Access Keys:
Skip to content (Access Key - 0)

GTS


Programmatically Syncing With the Trust Fabric


SyncGTS provides a client API for programmatically syncing with the trust fabric. In this guide we will provide example code for syncing with the trust fabric programmatically.

Prerequisites


Create Sync Description File

SyncGTS is configured through an XML configuration file herein referred to as the Sync Description. The default Sync Description file can be found inSYNC_GTS_LOCATION/ext/resource/sync-description.xml. For most distributions, SyncGTS is pre-configured to work with the Grid in which it is being distributed for, therefore no further configuration is required. If you do need to make configuration changes to SyncGTS, in most cases you will only need to edit the gtsServiceURI, GTSIdentity, and ExcludedCAs elements. For comprehensive details on configuring SyncGTS click here.

Installing GTS Trust Roots

In order for SyncGTS to sync with a GTS service, it is required that the local environment trust the GTS service being synced with. In other words the local environment must trust the certificate authority that issued the GTS Service's credentials. Most distributions of SyncGTS are pre-configured to trust the GTS credentialing certificate authority for the Grid in which the distribution if configured for. If this is the case no further configuration is required. If this is not the case SyncGTS can easily be configured to trust other certificate authorities by placing a copy of the CA's certificate in the directory: SYNC_GTS_LOCATION/ext/resources/certificates. The CA certificate must be contained in PEM format and must be given a digit (0-9) extension. For example to configure SyncGTS to trust a CA whose certificate is contained in the file cacert.pem, the file should be rename to cacert.0 and copied to the directory: SYNC_GTS_LOCATION/ext/resources/certificates. In most cases you will also want to also add an entry to the excluded CA list in SyncGTS's configuration file. For more details on the SyncGTS configuration file click here.

Syncing With the Trust Fabric (Once)

The example code below syncs with the trust fabric once using a specified SyncDescription:

try{

      //Load Sync Description

      String pathToSyncDescription = "sync-description.xml";
      SyncDescription description = (SyncDescription) Utils.deserializeDocument(pathToSyncDescription,SyncDescription.class);

      //Sync with the Trust Fabric Once

      SyncGTS.getInstance().syncOnce(description);

     }catch (Exception e) {
	e.printStackTrace();
     }

Syncing With the Trust Fabric (Repeatedly)


The example code below syncs with the trust fabric repeatedly in the background using a specified SyncDescription:

try{

      //Load Sync Description

      String pathToSyncDescription = "sync-description.xml";
      SyncDescription description = (SyncDescription) Utils.deserializeDocument(pathToSyncDescription,SyncDescription.class);

      //Sync with the Trust Fabric Once

      SyncGTS.getInstance().syncAndResyncInBackground(description, false);

     }catch (Exception e) {
	e.printStackTrace();
     }
Last edited by
Sarah Honacki (1331 days ago)
Adaptavist Theme Builder Powered by Atlassian Confluence