001 package org.apache.archiva.scheduler.repository.model; 002 003 import org.apache.archiva.redback.components.taskqueue.Task; 004 005 import java.io.File; 006 007 /* 008 * Licensed to the Apache Software Foundation (ASF) under one 009 * or more contributor license agreements. See the NOTICE file 010 * distributed with this work for additional information 011 * regarding copyright ownership. The ASF licenses this file 012 * to you under the Apache License, Version 2.0 (the 013 * "License"); you may not use this file except in compliance 014 * with the License. You may obtain a copy of the License at 015 * 016 * http://www.apache.org/licenses/LICENSE-2.0 017 * 018 * Unless required by applicable law or agreed to in writing, 019 * software distributed under the License is distributed on an 020 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 021 * KIND, either express or implied. See the License for the 022 * specific language governing permissions and limitations 023 * under the License. 024 */ 025 026 /** 027 * DataRefreshTask - task for discovering changes in the repository 028 * and updating all associated data. 029 * 030 * 031 */ 032 public class RepositoryTask 033 implements Task 034 { 035 private String repositoryId; 036 037 private File resourceFile; 038 039 private boolean updateRelatedArtifacts; 040 041 private boolean scanAll; 042 043 public boolean isScanAll() 044 { 045 return scanAll; 046 } 047 048 public void setScanAll( boolean scanAll ) 049 { 050 this.scanAll = scanAll; 051 } 052 053 public String getRepositoryId() 054 { 055 return repositoryId; 056 } 057 058 public void setRepositoryId( String repositoryId ) 059 { 060 this.repositoryId = repositoryId; 061 } 062 063 public long getMaxExecutionTime() 064 { 065 return 0; 066 } 067 068 public File getResourceFile() 069 { 070 return resourceFile; 071 } 072 073 public void setResourceFile( File resourceFile ) 074 { 075 this.resourceFile = resourceFile; 076 } 077 078 public boolean isUpdateRelatedArtifacts() 079 { 080 return updateRelatedArtifacts; 081 } 082 083 public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts ) 084 { 085 this.updateRelatedArtifacts = updateRelatedArtifacts; 086 } 087 088 @Override 089 public String toString() 090 { 091 return "RepositoryTask [repositoryId=" + repositoryId + ", resourceFile=" + resourceFile + ", scanAll=" 092 + scanAll + ", updateRelatedArtifacts=" + updateRelatedArtifacts + "]"; 093 } 094 095 @Override 096 public int hashCode() 097 { 098 final int prime = 31; 099 int result = 1; 100 result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() ); 101 result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() ); 102 return result; 103 } 104 105 @Override 106 public boolean equals( Object obj ) 107 { 108 if ( this == obj ) 109 { 110 return true; 111 } 112 if ( obj == null ) 113 { 114 return false; 115 } 116 if ( getClass() != obj.getClass() ) 117 { 118 return false; 119 } 120 RepositoryTask other = (RepositoryTask) obj; 121 if ( repositoryId == null ) 122 { 123 if ( other.repositoryId != null ) 124 { 125 return false; 126 } 127 } 128 else if ( !repositoryId.equals( other.repositoryId ) ) 129 { 130 return false; 131 } 132 if ( resourceFile == null ) 133 { 134 if ( other.resourceFile != null ) 135 { 136 return false; 137 } 138 } 139 else if ( !resourceFile.equals( other.resourceFile ) ) 140 { 141 return false; 142 } 143 return true; 144 } 145 }