Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

KnownScanConsumer.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package org.apache.archiva.repository.scanner;
  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.admin.model.beans.ManagedRepository;
  21. import org.apache.archiva.consumers.AbstractMonitoredConsumer;
  22. import org.apache.archiva.consumers.ConsumerException;
  23. import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
  24. import org.springframework.context.annotation.Scope;
  25. import org.springframework.stereotype.Service;
  26. import java.util.ArrayList;
  27. import java.util.Arrays;
  28. import java.util.Date;
  29. import java.util.List;
  30. /**
  31. * ScanConsumer
  32. *
  33. *
  34. */
  35. public class KnownScanConsumer
  36. extends AbstractMonitoredConsumer
  37. implements KnownRepositoryContentConsumer
  38. {
  39. private int processCount = 0;
  40. private List<String> includes = new ArrayList<>();
  41. private boolean processUnmodified = false;
  42. public List<String> getExcludes()
  43. {
  44. return null;
  45. }
  46. public void setIncludes( String includesArray[] )
  47. {
  48. this.includes.clear();
  49. this.includes.addAll( Arrays.asList( includesArray ) );
  50. }
  51. public List<String> getIncludes()
  52. {
  53. return includes;
  54. }
  55. public String getId()
  56. {
  57. return "test-scan-consumer";
  58. }
  59. public String getDescription()
  60. {
  61. return "Scan Consumer (for testing)";
  62. }
  63. public void beginScan( ManagedRepository repository, Date whenGathered )
  64. throws ConsumerException
  65. {
  66. /* do nothing */
  67. }
  68. public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
  69. throws ConsumerException
  70. {
  71. beginScan( repository, whenGathered );
  72. }
  73. public void processFile( String path )
  74. throws ConsumerException
  75. {
  76. this.processCount++;
  77. }
  78. public void processFile( String path, boolean executeOnEntireRepo )
  79. throws Exception
  80. {
  81. processFile( path );
  82. }
  83. public void completeScan()
  84. {
  85. /* do nothing */
  86. }
  87. public void completeScan( boolean executeOnEntireRepo )
  88. {
  89. completeScan();
  90. }
  91. public int getProcessCount()
  92. {
  93. return processCount;
  94. }
  95. public void setProcessCount( int processCount )
  96. {
  97. this.processCount = processCount;
  98. }
  99. public boolean isPermanent()
  100. {
  101. return false;
  102. }
  103. public boolean isProcessUnmodified()
  104. {
  105. return processUnmodified;
  106. }
  107. public void setProcessUnmodified( boolean processUnmodified )
  108. {
  109. this.processUnmodified = processUnmodified;
  110. }
  111. }