Creating the XSD Schema File

19-10 Oracle Complex Event Processing Developers Guide Example 19–5 Extended Component Configuration ?xml version=1.0 encoding=UTF-8? app:config xmlns:app=http:www.bea.comnswlevsconfigapplication xmlns:sample=http:www.oracle.comnscepconfigsample xmlns:xsi=http:www.w3.org2001XMLSchema-instance xsi:schemaLocation= http:www.bea.comnswlevsconfigapplication http:www.bea.comnswlevsconfigapplicationwlevs_application_config.xsd http:www.oracle.comnscepconfigsample http:www.oracle.comnscepconfigsampleocep_sample_config.xsd processor nameclusterProcessorname rules query id=clusterRule[CDATA[ select from clusterInstream [Now] ]]query rules processor sample:adapter namemyadaptername config doittruedoit config sample:adapter app:config At run time, by default Oracle CEP directly injects the value true of the Java bean property doit. For more information, see: ■ Section 19.3.2, How to Access Component Configuration Using Lifecycle Callbacks ■ Section 1.4, Configuring Oracle CEP Resource Access

19.3.2 How to Access Component Configuration Using Lifecycle Callbacks

In your adapter implementation, you can use metadata annotations to specify the Java methods that are invoked by Oracle CEP at runtime. Oracle CEP passes an instance of the configuration Java class to these specified methods; you can then program these methods to get specific runtime configuration information about the adapter. The following example shows how to annotate the activateAdapter method with the Activate annotation to specify the method invoked when the adapter configuration is first activated: Activate public void activateAdapterHelloWorldAdapterConfig adapterConfig { this.message = adapterConfig.getMessage; } By default, the data type of the adapter configuration Java class is com.bea.wlevs.configuration.application.DefaultAdapterConfig. If, however, you have extended the configuration of your adapter by creating your own XSD file that describes the configuration XMLfile, then you specify the type in the XSD Note: The extended component configuration schema requires a nested config element as Example 19–5 shows. Extending Component Configuration 19-11 file. In the preceding example, the data type of the Java configuration object is com.bea.wlevs.example.helloworld.HelloWorldAdapterConfig. This section describes: ■ Section 19.3.2.1, Lifecycle Callback Annotations ■ Section 19.3.2.2, Lifecycle

19.3.2.1 Lifecycle Callback Annotations

You can use the following metadata annotations to specify various lifecycle callback methods: ■ com.bea.wlevs.management.Activate—Specifies the method invoked when the configuration is activated. See Section I.2, com.bea.wlevs.configuration.Activate for additional details about using this annotation in your adapter code. ■ com.bea.wlevs.management.Prepare—Specifies the method invoked when the configuration is prepared. See Section I.3, com.bea.wlevs.configuration.Prepare for additional details about using this annotation in your adapter code. ■ com.bea.wlevs.management.Rollback—Specifies the method invoked when the adapter is terminated due to an exception. See Section I.4, com.bea.wlevs.configuration.Rollback for additional details about using this annotation in your adapter code. For more information, see Section 19.3.2.2, Lifecycle .

19.3.2.2 Lifecycle

Oracle CEP follows the following lifecycle during custom adapter and event bean instantiation: 1. Create adapter or event bean instance. 2. Inject static properties. 3. Call afterPropertiesSet. 4. Prepare phase: a. If Prepare with one or more configuration arguments is present, call it. b. Otherwise, directly inject configuration properties. See Section 19.3.1, How to Access Component Configuration Using Resource Injection . c. If Prepare without arguments is present, call it. 5. Activate phase: a. If Activate with one or more configuration arguments is present, call it. b. If Activate without arguments is present, call it. 6. Call afterConfigurationActive. 7. Continue with other configuration. 19-12 Oracle Complex Event Processing Developers Guide Part V Part V Developing Applications for High Availability Part V contains the following chapters: ■ Chapter 20, Understanding High Availability ■ Chapter 21, Configuring High Availability