org.gvsig.metadata
Interface MetadataManager


public interface MetadataManager

Manages the load and storage of Metadata objects.

Version:
$Id$
Author:
gvSIG Team, César Ordiñana, cmartin

Field Summary
static String METADATA_NAMESPACE
           
 
Method Summary
 void addDefinition(DynClass definition)
          Adds a new definition in the metadata manager.
 DynStruct addDefinition(String name, InputStream stream, ClassLoader loader)
          Adds a new definition in the metadata manager.
 DynStruct addDefinition(String name, String description)
          Adds a new definition in the metadata manager.
 MetadataContainer createMetadataContainer(String name)
          This is a utility interface to implement classes that implement the interface Metadata.
 DynStruct getDefinition(Metadata metadata)
           If a Metadata definition ( DynStruct ) with a given metadata that has been previously registered in this manager, then this method returns that definition.
 DynStruct getDefinition(String definitionName)
           If a Metadata definition ( DynStruct ) with the given definition name has been previously registered in this manager, then this method returns that definition.
 Iterator getDefinitions()
           Retrieves all the current definitions in the form of an Iterator interface.
 Metadata getMetadata(DynStruct dynStruct)
          Creates a default Metadata instance based on a given DynStruct, if it has not been previously registered, and adds this Metadata to the system.
 Metadata getMetadata(String metadataID)
          Retrieves a metadata object based on its metadata ID.
 File getMetadataHomeRepository()
          Returns the main Metadata extension root repository.
 boolean getValidationBeforeExporting()
          Added options properties getter for validating before the exporting function.
 boolean getValidationBeforeSaving()
          Added options properties getter for validating before the saving function.
 void loadMetadata(Metadata metadata)
          This function populates the given Metadata object with the current values that the system contains.
 void removeDefinition(DynStruct dynStruct)
          If the current dynStruct has been previously registered, it is removed from both the dynObjectManager and the metadataManager lists.
 void setMetadataHomeRepository(File metadataHomeRepository)
          Sets the main Metadata root repository for this manager.
 void setValidationBeforeExporting(boolean doValidation)
          Added options properties setter for validating before the exporting function.
 void setValidationBeforeSaving(boolean doValidation)
          Added options properties setter for validating before the saving function.
 void storeMetadata(Metadata metadata)
          This function stores the given Metadata object to an output resource, be it a database or a file containing its information.
 

Field Detail

METADATA_NAMESPACE

static final String METADATA_NAMESPACE
See Also:
Constant Field Values
Method Detail

addDefinition

DynStruct addDefinition(String name,
                        String description)
                        throws MetadataException
Adds a new definition in the metadata manager. The new definition is defined in the namespace by default for DynClasses used for metadata.

Parameters:
name - the definition Name
description - the definition Description
Returns:
the created DynStruct definition
Throws:
MetadataException

addDefinition

void addDefinition(DynClass definition)
                   throws MetadataException
Adds a new definition in the metadata manager. The new definition is defined in the namespace by default for DynClasses used for metadata.

Parameters:
dynClass - the new definition
Throws:
MetadataException

addDefinition

DynStruct addDefinition(String name,
                        InputStream stream,
                        ClassLoader loader)
                        throws MetadataException
Adds a new definition in the metadata manager. The new definition is defined in the namespace by default for DynClasses used for metadata.

Parameters:
name - the definition Name
stream - the input stream to be parsed.
loader - the Class loader that can parse this input stream
Returns:
the created DynStruct definition
Throws:
MetadataException

getDefinition

DynStruct getDefinition(String definitionName)

If a Metadata definition ( DynStruct ) with the given definition name has been previously registered in this manager, then this method returns that definition. Otherwise, it returns null.

Parameters:
definitionName - the name whose corresponding attribute definition is to be retrieved.
Returns:
The attribute definition corresponding to the provided metadata class, or null otherwise.

getDefinitions

Iterator getDefinitions()

Retrieves all the current definitions in the form of an Iterator interface.

Returns:
The Metadata iterator containing the current metadata definitions

getDefinition

DynStruct getDefinition(Metadata metadata)
                        throws MetadataException

If a Metadata definition ( DynStruct ) with a given metadata that has been previously registered in this manager, then this method returns that definition. Otherwise, it returns null.

Parameters:
metadata - the given metadata.
Returns:
The attribute definition corresponding to the provided metadata class, or null otherwise.
Throws:
MetadataException

removeDefinition

void removeDefinition(DynStruct dynStruct)
If the current dynStruct has been previously registered, it is removed from both the dynObjectManager and the metadataManager lists. Otherwise, does nothing.

Parameters:
dynStruct - the dynStruct to be removed.

getMetadata

Metadata getMetadata(DynStruct dynStruct)
                     throws InvalidMetadataNamespaceException
Creates a default Metadata instance based on a given DynStruct, if it has not been previously registered, and adds this Metadata to the system.

Parameters:
dynStruct - the given dynStruct object.
Returns:
the resultant Metadata object.
Throws:
InvalidMetadataNamespaceException

loadMetadata

void loadMetadata(Metadata metadata)
                  throws MetadataException
This function populates the given Metadata object with the current values that the system contains. If there is any invalid access to an undeclared field, for example, a MetadataException will be thrown.

Parameters:
metadata - the metadata that needs to be populated.
Throws:
MetadataException - Exception caused by any access violation.

storeMetadata

void storeMetadata(Metadata metadata)
                   throws MetadataException
This function stores the given Metadata object to an output resource, be it a database or a file containing its information.

Parameters:
metadata - the metadata that needs to be stored.
Throws:
MetadataException - Exception caused by any access violation.

createMetadataContainer

MetadataContainer createMetadataContainer(String name)
This is a utility interface to implement classes that implement the interface Metadata. Use the createMetadataContainer in the MetadataManager to create a container for delegate the implementation of Metadata methods in it.

Parameters:
name - the DynStruct name.
Returns:
the metadata container.

getMetadataHomeRepository

File getMetadataHomeRepository()
Returns the main Metadata extension root repository.

Returns:
the File object containing the home repository folder

setMetadataHomeRepository

void setMetadataHomeRepository(File metadataHomeRepository)
Sets the main Metadata root repository for this manager.

Parameters:
metadataHomeRepository - the main Repository folder.

getMetadata

Metadata getMetadata(String metadataID)
                     throws InvalidMetadataNamespaceException
Retrieves a metadata object based on its metadata ID. This metadata object is basically a dynObject if metadata namespace set to "metadata".

Parameters:
metadataID - the metadata ID of the metadata object.
Returns:
Throws:
InvalidMetadataNamespaceException - if the metadataID was not previously registered as Metadata.

setValidationBeforeSaving

void setValidationBeforeSaving(boolean doValidation)
Added options properties setter for validating before the saving function. If it is set to false, the validation will not be performed.

Parameters:
doValidation - if the validation must be performed or not before saving metadata objects.

getValidationBeforeSaving

boolean getValidationBeforeSaving()
Added options properties getter for validating before the saving function. If it is set to false, the validation will not be performed.

Returns:
if the validation must be performed or not before saving metadata objects.

setValidationBeforeExporting

void setValidationBeforeExporting(boolean doValidation)
Added options properties setter for validating before the exporting function. If it is set to false, the validation will not be performed.

Parameters:
doValidation - if the validation must be performed or not before saving metadata objects.

getValidationBeforeExporting

boolean getValidationBeforeExporting()
Added options properties getter for validating before the exporting function. If it is set to false, the validation will not be performed.

Returns:
if the validation must be performed or not before saving metadata objects.


Copyright © 2004-2011 gvSIG. All Rights Reserved.