Configuring an Oracle Coherence Cache Loader

12-26 Oracle Complex Event Processing Developers Guide 2. Declare the caching system in the EPN assembly file. Use the wlevs:caching-system element to declare a third-party implementation; use the class or provider attributes to specify additional information. For simplicity, you can include the third-party implementation code inside the Oracle CEP application bundle itself to avoid having to import or export packages and managing the lifecycle of a separate bundle that contains the third-party implementation. In this case the wlevs:caching-system element appears in the EPN assembly file as shown in the following example: wlevs:caching-system id=caching-system-id class=third-party-implementation-class The class attribute specifies a Java class that must implement the com.bea.wlevs.cache.spi.CachingSystem interface. For details about this interface, see the Oracle Fusion Middleware Java API Reference for Oracle Complex Event Processing. Sometimes, however, you might not be able, or want, to include the third-party caching implementation in the same bundle as the Oracle CEP application that is using it. In this case, you must create a separate bundle whose Spring application context includes the wlevs:caching-system element, with the advertise attribute mandatory: wlevs:caching-system id =caching-system-id class=third-party-implementation-class advertise=true Alternatively, if you want to decouple the implementation bundle from the bundle that references it, or you are plugging in a caching implementation that supports multiple caching systems per Java process, you can specify a factory as a provider: wlevs:caching-system id =caching-system-id provider=caching-provider factory id=factory-id provider-name=caching-provider classthe.factory.class.nameclass factory The factory class the.factory.class.name in the example must implement the com.bea.wlevs.cache.spi.CachingSystemFactory interface. This interface has a single method, create, that returns a com.bea.wlevs.cache.spi.CachingSystem instance. You must deploy this bundle alongside the application bundle so that the latter can start using it. 3. Declare one or more caches for this caching system in the EPN assembly file. After you have declared a caching system for an application, you configure one or more caches using the wlevs:cache element: wlevs:caching-system id =caching-system-id provider=caching-provider ... wlevs:cache id=cache-id name=alternative-cache-name wlevs:caching-system ref=caching-system-id wlevs:cache The name attribute is optional; specify it only if the name of the cache in the caching system is different from its ID. The wlevs:caching-system child element references the already-declared caching system that contains the cache. You must specify this child element only if the caching system is ambiguous: there Configuring Caching 12-27 is more than one caching system declared either implicitly or explicitly or if the caching system is in a different application or bundle. You can export both the caching system and the cache as an OSGI service using the advertise attribute. wlevs:caching-system id=caching-system-id advertise=true ... wlevs:cache id=cache-id name=alternative-cache-name advertise=true wlevs:caching-system ref=caching-system-id wlevs:cache If the cache is advertised, then a component in the EPN of an application in a separate bundle can then reference it. The following example shows how a processor in one bundle can use as a cache source the cache with ID cache-id located in a separate bundle called cacheprovider: wlevs:processor id=myProcessor2 wlevs:cache-source ref=cacheprovider:cache-id wlevs:processor The caching system is responsible for creating the cache associated with a particular name and returning a reference to the cache. The resulting cache bean implements the java.util.Map interface. 4. Configure the third-party caching system and its caches by updating the third-party caching configuration file or files for the application. Refer to your third-party cache documentation. 5. Optionally, override the default third-party cache configuration by updating the appropriate configuration file with one or more additional cache element child elements. ■ Specify that a cache is an event sink by configuring it as a listener to another component in the event processing network. Refer to your third-party cache documentation. ■ Specify that a cache is an event source to which another component in the event processing network listens. Refer to your third-party cache documentation. ■ Configure a cache loader or store. Refer to your third-party cache documentation. 6. Access the third-party cache: – Optionally reference the third-party cache in a query statement. See: Section 12.5, Accessing a Cache From an Oracle CQL Statement Section 12.6, Accessing a Cache From an EPL Statement – Optionally configure and program a custom adapter, business POJO, or Oracle CQL or EPL user-defined function to access the third-party cache. The configuration is done in the EPN assembly file and the programming is done in the Java file that implements the adapter, POJO, or user-defined function. See: