org.wso2.carbon.governance.api.schema
Class SchemaManager

java.lang.Object
  extended by org.wso2.carbon.governance.api.schema.SchemaManager

public class SchemaManager
extends Object

This provides the management functionality for schema artifacts stored on the registry.


Constructor Summary
SchemaManager(org.wso2.carbon.registry.core.Registry registry)
          Constructor accepting an instance of the registry to use.
 
Method Summary
 void addSchema(Schema schema)
          Adds the given schema artifact to the registry.
 Schema[] findSchemas(SchemaFilter criteria)
          Finds all schema artifacts matching the given filter criteria.
 Schema[] getAllSchemas()
          Finds all schema artifacts on the registry.
 Schema getSchema(String schemaId)
          Fetches the given schema artifact on the registry.
 Schema newSchema(byte[] content)
          Create a new Schema based on content either embedded or passed to a service.
 Schema newSchema(byte[] content, String name)
          Create a new Schema based on content either embedded or passed to a service.
 Schema newSchema(String url)
          Creates a new schema artifact from the given URL.
 void removeSchema(String schemaId)
          Removes the given schema artifact from the registry.
protected  void setContent(Schema schema, org.wso2.carbon.registry.core.Resource schemaResource)
          Sets content of the given schema artifact to the given resource on the registry.
 void updateSchema(Schema schema)
          Updates the given schema artifact on the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaManager

public SchemaManager(org.wso2.carbon.registry.core.Registry registry)
Constructor accepting an instance of the registry to use.

Parameters:
registry - the instance of the registry.
Method Detail

newSchema

public Schema newSchema(String url)
                 throws GovernanceException
Creates a new schema artifact from the given URL.

Parameters:
url - the given URL.
Returns:
the artifact added.
Throws:
GovernanceException - if the operation failed.

newSchema

public Schema newSchema(byte[] content)
                 throws org.wso2.carbon.registry.core.exceptions.RegistryException
Create a new Schema based on content either embedded or passed to a service.

Parameters:
content - the schema content
Returns:
the artifact added.
Throws:
GovernanceException - if the operation failed.
org.wso2.carbon.registry.core.exceptions.RegistryException

newSchema

public Schema newSchema(byte[] content,
                        String name)
                 throws org.wso2.carbon.registry.core.exceptions.RegistryException
Create a new Schema based on content either embedded or passed to a service.

Parameters:
content - the schema content
name - the schema name
Returns:
the artifact added.
Throws:
GovernanceException - if the operation failed.
org.wso2.carbon.registry.core.exceptions.RegistryException

addSchema

public void addSchema(Schema schema)
               throws GovernanceException
Adds the given schema 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:
schema - the schema artifact.
Throws:
GovernanceException - if the operation failed.

updateSchema

public void updateSchema(Schema schema)
                  throws GovernanceException
Updates the given schema artifact on the registry.

Parameters:
schema - the schema artifact.
Throws:
GovernanceException - if the operation failed.

getSchema

public Schema getSchema(String schemaId)
                 throws GovernanceException
Fetches the given schema artifact on the registry.

Parameters:
schemaId - the identifier of the schema artifact.
Returns:
the schema artifact.
Throws:
GovernanceException - if the operation failed.

removeSchema

public void removeSchema(String schemaId)
                  throws GovernanceException
Removes the given schema artifact from the registry.

Parameters:
schemaId - the identifier of the schema artifact.
Throws:
GovernanceException - if the operation failed.

setContent

protected void setContent(Schema schema,
                          org.wso2.carbon.registry.core.Resource schemaResource)
                   throws GovernanceException
Sets content of the given schema artifact to the given resource on the registry.

Parameters:
schema - the schema artifact.
schemaResource - the content resource.
Throws:
GovernanceException - if the operation failed.

findSchemas

public Schema[] findSchemas(SchemaFilter criteria)
                     throws GovernanceException
Finds all schema artifacts matching the given filter criteria.

Parameters:
criteria - the filter criteria to be matched.
Returns:
the schema artifacts that match.
Throws:
GovernanceException - if the operation failed.

getAllSchemas

public Schema[] getAllSchemas()
                       throws GovernanceException
Finds all schema artifacts on the registry.

Returns:
all schema artifacts on the registry.
Throws:
GovernanceException - if the operation failed.


Copyright © 2012 WSO2 Inc. All Rights Reserved.