This project has retired. For details please refer to its Attic page.
IndexMergerRequest xref
View Javadoc
1   package org.apache.archiva.indexer.merger;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   * http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import org.apache.archiva.repository.storage.StorageAsset;
22  
23  import java.nio.file.Path;
24  import java.util.Collection;
25  
26  import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_INDEX_PATH;
27  
28  /**
29   * @author Olivier Lamy
30   */
31  public class IndexMergerRequest
32  {
33      /**
34       * repositories Ids to merge content
35       */
36      private Collection<String> repositoriesIds;
37  
38      /**
39       * will generate a downloadable index
40       */
41      private boolean packIndex;
42  
43      /**
44       * original groupId (repositoryGroup id)
45       */
46      private String groupId;
47  
48      private String mergedIndexPath = DEFAULT_INDEX_PATH;
49  
50      private int mergedIndexTtl;
51  
52      private StorageAsset mergedIndexDirectory;
53  
54      private boolean temporary;
55  
56      public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
57      {
58          this.repositoriesIds = repositoriesIds;
59          this.packIndex = packIndex;
60          this.groupId = groupId;
61      }
62  
63      /**
64       * @since 1.4-M4
65       */
66      public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId,
67                                 String mergedIndexPath, int mergedIndexTtl )
68      {
69          this.repositoriesIds = repositoriesIds;
70          this.packIndex = packIndex;
71          this.groupId = groupId;
72          this.mergedIndexPath = mergedIndexPath;
73          this.mergedIndexTtl = mergedIndexTtl;
74      }
75  
76      public Collection<String> getRepositoriesIds()
77      {
78          return repositoriesIds;
79      }
80  
81      public void setRepositoriesIds( Collection<String> repositoriesIds )
82      {
83          this.repositoriesIds = repositoriesIds;
84      }
85  
86      public boolean isPackIndex()
87      {
88          return packIndex;
89      }
90  
91      public void setPackIndex( boolean packIndex )
92      {
93          this.packIndex = packIndex;
94      }
95  
96      public String getGroupId()
97      {
98          return groupId;
99      }
100 
101     public void setGroupId( String groupId )
102     {
103         this.groupId = groupId;
104     }
105 
106     public String getMergedIndexPath()
107     {
108         return mergedIndexPath;
109     }
110 
111     public void setMergedIndexPath( String mergedIndexPath )
112     {
113         this.mergedIndexPath = mergedIndexPath;
114     }
115 
116     public int getMergedIndexTtl()
117     {
118         return mergedIndexTtl;
119     }
120 
121     public void setMergedIndexTtl( int mergedIndexTtl )
122     {
123         this.mergedIndexTtl = mergedIndexTtl;
124     }
125 
126     public StorageAsset getMergedIndexDirectory()
127     {
128         return mergedIndexDirectory;
129     }
130 
131     public void setMergedIndexDirectory( StorageAsset mergedIndexDirectory )
132     {
133         this.mergedIndexDirectory = mergedIndexDirectory;
134     }
135 
136     public IndexMergerRequest mergedIndexDirectory( StorageAsset mergedIndexDirectory )
137     {
138         this.mergedIndexDirectory = mergedIndexDirectory;
139         return this;
140     }
141 
142     public boolean isTemporary()
143     {
144         return temporary;
145     }
146 
147     public void setTemporary( boolean temporary )
148     {
149         this.temporary = temporary;
150     }
151 
152 
153     public IndexMergerRequest temporary( boolean temporary )
154     {
155         this.temporary = temporary;
156         return this;
157     }
158 
159     @Override
160     public String toString()
161     {
162         final StringBuilder sb = new StringBuilder( "IndexMergerRequest{" );
163         sb.append( "repositoriesIds=" ).append( repositoriesIds );
164         sb.append( ", packIndex=" ).append( packIndex );
165         sb.append( ", groupId='" ).append( groupId ).append( '\'' );
166         sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
167         sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
168         sb.append( ", mergedIndexDirectory=" ).append( mergedIndexDirectory );
169         sb.append( ", temporary=" ).append( temporary );
170         sb.append( '}' );
171         return sb.toString();
172     }
173 
174     @Override
175     public boolean equals( Object o )
176     {
177         if ( this == o )
178         {
179             return true;
180         }
181         if ( o == null || getClass() != o.getClass() )
182         {
183             return false;
184         }
185 
186         IndexMergerRequest./../org/apache/archiva/indexer/merger/IndexMergerRequest.html#IndexMergerRequest">IndexMergerRequest that = (IndexMergerRequest) o;
187 
188         return groupId.equals( that.groupId );
189     }
190 
191     @Override
192     public int hashCode()
193     {
194         return groupId.hashCode();
195     }
196 }