public class MetadataFactory extends NamespaceContainer
Modifier and Type | Field and Description |
---|---|
protected int |
count |
ACCUMULO_PREFIX, COUCHBASE_PREFIX, EXCEL_PREFIX, HBASE_PREFIX, INFINISPAN_PREFIX, JPA_PREFIX, LDAP_PREFIX, MONGO_PREFIX, ODATA_PREFIX, PI_PREFIX, RELATIONAL_PREFIX, REST_PREFIX, SF_PREFIX, SPATIAL_PREFIX, WS_PREFIX
Constructor and Description |
---|
MetadataFactory() |
MetadataFactory(String vdbName,
Object vdbVersion,
Map<String,Datatype> runtimeTypes,
ModelMetaData model) |
MetadataFactory(String vdbName,
Object vdbVersion,
String schemaName,
Map<String,Datatype> runtimeTypes,
Properties modelProperties,
String rawMetadata) |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
addColumnPermission(String role,
Column resource,
Boolean allowCreate,
Boolean allowRead,
Boolean allowUpdate,
String mask,
Integer order)
Add a permission for a
Column |
void |
addColumnPermission(String role,
Column resource,
Boolean allowCreate,
Boolean allowRead,
Boolean allowUpdate,
String condition,
String mask,
Integer order)
Deprecated.
|
ForeignKey |
addForeignKey(String name,
List<String> columnNames,
List<String> referencedColumnNames,
String referenceTable,
Table table)
Adds a foreign key to the given table.
|
ForeignKey |
addForeignKey(String name,
List<String> columnNames,
String referenceTable,
Table table)
Adds a foreign key to the given table.
|
ForeignKey |
addForiegnKey(String name,
List<String> columnNames,
List<String> referencedColumnNames,
String referenceTable,
Table table)
Deprecated.
|
ForeignKey |
addForiegnKey(String name,
List<String> columnNames,
String referenceTable,
Table table)
Deprecated.
|
void |
addFunction(FunctionMethod functionMethod) |
FunctionMethod |
addFunction(String name)
Add a function with the given name to the model.
|
FunctionMethod |
addFunction(String name,
Method method)
Adds a non-pushdown function based upon the given
Method . |
FunctionMethod |
addFunction(String name,
String returnType,
String... paramTypes)
Add a function with the given name to the model.
|
KeyRecord |
addFunctionBasedIndex(String name,
List<String> expressions,
List<Boolean> nonColumnExpressions,
Table table)
Adds a function based index on the given expressions.
|
KeyRecord |
addIndex(String name,
boolean nonUnique,
List<String> columnNames,
Table table)
Adds an index to the given table.
|
void |
addPermission(String role,
AbstractMetadataRecord resource,
Boolean allowAlter,
Boolean allowCreate,
Boolean allowRead,
Boolean allowUpdate,
Boolean allowDelete,
Boolean allowExecute)
|
void |
addPermission(String role,
AbstractMetadataRecord resource,
Boolean allowAlter,
Boolean allowCreate,
Boolean allowRead,
Boolean allowUpdate,
Boolean allowDelete,
Boolean allowExecute,
String condition,
Boolean constraint)
Deprecated.
|
void |
addPolicy(String role,
String policyName,
AbstractMetadataRecord resource,
String condition,
Policy.Operation... operations)
|
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.
|
void |
addSchemaPermission(String role,
Boolean allowAlter,
Boolean allowCreate,
Boolean allowRead,
Boolean allowUpdate,
Boolean allowDelete,
Boolean allowExecute)
Add a permission for the current
Schema which will typically act as a default for all child objects. |
Table |
addTable(String name)
Add a table with the given name to the model.
|
MetadataStore |
asMetadataStore() |
void |
correctDatatypes(Map<String,Datatype> dt)
To be called if the MetadataFactory is deserialized to set the canonical system
type value.
|
static FunctionMethod |
createFunctionFromMethod(String name,
Method method) |
Map<String,Datatype> |
getDataTypes()
get runtime types keyed by runtime name, which is
a type name known to the Teiid engine
|
Properties |
getImportProperties()
Deprecated.
|
Model |
getModel() |
Properties |
getModelProperties() |
String |
getName() |
String |
getNameFormat() |
Parser |
getParser() |
String |
getRawMetadata()
Deprecated.
|
Schema |
getSchema() |
ClassLoader |
getVDBClassLoader() |
String |
getVdbName() |
Map<String,? extends VDBResource> |
getVDBResources() |
String |
getVdbVersion() |
static String |
hex(long val,
int hexLength) |
boolean |
isAutoCorrectColumnNames() |
boolean |
isImportPushdownFunctions() |
boolean |
isRenameAllDuplicates() |
boolean |
isRenameDuplicateColumns() |
boolean |
isRenameDuplicateTables() |
void |
mergeInto(MetadataStore store) |
void |
parse(Reader ddl)
Parses, but does not close, the given
Reader into this MetadataFactory |
Column |
renameColumn(String oldName,
String name,
ColumnSet<?> table) |
ProcedureParameter |
renameParameter(String oldName,
String name,
Procedure procedure) |
void |
setAutoCorrectColumnNames(boolean autoCorrectColumnNames)
Set to false to disable correcting column and other names to be valid Teiid names.
|
static Datatype |
setDataType(String type,
BaseColumn column,
Map<String,Datatype> dataTypes,
boolean allowNull) |
void |
setImportPushdownFunctions(boolean importPushdownFunctions) |
void |
setModel(ModelMetaData model) |
void |
setNameFormat(String nameFormat) |
void |
setParser(Parser parser) |
void |
setRenameAllDuplicates(boolean renameAllDuplicates) |
void |
setRenameDuplicateColumns(boolean renameDuplicateColumns) |
void |
setRenameDuplicateTables(boolean renameDuplicateTables) |
void |
setSchema(Schema schema)
Set the
Schema to a different instance. |
protected void |
setUUID(AbstractMetadataRecord record) |
void |
setVDBClassLoader(ClassLoader classLoader) |
void |
setVdbResources(Map<String,? extends VDBResource> vdbResources) |
addNamespace, getLegacyKey, resolvePropertyKey
public MetadataFactory()
public MetadataFactory(String vdbName, Object vdbVersion, Map<String,Datatype> runtimeTypes, ModelMetaData model)
public static String hex(long val, int hexLength)
@Deprecated public Properties getImportProperties()
getModelProperties()
public Properties getModelProperties()
@Deprecated public String getRawMetadata()
public Model getModel()
protected void setUUID(AbstractMetadataRecord record)
public String getName()
public Schema getSchema()
public Table addTable(String name)
name
- MetadataException
public Column addColumn(String name, String type, ColumnSet<?> table)
name
- type
- should be one of TypeFacility.RUNTIME_NAMES
table
- MetadataException
public ProcedureParameter renameParameter(String oldName, String name, Procedure procedure)
public static Datatype setDataType(String type, BaseColumn column, Map<String,Datatype> dataTypes, boolean allowNull)
public KeyRecord addPrimaryKey(String name, List<String> columnNames, Table table)
name
- columnNames
- table
- MetadataException
public KeyRecord addAccessPattern(String name, List<String> columnNames, Table table)
name
- columnNames
- table
- MetadataException
public KeyRecord addIndex(String name, boolean nonUnique, List<String> columnNames, Table table)
name
- nonUnique
- true indicates that an index is being added.columnNames
- table
- MetadataException
public KeyRecord addFunctionBasedIndex(String name, List<String> expressions, List<Boolean> nonColumnExpressions, Table table)
name
- expressions
- nonColumnExpressions
- a Boolean list indicating when expressions are non-column expressionstable
- MetadataException
public ForeignKey addForeignKey(String name, List<String> columnNames, String referenceTable, Table table)
name
- columnNames
- referenceTable
- - schema qualified reference table nametable
- MetadataException
@Deprecated public ForeignKey addForiegnKey(String name, List<String> columnNames, String referenceTable, Table table)
public ForeignKey addForeignKey(String name, List<String> columnNames, List<String> referencedColumnNames, String referenceTable, Table table)
name
- columnNames
- referencedColumnNames
- may be null to indicate that the primary key should be used.referenceTable
- - schema qualified reference table name, can be from another schematable
- MetadataException
@Deprecated public ForeignKey addForiegnKey(String name, List<String> columnNames, List<String> referencedColumnNames, String referenceTable, Table table)
public Procedure addProcedure(String name)
name
- MetadataException
public ProcedureParameter addProcedureParameter(String name, String type, ProcedureParameter.Type parameterType, Procedure procedure)
name
- type
- should be one of TypeFacility.RUNTIME_NAMES
parameterType
- should be one of ProcedureParameter.Type
procedure
- MetadataException
public Column addProcedureResultSetColumn(String name, String type, Procedure procedure)
name
- type
- should be one of TypeFacility.RUNTIME_NAMES
procedure
- MetadataException
public FunctionMethod addFunction(String name)
name
- MetadataException
public FunctionMethod addFunction(String name, String returnType, String... paramTypes)
name
- MetadataException
public FunctionMethod addFunction(String name, Method method)
Method
.name
- method
- MetadataException
public static FunctionMethod createFunctionFromMethod(String name, Method method)
public void setAutoCorrectColumnNames(boolean autoCorrectColumnNames)
autoCorrectColumnNames
- public void mergeInto(MetadataStore store)
public MetadataStore asMetadataStore()
public void setSchema(Schema schema)
Schema
to a different instance. This is typically called
in special situations where the MetadataFactory
logic is not used
to construct the Schema
.schema
- public Map<String,Datatype> getDataTypes()
public void correctDatatypes(Map<String,Datatype> dt)
dt
- public String getVdbName()
public String getVdbVersion()
public void parse(Reader ddl) throws MetadataException
Reader
into this MetadataFactory
ddl
- MetadataException
public void setParser(Parser parser)
public void setModel(ModelMetaData model)
public Parser getParser()
public Map<String,? extends VDBResource> getVDBResources()
public void setVdbResources(Map<String,? extends VDBResource> vdbResources)
@Deprecated public void addPermission(String role, AbstractMetadataRecord resource, Boolean allowAlter, Boolean allowCreate, Boolean allowRead, Boolean allowUpdate, Boolean allowDelete, Boolean allowExecute, String condition, Boolean constraint)
role
- resource
- allowAlter
- allowCreate
- allowRead
- allowUpdate
- allowDelete
- allowExecute
- condition
- constraint
- public void addPermission(String role, AbstractMetadataRecord resource, Boolean allowAlter, Boolean allowCreate, Boolean allowRead, Boolean allowUpdate, Boolean allowDelete, Boolean allowExecute)
role
- resource
- allowAlter
- allowCreate
- allowRead
- allowUpdate
- allowDelete
- allowExecute
- public void addSchemaPermission(String role, Boolean allowAlter, Boolean allowCreate, Boolean allowRead, Boolean allowUpdate, Boolean allowDelete, Boolean allowExecute)
Schema
which will typically act as a default for all child objects.role
- allowAlter
- allowCreate
- allowRead
- allowUpdate
- allowDelete
- allowExecute
- @Deprecated public void addColumnPermission(String role, Column resource, Boolean allowCreate, Boolean allowRead, Boolean allowUpdate, String condition, String mask, Integer order)
Column
role
- resource
- allowCreate
- allowRead
- allowUpdate
- condition
- must be nullmask
- order
- public void addColumnPermission(String role, Column resource, Boolean allowCreate, Boolean allowRead, Boolean allowUpdate, String mask, Integer order)
Column
role
- resource
- allowCreate
- allowRead
- allowUpdate
- mask
- order
- public void addPolicy(String role, String policyName, AbstractMetadataRecord resource, String condition, Policy.Operation... operations)
role
- resource
- condition
- operations
- public void addFunction(FunctionMethod functionMethod)
@TranslatorProperty(display="Auto-correct Column Names", category=IMPORT, description="If true replace the . character with _ in the Teiid column name, otherwise an exception will be raised.") public boolean isAutoCorrectColumnNames()
@TranslatorProperty(display="Rename All Duplicate Names", category=IMPORT, description="Provide a unique Teiid name for all duplicate names (typically due to Teiid\'s case insensitivity).") public boolean isRenameAllDuplicates()
@TranslatorProperty(display="Rename Duplicate Columns", category=IMPORT, description="Provide a unique Teiid name for duplicate column names (typically due to Teiid\'s case insensitivity).") public boolean isRenameDuplicateColumns()
@TranslatorProperty(display="Rename Duplicate Tables", category=IMPORT, description="Provide a unique Teiid name for duplicate table names (typically due to Teiid\'s case insensitivity).") public boolean isRenameDuplicateTables()
public void setRenameAllDuplicates(boolean renameAllDuplicates)
public void setRenameDuplicateColumns(boolean renameDuplicateColumns)
public void setRenameDuplicateTables(boolean renameDuplicateTables)
@TranslatorProperty(display="Name Format", category=IMPORT, description="The Java String Format to manipulate table and procedure names.") public String getNameFormat()
public void setNameFormat(String nameFormat)
@TranslatorProperty(display="Import Pushdown Functions", category=IMPORT, description="Expose translator pushdown functions on the source model, so that the functions are known to design environments.") public boolean isImportPushdownFunctions()
public void setImportPushdownFunctions(boolean importPushdownFunctions)
public void setVDBClassLoader(ClassLoader classLoader)
public ClassLoader getVDBClassLoader()
Copyright © 2020. All rights reserved.