This project has retired. For details please refer to its Attic page.
RepositoryTask xref
View Javadoc
1   package org.apache.archiva.scheduler.repository.model;
2   
3   import org.apache.archiva.redback.components.taskqueue.Task;
4   
5   import java.io.File;
6   
7   /*
8    * Licensed to the Apache Software Foundation (ASF) under one
9    * or more contributor license agreements.  See the NOTICE file
10   * distributed with this work for additional information
11   * regarding copyright ownership.  The ASF licenses this file
12   * to you under the Apache License, Version 2.0 (the
13   * "License"); you may not use this file except in compliance
14   * with the License.  You may obtain a copy of the License at
15   *
16   *   http://www.apache.org/licenses/LICENSE-2.0
17   *
18   * Unless required by applicable law or agreed to in writing,
19   * software distributed under the License is distributed on an
20   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21   * KIND, either express or implied.  See the License for the
22   * specific language governing permissions and limitations
23   * under the License.
24   */
25  
26  /**
27   * DataRefreshTask - task for discovering changes in the repository
28   * and updating all associated data.
29   */
30  public class RepositoryTask
31      implements Task
32  {
33      private String repositoryId;
34  
35      private File resourceFile;
36  
37      private boolean updateRelatedArtifacts;
38  
39      private boolean scanAll;
40  
41      public RepositoryTask()
42      {
43          // no op
44      }
45  
46      public RepositoryTask( String repositoryId )
47      {
48          this.repositoryId = repositoryId;
49      }
50  
51      public RepositoryTask( String repositoryId, boolean scanAll )
52      {
53          this.repositoryId = repositoryId;
54          this.scanAll = scanAll;
55      }
56  
57      public boolean isScanAll()
58      {
59          return scanAll;
60      }
61  
62      public void setScanAll( boolean scanAll )
63      {
64          this.scanAll = scanAll;
65      }
66  
67      public String getRepositoryId()
68      {
69          return repositoryId;
70      }
71  
72      public void setRepositoryId( String repositoryId )
73      {
74          this.repositoryId = repositoryId;
75      }
76  
77      @Override
78      public long getMaxExecutionTime()
79      {
80          return 0;
81      }
82  
83      public File getResourceFile()
84      {
85          return resourceFile;
86      }
87  
88      public void setResourceFile( File resourceFile )
89      {
90          this.resourceFile = resourceFile;
91      }
92  
93      public boolean isUpdateRelatedArtifacts()
94      {
95          return updateRelatedArtifacts;
96      }
97  
98      public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts )
99      {
100         this.updateRelatedArtifacts = updateRelatedArtifacts;
101     }
102 
103     @Override
104     public String toString()
105     {
106         return "RepositoryTask [repositoryId=" + repositoryId + ", resourceFile=" + resourceFile + ", scanAll="
107             + scanAll + ", updateRelatedArtifacts=" + updateRelatedArtifacts + "]";
108     }
109 
110     @Override
111     public int hashCode()
112     {
113         final int prime = 31;
114         int result = 1;
115         result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );
116         result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );
117         return result;
118     }
119 
120     @Override
121     public boolean equals( Object obj )
122     {
123         if ( this == obj )
124         {
125             return true;
126         }
127         if ( obj == null )
128         {
129             return false;
130         }
131         if ( getClass() != obj.getClass() )
132         {
133             return false;
134         }
135         RepositoryTask other = (RepositoryTask) obj;
136         if ( repositoryId == null )
137         {
138             if ( other.repositoryId != null )
139             {
140                 return false;
141             }
142         }
143         else if ( !repositoryId.equals( other.repositoryId ) )
144         {
145             return false;
146         }
147         if ( resourceFile == null )
148         {
149             if ( other.resourceFile != null )
150             {
151                 return false;
152             }
153         }
154         else if ( !resourceFile.equals( other.resourceFile ) )
155         {
156             return false;
157         }
158         return true;
159     }
160 }