-
1. Re: programmatically creating vdb
rareddy Aug 13, 2012 4:03 PM (in response to yapnel)Nelson,
No, there is no way to build the Designer based VDB along with its XMI files into a VDB that can create index file. "vdb.xml" only defines the model structure, the index files are the ones that define the "metadata" of the model. You need to give Dynamic VDBs a second look, as starting with Teiid 8.1.x they are fully capable in functionality as the Designer VDBs. You can even define view models using the DDL, which was not available in previous versions. Currently the web service model and xml models are not supported in Dynamic VDBs.
I not not sure if there is head less Designer way to accomplish what you are looking for, somebody who is familiar with Designer probably can comment.
Ramesh..
-
2. Re: programmatically creating vdb
markaddleman Aug 13, 2012 4:06 PM (in response to yapnel)Hi Nelson -
We programmatically create VDB XML (which, by definition, is a dynamic VDB). We use the Teiid's metadata objects to build an in-memory data structure of the VDB that we want and the convert the in-memory structure to XML which is then written out to disk. After written to disk, JBoss reads it and deploys it to Teiid. It's a bit roundabout (and there is probably a more straightforward solution), but it works. Given your usecase, I think all you care about is generating the XML.
There is a set of objects in the org.teiid.adminapi.impl.* package that you can progammatically manipuate. There is a bit of insider knowledget that you need in order to make sure that you set all of the correct properties and hook everything up correctly but it's not too bad. Finally, we call the following code to generate the XML:
public String getVdbXmlString(final VDBMetaData vdbMetaData) throws JAXBException, PropertyException
{
final JAXBContext jaxbContext = JAXBContext.newInstance(VDBMetaData.class);
final Marshaller createMarshaller = jaxbContext.createMarshaller();
createMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
final StringWriter writer = new StringWriter();
createMarshaller.marshal(vdbMetaData, writer);
return writer.toString();
}
-
3. Re: programmatically creating vdb
blafond Aug 13, 2012 4:07 PM (in response to yapnel)Currently Teiid Designer only supports creating/editing/managing EMF-based model files and VDB's containing those files along with their INDEX files. The INDEX files are what TEIID uses to create their runtime represenation of your metadata.
We are currently developing a long-term plan for Teiid Designer to include programmatic creation of VDBs, and we intend to phase in some features/tooling for the community to excersize. When that happens, we would greatly appreciate your input/feedback.
Barry LaFond
Teiid Designer Project -
4. Re: programmatically creating vdb
mehta35 Oct 8, 2012 6:02 AM (in response to blafond)Hi,
My issue is on the similar lines ..
I have created a VDB for dev/uat purposes using dev/uat enviroments of the sources I wish to join/ virtualise. Now how do i productionise this VDB. Do i have to create a complete new one for production ? Or is there a way wherein i just replace the uat credentials of the sources with the production ones and make my VDB production ready ? I exploded the VDB using winrar and found the connection parameters are all over the .xmi file and also found that a separate *-ds.xml also got deployed along with the .vdb file when i deployed using designer.
Please suggest if there is any way to solve this other than using Dynamic VDB and teiid 8.1
Thanks
Saurabh
-
5. Re: programmatically creating vdb
rareddy Oct 8, 2012 9:37 AM (in response to mehta35)Surabh,
You *only* need to develop the VDB once if you are using either Designer or Dynamic VDB. Once you have it, it is same between your DEV/UAT and PROD environments. You just need to make sure that the sources it is integrating are same in terms of their schema.
A VDB, has a JNDI name for each data source it is connected to, as long as you create the same JNDI name in different environments with different connection properties, the VDB can be deployed anywhere and it will work. Also .vdb file *MUST* not be unzipped for deployment, it has to be deployed as is.
If you want to change the JNDI names in already built VDB, then open it using a ZIP util program and edit "META-INF/vdb.xml" file and correct it for correct JNDI names, or use the Designer to regenerate a new VDB with new JNDI names. Note, you can build as many VDBS as you want given your Designer project set.
HTH
Ramesh..