Class SchemaManager
java.lang.Object
org.wso2.carbon.governance.api.schema.SchemaManager
This provides the management functionality for schema artifacts stored on the
registry.
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaManager(org.wso2.carbon.registry.core.Registry registry) Constructor accepting an instance of the registry to use. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given schema artifact to the registry.Schema[]findSchemas(SchemaFilter criteria) Finds all schema artifacts matching the given filter criteria.Schema[]Finds all schema artifacts on the registry.Fetches the given schema artifact on the registry.newSchema(byte[] content) Create a new Schema based on content either embedded or passed to a service.Create a new Schema based on content either embedded or passed to a service.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.
-
Constructor Details
-
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 Details
-
newSchema
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
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
Updates the given schema artifact on the registry.- Parameters:
schema- the schema artifact.- Throws:
GovernanceException- if the operation failed.
-
getSchema
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
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
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
Finds all schema artifacts on the registry.- Returns:
- all schema artifacts on the registry.
- Throws:
GovernanceException- if the operation failed.
-