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.

ManagedRepositoryContentMock.java 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. package org.apache.archiva.repository.mock;
  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.model.ArchivaArtifact;
  21. import org.apache.archiva.model.ArtifactReference;
  22. import org.apache.archiva.model.ProjectReference;
  23. import org.apache.archiva.model.VersionedReference;
  24. import org.apache.archiva.repository.ContentNotFoundException;
  25. import org.apache.archiva.repository.ManagedRepository;
  26. import org.apache.archiva.repository.ManagedRepositoryContent;
  27. import org.apache.archiva.repository.RepositoryException;
  28. import org.apache.archiva.repository.layout.LayoutException;
  29. import org.springframework.stereotype.Service;
  30. import java.net.URI;
  31. import java.nio.file.Path;
  32. import java.nio.file.Paths;
  33. import java.util.Set;
  34. /**
  35. * @author Martin Stockhammer <martin_s@apache.org>
  36. */
  37. @Service("managedRepositoryContent#mock")
  38. public class ManagedRepositoryContentMock implements ManagedRepositoryContent
  39. {
  40. private ManagedRepository repository;
  41. @Override
  42. public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException
  43. {
  44. }
  45. @Override
  46. public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException
  47. {
  48. }
  49. @Override
  50. public void deleteGroupId( String groupId ) throws ContentNotFoundException
  51. {
  52. }
  53. @Override
  54. public void deleteProject( String namespace, String projectId ) throws RepositoryException
  55. {
  56. }
  57. @Override
  58. public String getId( )
  59. {
  60. return null;
  61. }
  62. @Override
  63. public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) throws ContentNotFoundException
  64. {
  65. return null;
  66. }
  67. @Override
  68. public String getRepoRoot()
  69. {
  70. return convertUriToPath( repository.getLocation() );
  71. }
  72. private String convertUriToPath( URI uri ) {
  73. if (uri.getScheme()==null) {
  74. return Paths.get(uri.getPath()).toString();
  75. } else if ("file".equals(uri.getScheme())) {
  76. return Paths.get(uri).toString();
  77. } else {
  78. return uri.toString();
  79. }
  80. }
  81. @Override
  82. public ManagedRepository getRepository( )
  83. {
  84. return repository;
  85. }
  86. @Override
  87. public Set<String> getVersions( ProjectReference reference ) throws ContentNotFoundException, LayoutException
  88. {
  89. return null;
  90. }
  91. @Override
  92. public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException
  93. {
  94. return null;
  95. }
  96. @Override
  97. public boolean hasContent( ArtifactReference reference )
  98. {
  99. return false;
  100. }
  101. @Override
  102. public boolean hasContent( ProjectReference reference )
  103. {
  104. return false;
  105. }
  106. @Override
  107. public boolean hasContent( VersionedReference reference )
  108. {
  109. return false;
  110. }
  111. @Override
  112. public void setRepository( ManagedRepository repo )
  113. {
  114. this.repository = repo;
  115. }
  116. @Override
  117. public ArtifactReference toArtifactReference( String path ) throws LayoutException
  118. {
  119. return null;
  120. }
  121. @Override
  122. public Path toFile( ArtifactReference reference )
  123. {
  124. return null;
  125. }
  126. @Override
  127. public Path toFile( ArchivaArtifact reference )
  128. {
  129. return null;
  130. }
  131. @Override
  132. public String toMetadataPath( ProjectReference reference )
  133. {
  134. return null;
  135. }
  136. @Override
  137. public String toMetadataPath( VersionedReference reference )
  138. {
  139. return null;
  140. }
  141. @Override
  142. public String toPath( ArtifactReference reference )
  143. {
  144. return null;
  145. }
  146. @Override
  147. public String toPath( ArchivaArtifact reference )
  148. {
  149. return null;
  150. }
  151. }