org.gvsig.metadata.lib.ioexchanger.iso19139.parser.io
Interface IOExchangerManager


public interface IOExchangerManager


Field Summary
static String PARAM_ACTION
           
static String PARAM_EXCHANGERID
           
static String PARAM_FILE
           
 
Method Summary
 DynObject createExchangerParameters(String formatName)
          Creates the appropriate DynObject object containing the required parameters to be fulfilled before calling the import/export operations.
 MetadataExchanger createMetadataExchanger(String exchangerID, DynObject parameters)
          Gets an Exchanger instance based on a previously registered.
 DynStruct getExchangerDefinition(String definitionID)
          Gets the currend exchanger definition, if any.
 Map<String,DynStruct> getExchangerDefinitions()
          Gets all current exchanger registered definitions.
 Map<String,DynStruct> getExchangerDefinitions(DynStruct mainDynClass)
          Gets all current exchanger registered definitions ommiting the given mainDynClass.
 List<MetadataExchangerFactory> getMetadataExchangers()
          Gets a list of the current Exchangers available
 boolean hasDefinition(DynStruct definition)
          Checks if has a given definition as exchanger definition or not.
 void loadMetadata(DynObject inParams, Metadata metadata)
          Adds to the metadata object the meaningful field values given by an InputStream object based on the formatType we want (ISO,NEM, IDEC, and so on).
 void registerExchangerDefinition(DynStruct exchangerDefinition, boolean addToDynObjectManager)
          Adds exchanger definitions to the manager, also added to the system (dynManager) if needed.
 DynStruct registerExchangerDefinition(String metadataName, String metadataDescription, boolean addToDynObjectManager)
          Adds exchanger definitions to the manager, also added to the system (dynManager) if needed.
 void registerMetadataExchanger(MetadataExchangerFactory metadataExchangerFactory)
          Registers a new Metadata Exchanger to load and write from one specific resource type to the metadata object.
 MetadataExchangerFactory removeMetadataExchanger(String exchangerId)
          Remove a MetadataExchanger (if exists) from the registered list based on its id.
 void saveMetadata(DynObject outParams, Metadata metadata)
          Writes to the meaningful metadata values the meaningful field values given to a InputStream object based on the formatType we want (ISO,NEM, IDEC, and so on).
 

Field Detail

PARAM_FILE

static final String PARAM_FILE
See Also:
Constant Field Values

PARAM_EXCHANGERID

static final String PARAM_EXCHANGERID
See Also:
Constant Field Values

PARAM_ACTION

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

registerMetadataExchanger

void registerMetadataExchanger(MetadataExchangerFactory metadataExchangerFactory)
Registers a new Metadata Exchanger to load and write from one specific resource type to the metadata object.

Parameters:
metadataExchangerFactory - the metadataExchanger instance to be registered.

removeMetadataExchanger

MetadataExchangerFactory removeMetadataExchanger(String exchangerId)
Remove a MetadataExchanger (if exists) from the registered list based on its id.

Parameters:
exchangerId - the MetadataExchanger identifier.

createMetadataExchanger

MetadataExchanger createMetadataExchanger(String exchangerID,
                                          DynObject parameters)
                                          throws ExchangerNotFoundException
Gets an Exchanger instance based on a previously registered.

Parameters:
exchangerId - the Metadata Exchanger identifier
Returns:
the MetadataExchanger instance. Throws EchangerNotFoundException if the key was not previously registered with a MetadataExchanger instance.
Throws:
ExchangerNotFoundException - exception thrown when the exchanger has not been found.

loadMetadata

void loadMetadata(DynObject inParams,
                  Metadata metadata)
                  throws ExchangerNotFoundException
Adds to the metadata object the meaningful field values given by an InputStream object based on the formatType we want (ISO,NEM, IDEC, and so on). The steps are: 0. Getting the correspondent parser based on the formatType chosen. Throw ExchangerNotfoundException if no parser has been found. 1. Parsing the document. - Parse of InputStream to look for meaningful items that match with the metadata fields. - For each meaningful field, cast its parsed value into the right dynField type - For each successfully casted field value, add it into a intermediate HashMap-like structure. - Do this until the end of the document. 2. Iterate the metadata object to add its casted dynValues mapped in the intermediate structure.

Parameters:
inParams - the DynObject object, normally corresponding to a FileInputStream instance. This parameters should contain at least a field "file" indicating the input or output file and the field "fileType" indicationg the Import/Export format type.
metadata - the metadata instance whose values are to be updated.
formatType - the Import/Export format type
Throws:
ExchangerNotFoundException - exception thrown when the exchanger has not been found.

saveMetadata

void saveMetadata(DynObject outParams,
                  Metadata metadata)
                  throws ExchangerNotFoundException
Writes to the meaningful metadata values the meaningful field values given to a InputStream object based on the formatType we want (ISO,NEM, IDEC, and so on). The steps are: 0. Getting the correspondent parser based on the formatType chosen. Throw ExchangerNotfoundException if no parser has been found. 1. Iterating the metadata values. - Iterate through the metadata values and get the ones that the Exchanger needs - Load these values into an intermediate HashMap-like structure. 2. Write the output - Create of File object based on the OnputStream one. - For each meaningful metadata value on the intermediate structure, use the parser to write in order the values into the file output.

Parameters:
outParams - the DynObject instance where to flush the metadata values.
metadata - the metadata object from which the current values have to be obtained.
exchangerID - the output format type desired.
Throws:
ExchangerNotFoundException - Exception thrown when the exchanger has not been found.

hasDefinition

boolean hasDefinition(DynStruct definition)
Checks if has a given definition as exchanger definition or not.

Parameters:
definition - the definition to be checked
Returns:

getExchangerDefinitions

Map<String,DynStruct> getExchangerDefinitions()
Gets all current exchanger registered definitions.

Returns:

getExchangerDefinitions

Map<String,DynStruct> getExchangerDefinitions(DynStruct mainDynClass)
Gets all current exchanger registered definitions ommiting the given mainDynClass.

Returns:

registerExchangerDefinition

void registerExchangerDefinition(DynStruct exchangerDefinition,
                                 boolean addToDynObjectManager)
                                 throws MetadataException
Adds exchanger definitions to the manager, also added to the system (dynManager) if needed. This is used for the inner dynObject definitions used within the main exchanger definition.

Parameters:
exchangerDefinition -
addToDynObjectManager -
Throws:
MetadataException

registerExchangerDefinition

DynStruct registerExchangerDefinition(String metadataName,
                                      String metadataDescription,
                                      boolean addToDynObjectManager)
                                      throws MetadataException
Adds exchanger definitions to the manager, also added to the system (dynManager) if needed. This is used for the inner dynObject definitions used within the main exchanger definition.

Parameters:
exchangerDefinition - the definition ID.
addToDynObjectManager -
Throws:
MetadataException

getExchangerDefinition

DynStruct getExchangerDefinition(String definitionID)
Gets the currend exchanger definition, if any.

Parameters:
definitionID -
Returns:

createExchangerParameters

DynObject createExchangerParameters(String formatName)
                                    throws ExchangerNotFoundException
Creates the appropriate DynObject object containing the required parameters to be fulfilled before calling the import/export operations.

Parameters:
formatName - the format from/to we want to import/export
Returns:
the dynObject containing the required parameters.
Throws:
ExchangerNotFoundException

getMetadataExchangers

List<MetadataExchangerFactory> getMetadataExchangers()
Gets a list of the current Exchangers available

Returns:


Copyright © 2004-2013 gvSIG. All Rights Reserved.