public class MetadataFactory extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
ACCUMULO_URI |
static Map<String,String> |
BUILTIN_NAMESPACES |
protected int |
count |
static String |
EXCEL_URI |
static String |
HBASE_URI |
static String |
JPA_URI |
static String |
LDAP_URI |
static String |
MONGO_URI |
static String |
ODATA_URI |
static String |
PI_URI |
static String |
REST_URI |
static String |
SF_URI |
static String |
SPATIAL_URI |
static String |
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 |
void |
addDatatype(Datatype datatype)
Deprecated.
see addEnterpriseType
|
void |
addEnterpriseDatatype(Datatype datatype)
Add an enterprise type (typically a Designer defined type extension)- typically not called
|
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 |
addNamespace(String prefix,
String uri) |
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,
Map<String,Datatype> builtin)
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> |
getBuiltinDataTypes()
get all built-in types, known to Designer and defined in the system metadata.
|
Map<String,Datatype> |
getDataTypes()
get runtime types keyed by runtime name, which is
a type name known to the Teiid engine
|
Datatype |
getEnterpriseDatatype(String name)
Get an enterprise type (typically a Designer defined type extension) by name.
|
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 |
static String |
resolvePropertyKey(MetadataFactory factory,
String key) |
void |
setAutoCorrectColumnNames(boolean autoCorrectColumnNames)
Set to false to disable correcting column and other names to be valid Teiid names.
|
void |
setBuiltinDataTypes(Map<String,Datatype> builtinDataTypes) |
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) |
protected int count
public static final String SF_URI
public static final String WS_URI
public static final String MONGO_URI
public static final String ODATA_URI
public static final String ACCUMULO_URI
public static final String EXCEL_URI
public static final String JPA_URI
public static final String HBASE_URI
public static final String SPATIAL_URI
public static final String LDAP_URI
public static final String REST_URI
public static final String PI_URI
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, Map<String,Datatype> builtin)
dt
- builtin
- @Deprecated public void addDatatype(Datatype datatype)
datatype
- public void addEnterpriseDatatype(Datatype datatype)
datatype
- public Datatype getEnterpriseDatatype(String name)
name
- public String getVdbName()
public String getVdbVersion()
public Map<String,String> getNamespaces()
addNamespace(String, String)
has not been called successfully.public Map<String,Datatype> getBuiltinDataTypes()
for run-time types
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)
public static String resolvePropertyKey(MetadataFactory factory, String key)
Copyright © 2016 JBoss by Red Hat. All rights reserved.