org.apache.maven.scm.provider.synergy.util

## Class SynergyUtil

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

    public class SynergyUtil
    extends Object

This class contains functional methodsfor Synergy.

Version:
  $Id: SynergyUtil.java 894254 2009-12-28 21:55:32Z olamy $
Author:
  Julien Henry

### Field Summary

Fields
`static String` `SEPARATOR` Separator used with formatted result

### Constructor Summary

Constructors
Constructor and Description
`SynergyUtil()`

### Method Summary

Methods
`static void` `checkinDefaultTask(ScmLogger logger, String comment, String ccmAddr)` Checkin the default task.
`static void` `checkinFiles(ScmLogger logger, List files, String comment, String ccmAddr)` Checkin a file set.
`static void` `checkinProject(ScmLogger logger, String projectSpec, String comment, String ccmAddr)` Checkin a given project.
`static void` `checkinTask(ScmLogger logger, int taskNumber, String comment, String ccmAddr)` Checkin a task.
`static void` `checkoutFiles(ScmLogger logger, List files, String ccmAddr)` Checkout given files or directory.
`static void` `checkoutProject(ScmLogger logger, File directory, String projectSpec, ScmVersion version, String purpose, String release, String ccmAddr)` Checkout a given project.
`static void` `create(ScmLogger logger, File file, String message, String ccmAddr)` Add new file to Synergy database.
`static void` `createBaseline(ScmLogger logger, String projectSpec, String name, String release, String purpose, String ccmAddr)` Create a baseline.
`static int` `createTask(ScmLogger logger, String synopsis, String release, boolean defaultTask, String ccmAddr)` Create new task.
`static void` `delete(ScmLogger logger, File file, String ccmAddr, boolean replace)` Delete file from Synergy database.
`static String` `delimiter(ScmLogger logger, String ccmAddr)` Get Database delimiter
`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)` Execute a command line for Synergy.
`static List` `getCompletedTasks(ScmLogger logger, String projectSpec, Date startDate, Date endDate, String ccmAddr)` 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.
`static List` `getModifiedObjects(ScmLogger logger, int numTask, String ccmAddr)` Populate the object list of a Modification by querying for objects associated with the task.
`static File` `getWorkArea(ScmLogger logger, String projectSpec, String ccmAddr)` Get the work area of a given project.
`static List` `getWorkingFiles(ScmLogger logger, String projectSpec, String release, String ccmAddr)` Get working file(s) in a given project.
`static String` `getWorkingProject(ScmLogger logger, String projectSpec, String username, String ccmAddr)` Get a working project whose predecessor is given.
`static void` `reconcileUdb(ScmLogger logger, String projectSpec, String ccmAddr)` Reconcile a project with -udb option.
`static void` `reconcileUwa(ScmLogger logger, String projectSpec, String ccmAddr)` Reconcile a project with -uwa option.
`static void` `reconfigure(ScmLogger logger, String projectSpec, String ccmAddr)` Reconfigure a project.
`static void` `reconfigureProperties(ScmLogger logger, String projectSpec, String ccmAddr)` Reconfigure properties of a project.
`static String` `removePrefix(File prefix, File file)` Remove prefix path from a path.
`static String` `start(ScmLogger logger, String username, String password, SynergyRole role)` Start a session Synergy
`static void` `stop(ScmLogger logger, String ccmAddr)` Stop a ccm session.
`static void` `synchronize(ScmLogger logger, String projectSpec, String ccmAddr)` Synchronize a given project.

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

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

### Field Detail

#### SEPARATOR

    public static final String SEPARATOR

Separator used with formatted result

See Also:
  Constant Field Values

### Constructor Detail

#### SynergyUtil

    public SynergyUtil()

### Method Detail

#### 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 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 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 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 `Task`
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 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 files,
                    String comment,
                    String ccmAddr)
                             throws ScmException

Checkin a file set.

Parameters:
  `logger` - a logger.
  `ccmAddr` - used to run in multi-session.
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