org.apache.archiva.metadata.repository
Class DefaultMetadataResolver
java.lang.Object
org.apache.archiva.metadata.repository.DefaultMetadataResolver
- All Implemented Interfaces:
- MetadataResolver
@Service(value="metadataResolver#default")
public class DefaultMetadataResolver
- extends Object
- implements MetadataResolver
Default implementation of the metadata resolver API. At present it will handle updating the content repository
from new or changed information in the model and artifacts from the repository storage.
This is a singleton component to allow an alternate implementation to be provided. It is intended to be the same
system-wide for the whole content repository instead of on a per-managed-repository basis. Therefore, the session is
passed in as an argument to obtain any necessary resources, rather than the class being instantiated within the
session in the context of a single managed repository's resolution needs.
Note that the caller is responsible for the session, such as closing and saving (which is implied by the resolver
being obtained from within the session). The RepositorySession.markDirty()
method is used as a hint to ensure
that the session knows we've made changes at close. We cannot ensure the changes will be persisted if the caller
chooses to revert first. This is preferable to storing the metadata immediately - a separate session would require
having a bi-directional link with the session factory, and saving the existing session might save other changes
unknowingly by the caller.
Method Summary |
private Collection<String> |
createArtifactIdList(Collection<ArtifactMetadata> artifacts)
|
Collection<ArtifactMetadata> |
resolveArtifacts(RepositorySession session,
String repoId,
String namespace,
String projectId,
String projectVersion)
|
Collection<String> |
resolveNamespaces(RepositorySession session,
String repoId,
String namespace)
|
Collection<ProjectVersionReference> |
resolveProjectReferences(RepositorySession session,
String repoId,
String namespace,
String projectId,
String projectVersion)
Retrieve project references from the metadata repository. |
Collection<String> |
resolveProjects(RepositorySession session,
String repoId,
String namespace)
|
ProjectVersionMetadata |
resolveProjectVersion(RepositorySession session,
String repoId,
String namespace,
String projectId,
String projectVersion)
|
Collection<String> |
resolveProjectVersions(RepositorySession session,
String repoId,
String namespace,
String projectId)
|
Collection<String> |
resolveRootNamespaces(RepositorySession session,
String repoId)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private org.slf4j.Logger log
repositoryStorage
@Inject
@Named(value="repositoryStorage#maven2")
private RepositoryStorage repositoryStorage
- FIXME: this needs to be configurable based on storage type - and could also be instantiated per repo. Change to a
factory, and perhaps retrieve from the session. We should avoid creating one per request, however.
TODO: Also need to accommodate availability of proxy module
... could be a different type since we need methods to modify the storage metadata, which would also allow more
appropriate methods to pass in the already determined repository configuration, for example, instead of the ID
listeners
@Inject
private List<RepositoryListener> listeners
DefaultMetadataResolver
public DefaultMetadataResolver()
resolveProjectVersion
public ProjectVersionMetadata resolveProjectVersion(RepositorySession session,
String repoId,
String namespace,
String projectId,
String projectVersion)
throws MetadataResolutionException
- Specified by:
resolveProjectVersion
in interface MetadataResolver
- Throws:
MetadataResolutionException
resolveProjectReferences
public Collection<ProjectVersionReference> resolveProjectReferences(RepositorySession session,
String repoId,
String namespace,
String projectId,
String projectVersion)
throws MetadataResolutionException
- Description copied from interface:
MetadataResolver
- Retrieve project references from the metadata repository. Note that this is not built into the content model for
a project version as a reference may be present (due to reverse-lookup of dependencies) before the actual
project is, and we want to avoid adding a stub model to the content repository.
- Specified by:
resolveProjectReferences
in interface MetadataResolver
repoId
- the repository ID to look withinnamespace
- the namespace of the project to get references toprojectId
- the identifier of the project to get references toprojectVersion
- the version of the project to get references to
- Returns:
- a list of project references
- Throws:
MetadataResolutionException
resolveRootNamespaces
public Collection<String> resolveRootNamespaces(RepositorySession session,
String repoId)
throws MetadataResolutionException
- Specified by:
resolveRootNamespaces
in interface MetadataResolver
- Throws:
MetadataResolutionException
resolveNamespaces
public Collection<String> resolveNamespaces(RepositorySession session,
String repoId,
String namespace)
throws MetadataResolutionException
- Specified by:
resolveNamespaces
in interface MetadataResolver
- Throws:
MetadataResolutionException
resolveProjects
public Collection<String> resolveProjects(RepositorySession session,
String repoId,
String namespace)
throws MetadataResolutionException
- Specified by:
resolveProjects
in interface MetadataResolver
- Throws:
MetadataResolutionException
resolveProjectVersions
public Collection<String> resolveProjectVersions(RepositorySession session,
String repoId,
String namespace,
String projectId)
throws MetadataResolutionException
- Specified by:
resolveProjectVersions
in interface MetadataResolver
- Throws:
MetadataResolutionException
resolveArtifacts
public Collection<ArtifactMetadata> resolveArtifacts(RepositorySession session,
String repoId,
String namespace,
String projectId,
String projectVersion)
throws MetadataResolutionException
- Specified by:
resolveArtifacts
in interface MetadataResolver
- Throws:
MetadataResolutionException
createArtifactIdList
private Collection<String> createArtifactIdList(Collection<ArtifactMetadata> artifacts)
Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.