org.makumba.providers
Class DataDefinitionProvider

java.lang.Object
  extended by org.makumba.providers.DataDefinitionProvider
All Implemented Interfaces:
SingletonHolder
Direct Known Subclasses:
MakumbaDataDefinitionFactory, MDDProvider

public abstract class DataDefinitionProvider
extends Object
implements SingletonHolder

This class is a facade for creating different kinds of DataDefinitionProviders. Its constructor knows from a Configuration (or in the future maybe through other means) which implementation to use, and provides this implementation methods to its client, without revealing the implementation used.

Version:
$Id: DataDefinitionProvider.java 5154 2010-05-18 22:01:40Z rosso_nero $
Author:
Manuel Gay

Field Summary
(package private) static Map<String,DataDefinitionProvider> providerInstances
           
 
Constructor Summary
DataDefinitionProvider()
           
 
Method Summary
abstract  DataDefinition getDataDefinition(String typeName)
          Gets the data definition defined by the given type.
 Vector<String> getDataDefinitionsInDefaultLocations()
          gives a list of data definitions in the default locations of the data definition provider
 Vector<String> getDataDefinitionsInDefaultLocations(String... ignoreList)
          gives a list of data definitions in the default locations of the data definition provider, ignoring those MDDs that start with any of the strings in the ignoreList
 Vector<String> getDataDefinitionsInLocation(String location)
          gives a list of data definitions in a given location
static FieldDefinition getFieldDefinition(DataDefinition dd, String fieldName, String lineWithDefinition)
          This method finds a field definition with the given name within the given data definition.
static DataDefinitionProvider getInstance()
          Gives an instance of a DataDefinitionProvider.
abstract  DataDefinition getVirtualDataDefinition(String name)
           
abstract  FieldDefinition makeFieldDefinition(String name, String definition)
          makes a field definition from the indicated string
abstract  FieldDefinition makeFieldOfType(String name, String type)
          makes a field definition with the elementary type
abstract  FieldDefinition makeFieldOfType(String name, String type, String description)
          makes a field definition identical with the given one, except for the name
abstract  FieldDefinition makeFieldWithName(String name, FieldDefinition type)
          makes a field definition with the elementary type
abstract  FieldDefinition makeFieldWithName(String name, FieldDefinition type, String description)
          makes a field definition identical with the given one, except for the name and the description
 void release()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

providerInstances

static final Map<String,DataDefinitionProvider> providerInstances
Constructor Detail

DataDefinitionProvider

public DataDefinitionProvider()
Method Detail

getInstance

public static DataDefinitionProvider getInstance()
Gives an instance of a DataDefinitionProvider.


release

public void release()
Specified by:
release in interface SingletonHolder

getDataDefinition

public abstract DataDefinition getDataDefinition(String typeName)
Gets the data definition defined by the given type.


getVirtualDataDefinition

public abstract DataDefinition getVirtualDataDefinition(String name)

makeFieldDefinition

public abstract FieldDefinition makeFieldDefinition(String name,
                                                    String definition)
makes a field definition from the indicated string

Parameters:
name - the name of the field
definition - the definition string, e.g. "ptr general.Person ;pointer to a person"
Returns:
a field definition built on a definition string

makeFieldOfType

public abstract FieldDefinition makeFieldOfType(String name,
                                                String type)
makes a field definition with the elementary type

Parameters:
name - the name of the field
type - the type of the field
Returns:
a field definition generated by the name and the type of the field

makeFieldOfType

public abstract FieldDefinition makeFieldOfType(String name,
                                                String type,
                                                String description)
makes a field definition identical with the given one, except for the name

Parameters:
name - the name of the field
type - the FieldDefinition used as model
Returns:
a copy of the initial field definition with a different name

makeFieldWithName

public abstract FieldDefinition makeFieldWithName(String name,
                                                  FieldDefinition type)
makes a field definition with the elementary type

Parameters:
name - the name of the field
type - the elementary type of the field
description - the description of the field
Returns:
a field definition generated by the name, type and description of the field

makeFieldWithName

public abstract FieldDefinition makeFieldWithName(String name,
                                                  FieldDefinition type,
                                                  String description)
makes a field definition identical with the given one, except for the name and the description

Parameters:
name - the name of the field
type - the FieldDefinition used as model
description - the description of the field
Returns:
a copy of the initial field definition with a different name and description

getDataDefinitionsInLocation

public Vector<String> getDataDefinitionsInLocation(String location)
gives a list of data definitions in a given location

Parameters:
location - the location where the data definitions should be
Returns:
a vector with references to the data definitions in the location

getDataDefinitionsInDefaultLocations

public Vector<String> getDataDefinitionsInDefaultLocations()
gives a list of data definitions in the default locations of the data definition provider

Returns:
a vector with references to the data definitions in the default locations of the data definition provider

getDataDefinitionsInDefaultLocations

public Vector<String> getDataDefinitionsInDefaultLocations(String... ignoreList)
gives a list of data definitions in the default locations of the data definition provider, ignoring those MDDs that start with any of the strings in the ignoreList

Parameters:
ignoreList - a list of prefixes for MDDs to be ignored
Returns:
a vector with references to the data definitions in the default locations of the data definition provider

getFieldDefinition

public static final FieldDefinition getFieldDefinition(DataDefinition dd,
                                                       String fieldName,
                                                       String lineWithDefinition)
                                                throws DataDefinitionParseError
This method finds a field definition with the given name within the given data definition. The difference to a simple DataDefinition.getFieldDefinition(String) is that the field name can be of the form field.subfield.otherSubfield, over an arbitrary number of levels.

Throws:
DataDefinitionParseError