Package 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
Fields -
Method Summary
Modifier and TypeMethodDescriptionorg.gvsig.tools.dynobject.DynStructaddDefinition(String name, InputStream stream, ClassLoader loader) Adds a new definition in the metadata manager.org.gvsig.tools.dynobject.DynStructaddDefinition(String name, String description) Adds a new definition in the metadata manager.voidaddDefinition(org.gvsig.tools.dynobject.DynClass definition) Adds a new definition in the metadata manager.This is a utility interface to implement classes that implement the interface Metadata.org.gvsig.tools.dynobject.DynStructgetDefinition(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.org.gvsig.tools.dynobject.DynStructgetDefinition(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.Retrieves all the current definitions in the form of an Iterator interface.getMetadata(String metadataID) Retrieves a metadata object based on its metadata ID.getMetadata(org.gvsig.tools.dynobject.DynStruct dynStruct) Creates a defaultMetadatainstance based on a givenDynStruct, if it has not been previously registered, and adds this Metadata to the system.Returns the main Metadata extension root repository.booleanAdded options properties getter for validating before the exporting function.booleanAdded options properties getter for validating before the saving function.voidloadMetadata(Metadata metadata) This function populates the given Metadata object with the current values that the system contains.voidremoveDefinition(org.gvsig.tools.dynobject.DynStruct dynStruct) If the current dynStruct has been previously registered, it is removed from both the dynObjectManager and the metadataManager lists.voidsetMetadataHomeRepository(File metadataHomeRepository) Sets the main Metadata root repository for this manager.voidsetValidationBeforeExporting(boolean doValidation) Added options properties setter for validating before the exporting function.voidsetValidationBeforeSaving(boolean doValidation) Added options properties setter for validating before the saving function.voidstoreMetadata(Metadata metadata) This function stores the given Metadata object to an output resource, be it a database or a file containing its information.
-
Field Details
-
METADATA_NAMESPACE
- See Also:
-
-
Method Details
-
addDefinition
org.gvsig.tools.dynobject.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 Namedescription- the definition Description- Returns:
- the created DynStruct definition
- Throws:
MetadataException
-
addDefinition
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
org.gvsig.tools.dynobject.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 Namestream- the input stream to be parsed.loader- the Class loader that can parse this input stream- Returns:
- the created DynStruct definition
- Throws:
MetadataException
-
getDefinition
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
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(org.gvsig.tools.dynobject.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(org.gvsig.tools.dynobject.DynStruct dynStruct) throws InvalidMetadataNamespaceException Creates a defaultMetadatainstance based on a givenDynStruct, 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
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
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
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
Sets the main Metadata root repository for this manager.- Parameters:
metadataHomeRepository- the main Repository folder.
-
getMetadata
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.
-