@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.
Modifier and Type | Field and Description |
---|---|
private List<RepositoryListener> |
listeners |
private org.slf4j.Logger |
log |
private org.apache.archiva.redback.components.cache.Cache<String,Collection<String>> |
namespacesCache
Cache used for namespaces
|
private RepositoryStorage |
repositoryStorage
FIXME: this needs to be configurable based on storage type - and could also be instantiated per repo.
|
Constructor and Description |
---|
DefaultMetadataResolver() |
private org.slf4j.Logger log
@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
@Inject @Autowired(required=false) private List<RepositoryListener> listeners
@Inject @Named(value="cache#namespaces") private org.apache.archiva.redback.components.cache.Cache<String,Collection<String>> namespacesCache
public DefaultMetadataResolver()
public ProjectVersionMetadata resolveProjectVersion(RepositorySession session, String repoId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
resolveProjectVersion
in interface MetadataResolver
MetadataResolutionException
public Collection<ProjectVersionReference> resolveProjectReferences(RepositorySession session, String repoId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
MetadataResolver
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 toMetadataResolutionException
public Collection<String> resolveRootNamespaces(RepositorySession session, String repoId) throws MetadataResolutionException
resolveRootNamespaces
in interface MetadataResolver
MetadataResolutionException
public Collection<String> resolveNamespaces(RepositorySession session, String repoId, String namespace) throws MetadataResolutionException
resolveNamespaces
in interface MetadataResolver
MetadataResolutionException
public Collection<String> resolveProjects(RepositorySession session, String repoId, String namespace) throws MetadataResolutionException
resolveProjects
in interface MetadataResolver
MetadataResolutionException
public Collection<String> resolveProjectVersions(RepositorySession session, String repoId, String namespace, String projectId) throws MetadataResolutionException
resolveProjectVersions
in interface MetadataResolver
MetadataResolutionException
public Collection<ArtifactMetadata> resolveArtifacts(RepositorySession session, String repoId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
resolveArtifacts
in interface MetadataResolver
MetadataResolutionException
private Collection<String> createArtifactIdList(Collection<ArtifactMetadata> artifacts)
Copyright © 2006–2023 The Apache Software Foundation. All rights reserved.