You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IndexMergerRequest.java 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. import org.apache.archiva.repository.storage.StorageAsset;
  21. import java.nio.file.Path;
  22. import java.util.Collection;
  23. import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_INDEX_PATH;
  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. * will generate a downloadable index
  35. */
  36. private boolean packIndex;
  37. /**
  38. * original groupId (repositoryGroup id)
  39. */
  40. private String groupId;
  41. private String mergedIndexPath = DEFAULT_INDEX_PATH;
  42. private int mergedIndexTtl;
  43. private StorageAsset mergedIndexDirectory;
  44. private boolean temporary;
  45. public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
  46. {
  47. this.repositoriesIds = repositoriesIds;
  48. this.packIndex = packIndex;
  49. this.groupId = groupId;
  50. }
  51. /**
  52. * @since 1.4-M4
  53. */
  54. public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId,
  55. String mergedIndexPath, int mergedIndexTtl )
  56. {
  57. this.repositoriesIds = repositoriesIds;
  58. this.packIndex = packIndex;
  59. this.groupId = groupId;
  60. this.mergedIndexPath = mergedIndexPath;
  61. this.mergedIndexTtl = mergedIndexTtl;
  62. }
  63. public Collection<String> getRepositoriesIds()
  64. {
  65. return repositoriesIds;
  66. }
  67. public void setRepositoriesIds( Collection<String> repositoriesIds )
  68. {
  69. this.repositoriesIds = repositoriesIds;
  70. }
  71. public boolean isPackIndex()
  72. {
  73. return packIndex;
  74. }
  75. public void setPackIndex( boolean packIndex )
  76. {
  77. this.packIndex = packIndex;
  78. }
  79. public String getGroupId()
  80. {
  81. return groupId;
  82. }
  83. public void setGroupId( String groupId )
  84. {
  85. this.groupId = groupId;
  86. }
  87. public String getMergedIndexPath()
  88. {
  89. return mergedIndexPath;
  90. }
  91. public void setMergedIndexPath( String mergedIndexPath )
  92. {
  93. this.mergedIndexPath = mergedIndexPath;
  94. }
  95. public int getMergedIndexTtl()
  96. {
  97. return mergedIndexTtl;
  98. }
  99. public void setMergedIndexTtl( int mergedIndexTtl )
  100. {
  101. this.mergedIndexTtl = mergedIndexTtl;
  102. }
  103. public StorageAsset getMergedIndexDirectory()
  104. {
  105. return mergedIndexDirectory;
  106. }
  107. public void setMergedIndexDirectory( StorageAsset mergedIndexDirectory )
  108. {
  109. this.mergedIndexDirectory = mergedIndexDirectory;
  110. }
  111. public IndexMergerRequest mergedIndexDirectory( StorageAsset mergedIndexDirectory )
  112. {
  113. this.mergedIndexDirectory = mergedIndexDirectory;
  114. return this;
  115. }
  116. public boolean isTemporary()
  117. {
  118. return temporary;
  119. }
  120. public void setTemporary( boolean temporary )
  121. {
  122. this.temporary = temporary;
  123. }
  124. public IndexMergerRequest temporary( boolean temporary )
  125. {
  126. this.temporary = temporary;
  127. return this;
  128. }
  129. @Override
  130. public String toString()
  131. {
  132. final StringBuilder sb = new StringBuilder( "IndexMergerRequest{" );
  133. sb.append( "repositoriesIds=" ).append( repositoriesIds );
  134. sb.append( ", packIndex=" ).append( packIndex );
  135. sb.append( ", groupId='" ).append( groupId ).append( '\'' );
  136. sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
  137. sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
  138. sb.append( ", mergedIndexDirectory=" ).append( mergedIndexDirectory );
  139. sb.append( ", temporary=" ).append( temporary );
  140. sb.append( '}' );
  141. return sb.toString();
  142. }
  143. @Override
  144. public boolean equals( Object o )
  145. {
  146. if ( this == o )
  147. {
  148. return true;
  149. }
  150. if ( o == null || getClass() != o.getClass() )
  151. {
  152. return false;
  153. }
  154. IndexMergerRequest that = (IndexMergerRequest) o;
  155. return groupId.equals( that.groupId );
  156. }
  157. @Override
  158. public int hashCode()
  159. {
  160. return groupId.hashCode();
  161. }
  162. }