Version 12

    Here is a framework to assist with using Teiid Embedded.  It provides the following:


    -  provides a framework for data driving the configuration of components (i.e., translators, connectors, transaction mgr, buffer service, and others that could be added)

    -  provides out-of-the-box use of the translators supported by teiid (no coding of adding translators to the embedded server) by specifying them in the xml configuration

    -  provides re-use- of configurations for portability

    -  enables tuning and configuration changes without having to recompile your code to make configuration changes

    -  you can create your own components (i.e., a different transaction mgr) and include those for reuse.  

     

    README.md  https://github.com/vhalbert/wip/tree/master/teiidEmbeddedDriver   that helps explain using the framework.


    Example (this is the portfolio example):

     

    {code}

     

            <embedded name="teiidEmbeddedInstance">

                    <properties>

                    </properties>

            </embedded>

           

        <transactionmgr>

            <className>org.teiid.embedded.transactionmgr.ArjunaTransactionManager</className>

            <properties>

                <property name="NodeIdentifier">1</property>

                <property name="SocketProcessIdPort">0</property>

                <property name="SocketProcessIdMaxPorts">10</property>

       

                <property name="EnableStatistics">false</property>

                <property name="DefaultTimeout">300</property>

                <property name="TransactionStatusManagerEnable">false</property>

                <property name="TxReaperTimeout">120000</property>

            </properties> 

        </transactionmgr>

     

            <translators>

                    <translator name="file-translator">

                            <connectorName>file-connector</connectorName>

                            <type>file</type>

                            <properties>

                            </properties>                                      

                    </translator>

                    <translator name="translator-h2">

                            <type>h2</type>

                            <properties>

                                    <property name="SupportsDirectQueryProcedure">true</property>

                            </properties>                                    

                    </translator>

            </translators>

     

            <connectors>

                    <connector name="file-connector">

                        <type>file</type>

                            <jndiName>java:/marketdata-file</jndiName>

                            <properties>

                                    <property name="ParentDirectory">data</property>

                            </properties>              

                    </connector>       

            </connectors>

     

    {code}

     

    The basic process for using the driver is the following:

     

    {code}

                      TeiidEmbeddedDriver driver = new TeiidEmbeddedDriver();

                      String configFileName = ...

                      driver.initialize(configFileName);

     

                      {optional, configure data source(s), see next example}


                      driver.startServer();

     

                      driver.deployVDB(vdbFileName);

     

                      driver.getConnection(teiidJdbcURL, properties);

    {code}

     

    (This is the more on the connectors) If you create a data source on your own, like the H2 data source in the portfolio example, you would still need to make the following call:

     

    {code}

                      DataSource ds = .....

                      driver.getEmbeddedServer().addConnectionFactory("jndi-name", ds);

    {code}

     

     

    Where can you find the code:   https://github.com/vhalbert/wip/tree/master/teiidEmbeddedDriver

    How to use it:

    run:   mvn clean install

    will produce a dist.zip in the target directory, unzip that into an existing Teiid Embedded unzipped location.

    There is a new examples directory, examples_driver.    In this directory is the embedded-portfolio, which should be similar to the original example, except for the how the TeiidEmbeddedPortfolio.java interacts with TeiidEmbeddedDriver.

     

    This is just an initial prototype to prove out that the use of Teiid Embedded could be simplified.  Your comments and feedback will help me determine if this is something that should move forward.

     

    Thanks in advance for reading, hope you take it for a drive and let me know how it went.


    Examples that have been added:

    -  embedded portfolio

    -  excel as a data source

    -  cassandra as a data source

    -  webservices as a data source

    -  mongodb as a data source


    Which currently includes support for:

    Translators:  file, h2, excel, cassandra, ws, mongodb

    Connectors:  file, cassandra, jdbc (must call addConnectionFactory("jndi-name", ds), ws, mongodb