This article covers a Bloomreach Experience Manager version 11. There's an updated version available that covers our most recent release.

Enabling Your Plugin For Replication

The core replication engine is capable of replicating documents, assets, and images under /content, and of replicating HST configuration. If you have a plugin that defines its own content model you may need to extend the replication engine. An example of an addon that does this is the Relevance Module.

Such a plugin must a) implement a component that tells replication about its model's units of replication, i.e. which nodes should be replicated atomically, and b) configure an additional content root if needed.

You may optionally implement the PropertyFilter interface to filter out properties that should not be replicated.

ReplicationScopeProvider

To let the replication engine know about your plugin's content model you implement a ReplicationScopeProvider.

/**
 * Extension point that allows the replication engine to know how to deal with the content model of
 * a given sub system.
 */
public interface ReplicationScopeProvider {

    /**
     * Maps the given {@code node} to a {@link ReplicationScope}. This lets the engine
     * know whether to treat the node as the root of a unit of replication (ReplicationScope.REPLICABLE),
     * to include it within the scope of the an ancestor unit of replication (ReplicationScope.NONE),
     * to exclude it from replication (ReplicationScope.EXCLUDED), or to ignore it (ReplicationScope.IGNORED).
     * <p>
     * This method should return {@code null} if this provider does not know about the node in question, in
     * order that another provider may be consulted.
     */
    ReplicationScope getReplicationScope(Node node) throws RepositoryException;

    /**
     * Whether the {@code event} in question could have had the effect that the node associated with
     * this event changed {@link ReplicationScope}.
     * For instance, a published variant has ReplicationScope.REPLICABLE when it is live, otherwise
     * it is ReplicationScope.EXCLUDED.
     * <p>
     * This method should return {@code null} if this provider does not know about the event in question, in
     * order that another provider may be consulted.
     */
    Boolean isReplicationScopeChangeEvent(final Event event, final Session session) throws RepositoryException;


}

When changes are processed on the source repository, the changed nodes are mapped to a unit of replication. This is done with the help of ReplicationScopeProviders. A node may be not be replicable at all, may be the root of a unit of replication, or may be a descendant of such a root. When an event is processed, the change log monitor checks with these providers to see if the node involved in the event should be replicated, and if so, which unit of replication is involved. When the time comes for the replication package to be created and sent to the target, the xml serializer needs to know which nodes to include and which nodes to exclude. For that task it also uses the ReplicationScopeProviders. Your component may additionally implement a PropertyFilter to prevent certain properties from being replicated.

Registering the provider

The provider must be registered with the replication engine. This is done by adding a node of type hipposys:moduleconfig with a property className containing the fully qualified classname as a child of /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata.

example_content_replication_provider.xml

<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="examplecontent" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hipposys:moduleconfig</sv:value>
  </sv:property>
  <sv:property sv:name="className" sv:type="String">
    <sv:value>com.example.replication.ExampleReplicationScopeProvider</sv:value>
  </sv:property>
</sv:node>

the corresponding initialize item:

  <sv:node sv:name="example_content_replication_provider">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>hippo:initializeitem</sv:value>
    </sv:property>
    <sv:property sv:name="hippo:contentresource" sv:type="String">
      <sv:value>example_content_replication_provider.xml</sv:value>
    </sv:property>
    <sv:property sv:name="hippo:contentroot" sv:type="String">
      <sv:value>/hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata</sv:value>
    </sv:property>
    <sv:property sv:name="hippo:sequence" sv:type="Double">
      <sv:value>8992.3</sv:value>
    </sv:property>
  </sv:node> 

Configure the replication root

For a certain node to be included, it not only needs to be mapped by a ReplicationScopeProvider, but its path must also be configured as mentioned on the replication configuration page. For instance, for the targeting addon, the path /targeting:targeting must be added to the includedpaths property of the /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata. To add such a value to that property, add something like the following initialise item to your hippoecm-extension.xml file:

  <sv:node sv:name="include_example_replication_path">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>hippo:initializeitem</sv:value>
    </sv:property>
    <sv:property sv:name="hippo:contentroot" sv:type="String">
      <sv:value>/hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/includedpaths</sv:value>
    </sv:property>
    <sv:property sv:name="hippo:contentpropadd" sv:type="String">
      <sv:value>/example</sv:value>
    </sv:property>
    <sv:property sv:name="hippo:sequence" sv:type="Double">
      <sv:value>8992.4</sv:value>
    </sv:property>
  </sv:node>

 

 

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?