Class DeploymentSynchronizer


  • public class DeploymentSynchronizer
    extends Object
    This class is responsible for maintaining a repository in the local file system in sync with a remote repository. The local repository could be an artifact repository used by Carbon, Axis2 or Synapse. In fact it could be any directory hierarchy in the local file system. The remote repository could be a registry instance, a version control system or an online data storage service. This implementation can commit the changes in the local file system to the remote repository, and checkout any updated artifacts from the repository to the local file system. Commit operations and checkout operations are synchronized so that both operations will never run at the same time. This implementation also supports triggering checkouts on events.
    • Method Detail

      • start

        public void start()
        Start this DeploymentSynchronizer instance. If the autoCommit and autoCheckout modes are not enabled, this method will do nothing. If such additional features are enabled, this method will schedule the necessary periodic tasks and get the auto-sync tasks up and running.
      • stop

        public void stop()
      • checkout

        public boolean checkout()
                         throws DeploymentSynchronizerException
        Checkout the artifacts stored in the repository to the file system. If the artifacts have already been checked out, an update will be executed instead.
        Throws:
        DeploymentSynchronizerException - If an error occurs while checking out or updating the resources
      • requestCheckout

        public void requestCheckout​(long timestamp)
        Notify the synchronizer that a checkout needs to be performed. This method is mainly used in conjunction with the eventing mode of operation. Once this method is invoked, synchronizer will set a flag to indicate that a checkout needs to be performed. During the next execution of the synchronizer task, the checkout will be performed and the flag will be unset.
        Parameters:
        timestamp - A timestamp corresponding to the time of the notification
      • setAutoCommit

        public void setAutoCommit​(boolean autoCommit)
      • setAutoCheckout

        public void setAutoCheckout​(boolean autoCheckout)
      • setPeriod

        public void setPeriod​(long period)
      • setUseEventing

        public void setUseEventing​(boolean useEventing)
      • isUseEventing

        public boolean isUseEventing()
      • isAutoCommit

        public boolean isAutoCommit()
      • isAutoCheckout

        public boolean isAutoCheckout()
      • getLastCheckoutTime

        public long getLastCheckoutTime()
      • getLastCommitTime

        public long getLastCommitTime()
      • sync

        public void sync()