org.apache.maven.scm.provider.integrity
Class Sandbox

java.lang.Object
  extended by org.apache.maven.scm.provider.integrity.Sandbox

public class Sandbox
extends Object

This class represents an MKS Integrity Sandbox and provides an encapsulation for executing typical Sandbox operations

Since:
1.6
Version:
$Id: Sandbox.java 1.11 2011/08/22 13:06:50EDT Cletus D'Souza (dsouza) Exp $
Author:
Cletus D'Souza

Field Summary
static SimpleDateFormat RLOG_DATEFORMAT
           
 
Constructor Summary
Sandbox(APISession api, Project cmProject, String dir)
          The Sandbox constructor
 
Method Summary
 List<ScmFile> addNonMembers(String exclude, String include, String message)
          Adds a list of files to the MKS Integrity SCM Project
 List<ScmFile> checkInUpdates(String message)
          Wrapper function to check-in all changes and drop members associated with missing working files
 boolean create()
          Creates a new Sandbox in the sandboxDir specified
 com.mks.api.response.Response createSubproject(String dirPath)
          Creates one subproject per directory, as required.
 com.mks.api.response.Response drop()
          Removes the registration for the Sandbox in the user's profile
static String formatFilePatterns(String pattern)
          Fixes the default includes/excludes patterns for compatibility with MKS Integrity's 'si viewnonmembers' command
 List<com.mks.api.response.WorkItem> getChangeList()
          Executes a 'si viewsandbox' and parses the output for changed or dropped working files
 ChangeLogSet getChangeLog(Date startDate, Date endDate)
          Executes the 'si rlog' command to generate a list of changed revision found between startDate and endDate
 List<ScmFile> getNewMembers(String exclude, String include)
          Executes a 'si viewnonmembers' command filtering the results using the exclude and include lists
 boolean getOverallAddSuccess()
          Returns the overall success of the add operation
 boolean getOverallCheckInSuccess()
          Returns the overall success of the check-in operation
 String getSandboxDir()
          Returns the full path name to the current Sandbox directory
 boolean hasWorkingFile(com.mks.api.response.Item wfdelta)
          Inspects the MKS API Response object's Item field to determine whether or nor a working file exists
 com.mks.api.response.Response lock(File memberFile, String relativeName)
          Executes a 'si lock' command using the relativeName of the file
 com.mks.api.response.Response makeWriteable()
          Executes a 'si makewritable' command to allow edits to all files in the Sandbox directory
 com.mks.api.response.Response resync()
          Resynchronizes an existing Sandbox Assumes that the create() call has already been made to validate this sandbox
 com.mks.api.response.Response revertMembers()
          Executes a 'si revert' command to roll back changes to all files in the Sandbox directory
 com.mks.api.response.Response unlock(File memberFile, String relativeName)
          Executes a 'si unlock' command using the relativeName of the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RLOG_DATEFORMAT

public static final SimpleDateFormat RLOG_DATEFORMAT
Constructor Detail

Sandbox

public Sandbox(APISession api,
               Project cmProject,
               String dir)
The Sandbox constructor

Parameters:
api - MKS API Session object
cmProject - Project object
dir - Absolute path to the location for the Sandbox directory
Method Detail

formatFilePatterns

public static String formatFilePatterns(String pattern)
Fixes the default includes/excludes patterns for compatibility with MKS Integrity's 'si viewnonmembers' command

Parameters:
pattern - String pattern representing the includes/excludes file/directory list

getSandboxDir

public String getSandboxDir()
Returns the full path name to the current Sandbox directory

Returns:

lock

public com.mks.api.response.Response lock(File memberFile,
                                          String relativeName)
                                   throws com.mks.api.response.APIException
Executes a 'si lock' command using the relativeName of the file

Parameters:
memberFile - Full path to the member's current sandbox location
relativeName - Relative path from the nearest subproject or project
Returns:
MKS API Response object
Throws:
com.mks.api.response.APIException

unlock

public com.mks.api.response.Response unlock(File memberFile,
                                            String relativeName)
                                     throws com.mks.api.response.APIException
