3 Replies Latest reply on Aug 24, 2013 12:26 PM by Ramesh Reddy

    Dynamic creation of TEIID VDB examples

    lawrence jesu Newbie

      Hi,

        Can we create VDB dynamicaly by admi API? please post the sample code.

       

       

      -Lawrence

        • 1. Re: Dynamic creation of TEIID VDB examples
          Ramesh Reddy Master

          Dynamic VDB is just an XML file, so you can create however you want that file, but we also provide some helper classes see example test code https://github.com/teiid/teiid/blob/master/jboss-admin/src/test/java/org/teiid/adminapi/jboss/TestVDBMetaData.java

           

          Once you have the VDB, then you can do variety of operations to deploy and create data sources through Admin API, for that see an example here teiid/IntegrationTestDeployment.java at master · teiid/teiid · GitHub

           

          Ramesh..

          • 2. Re: Dynamic creation of TEIID VDB examples
            lawrence jesu Newbie

            Ramesh,

                       Thanks for your reply. I did understand partialy. please look here i have my vdb file created through teiid desiner. Now i need to create it by java code.

             

            ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
            <vdb version="1" name="GFA_IRD">
                <property value="false" name="preview"/>
                <model visible="true" type="VIRTUAL" name="ACCOUNTS" path="/GFAIntegration/views/ACCOUNTS.xmi">
                    <property value="4237559554" name="checksum"/>
                    <property value="Relational" name="modelClass"/>
                    <property value="false" name="builtIn"/>
                    <property value="2448556647.INDEX" name="indexName"/>
                    <property value="/GFAIntegration/sources/OracleGFADevDS.xmi" name="imports"/>
                    <property value="/GFAIntegration/web_services/ESF_FUND_LIST_VIEW.xmi" name="imports"/>
                    <property value="/GFAIntegration/web_services/ESF_FUND_LIST_DS.xmi" name="imports"/>
                    <validation-error path="DM_RPT_ACCOUNT_SALDOS/FUND_ID_2" severity="WARNING">Missing or invalid Precision on column with a numeric datatype (See validation Preferences)</validation-error>
                    <validation-error path="DM_RPT_ACCOUNT_SALDOS/FUND_ID_1" severity="WARNING">Missing or invalid Precision on column with a numeric datatype (See validation Preferences)</validation-error>
                    <validation-error path="DM_RPT_ACCOUNT_SALDOS/ASSET_ID_1" severity="WARNING">Missing or invalid Precision on column with a numeric datatype (See validation Preferences)</validation-error>
                    <validation-error path="DM_RPT_ACCOUNT_SALDOS/TRANCHE_ID_1" severity="WARNING">Missing or invalid Precision on column with a numeric datatype (See validation Preferences)</validation-error>
                </model>

             

            </vd>

             

             

             

             

            How to do create this VDB through Admin API?  If you use Eclipse pls tell me how to do the ENV setup?

             

             

            Thanks

            Lawrence

             

             

            • 3. Re: Dynamic creation of TEIID VDB examples
              Ramesh Reddy Master

              Lawrence,

               

              There two types of VDBs. Designer based and Dynamic VDB.  Designer based can only be created using the Teiid Designer. Dynamic VDB is similar to Designer based VDB, but it is purely defined by "vdb.xml" file and metadata of the models is defined through DDL.

               

              You CAN NOT create Designer based VDBs programmatically. Where as you can create a Dynamic VDBs as they are simple XML files containing DDL as metadata. The example, I gave above shows you how to create Dynamic VDB.  Each physical model inside the VDB defines a physical data source. A Virtual model defines "Views", you can create metadata for models using DDL definitions here. If you are JDBC and some other sources, the physical models can also be dynamically imported.

               

              So, use the example from TestVDBMetadata.java class to define a "something-vdb.xml" file, and use DDL to define metadata, then deploy the VDB  through Admin API. If you are not familiar with Teiid then I strongly suggest going through a Quick Start example first and understand the basics before you jump into the creating the VDB programmatically.

               

              Hopefully the above gives you enough information to start. If you need further assistance please let us know.

               

              Thanks

               

              Ramesh..