24
<Insert Picture Here> Coherence 12.1.2 Configuration Enhancements Part 2: Custom Configuration Namespaces Brian Oliver Senior Consulting Member of Staff Cloud Application Foundation - Oracle Coherence Oracle Fusion Middleware 12c Cloud Application Foundation Coherence 12.1.2

Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

<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

Page 2: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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.

Page 3: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

The Agenda…

Page 4: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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

Page 5: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

Using Objects from Elsewhere…

Page 6: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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>

Page 7: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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>

Page 8: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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(…);

Page 9: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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!

Page 10: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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!

Page 11: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

Custom Configuration Namespaces…

Page 12: Coherence Configuration Enhancements - Part 2 - 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>

Page 13: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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>

Page 14: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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>

Page 15: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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>

Page 16: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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

Page 17: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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

Page 18: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

Build Your Own…Imagine the possibilities…

Page 19: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

Summary

Page 20: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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

Page 21: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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

Page 22: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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

Page 23: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

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.

Page 24: Coherence Configuration Enhancements - Part 2 - Custom Configuration Namespaces

<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