Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

Preview:

DESCRIPTION

Watch on YouTube: http://www.youtube.com/watch?v=VSCLETDNs14

Citation preview

<Insert Picture Here>

Coherence 12.1.2 Configuration EnhancementsPart 2: Custom Configuration NamespacesBrian OliverSenior Consulting Member of StaffCloud Application Foundation - Oracle Coherence

Oracle Fusion Middleware 12c Cloud Application Foundation

Coherence 12.1.2

2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

The Agenda…

4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Coherence 12.1.2 ConfigurationEnhancements…• Configuration Objects from elsewhere?

– How to I get an Object from framework X into Coherence?

• Introducing the Spring Namespace for Coherence 12.1.2

• Summary

Using Objects from Elsewhere…

6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Old Style Cache Store Configuration<cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd">

<caching-scheme-mapping> <cache-mapping> <cache-name>dist-*</cache-name> <scheme-name>distributed-scheme</scheme-name> </cache-mapping> </caching-scheme-mapping>

<caching-schemes> <distributed-scheme> <scheme-name>distributed-scheme</scheme-name> <service-name>DistributedCache</service-name>

<backing-map-scheme> <read-write-backing-map-scheme>

<cachestore-scheme> <class-scheme> <class-name>MyOldStyleCacheStore</class-name> </class-scheme> </cachestore-scheme> </read-write-backing-map-scheme> </backing-map-scheme>

<autostart>true</autostart> </distributed-scheme>

</caching-schemes></cache-config>

7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

My Custom Cache Store Configuration<cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd">

<caching-scheme-mapping> <cache-mapping> <cache-name>dist-*</cache-name> <scheme-name>distributed-scheme</scheme-name> </cache-mapping> </caching-scheme-mapping>

<caching-schemes> <distributed-scheme> <scheme-name>distributed-scheme</scheme-name> <service-name>DistributedCache</service-name>

<backing-map-scheme> <read-write-backing-map-scheme>

<cachestore-scheme> MY FRAMEWORK OBJECT HERE!!! </cachestore-scheme> </read-write-backing-map-scheme> </backing-map-scheme>

<autostart>true</autostart> </distributed-scheme>

</caching-schemes></cache-config>

8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Objects from elsewhere?

• Use Case:– Provide an Object to Coherence (not have Coherence build one)– Use an external Container/ Factory / Framework to provide them– Coherence should just use but not instantiate Objects

• Historical Solution:– Use <class-scheme> with <class-factory-name> and <method-

name>… to specify a static factory

public static Object createObject(…);

9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Objects from elsewhere?

• For CDI / Spring / Guice et al support…– Extend internal DefaultConfigurableCacheFactory class– And… override internally defined instantiateAny(…) method– Or... configure a SpringAwareCacheFactory

• Oh no!!!– Can’t easily use both SpringAwareCacheFactory and Incubator…

together… Each implementation uses the same technique!

10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Why?

• Perhaps you need…– A Database Connection from a Database Connection Pool?– A JNDI Resource?– A Transaction Manager?– … are probably provided by another framework– … how to you “get” them into your “Cache Store”?

• @Injectables help but we need more!

Custom Configuration Namespaces…

12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Introducing the Spring Namespace<cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="" xmlns:spring="class://com.oracle.coherence.spring.SpringNamespaceHandler" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd class://com.oracle.coherence.spring.SpringNamespaceHandler coherence-spring-config.xsd">

<spring:bean-factory> <spring:application-context-uri>application-context.xml</spring:application-context-uri> </spring:bean-factory>

. . . <caching-schemes> <distributed-scheme> <scheme-name>distributed-scheme</scheme-name> <service-name>DistributedCache</service-name>

<backing-map-scheme> <read-write-backing-map-scheme> <cachestore-scheme> <spring:bean> <spring:bean-name>myCacheStoreBean</spring:bean-name> </spring:bean> </cachestore-scheme> </read-write-backing-map-scheme> </backing-map-scheme>

<autostart>true</autostart> </distributed-scheme> </caching-schemes></cache-config>

13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Introducing the Spring Namespace<cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="" xmlns:spring="class://com.oracle.coherence.spring.SpringNamespaceHandler" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd class://com.oracle.coherence.spring.SpringNamespaceHandler coherence-spring-config.xsd">

