org.teiid.connector.metadata.runtime
Class MetadataFactory

java.lang.Object
  extended by org.teiid.connector.metadata.runtime.MetadataFactory
All Implemented Interfaces:
java.io.Serializable, ConnectorMetadata

public class MetadataFactory
extends java.lang.Object
implements ConnectorMetadata

See Also:
Serialized Form

Constructor Summary
MetadataFactory(java.lang.String modelName, java.util.Map<java.lang.String,DatatypeRecordImpl> dataTypes, java.util.Properties importProperties)
           
 
Method Summary
 AnnotationRecordImpl addAnnotation(java.lang.String annotation, AbstractMetadataRecord record)
          Add an annotation of description to a record.
 ColumnRecordImpl addColumn(java.lang.String name, java.lang.String type, ColumnSetRecordImpl table)
          Adds a column to the table with the given name and type.
 PropertyRecordImpl addExtensionProperty(java.lang.String name, java.lang.String value, AbstractMetadataRecord record)
          Adds an extension property to the given record.
 ForeignKeyRecordImpl addForiegnKey(java.lang.String name, java.util.List<java.lang.String> columnNames, TableRecordImpl pkTable, TableRecordImpl table)
          Adds a foreign key to the given table.
 ColumnSetRecordImpl addIndex(java.lang.String name, boolean nonUnique, java.util.List<java.lang.String> columnNames, TableRecordImpl table)
          Adds an index or unique key constraint to the given table.
 ColumnSetRecordImpl addPrimaryKey(java.lang.String name, java.util.List<java.lang.String> columnNames, TableRecordImpl table)
          Adds a primary key to the given table.
 ProcedureRecordImpl addProcedure(java.lang.String name)
          Add a procedure with the given name to the model.
 ProcedureParameterRecordImpl addProcedureParameter(java.lang.String name, java.lang.String type, short parameterType, ProcedureRecordImpl procedure)
           
 ColumnRecordImpl addProcedureResultSetColumn(java.lang.String name, java.lang.String type, ProcedureRecordImpl procedure)
           
 TableRecordImpl addTable(java.lang.String name)
          Add a table with the given name to the model.
 java.util.Collection<AnnotationRecordImpl> getAnnotations()
          Get the annotations defined for this model
 java.util.Properties getImportProperties()
           
 ModelRecordImpl getModel()
          Get the model that this metadata represents.
 java.util.Collection<ProcedureRecordImpl> getProcedures()
          Get the procedures defined for this model
 java.util.Collection<PropertyRecordImpl> getProperties()
          Get the extension properties defined for this model
 java.util.Collection<TableRecordImpl> getTables()
          Get the tables defined for this model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataFactory

public MetadataFactory(java.lang.String modelName,
                       java.util.Map<java.lang.String,DatatypeRecordImpl> dataTypes,
                       java.util.Properties importProperties)
Method Detail

getImportProperties

public java.util.Properties getImportProperties()

getModel

public ModelRecordImpl getModel()
Description copied from interface: ConnectorMetadata
Get the model that this metadata represents. The model name is treated as a top level schema for all source metadata.

Specified by:
getModel in interface ConnectorMetadata
Returns:

getTables

public java.util.Collection<TableRecordImpl> getTables()
Description copied from interface: ConnectorMetadata
Get the tables defined for this model

Specified by:
getTables in interface ConnectorMetadata
Returns:

getProcedures

public java.util.Collection<ProcedureRecordImpl> getProcedures()
Description copied from interface: ConnectorMetadata
Get the procedures defined for this model

Specified by:
getProcedures in interface ConnectorMetadata
Returns:

getAnnotations

public java.util.Collection<AnnotationRecordImpl> getAnnotations()
Description copied from interface: ConnectorMetadata
Get the annotations defined for this model

Specified by:
getAnnotations in interface ConnectorMetadata
Returns:

getProperties

public java.util.Collection<PropertyRecordImpl> getProperties()
Description copied from interface: ConnectorMetadata
Get the extension properties defined for this model

Specified by:
getProperties in interface ConnectorMetadata
Returns:

addTable

public TableRecordImpl addTable(java.lang.String name)
                         throws ConnectorException
Add a table with the given name to the model.

Parameters:
name -
Returns:
Throws:
ConnectorException

addColumn

public ColumnRecordImpl addColumn(java.lang.String name,
                                  java.lang.String type,
                                  ColumnSetRecordImpl table)
                           throws ConnectorException
Adds a column to the table with the given name and type.

Parameters:
name -
type - should be one of TypeFacility.RUNTIME_NAMES
table -
Returns:
Throws:
ConnectorException

addAnnotation

public AnnotationRecordImpl addAnnotation(java.lang.String annotation,
                                          AbstractMetadataRecord record)
Add an annotation of description to a record. Only one annotation should be added per record.

Parameters:
annotation -
record -
Returns:

addPrimaryKey

public ColumnSetRecordImpl addPrimaryKey(java.lang.String name,
                                         java.util.List<java.lang.String> columnNames,
                                         TableRecordImpl table)
                                  throws ConnectorException
Adds a primary key to the given table. The column names should be in key order.

Parameters:
name -
columnNames -
table -
Returns:
Throws:
ConnectorException

addIndex

public ColumnSetRecordImpl addIndex(java.lang.String name,
                                    boolean nonUnique,
                                    java.util.List<java.lang.String> columnNames,
                                    TableRecordImpl table)
                             throws ConnectorException
Adds an index or unique key constraint to the given table.

Parameters:
name -
nonUnique - true indicates that an index is being added.
columnNames -
table -
Returns:
Throws:
ConnectorException

addForiegnKey

public ForeignKeyRecordImpl addForiegnKey(java.lang.String name,
                                          java.util.List<java.lang.String> columnNames,
                                          TableRecordImpl pkTable,
                                          TableRecordImpl table)
                                   throws ConnectorException
Adds a foreign key to the given table. The column names should be in key order.

Parameters:
name -
columnNames -
pkTable -
table -
Returns:
Throws:
ConnectorException

addExtensionProperty

public PropertyRecordImpl addExtensionProperty(java.lang.String name,
                                               java.lang.String value,
                                               AbstractMetadataRecord record)
                                        throws ConnectorException
Adds an extension property to the given record.

Parameters:
name -
value -
record -
Returns:
Throws:
ConnectorException

addProcedure

public ProcedureRecordImpl addProcedure(java.lang.String name)
                                 throws ConnectorException
Add a procedure with the given name to the model.

Parameters:
name -
Returns:
Throws:
ConnectorException

addProcedureParameter

public ProcedureParameterRecordImpl addProcedureParameter(java.lang.String name,
                                                          java.lang.String type,
                                                          short parameterType,
                                                          ProcedureRecordImpl procedure)
                                                   throws ConnectorException
Parameters:
name -
type - should be one of MetadataConstants.PARAMETER_TYPES
parameterType - should be one of TypeFacility.RUNTIME_NAMES
procedure -
Returns:
Throws:
ConnectorException

addProcedureResultSetColumn

public ColumnRecordImpl addProcedureResultSetColumn(java.lang.String name,
                                                    java.lang.String type,
                                                    ProcedureRecordImpl procedure)
                                             throws ConnectorException
Parameters:
name -
type - should be one of TypeFacility.RUNTIME_NAMES
procedure -
Returns:
Throws:
ConnectorException


Copyright © 2009. All Rights Reserved.