org.apache.archiva.rest.services
Class DefaultBrowseService

java.lang.Object
  extended by org.apache.archiva.rest.services.AbstractRestService
      extended by org.apache.archiva.rest.services.DefaultBrowseService
All Implemented Interfaces:
BrowseService

@Service(value="browseService#rest")
public class DefaultBrowseService
extends AbstractRestService
implements BrowseService

Since:
1.4-M3
Author:
Olivier Lamy

Field Summary
private  RepositoryProxyConnectors connectors
           
private  DependencyTreeBuilder dependencyTreeBuilder
           
private  RepositoryContentFactory repositoryContentFactory
           
 
Fields inherited from class org.apache.archiva.rest.services.AbstractRestService
archivaAdministration, config, httpServletRequest, log, managedRepositoryAdmin, repositorySessionFactory, repositoryTaskScheduler, userRepositories
 
Constructor Summary
DefaultBrowseService()
           
 
Method Summary
 Boolean addMetadata(String groupId, String artifactId, String version, String key, String value, String repositoryId)
           
 Boolean artifactAvailable(String groupId, String artifactId, String version, String repositoryId)
          verify if an artifact is available locally if not download from proxies will be try
 Boolean artifactAvailable(String groupId, String artifactId, String version, String classifier, String repositoryId)
          verify if an artifact is available locally if not download from proxies will be try
 BrowseResult browseGroupId(String groupId, String repositoryId)
           
private  void closeQuietly(JarFile jarFile)
           
private  String collapseNamespaces(RepositorySession repositorySession, MetadataResolver metadataResolver, Collection<String> repoIds, String n)
           
 Boolean deleteMetadata(String groupId, String artifactId, String version, String key, String repositoryId)
           
 List<ArtifactContentEntry> getArtifactContentEntries(String groupId, String artifactId, String version, String classifier, String type, String path, String repositoryId)
           
 ArtifactContent getArtifactContentText(String groupId, String artifactId, String version, String classifier, String type, String path, String repositoryId)
          if path is empty content of the file is returned (for pom view)
 List<Artifact> getArtifactDownloadInfos(String groupId, String artifactId, String version, String repositoryId)
           
 List<Artifact> getArtifacts(String repositoryId)
          return List of all artifacts from this repository
 List<Artifact> getDependees(String groupId, String artifactId, String version, String repositoryId)
          List of artifacts using the artifact passed in parameter.
 List<Entry> getMetadatas(String groupId, String artifactId, String version, String repositoryId)
           
 ProjectVersionMetadata getProjectMetadata(String groupId, String artifactId, String version, String repositoryId)
           
 ProjectVersionMetadata getProjectVersionMetadata(String groupId, String artifactId, String repositoryId)
           
 BrowseResult getRootGroups(String repositoryId)
           
private  String getRootPath(String path)
           
private  List<String> getSelectedRepos(String repositoryId)
           
private  List<ArtifactContentEntry> getSmallerDepthEntries(Map<String,ArtifactContentEntry> entries)
           
 List<TreeEntry> getTreeEntries(String groupId, String artifactId, String version, String repositoryId)
          return the dependency Tree for an artifacts the List result has only one entry
 List<ManagedRepository> getUserRepositories()
           
private  Collection<String> getVersions(List<String> selectedRepos, String groupId, String artifactId)
           
 VersionsList getVersionsList(String groupId, String artifactId, String repositoryId)
           
 Boolean importMetadata(MetadataAddRequest metadataAddRequest, String repositoryId)
           
protected  List<ArtifactContentEntry> readFileEntries(File file, String filterPath, String repoId)
           
 
Methods inherited from class org.apache.archiva.rest.services.AbstractRestService
buildArtifacts, doScanRepository, getArtifactUrl, getAuditInformation, getAuditListeners, getBaseUrl, getBeansOfType, getObservableRepos, getPrincipal, setAuditListeners, triggerAuditEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dependencyTreeBuilder

@Inject
private DependencyTreeBuilder dependencyTreeBuilder

repositoryContentFactory

@Inject
private RepositoryContentFactory repositoryContentFactory

connectors

@Inject
@Named(value="repositoryProxyConnectors#default")
private RepositoryProxyConnectors connectors
Constructor Detail

DefaultBrowseService

public DefaultBrowseService()
Method Detail

getRootGroups

public BrowseResult getRootGroups(String repositoryId)
                           throws ArchivaRestServiceException
Specified by:
getRootGroups in interface BrowseService
Throws:
ArchivaRestServiceException

browseGroupId

public BrowseResult browseGroupId(String groupId,
                                  String repositoryId)
                           throws ArchivaRestServiceException
Specified by:
browseGroupId in interface BrowseService
Parameters:
groupId - groupId to browse
repositoryId - optionnal (repository to browse if null all available user repositories are used)
Throws:
ArchivaRestServiceException

getVersionsList

public VersionsList getVersionsList(String groupId,
                                    String artifactId,
                                    String repositoryId)
                             throws ArchivaRestServiceException
Specified by:
getVersionsList in interface BrowseService
Throws:
ArchivaRestServiceException

getVersions

private Collection<String> getVersions(List<String> selectedRepos,
                                       String groupId,
                                       String artifactId)
                                throws MetadataResolutionException
Throws:
MetadataResolutionException

getProjectMetadata

public ProjectVersionMetadata getProjectMetadata(String groupId,
                                                 String artifactId,
                                                 String version,
                                                 String repositoryId)
                                          throws ArchivaRestServiceException
Specified by:
getProjectMetadata in interface BrowseService
Throws:
ArchivaRestServiceException

