Remote replication implementation details

NameComposum Platform Staging Servlet

Path/bin/cpm/platform/staging

SuffixPath to release root

Classcom.composum.sling.platform.staging.impl.PlatformStagingServlet
This servlet allows querying the state of the replication processes for a release root.

SelectorreplicationState Extensionjson MethodGET OperationReplication State

Retrieves the states of the ReleaseChangeProcess(es) for a release root. 

Examples

  • http://localhost:9090/bin/cpm/platform/staging.replicationState.json/content/composum/prototype/assets/pagesintegration
    In this example there are two remote replications configured at the paths given as id. The second one is enabled and was recently run (this data is not persistent). All timestamps are Unix timestamps in milliseconds.
    {
      "status": 200,
      "success": true,
      "warning": false,
      "data": {
        "replicationStates": {
          "/conf/content/composum/prototype/assets/pagesintegration/replication/launch2fullsite": {
            "id": "/conf/content/composum/prototype/assets/pagesintegration/rep  lication/launch2fullsite",
            "name": "2nd local server",
            "description": "Replication to a second local server at port 9100.",
            "state": "idle",
            "messages": [],
            "enabled": false
          },
          "/conf/content/composum/prototype/assets/pagesintegration/replication/localfullsite": {
            "id": "/conf/content/composum/prototype/assets/pagesintegration/replication/localfullsite",
            "name": "same server",
            "description": "For debugging - replication to the testserver itself at 9090 with a debugging root.",
            "state": "success",
            "startedAt": 1579260024881,
            "finishedAt": 1579260025129,
            "messages": [
              {
                "level": "info",
                "text": "Replication done for upd-CtAWlOiwBtjS",
                "timestamp": 1579260025129
              }
            ],
            "isSynchronized": true,
            "enabled": true,
            "lastReplicationTimestamp": 1579260025089
          }
        }
      }
    }

SelectoraggregatedReplicationState Extensionjson MethodGET OperationAggregated Replication State

Retrieves a short view of the states of the ReleaseChangeProcess(es) of a release root, that summarizes whether there are any running operations and whether there are any errors.

Examples

  • http://localhost:9090/bin/cpm/platform/staging.aggregatedReplicationState.json/content/composum/prototype/assets/pagesintegration
    "everythingIsSynchronized" means all remote repositories are at the same release change number. There are currently no replications running, and none of the replication processes show errors.
    {
      "status": 200,
      "success": true,
      "warning": false,
      "data": {
        "aggregatedReplicationState": {
          "result": {
            "everythingIsSynchronized": true,
            "replicationsAreRunning": false,
            "haveErrors": false,
            "numberEnabledProcesses": 1
          }
        }
      }
    }

SelectorcompareTree Extensionjson MethodPOST OperationCompare remote content

<p>Verifies whether the content of a remotely published site corresponds to the content of the release published there. The suffix is either a release root, in which case the whole release content is compared, or a path of a subtree within a release root.</p><p>It returns whether the release roots differ, and the number of new / updated / removed versionables, parent nodes and children orderings. Details are normally omitted - only given if the parameter "details" is true.</p>

Parameters

  • processId
    optional
    If given, we do the compare operation only for the release change process with the given id. Can be given multiple times.
  • details
    optional
    Numeric detail level. If 0, only difference counts are returned. If 1, the paths for the different nodes are returned, too. Normally these are not returned since there might be a large number of differences.

