Class SynergyUtil

java.lang.Object
org.apache.maven.scm.provider.synergy.util.SynergyUtil

public final class SynergyUtil extends Object
This class contains functional methods for Synergy.
  • Field Details

  • Constructor Details

    • SynergyUtil

      private SynergyUtil()
  • Method Details

    • removePrefix

      public static String removePrefix(File prefix, File file) throws ScmException
      Remove prefix path from a path. Example: removeParent("c:\tmp", "c:\tmp\foo.bar") returns "foo.bar"
      Parameters:
      prefix - parent path (prefix).
      file - file path.
      Returns:
      suffix
      Throws:
      ScmException - if parent is not a prefix of file
    • getWorkingProject

      public static String getWorkingProject(ScmLogger logger, String projectSpec, String username, String ccmAddr) throws ScmException
      Get a working project whose predecessor is given.
      Parameters:
      logger - a logger.
      projectSpec - predecessor (prep project)
      username - owner of working project
      ccmAddr - Synergy session ID.
      Returns:
      projectSpec of the working checkout, or null if none
      Throws:
      ScmException
    • getWorkingFiles

      public static List<String> getWorkingFiles(ScmLogger logger, String projectSpec, String release, String ccmAddr) throws ScmException
      Get working file(s) in a given project.
      Parameters:
      logger - a logger.
      projectSpec - (project)
      release - release
      ccmAddr - Synergy session ID.
      Returns:
      list of working files.
      Throws:
      ScmException
    • getModifiedObjects

      public static List<ChangeFile> getModifiedObjects(ScmLogger logger, int numTask, String ccmAddr) throws ScmException
      Populate the object list of a Modification by querying for objects associated with the task.
      Parameters:
      logger - a logger.
      numTask - task number.
      ccmAddr - Synergy session ID.
      Throws:
      ScmException
    • getCompletedTasks

      public static List<SynergyTask> getCompletedTasks(ScmLogger logger, String projectSpec, Date startDate, Date endDate, String ccmAddr) throws ScmException
      Get a list of all tasks which are contained in all folders in the reconfigure properties of the specified project and were completed after startDate and before endDate.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec.
      startDate - start date.
      endDate - end date.
      ccmAddr - Synergy session ID.
      Returns:
      A list of SynergyTask
      Throws:
      ScmException
    • createBaseline

      public static void createBaseline(ScmLogger logger, String projectSpec, String name, String release, String purpose, String ccmAddr) throws ScmException
      Create a baseline.
      Parameters:
      logger - a logger.
      projectSpec - the projectSpec.
      name - name of the baseline.
      release - the release.
      purpose - the purpose.
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • create

      public static void create(ScmLogger logger, File file, String message, String ccmAddr) throws ScmException
      Add new file to Synergy database.
      Parameters:
      logger - a logger.
      file - file to be added.
      message - log message for Synergy.
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • createTask

      public static int createTask(ScmLogger logger, String synopsis, String release, boolean defaultTask, String ccmAddr) throws ScmException
      Create new task.
      Parameters:
      logger - a logger.
      synopsis - short description of task.
      release - release.
      defaultTask - should this task become the default task?
      ccmAddr - used to run in multi-session.
      Returns:
      Task number
      Throws:
      ScmException
    • checkinDefaultTask

      public static void checkinDefaultTask(ScmLogger logger, String comment, String ccmAddr) throws ScmException
      Checkin the default task.
      Parameters:
      logger - a logger.
      comment - a comment.
      ccmAddr - Synergy session ID.
      Throws:
      ScmException
    • checkinTask

      public static void checkinTask(ScmLogger logger, int taskNumber, String comment, String ccmAddr) throws ScmException
      Checkin a task.
      Parameters:
      logger - a logger.
      taskNumber - task number.
      comment - a comment.
      ccmAddr - Synergy session ID.
      Throws:
      ScmException
    • delete

      public static void delete(ScmLogger logger, File file, String ccmAddr, boolean replace) throws ScmException
      Delete file from Synergy database.
      Parameters:
      logger - a logger.
      file - file to be deleted.
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • reconfigure

      public static void reconfigure(ScmLogger logger, String projectSpec, String ccmAddr) throws ScmException
      Reconfigure a project.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • reconfigureProperties

      public static void reconfigureProperties(ScmLogger logger, String projectSpec, String ccmAddr) throws ScmException
      Reconfigure properties of a project.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • reconcileUwa

      public static void reconcileUwa(ScmLogger logger, String projectSpec, String ccmAddr) throws ScmException
      Reconcile a project with -uwa option.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • reconcileUdb

      public static void reconcileUdb(ScmLogger logger, String projectSpec, String ccmAddr) throws ScmException
      Reconcile a project with -udb option.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • checkoutFiles

      public static void checkoutFiles(ScmLogger logger, List<File> files, String ccmAddr) throws ScmException
      Checkout given files or directory.
      Parameters:
      logger - a logger.
      files - files to add.
      ccmAddr - Synergy session ID.
      Throws:
      ScmException
    • checkoutProject

      public static void checkoutProject(ScmLogger logger, File directory, String projectSpec, ScmVersion version, String purpose, String release, String ccmAddr) throws ScmException
      Checkout a given project.
      Parameters:
      logger - a logger.
      directory - new project work area, or null if you want to use default wa.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • checkinProject

      public static void checkinProject(ScmLogger logger, String projectSpec, String comment, String ccmAddr) throws ScmException
      Checkin a given project.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      comment - message.
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • checkinFiles

      public static void checkinFiles(ScmLogger logger, List<File> files, String comment, String ccmAddr) throws ScmException
      Checkin a file set.
      Parameters:
      logger - a logger.
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • getDefaultTask

      public static int getDefaultTask(ScmLogger logger, String ccmAddr) throws ScmException
      Get the number of the current (ie default) task.
      Parameters:
      logger - a logger.
      ccmAddr - current Synergy session id.
      Returns:
      the number of the current (ie default) task. 0 if current task is not set.
      Throws:
      ScmException
    • setDefaultTask

      public static void setDefaultTask(ScmLogger logger, int task, String ccmAddr) throws ScmException
      Set the current (ie default) task.
      Parameters:
      logger - a logger.
      task - the number of the task to set as current task.
      ccmAddr - current Synergy session id.
      Throws:
      ScmException
    • synchronize

      public static void synchronize(ScmLogger logger, String projectSpec, String ccmAddr) throws ScmException
      Synchronize a given project.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • getWorkArea

      public static File getWorkArea(ScmLogger logger, String projectSpec, String ccmAddr) throws ScmException
      Get the work area of a given project.
      Parameters:
      logger - a logger.
      projectSpec - projectSpec (i.e. myProject~1).
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • stop

      public static void stop(ScmLogger logger, String ccmAddr) throws ScmException
      Stop a ccm session.
      Parameters:
      logger - a logger.
      ccmAddr - used to run in multi-session.
      Throws:
      ScmException
    • start

      public static String start(ScmLogger logger, String username, String password, SynergyRole role) throws ScmException
      Start a session Synergy
      Parameters:
      logger - a logger.
      username - username.
      password - password.
      role - role or null if none.
      Returns:
      ccmAddr value to use with this session.
      Throws:
      ScmException
    • delimiter

      public static String delimiter(ScmLogger logger, String ccmAddr) throws ScmException
      Get Database delimiter
      Parameters:
      logger - a logger.
      ccmAddr - Synergy session ID.
      Returns:
      delimiter of the database (i.e. ~).
      Throws:
      ScmException
    • executeSynergyCommand

      protected static int executeSynergyCommand(ScmLogger logger, org.codehaus.plexus.util.cli.Commandline cl, org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer stderr, org.codehaus.plexus.util.cli.StreamConsumer stdout, boolean failOnError) throws ScmException
      Execute a command line for Synergy.
      Parameters:
      logger - a logger.
      cl - command line.
      stderr - stderr.
      stdout - stdout.
      failOnError - should we raise an exception when exit code != 0
      Returns:
      exit code.
      Throws:
      ScmException - on error or if exit code != 0 and failOnError = true