Questo contenuto non è disponibile nella lingua selezionata.

4.9. Data Source Deployment


4.9.1. Accumulo Data Sources

Accumulo data sources use a Teiid specific JCA connector that is deployed into JBoss EAP during installation. There are many ways to create a Accumulo data source, using CLI, AdminShell, admin-console, etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Ensure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB. batch /subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid:add(jndi-name=java:/accumulo-ds, class-name=org.teiid.resource.adapter.accumulo.AccumuloManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=ZooKeeperServerList:add(value=localhost:2181) /subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=Username:add(value=user) /subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=Password:add(value=password) /subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=InstanceName:add(value=instancename) /subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=Roles:add(value=public) /subsystem=resource-adapters/resource-adapter=accumulo:activate runbatch
These are the properties defined in the RAR file:
Expand
Table 4.1.  Properties
Property Description Required? Default?
ZooKeeperServerList
A comma-separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port
True.
None.
ZooKeeperServerList
A comma-separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port
True.
None.
Username
Connection User's Name
True.
None.
Password
Connection User's password
True.
None.
InstanceName
Accumulo instance name
True.
None.
Password
Connection User's password
True.
None.
Roles
optional visibility for user, supply multiple with comma separated
False.
None.
To find out all the properties that are supported by this Accumulo Connector execute this command in the CLI: /subsystem=teiid:read-rar-description(rar-name=accumulo)

4.9.2. Amazon SimpleDB Data Sources

SimpleDB data sources use a Teiid specific JCA connector that is deployed into EAP during installation. There are many ways to create a SimpleDB data source, using CLI, AdminShell, admin-console, and so forth. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Make sure you provide the correct access keys. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB. batch /subsystem=resource-adapters/resource-adapter=simpledb/connection-definitions=simpledbDS:add(jndi-name=java:/simpledbDS, class-name=org.teiid.resource.adapter.simpledb.SimpleDBManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=simpledb/connection-definitions=simpledbDS/config-properties=AccessKey:add(value=xxx) /subsystem=resource-adapters/resource-adapter=simpledb/connection-definitions=simpledbDS/config-properties=SecretAccessKey:add(value=xxx) /subsystem=resource-adapters/resource-adapter=simpledb:activate runbatch
To find out all the properties that are supported by this SimpleDB Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=simpledb)

4.9.3. Cassandra Data Sources

Warning

Technology Preview features are not supported, may not be functionally complete, and are not intended for production use. These features are included to provide customers with early access to upcoming product innovations, enabling them to test functionality and provide feedback during the development process.
Cassandra's data sources use a Teiid specific JCA connector that is deployed into EAP during installation. There are many ways to create a Cassandra data source, using CLI, AdminShell, admin-console, etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Make sure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=cassandra/connection-definitions=cassandraDS:add(jndi-name=java:/cassandraDS, class-name=org.teiid.resource.adapter.cassandra.CassandraManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=cassandra/connection-definitions=cassandraDS/config-properties=Address:add(value=127.0.0.1) /subsystem=resource-adapters/resource-adapter=cassandra/connection-definitions=cassandraDS/config-properties=Keyspace:add(value=my-keyspace) /subsystem=resource-adapters/resource-adapter=cassandra:activate runbatch
To find out all the properties that are supported by this Cassandra Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=cassandra)

4.9.4. File Data Source

File data sources use a Teiid specific JCA connector that is deployed into EAP during installation. There are many ways to create the file data source, using CLI, AdminShell, admin-console, and so forth. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute following command using the CLI once you connected to the Server. Make sure you provide the correct directory name and other properties below. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=file/connection-definitions=fileDS:add(jndi-name=java:/fileDS, class-name=org.teiid.resource.adapter.file.FileManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=file/connection-definitions=fileDS/config-properties=Parentdirectory:add(value=/home/rareddy/testing/) /subsystem=resource-adapters/resource-adapter=file/connection-definitions=fileDS/config-properties=AllowParentPaths:add(value=true) /subsystem=resource-adapters/resource-adapter=file:activate runbatch
To find out all the properties that are supported by this File Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=file)

