fipaos.parser.datamapping
Class DataMapperFactory


public class DataMapperFactory

This is a factory class used to create the proper type of DataMapper
instance given the location of an instance document. (DataMapper
objects are used to support language-independent data binding.) When a
DataMapper class is loaded it registers itself by passing a
DataMapperFactory.Creator instance to the register()
function of DataMapperFactory. This results in a binding between
the location of instance documents passed to the
createDataMapperByURL(), createDataMapperByFile() and
createDataMapper() functions of this class and the realizations of
the objects these documents describe. The
dataMapperFactory.properties properties file is used to insure that
all standard DataMapper subclasses are loaded before they're needed
by application code. The processes of marshalling and unmarshalling object
instances may utilize optional schema data given to the factory when a data
mapper instance was created.

Note: This class has neither instance variables not instance methods. As such,
it should not be instanciated.


Inner Class Summary
 public static classDataMapperFactory.Creator
          This is a functoid class.

Method Summary
 static DataMappercreateDataMapper(String data_url, String schema_url)
          Creates a DataMapper subclass based on the type of instance
document referred to by the data_url parameter, or null
if none of the registered data mapper classes are capable of support the given
instance document type.
 static DataMappercreateDataMapper(String data_url, String data, String schema_url)
          Creates a DataMapper subclass based on the type of instance
document referred to by the data_url parameter, the contents of which
are contained within the data parameter, or null
if none of the registered data mapper classes are capable of support the given
instance document type.
 static DataMappercreateDataMapper(List properties)
          Creates a DataMapper subclass based on the properties passed
 static IteratorcreateDataMappers(List properties)
          Creates DataMapper's based on the properties passed
 static voidmain(String[] args_array)
          Minimal test harness
 static voidregister(DataMapperFactory.Creator creator)
          When a DataMapper class is loaded it registers itself by passing a
DataMapperFactory.Creator instance to this function.

Method Detail

createDataMapper

public static DataMapper createDataMapper(String data_url, String schema_url)
Creates a DataMapper subclass based on the type of instance
document referred to by the data_url parameter, or null
if none of the registered data mapper classes are capable of support the given
instance document type.
Parameters:
data_url - - A URL/filename String that refers to the instance document a data mapper
is to be bound to.
schema_url - - An optional URL/filename String that refers to an schema that the data
mapper may use in the marshalling and unmarshalling process.
Returns: DataMapper that supports the given instance document, or
null if the document is not supported.

createDataMapper

public static DataMapper createDataMapper(String data_url, String data, String schema_url)
Creates a DataMapper subclass based on the type of instance
document referred to by the data_url parameter, the contents of which
are contained within the data parameter, or null
if none of the registered data mapper classes are capable of support the given
instance document type.
Parameters:
data_url - - A URL/filename String that refers to the instance document a data mapper
is to be bound to.
data - - The data contained within the named file
schema_url - - An optional URL/filename String that refers to an schema that the data
mapper may use in the marshalling and unmarshalling process.
Returns: DataMapper that supports the given instance document, or
null if the document is not supported.

createDataMapper

public static DataMapper createDataMapper(List properties)
Creates a DataMapper subclass based on the properties passed
Returns: DataMapper that supports the given properties, or
null if there is no DataMapper which matches.

createDataMappers

public static Iterator createDataMappers(List properties)
Creates DataMapper's based on the properties passed
Returns: Iterator containing all DataMapper's
matching the given properties.

main

public static void main(String[] args_array)
throws java.lang.Throwable
Minimal test harness

register

public static void register(DataMapperFactory.Creator creator)
When a DataMapper class is loaded it registers itself by passing a
DataMapperFactory.Creator instance to this function. This results
in a binding between the location of instance documents passed to the
createDataMapperByURL(), createDataMapperByFile() and
createDataMapper() functions and the realizations of the objects
these documents describe.
Parameters:
creator - - A DataMapperFactory.Creator having a
createIfSupported() function that takes a URL Strings
that refer to an instance document and optional schema document. Each
DataMapper subclass will implement this function to return a
DataMapper instance for those instance documents that it supports.

Association Links

to Class java.util.List

List of registered creators. Each subclass of DataMapper should
register a creator. The getInstance function of the factory iterates
through this list in reverse-chronological order until a creator
returns a DataMapper that can support the given URL.