Class MetadataFactory

    • Field Detail

      • count

        protected int count
    • Method Detail

      • hex

        public static String hex​(long val,
                                 int hexLength)
      • getModelProperties

        public Properties getModelProperties()
      • getRawMetadata

        @Deprecated
        public String getRawMetadata()
        Deprecated.
        Get the metadata text for the first metadata element
        Returns:
      • getModel

        public Model getModel()
      • getName

        public String getName()
      • getSchema

        public Schema getSchema()
      • addTable

        public Table addTable​(String name)
        Add a table with the given name to the model.
        Parameters:
        name -
        Returns:
        Throws:
        MetadataException
      • addPrimaryKey

        public KeyRecord addPrimaryKey​(String name,
                                       List<String> columnNames,
                                       Table table)
        Adds a primary key to the given table. The column names should be in key order.
        Parameters:
        name -
        columnNames -
        table -
        Returns:
        Throws:
        MetadataException
      • addIndex

        public KeyRecord addIndex​(String name,
                                  boolean nonUnique,
                                  List<String> columnNames,
                                  Table table)
        Adds an index to the given table.
        Parameters:
        name -
        nonUnique - true indicates that an index is being added.
        columnNames -
        table -
        Returns:
        Throws:
        MetadataException
      • addFunctionBasedIndex

        public KeyRecord addFunctionBasedIndex​(String name,
                                               List<String> expressions,
                                               List<Boolean> nonColumnExpressions,
                                               Table table)
        Adds a function based index on the given expressions.
        Parameters:
        name -
        expressions -
        nonColumnExpressions - a Boolean list indicating when expressions are non-column expressions
        table -
        Returns:
        Throws:
        MetadataException
      • addForeignKey

        public ForeignKey addForeignKey​(String name,
                                        List<String> columnNames,
                                        String referenceTable,
                                        Table table)
        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 -
        referenceTable - - schema qualified reference table name
        table -
        Returns:
        Throws:
        MetadataException
      • addForeignKey

        public ForeignKey addForeignKey​(String name,
                                        List<String> columnNames,
                                        List<String> referencedColumnNames,
                                        String referenceTable,
                                        Table table)
        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. if reference table is is another schema, they will be resolved during validation.
        Parameters:
        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 schema
        table -
        Returns:
        Throws:
        MetadataException
      • addProcedure

        public Procedure addProcedure​(String name)
        Add a procedure with the given name to the model.
        Parameters:
        name -
        Returns:
        Throws:
        MetadataException
      • setAutoCorrectColumnNames

        public void setAutoCorrectColumnNames​(boolean autoCorrectColumnNames)
        Set to false to disable correcting column and other names to be valid Teiid names.
        Parameters:
        autoCorrectColumnNames -
      • setSchema

        public void setSchema​(Schema schema)
        Set the Schema to a different instance. This is typically called in special situations where the MetadataFactory logic is not used to construct the Schema.
        Parameters:
        schema -
      • getDataTypes

        public Map<String,​Datatype> getDataTypes()
        get runtime types keyed by runtime name, which is a type name known to the Teiid engine
        Returns:
      • correctDatatypes

        public void correctDatatypes​(Map<String,​Datatype> dt)
        To be called if the MetadataFactory is deserialized to set the canonical system type value.
        Parameters:
        dt -
      • getVdbName

        public String getVdbName()
      • getVdbVersion

        public String getVdbVersion()
      • setParser

        public void setParser​(Parser parser)
      • getParser

        public Parser getParser()
      • setVdbResources

        public void setVdbResources​(Map<String,​? extends VDBResource> vdbResources)
      • addSchemaPermission

        public 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.
        Parameters:
        role -
        allowAlter -
        allowCreate -
        allowRead -
        allowUpdate -
        allowDelete -
        allowExecute -
      • addColumnPermission

        @Deprecated
        public void addColumnPermission​(String role,
                                        Column resource,
                                        Boolean allowCreate,
                                        Boolean allowRead,
                                        Boolean allowUpdate,
                                        String condition,
                                        String mask,
                                        Integer order)
        Deprecated.
        Add a permission for a Column
        Parameters:
        role -
        resource -
        allowCreate -
        allowRead -
        allowUpdate -
        condition - must be null
        mask -
        order -
      • addColumnPermission

        public void addColumnPermission​(String role,
                                        Column resource,
                                        Boolean allowCreate,
                                        Boolean allowRead,
                                        Boolean allowUpdate,
                                        String mask,
                                        Integer order)
        Add a permission for a Column
        Parameters:
        role -
        resource -
        allowCreate -
        allowRead -
        allowUpdate -
        mask -
        order -
      • addFunction

        public void addFunction​(FunctionMethod functionMethod)
      • isAutoCorrectColumnNames

        @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()
      • isRenameDuplicateColumns

        @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()
      • isRenameDuplicateTables

        @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()
      • setRenameAllDuplicates

        public void setRenameAllDuplicates​(boolean renameAllDuplicates)
      • setRenameDuplicateColumns

        public void setRenameDuplicateColumns​(boolean renameDuplicateColumns)
      • setRenameDuplicateTables

        public void setRenameDuplicateTables​(boolean renameDuplicateTables)
      • setNameFormat

        public void setNameFormat​(String nameFormat)
      • isImportPushdownFunctions

        @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()
      • setImportPushdownFunctions

        public void setImportPushdownFunctions​(boolean importPushdownFunctions)
      • setVDBClassLoader

        public void setVDBClassLoader​(ClassLoader classLoader)
      • getVDBClassLoader

        public ClassLoader getVDBClassLoader()