Examples

  • http://localhost:9090/bin/cpm/platform/staging.compareContent.json/content/composum/prototype/assets/pagesintegration?details=true

    Compares the content of the replicated release from /content/composum/prototype/assets/pagesintegration to the remote content. As requested with parameter details, the response gives full details, including the different paths.

    The node below compareTree is named as the ID of the replication configuration - if there are several, there can be several results.

    {
      "status": 200,
      "success": true,
      "warning": false,
      "data": {
        "compareTree": {
          "/conf/content/composum/prototype/assets/pagesintegration/replication/localfullsite": {
            "equal": false,
            "releaseChangeNumbersEqual": false,
            "differentVersionablesCount": 3,
            "changedParentNodeCount": 3,
            "changedChildrenOrderCount": 1,
            "differentVersionables": [
              "/content/composum/prototype/assets/pagesintegration/home/jcr:content",
              "/content/composum/prototype/assets/pagesintegration/home/noassets/jcr:content",
              "/content/composum/prototype/assets/pagesintegration/home/test/jcr:content"
            ],
            "changedParentNodes": [
              "/content/composum/prototype/assets/pagesintegration/home",
              "/content/composum/prototype/assets/pagesintegration/home/noassets",
              "/content/composum/prototype/assets/pagesintegration/meta/search"
            ],
            "changedChildrenOrders": [
              "/content/composum/prototype/assets/pagesintegration/home"
            ]
          }
        }
      }
    }

NameRemote replication receiver servlet

Path/bin/cpm/platform/replication/publishreceiver

Suffixa path into a site or a path to the site's top directory

Classcom.composum.sling.platform.staging.remote.RemotePublicationReceiverServlet
This servlet is active on the publisher host and is called from the author host to check the state of the content there and to transmit changed content.

Selectorcontentstate Extensionjson MethodGET OperationGet the content state

The servlet returns a JSON describing the versionables within the path within a site (or the path of the whole site) given as suffix.

Parameters

  • path
    required
    The path(s) for which we return information about the present versionables.

Examples

  • http://localhost:9100/bin/cpm/platform/replication/publishreceiver.contentstate.json?
    path=/content/composum/prototype/assets/pagesintegration/home

    Retrieves the versions of the versionables in the release as it is replicated at /content/composum/prototype/assets/pagesintegration/home .

    {
      "versionables": [
        {
          "path": "/content/composum/prototype/assets/pagesintegration/home/test/jcr:content",
          "version": "1f18eb90-f3ba-47c2-8307-f4ce93b1beb9"
        },
        {
          "path": "/content/composum/prototype/assets/pagesintegration/home/noassets/jcr:content",
          "version": "08146707-1bbf-45f8-ab61-7b04e58edb6f"
        }
      ],
      "status": 200, "success": true, "warning": false
    }

Selectorstartupdate Extensionjson MethodPOST OperationStart a content update

Creates a temporary directory to upload the content to and returns it's identifier. Returns the ID of the created directory, and the current value of the replication counter to doublecheck for concurrent modifications.

Parameters

  • releaseRoot
    required
    The root of the release containing the path.
  • srcPath
    optional

    Optionally, the path of the content that is actually replicated - can be releaseRoot or a subpath. Default: releasRoot.

  • targetPath
    optional

    Optionally, the path where the content below srcPath is placed - if different than srcPath this will imply reference transformation. Default: releaseRoot

Examples

  • http://localhost:9100/bin/cpm/platform/replication/publishreceiver.startupdate.json/content/composum/prototype/assets/pagesintegration/home

    A new temporary directory with the id upd-vicgwNl6NbG6 was created. The release change number and the timestamp of the last replication (Unix timestamp in milliseconds) of the synchronized content are also included.

    {
      "updateInfo": {
        "updateId": "upd-vicgwNl6NbG6",
        "originalPublisherReleaseChangeId": "chg9000483602364128923",
        "lastReplication": 1579260025089
      },
      "status": 200, "success": true,  "warning": false
    }

Selectorcomparecontent Extensionjson MethodPUT OperationCompare remote content

Receives information about the versionables present on the author server and compares the current content with it, returning differences. The suffix is a directory within the release root.

Parameters

  • updateid
    optional

    The update id returned by the startupdate operation.

