public class JcrMetadataRepository extends Object implements MetadataRepository
| Modifier and Type | Field and Description |
|---|---|
(package private) static String |
ARTIFACT_NODE_TYPE |
private static String |
DEPENDENCY_NODE_TYPE |
(package private) static String |
FACET_NODE_TYPE |
private static String |
JCR_LAST_MODIFIED |
private javax.jcr.Session |
jcrSession |
private org.slf4j.Logger |
log |
private Map<String,MetadataFacetFactory> |
metadataFacetFactories |
(package private) static String |
NAMESPACE_NODE_TYPE |
(package private) static String |
PROJECT_NODE_TYPE |
(package private) static String |
PROJECT_VERSION_NODE_TYPE |
private javax.jcr.Repository |
repository |
| Constructor and Description |
|---|
JcrMetadataRepository(Map<String,MetadataFacetFactory> metadataFacetFactories,
javax.jcr.Repository repository) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMetadataFacet(String repositoryId,
MetadataFacet metadataFacet) |
boolean |
canObtainAccess(Class<?> aClass) |
void |
close() |
private static Calendar |
createCalendar(Date time) |
private ArtifactMetadata |
getArtifactFromNode(String repositoryId,
javax.jcr.Node artifactNode) |
private static String |
getArtifactPath(String repositoryId,
String namespace,
String projectId,
String projectVersion,
String id) |
private static String |
getArtifactQuery(String repositoryId) |
List<ArtifactMetadata> |
getArtifacts(String repositoryId) |
Collection<ArtifactMetadata> |
getArtifacts(String repositoryId,
String namespace,
String projectId,
String projectVersion) |
List<ArtifactMetadata> |
getArtifactsByChecksum(String repositoryId,
String checksum) |
List<ArtifactMetadata> |
getArtifactsByDateRange(String repoId,
Date startTime,
Date endTime)
if startTime or endTime are
null they are not used for search |
List<ArtifactMetadata> |
getArtifactsByMetadata(String key,
String value,
String repositoryId)
Get artifacts with an artifact metadata key that matches the passed value.
|
List<ArtifactMetadata> |
getArtifactsByProjectVersionMetadata(String key,
String value,
String repositoryId)
Get artifacts with a project version metadata key that matches the passed value.
|
List<ArtifactMetadata> |
getArtifactsByProperty(String key,
String value,
String repositoryId)
Get artifacts with a property key that matches the passed value.
|
Collection<String> |
getArtifactVersions(String repositoryId,
String namespace,
String projectId,
String projectVersion) |
private static String |
getFacetPath(String repositoryId,
String facetId) |
private static String |
getFacetPath(String repositoryId,
String facetId,
String name) |
javax.jcr.Session |
getJcrSession() |
MetadataFacet |
getMetadataFacet(String repositoryId,
String facetId,
String name) |
List<String> |
getMetadataFacets(String repositoryId,
String facetId) |
private static String |
getNamespacePath(String repositoryId,
String namespace) |
Collection<String> |
getNamespaces(String repositoryId,
String baseNamespace) |
private Collection<String> |
getNodeNames(String path,
String nodeType) |
private javax.jcr.Node |
getOrAddArtifactNode(String repositoryId,
String namespace,
String projectId,
String projectVersion,
String id) |
private javax.jcr.Node |
getOrAddNamespaceNode(String repositoryId,
String namespace) |
private javax.jcr.Node |
getOrAddNodeByPath(javax.jcr.Node baseNode,
String name) |
private javax.jcr.Node |
getOrAddNodeByPath(javax.jcr.Node baseNode,
String name,
String nodeType) |
private javax.jcr.Node |
getOrAddProjectNode(String repositoryId,
String namespace,
String projectId) |
private javax.jcr.Node |
getOrAddProjectVersionNode(String repositoryId,
String namespace,
String projectId,
String projectVersion) |
private javax.jcr.Node |
getOrAddRepositoryContentNode(String repositoryId) |
private javax.jcr.Node |
getOrAddRepositoryNode(String repositoryId) |
ProjectMetadata |
getProject(String repositoryId,
String namespace,
String projectId)
basically just checking it exists not complete data returned
|
private static String |
getProjectPath(String repositoryId,
String namespace,
String projectId) |
Collection<ProjectVersionReference> |
getProjectReferences(String repositoryId,
String namespace,
String projectId,
String projectVersion)
Retrieve project references from the metadata repository.
|
Collection<String> |
getProjects(String repositoryId,
String namespace) |
ProjectVersionMetadata |
getProjectVersion(String repositoryId,
String namespace,
String projectId,
String projectVersion) |
private static String |
getProjectVersionPath(String repositoryId,
String namespace,
String projectId,
String projectVersion) |
Collection<String> |
getProjectVersions(String repositoryId,
String namespace,
String projectId) |
private static String |
getPropertyString(javax.jcr.Node node,
String name) |
Collection<String> |
getRepositories() |
private static String |
getRepositoryContentPath(String repositoryId) |
private static String |
getRepositoryPath(String repositoryId) |
Collection<String> |
getRootNamespaces(String repositoryId) |
boolean |
hasMetadataFacet(String repositoryId,
String facetId) |
(package private) static void |
initialize(javax.jcr.Session session) |
private String |
join(Collection<String> ids) |
<T> T |
obtainAccess(Class<T> aClass) |
private void |
recurse(List<String> facets,
String prefix,
javax.jcr.Node node) |
private static void |
registerMixinNodeType(javax.jcr.nodetype.NodeTypeManager nodeTypeManager,
String name) |
void |
removeArtifact(ArtifactMetadata artifactMetadata,
String baseVersion)
used for deleting timestamped version of SNAPSHOT artifacts
|
void |
removeArtifact(String repositoryId,
String namespace,
String project,
String projectVersion,
MetadataFacet metadataFacet)
FIXME need a unit test!!!
Only remove
MetadataFacet for the artifact |
void |
removeArtifact(String repositoryId,
String namespace,
String projectId,
String projectVersion,
String id) |
void |
removeMetadataFacet(String repositoryId,
String facetId,
String name) |
void |
removeMetadataFacets(String repositoryId,
String facetId) |
void |
removeNamespace(String repositoryId,
String projectId) |
void |
removeProject(String repositoryId,
String namespace,
String projectId)
remove a project
|
void |
removeProjectVersion(String repoId,
String namespace,
String projectId,
String projectVersion) |
void |
removeRepository(String repositoryId)
Delete a repository's metadata.
|
void |
revert()
implementations can throw RuntimeException
|
private List<ArtifactMetadata> |
runJcrQuery(String repositoryId,
String q,
Map<String,String> bindings) |
void |
save()
implementations can throw RuntimeException
|
List<ArtifactMetadata> |
searchArtifacts(String text,
String repositoryId,
boolean exact)
Exact is ignored as we can't do exact search in any property, we need a key
|
List<ArtifactMetadata> |
searchArtifacts(String key,
String text,
String repositoryId,
boolean exact)
Full text artifacts search inside the specified key.
|
void |
updateArtifact(String repositoryId,
String namespace,
String projectId,
String projectVersion,
ArtifactMetadata artifactMeta) |
void |
updateNamespace(String repositoryId,
String namespace)
create the namespace in the repository.
|
void |
updateProject(String repositoryId,
ProjectMetadata project)
Update metadata for a particular project in the metadata repository, or create it if it does not already exist.
|
private void |
updateProject(String repositoryId,
String namespace,
String projectId) |
void |
updateProjectVersion(String repositoryId,
String namespace,
String projectId,
ProjectVersionMetadata versionMetadata) |
private static final String JCR_LAST_MODIFIED
static final String NAMESPACE_NODE_TYPE
static final String PROJECT_NODE_TYPE
static final String PROJECT_VERSION_NODE_TYPE
static final String ARTIFACT_NODE_TYPE
static final String FACET_NODE_TYPE
private static final String DEPENDENCY_NODE_TYPE
private final Map<String,MetadataFacetFactory> metadataFacetFactories
private org.slf4j.Logger log
private javax.jcr.Repository repository
private javax.jcr.Session jcrSession
public JcrMetadataRepository(Map<String,MetadataFacetFactory> metadataFacetFactories, javax.jcr.Repository repository) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionstatic void initialize(javax.jcr.Session session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate static void registerMixinNodeType(javax.jcr.nodetype.NodeTypeManager nodeTypeManager, String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void updateProject(String repositoryId, ProjectMetadata project) throws MetadataRepositoryException
MetadataRepositoryupdateProject in interface MetadataRepositoryrepositoryId - the repository the project is inproject - the project metadata to create or updateMetadataRepositoryExceptionprivate void updateProject(String repositoryId, String namespace, String projectId) throws MetadataRepositoryException
MetadataRepositoryExceptionpublic void updateArtifact(String repositoryId, String namespace, String projectId, String projectVersion, ArtifactMetadata artifactMeta) throws MetadataRepositoryException
updateArtifact in interface MetadataRepositoryMetadataRepositoryExceptionpublic void updateProjectVersion(String repositoryId, String namespace, String projectId, ProjectVersionMetadata versionMetadata) throws MetadataRepositoryException
updateProjectVersion in interface MetadataRepositoryMetadataRepositoryExceptionpublic void updateNamespace(String repositoryId, String namespace) throws MetadataRepositoryException
MetadataRepositoryupdateNamespace in interface MetadataRepositoryMetadataRepositoryExceptionpublic void removeProject(String repositoryId, String namespace, String projectId) throws MetadataRepositoryException
MetadataRepositoryremoveProject in interface MetadataRepositoryMetadataRepositoryExceptionpublic boolean hasMetadataFacet(String repositoryId, String facetId) throws MetadataRepositoryException
hasMetadataFacet in interface MetadataRepositoryMetadataRepositoryExceptionpublic List<String> getMetadataFacets(String repositoryId, String facetId) throws MetadataRepositoryException
getMetadataFacets in interface MetadataRepositoryMetadataRepositoryExceptionprivate void recurse(List<String> facets, String prefix, javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic MetadataFacet getMetadataFacet(String repositoryId, String facetId, String name) throws MetadataRepositoryException
getMetadataFacet in interface MetadataRepositoryMetadataRepositoryExceptionpublic void addMetadataFacet(String repositoryId, MetadataFacet metadataFacet) throws MetadataRepositoryException
addMetadataFacet in interface MetadataRepositoryMetadataRepositoryExceptionpublic void removeNamespace(String repositoryId, String projectId) throws MetadataRepositoryException
removeNamespace in interface MetadataRepositoryprojectId - (groupId for maven )MetadataRepositoryExceptionpublic void removeMetadataFacets(String repositoryId, String facetId) throws MetadataRepositoryException
removeMetadataFacets in interface MetadataRepositoryMetadataRepositoryExceptionpublic void removeMetadataFacet(String repositoryId, String facetId, String name) throws MetadataRepositoryException
removeMetadataFacet in interface MetadataRepositoryMetadataRepositoryExceptionpublic List<ArtifactMetadata> getArtifactsByDateRange(String repoId, Date startTime, Date endTime) throws MetadataRepositoryException
MetadataRepositorynull they are not used for searchgetArtifactsByDateRange in interface MetadataRepositorystartTime - can be nullendTime - can be nullMetadataRepositoryExceptionpublic Collection<String> getRepositories() throws MetadataRepositoryException
getRepositories in interface MetadataRepositoryMetadataRepositoryExceptionpublic List<ArtifactMetadata> getArtifactsByChecksum(String repositoryId, String checksum) throws MetadataRepositoryException
getArtifactsByChecksum in interface MetadataRepositoryMetadataRepositoryExceptionprivate List<ArtifactMetadata> runJcrQuery(String repositoryId, String q, Map<String,String> bindings) throws MetadataRepositoryException
MetadataRepositoryExceptionpublic List<ArtifactMetadata> getArtifactsByProjectVersionMetadata(String key, String value, String repositoryId) throws MetadataRepositoryException
MetadataRepositorygetArtifactsByProjectVersionMetadata in interface MetadataRepositoryrepositoryId - can be null, meaning search in all repositoriesMetadataRepositoryExceptionpublic List<ArtifactMetadata> getArtifactsByMetadata(String key, String value, String repositoryId) throws MetadataRepositoryException
MetadataRepositorygetArtifactsByMetadata in interface MetadataRepositoryrepositoryId - can be null, meaning search in all repositoriesMetadataRepositoryExceptionpublic List<ArtifactMetadata> getArtifactsByProperty(String key, String value, String repositoryId) throws MetadataRepositoryException
MetadataRepositorygetArtifactsByProperty in interface MetadataRepositoryrepositoryId - can be null, meaning search in all repositoriesMetadataRepositoryExceptionpublic void removeRepository(String repositoryId) throws MetadataRepositoryException
MetadataRepositoryremoveRepository in interface MetadataRepositoryrepositoryId - the repository to deleteMetadataRepositoryExceptionpublic List<ArtifactMetadata> getArtifacts(String repositoryId) throws MetadataRepositoryException
getArtifacts in interface MetadataRepositoryMetadataRepositoryExceptionprivate static String getArtifactQuery(String repositoryId)
public ProjectMetadata getProject(String repositoryId, String namespace, String projectId) throws MetadataResolutionException
MetadataRepositorygetProject in interface MetadataRepositoryMetadataResolutionExceptionpublic ProjectVersionMetadata getProjectVersion(String repositoryId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
getProjectVersion in interface MetadataRepositoryMetadataResolutionExceptionpublic Collection<String> getArtifactVersions(String repositoryId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
getArtifactVersions in interface MetadataRepositoryMetadataResolutionExceptionpublic Collection<ProjectVersionReference> getProjectReferences(String repositoryId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
MetadataRepositorygetProjectReferences in interface MetadataRepositoryrepositoryId - 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 toMetadataResolutionExceptionpublic Collection<String> getRootNamespaces(String repositoryId) throws MetadataResolutionException
getRootNamespaces in interface MetadataRepositoryMetadataResolutionExceptionpublic Collection<String> getNamespaces(String repositoryId, String baseNamespace) throws MetadataResolutionException
getNamespaces in interface MetadataRepositoryCollection of child namespaces of the namespace argumentMetadataResolutionExceptionpublic Collection<String> getProjects(String repositoryId, String namespace) throws MetadataResolutionException
getProjects in interface MetadataRepositoryMetadataResolutionExceptionpublic Collection<String> getProjectVersions(String repositoryId, String namespace, String projectId) throws MetadataResolutionException
getProjectVersions in interface MetadataRepositoryMetadataResolutionExceptionpublic void removeArtifact(ArtifactMetadata artifactMetadata, String baseVersion) throws MetadataRepositoryException
MetadataRepositoryremoveArtifact in interface MetadataRepositoryartifactMetadata - the artifactMetadata with the timestamped version (2.0-20120618.214135-2)baseVersion - the base version of the snapshot (2.0-SNAPSHOT)MetadataRepositoryExceptionpublic void removeProjectVersion(String repoId, String namespace, String projectId, String projectVersion) throws MetadataRepositoryException
removeProjectVersion in interface MetadataRepositoryMetadataRepositoryExceptionpublic void removeArtifact(String repositoryId, String namespace, String projectId, String projectVersion, String id) throws MetadataRepositoryException
removeArtifact in interface MetadataRepositoryMetadataRepositoryExceptionpublic void removeArtifact(String repositoryId, String namespace, String project, String projectVersion, MetadataFacet metadataFacet) throws MetadataRepositoryException
MetadataRepositoryMetadataFacet for the artifactremoveArtifact in interface MetadataRepositoryMetadataRepositoryExceptionpublic Collection<ArtifactMetadata> getArtifacts(String repositoryId, String namespace, String projectId, String projectVersion) throws MetadataResolutionException
getArtifacts in interface MetadataRepositoryMetadataResolutionExceptionpublic void save()
MetadataRepositorysave in interface MetadataRepositorypublic void revert()
MetadataRepositoryrevert in interface MetadataRepositorypublic boolean canObtainAccess(Class<?> aClass)
canObtainAccess in interface MetadataRepositorypublic <T> T obtainAccess(Class<T> aClass) throws MetadataRepositoryException
obtainAccess in interface MetadataRepositoryMetadataRepositoryExceptionpublic void close() throws MetadataRepositoryException
close in interface MetadataRepositoryMetadataRepositoryExceptionpublic List<ArtifactMetadata> searchArtifacts(String text, String repositoryId, boolean exact) throws MetadataRepositoryException
searchArtifacts in interface MetadataRepositoryrepositoryId - can be null to search in all repositoriesexact - running an exact search, the value must exactly match the text.MetadataRepositoryExceptionpublic List<ArtifactMetadata> searchArtifacts(String key, String text, String repositoryId, boolean exact) throws MetadataRepositoryException
MetadataRepositorysearchArtifacts in interface MetadataRepositorykey - search only inside this keyrepositoryId - can be null to search in all repositoriesexact - running an exact search, the value must exactly match the text.MetadataRepositoryExceptionprivate ArtifactMetadata getArtifactFromNode(String repositoryId, javax.jcr.Node artifactNode) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate static String getPropertyString(javax.jcr.Node node, String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate Collection<String> getNodeNames(String path, String nodeType) throws MetadataResolutionException
MetadataResolutionExceptionprivate static String getRepositoryPath(String repositoryId)
private static String getRepositoryContentPath(String repositoryId)
private static String getFacetPath(String repositoryId, String facetId)
private static String getNamespacePath(String repositoryId, String namespace)
private static String getProjectPath(String repositoryId, String namespace, String projectId)
private static String getProjectVersionPath(String repositoryId, String namespace, String projectId, String projectVersion)
private static String getArtifactPath(String repositoryId, String namespace, String projectId, String projectVersion, String id)
private javax.jcr.Node getOrAddNodeByPath(javax.jcr.Node baseNode, String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate javax.jcr.Node getOrAddNodeByPath(javax.jcr.Node baseNode, String name, String nodeType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate static String getFacetPath(String repositoryId, String facetId, String name)
private javax.jcr.Node getOrAddRepositoryNode(String repositoryId) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate javax.jcr.Node getOrAddRepositoryContentNode(String repositoryId) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate javax.jcr.Node getOrAddNamespaceNode(String repositoryId, String namespace) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate javax.jcr.Node getOrAddProjectNode(String repositoryId, String namespace, String projectId) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate javax.jcr.Node getOrAddProjectVersionNode(String repositoryId, String namespace, String projectId, String projectVersion) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate javax.jcr.Node getOrAddArtifactNode(String repositoryId, String namespace, String projectId, String projectVersion, String id) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprivate static Calendar createCalendar(Date time)
private String join(Collection<String> ids)
public javax.jcr.Session getJcrSession() throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionCopyright © 2006–2023 The Apache Software Foundation. All rights reserved.