Executes a 'si unlock' command using the relativeName of the file

Parameters:
memberFile - Full path to the member's current sandbox location
relativeName - Relative path from the nearest subproject or project
Returns:
MKS API Response object
Throws:
com.mks.api.response.APIException

drop

public com.mks.api.response.Response drop()
                                   throws com.mks.api.response.APIException
Removes the registration for the Sandbox in the user's profile

Returns:
The API Response associated with executing this command
Throws:
com.mks.api.response.APIException

create

public boolean create()
               throws com.mks.api.response.APIException
Creates a new Sandbox in the sandboxDir specified

Returns:
true if the operation is successful; false otherwise
Throws:
com.mks.api.response.APIException

resync

public com.mks.api.response.Response resync()
                                     throws com.mks.api.response.APIException
Resynchronizes an existing Sandbox Assumes that the create() call has already been made to validate this sandbox

Throws:
com.mks.api.response.APIException

makeWriteable

public com.mks.api.response.Response makeWriteable()
                                            throws com.mks.api.response.APIException
Executes a 'si makewritable' command to allow edits to all files in the Sandbox directory

Returns:
MKS API Response object
Throws:
com.mks.api.response.APIException

revertMembers

public com.mks.api.response.Response revertMembers()
                                            throws com.mks.api.response.APIException
Executes a 'si revert' command to roll back changes to all files in the Sandbox directory

Returns:
MKS API Response object
Throws:
com.mks.api.response.APIException

getNewMembers

public List<ScmFile> getNewMembers(String exclude,
                                   String include)
                            throws com.mks.api.response.APIException
Executes a 'si viewnonmembers' command filtering the results using the exclude and include lists

Parameters:
exclude - Pattern containing the exclude file list
include - Pattern containing the include file list
Returns:
List of ScmFile objects representing the new files in the Sandbox
Throws:
com.mks.api.response.APIException

addNonMembers

public List<ScmFile> addNonMembers(String exclude,
                                   String include,
                                   String message)
Adds a list of files to the MKS Integrity SCM Project

Parameters:
exclude - Pattern containing the exclude file list
include - Pattern containing the include file list
message - Description for the member's archive
Returns:

getOverallAddSuccess

public boolean getOverallAddSuccess()
Returns the overall success of the add operation

Returns:

hasWorkingFile

public boolean hasWorkingFile(com.mks.api.response.Item wfdelta)
Inspects the MKS API Response object's Item field to determine whether or nor a working file exists

Parameters:
wfdelta - MKS API Response object's Item representing the Working File Delta
Returns:

getChangeList

public List<com.mks.api.response.WorkItem> getChangeList()
                                                  throws com.mks.api.response.APIException
Executes a 'si viewsandbox' and parses the output for changed or dropped working files

Returns:
A list of MKS API Response WorkItem objects representing the changes in the Sandbox
Throws:
com.mks.api.response.APIException

checkInUpdates

public List<ScmFile> checkInUpdates(String message)
Wrapper function to check-in all changes and drop members associated with missing working files

Parameters:
message - Description for the changes
Returns:

getOverallCheckInSuccess

public boolean getOverallCheckInSuccess()
Returns the overall success of the check-in operation

Returns:

createSubproject

public com.mks.api.response.Response createSubproject(String dirPath)
                                               throws com.mks.api.response.APIException
Creates one subproject per directory, as required.

Parameters:
dirPath - A relative path structure of folders
Returns:
Response containing the result for the created subproject
Throws:
com.mks.api.response.APIException

getChangeLog

public ChangeLogSet getChangeLog(Date startDate,
                                 Date endDate)
                          throws com.mks.api.response.APIException
Executes the 'si rlog' command to generate a list of changed revision found between startDate and endDate

Parameters:
startDate - The date range for the beginning of the operation
endDate - The date range for the end of the operation
Returns:
ChangeLogSet containing a list of changes grouped by Change Pacakge ID
Throws:
com.mks.api.response.APIException


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.