How to Expose an Oracle CEP Application as a Web Service

18-2 Oracle Complex Event Processing Developers Guide To configure Oracle Spatial application context: 1. Open the EPN editor in the Oracle CEP IDE for Eclipse. See Section 6.1, Opening the EPN Editor . 2. Import the package com.oracle.cep.cartridge.spatial into your Oracle CEP application’s MANIFEST.MF file. For more information, see Section 4.7.5, How to Import a Package .

3. Right-click any component and select Go to Assembly Source.

4. Edit the EPN file to add the required namespace and schema location entries as Example 18–1 shows: Example 18–1 EPN Assembly File: Oracle Spatial Namespace and Schema Location ?xml version=1.0 encoding=UTF-8? beans xmlns=http:www.springframework.orgschemabeans xmlns:xsi=http:www.w3.org2001XMLSchema-instance xmlns:osgi=http:www.springframework.orgschemaosgi xmlns:wlevs=http:www.bea.comnswlevsspring xmlns:spatial=http:www.oracle.comnsocepspatial xsi:schemaLocation= http:www.springframework.orgschemabeans http:www.springframework.orgschemabeansspring-beans.xsd http:www.springframework.orgschemaosgi http:www.springframework.orgschemaosgispring-osgi.xsd http:www.bea.comnswlevsspring http:www.bea.comnswlevsspringspring-wlevs-v11_1_1_3.xsd http:www.oracle.comnsocepspatial http:www.oracle.comnsocepspatialocep-spatial.xsd 5. Edit the EPN file to add a spatial:context element as Example 18–2 shows. Example 18–2 spatial:context Element in EPN Assembly File spatial:context id=SpatialGRS80 6. Assign a value to the id attribute that is unique in this EPN. This is the name you will use to reference this application context in subsequent Oracle CQL queries. In Example 18–2 , the id is SpatialGRS80. 7. Configure the other attributes of the spatial:context element to suit your application requirements. Table 18–1 lists the attributes of the spatial:context element. Note: The id value must not equal the Oracle Spatial name spatial. For more information, see Data Cartridge Name in the Oracle Complex Event Processing CQL Language Reference. Table 18–1 spatial:context Element Attributes Attribute Description anyinteract-tolerance The default tolerance for contain or inside operator. Default: 0.0000005 Configuring Applications With Data Cartridges 18-3 Example 18–3 shows how to create a spatial context named SpatialGRS80 in an EPN assembly file using the Geodetic Reference System 1980 GRS80 coordinate system srid=4269. Example 18–3 spatial:context Element in EPN Assembly File spatial:context id=SpatialGRS80 srid=4269 sma=63787.0 rof=298.25722101 8. Create Oracle CQL queries that reference this application context by name. Example 18–4 shows how to reference a spatial:context in an Oracle CQL query. In this case, the query uses link name SpatialGRS80 defined in Example 18–2 to propagate this application context to the Oracle Spatial. The spatial:context attribute settings of SpatialGRS80 are applied to the createPoint method call. Because the application context defines the SRID, you do not need to pass that argument into the createPoint method. Example 18–4 Referencing spatial:context in an Oracle CQL Query view id=”createPoint” select com.oracle.cep.cartridge.spatial.Geometry.createPointSpatialGRS80lng, lat, 0d from CustomerPos[NOW] view For more information, see Using Oracle Spatial in the Oracle Complex Event Processing CQL Language Reference.

18.3 How to Configure Oracle JDBC Data Cartridge Application Context

You define an application context for an instance of an Oracle JDBC data cartridge using: ■ A jdbc:jdbc-context element in the EPN assembly file. ■ A jc:jdbc-ctx element in the component configuration file. rof Defines the Reciprocal Of Flattening ROF parameter used for buffering and projection. Default: 298.257223563 sma Defines the Semi-Major Axis SMA parameter used for buffering and projection. Default: 6378137.0 srid SRID integer. Valid values are: ■ CARTESIAN: for cartesian coordinate system. ■ LAT_LNG_WGS84_SRID: for WGS84 coordinate system. ■ An integer value from the Oracle Spatial SDO_COORD_SYS table COORD_SYS_ID column. Default : LAT_LNG_WGS84_SRID tolerance The minimum distance to be ignored in geometric operations including buffering. Default: 0.000000001 Table 18–1 Cont. spatial:context Element Attributes Attribute Description 18-4 Oracle Complex Event Processing Developers Guide The jc:jdbc-ctx element: – references one and only one jdbc:jdbc-context – references one and only one data-source – defines one or more SQL functions For more information see, Understanding the Oracle JDBC Data Cartridge in the Oracle Complex Event Processing CQL Language Reference. To configure Oracle JDBC data cartridge application context: 1. Open the EPN editor in the Oracle CEP IDE for Eclipse. See Section 6.1, Opening the EPN Editor .

2. Right-click any component and select Go to Assembly Source.

3. Edit the EPN file to add the required namespace and schema location entries as Example 18–5 shows: Example 18–5 EPN Assembly File: Oracle JDBC Data Cartridge Namespace and Schema Location ?xml version=1.0 encoding=UTF-8? beans xmlns=http:www.springframework.orgschemabeans xmlns:xsi=http:www.w3.org2001XMLSchema-instance xmlns:osgi=http:www.springframework.orgschemaosgi xmlns:wlevs=http:www.bea.comnswlevsspring xmlns:jdbc=http:www.oracle.comnsocepjdbc xsi:schemaLocation= http:www.springframework.orgschemabeans http:www.springframework.orgschemabeansspring-beans.xsd http:www.springframework.orgschemaosgi http:www.springframework.orgschemaosgispring-osgi.xsd http:www.bea.comnswlevsspring http:www.bea.comnswlevsspringspring-wlevs-v11_1_1_3.xsd http:www.oracle.comnsocepjdbc http:www.oracle.comnsocepjdbcocep-jdbc.xsd 4. Edit the EPN file to add a jdbc:jdbc-context element as Example 18–6 shows. Example 18–6 jdbc:jdbc-context Element in EPN Assembly File: id jdbc:jdbc-context id=JdbcCartridgeOne 5. Assign a value to the id attribute that is unique in this EPN. This is the name you will use to reference this application context in subsequent Oracle CQL queries. In Example 18–6 , the id is JdbcCartridgeOne.

6. Right-click the desired processor and select Go to Configuration Source.

Note: You must provide alias names for every SELECT list column in the SQL function. Note: The id value must not equal the Oracle JDBC data cartridge name jdbc. For more information, see Data Cartridge Name in the Oracle Complex Event Processing CQL Language Reference. 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