Package org.wso2.carbon.deployment.synchronizer

## Class DeploymentSynchronizationManager

- java.lang.Object
- - org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizationManager

-     public final class DeploymentSynchronizationManager
      extends Object

  This class is responsible for creating DeploymentSynchronizer instances as and when necessary and keeping track of them for management purposes. It also provides a base framework for scheduling automatic repository synchronization tasks.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DeploymentSynchronizer` | `createSynchronizer​(int tenantId, ArtifactRepository artifactRepository, String filePath)` | Creates a new DeploymentSynchronizer instance using the provided parameters.
    `DeploymentSynchronizer` | `deleteSynchronizer​(int tenantId)` |
    `DeploymentSynchronizer` | `deleteSynchronizer​(String filePath)` | Deletes the DeploymentSynchronizer for the specified file path.
    `static DeploymentSynchronizationManager` | `getInstance()` |
    `DeploymentSynchronizer` | `getSynchronizer​(int tenantId)` |
    `DeploymentSynchronizer` | `getSynchronizer​(String filePath)` |
    `Map<String,​DeploymentSynchronizer>` | `getSynchronizers()` |
    `void` | `init​(org.wso2.carbon.base.ServerConfiguration serverConfig)` | Initialize the RepositoryManager instance.
    `void` | `shutdown()` | Cleanup and shutdown the RepositoryManager instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static DeploymentSynchronizationManager getInstance()

    - #### init

          public void init​(org.wso2.carbon.base.ServerConfiguration serverConfig)

      Initialize the RepositoryManager instance. The RepositoryManager must be initialized by calling this method, before synchronizers can use it to schedule tasks.
      Parameters:
        `serverConfig` - Active Carbon ServerConfiguration

    - #### shutdown

          public void shutdown()

      Cleanup and shutdown the RepositoryManager instance. This method will also gracefully destroy all the created synchronizers, cancel any existing scheduled tasks and then free up any additional resources.

    - #### createSynchronizer

          public DeploymentSynchronizer createSynchronizer​(int tenantId,
                                                           ArtifactRepository artifactRepository,
                                                           String filePath)

      Creates a new DeploymentSynchronizer instance using the provided parameters. A given file path may only have one DeploymentSynchronizer engaged on it. Any attempts to create multiple DeploymentSynchronizer instances on the same file path will result in an IllegalStateException. This method only creates DeploymentSynchronizer instances. The caller should take action to customize and further initialize the repository as required.
      Parameters:
        `artifactRepository` - ArtifactRepository representing the remote repository
        `filePath` - File path in the local file system
      Returns:
        a DeploymentSynchronizer instance

    - #### getSynchronizer

          public DeploymentSynchronizer getSynchronizer​(String filePath)

    - #### getSynchronizer

          public DeploymentSynchronizer getSynchronizer​(int tenantId)

    - #### getSynchronizers

          public Map<String,​DeploymentSynchronizer> getSynchronizers()

    - #### deleteSynchronizer

          public DeploymentSynchronizer deleteSynchronizer​(String filePath)

      Deletes the DeploymentSynchronizer for the specified file path. This will simply remove the repository from the control of the DeploymentSynchronizationManager. Any tasks spawned by the synchronizer will continue to run until the synchronizer is properly stopped.
      Parameters:
        `filePath` - File path on which the repository is created
      Returns:
        A RegistryBasedRepository or null

    - #### deleteSynchronizer

          public DeploymentSynchronizer deleteSynchronizer​(int tenantId)