Interface ReplicationPathTransformer


  • public interface ReplicationPathTransformer
    Transforms the replication path for the replication request. It provides a hook, while building and importing replication content package, that can map a given replication path (i.e. /content/dam/skiing/images/Banner.JPG) to new target replication path (i.e. /content/dam/campaigns/skiing/images/Banner.JPG) This can be used when you need to replicate between system where path hierarchies on one system do not exactly match to path hierarchies on other system. Please note that it only allows for one-to-one mapping between source and target for a replication request. Implementations can choose using accepts(javax.jcr.Session, ReplicationAction, Agent), whether to map/transform given replication path in the context of the current replication request.
    • Method Detail

      • transform

        java.lang.String transform​(Session session,
                                   java.lang.String replicationPath,
                                   ReplicationAction action,
                                   Agent agent)
        Transforms the replication path. Should return the same replicationPath in case of error or if it can not be transform. i.e. an implementation map a given replication path (i.e. /content/dam/skiing/images/Banner.JPG) to new target replication path (i.e. /content/dam/campaigns/skiing/images/Banner.JPG) or vice versa, depending on the current replication context i.e. replication vs reverse replication Implementations can choose using accepts(javax.jcr.Session, ReplicationAction, Agent), whether to map/transform given replication path in the context of the current replication request. Replication Agent agent and Replication Action action is also available, based on the context in which the transform is called. i.e. in case of reverse replication, agent will not be null. So based on agent, transform method implementation may choose to do reverse mapping by identifying that it is a reverse replication.
        Parameters:
        session - jcr session
        replicationPath - replication path that needs to be transformed
        action - replication action if available
        agent - replication agent if available in the current context. i.e. Replication agent is not available while importing a replication content package.
        Returns:
        the transformed path
      • accepts

        boolean accepts​(Session session,
                        ReplicationAction action,
                        Agent agent)
        Returns true if Transformer can transform replication path for given replication request. This allows implementation to choose which requests to intercept i.e. replicate request in case of reverse replication, would have the Agent, so the implementation can check if it is the agent that implementation is interested in. Or using Session, implementation can look at the current user context and decide whether a transformation is needed or not.
        Parameters:
        session - jcr session
        action - replication action if available
        agent - replication agent if available in the current context. i.e. Replication agent is not available while importing a replication content package.
        Returns:
        true if it can transform false if it can not transform