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.7KB

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