org.teiid.metadata
Class MetadataFactory

java.lang.Object
  extended by org.teiid.metadata.MetadataFactory
Direct Known Subclasses:
PgCatalogMetadataStore

public class MetadataFactory
extends Object

Allows connectors to build metadata for use by the engine. TODO: add support for datatype import TODO: add support for unique constraints


Constructor Summary
MetadataFactory(String modelName, Map<String,Datatype> dataTypes, Properties importProperties)
           
 
Method Summary
 KeyRecord addAccessPattern(String name, List<String> columnNames, Table table)
          Adds an access pattern to the given table.
 Column addColumn(String name, String type, ColumnSet<?> table)
          Adds a column to the table with the given name and type.
 ForeignKey addForiegnKey(String name, List<String> columnNames, List<String> referencedColumnNames, Table pkTable, Table table, boolean addUniqueConstraint)
          Adds a foreign key to the given table.
 ForeignKey addForiegnKey(String name, List<String> columnNames, Table pkTable, Table table)
          Adds a foreign key to the given table.
 FunctionMethod addFunction(String name)
          Add a function with the given name to the model.
 KeyRecord addIndex(String name, boolean nonUnique, List<String> columnNames, Table table)
          Adds an index to the given table.
 KeyRecord addPrimaryKey(String name, List<String> columnNames, Table table)
          Adds a primary key to the given table.
 Procedure addProcedure(String name)
          Add a procedure with the given name to the model.
 ProcedureParameter addProcedureParameter(String name, String type, ProcedureParameter.Type parameterType, Procedure procedure)
          Add a procedure parameter.
 Column addProcedureResultSetColumn(String name, String type, Procedure procedure)
          Add a procedure resultset column to the given procedure.
 Table addTable(String name)
          Add a table with the given name to the model.
 Properties getImportProperties()
           
 MetadataStore getMetadataStore()
           
 void setAutoCorrectColumnNames(boolean autoCorrectColumnNames)
          Set to false to disable correcting column and other names to be valid Teiid names.
 void setMetadataStore(MetadataStore metadataStore)
           
protected  void setUUID(AbstractMetadataRecord record)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataFactory

public MetadataFactory(String modelName,
                       Map<String,Datatype> dataTypes,
                       Properties importProperties)
Method Detail

getMetadataStore

public MetadataStore getMetadataStore()

getImportProperties

public Properties getImportProperties()

setUUID

protected void setUUID(AbstractMetadataRecord record)

addTable

public Table addTable(String name)
               throws TranslatorException
Add a table with the given name to the model.

Parameters:
name -
Returns:
Throws:
TranslatorException

addColumn

public Column addColumn(String name,
                        String type,
                        ColumnSet<?> table)
                 throws TranslatorException
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:
TranslatorException

addPrimaryKey

public KeyRecord addPrimaryKey(String name,
                               List<String> columnNames,
                               Table table)
                        throws TranslatorException
Adds a primary key to the given table. The column names should be in key order.

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

addAccessPattern

public KeyRecord addAccessPattern(String name,
                                  List<String> columnNames,
                                  Table table)
                           throws TranslatorException
Adds an access pattern to the given table.

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

addIndex

public KeyRecord addIndex(String name,
                          boolean nonUnique,
                          List<String> columnNames,
                          Table table)
                   throws TranslatorException
Adds an index to the given table.

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

addForiegnKey

public ForeignKey addForiegnKey(String name,
                                List<String> columnNames,
                                Table pkTable,
                                Table table)
                         throws TranslatorException
Adds a foreign key to the given table. The referenced primary key must already exist. The column names should be in key order.

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

addForiegnKey

public ForeignKey addForiegnKey(String name,
                                List<String> columnNames,
                                List<String> referencedColumnNames,
                                Table pkTable,
                                Table table,
                                boolean addUniqueConstraint)
                         throws TranslatorException
Adds a foreign key to the given table. The referenced key may be automatically created if addUniqueConstraint is true. The column names should be in key order.

Parameters:
name -
columnNames -
referencedColumnNames, - may be null to indicate that the primary key should be used.
pkTable -
table -
addUniqueConstraint -
Returns:
Throws:
TranslatorException

addProcedure

public Procedure addProcedure(String name)
                       throws TranslatorException
Add a procedure with the given name to the model.

Parameters:
name -
Returns:
Throws:
TranslatorException

addProcedureParameter

public ProcedureParameter addProcedureParameter(String name,
                                                String type,
                                                ProcedureParameter.Type parameterType,
                                                Procedure procedure)
                                         throws TranslatorException
Add a procedure parameter.

Parameters:
name -
type - should be one of TypeFacility.RUNTIME_NAMES
parameterType - should be one of ProcedureParameter.Type
procedure -
Returns:
Throws:
TranslatorException

addProcedureResultSetColumn

public Column addProcedureResultSetColumn(String name,
                                          String type,
                                          Procedure procedure)
                                   throws TranslatorException
Add a procedure resultset column to the given procedure.

Parameters:
name -
type - should be one of TypeFacility.RUNTIME_NAMES
procedure -
Returns:
Throws:
TranslatorException

addFunction

public FunctionMethod addFunction(String name)
                           throws TranslatorException
Add a function with the given name to the model.

Parameters:
name -
Returns:
Throws:
TranslatorException

setAutoCorrectColumnNames

public void setAutoCorrectColumnNames(boolean autoCorrectColumnNames)
Set to false to disable correcting column and other names to be valid Teiid names.

Parameters:
autoCorrectColumnNames -

setMetadataStore

public void setMetadataStore(MetadataStore metadataStore)


Copyright © 2012. All Rights Reserved.