Examples

  • http://localhost:9090/bin/cpm/platform/replication/publishreceiver.comparecontent.json/content/composum/prototype/assets/pagesintegration/home
    
    [
      {
        "path": "/content/composum/prototype/assets/pagesintegration/home/test/jcr:content",
        "version": "1f18eb90-f3ba-47c2-8307-f4ce93b1beb9"
      },
      {
        "path": "/content/composum/prototype/assets/pagesintegration/home/noassets/jcr:content",
        "version": "08146707-1bbf-45f8-ab61-7b04e58edb6f"
      }
    ]
    Returned are the paths that are different - either because they are not present correspond to a different version.
    {
      "status": 200,  "success": true,  "warning": false,
      "data": {
        "data": {
          "path": [
            "/content/composum/prototype/assets/pagesintegration/home/jcr:content"
          ]
        }
      }
    }

Selectorpathupload Extensionjson MethodPUT OperationUploads a package for one path

Uploads a part of the content that is to be updated as a content package. The suffix must be the path where it is to be written.

Parameters

  • updateid
    required
    The update id returned by the startupdate operation.
  • (request)
    required
    The request contains a content package containing the data from the path.

Examples

  • http://localhost:9090/bin/cpm/platform/replication/publishreceiver.pathupload.zip/content/composum/prototype/assets/pagesintegration/home/jcr:content?
    updateId=upd-MhGbZhJtuWGv

    Unpacks the package with one versionable which transmitted in the request input stream to the temporary directory identified by the updateId. The suffix is the path to the versionable.

    {"status":200,"success":true,"warning":false}

Selectorcommitupdate Extensionjson MethodPOST OperationFinishes and commits the content update

<p>Finishes the update of content: the content that was unpacked into the temporary directory is now moved to the real content directory, and the paths marked for deletion are deleted.</p><br><p>The content of the request is a JSON that contains a list of sibling orderings for various nodes in the tree which should be checked and corrected if necessary.</p>

Parameters

  • updateid
    required
    The update id created in the startreplacement operation.
  • deletedpath
    optional
    A path that is to be deleted from the content. Can occur multiple times.

Examples

  • http://localhost:9100/bin/cpm/platform/replication/publishreceiver.commitupdate.json
    
    {
      "updateId": "upd-MhGbZhJtuWGv",
      "releaseChangeNumber": "chg8900357471976124478",
      "deletedpath": [
        "/content/composum/prototype/assets/pagesintegration/home/jcr:content"
      ],
      "childOrderings": [
        {
          "path": "/content/composum/prototype/assets/pagesintegration",
          "childNames": [
            "releasedassets",
            "jcr:content",
            "home",
            "meta"
          ]
        },
        {
          "path": "/content/composum/prototype/assets/pagesintegration/home",
          "childNames": [
            "test",
            "noassets"
          ]
        }
      ]
    }
    The deletedpath(s) are deleted, the uploaded versionables are moved from the temporary directory into the release root and the child orderings are changed to the given child orderings: for each path with orderable children the childNames in their JCR order are transmitted.
    {"status":200,"success":true,"warning":false}

Selectorabortupdate Extensionjson MethodPOST OperationAbort the update

<p>Aborts the update and deletes the temporary directory.</p>

Parameters

  • updateid
    required
    The updateid created in the startupdate operation.

Examples

  • http://localhost:9100/bin/cpm/platform/replication/publishreceiver.abortupdate.json?
    updateId=upd-MhGbZhJtuWGv
    {"status":200,"success":true,"warning":false}

Selectorreleaseinfo Extensionjson MethodGET OperationGet information about release state

<p>Queries the release change number of a release and the last updated timestamp.</p><p>The suffix is the release root directory.</p>

Examples

  • https://localhost:9100/bin/cpm/platform/replication/publishreceiver.releaseinfo.json/content/composum/prototype/assets/pagesintegration

    The example says that the path /content/composum/prototype/assets/pagesintegration contains the release with the release change number chg9000483602364128923 , which was last replicated at Unix timestamp 1579260025089 (milliseconds).

    {
      "updateInfo": {
        "originalPublisherReleaseChangeId": "chg9000483602364128923",
        "lastReplication": 1579260025089
      },
      "status": 200,
      "success": true,
      "warning": false
    }