Class SchemaManager
- java.lang.Object
-
- 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
Constructors Constructor Description SchemaManager(org.wso2.carbon.registry.core.Registry registry)Constructor accepting an instance of the registry to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSchema(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.SchemagetSchema(String schemaId)Fetches the given schema artifact on the registry.SchemanewSchema(byte[] content)Create a new Schema based on content either embedded or passed to a service.SchemanewSchema(byte[] content, String name)Create a new Schema based on content either embedded or passed to a service.SchemanewSchema(String url)Creates a new schema artifact from the given URL.voidremoveSchema(String schemaId)Removes the given schema artifact from the registry.protected voidsetContent(Schema schema, org.wso2.carbon.registry.core.Resource schemaResource)Sets content of the given schema artifact to the given resource on the registry.voidupdateSchema(Schema schema)Updates the given schema artifact on 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 contentname- 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.
-
-