<Insert Picture Here>
Coherence 12.1.2 Configuration Enhancements
Part 3: Creating Custom Configuration Namespaces
Brian O...
2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
The following is intended to outline our general pr...
The Agenda…
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Coherence 12.1.2 Configuration
Enhancements…
• Your...
Your First Custom
Configuration
Namespace…
6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
The Hello World Example
<cache-config
xmlns="http:/...
7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
The Hello World Example
<cache-config
xmlns="http:/...
8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Your First Custom Configuration
Namespace…
• Four S...
9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
A Basic HelloWorldNamespaceHandler
import com.tango...
10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
What about <helloworld:greeting/>?
• The Detail…
–...
11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
HelloWorldNamespaceHandler
public class HelloWorld...
12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
AbstractNamespaceHandler…
• Provides auto discover...
13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
AbstractNamespaceHandler class
public abstract cla...
Hello World in Action!
15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Custom Configuration Namespace
Development
• How t...
16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Coherence 12.1.2 Custom
Configuration Namespaces
•...
17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Important Packages…
• The com.tangosol.coherence.c...
Summary
19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Summary
• Coherence 12.1.2 introduces Custom Names...
20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Next Part?
• Developing a Cron service using Custo...
Join the Coherence Community
http://coherence.oracle.com
@OracleCoherence
/OracleCoherence
blogs.oracle.com/OracleCoherenc...
22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
The proceeding is intended to outline our general ...
<Insert Picture Here>
Coherence 12.1.2 Configuration Enhancements
Part 3: Creating Custom Configuration Namespaces
Brian O...
Upcoming SlideShare
Loading in …5
×

Coherence Configuration Enhancements - Part 3 - Creating Custom Configuration Namespaces

555 views
466 views

