/wildfly-swarm-teiid

The WildFly Swarm Teiid Fraction

Primary LanguageJava

Important
This is a legacy and unreleased version of Wildfly Swarm Teiid, the latest implementation be moved to wildfly-swarm, specifically, the teiid fraction goes into wildfly-swarm/fractions/teiid and the config api goes into wildfly-swarm/teiid-config-api, the first final release is the 2017.4.0.

What is Wildfly Swarm Teiid

WildFly Swarm is the decomposition and reconstitution of the popular WildFly Java Application Server, each portion of the Application Server is referred to as a fraction, Wildfly Swarm Teiid is one of fraction in order to run teiid as microservice type applications.

With Wildfly Swarm Teiid, you can start a Data Virtualization platform connect/compose/comsume multiple, heterogeneous data stores in simple 3 steps:

Step.1 add one dependency and one plugin

  • WildFly Swarm Teiid Dependency

<dependency>
  <groupId>org.wildfly.swarm</groupId>
  <artifactId>teiid</artifactId>
</dependency>
  • WildFly Swrm Plugin

<plugin>
  <groupId>org.wildfly.swarm</groupId>
  <artifactId>wildfly-swarm-plugin</artifactId>
  <configuration>
    <mainClass>org.wildfly.swarm.examples.teiid.Main</mainClass>
  </configuration>
  ...
</plugin>

Step.2 Develop Main class to setup connector/translator and deploy vdb

public static void main(String[] args) throws Exception {

    Swarm swarm = new Swarm();
    swarm.fraction(new TeiidFraction()
             .translator("h2", t -> t.module("org.jboss.teiid.translator.jdbc"))
             .translator("file", t -> t.module("org.jboss.teiid.translator.file")))
         .fraction(new DatasourcesFraction()
             .jdbcDriver("h2", driver -> {
                 driver.driverClassName("org.h2.Driver");
                 driver.xaDatasourceClass("org.h2.jdbcx.JdbcDataSource");
                 driver.driverModuleName("com.h2database.h2");
             })
             .dataSource("accounts-ds", ds -> {
                 ds.driverName("h2");
                 ds.connectionUrl(URL);
                 ds.userName("sa");
                 ds.password("sa");
             }))
         .fraction(new ResourceAdapterFraction()
             .resourceAdapter("fileQS", rac -> rac.module("org.jboss.teiid.resource-adapter.file")
                 .connectionDefinitions("fileQS", cdc -> cdc.className("org.teiid.resource.adapter.file.FileManagedConnectionFactory")
                     .jndiName("java:/marketdata-file")
                     .configProperties("ParentDirectory", cpc -> cpc.value(marketdataDir))
                     .configProperties("AllowParentPaths", cpc -> cpc.value("true")))));
    swarm.start();

    VDBArchive vdb = ShrinkWrap.create(VDBArchive.class);
    vdb.vdb(Main.class.getClassLoader().getResourceAsStream("portfolio-vdb.xml"));
    swarm.deploy(vdb);
}

Step.3 Build and Run -swarm.jar

Maven Build project generate -swarm.jar and run

java -jar target/vdb-datafederation-swarm.jar