One way to start developing a custom connector (resource-adapter) is to create a project using the Teiid archetype template. When the project is created from the template, it will contain the essential classes and resources for you to begin adding your custom logic. Additionally, the maven dependencies are defined in the pom.xml so that you can begin compiling the classes. |
To create your custom connector project, you can run the following from the command line: |
To create your custom connector project, you can use the following template: |
{code} |
... |
-DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=connector-archetype \ |
-DarchetypeVersion=8.6.0 -DarchetypeVersion=1.0.0 \ |
-DgroupId=${groupId} \ -DartifactId=connector-${connector-name} \ -Dpackage=org.teiid.resource.adapter.${connector-name} \ |
-Dversion=8.7.0.Alpha1-SNAPSHOT -Dversion=${teiid.version} \ |
-Dconnector-name=${connector-name} \ -Dvendor-name=MyVendor |
... |
-DarchetypeGroupId - is the group ID for the arche type to use to generate -DarchetypeArtifactId - is the artifact ID for the arche type to use to generate |
-DarchetypeVersion - is the version for of the arche type to use to generate |
-DgroupId - (user defined) group ID for the new connector project pom.xml -DartifactId - (user defined) artifact ID for the new connector project pom.xml -Dpackage - (user defined) the package structure where the java and resource files will be created |
-Dversion - (user defined) the Teiid version for the new connector project pom.xml to depend upon |
-Dconnector-name - (user defined) the name (type) of the new connector project, used to create the java class names and rar -Dvendor-name - name of the Vendor for the data source, updates the rar |
... |
-DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=connector-archetype \ |
-DarchetypeVersion=8.6.0 -DarchetypeVersion=1.0.0 \ |
-DgroupId=org.jboss.teiid.connectors \ -Dpackage=org.teiid.resource.adapter.myType \ -DartifactId=connector-myType \ |
-Dversion=8.7.0.Alpha2-SNAPSHOT -Dversion=8.7.0.Final \ |
-Dconnector-name=myType \ -Dvendor-name=MyVendor |
... |
groupId: org.jboss.teiid.connectors artifactId: connector-myType |
version: 8.7.0.Alpha1-SNAPSHOT 8.7.0.Final |
package: org.teiid.resource.adapter.myType connector-name: myType |
... |
One way to start developing a custom connector (resource-adapter) is to create a project using the Teiid archetype template. When the project is created from the template, it will contain the essential classes and resources for you to begin adding your custom logic. Additionally, the maven dependencies are defined in the pom.xml so that you can begin compiling the classes.
To create your custom connector project, you can use the following template:
mvn archetype:generate \ -DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=connector-archetype \ -DarchetypeVersion=1.0.0 \ -DgroupId=${groupId} \ -DartifactId=connector-${connector-name} \ -Dpackage=org.teiid.resource.adapter.${connector-name} \ -Dversion=${teiid.version} \ -Dconnector-name=${connector-name} \ -Dvendor-name=MyVendor
where:
-DarchetypeGroupId - is the group ID for the arche type to use to generate -DarchetypeArtifactId - is the artifact ID for the arche type to use to generate -DarchetypeVersion - is the version of the arche type to use to generate -DgroupId - (user defined) group ID for the new connector project pom.xml -DartifactId - (user defined) artifact ID for the new connector project pom.xml -Dpackage - (user defined) the package structure where the java and resource files will be created -Dversion - the Teiid version for the new connector project pom.xml to depend upon -Dconnector-name - (user defined) the name (type) of the new connector project, used to create the java class names and rar -Dvendor-name - name of the Vendor for the data source, updates the rar
The following is an example:
mvn archetype:generate - \ -DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=connector-archetype \ -DarchetypeVersion=1.0.0 \ -DgroupId=org.jboss.teiid.connectors \ -Dpackage=org.teiid.resource.adapter.myType \ -DartifactId=connector-myType \ -Dversion=8.7.0.Final \ -Dconnector-name=myType \ -Dvendor-name=MyVendor
When executed, you will be asked to confirm the properties
Confirm properties configuration: groupId: org.jboss.teiid.connectors artifactId: connector-myType version: 8.7.0.Final package: org.teiid.resource.adapter.myType connector-name: myType vendor-name: MyVendor Y: :
type Y (yes) and press enter, and the creation of the connector project will be done
Upon creation, a directory based on the artifactId will be created, that will contain the project. Note: The project will not compile because the ${connector-name}Connection interface in the ConnectionImpl has not been added as a dependency in the pom.xml. This will need to be done.
Now you are ready to start adding your custom code.