Custom Data Source Configuration

13-8 Oracle Complex Event Processing Administrators Guide Example 13–2 bundler.sh Command Line Options bundler.sh -source jar -name name -version version [-factory class+] [-service interface+] [-stagedir path] [-targetdir path] Example 13–3 shows how to use the bundler.sh to create an OSGi bundle for an Oracle JDBC driver. Example 13–3 Using the Bundler Utility bundler.sh \ -source C:\drivers\com.oracle.ojdbc14_11.2.0.jar \ -name oracle11g \ -version 11.2.0 \ -factory oracle.jdbc.xa.client.OracleXADataSource oracle.jdbc.OracleDriver \ -service javax.sql.XADataSource java.sql.Driver \ -targetdir C:\stage The source JAR is an Oracle driver located in directory C:\drivers. The name of the generated bundle JAR is the concatenation of the -name and -version arguments oracle10g_11.2.0.jar and is created in the C:\stage directory. The bundle JAR contains the files that Example 13–4 shows. Example 13–4 Bundle JAR Contents 1465 Thu Jun 29 17:54:04 EDT 2006 META-INFMANIFEST.MF 1540457 Thu May 11 00:37:46 EDT 2006 com.oracle.ojdbc14_11.2.0.jar 1700 Thu Jun 29 17:54:04 EDT 2006 combeacoretoolsbundlerActivator.class The command line options specify that there are two factory classes that will be instantiated and registered as an OSGi service when the bundle is activated, each under a separate object class as Table 13–2 shows. Table 13–1 bundler.sh Command Line Options Argument Description -source The path of the source JAR file to be bundled. -name The symbolic name of the bundle. The root of the target JAR file name is derived from the name value. -version The bundle version number. All exported packages are qualified with a version attribute with this value. The target JAR file name contains the version number. -factory An optional argument that specifies a space-delimited list of one or more factory classes that are to be instantiated and registered as OSGi services. Each service is registered with the OSGi service registry with name -name and version -version properties. -service An optional argument that specifies a space-delimited list of one or more Java interfaces that are used as the object class of each factory object service registration. If no interface names are specified, or the number of interfaces specified does not match the number of factory classes, then each factory object will be registered under the factory class name. -stagedir An optional argument that specifies where to write temporary files when creating the target JAR file. Default: .bundler.tmp -targetdir An optional argument that specifies the location of the generated bundle JAR file. Default: current working directory .. Configuring JDBC for Oracle CEP 13-9 Each service registration will be made with a name property set to oracle11g and a version property with a value of 11.2.0. Example 13–5 shows the Oracle CEP server log messages showing the registration of the services. Example 13–5 Service Registration Log Messages ... INFO: [Jun 29, 2006 5:54:18 PM] Service REGISTERED: { version=11.2.0, name=oracle11g, objectClass=[ javax.sql.XADataSource ], service.id=23 } INFO: [Jun 29, 2006 5:54:18 PM] Service REGISTERED: { version=11.2.0, name=oracle11g, objectClass=[ java.sql.Driver ], service.id=24 } INFO: [Jun 29, 2006 5:54:18 PM] Bundle oracle11g STARTED ...

3. Copy the bundler JAR to the Oracle CEP server library extensions directory.

Because your Oracle CEP application is an application library which contains a driver, you copy it to the Oracle CEP server library extensions directory is the DOMAIN_DIR servernamemodulesext directory, where DOMAIN_DIR refers to the domain directory such as oracle_cepuser_ projectsdomainsmydomain and servername refers to the server instance, such as myserver. For example: c:\oracle_cep\user_projects\domains\mydomain\myserver\modules\ext For more information, see Library Extensions Directory in the Oracle Complex Event Processing Developers Guide for Eclipse.

4. In the Oracle CEP server config.xml file, create a custom data-source

element for your driver version and add a driver-params child element as Example 13–6 shows. For more information, see Section 1.3.1, Oracle CEP Server Configuration Files . Example 13–6 driver-params Child Element driver-params urljdbc:oracle:thin:lcw2k18:1531:lcw101url driver-nameoracle.jdbc.xa.client.OracleXADataSourcedriver-name properties element nameusername valuescottvalue element element namepasswordname value{3DES}EoIfSBMhnW8=value element element namecom.bea.core.datasource.serviceNamename valueoracle11gvalue element element namecom.bea.core.datasource.serviceVersionname value11.2.0value Table 13–2 Factory Class and Service Interfacee Factory Class Service Interface oracle.jdbc.xa.client.OracleXADataSource javax.sql.XADataSource oracle.jdbc.OracleDriver java.sql.Driver