Class SchemaManager


  • public class SchemaManager
    extends Object
    This provides the management functionality for schema artifacts stored on the registry.
    • 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​(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.