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.- Author:
- Julien Henry, Olivier Lamy
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkinDefaultTask(ScmLogger logger, String comment, String ccmAddr)
Checkin the default task.static void
checkinFiles(ScmLogger logger, List<File> 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<File> 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 delimiterprotected 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<SynergyTask>
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 int
getDefaultTask(ScmLogger logger, String ccmAddr)
Get the number of the current (ie default) task.static List<ChangeFile>
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<String>
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 void
setDefaultTask(ScmLogger logger, int task, String ccmAddr)
Set the current (ie default) task.static String
start(ScmLogger logger, String username, String password, SynergyRole role)
Start a session Synergystatic void
stop(ScmLogger logger, String ccmAddr)
Stop a ccm session.static void
synchronize(ScmLogger logger, String projectSpec, String ccmAddr)
Synchronize a given project.
-
-
-
Field Detail
-
SEPARATOR
public static final String SEPARATOR
Separator used with formatted result- See Also:
- Constant Field Values
-
-
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 projectccmAddr
- 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
- releaseccmAddr
- 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
-
-