Class GovernanceArtifactManager
java.lang.Object
org.wso2.carbon.governance.api.common.GovernanceArtifactManager
Base Manager Functionality which can be used by any Artifact Manager instance.
-
Constructor Summary
ConstructorsConstructorDescriptionGovernanceArtifactManager(org.wso2.carbon.registry.core.Registry registry, String mediaType, String artifactNameAttribute, String artifactNamespaceAttribute, String artifactElementRoot, String artifactElementNamespace, String pathExpression, String lifecycle, List<Map> validationAttributes, org.wso2.carbon.registry.core.Association[] relationshipDefinitions) Constructor accepting an instance of the registry, and also details on the type of manager.GovernanceArtifactManager(org.wso2.carbon.registry.core.Registry registry, String mediaType, String artifactNameAttribute, String artifactNamespaceAttribute, String artifactElementRoot, String artifactElementNamespace, String pathExpression, org.wso2.carbon.registry.core.Association[] relationshipDefinitions) Constructor accepting an instance of the registry, and also details on the type of manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGovernanceArtifact(GovernanceArtifact artifact) Adds the given artifact to the registry.findGovernanceArtifacts(String query) Finds and returns all GovernanceArtifacts that match the search query.findGovernanceArtifacts(Map<String, List<String>> criteria) Finds all artifacts matching the given filter criteria.Finds all artifacts matching the given filter criteria.String[]Finds all identifiers of the artifacts on the registry.Finds all artifacts of a given type on the registry.Retrieve all the governance artifacts which associated with the given lifecyclegetAllGovernanceArtifactsByLIfecycleStatus(String lcName, String lcState) Retrieve all the governance artifacts which associated with the given lifecycle in the given lifecycle stategetGovernanceArtifact(String artifactId) Fetches the given artifact on the registry.org.wso2.carbon.registry.common.TermData[]Find all possible terms and its count for the given facet field and query criteriabooleanisExists(GovernanceArtifact artifact) Check whether GovernanceArtifact is exists in the Registry without loading whole artifact into memory.Creates a new artifact from the given qualified name.newGovernanceArtifact(org.apache.axiom.om.OMElement content) Creates a new artifact from the given content.voidremoveGenericArtifact(GenericArtifact artifact) voidremoveGovernanceArtifact(String artifactId) Removes the given artifact from the registry.protected voidsetContent(GovernanceArtifact artifact, org.wso2.carbon.registry.core.Resource resource) Sets content of the given artifact to the given resource on the registry.voidsetContent(org.wso2.carbon.registry.core.Resource resource, GovernanceArtifact artifact) Sets content of the given artifact to the given resource on the registry.voidupdateGovernanceArtifact(GovernanceArtifact artifact) Updates the given artifact on the registry.
-
Constructor Details
-
GovernanceArtifactManager
public GovernanceArtifactManager(org.wso2.carbon.registry.core.Registry registry, String mediaType, String artifactNameAttribute, String artifactNamespaceAttribute, String artifactElementRoot, String artifactElementNamespace, String pathExpression, org.wso2.carbon.registry.core.Association[] relationshipDefinitions) Constructor accepting an instance of the registry, and also details on the type of manager.- Parameters:
registry- the instance of the registry.mediaType- the media type of resources being saved or fetched.artifactNameAttribute- the attribute that specifies the name of the artifact.artifactNamespaceAttribute- the attribute that specifies the namespace of the artifact.artifactElementRoot- the attribute that specifies the root artifact element.artifactElementNamespace- the attribute that specifies the artifact element's namespace.pathExpression- the expression that can be used to compute where to store the artifact.relationshipDefinitions- the relationship definitions for the types of associations that will be created when the artifact gets updated.
-
GovernanceArtifactManager
public GovernanceArtifactManager(org.wso2.carbon.registry.core.Registry registry, String mediaType, String artifactNameAttribute, String artifactNamespaceAttribute, String artifactElementRoot, String artifactElementNamespace, String pathExpression, String lifecycle, List<Map> validationAttributes, org.wso2.carbon.registry.core.Association[] relationshipDefinitions) Constructor accepting an instance of the registry, and also details on the type of manager.- Parameters:
registry- the instance of the registry.mediaType- the media type of resources being saved or fetched.artifactNameAttribute- the attribute that specifies the name of the artifact.artifactNamespaceAttribute- the attribute that specifies the namespace of the artifact.artifactElementRoot- the attribute that specifies the root artifact element.artifactElementNamespace- the attribute that specifies the artifact element's namespace.pathExpression- the expression that can be used to compute where to store the artifact.lifecycle- the lifecycle name which associated with the artifactsvalidationAttributes- the validations for artifact attributesrelationshipDefinitions- the relationship definitions for the types of associations that will be created when the artifact gets updated.
-
-
Method Details
-
newGovernanceArtifact
Creates a new artifact from the given qualified name.- Returns:
- the artifact added.
- Throws:
GovernanceException- if the operation failed.
-
newGovernanceArtifact
public GovernanceArtifact newGovernanceArtifact(org.apache.axiom.om.OMElement content) throws GovernanceException Creates a new artifact from the given content.- Parameters:
content- the artifact content.- Returns:
- the artifact added.
- Throws:
GovernanceException- if the operation failed.
-
addGovernanceArtifact
Adds the given artifact to the registry. Please do not use this method to update an existing artifact use the update method instead. If this method is used to update an existing artifact, all existing properties (such as lifecycle details) will be removed from the existing artifact.- Parameters:
artifact- the artifact.- Throws:
GovernanceException- if the operation failed.
-
updateGovernanceArtifact
Updates the given artifact on the registry.- Parameters:
artifact- the artifact.- Throws:
GovernanceException- if the operation failed.
-
getGovernanceArtifact
Fetches the given artifact on the registry.- Parameters:
artifactId- the identifier of the artifact.- Returns:
- the artifact.
- Throws:
GovernanceException- if the operation failed.
-
removeGovernanceArtifact
Removes the given artifact from the registry.- Parameters:
artifactId- the identifier of the artifact.- Throws:
GovernanceException- if the operation failed.
-
setContent
public void setContent(org.wso2.carbon.registry.core.Resource resource, GovernanceArtifact artifact) throws GovernanceException Sets content of the given artifact to the given resource on the registry.- Parameters:
resource- the content resource.artifact- the artifact.- Throws:
GovernanceException- if the operation failed.
-
setContent
protected void setContent(GovernanceArtifact artifact, org.wso2.carbon.registry.core.Resource resource) throws GovernanceException Sets content of the given artifact to the given resource on the registry.- Parameters:
artifact- the artifact.resource- the content resource.- Throws:
GovernanceException- if the operation failed.
-
findGovernanceArtifacts
public GovernanceArtifact[] findGovernanceArtifacts(Map<String, List<String>> criteria) throws GovernanceExceptionFinds all artifacts matching the given filter criteria.- Parameters:
criteria- the filter criteria to be matched.- Returns:
- the artifacts that match.
- Throws:
GovernanceException- if the operation failed.
-
getTermData
public org.wso2.carbon.registry.common.TermData[] getTermData(Map<String, List<String>> criteria, String facetField, boolean authRequired) throws GovernanceExceptionFind all possible terms and its count for the given facet field and query criteria- Parameters:
criteria- the filter criteria to be matchedfacetField- field used for facetingauthRequired- authorization required flag- Returns:
- term results
- Throws:
GovernanceException
-
findGovernanceArtifacts
Finds and returns all GovernanceArtifacts that match the search query.- Parameters:
query- The query to search artifacts- Returns:
- Array of artifacts that match the query string
- Throws:
GovernanceException- if the operation failed
-
findGovernanceArtifacts
public GovernanceArtifact[] findGovernanceArtifacts(GovernanceArtifactFilter criteria) throws GovernanceException Finds all artifacts matching the given filter criteria.- Parameters:
criteria- the filter criteria to be matched.- Returns:
- the artifacts that match.
- Throws:
GovernanceException- if the operation failed.
-
getAllGovernanceArtifacts
Finds all artifacts of a given type on the registry.- Returns:
- all artifacts of the given type on the registry.
- Throws:
GovernanceException- if the operation failed.
-
getPaginatedGovernanceArtifacts
- Throws:
GovernanceException
-
getAllGovernanceArtifactIds
Finds all identifiers of the artifacts on the registry.- Returns:
- an array of identifiers of the artifacts.
- Throws:
GovernanceException- if the operation failed.
-
getAllGovernanceArtifactsByLifecycle
public GovernanceArtifact[] getAllGovernanceArtifactsByLifecycle(String lcName) throws GovernanceException Retrieve all the governance artifacts which associated with the given lifecycle- Parameters:
lcName- Name of the lifecycle- Returns:
- GovernanceArtifact array
- Throws:
GovernanceException
-
getAllGovernanceArtifactsByLIfecycleStatus
public GovernanceArtifact[] getAllGovernanceArtifactsByLIfecycleStatus(String lcName, String lcState) throws GovernanceException Retrieve all the governance artifacts which associated with the given lifecycle in the given lifecycle state- Parameters:
lcName- Name of the lifecyclelcState- Name of the current lifecycle state- Returns:
- GovernanceArtifact array
- Throws:
GovernanceException
-
isExists
Check whether GovernanceArtifact is exists in the Registry without loading whole artifact into memory. This method only work for Configurable Governance Artifacts and doe not work for Content Artifacts such as WSDL, WADL, Swagger, XMLSchema etc.- Parameters:
artifact- GovernanceArtifact to check it's existence.- Returns:
- true or false
- Throws:
GovernanceException- if the operation failed.
-
removeGenericArtifact
- Throws:
GovernanceException
-