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.

BasicRemoteRepository.java 2.5KB

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