This discussion is archived
3 Replies Latest reply: Jul 26, 2013 5:41 AM by Jonathan.Knight RSS

Split cache config file support in 12.1.2?

962259 Newbie
Currently Being Moderated

With 3.7.1 you could use the coherence-common library from incubator 11 to split cache config files.

This was done with the introduce-cache-config XML element:

 

<?xml version="1.0"?>

<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd"
xmlns:element="class://com.oracle.coherence.environment.extensible.namespaces.XmlElementProcessingNamespaceContentHandler"
element:introduce-cache-config="cache-config-1.xml, cache-config-2.xml, cache-config-3.xml">


</cache-config>

 

But this will not be available in incubator 12, the classes used for that will not be ported from incubator 11 (Coherence 3.7.x) to incubator 12 (Coherence 12.x):

http://coherence.oracle.com/download/attachments/14188570/Incubator+Update.pdf?version=2&modificationDate=1353937318977

 

How to achieve this with 12.1.2?

 


  • 1. Re: Split cache config file support in 12.1.2?
    Jonathan.Knight Expert
    Currently Being Moderated

    Hi,

    It is still possible to do this as I did it with the 12.1.2 beta and a beta of Incubator 12 so unless either of those changed at the last minute you should be able to still import cache configuration files.

     

    The top of your XML needs to look something like this...

    <?xml version="1.0"?>

    <cache-config xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"

                  xmlns:element="class://com.oracle.coherence.common.namespace.preprocessing.XmlPreprocessingNamespaceHandler"

                  element:introduce-cache-config="config/cluster.xml">

     

    where this file is importing the "config/cluster.xml" file.

     

    If you use custom name spaces in you configuration files then there is a bit more work to do as the XmlPreprocessingNamespaceHandler only knows how to merge the standard Coherence XML so you need to add extra code to you own namespace handlers. Specifically you need to implement...

    public void mergeConfiguration(ProcessingContext processingContext, String sFromURI, XmlElement element, XmlElement xmlIntoCacheConfig, QualifiedName originatedFrom)

     

    In the implementation you need to merge your custom XML (the element parameter) across to the main XML (the xmlIntoCacheConfig parameter). A very simple implementation of this would be...

     

    @Override

    public void mergeConfiguration(ProcessingContext processingContext, String sFromURI, XmlElement element, XmlElement xmlIntoCacheConfig, QualifiedName originatedFrom) {

        // clone the element to merge

        XmlElement xmlMergeElement = (XmlElement) element.clone();

        // annotate the origin of the merging element

        xmlMergeElement.addAttribute(originatedFrom.getName()).setString(sFromURI);

        // Add the cloned element to the XML configuration

        xmlIntoCacheConfig.getElementList().add(xmlMergeElement);

    }

     

    JK

  • 2. Re: Split cache config file support in 12.1.2?
    984072 Newbie
    Currently Being Moderated

    Tested it with Coherence 12.1.2 GA, worked fine but I had the coherence-commons from incubator 11.  Any idea when Incubator 12 will be released?  And I probably missed a link somewhere, but where can I get the incubator 12 beta version?

     

    Tks

  • 3. Re: Split cache config file support in 12.1.2?
    Jonathan.Knight Expert
    Currently Being Moderated

    The reason it would have worked is that Incubator 11 contains an override file that changes the class used to implement the cache factory and this will handle all the old namespace implementations. In Incubator 12 this has been removed as name spaces are now in the core product.

     

    I'm not sure what is happening with Incubator 12. The beta worked fine for me but then I'm sure I'm not the only one testing it. The official launch date for 12.1.2 is 31st July, even though you can download it now, so hopefully there will be some official news then.

     

    JK

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points