4.9.5. Google Spreadsheet Data Sources

You can authenticate your Google account in either of two ways: ClientLogin (which requires login and password) or OAuth (more complicated as it requires the user to supply a refresh token).
The Google JCA connector is named teiid-connector-google.rar. The examples include a sample google.xml file. The JCA connector has number of config-properties that facilitate authentication. The JCA connector connects to one spreadsheet:
Expand
Table 4.2. Configuration Properties
Property Description
AuthMethod
Method to access Google. This property can be set to one of: ClientLogin, OAuth2. If the setting is ClientLogin it is necessary to provide additional two config properties Username, Password. If the setting is OAuth2 it is necessary to provide RefreshToken.
Username
Username to Google account. Applicable only if AuthMethod=ClientLogin
Password
Password to Google account. Applicable only if AuthMethod=ClientLogin
SpreadsheetName
Required property with name of the Spreadsheet that is datasource for this connector.
BatchSize
Maximum number of rows that can be fetched at a time. Defaults to 4096.
To obtain an OAuth Refresh Token, go to Google's authentication site:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=217138521084.apps.googleusercontent.com
Copy to Clipboard Toggle word wrap
Next, copy the authorization code into the following POST request and run it on command line. (The refresh token will be in the response.)
curl \--data-urlencode code=<AUTH_CODE> \
--data-urlencode client_id=217138521084.apps.googleusercontent.com \
--data-urlencode client_secret=gXQ6-lOkEjE1lVcz7giB4Poy \
--data-urlencode redirect_uri=urn:ietf:wg:oauth:2.0:oob \
--data-urlencode grant_type=authorization_code https://accounts.google.com/o/oauth2/token	
Copy to Clipboard Toggle word wrap

4.9.6. Infinispan Data Sources

Infinispan data sources use a Teiid specific JCA connector that is deployed into EAP during installation. This connector can be configured to support the following modes of Infinispan caches:
Expand
Table 4.3. Registry Properties
Cache Type How to Obtain This Cache
Local Cache
JNDI
Local Cache
Configuration file
Remote Cache
JNDI
Remote Cache
Specify one or more host porrts.
Local Cache
Specify one or more Hot Rod client property files.
You can configure these properties for this connector:
Expand
Table 4.4. Registry Properties
Property Required Property Template Description
CacheTypeMap
Yes
cacheName:className[;pkFieldName] [,cacheName:className[;pkFieldName]..]
Map the root Java Object class name to the cache, and identify which attribute is the primary key to the cache.
module
No
Nil
Specify the JBoss AS module that contains the cache classes that were defined in CacheTypeMap
CacheJndiName
No
Nil
JNDI name to fine the CacheContainer
RemoteServerList
No
host:port[;host:port….]
Specify the host and ports that will be clustered together to access the caches defined in CacheTypeMap
ConfigurationFileNameForLocalCache
No
Nil
The Infinispan Configuration xml file for configuring a local cache.
HotRodClientPropertiesFile
No
Nil
The HotRod properties file for configuring a connection to a remote cache
There are many ways to create the data source, using CLI, AdminShell, admin-console and so forth. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes:
Execute following command using CLI once you connected to the Server. Make sure you provide the correct directory name and other properties below. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS:add(jndi-name=java:/infinispanDS, class-name=org.teiid.resource.adapter.infinispan.InfinispanManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS/config-properties=CacheTypeMap:add(value=trades:org.somewhere.Trade;tradeId) /subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS/config-properties=Module:add(value=org.somewhere) /subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS/config-properties=CacheJndiName:add(value=java:/myCache) runbatch
To find out all the properties that are supported by this Infinispan Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=infinispan)

Important

Avoid Classloading Issues: If you are using a servlet or other type of web application to create the DefaultCacheManager for the cache, be sure not to include the Infinispan jar dependencies in the application, but add their module dependencies instead.

4.9.7. Infinispan-DSL Data Sources

