|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.wso2.carbon.governance.api.util.GovernanceUtils
public class GovernanceUtils
Utilities used by various Governance API related functionality.
Constructor Summary | |
---|---|
GovernanceUtils()
|
Method Summary | |
---|---|
static void |
associateAspect(String path,
String aspect,
org.wso2.carbon.registry.core.Registry registry)
Method to associate an aspect with a given resource on the registry. |
static org.apache.axiom.om.OMElement |
buildOMElement(byte[] content)
Method to build an AXIOM element from a byte stream. |
static String |
derivePathFromQName(QName qName)
Method to obtain a path from a qualified name. |
static List<org.apache.axiom.om.OMElement> |
evaluateXPathToElements(String expression,
org.apache.axiom.om.OMElement root)
|
static GovernanceArtifactConfiguration |
findGovernanceArtifactConfiguration(String key,
org.wso2.carbon.registry.core.Registry registry)
Query to search for a governance artifact configuration. |
static GovernanceArtifactConfiguration |
findGovernanceArtifactConfigurationByMediaType(String mediaType,
org.wso2.carbon.registry.core.Registry registry)
Query to search for a governance artifact configuration. |
static List<GovernanceArtifactConfiguration> |
findGovernanceArtifactConfigurations(org.wso2.carbon.registry.core.Registry registry)
Method to locate Governance Artifact configurations. |
static List<GovernanceArtifact> |
findGovernanceArtifacts(Map<String,List<String>> criteria,
org.wso2.carbon.registry.core.Registry registry,
String mediaType)
Returns a list of governance artifacts found by searching indexes. |
static String[] |
findGovernanceArtifacts(String mediaType,
org.wso2.carbon.registry.core.Registry registry)
Query to search for governance artifacts. |
static ApproveItemBean[] |
getAllApproveItemBeans(String currentUser,
org.wso2.carbon.registry.core.Resource artifactResource,
GovernanceArtifact artifact)
Extracts all ApproveItemBeans from the resource |
static String[] |
getAllArtifactIds(org.wso2.carbon.registry.core.Registry registry)
Deprecated. Method to obtain all indexed governance artifact identifiers on the provided registry instance. |
static String[] |
getAllArtifactPathsByLifecycle(org.wso2.carbon.registry.core.Registry registry,
String lcName,
String mediaType)
Retrieve all the governance artifact paths which associated with the given lifecycle |
static String[] |
getAllArtifactPathsByLifecycleState(org.wso2.carbon.registry.core.Registry registry,
String lcName,
String lcState,
String mediaType)
Retrieve all the governance artifact paths which associated with the given lifecycle in the given lifecycle state |
static GovernanceArtifact[] |
getAllArtifacts(org.wso2.carbon.registry.core.Registry registry)
Deprecated. Method to obtain all indexed governance artifacts on the provided registry instance. |
static CheckListItemBean[] |
getAllCheckListItemBeans(org.wso2.carbon.registry.core.Resource artifactResource,
GovernanceArtifact artifact)
Extracts all CheckListItemBeans from the resource and update the lifecycle name and state of the artifact |
static String |
getArtifactPath(org.wso2.carbon.registry.core.Registry registry,
String artifactId)
Method to obtain the artifact path of a governance artifact on the registry. |
static org.wso2.carbon.registry.common.AttributeSearchService |
getAttributeSearchService()
|
static String |
getAttributeValue(org.apache.axiom.om.OMElement element,
String name,
String namespace)
Method to obtain the value of a governance attribute. |
static String[] |
getAvailableAspects()
Method to obtain all available aspects for the given tenant. |
static GovernanceArtifactConfiguration |
getGovernanceArtifactConfiguration(String elementString)
|
static org.wso2.carbon.registry.core.Registry |
getGovernanceSystemRegistry(org.wso2.carbon.registry.core.Registry registry)
Returns the system governance registry. |
static org.wso2.carbon.registry.core.Registry |
getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry,
String username)
Obtains the governance user registry from the given root registry instance. |
static org.wso2.carbon.registry.core.Registry |
getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry,
String username,
int tenantId)
Obtains the governance user registry from the given root registry instance. |
static String |
getNameFromUrl(String url)
Obtain a name that can represent a URL. |
static String |
getPathFromPathExpression(String pathExpression,
GovernanceArtifact artifact)
Method to convert the expression specified for storing the path with corresponding values where the artifact is stored. |
static String |
getPathFromPathExpression(String pathExpression,
GovernanceArtifact artifact,
String storagePath)
Method to convert the expression specified for storing the path with corresponding values where the artifact is stored. |
static String[] |
getPathsFromPathExpression(String pathExpression,
GovernanceArtifact artifact)
Method to convert the expression specified for storing the path with corresponding values where the artifact is stored. |
static String[] |
getResultPaths(org.wso2.carbon.registry.core.Registry registry,
String mediaType)
Method to obtain a list of paths having resources of the given media type. |
static boolean |
hasSamePath(String pathExpression,
GovernanceArtifact newArtifact,
GovernanceArtifact oldArtifact)
Method to compare the old and new artifact paths |
static void |
loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry)
Method to load the Governance Artifacts to be used by the API operations. |
static void |
loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry,
List<GovernanceArtifactConfiguration> configurations)
Method to load the Governance Artifacts to be used by the API operations. |
static void |
removeArtifact(org.wso2.carbon.registry.core.Registry registry,
String artifactId)
Method to remove a governance artifact from the registry. |
static void |
removeAspect(String path,
String aspect,
org.wso2.carbon.registry.core.Registry registry)
Method to remove an aspect from a given resource on the registry. |
static GovernanceArtifact |
retrieveGovernanceArtifactById(org.wso2.carbon.registry.core.Registry registry,
String artifactId)
Method to obtain a governance artifact on the registry. |
static GovernanceArtifact |
retrieveGovernanceArtifactByPath(org.wso2.carbon.registry.core.Registry registry,
String artifactPath)
Method to obtain a governance artifact on the registry by the artifact path. |
static String |
serializeOMElement(org.apache.axiom.om.OMElement element)
Method to serialize an XML element into a string. |
static void |
setAttributeSearchService(org.wso2.carbon.registry.common.AttributeSearchService attributeSearchService)
|
static void |
setRegistryService(org.wso2.carbon.registry.core.service.RegistryService registryService)
Setting the registry service. |
static void |
setTenantGovernanceSystemRegistry(int tenantId)
|
static void |
unsetTenantGovernanceSystemRegistry()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GovernanceUtils()
Method Detail |
---|
public static void setRegistryService(org.wso2.carbon.registry.core.service.RegistryService registryService)
registryService
- the registryService.public static String[] findGovernanceArtifacts(String mediaType, org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
mediaType
- the media type of the artifacts to be searched for.registry
- the registry instance to run query on.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static GovernanceArtifactConfiguration findGovernanceArtifactConfigurationByMediaType(String mediaType, org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
mediaType
- the media type of the artifact configuration.registry
- the registry instance to run query on.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static GovernanceArtifactConfiguration findGovernanceArtifactConfiguration(String key, org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
key
- the key of the artifact configuration.registry
- the registry instance to run query on.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static String[] getResultPaths(org.wso2.carbon.registry.core.Registry registry, String mediaType) throws GovernanceException
registry
- the registry instance to run query on.mediaType
- the media type.
GovernanceException
- if the operation failed.public static void loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry, List<GovernanceArtifactConfiguration> configurations) throws org.wso2.carbon.registry.core.exceptions.RegistryException
registry
- the registry instance used to search for artifacts.configurations
- the artifact configurations to load.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static void loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
registry
- the registry instance used to search for artifacts.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static GovernanceArtifactConfiguration getGovernanceArtifactConfiguration(String elementString)
public static List<GovernanceArtifactConfiguration> findGovernanceArtifactConfigurations(org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
registry
- the registry instance to run query on.
GovernanceException
- if the operation failed.
org.wso2.carbon.registry.core.exceptions.RegistryException
public static void setTenantGovernanceSystemRegistry(int tenantId) throws org.wso2.carbon.registry.core.exceptions.RegistryException
org.wso2.carbon.registry.core.exceptions.RegistryException
public static void unsetTenantGovernanceSystemRegistry() throws org.wso2.carbon.registry.core.exceptions.RegistryException
org.wso2.carbon.registry.core.exceptions.RegistryException
public static org.wso2.carbon.registry.core.Registry getGovernanceSystemRegistry(org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
registry
- the user registry.
org.wso2.carbon.registry.core.exceptions.RegistryException
- throws if an error occurspublic static org.wso2.carbon.registry.core.Registry getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry, String username) throws org.wso2.carbon.registry.core.exceptions.RegistryException
registry
- the remote client registry instance.username
- the name of the user to connect as.
org.wso2.carbon.registry.core.exceptions.RegistryException
- throws if an error occurspublic static org.wso2.carbon.registry.core.Registry getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry, String username, int tenantId) throws org.wso2.carbon.registry.core.exceptions.RegistryException
registry
- registry the remote client registry instance.username
- username the name of the user to connect as.tenantId
- tenant id
org.wso2.carbon.registry.core.exceptions.RegistryException
- throws if an error occurspublic static void removeArtifact(org.wso2.carbon.registry.core.Registry registry, String artifactId) throws GovernanceException
registry
- the registry instance.artifactId
- the identifier of the artifact.
GovernanceException
- if the operation failed.public static String getArtifactPath(org.wso2.carbon.registry.core.Registry registry, String artifactId) throws GovernanceException
registry
- the registry instance.artifactId
- the identifier of the artifact.
GovernanceException
- if the operation failed.public static String[] getAllArtifactPathsByLifecycle(org.wso2.carbon.registry.core.Registry registry, String lcName, String mediaType) throws GovernanceException
registry
- registry instancelcName
- lifecycle namemediaType
- mediatype of the artifacts
GovernanceException
- if the operation failed.public static String[] getAllArtifactPathsByLifecycleState(org.wso2.carbon.registry.core.Registry registry, String lcName, String lcState, String mediaType) throws GovernanceException
registry
- registry instancelcName
- lifecycle namelcState
- lifecycle statemediaType
- mediatype of the artifacts
GovernanceException
- if the operation failed.public static String getAttributeValue(org.apache.axiom.om.OMElement element, String name, String namespace)
element
- the payload element.name
- the attribute name.namespace
- the namespace of the payload element.
public static String[] getAllArtifactIds(org.wso2.carbon.registry.core.Registry registry) throws GovernanceException
registry
- the registry instance.
GovernanceException
- if the operation failed.public static GovernanceArtifact[] getAllArtifacts(org.wso2.carbon.registry.core.Registry registry) throws GovernanceException
registry
- the registry instance.
GovernanceException
- if the operation failed.public static GovernanceArtifact retrieveGovernanceArtifactById(org.wso2.carbon.registry.core.Registry registry, String artifactId) throws GovernanceException
registry
- the registry instance.artifactId
- the identifier of the artifact.
GovernanceException
- if the operation failed.public static GovernanceArtifact retrieveGovernanceArtifactByPath(org.wso2.carbon.registry.core.Registry registry, String artifactPath) throws GovernanceException
registry
- the registry instance.artifactPath
- the path of the artifact.
GovernanceException
- if the operation failed.public static CheckListItemBean[] getAllCheckListItemBeans(org.wso2.carbon.registry.core.Resource artifactResource, GovernanceArtifact artifact) throws GovernanceException
artifactResource
- resource related to the artifactartifact
- artifact which related to the resource
GovernanceException
- GovernanceException if the operation failed.public static ApproveItemBean[] getAllApproveItemBeans(String currentUser, org.wso2.carbon.registry.core.Resource artifactResource, GovernanceArtifact artifact) throws GovernanceException
currentUser
- current registry userartifactResource
- resource related to the artifactartifact
- artifact related to the resource
GovernanceException
- if the operation failed.public static org.apache.axiom.om.OMElement buildOMElement(byte[] content) throws org.wso2.carbon.registry.core.exceptions.RegistryException
content
- the stream of bytes.
GovernanceException
- if the operation failed.
org.wso2.carbon.registry.core.exceptions.RegistryException
public static String serializeOMElement(org.apache.axiom.om.OMElement element) throws GovernanceException
element
- the XML element.
GovernanceException
- if the operation failed.public static String getPathFromPathExpression(String pathExpression, GovernanceArtifact artifact, String storagePath) throws GovernanceException
pathExpression
- the expression specified for storing the pathartifact
- the governance artifactstoragePath
- the storage path of the artifact
GovernanceException
- if the operation failed.public static String getPathFromPathExpression(String pathExpression, GovernanceArtifact artifact) throws GovernanceException
pathExpression
- the expression specified for storing the pathartifact
- the governance artifact
GovernanceException
- if the operation failed.public static boolean hasSamePath(String pathExpression, GovernanceArtifact newArtifact, GovernanceArtifact oldArtifact) throws GovernanceException
pathExpression
- the expression specified for storing the pathnewArtifact
- updated artifactoldArtifact
- existing artifact
GovernanceException
- if the operation failed.public static String[] getPathsFromPathExpression(String pathExpression, GovernanceArtifact artifact) throws GovernanceException
pathExpression
- the expression specified for storing the pathartifact
- the governance artifact
GovernanceException
- if the operation failed.public static String[] getAvailableAspects() throws org.wso2.carbon.registry.core.exceptions.RegistryException
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static String derivePathFromQName(QName qName)
qName
- the qualified name.
public static String getNameFromUrl(String url)
url
- the URL.
public static List<org.apache.axiom.om.OMElement> evaluateXPathToElements(String expression, org.apache.axiom.om.OMElement root) throws org.jaxen.JaxenException
org.jaxen.JaxenException
public static void associateAspect(String path, String aspect, org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
path
- the path of the resource.aspect
- the aspect to add.registry
- the registry instance on which the resource is available.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static void removeAspect(String path, String aspect, org.wso2.carbon.registry.core.Registry registry) throws org.wso2.carbon.registry.core.exceptions.RegistryException
path
- the path of the resource.aspect
- the aspect to be removed.registry
- the registry instance on which the resource is available.
org.wso2.carbon.registry.core.exceptions.RegistryException
- if the operation failed.public static org.wso2.carbon.registry.common.AttributeSearchService getAttributeSearchService()
public static void setAttributeSearchService(org.wso2.carbon.registry.common.AttributeSearchService attributeSearchService)
public static List<GovernanceArtifact> findGovernanceArtifacts(Map<String,List<String>> criteria, org.wso2.carbon.registry.core.Registry registry, String mediaType) throws GovernanceException
criteria
- the search criteriaregistry
- the governance registry instance
GovernanceException
- if the operation failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |