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

## Class SynergyUtil

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

    public final class SynergyUtil
    extends java.lang.Object

This class contains functional methods for Synergy.

Author:
  Julien Henry, Olivier Lamy

### Field Summary

Fields
`static java.lang.String` `SEPARATOR` Separator used with formatted result

### Method Summary

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

Separator used with formatted result

See Also:
  Constant Field Values

### Method Detail

#### removePrefix

    public static java.lang.String removePrefix​(java.io.File prefix,
                                                java.io.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 java.lang.String getWorkingProject​(ScmLogger logger,
                                                     java.lang.String projectSpec,
                                                     java.lang.String username,
                                                     java.lang.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 java.util.List<java.lang.String> getWorkingFiles​(ScmLogger logger,
                                                                   java.lang.String projectSpec,
                                                                   java.lang.String release,
                                                                   java.lang.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 java.util.List<ChangeFile> getModifiedObjects​(ScmLogger logger,
                                                                int numTask,
                                                                java.lang.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 java.util.List<SynergyTask> getCompletedTasks​(ScmLogger logger,
                                                                java.lang.String projectSpec,
                                                                java.util.Date startDate,
                                                                java.util.Date endDate,
                                                                java.lang.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,
                                      java.lang.String projectSpec,
                                      java.lang.String name,
                                      java.lang.String release,
                                      java.lang.String purpose,
                                      java.lang.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,
                              java.io.File file,
                              java.lang.String message,
                              java.lang.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,
                                 java.lang.String synopsis,
                                 java.lang.String release,
                                 boolean defaultTask,
                                 java.lang.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,
                                          java.lang.String comment,
                                          java.lang.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,
                                   java.lang.String comment,
                                   java.lang.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,
                              java.io.File file,
                              java.lang.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,
                                   java.lang.String projectSpec,
                                   java.lang.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,
                                             java.lang.String projectSpec,
                                             java.lang.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,
                                    java.lang.String projectSpec,
                                    java.lang.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,
                                    java.lang.String projectSpec,
                                    java.lang.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,
                                     java.util.List<java.io.File> files,
                                     java.lang.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,
                                       java.io.File directory,
                                       java.lang.String projectSpec,
                                       ScmVersion version,
                                       java.lang.String purpose,
                                       java.lang.String release,
                                       java.lang.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,
                                      java.lang.String projectSpec,
                                      java.lang.String comment,
                                      java.lang.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,
                                    java.util.List<java.io.File> files,
                                    java.lang.String comment,
                                    java.lang.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,
                                     java.lang.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,
                                      java.lang.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,
                                   java.lang.String projectSpec,
                                   java.lang.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 java.io.File getWorkArea​(ScmLogger logger,
                                           java.lang.String projectSpec,
                                           java.lang.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,
                            java.lang.String ccmAddr)
                     throws ScmException

Stop a ccm session.

Parameters:
  `logger` - a logger.
  `ccmAddr` - used to run in multi-session.
Throws:
  `ScmException`

#### start

    public static java.lang.String start​(ScmLogger logger,
                                         java.lang.String username,
                                         java.lang.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 java.lang.String delimiter​(ScmLogger logger,
                                             java.lang.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