org.wso2.carbon.governance.api.util
Class GovernanceUtils

java.lang.Object
  extended by org.wso2.carbon.governance.api.util.GovernanceUtils

public class GovernanceUtils
extends Object


Constructor Summary
GovernanceUtils()
           
 
Method Summary
static void addGovernanceArtifactEntry(org.wso2.carbon.registry.core.Registry registry, String artifactId, String artifactPath)
          Method to register a governance artifact.
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 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.core.Registry getGovernanceSystemRegistry(org.wso2.carbon.registry.core.Registry registry)
          Returns the system governance registry.
static String getRelativeServicePath(org.wso2.carbon.registry.core.config.RegistryContext registryContext, QName qName)
          Method to derive the relative service path for the given qualified name.
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 void removeArtifact(org.wso2.carbon.registry.core.Registry registry, String artifactId)
          Method to remove a governance artifact from 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 setRegistryService(org.wso2.carbon.registry.core.service.RegistryService registryService)
          Setting the registry service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GovernanceUtils

public GovernanceUtils()
Method Detail

setRegistryService

public static void setRegistryService(org.wso2.carbon.registry.core.service.RegistryService registryService)
Setting the registry service.

Parameters:
registryService - the registryService.

getGovernanceSystemRegistry

public static org.wso2.carbon.registry.core.Registry getGovernanceSystemRegistry(org.wso2.carbon.registry.core.Registry registry)
                                                                          throws org.wso2.carbon.registry.core.exceptions.RegistryException
Returns the system governance registry.

Parameters:
registry - the user registry.
Returns:
the system registry.
Throws:
org.wso2.carbon.registry.core.exceptions.RegistryException - throws if an error occurs

removeArtifact

public static void removeArtifact(org.wso2.carbon.registry.core.Registry registry,
                                  String artifactId)
                           throws GovernanceException
Method to remove a governance artifact from the registry.

Parameters:
registry - the registry instance.
artifactId - the identifier of the artifact.
Throws:
GovernanceException - if the operation failed.

getArtifactPath

public static String getArtifactPath(org.wso2.carbon.registry.core.Registry registry,
                                     String artifactId)
                              throws GovernanceException
Method to obtain the artifact path of a governance artifact on the registry.

Parameters:
registry - the registry instance.
artifactId - the identifier of the artifact.
Returns:
the artifact path.
Throws:
GovernanceException - if the operation failed.

retrieveGovernanceArtifactById

public static GovernanceArtifact retrieveGovernanceArtifactById(org.wso2.carbon.registry.core.Registry registry,
                                                                String artifactId)
                                                         throws GovernanceException
Method to obtain a governance artifact on the registry.

Parameters:
registry - the registry instance.
artifactId - the identifier of the artifact.
Returns:
the artifact.
Throws:
GovernanceException - if the operation failed.

retrieveGovernanceArtifactByPath

public static GovernanceArtifact retrieveGovernanceArtifactByPath(org.wso2.carbon.registry.core.Registry registry,
                                                                  String artifactPath)
                                                           throws GovernanceException
Method to obtain a governance artifact on the registry by the artifact path.

Parameters:
registry - the registry instance.
artifactPath - the path of the artifact.
Returns:
the artifact.
Throws:
GovernanceException - if the operation failed.

addGovernanceArtifactEntry

public static void addGovernanceArtifactEntry(org.wso2.carbon.registry.core.Registry registry,
                                              String artifactId,
                                              String artifactPath)
                                       throws GovernanceException
Method to register a governance artifact.

Parameters:
registry - the registry instance.
artifactId - the identifier of the artifact.
artifactPath - the path of the artifact.
Throws:
GovernanceException - if the operation failed.

buildOMElement

public static org.apache.axiom.om.OMElement buildOMElement(byte[] content)
                                                    throws GovernanceException
Method to build an AXIOM element from a byte stream.

Parameters:
content - the stream of bytes.
Returns:
the AXIOM element.
Throws:
GovernanceException - if the operation failed.

serializeOMElement

public static String serializeOMElement(org.apache.axiom.om.OMElement element)
                                 throws GovernanceException
Method to serialize an XML element into a string.

Parameters:
element - the XML element.
Returns:
the corresponding String representation
Throws:
GovernanceException - if the operation failed.

derivePathFromQName

public static String derivePathFromQName(QName qName)
Method to obtain a path from a qualified name.

Parameters:
qName - the qualified name.
Returns:
the corresponding path.

getResultPaths

public static String[] getResultPaths(org.wso2.carbon.registry.core.Registry registry,
                                      String mediaType)
                               throws GovernanceException
Method to obtain a list of paths having resources of the given media type.

Parameters:
registry - the registry instance to run query on.
mediaType - the media type.
Returns:
an array of resource paths.
Throws:
GovernanceException - if the operation failed.

getRelativeServicePath

public static String getRelativeServicePath(org.wso2.carbon.registry.core.config.RegistryContext registryContext,
                                            QName qName)
Method to derive the relative service path for the given qualified name.

Parameters:
registryContext - the registry context to use.
qName - the qualified name.
Returns:
the relative service path.


Copyright © 2010 WSO2 Inc. All Rights Reserved.