One-Way Sync

Table of Contents

1. Intro

The One-Way Sync Tool allows files on your Design Cloud to be synchronized to the local filesystem. It only pulls changes from the Resource Server and updates the local filesystem. Changes that are made to the local filesystem will be overwritten and are not synchronized to your Design Cloud.

All local changes to synchronized directories are reverted. All existing files in the local directory will be deleted (if they don’t exist in the remote folder).

2. Configuration

Each remote folder that is being synchronized, needs to be configured. Depending on the run-mode, these properties need to be set differently. See Modes for more details.

The following properties need to be set:

  • Server base-path: The public address of the remote Design Cloud Resource Server (which hosts the resources that you want to synchronize). E.g.: https://resource-app-eu1.scripturaengage.com

  • Client ID: The client-id of the user that needs to be used to download the resources from the Resource Server.

  • Client secret: The secret associated with the client-id as specified in client-id.

  • Remote idr: The URL with protocol idr that specifies which remote folder should be synchronized. E.g.: idr://inventive-designers/draft/

  • Local directory: The local directory where resources are synchronized to. This directory (and any of its parent directories) is created if it doesn’t exist yet. E.g.: C:\sync\draft

3. Modes

The One-Way Sync Tool can run in different modes:

  • Embedded in the Server

  • As a standalone process

  • Embedded in your own java-application

3.1. Embedded in the Server

Since the synchronized files are mostly templates (and their artefacts), the One-Way sync tool can run in the Server. This makes them available for output generation (e.g. deployed Document Flows).

In the configuration of the Server, you can specify which folders need to be synchronized.

Sample configuration
<config>
    <server>
        <resources>
            <sync>
                <channel1>
                    <server-basepath type="value">https://resource-app-eu1.scripturaengage.com</server-basepath>
                    <client-id type="value">adO-DkNfDZF64uhG42jK</client-id>
                    <client-secret encryption="aes" type="value">AAAAAAAAABAzQ1F6NEFmODR4SjBGMVdXjZ.../HichjFfr8J</client-secret>
                    <remote-idr type="value">idr://inventive-designers/draft/</remote-idr>
                    <local-directory type="value">/sync/draft</local-directory>
                </channel1>
                <channel2>
                    ...
                </channel2>
            </sync>
        </resources>
    </server>
</config>

Add a fragment for each channel (i.e. each directory that you want to synchronize). Choose a name for the fragment-element (like channel1 and channel2). See Configuration for a description of the properties.

3.2. Standalone Process

The One-Way Sync Tool can also run as a separate java process. Download the JAR (java archive) from the website: https://www.inventivedesigners.com/private/scriptura

Start the application

java -jar one-way-sync-standalone-release-18.04-201804301553.jar

Properties are read from sync-properties.xml in the current directory. If you want to use a different file, pass it as an argument.

java -jar one-way-sync-standalone-release-18.04-201804301553.jar ../myprops.xml

Sample configuration
<sync>
    <channel>
        <server-basepath>https://resource-app-eu1.scripturaengage.com</server-basepath>
        <client-id>adO-DkNfDZF64uhG42jK</client-id>
        <client-secret>diroRqes3UT7Xycqtt1ETt_OdVeGXmahv-ms3UT7</client-secret>
        <remote-idr>idr://inventive-designers/draft/</remote-idr>
        <local-directory>/sync/draft</local-directory>
    </channel>
    <channel>
        ...
    </channel>
</sync>

Add a channel-fragment for each directory that you want to synchronize. See Configuration for a description of the properties.

Type Ctrl-C to stop this process.

3.3. Embedded in a java application

Place the standalone JAR (see Standalone Process) on the classpath of your application. For each folder that you want to synchronize, call:

SyncStarter.startSync(
    Path localDirectory,
    String remoteIDRPath,
    String serverBasePath,
    String clientID,
    String clientSecret
)

The class SyncStarter is located in package com.id.resource.sync.oneway. The function returns an instance of class SyncStarter. When synchronization should stop, call stopSync();.

The JAR file contains some libraries (like slf4j, log4j, mapdb and jackson). If you already have these dependencies in your own application, you can choose to copy the plugin com.id.resource.sync.oneway_4.500.0.201803121320.jar (the version number will be different) from a Scriptura Engage installation or update site. This is not guaranteed to work, however. The One-Way Sync tool is only tested with the shipped version of its dependencies.

Comments or suggestions?
Tell us here.

If you have any suggestions or comments about this guide, please send us an email using this form.