public class MetadataFactory extends NamespaceContainer
Modifier and Type | Field and Description |
---|---|
protected int |
count |
ACCUMULO_URI, BUILTIN_NAMESPACES, COUCHBASE_URI, EXCEL_URI, HBASE_URI, INFINISPAN_URI, JPA_URI, LDAP_URI, MONGO_URI, namespaces, ODATA_URI, PI_URI, REST_URI, SF_URI, SPATIAL_URI, WS_URI
Constructor and Description |
---|
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 condition,
String mask,
Integer order)
Add a permission for a
Column |
ForeignKey |
addForiegnKey(String name,
List<String> columnNames,
List<String> referencedColumnNames,
String referenceTable,
Table table)
Adds a foreign key to the given table.
|
ForeignKey |
addForiegnKey(String name,
List<String> columnNames,
String referenceTable,
Table table)
Adds a foreign key to the given table.
|
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,
String condition,
Boolean constraint)
|
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() |
Map<String,String> |
getNamespaces()
Get the namespace map.
|
Parser |
getParser() |
String |
getRawMetadata()
Deprecated.
|
Schema |
getSchema() |
String |
getVdbName() |
Map<String,? extends VDBResource> |
getVDBResources() |
String |
getVdbVersion() |
static String |
hex(long val,
int hexLength) |
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) |
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 |
setModel(ModelMetaData model) |
void |
setParser(Parser parser) |
void |
setSchema(Schema schema)
Set the
Schema to a different instance. |
protected void |
setUUID(AbstractMetadataRecord record) |
void |
setVdbResources(Map<String,? extends VDBResource> vdbResources) |
addNamespace, resolvePropertyKey
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 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 addForiegnKey(String name, List<String> columnNames, String referenceTable, Table table)
name
- columnNames
- referenceTable
- - schema qualified reference table nametable
- MetadataException
public ForeignKey addForiegnKey(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
- addUniqueConstraint
- - if true, if the referenced table columns do not match with either PK, or FK then a UNIQUE index on reference table is created.MetadataException
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
- builtin
- public String getVdbName()
public String getVdbVersion()
public Map<String,String> getNamespaces()
NamespaceContainer.addNamespace(String, String)
has not been called successfully.getNamespaces
in class NamespaceContainer
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)
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 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
- 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
- mask
- order
- public void addFunction(FunctionMethod functionMethod)
Copyright © 2017 JBoss by Red Hat. All rights reserved.