Published on

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

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
555
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • We’ve made some significant investments in Coherence Cache Configuration for 12.1.2This presentation outlines some of the enhancements and flexibility of the new internal infrastructure for improving integration and extension of Coherence, especially by third-parties.
  • When processed, we will output “Gudday” to Standard Output.
  • The AbstractNamespaceHandler will automatically look for Processors it can register automatically if they are defined as inner-classes!
  • The type-based registration automatically creates a Processor for the said type based on @Injectable values! If you have an existing type that you want “configured”, CODI can do this simply by you registering the type and annotating the setters with @Injectable
  • Come join this large, vibrant community.We have a pretty significant engagement through various social media channels like twitter and facebook. ….
  • We’ve made some significant investments in Coherence Cache Configuration for 12.1.2This presentation outlines some of the enhancements and flexibility of the new internal infrastructure for improving integration and extension of Coherence, especially by third-parties.
  • Coherence Configuration Enhancements - Part 3 - Creating Custom Configuration Namespaces

    1. 1. <Insert Picture Here> Coherence 12.1.2 Configuration Enhancements Part 3: Creating 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
    2. 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.
    3. 3. The Agenda…
    4. 4. 4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Coherence 12.1.2 Configuration Enhancements… • Your First Custom Configuration Namespace – HelloWorld for Namespaces! • Coherence Cache Configuration Model – Important JavaDocs! • Summary
    5. 5. Your First Custom Configuration Namespace…
    6. 6. 6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. The Hello World Example <cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance” xmlns:helloworld=“class://HelloWorldNamespaceHandler” xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd"> <helloworld:greeting>Gudday</helloworld:greeting> <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> <local-scheme/> </backing-map-scheme> <autostart>true</autostart> </distributed-scheme> </caching-schemes> </cache-config>
    7. 7. 7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. The Hello World Example <cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance” xmlns:helloworld=“class://HelloWorldNamespaceHandler” xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd"> <helloworld:greeting>Gudday</helloworld:greeting> <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> <local-scheme/> </backing-map-scheme> <autostart>true</autostart> </distributed-scheme> </caching-schemes> </cache-config>
    8. 8. 8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Your First Custom Configuration Namespace… • Four Steps to Writing and Using Namespaces 1. Create a NamespaceHandler • Extend com.tangosol.config.xml.AbstractNamespaceHandler • Or implement com.tangosol.config.xml.NamespaceHandler 2. Create XSD for the Namespace (optional) 3. Develop Xml Content Processors for your custom Xml Content 4. Leverage Coherence Lifecycle Events (optional)
    9. 9. 9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. A Basic HelloWorldNamespaceHandler import com.tangosol.config.xml.AbstractNamespaceHandler; import com.tangosol.config.xml.ProcessingContext; import com.tangosol.run.xml.XmlElement; import java.net.URI; /** * A Simple Hello World NamespaceHandler. * * @author Brian Oliver */ public class HelloWorldNamespaceHandler extends AbstractNamespaceHandler { @Override public void onStartNamespace(ProcessingContext context, XmlElement element, String prefix, URI uri) { super.onStartNamespace(context, element, prefix, uri); System.out.println("Hello World Namespace Started"); } }
    10. 10. 10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. What about <helloworld:greeting/>? • The Detail… – The Configuration Framework delegates Xml content processing to NamespaceHandler provided Content “processors” – Xml Content Processors “process” Xml content that belongs to a namespace • So… We must define an appropriate Xml ElementProcessor for the <helloworld:greeting> element in our NamespaceHandler
    11. 11. 11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. HelloWorldNamespaceHandler public class HelloWorldNamespaceHandler extends AbstractNamespaceHandler { @Override public void onStartNamespace(ProcessingContext context, XmlElement element, String prefix, URI uri) { super.onStartNamespace(context, element, prefix, uri); System.out.println("Hello World Namespace Started"); } @XmlSimpleName("greeting") public static class GreetingProcessor implements ElementProcessor<Void> { @Override public Void process(ProcessingContext context, XmlElement element) throws ConfigurationException { System.out.println(”Greeting was [" + element.getString() + “]”); return null; } } }
    12. 12. 12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. AbstractNamespaceHandler… • Provides auto discovery of Xml Processors using Annotations – Supports manual registration through explicit calls • Internally tracks known Processors • Provides default behaviors for unknown Xml Content • Advanced… – Can “inject” values into Objects – Can “create” values from known Xml content types – Can “auto-create” Processors for Annotated Types
    13. 13. 13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. AbstractNamespaceHandler class public abstract class AbstractNamespaceHandler implements com.tangosol.config.xml.NamespaceHandler { public AbstractNamespaceHandler(); . . . public void registerProcessor(Class<?> processorClass); public void registerProcessor(String localName, ElementProcessor<?> processor); public void registerProcessor(String localName, AttributeProcessor<?> processor); public <T> void registerElementType(String localName, Class<T> elementClass); public <T> void registerAttributeType(String localName, Class<T> attributeClass); protected AttributeProcessor<?> onUnknownAttribute(XmlAttribute attribute); protected ElementProcessor<?> onUnknownElement(XmlElement element); . . . }
    14. 14. Hello World in Action!
    15. 15. 15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Custom Configuration Namespace Development • How to think about the Cache Configuration XML… – When “processed” Xml Content “produces” a specific type of instance – The Framework processes Xml documents to produce “configurations” – For Example: <cache-config> produces a CacheConfig <class-scheme> produces a ClassScheme <distributed-scheme> produces a DistributedScheme
    16. 16. 16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Coherence 12.1.2 Custom Configuration Namespaces • How to think about the Cache Configuration XML? – NamespaceHandlers define Element/Attribute Processors for XML in a Namespace • ElementProcessor<?>’s… – Are responsible for processing Xml Elements to produce values • AttributeProcessor<?>’s… – Are responsible for processing Xml Attributes to produce values
    17. 17. 17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Important Packages… • The com.tangosol.coherence.config package – Defines the runtime configuration model for Coherence 12.1.2 – Defines the Coherence Cache Configuration Namespace Handler – Defines the Coherence Xml Element and Attribute Processors – Defines Classes produced by the *Processors • The com.tangosol.config package – Defines the Configuration Framework for Coherence 12.1.2 – The core framework that processes Xml Documents
    18. 18. Summary
    19. 19. 19 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
    20. 20. 20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Next Part? • Developing a Cron service using Custom Namespaces – Leverage the Coherence Configuration Framework – Leverage the Coherence Configuration Model – Leverage the Coherence Configuration Lifecycle
    21. 21. Join the Coherence Community http://coherence.oracle.com @OracleCoherence /OracleCoherence blogs.oracle.com/OracleCoherence Group: Oracle Coherence Users /OracleCoherence coherence.oracle.com/display/CSIG Coherence Special Interest Group
    22. 22. 22 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.
    23. 23. <Insert Picture Here> Coherence 12.1.2 Configuration Enhancements Part 3: Creating 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

    ×