Using the EPN Assembly File

Overview of Oracle CEP Events 2-23 Then, in the MyBean class, you can access the EventTypeRepository using the eventTypeRepository property initialized by Spring as Example 2–16 shows. Example 2–16 Accessing the EventTypeRepository in the MyBean Implementation package com.acme; import com.bea.wlevs.ede.api.EventTypeRepository; import com.bea.wlevs.ede.api.EventType; public class MyBean { private EventTypeRepository eventTypeRepository; public void setEventTypeRepositoryEventTypeRepository eventTypeRepository { this.eventTypeRepository = eventTypeRepository; } public void onInsertEventObject event throws EventRejectedException { get the event type for the current event instance EventType eventType = eventTypeRepository.getEventTypeevent; ... } }

2.7.2 Using the Spring-DM ServiceReference Annotation

You can access the EventTypeRepository by using the Spring-DM ServiceReference annotatoin to initialize a property in your Java source as Example 2–17 shows. Example 2–17 Java Source File Using the ServiceReference Annotation import org.springframework.osgi.extensions.annotation.ServiceReference; import com.bea.wlevs.ede.api.EventTypeRepository; ... ServiceReference setEventTypeRepositoryEventTypeRepository etr { ... }

2.7.3 Using the Oracle CEP Service Annotation

You can access the EventTypeRepository by using the Oracle CEP Service annotation to initialize a property in your Java source as Example 2–17 shows. Example 2–18 Java Source File Using the Service Annotation import com.bea.wlevs.util.Service; import com.bea.wlevs.ede.api.EventTypeRepository; ... Service setEventTypeRepositoryEventTypeRepository etr { ... } For more information, see: Section I.5, com.bea.wlevs.util.Service .

2.8 Sharing Event Types Between Application Bundles

Each Oracle CEP application gets its own Java classloader and loads application classes using that classloader. This means that, by default, one application cannot 2-24 Oracle Complex Event Processing Developers Guide access the classes in another application. However, because the event type repository is a singleton service, you can configure the repository in one bundle and then explicitly export the event type classes so that applications in separate bundles deployed to the same Oracle CEP server can use these shared event types. The event type names in this case are scoped to the entire Oracle CEP server instance. This means that you will get an exception if you try to create an event type that has the same name as an event type that has been shared from another bundle, but the event type classes are different. To share event type classes, add their package name to the Export-Package header of the MANIFEST.MF file of the bundle that contains the event type repository you want to share. Be sure you deploy the bundle that contains the event type repository before all bundles that contain applications that use the shared event types, or you will get a deployment exception. For more information, see: ■ Section 2.1.3.1, Event Types Specified as JavaBean or Java Class ■ Section 24.2.3, Assembling Applications With Foreign Stages ■ Oracle Java Data Cartridge in the Oracle Complex Event Processing CQL Language Reference