Skip to content

Latest commit

 

History

History

webservice-as-datasource

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Summary

Please raise any issues found with this example in our JIRA: https://issues.jboss.org/projects/TEIID

This example demonstrates:

  • Using the ws translator / resource adapter

  • how to use Thorntail to configure translators, resource adapters and run teiid as a Thorntail uber jar.

Project pom.xml

The project is a normal maven project with vdb packaging

<packaging>vdb</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>org.teiid</groupId>
        <artifactId>vdb-maven-plugin</artifactId>
        <version>1.1</version>
		... see more in pom.xml file
      </plugin>
	</plugins>
  </build>

This project also requires the thorntail-maven-plugin to build a uber jar with -thorntail.jar extension, for that add the following

<build>
	<plugins>
      <plugin>
        <groupId>io.thorntail</groupId>
        <artifactId>thorntail-maven-plugin</artifactId>
        <version>${version.thorntail}</version>
		... see more in pom.xml file
      </plugin>
	</plugins>
</build>

To define the needed parts of Thorntail, a few dependencies(teiid, datasources, resource-adapters) are added.

<!-- This adds dependency on Teiid Fraction in Thorntail -->
<dependency>
  <groupId>io.thorntail</groupId>
  <artifactId>teiid</artifactId>
</dependency>

<!-- This adds dependency for Teiid's webservice translator -->
<dependency>
  <groupId>io.thorntail</groupId>
  <artifactId>teiid-ws</artifactId>
</dependency>

Run

To build the project

mvn clean package

once build success, a webservice-as-datasource-thorntail.jar will generated under 'target' folder, run the example via

java -jar webservice-as-datasource-thorntail.jar

By default, jdbc transport bind on 0.0.0.0 and port 31000, system properties can be used eto bind a specific IP and Port, to bind a IP use -Dswarm.bind.address=127.0.0.1, to bind a port use -Dswarm.teiid.jdbc.port=31000.

Query Demonstrations

Simple Java Client for sample SQL Queries, SQuirreL Client for a fully featured SQL Queries.

Example - Query the static materialized View
mvn exec:java -Dvdb="Market" -Dsql="select * from CountryInfo.continents"

Since the OData fraction is also declared in the pom, you may use a browser or curl to see OData results.

Example - OData Function
http://localhost:8080/odata4/ws/CountryInfo/capital_city(code='US')