au.org.intersect.exsite9.service
Class SchemaService

java.lang.Object
  extended by au.org.intersect.exsite9.service.SchemaService
All Implemented Interfaces:
ISchemaService

public final class SchemaService
extends java.lang.Object
implements ISchemaService

Handles working with Metadata Schemas.


Constructor Summary
SchemaService(java.io.File defaultSchemaDirectory, java.io.File defaultSchema, java.io.File metadataSchemaSchema, javax.persistence.EntityManagerFactory emf, SchemaDAOFactory schemaDAOFactory, MetadataCategoryDAOFactory metadataCategoryDAOFactory, MetadataAttributeDAOFactory metadataAttributeDAOFactory)
           
 
Method Summary
 void addMetadataCategoryToSchema(Schema schema, MetadataCategory metadataCategory)
          Adds a metadata category to a schema.
 void createImportedSchema(Schema schema)
          Persists an Imported Schema
 Schema createLocalSchema(java.lang.String schemaName, java.lang.String schemaDescription, java.lang.String schemaNamespaceURL)
          Creates a new Local Schema
 java.io.File getDefaultSchema()
          Obtains the default Schema.
 java.io.File getDefaultSchemaDirectory()
          Obtains the default directory on the file system that contains the pre-defined Schemas.
 Schema parseSchema(java.io.File xmlFile)
          Parses the provides schema XML file to a schema object.
 void removeMetadataCategoryFromSchema(Schema schema, MetadataCategory metadataCategory)
          Removes a metadata category from a schema.
 void removeSchema(Schema schema)
          Removes a schema, its association to a project, and its association to files/groups.
 void updateSchema(Schema schema, java.lang.String schemaName, java.lang.String schemaDescription, java.lang.String schemaNamespaceURL)
          Updates the details of the provided schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaService

public SchemaService(java.io.File defaultSchemaDirectory,
                     java.io.File defaultSchema,
                     java.io.File metadataSchemaSchema,
                     javax.persistence.EntityManagerFactory emf,
                     SchemaDAOFactory schemaDAOFactory,
                     MetadataCategoryDAOFactory metadataCategoryDAOFactory,
                     MetadataAttributeDAOFactory metadataAttributeDAOFactory)
Parameters:
defaultSchemaDirectory - The default directory that metadata schema's will lie in.
defaultSchema - The default metadata schema - loaded by default for new projects.
metadataSchemaSchema - The RELAX-NG format schema, used to validate metadata schemas.
emf -
schemaDAOFactory -
Method Detail

createLocalSchema

public Schema createLocalSchema(java.lang.String schemaName,
                                java.lang.String schemaDescription,
                                java.lang.String schemaNamespaceURL)
Creates a new Local Schema

Specified by:
createLocalSchema in interface ISchemaService
Parameters:
schemaName - The name of the schema.
schemaDescription - The description of the schema.
schemaNamespaceURL - The namespace URL of the schema.
Returns:
The newly created schema.

createImportedSchema

public void createImportedSchema(Schema schema)
Persists an Imported Schema

Specified by:
createImportedSchema in interface ISchemaService
Parameters:
schema - The schema to persist.

updateSchema

public void updateSchema(Schema schema,
                         java.lang.String schemaName,
                         java.lang.String schemaDescription,
                         java.lang.String schemaNamespaceURL)
Description copied from interface: ISchemaService
Updates the details of the provided schema.

Specified by:
updateSchema in interface ISchemaService
Parameters:
schema - The schema to update.
schemaName - The new name of the schema.
schemaDescription - The new description of the schema.
schemaNamespaceURL - The new namespace URL of the schema.

removeSchema

public void removeSchema(Schema schema)
Description copied from interface: ISchemaService
Removes a schema, its association to a project, and its association to files/groups.

Specified by:
removeSchema in interface ISchemaService
Parameters:
schema - The schema to delete.

addMetadataCategoryToSchema

public void addMetadataCategoryToSchema(Schema schema,
                                        MetadataCategory metadataCategory)
Description copied from interface: ISchemaService
Adds a metadata category to a schema.

Specified by:
addMetadataCategoryToSchema in interface ISchemaService
Parameters:
schema - The schema.
metadataCategory - The metadata category to add.

removeMetadataCategoryFromSchema

public void removeMetadataCategoryFromSchema(Schema schema,
                                             MetadataCategory metadataCategory)
Description copied from interface: ISchemaService
Removes a metadata category from a schema.

Specified by:
removeMetadataCategoryFromSchema in interface ISchemaService
Parameters:
schema - The schema.
metadataCategory - The metadata category to remove.

getDefaultSchemaDirectory

public java.io.File getDefaultSchemaDirectory()
Description copied from interface: ISchemaService
Obtains the default directory on the file system that contains the pre-defined Schemas.

Specified by:
getDefaultSchemaDirectory in interface ISchemaService
Returns:
The default directory on the file system that contains the pre-defined Schemas. May be null if there is no default schema directory.

getDefaultSchema

public java.io.File getDefaultSchema()
Obtains the default Schema.

Specified by:
getDefaultSchema in interface ISchemaService
Returns:
The default Schema to be used with new projects.

parseSchema

public Schema parseSchema(java.io.File xmlFile)
                   throws org.xml.sax.SAXException,
                          java.io.IOException,
                          javax.xml.parsers.ParserConfigurationException,
                          InvalidSchemaException
Description copied from interface: ISchemaService
Parses the provides schema XML file to a schema object. Does not persist the Schema to the database.

Specified by:
parseSchema in interface ISchemaService
Parameters:
xmlFile - The XML File to import.
Returns:
The imported Schema.
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
InvalidSchemaException