You must install the Red Hat JBoss Data Grid modules in order to use this translator. Note that this translator uses different JBoss Data Grid modules for remote and local modes. Please refer to the JBoss Data Grid documentation at https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/6.4/html/Infinispan_Query_Guide/chap-The_Infinispan_Query_DSL.html for more information about this. This JBoss Data Grid guide contains some basic information on using the Infinispan Query DSL. The jar required for library mode is infinispan-embedded-query, and in remote client-server mode the .jar is infinispan-query, which is installed by default with jboss-datagrid-server.
Infinispan-DSL data sources use a Teiid-specific JCA connector that is deployed into EAP during installation. This connector can be configured to support the following modes of Infinispan caches that will be accessed using the Hot Rod client:
Expand
Table 4.5. Properties
Cache Type Property Name How to Obtain Cache
Remote Cache
CacheJndiName
JNDI
Remote Cache
RemoteServerList
Server list: specify one or more host ports
Remote Cache
HotRodClientPropertiesFile
HotRod client properties file
This requires, at a minimum, JDG 6.3 or better, that is configured to use Google Protobuf for object serialization. This will enable Teiid to query the cache as if it was a local cache configured with Lucene indexes.
You can configure the following properties for this connector:
Expand
Table 4.6. Properties
Property Required? Property Template Description
CacheTypeMap
Yes
cacheName:className[;pkFieldName] [,cacheName:className[;pkFieldName]..]
Map the root Java Object class name to the cache, and identify which attribute is the primary key to the cache.
ProtobinFile
Yes
Nil
Path to the Google Protobin file that's packaged in a jar (such as /quickstart/addressbook.protobin)
MessageMarshallers
Yes
marshaller [,marshaller,..]
Contains Class names mapped its respective message marshaller, (class:marshaller,[class:marshaller,..]), that are to be registered for serialization
MessageDescriptor
Yes
Nil
Message descriptor class name for the root object in cache
module
No
Nil
Specify the JBoss EAP module that contains the cache classes that need to be loaded.
CacheJndiName
No
Nil
JNDI name to find the CacheContainer
RemoteServerList
No
host:port[;host:port….]
Specify the host and ports that will be clustered together to access the caches.
HotRodClientPropertiesFile
No
Nil
The HotRod properties file for configuring a connection to a remote cache
Here is the XML code for a resource-adapter that is used to connect to the JDG remote-query quick start:
<resource-adapter id="infinispanRemQS">
     <module slot="main" id="org.jboss.teiid.resource-adapter.infinispan.dsl"/>
     <connection-definitions>
         <connection-definition class-name="org.teiid.resource.adapter.infinispan.dsl.InfinispanManagedConnectionFactory" jndi-name="java:/infinispanRemote" enabled="true" use-java-context="true" pool-name="infinispanDS">
             <config-property name="CacheTypeMap">
                 addressbook:org.jboss.as.quickstarts.datagrid.hotrod.query.domain.Person;id
             </config-property>
             <config-property name="ProtobinFile">
                  /quickstart/addressbook.protobin
             </config-property>
             <config-property name="MessageDescriptor">
                 quickstart.Person
             </config-property>
             <config-property name="Module">
                 com.client.quickstart.pojos
             </config-property>
             <config-property name="MessageMarshallers">                              org.jboss.as.quickstarts.datagrid.hotrod.query.domain.Person:org.jboss.as.quickstarts.datagrid.hotrod.query.marshallers.PersonMarshaller,org.jboss.as.quickstarts.datagrid.hotrod.query.domain.PhoneNumber:org.jboss.as.quickstarts.datagrid.hotrod.query.marshallers.PhoneNumberMarshaller,org.jboss.as.quickstarts.datagrid.hotrod.query.domain.PhoneType:org.jboss.as.quickstarts.datagrid.hotrod.query.marshallers.PhoneTypeMarshaller
             </config-property>
             <config-property name="RemoteServerList">
                 127.0.0.1:11322
             </config-property>
         </connection-definition>
     </connection-definitions>
 </resource-adapter>
Copy to Clipboard Toggle word wrap

4.9.8. JDBC Data Sources

