= Teiid OpenShift Examples

This repository contains example projects, designed to be deployed on OpenShift using Teiid, and the VDB Migration Utility.

The following documents are available 

* xref:minishift.adoc[How to Install Minishift]
* xref:install-operator.adoc[How to Install Teiid OpenShift Operator]
* xref:dv-on-openshift.adoc[How to write custom resource for DV]
* xref:datasources.adoc[How to configure physical data sources for VDB]
* xref:jdbc.adoc[How to configure JDBC connection to a VDB]
* xref:jdv-changes.adoc[JDV to "Teiid on OpenShift" changes]

## Available Examples and Utility
[Attributes]
|===

| Example Name  | Description   | Prerequisite  
| xref:rdbms-example/Readme.adoc[rdbms-example] | Shows how to deploy a single relational source VDB into OpenShift | None 

| xref:security/keycloak-odata-sso.adoc[keycloak-odata-sso] | Securing the virtualizations OData API Interface |rdbms-example 

| xref:security/keycloak-db-security.adoc[keycloak-jdbc-sso] | Securing the virtualizations JDBC API | keycloak-odata-sso 

| xref:security/3scale-odata-sso.adoc[3scale-odata-sso] | Securing the virtualizations JDBC API | keycloak-odata-sso
|===

== VDB Migration Utility

This VDB Migration Utility is used to convert a VDB (xml format) file to DDL.   If you have a .vdb file, first use Teiid Designer to export the .vdb to an .xml formatted file.

There are two options to running this utility.  The first option is to run the utility, to report any validation errors, by providing only the path to the vdb file to convert.  The second option will also perform the validation reporting, but will write the converted vdb (assuming no validation errors) to a .ddl file.  This can be executed by providing the second output argument. 


=== Migrate VDB

To perform the task of converting a vdb and reporting validation errors, do the following:

Open a terminal and navigate to the teiid-openshift-examples directory.

----
$mvn -s settings.xml exec:java -Dvdb={filepath/to/vdb}
----

This will perform the vdb conversion, reporting any validation errors to the terminal.  If there are no validation errors, the ddl form of the vdb will be written to the terminal. Once there are no validation errors, execute 

----
$mvn -s settings.xml exec:java -Dvdb={filepath/to/vdb} -Doutput={filepath/to/convertedvdb}
----

This will perform the vdb conversion and will write a valid vdb to the specified output file.  The output file will only be written if there are no validation errors.