<spring:bean-factory> <spring:application-context-uri>application-context.xml</spring:application-context-uri> </spring:bean-factory>

. . . <caching-schemes> <distributed-scheme> <scheme-name>distributed-scheme</scheme-name> <service-name>DistributedCache</service-name>

<backing-map-scheme> <read-write-backing-map-scheme> <cachestore-scheme> <spring:bean> <spring:bean-name>myCacheStoreBean</spring:bean-name> </spring:bean> </cachestore-scheme> </read-write-backing-map-scheme> </backing-map-scheme>

<autostart>true</autostart> </distributed-scheme> </caching-schemes></cache-config>

14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Introducing the Spring Namespace<cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="" xmlns:spring="class://com.oracle.coherence.spring.SpringNamespaceHandler" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd class://com.oracle.coherence.spring.SpringNamespaceHandler coherence-spring-config.xsd">

<spring:bean-factory> <spring:application-context-uri>application-context.xml</spring:application-context-uri> </spring:bean-factory>

. . . <caching-schemes> <distributed-scheme> <scheme-name>distributed-scheme</scheme-name> <service-name>DistributedCache</service-name>

<backing-map-scheme> <read-write-backing-map-scheme> <cachestore-scheme> <spring:bean> <spring:bean-name>myCacheStoreBean</spring:bean-name> </spring:bean> </cachestore-scheme> </read-write-backing-map-scheme> </backing-map-scheme>

<autostart>true</autostart> </distributed-scheme> </caching-schemes></cache-config>

15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Introducing the Spring Namespace<cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="" xmlns:spring="class://com.oracle.coherence.spring.SpringNamespaceHandler" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd class://com.oracle.coherence.spring.SpringNamespaceHandler coherence-spring-config.xsd">

<spring:bean-factory> <spring:application-context-uri>application-context.xml</spring:application-context-uri> </spring:bean-factory>

. . . <caching-schemes> <distributed-scheme> <scheme-name>distributed-scheme</scheme-name> <service-name>DistributedCache</service-name>

<backing-map-scheme> <read-write-backing-map-scheme> <cachestore-scheme> <spring:bean> <spring:bean-name>myCacheStoreBean</spring:bean-name> </spring:bean> </cachestore-scheme> </read-write-backing-map-scheme> </backing-map-scheme>

<autostart>true</autostart> </distributed-scheme> </caching-schemes></cache-config>

16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Why Coherence 12.1.2 Namespaces? They allow you to…

• Replace Standard Coherence Configurations– eg: Replace the <class-scheme> with <spring:bean>

• Refine Coherence Configuration Objects– eg: Change a defined Scheme or Cache Mapping

• Define new Coherence Configuration Objects– eg: Define a new Cache/Scheme/Mapping on-the-fly

17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Why Coherence 12.1.2 Namespaces? They allow you to…

• Define new Resources for @Injectables– eg: Define a Database Connection Pool in the Resource Registry

• Define new “features” for Coherence– eg: Define a new type of Cache or Service (or anything else)

• Or.. Completely replace Coherence Configurations– eg: Make up your own way to configure Coherence

Build Your Own…Imagine the possibilities…

Summary

20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Summary

• Coherence 12.1.2 introduces Custom Namespace Configurations– Allows integration of third-party frameworks directly into Coherence– Allows independent development of extensions– Allows customization of Coherence

21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Next Part?

• Developing your own Custom Namespaces– The Coherence Configuration Framework– The Coherence Configuration Model

Join the Coherence Community

http://coherence.oracle.com

@OracleCoherence

/OracleCoherence

blogs.oracle.com/OracleCoherence

Group: Oracle Coherence Users

/OracleCoherence

coherence.oracle.com/display/CSIGCoherence Special Interest Group

23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

The proceeding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

<Insert Picture Here>

Coherence 12.1.2 Configuration EnhancementsPart 2: Custom Configuration NamespacesBrian OliverSenior Consulting Member of StaffCloud Application Foundation - Oracle Coherence

Oracle Fusion Middleware 12c Cloud Application Foundation

Coherence 12.1.2