Here is an example highlighting configuring an Oracle data source. The process is nearly identical regardless of the database vendor. Typically the JDBC jar and the configuration like connection URL and user credentials change.
There are configuration templates for all the data sources in the jboss-install/docs/teiid/datasources directory. A complete description how a data source can be added into JBoss EAP is also described here. Here are two different ways to create a datasource:
Firstly, deploy the required JDBC jar file. For example, if you are trying to create a Oracle data source, first you need to deploy the "ojdbc6.jar" file: deploy /path/to/ojdbc6.jar

Note

If JBoss EAPis running in standalone mode, you can also manually copy this 'ojdbc6.jar" to the jboss-install>/standalone/deployments directory, to automatically deploy without using the CLI tool.
Now create a data source using this driver. There are many ways to create the datasource using CLI, AdminShell or admin-console. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Make sure you provide the correct URL and user credentials and edit the JNDI name to match the JNDI name you used in VDB: /subsystem=datasources/data-source=oracel-ds:add(jndi-name=java:/OracleDS, driver-name=ojdbc6.jar, connection-url=jdbc:oracle:thin:{host}:1521:orcl,user-name={user}, password={password}) /subsystem=datasources/data-source=oracel-ds:enable

4.9.9. LDAP Data Sources

LDAP data sources use a Teiid specific JCA connector which is deployed into EAP during installation. There are many ways to create the ldap data source, using CLI, AdminShell, admin-console etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Make sure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS:add(jndi-name=java:/ldapDS, class-name=org.teiid.resource.adapter.ldap.LDAPManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapUrl:add(value=ldap://ldapServer:389) /subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapAdminUserDN:add(value={cn=???,ou=???,dc=???}) /subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapAdminUserPassword:add(value={pass}) /subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapTxnTimeoutInMillis:add(value=-1) /subsystem=resource-adapters/resource-adapter=ldap:activate runbatch
To find out all the properties that are supported by this LDAP Connector execute the following command in the CLI. /subsystem=teiid:read-rar-description(rar-name=ldap)

4.9.10. MongoDB Data Sources

MongoDB data sources use a Teiid-specific JCA connector that is deployed into EAP during installation. There are many ways to create a MongoDB data source, using CLI, AdminShell, admin-console and so forth. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Make sure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS:add(jndi-name="java:/mongoDS", class-name=org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=RemoteServerList:add(value="{host}:27017") /subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Database:add(value="{db-name}") /subsystem=resource-adapters/resource-adapter=mongodb:activate runbatch
These are the properties that are defined in the RAR file:
Expand
Table 4.7. Properties
Property Description Required? Default
RemoteServerList
A comma-separated list of server locations. Each location can contain an optional port, of the format host:port
Not applicable.
Not applicable.
Username
Connection User's Name
False
None.
Password
Connection User's password
False
None.
Database
MongoDB database name
True
None.
To find out all the properties that are supported by this MongoDB Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=mongodb)

4.9.11. Phoenix Data Source

The following is a example for setting up Phoenix Data Sources, which is precondition for Apache HBase Translator. In addition to the Data Sources set up, this article also cover mapping Phoenix table to an existing HBase table and creating a new Phoenix table.
There are configuration templates for Phoenix data sources in the EAP_HOME>/docs/teiid/datasources directory. A complete description how a data source can be added into Red Hat JBoss EAP is also described here.
Configuring a Phoenix data source is nearly identical to configuring JDBC Data Sources. The first step is deploying the Phoenix driver jar. Using below CLI command to deploy Phoenix driver: module add --name=org.apache.phoenix --resources=/path/to/phoenix-[version]-client.jar --dependencies=javax.api,sun.jdk,org.apache.log4j,javax.transaction.api /subsystem=datasources/jdbc-driver=phoenix:add(driver-name=phoenix,driver-module-name=org.apache.phoenix,driver-class-name=org.apache.phoenix.jdbc.PhoenixDriver
The driver jar can be download from phoenix document.
Next, create the Data Source base on above deployed driver, which is also like creating JDBC Data Source. Using below CLI command to create the data source: /subsystem=datasources/data-source=phoenixDS:add(jndi-name=java:/phoenixDS, driver-name=phoenix, connection-url=jdbc:phoenix:{zookeeper quorum server}, enabled=true, use-java-context=true, user-name={user}, password={password})
Ensure the URL, Driver, and other properties are configured correctly: The JNDI name need to match the JNDI name you used in the VDB. The driver name need to match the driver you deployed in above steps
The URL need to match the HBase zookeeper quorum server. Here is an example:
 jdbc:phoenix [ :<zookeeper quorum> [ :<port number> ] [ :<root node> ] ], 'jdbc:phoenix:127.0.0.1:2181'
Copy to Clipboard Toggle word wrap
user-name/password - The user credentials for Phoenix Connection
Mapping a Phoenix table to an existing HBase table takes two steps. The first step is installing phoenix-[version]-server.jar to the classpath of every HBase region server. An easy way to do this is to copy it into the HBase lib. (For more details see the Phoenix documentation.)
Next, you must executing the DDL to map a Phoenix table to an existing HBase table. The DDL can either be executed via the Phoenix Command Line, or executed by JDBC.
The Following is a example for mapping an existing HBase Customer with the following structure:
As depicted above, the HBase Customer table have 2 column families, customer and sales, and each has 2 column qualifiers, name, city, product and amount respectively.Map this table to Phoenix via DDL:
 
CREATE TABLE IF NOT EXISTS "Customer"("ROW_ID" VARCHAR PRIMARY KEY, "customer"."city" VARCHAR, "customer"."name" VARCHAR, "sales"."amount" VARCHAR, "sales"."product" VARCHAR)
Copy to Clipboard Toggle word wrap
For more about mapping Phoenix table to an existing HBase table please refer to the Phoenix documentation.
Creating a new Phoenix table is just like mapping to an existing HBase table. Phoenix will create any metadata (table, column families) that do not exist. Similar to the above example the DDL to create the Phoenix/HBase Customer table would be:
CREATE TABLE IF NOT EXISTS "Customer"("ROW_ID" VARCHAR PRIMARY KEY, "customer"."city" VARCHAR, "customer"."name" VARCHAR, "sales"."amount" VARCHAR, "sales"."product" VARCHAR)
Copy to Clipboard Toggle word wrap

4.9.12. Salesforce Data Sources

Salesforce data sources use a Teiid specific JCA connector that is deployed into EAP during installation. There are many ways to create the salesforce data source, using CLI,AdminShell, admin-console etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the server. Make sure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS:add(jndi-name=java:/sfDS, class-name=org.teiid.resource.adapter.salesforce.SalesForceManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=URL:add(value=https://www.salesforce.com/services/Soap/u/22.0) /subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=username:add(value={user}) /subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=password:add(value={password}) /subsystem=resource-adapters/resource-adapter=salesforce:activate runbatch
To find out all the properties that are supported by this Salesforce Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=salesforce)

4.9.13. Solr Data Sources

Solr data sources use a Teiid specific JCA connector that is deployed into EAP during installation. There are many ways to create a Solr data source, using CLI, AdminShell, admin-console, etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute the following command using the CLI once you connected to the Server. Make sure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=solr/connection-definitions=solrDS:add(jndi-name=java:/solrDS, class-name=org.teiid.resource.adapter.solr.SolrManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=solr/connection-definitions=solrDS/config-properties=url:add(value=http://localhost:8983/solr/) /subsystem=resource-adapters/resource-adapter=solr/connection-definitions=solrDS/config-properties=CoreName:add(value=collection1) /subsystem=resource-adapters/resource-adapter=solr:activate runbatch
To find out all the properties that are supported by this Solr Connector execute the following command in the CLI: /subsystem=teiid:read-rar-description(rar-name=solr)

4.9.14. Web Service Data Sources

Web service data sources use a Teiid specific JCA connector that is deployed into EAP during installation. There are many ways to create the file data source, using CLI, AdminShell, admin-console etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute following command using the CLI once you connected to the Server. Make sure you provide the correct endpoint and other properties below. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB: batch /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=EndPoint:add(value={end_point}) /subsystem=resource-adapters/resource-adapter=webservice:activate runbatch
To find out all the properties that are supported by this Web Service Connector execute the following command in the CLI. /subsystem=teiid:read-rar-description(rar-name=webservice). The Web Service Data Source supports specifying a WSDL using the Wsdl property. If the Wsdl property is set, then the ServiceName, EndPointName, and NamespaceUri properties should also be set. The Wsdl property may be a URL or file location or the WSDL to use. You must restart the server.
Expand
Table 4.8. Registry Properties
Property Application Required? Default? Description
EndPoint
HTTP and SOAP.
True
Not applicable.
URL for HTTP ans service endpoint for SOAP.
SecurityType
HTTP and SOAP.
false
none
Type of Authentication to used with the web service. Allowed values are "None","HTTPBasic","WSSecurity" and "Kerberos".
AuthUserName
HTTP and SOAP.
false
Not applicable.
Name value for authentication, used in HTTPBasic and WsSecurity.
AuthPassword
HTTP and SOAP.
false
Not applicable.
Password value for authentication, used in HTTPBasic and WsSecurity
ConfigFile
HTTP and SOAP.
False
Not applicable.
CXF client configuration File or URL.
EndPointName
HTTP and SOAP.
False
Teiid
Local part of the end point QName to use with this connection, needs to match one defined in CXF file.
ServiceName
SOAP
False
Not applicable.
Local part of the service QName to use with this connection.
NamespaceUri
SOAP.
False
http://teiid.org
Namespace URI of the service QName to use with this connection
RequestTimeout
HTTP and SOAP.
False
Not applicable.
Timeout for request.
ConnectTimeout
HTTP and SOAP.
False
Not applicable.
Timeout for connection.
Wsdl
SOAP.
False
Not applicable.
WSDL file or URL for the web service.
Each web service data source may choose a particular CXF config file and port configuration. The ConfigFile config property specifies the Spring XML configuration file for the CXF Bus and port configuration to be used by connections. If no config file is specified then the system default configuration will be used.
Only one port configuration can be used by this data source. You may explicitly set the local name of the port QName to use via the ConfigName property. The namespace URI for the QName in your config file should match your WSDL/namespace setting on the data source or use the default of http://teiid.org. See the CXF Documentation and the sections below on WS-Security, Logging, etc. for examples of using the CXF configuration file.
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
        xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
        http://cxf.apache.org/schemas/configuration/http-conf.xsd
        http://www.springframework.org/schema/beans
        >
 
    <http-conf:conduit name="{http://teiid.org}configName.http-conduit">
        <http-conf:client ConnectionTimeout="120000" ReceiveTimeout="240000"/>
    </http-conf:conduit>
</beans>
Copy to Clipboard Toggle word wrap
In the conduit name {http://teiid.org}configName.http-conduit, the namespace, {http://teiid.org}, may be set via the namespace datasource property. Typically that will only need done when also supplying the wsdl setting. The local name is followed by .http-conduit. It will be based upon the configName setting, with a default value of teiid.

Note

You do not have to use the Spring configuration to set timeouts. The ConnectionTimeout and ReceiveTimeout can be set via the resource adapter connectTimeout and requestTimeout properties respectively.
To enable the use of WS-Security, the SecurityType should be set to WSSecurity. At this time Teiid does not expect a WSDL to describe the service being used. Thus a Spring XML configuration file is not only required, it must instead contain all of the relevant policy configuration. And just as with the general configuration, each data source is limited to specifying only a single port configuration to use: batch /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigFile:add(value=${jboss.server.home.dir}/standalone/configuration/xxx-jbossws-cxf.xml) /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigName:add(value=port_x) /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=SecurityType:add(value=WSSecurity) /subsystem=resource-adapters/resource-adapter=webservice:activate runbatch
This is the corresponding xxx-jbossws-cxf.xml file that adds a timestamp to the SOAP header
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://cxf.apache.org/jaxws
          http://cxf.apache.org/schemas/jaxws.xsd">
 
    <jaxws:client name="{http://teiid.org}port_x"
        createdFromAPI="true">
        <jaxws:outInterceptors>
            <bean/>
            <ref bean="Timestamp_Request"/>
        </jaxws:outInterceptors>
    </jaxws:client>
 
    <bean
 
        id="Timestamp_Request">
        <constructor-arg>
            <map>
                <entry key="action" value="Timestamp"/>
            <map>
        </constructor-arg>
    </bean>
 
</beans>
Copy to Clipboard Toggle word wrap
Note that the client port configuration is matched to the data source instance by the QName {http://teiid.org}port_x, where the namespace will match your namespace setting or the default of http://teiid.org. The configuration may contain other port configurations with different local names.
WS-Security Kerberos is only supported when the WSDL property is defined in resource-adapter connection configuration and only when WSDL Based Procedures are used. WSDL file must contain WS-Policy section, then WS-Policy section is correctly interpreted and enforced on the endpoint. This is what the sample CXF configuration looks like:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:http="http://cxf.apache.org/transports/http/configuration"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:cxf="http://cxf.apache.org/core"
    xmlns:p="http://cxf.apache.org/policy"
    xmlns:sec="http://cxf.apache.org/configuration/security"
    xsi:schemaLocation="http://www.springframework.org/schema/beans           http://www.springframework.org/schema/beans/spring-beans.xsd           http://cxf.apache.org/jaxws                           http://cxf.apache.org/schemas/jaxws.xsd           http://cxf.apache.org/transports/http/configuration   http://cxf.apache.org/schemas/configuration/http-conf.xsd           http://cxf.apache.org/configuration/security          http://cxf.apache.org/schemas/configuration/security.xsd           http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd           http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd">
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
    <cxf:bus>
        <cxf:features>
            <p:policies/>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus>
 
    <jaxws:client name="{http://webservices.samples.jboss.org/}HelloWorldPort" createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.kerberos.client">
                <bean class="org.apache.cxf.ws.security.kerberos.KerberosClient">
                    <constructor-arg ref="cxf"/>
                    <property name="contextName" value="alice"/>
                    <property name="serviceName" value="bob@service.example.com"/>
                </bean>
            </entry>
        </jaxws:properties>
    </jaxws:client>
</beans>
Copy to Clipboard Toggle word wrap
Nexst, configure the security-domain in the standalone-teiid.xml file under 'security' subsystem like this:
<security-domain name="alice" cache-type="default">
    <authentication>
        <login-module code="Kerberos" flag="required">
            <module-option name="storeKey" value="true"/>
            <module-option name="useKeyTab" value="true"/>
            <module-option name="keyTab" value="/home/alice/alice.keytab"/>
            <module-option name="principal" value="alice@EXAMPLE.COM"/>
            <module-option name="doNotPrompt" value="true"/>
            <module-option name="debug" value="true"/>
            <module-option name="refreshKrb5Config" value="true"/>
        </login-module>
    </authentication>
</security-domain>
Copy to Clipboard Toggle word wrap
The CXF config property may also be used to control the logging of requests and responses for specific or all ports. Logging, when enabled, will be performed at an INFO level to the org.apache.cxf.interceptor context: batch /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true) /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigFile:add(value=${jboss.server.home.dir}/standalone/configuration/xxx-jbossws-cxf.xml) /subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigName:add(value=port_x) /subsystem=resource-adapters/resource-adapter=webservice:activate runbatch
Here is the corresponding xxx-jbossws-cxf.xml file:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://cxf.apache.org/jaxws
          http://cxf.apache.org/schemas/jaxws.xsd">
 
    <jaxws:client name="{http://teiid.org}port_y"
        createdFromAPI="true">
        <jaxws:features>
            <bean class="org.apache.cxf.feature.LoggingFeature"/>
        </jaxws:features>
    </jaxws:client>
 
</beans>
Copy to Clipboard Toggle word wrap
The CXF config property may also be used to control low level aspects of the HTTP transport:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
       xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
                           http://cxf.apache.org/schemas/configuration/http-conf.xsd
                           http://www.springframework.org/schema/beans
                             http://www.springframework.org/schema/beans/spring-beans.xsd">
 
  <http-conf:conduit name="{http://teiid.org}port_z.http-conduit">
     <!-- WARNING ! disableCNcheck=true should NOT be used in production -->
     <http-conf:tlsClientParameters disableCNcheck="true" />
 
  </http-conf:conduit>
</beans>
Copy to Clipboard Toggle word wrap
To use HTTPS, configure the CXF file like this (You can also configure HTTPBasic, kerberos and so forth):
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:sec="http://cxf.apache.org/configuration/security"
    xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
    xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd">
  
    <http-conf:conduit name="*.http-conduit">
        <http-conf:client ConnectionTimeout="120000" ReceiveTimeout="240000"/>
        <http-conf:tlsClientParameters secureSocketProtocol="SSL">
          <sec:trustManagers>
            <sec:keyStore type="JKS" password="changeit" file="/path/to/truststore.jks"/>
          </sec:trustManagers>
        </http-conf:tlsClientParameters>
    </http-conf:conduit>
</beans>
Copy to Clipboard Toggle word wrap
The kerberos support is based SPNEGO as described in http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-SpnegoAuthentication%28Kerberos%29. There two types of kerberos support, this first of which is Negotiation. With this configuration, the REST service is configured with a Kerberos JAAS domain, to negotiate a token, which is then used to access the web service. For this first create a security domain in the standalone.xml file:
<security-domain name="MY_REALM" cache-type="default">
     <authentication>
         <login-module code="Kerberos" flag="required">
             <module-option name="storeKey" value="true"/>
              
             <module-option name="useKeyTab" value="true"/>
             <module-option name="keyTab" value="/home/username/service.keytab"/>
             <module-option name="principal" value="host/testserver@MY_REALM"/>
 
             <module-option name="doNotPrompt" value="true"/>
             <module-option name="debug" value="false"/>
         </login-module>
     </authentication>
</security-domain> 
Copy to Clipboard Toggle word wrap
Set the jboss-cxf-xxx.xml file like this:
<beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:sec="http://cxf.apache.org/configuration/security" 
        xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
        xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd"> 
  
       <http-conf:conduit name="*.http-conduit">
           <http-conf:authorization>
               <sec:AuthorizationType>Negotiate</sec:AuthorizationType>
               <sec:Authorization>MY_REALM</sec:Authorization>
           </http-conf:authorization>
       </http-conf:conduit>
</beans>
Copy to Clipboard Toggle word wrap
The resource adapter creation needs to define these properties:
<config-property name="ConfigFile">path/to/jboss-cxf-xxxx.xml</config-property>
<config-property name="ConfigName">test</config-property>
Copy to Clipboard Toggle word wrap

Important

Even though above configuration configures the value of "ConfigName", the cxf framework currently in the case of JAX-RS client does not give option to use it. For that reason use "*.http-conduit" which will apply to all the HTTP communications under this resource adapter.
The second method is Delegation. If the user is already logged into Teiid using Kerberos using JDBC/ODBC or used SPNEGO in web-tier and used pass-through authentication into Teiid, then there is no need to negotiate a new token for the Kerberos. The system can delegate the existing token. To configure for delegation, set up security domain defined exactly as defined in "negotiation", and jboss-cxf-xxx.xml file, however remove the following line from jboss-cxf-xxx.xml file, as it is not going to negotiate new token.
<sec:Authorization>MY_REALM</sec:Authorization>
Copy to Clipboard Toggle word wrap
Add the following properties in web service resource adapter creation. One determines that "kerberos" security being used, the second defines a security domain to be used at the data source, in this case we want to use a security domain that passes through a logged-in user:
<config-property name="SecurityType">Kerberos</config-property>
<security> 
     <security-domain>passthrough-security</security-domain> 
</security> 
Copy to Clipboard Toggle word wrap
To configure the "passthrough-security" security domain you must add the "security" subsystem settings:
<security-domain name="passthrough-security" cache-type="default"> 
    <authentication> 
        <login-module code="org.teiid.jboss.PassthroughIdentityLoginModule" flag="required" module="org.jboss.teiid"> 
            <module-option name="username" value="guest"/> 
            <module-option name="password" value="guest"/> 
        </login-module> 
    </authentication> 
</security-domain> 
Copy to Clipboard Toggle word wrap

Note

The username and password are optional. If there is no authenticated subject available in the context, these can help create a simple static user, but that user will not work with kerberos authentication as the subject will not have the kerberos token that is required.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat