JBoss.orgCommunity Documentation
A VDB can be built with either the Designer tool or through a simple XML file called a dynamic VDB. See the "dyanmicvdb-portolio" for an example dynamic VDB. for this example purpose we will use the a dynamic VDB. If you would like to use the Designer to build your VDB, check out the Designer examples. If you need to build any view layers using your source, you must use Designer based approach to building the VDB. A sample Designer based VDB is available in the "teiid-examples/portfolio/PortfolioModel" directory.
This XML file is defines a set of sources that need to treated as single source by the client application. Dynamic VDB does not yet allow for the creation of view layers. Below XML file defines "dynamicvdb-portfolio" example vdb.
portfolio-vdb.xml (copy available in "teiid-examples/dynamicvdb-portfolio" directory)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <vdb name="DynamicPortfolio" version="1"> <description>A Dynamic VDB</description> <!-- Setting to use connector supplied metadata. Can be "true" or "cached". "true" will obtain metadata once for every launch of Teiid. "cached" will save a file containing the metadata into the deploy/<vdb name>/<vdb version/META-INF directory --> <property name="UseConnectorMetadata" value="cached" /> <!-- Each model represents a access to one or more sources. The name of the model will be used as a top level schema name for all of the metadata imported from the connector. NOTE: Multiple model, with different import settings, can be bound to the same connector binding and will be treated as the same source at runtime. --> <model name="MarketData"> <!-- Each source represents a translator and data source. There are pre-defined translators, or you can create one. ConnectionFactories or DataSources in JBoss AS they are typically defined using "xxx-ds.xml" files. --> <source name="text-connector" translator-name="file" connection-jndi-name="java:marketdata-file"/> </model> <model name="Accounts"> <!-- JDBC Import settings importer.useFullSchemaName directs the importer to drop the source schema from the Teiid object name, so that the Teiid fully qualified name will be in the form of <model name>.<table name> --> <property name="importer.useFullSchemaName" value="false"/> <!-- This connector is defined in the "derby-connector-ds.xml" --> <source name="derby-connector" translator-name="derby" connection-jndi-name="java:PortfolioDS"/> </model> </vdb>
The XML file is explained below.
The above XML file defines a "vdb" with name "DynamicPortfolio" with version "1"
A "model" XML element represents a schema that being integrated. This sample defines two sources, "MarketData" that represents the schema for the text file that has the stock price information and "Accounts" that represents the "portfolio" schema in the Derby database.
The "source" element inside the "model" element defines name of the source (can be any name), and name of the translator (defines the type of the source like oracle, db2, mysql, h2, file, ws etc..) and the "connection-jndi-name" defines the source's JNDI name in the JBoss AS container.
Also note that inside the "model" elements, some "property" elements are used to define how metadata can be imported from source. For more information check out the Reference Guide's Dynamic VDB section.
Note that you need to also create the necessary deployment files for the data sources (Connection Factories) too.