Understanding Data Cartridge Application Context How to Configure Oracle Spatial Application Context

Configuring Applications With Data Cartridges 18-5 7. Edit the component configuration file to add the required namespace entries as Example 18–7 shows: Example 18–7 Component Configuration File: Oracle JDBC Data Cartridge Namespace ?xml version=1.0 encoding=UTF-8? wlevs:config xmlns:wlevs=http:www.bea.comnswlevsconfigapplication xmlns:xsi=http:www.w3.org2001XMLSchema-instance xmlns:jc=http:www.oracle.comnsocepconfigjdbc xsi:schemaLocation= http:www.oracle.comnsocepconfigjdbc http:www.oracle.comnsocepconfigjdbcocep_jdbc_context.xsd 8. Edit the component configuration file to add a jc:jdbc-ctx element as Example 18–8 shows. Example 18–8 jc:jdbc-ctx Element in Component Configuration File jc:jdbc-ctx jc:jdbc-ctx 9. Add a name child element whose value is the name of the Oracle JDBC application context you defined in the EPN assembly file as Example 18–9 shows. Example 18–9 jc:jdbc-ctx Element in Component Configuration File: name jc:jdbc-ctx nameJdbcCartridgeOnename jc:jdbc-ctx 10. Add a data-source child element whose value is the name of a datasource defined in the Oracle CEP server config.xml file. For more information, see: ■ Configuring JDBC for Oracle CEP in the Oracle Complex Event Processing Administrators Guide. ■ Section F.10, data-source Example 18–10 shows how to specify the datasource named StockDS. Example 18–10 jc:jdbc-ctx Element in Component Configuration File: data-source jc:jdbc-ctx nameJdbcCartridgeOnename data-sourceStockDSdata-source jc:jdbc-ctx 11. Create one or more SQL functions using the function child element as Example 18–11 shows. Example 18–11 jc:jdbc-ctx Element in Component Configuration File: function jc:jdbc-ctx nameJdbcCartridgeOnename data-sourceStockDSdata-source function name=getDetailsByOrderIdName param name=inpOrderId type=int param name=inpName type=char return-component-type com.oracle.cep.example.jdbc_cartridge.RetEvent return-component-type 18-6 Oracle Complex Event Processing Developers Guide sql[CDATA[ SELECT Employee.empName as employeeName, Employee.empEmail as employeeEmail, OrderDetails.description as description FROM PlacedOrders, OrderDetails , Employee WHERE PlacedOrders.empId = Employee.empId AND PlacedOrders.orderId = OrderDetails.orderId AND Employee.empName = :inpName AND PlacedOrders.orderId = :inpOrderId ]]sql function jc:jdbc-ctx For more information, see Defining SQL Statements in the Oracle Complex Event Processing CQL Language Reference. 12. Create Oracle CQL queries that invoke the SQL functions using the Oracle JDBC data cartridge application context. Example 18–12 shows how to reference a jdbc:jdbc-context in an Oracle CQL query. In this case, the query uses link name JdbcCartridgeOne defined in Example 18–11 to propagate this application context to the Oracle JDBC data cartridge. The Oracle CQL query in Example 18–12 invokes the function getDetailsByOrderIdName defined by Oracle JDBC data cartridge context JdbcCartridgeOne. Example 18–12 Referencing JDBC Application Context in an Oracle CQL Query processor nameProcname rules query id=q1[CDATA[ RStream select currentOrder.orderId, details.orderInfo.employeeName, details.orderInfo.employeeemail, details.orderInfo.description from OrderArrival[now] as currentOrder, TABLEgetDetailsByOrderIdNameJdbcCartridgeOne currentOrder.orderId, currentOrder.empName as orderInfo as details ]]query rules processor For more information see, Defining Oracle CQL Queries With the Oracle JDBC Data Cartridge in the Oracle Complex Event Processing CQL Language Reference. Note: You must provide alias names for every SELECT list column in the SQL query. 19 Extending Component Configuration 19-1 19 Extending Component Configuration This chapter describes: ■ Section 19.1, Overview of Extending Component Configuration ■ Section 19.2, Extending Component Configuration ■ Section 19.3, Programming Access to the Configuration of a Custom Adapter or Event Bean

19.1 Overview of Extending Component Configuration

Adapters and event beans have default configuration data. This default configuration is typically adequate for simple and basic applications. However, you can also extend this configuration by using a XML Schema Definition XSD schema to specify a new XML format of an adapter configuration file that extends the built-in XML type provided by Oracle CEP. By extending the XSD Schema, you can add as many new elements to the adapter configuration as you want, with few restrictions other than each new element must have a name attribute. This feature is based on standard technologies, such as XSD and Java Architecture for XML Binding JAXB. You can extend component configuration by: ■ Annotating your adapter or event bean Java class with the annotations that javax.xml.bind.annotation specifies. See Section 19.1.1, Extending Component Configuration Using Annotations . ■ Manually generating an XSD. See Section 19.1.2, Extending Component Configuration Using an XSD . ■ Manually generating a custom schema which does not extend the application schema. This allows you to create custom configuration in your own namespace without having to define all the other elements. This mechanism functions like the annotation approach after you generate the schema. For more information, see: ■ Chapter 14, Configuring Custom Adapters ■ Chapter 15, Configuring Custom Event Beans ■ Section B.2, Component Configuration Schema wlevs_application_config.xsd