org.makumba.providers
Class DataDefinitionProvider

java.lang.Object
  extended by org.makumba.providers.DataDefinitionProvider
All Implemented Interfaces:
DataDefinitionProviderInterface

public class DataDefinitionProvider
extends Object
implements DataDefinitionProviderInterface

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 3575 2009-01-05 20:36:12Z manuel_gay $
Author:
Manuel Gay

Constructor Summary
DataDefinitionProvider()
           
 
Method Summary
 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()
           
 DataDefinition getVirtualDataDefinition(String name)
          Gets a virtual data definition
 FieldDefinition makeFieldDefinition(String name, String definition)
          makes a field definition from the indicated string FIXME this is particular to mdds
 FieldDefinition makeFieldOfType(String name, String type)
          makes a field definition with the elementary type
 FieldDefinition makeFieldOfType(String name, String type, String description)
          makes a field definition identical with the given one, except for the name
 FieldDefinition makeFieldWithName(String name, FieldDefinition type)
          makes a field definition with the elementary type
 FieldDefinition makeFieldWithName(String name, FieldDefinition type, String description)
          makes a field definition identical with the given one, except for the name and the description
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataDefinitionProvider

public DataDefinitionProvider()
Method Detail

getInstance

public static DataDefinitionProvider getInstance()

getDataDefinition

public DataDefinition getDataDefinition(String typeName)
Description copied from interface: DataDefinitionProviderInterface
Gets the data definition defined by the given type.

Specified by:
getDataDefinition in interface DataDefinitionProviderInterface

getDataDefinitionsInLocation

public Vector<String> getDataDefinitionsInLocation(String location)
Description copied from interface: DataDefinitionProviderInterface
gives a list of data definitions in a given location

Specified by:
getDataDefinitionsInLocation in interface DataDefinitionProviderInterface
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()
Description copied from interface: DataDefinitionProviderInterface
gives a list of data definitions in the default locations of the data definition provider

Specified by:
getDataDefinitionsInDefaultLocations in interface DataDefinitionProviderInterface
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)
Description copied from interface: DataDefinitionProviderInterface
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

Specified by:
getDataDefinitionsInDefaultLocations in interface DataDefinitionProviderInterface
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

getVirtualDataDefinition

public DataDefinition getVirtualDataDefinition(String name)
Description copied from interface: DataDefinitionProviderInterface
Gets a virtual data definition

Specified by:
getVirtualDataDefinition in interface DataDefinitionProviderInterface
Parameters:
name - the name of the virtual data definition
Returns:
a virtual data definition, representing e.g. a query result

makeFieldDefinition

public FieldDefinition makeFieldDefinition(String name,
                                           String definition)
Description copied from interface: DataDefinitionProviderInterface
makes a field definition from the indicated string FIXME this is particular to mdds

Specified by:
makeFieldDefinition in interface DataDefinitionProviderInterface
Parameters:
name - the name of the field
definition - the definition string
Returns:
a field definition built on a definition string

makeFieldOfType

public FieldDefinition makeFieldOfType(String name,
                                       String type)
Description copied from interface: DataDefinitionProviderInterface
makes a field definition with the elementary type

Specified by:
makeFieldOfType in interface DataDefinitionProviderInterface
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 FieldDefinition makeFieldOfType(String name,
                                       String type,
                                       String description)
Description copied from interface: DataDefinitionProviderInterface
makes a field definition identical with the given one, except for the name

Specified by:
makeFieldOfType in interface DataDefinitionProviderInterface
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 FieldDefinition makeFieldWithName(String name,
                                         FieldDefinition type)
Description copied from interface: DataDefinitionProviderInterface
makes a field definition with the elementary type

Specified by:
makeFieldWithName in interface DataDefinitionProviderInterface
Parameters:
name - the name of the field
type - the elementary type of the field
Returns:
a field definition generated by the name, type and description of the field

makeFieldWithName

public FieldDefinition makeFieldWithName(String name,
                                         FieldDefinition type,
                                         String description)
Description copied from interface: DataDefinitionProviderInterface
makes a field definition identical with the given one, except for the name and the description

Specified by:
makeFieldWithName in interface DataDefinitionProviderInterface
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

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