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.

RepositoryTask.java 3.9KB

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