getProjectVersionMetadata

public ProjectVersionMetadata getProjectVersionMetadata(String groupId,
                                                        String artifactId,
                                                        String repositoryId)
                                                 throws ArchivaRestServiceException
Specified by:
getProjectVersionMetadata in interface BrowseService
Throws:
ArchivaRestServiceException

getTreeEntries

public List<TreeEntry> getTreeEntries(String groupId,
                                      String artifactId,
                                      String version,
                                      String repositoryId)
                               throws ArchivaRestServiceException
Description copied from interface: BrowseService
return the dependency Tree for an artifacts the List result has only one entry

Specified by:
getTreeEntries in interface BrowseService
Throws:
ArchivaRestServiceException

getUserRepositories

public List<ManagedRepository> getUserRepositories()
                                            throws ArchivaRestServiceException
Specified by:
getUserRepositories in interface BrowseService
Returns:
List of managed repositories current user can read
Throws:
ArchivaRestServiceException

getDependees

public List<Artifact> getDependees(String groupId,
                                   String artifactId,
                                   String version,
                                   String repositoryId)
                            throws ArchivaRestServiceException
Description copied from interface: BrowseService
List of artifacts using the artifact passed in parameter.

Specified by:
getDependees in interface BrowseService
Throws:
ArchivaRestServiceException

getMetadatas

public List<Entry> getMetadatas(String groupId,
                                String artifactId,
                                String version,
                                String repositoryId)
                         throws ArchivaRestServiceException
Specified by:
getMetadatas in interface BrowseService
Throws:
ArchivaRestServiceException

addMetadata

public Boolean addMetadata(String groupId,
                           String artifactId,
                           String version,
                           String key,
                           String value,
                           String repositoryId)
                    throws ArchivaRestServiceException
Specified by:
addMetadata in interface BrowseService
Throws:
ArchivaRestServiceException

deleteMetadata

public Boolean deleteMetadata(String groupId,
                              String artifactId,
                              String version,
                              String key,
                              String repositoryId)
                       throws ArchivaRestServiceException
Specified by:
deleteMetadata in interface BrowseService
Throws:
ArchivaRestServiceException

getArtifactContentEntries

public List<ArtifactContentEntry> getArtifactContentEntries(String groupId,
                                                            String artifactId,
                                                            String version,
                                                            String classifier,
                                                            String type,
                                                            String path,
                                                            String repositoryId)
                                                     throws ArchivaRestServiceException
Specified by:
getArtifactContentEntries in interface BrowseService
Throws:
ArchivaRestServiceException

getArtifactDownloadInfos

public List<Artifact> getArtifactDownloadInfos(String groupId,
                                               String artifactId,
                                               String version,
                                               String repositoryId)
                                        throws ArchivaRestServiceException
Specified by:
getArtifactDownloadInfos in interface BrowseService
Throws:
ArchivaRestServiceException

getArtifactContentText

public ArtifactContent getArtifactContentText(String groupId,
                                              String artifactId,
                                              String version,
                                              String classifier,
                                              String type,
                                              String path,
                                              String repositoryId)
                                       throws ArchivaRestServiceException
Description copied from interface: BrowseService
if path is empty content of the file is returned (for pom view)

Specified by:
getArtifactContentText in interface BrowseService
Throws:
ArchivaRestServiceException

artifactAvailable

public Boolean artifactAvailable(String groupId,
                                 String artifactId,
                                 String version,
                                 String classifier,
                                 String repositoryId)
                          throws ArchivaRestServiceException
Description copied from interface: BrowseService
verify if an artifact is available locally if not download from proxies will be try

Specified by:
artifactAvailable in interface BrowseService
Throws:
ArchivaRestServiceException

artifactAvailable

public Boolean artifactAvailable(String groupId,
                                 String artifactId,
                                 String version,
                                 String repositoryId)
                          throws ArchivaRestServiceException
Description copied from interface: BrowseService
verify if an artifact is available locally if not download from proxies will be try

Specified by:
artifactAvailable in interface BrowseService
Throws:
ArchivaRestServiceException

getArtifacts

public List<Artifact> getArtifacts(String repositoryId)
                            throws ArchivaRestServiceException
Description copied from interface: BrowseService
return List of all artifacts from this repository

Specified by:
getArtifacts in interface BrowseService
Returns:
Throws:
ArchivaRestServiceException

importMetadata

public Boolean importMetadata(MetadataAddRequest metadataAddRequest,
                              String repositoryId)
                       throws ArchivaRestServiceException
Specified by:
importMetadata in interface BrowseService
Throws:
ArchivaRestServiceException

closeQuietly

private void closeQuietly(JarFile jarFile)

readFileEntries

protected List<ArtifactContentEntry> readFileEntries(File file,
                                                     String filterPath,
                                                     String repoId)
                                              throws IOException
Throws:
IOException

getSmallerDepthEntries

private List<ArtifactContentEntry> getSmallerDepthEntries(Map<String,ArtifactContentEntry> entries)

getRootPath

private String getRootPath(String path)
Parameters:
path -
Returns:
org/apache -> org , org -> org

getSelectedRepos

private List<String> getSelectedRepos(String repositoryId)
                               throws ArchivaRestServiceException
Throws:
ArchivaRestServiceException

collapseNamespaces

private String collapseNamespaces(RepositorySession repositorySession,
                                  MetadataResolver metadataResolver,
                                  Collection<String> repoIds,
                                  String n)
                           throws MetadataResolutionException
Throws:
MetadataResolutionException


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.