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.

BasicManagedRepository.java 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package org.apache.archiva.repository;
  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.features.ArtifactCleanupFeature;
  21. import org.apache.archiva.repository.features.IndexCreationFeature;
  22. import org.apache.archiva.repository.features.StagingRepositoryFeature;
  23. import org.slf4j.Logger;
  24. import org.slf4j.LoggerFactory;
  25. import java.nio.file.Path;
  26. import java.util.Locale;
  27. /**
  28. *
  29. * Just a helper class, mainly used for unit tests.
  30. *
  31. *
  32. */
  33. public class BasicManagedRepository extends AbstractManagedRepository
  34. {
  35. Logger log = LoggerFactory.getLogger(BasicManagedRepository.class);
  36. ArtifactCleanupFeature artifactCleanupFeature = new ArtifactCleanupFeature( );
  37. StagingRepositoryFeature stagingRepositoryFeature = new StagingRepositoryFeature( );
  38. static final StandardCapabilities CAPABILITIES = new StandardCapabilities( new ReleaseScheme[] {
  39. ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT
  40. }, new String[] {"default"}, new String[0], new String[] {
  41. ArtifactCleanupFeature.class.toString(), IndexCreationFeature.class.toString(),
  42. StagingRepositoryFeature.class.toString()
  43. }, true, true, true, true, true );
  44. public BasicManagedRepository( String id, String name, Path basePath )
  45. {
  46. super( RepositoryType.MAVEN, id, name, basePath );
  47. initFeatures();
  48. }
  49. public BasicManagedRepository( Locale primaryLocale, RepositoryType type, String id, String name, Path basePath )
  50. {
  51. super( primaryLocale, type, id, name, basePath );
  52. initFeatures();
  53. }
  54. private void initFeatures() {
  55. IndexCreationFeature indexCreationFeature = new IndexCreationFeature(this, this);
  56. addFeature( artifactCleanupFeature );
  57. addFeature( indexCreationFeature );
  58. addFeature( stagingRepositoryFeature );
  59. }
  60. @Override
  61. public boolean hasIndex( )
  62. {
  63. return true;
  64. }
  65. @Override
  66. public RepositoryCapabilities getCapabilities( )
  67. {
  68. return CAPABILITIES;
  69. }
  70. @Override
  71. public RepositoryRequestInfo getRequestInfo() {
  72. return null;
  73. }
  74. }