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 java.io.File;
22  import java.util.Collection;
23  
24  /**
25   * @author Olivier Lamy
26   */
27  public class IndexMergerRequest
28  {
29      /**
30       * repositories Ids to merge content
31       */
32      private Collection<String> repositoriesIds;
33  
34      /**
35       * will generate a downloadable index
36       */
37      private boolean packIndex;
38  
39      /**
40       * original groupId (repositoryGroup id)
41       */
42      private String groupId;
43  
44      private String mergedIndexPath = "/.indexer";
45  
46      private int mergedIndexTtl;
47  
48      private File mergedIndexDirectory;
49  
50      private boolean temporary;
51  
52      public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
53      {
54          this.repositoriesIds = repositoriesIds;
55          this.packIndex = packIndex;
56          this.groupId = groupId;
57      }
58  
59      /**
60       * @since 1.4-M4
61       */
62      public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId,
63                                 String mergedIndexPath, int mergedIndexTtl )
64      {
65          this.repositoriesIds = repositoriesIds;
66          this.packIndex = packIndex;
67          this.groupId = groupId;
68          this.mergedIndexPath = mergedIndexPath;
69          this.mergedIndexTtl = mergedIndexTtl;
70      }
71  
72      public Collection<String> getRepositoriesIds()
73      {
74          return repositoriesIds;
75      }
76  
77      public void setRepositoriesIds( Collection<String> repositoriesIds )
78      {
79          this.repositoriesIds = repositoriesIds;
80      }
81  
82      public boolean isPackIndex()
83      {
84          return packIndex;
85      }
86  
87      public void setPackIndex( boolean packIndex )
88      {
89          this.packIndex = packIndex;
90      }
91  
92      public String getGroupId()
93      {
94          return groupId;
95      }
96  
97      public void setGroupId( String groupId )
98      {
99          this.groupId = groupId;
100     }
101 
102     public String getMergedIndexPath()
103     {
104         return mergedIndexPath;
105     }
106 
107     public void setMergedIndexPath( String mergedIndexPath )
108     {
109         this.mergedIndexPath = mergedIndexPath;
110     }
111 
112     public int getMergedIndexTtl()
113     {
114         return mergedIndexTtl;
115     }
116 
117     public void setMergedIndexTtl( int mergedIndexTtl )
118     {
119         this.mergedIndexTtl = mergedIndexTtl;
120     }
121 
122     public File getMergedIndexDirectory()
123     {
124         return mergedIndexDirectory;
125     }
126 
127     public void setMergedIndexDirectory( File mergedIndexDirectory )
128     {
129         this.mergedIndexDirectory = mergedIndexDirectory;
130     }
131 
132     public IndexMergerRequest mergedIndexDirectory( File mergedIndexDirectory )
133     {
134         this.mergedIndexDirectory = mergedIndexDirectory;
135         return this;
136     }
137 
138     public boolean isTemporary()
139     {
140         return temporary;
141     }
142 
143     public void setTemporary( boolean temporary )
144     {
145         this.temporary = temporary;
146     }
147 
148 
149     public IndexMergerRequest temporary( boolean temporary )
150     {
151         this.temporary = temporary;
152         return this;
153     }
154 
155     @Override
156     public String toString()
157     {
158         final StringBuilder sb = new StringBuilder( "IndexMergerRequest{" );
159         sb.append( "repositoriesIds=" ).append( repositoriesIds );
160         sb.append( ", packIndex=" ).append( packIndex );
161         sb.append( ", groupId='" ).append( groupId ).append( '\'' );
162         sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
163         sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
164         sb.append( ", mergedIndexDirectory=" ).append( mergedIndexDirectory );
165         sb.append( ", temporary=" ).append( temporary );
166         sb.append( '}' );
167         return sb.toString();
168     }
169 
170     @Override
171     public boolean equals( Object o )
172     {
173         if ( this == o )
174         {
175             return true;
176         }
177         if ( o == null || getClass() != o.getClass() )
178         {
179             return false;
180         }
181 
182         IndexMergerRequest that = (IndexMergerRequest) o;
183 
184         return groupId.equals( that.groupId );
185     }
186 
187     @Override
188     public int hashCode()
189     {
190         return groupId.hashCode();
191     }
192 }