Data Request Broker
2-3-release

fr.gael.drb.impl
Class DrbDefaultMetadataResolver

java.lang.Object
  extended by fr.gael.drb.impl.DrbDefaultMetadataResolver
All Implemented Interfaces:
fr.gael.drb.meta.DrbMetadataResolver

public class DrbDefaultMetadataResolver
extends Object
implements fr.gael.drb.meta.DrbMetadataResolver

Standard Metadata Resolver.


Constructor Summary
DrbDefaultMetadataResolver()
           
 
Method Summary
static Hashtable<String,String> getExtensionHash()
          Allow to get a hashtable containing mapping between extension and implementations.
static Hashtable<String,String> getSchemaHash()
          Allow to get a hashtable containing mapping between extension and schemas.
static void registerItemNameExtension(String extension, String implementation_identifier)
          Registers an extension.
static void registerSchemaLocation(String extension, String schema_location)
          Registers a schema location path.
 fr.gael.drb.meta.DrbMetadata resolveMetadata(DrbItem item)
          Resolve the metadata from a single item.
 fr.gael.drb.meta.DrbMetadata resolveMetadata(DrbSequence sequence)
          Resolve the metadata from a sequence.
 fr.gael.drb.meta.DrbMetadata resolveMetadata(String item_name)
          Resolve a specific implementation by its identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrbDefaultMetadataResolver

public DrbDefaultMetadataResolver()
Method Detail

getExtensionHash

public static Hashtable<String,String> getExtensionHash()
Allow to get a hashtable containing mapping between extension and implementations. Note that the returned hashtable is a copy of the internal hashtable, therefore the class behaviour can not be altered throw this returned instance.

Returns:
a copy of the internal hashtable containing mapping between extension and implementations.

getSchemaHash

public static Hashtable<String,String> getSchemaHash()
Allow to get a hashtable containing mapping between extension and schemas. Note that the returned hashtable is a copy of the internal hashtable, therefore the class behaviour can not be altered throw this returned instance.

Returns:
a copy of the internal hashtable containing mapping between extension and schemas.

resolveMetadata

public fr.gael.drb.meta.DrbMetadata resolveMetadata(String item_name)
                                             throws NullPointerException
Resolve a specific implementation by its identifier. This methods uses the given item name extension i.e. the trailing characters next to the last period, to retrieve a corresponding implementation name. If the given name does not contain any period, this method returns null. If the extension does not match any entry of the internal registers, the this method returns null.

Should the implementation be identified, the output DrbMetadata object accept the implementationIdentifier property, that is assigned with the identifier retrieved from this class internal register. See registerItemNameExtension(String, String) for further information about augmenting the internal extension register.

Should the given item name extension also match an entry of the schema location register, the output DrbMetadata object also accept a schemaLocation property that locates an XML Schema document on the file system corresponding to any item with this extension. Warning: this class is not responsible in verifying if an actual XML Schema document exists at the given location. See registerSchemaLocation(String, String) for further information about augmenting the internal schema location register.

Specified by:
resolveMetadata in interface fr.gael.drb.meta.DrbMetadataResolver
Parameters:
item_name - the name of the item from with the requested metadata should derive.
Returns:
the metadata object matching the given item name.
Throws:
NullPointerException - if the given item name is null.

resolveMetadata

public fr.gael.drb.meta.DrbMetadata resolveMetadata(DrbItem item)
Resolve the metadata from a single item.

Specified by:
resolveMetadata in interface fr.gael.drb.meta.DrbMetadataResolver
Parameters:
item - The single item
Returns:
The metadata associated to the resource.

resolveMetadata

public fr.gael.drb.meta.DrbMetadata resolveMetadata(DrbSequence sequence)
Resolve the metadata from a sequence.

Specified by:
resolveMetadata in interface fr.gael.drb.meta.DrbMetadataResolver
Parameters:
sequence - The sequence
Returns:
The metadata associated to the ressource.

registerItemNameExtension

public static void registerItemNameExtension(String extension,
                                             String implementation_identifier)
                                      throws NullPointerException
Registers an extension. This method augments the internal register of item name extensions. This register is a map of item name extensions i.e. the trailing characters next to the last period of the name, to an implementation identifier. It is an error to map either a null extension or a null implementation identifier.

Parameters:
extension - item name extension that matches items to be attached to the given implementation.
schema_location - the location path of the registered schema
Throws:
NullPointerException - if one of the extension or the implementation_identifier is null.

registerSchemaLocation

public static void registerSchemaLocation(String extension,
                                          String schema_location)
Registers a schema location path.

Parameters:
extension - item name extension that matches items to be attached to the given schema_location.
schema_location - the location path of the registered schema

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .