You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2011/08/27 14:39:22 UTC

svn commit: r1162334 [1/4] - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity: ./ src/main/java/org/apache/maven/scm/provider/integrity/ src/main/java/org/apache/maven/scm/provider/integrity/command/add/ src/main/java/org/apache/mav...

Author: olamy
Date: Sat Aug 27 12:39:21 2011
New Revision: 1162334

URL: http://svn.apache.org/viewvc?rev=1162334&view=rev
Log:
[SCM-630] Mks integrity scm
format all files and check license headers

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/pom.xml
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/APISession.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/IntegrityScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Member.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Project.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Sandbox.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/add/IntegrityAddCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameConsumer.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/edit/IntegrityEditCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/fileinfo/IntegrityFileInfoCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/list/IntegrityListCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/lock/IntegrityLockCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/login/IntegrityLoginCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/mkdir/IntegrityMkdirCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/remove/IntegrityRemoveCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/unlock/IntegrityUnlockCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepository.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/pom.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/pom.xml?rev=1162334&r1=1162333&r2=1162334&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/pom.xml (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/pom.xml Sat Aug 27 12:39:21 2011
@@ -1,85 +1,84 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>maven-scm-providers</artifactId>
-        <groupId>org.apache.maven.scm</groupId>
-        <version>1.6-SNAPSHOT</version>
-    </parent>
-    <artifactId>maven-scm-provider-integrity</artifactId>
-    <name>MKS Integrity CM - Maven Plugin</name>
-    <description>This Maven plugin provides SCM integration capabilities to MKS Integrity for Configuration Management
-    </description>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>maven-scm-providers</artifactId>
+    <groupId>org.apache.maven.scm</groupId>
+    <version>1.6-SNAPSHOT</version>
+  </parent>
+  <artifactId>maven-scm-provider-integrity</artifactId>
+  <name>MKS Integrity CM - Maven Plugin</name>
+  <description>SCM Provider implementation for MKS Integrity : http://mks.com/</description>
 
-    <developers>
-        <developer>
-            <id>cdsouza</id>
-            <name>Cletus D'Souza</name>
-            <email>dsouza@mks.com</email>
-        </developer>
-    </developers>
-    <dependencies>
-        <dependency>
-            <groupId>com.mks.api</groupId>
-            <artifactId>mksapi-jar</artifactId>
-            <version>4.10.9049</version>
-        </dependency>
-        <dependency>
+  <developers>
+    <developer>
+      <id>cdsouza</id>
+      <name>Cletus D'Souza</name>
+      <email>dsouza@mks.com</email>
+    </developer>
+  </developers>
+  <dependencies>
+    <dependency>
+      <groupId>com.mks.api</groupId>
+      <artifactId>mksapi-jar</artifactId>
+      <version>4.10.9049</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-manager-plexus</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy-all</artifactId>
+      <version>1.7.6</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>create-component-descriptor</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-scm-plugin</artifactId>
+        <version>1.5</version>
+        <configuration>
+          <excludes>
+            file:mksapi.log,dir:.metadata,dir:doc,dir:bin,dir:obj,dir:Debug,dir:Release,dir:.git,dir:target,dir:.settings
+          </excludes>
+          <tag>
+            ${env['JOB_NAME']}-${env['BUILD_NUMBER']}-${new java.text.SimpleDateFormat("yyyy_MM_dd").format(new Date())}
+          </tag>
+        </configuration>
+        <dependencies>
+          <dependency>
             <groupId>org.apache.maven.scm</groupId>
-            <artifactId>maven-scm-api</artifactId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven.scm</groupId>
-            <artifactId>maven-scm-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven.scm</groupId>
-            <artifactId>maven-scm-manager-plexus</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.groovy</groupId>
-            <artifactId>groovy-all</artifactId>
-            <version>1.7.6</version>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>create-component-descriptor</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>descriptor</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-scm-plugin</artifactId>
-                <version>1.5</version>
-                <configuration>
-                    <excludes>
-                        file:mksapi.log,dir:.metadata,dir:doc,dir:bin,dir:obj,dir:Debug,dir:Release,dir:.git,dir:target,dir:.settings
-                    </excludes>
-                    <tag>
-                        ${env['JOB_NAME']}-${env['BUILD_NUMBER']}-${new java.text.SimpleDateFormat("yyyy_MM_dd").format(new Date())}
-                    </tag>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.maven.scm</groupId>
-                        <artifactId>maven-scm-provider-integrity</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-        </plugins>
-    </build>
+            <artifactId>maven-scm-provider-integrity</artifactId>
+            <version>${project.version}</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
 </project>
\ No newline at end of file

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/APISession.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/APISession.java?rev=1162334&r1=1162333&r2=1162334&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/APISession.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/APISession.java Sat Aug 27 12:39:21 2011
@@ -18,235 +18,268 @@ package org.apache.maven.scm.provider.in
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 import com.mks.api.CmdRunner;
 import com.mks.api.Command;
 import com.mks.api.IntegrationPoint;
 import com.mks.api.IntegrationPointFactory;
+import com.mks.api.Session;
 import com.mks.api.response.APIException;
 import com.mks.api.response.Response;
-import com.mks.api.Session;
-import java.io.IOException;
-
 import org.apache.maven.scm.log.ScmLogger;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.io.IOException;
+
 /**
  * The APISession provides a wrapper for the MKS JAVA API
- * @version $Id: APISession.java 1.2 2011/08/22 13:06:44EDT Cletus D'Souza (dsouza) Exp  $
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: APISession.java 1.2 2011/08/22 13:06:44EDT Cletus D'Souza (dsouza) Exp  $
+ * @since 1.6
  */
 public class APISession
 {
-	// Store the API Version
-	public static final String VERSION = IntegrationPointFactory.getAPIVersion().substring(0, 
-											IntegrationPointFactory.getAPIVersion().indexOf(' '));
-	public static final int MAJOR_VERSION = Integer.parseInt(VERSION.substring(0, VERSION.indexOf('.')));	
-	public static final int MINOR_VERSION = Integer.parseInt(VERSION.substring(VERSION.indexOf('.')+1, VERSION.length()));
-	
-	// Logs all API work...
-	private ScmLogger logger;
-	
-	// Class variables used to create an API Session
-	private String hostName;
-	private int port = 0;
-	private String userName;
-	private String password;
-	
-	// API Specific Objects
-	private IntegrationPoint ip;
-	private Session session;
-	private boolean terminated;
-	
-	/**
-	 * Constructor for the API Session Object
-	 * Needs an ScmLogger to log all API operations
-	 * @param logger
-	 */
-	public APISession(ScmLogger logger)
-	{
-		logger.info("MKS Integrity API Version: " + VERSION);
-		this.logger = logger;
-	}
-	
-	/**
-	 * Establishes a connection with the MKS Integrity Server
-	 * @param host Hostname or IP address for the MKS Integrity Server
-	 * @param portNum Port number for the MKS Integrity Server
-	 * @param user Username to connect to the MKS Integrity Server
-	 * @param paswd Password for the User connecting to the server
-	 * @throws APIException
-	 */
-	public Response connect(String host, int portNum, String user, String paswd) throws APIException
-	{
-		// Initialize our termination flag...
-		terminated = false;
-		// Create a local integration point
-		ip = IntegrationPointFactory.getInstance().createLocalIntegrationPoint(MAJOR_VERSION, MINOR_VERSION);
-		// Set the flag to automatically start the MKS Integrity Client, if not running
-		ip.setAutoStartIntegrityClient(true);
-		// Use a common session, which means we don't have to manage the password
-		if( null != paswd && paswd.length() > 0 )
-		{
-			logger.info("Creating session for " + user + "/" + StringUtils.repeat("*", paswd.length()));
-			session = ip.createSession(user, paswd);
-		    logger.info("Attempting to establish connection using " + user + "@" + host + ":" + portNum);
-		}
-		else
-		{
-			logger.info("Using a common session.  Connection information is obtained from client preferences");
-			session = ip.getCommonSession();
-		}
-		// Test the connection to the MKS Integrity Server
-		Command ping = new Command(Command.SI, "connect");
-	    CmdRunner cmdRunner = session.createCmdRunner();
-	    // Initialize the command runner with valid connection information
-	    if( null != host && host.length() > 0 ){ cmdRunner.setDefaultHostname(host); }
-	    if( portNum > 0 ){ cmdRunner.setDefaultPort(portNum); }
-	    if( null != user && user.length() > 0 ){ cmdRunner.setDefaultUsername(user); }
-	    if( null != paswd && paswd.length() > 0 ){ cmdRunner.setDefaultPassword(paswd); }
-	    // Execute the connection
-		Response res = cmdRunner.execute(ping);
-		logger.debug(res.getCommandString() + " returned exit code " + res.getExitCode());
-		// Initialize class variables based on the connection information
-		hostName = res.getConnectionHostname();
-		port = res.getConnectionPort();
-		userName = res.getConnectionUsername();
-		password = paswd;
-		cmdRunner.release();
-		logger.info("Successfully established connection " + userName + "@" + hostName + ":" + port);
-		return res;
-	}
-	
-	/**
-	 * This function executes a generic API Command
-	 * @param cmd MKS API Command Object representing an API command
-	 * @return MKS API Response Object
-	 * @throws APIException
-	 */
-	public Response runCommand(Command cmd) throws APIException
-	{
-	    CmdRunner cmdRunner = session.createCmdRunner();
-	    cmdRunner.setDefaultHostname(hostName);
-	    cmdRunner.setDefaultPort(port);
-	    cmdRunner.setDefaultUsername(userName);
-	    if( null != password && password.length() > 0 )
-	    {
-	    	cmdRunner.setDefaultPassword(password);
-	    }
-	    Response res = cmdRunner.execute(cmd);
-	    logger.debug(res.getCommandString() + " returned exit code " + res.getExitCode());	    
-	    cmdRunner.release();
-	    return res;
-	}
-
-	/**
-	 * This function executes a generic API Command impersonating another user
-	 * @param cmd MKS API Command Object representing a API command
-	 * @param impersonateUser The user to impersonate
-	 * @return MKS API Response Object
-	 * @throws APIException
-	 */
-	public Response runCommandAs(Command cmd, String impersonateUser) throws APIException
-	{
-	    CmdRunner cmdRunner = session.createCmdRunner();
-	    cmdRunner.setDefaultHostname(hostName);
-	    cmdRunner.setDefaultPort(port);
-	    cmdRunner.setDefaultUsername(userName);
-	    if( null != password && password.length() > 0 )
-	    {
-	    	cmdRunner.setDefaultPassword(password);
-	    }
-	    cmdRunner.setDefaultImpersonationUser(impersonateUser);
-	    Response res = cmdRunner.execute(cmd);
-	    logger.debug(res.getCommandString() + " returned exit code " + res.getExitCode());
-	    cmdRunner.release();
-	    return res;
-	}
-	
-	/**
-	 * Terminate the API Session and Integration Point
-	 */
-	public void Terminate()
-	{
-		// Terminate only if not already terminated!
-		if( ! terminated )
-		{
-			try
-			{
-				if( null != session )
-				{
-					session.release();
-				}
-	
-				if( null != ip )
-				{
-					ip.release();
-				}
-				terminated = true;
-				logger.info("Successfully disconnected connection " + userName + "@" + hostName + ":" + port);
-			}
-			catch(APIException aex)
-			{
-			    logger.debug("Caught API Exception when releasing session!");
-			    aex.printStackTrace();
-			}
-			catch(IOException ioe)
-			{
-			    logger.debug("Caught IO Exception when releasing session!");
-			    ioe.printStackTrace();			
-			}
-		}
-	}
-	
-	/**
-	 * Returns the MKS Integrity Hostname for this APISession
-	 * @return
-	 */
-	public String getHostName() 
-	{
-		return hostName;
-	}
-
-	/**
-	 * Returns the MKS Integrity Port for this APISession
-	 * @return
-	 */
-	public int getPort()
-	{
-		return port;
-	}
-	
-	/**
-	 * Returns the MKS Integrity User for this APISession
-	 * @return
-	 */
-	public String getUserName()
-	{
-		return userName;
-	}
-	
-	/**
-	 * Returns the MKS Integrity Password for this APISession
-	 * @return
-	 */
-	public String getPassword()
-	{
-		if( null != password && password.length() > 0 )
-		{
-			return password;
-		}
-		else
-		{
-			return "";
-		}
-	}
-	
-	/**
-	 * Returns the ScmLogger for this APISession
-	 */
-	public ScmLogger getLogger()
-	{
-		return logger;
-	}
+    // Store the API Version
+    public static final String VERSION =
+        IntegrationPointFactory.getAPIVersion().substring( 0, IntegrationPointFactory.getAPIVersion().indexOf( ' ' ) );
+
+    public static final int MAJOR_VERSION = Integer.parseInt( VERSION.substring( 0, VERSION.indexOf( '.' ) ) );
+
+    public static final int MINOR_VERSION =
+        Integer.parseInt( VERSION.substring( VERSION.indexOf( '.' ) + 1, VERSION.length() ) );
+
+    // Logs all API work...
+    private ScmLogger logger;
+
+    // Class variables used to create an API Session
+    private String hostName;
+
+    private int port = 0;
+
+    private String userName;
+
+    private String password;
+
+    // API Specific Objects
+    private IntegrationPoint ip;
+
+    private Session session;
+
+    private boolean terminated;
+
+    /**
+     * Constructor for the API Session Object
+     * Needs an ScmLogger to log all API operations
+     *
+     * @param logger
+     */
+    public APISession( ScmLogger logger )
+    {
+        logger.info( "MKS Integrity API Version: " + VERSION );
+        this.logger = logger;
+    }
+
+    /**
+     * Establishes a connection with the MKS Integrity Server
+     *
+     * @param host    Hostname or IP address for the MKS Integrity Server
+     * @param portNum Port number for the MKS Integrity Server
+     * @param user    Username to connect to the MKS Integrity Server
+     * @param paswd   Password for the User connecting to the server
+     * @throws APIException
+     */
+    public Response connect( String host, int portNum, String user, String paswd )
+        throws APIException
+    {
+        // Initialize our termination flag...
+        terminated = false;
+        // Create a local integration point
+        ip = IntegrationPointFactory.getInstance().createLocalIntegrationPoint( MAJOR_VERSION, MINOR_VERSION );
+        // Set the flag to automatically start the MKS Integrity Client, if not running
+        ip.setAutoStartIntegrityClient( true );
+        // Use a common session, which means we don't have to manage the password
+        if ( null != paswd && paswd.length() > 0 )
+        {
+            logger.info( "Creating session for " + user + "/" + StringUtils.repeat( "*", paswd.length() ) );
+            session = ip.createSession( user, paswd );
+            logger.info( "Attempting to establish connection using " + user + "@" + host + ":" + portNum );
+        }
+        else
+        {
+            logger.info( "Using a common session.  Connection information is obtained from client preferences" );
+            session = ip.getCommonSession();
+        }
+        // Test the connection to the MKS Integrity Server
+        Command ping = new Command( Command.SI, "connect" );
+        CmdRunner cmdRunner = session.createCmdRunner();
+        // Initialize the command runner with valid connection information
+        if ( null != host && host.length() > 0 )
+        {
+            cmdRunner.setDefaultHostname( host );
+        }
+        if ( portNum > 0 )
+        {
+            cmdRunner.setDefaultPort( portNum );
+        }
+        if ( null != user && user.length() > 0 )
+        {
+            cmdRunner.setDefaultUsername( user );
+        }
+        if ( null != paswd && paswd.length() > 0 )
+        {
+            cmdRunner.setDefaultPassword( paswd );
+        }
+        // Execute the connection
+        Response res = cmdRunner.execute( ping );
+        logger.debug( res.getCommandString() + " returned exit code " + res.getExitCode() );
+        // Initialize class variables based on the connection information
+        hostName = res.getConnectionHostname();
+        port = res.getConnectionPort();
+        userName = res.getConnectionUsername();
+        password = paswd;
+        cmdRunner.release();
+        logger.info( "Successfully established connection " + userName + "@" + hostName + ":" + port );
+        return res;
+    }
+
+    /**
+     * This function executes a generic API Command
+     *
+     * @param cmd MKS API Command Object representing an API command
+     * @return MKS API Response Object
+     * @throws APIException
+     */
+    public Response runCommand( Command cmd )
+        throws APIException
+    {
+        CmdRunner cmdRunner = session.createCmdRunner();
+        cmdRunner.setDefaultHostname( hostName );
+        cmdRunner.setDefaultPort( port );
+        cmdRunner.setDefaultUsername( userName );
+        if ( null != password && password.length() > 0 )
+        {
+            cmdRunner.setDefaultPassword( password );
+        }
+        Response res = cmdRunner.execute( cmd );
+        logger.debug( res.getCommandString() + " returned exit code " + res.getExitCode() );
+        cmdRunner.release();
+        return res;
+    }
+
+    /**
+     * This function executes a generic API Command impersonating another user
+     *
+     * @param cmd             MKS API Command Object representing a API command
+     * @param impersonateUser The user to impersonate
+     * @return MKS API Response Object
+     * @throws APIException
+     */
+    public Response runCommandAs( Command cmd, String impersonateUser )
+        throws APIException
+    {
+        CmdRunner cmdRunner = session.createCmdRunner();
+        cmdRunner.setDefaultHostname( hostName );
+        cmdRunner.setDefaultPort( port );
+        cmdRunner.setDefaultUsername( userName );
+        if ( null != password && password.length() > 0 )
+        {
+            cmdRunner.setDefaultPassword( password );
+        }
+        cmdRunner.setDefaultImpersonationUser( impersonateUser );
+        Response res = cmdRunner.execute( cmd );
+        logger.debug( res.getCommandString() + " returned exit code " + res.getExitCode() );
+        cmdRunner.release();
+        return res;
+    }
+
+    /**
+     * Terminate the API Session and Integration Point
+     */
+    public void Terminate()
+    {
+        // Terminate only if not already terminated!
+        if ( !terminated )
+        {
+            try
+            {
+                if ( null != session )
+                {
+                    session.release();
+                }
+
+                if ( null != ip )
+                {
+                    ip.release();
+                }
+                terminated = true;
+                logger.info( "Successfully disconnected connection " + userName + "@" + hostName + ":" + port );
+            }
+            catch ( APIException aex )
+            {
+                logger.debug( "Caught API Exception when releasing session!" );
+                aex.printStackTrace();
+            }
+            catch ( IOException ioe )
+            {
+                logger.debug( "Caught IO Exception when releasing session!" );
+                ioe.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * Returns the MKS Integrity Hostname for this APISession
+     *
+     * @return
+     */
+    public String getHostName()
+    {
+        return hostName;
+    }
+
+    /**
+     * Returns the MKS Integrity Port for this APISession
+     *
+     * @return
+     */
+    public int getPort()
+    {
+        return port;
+    }
+
+    /**
+     * Returns the MKS Integrity User for this APISession
+     *
+     * @return
+     */
+    public String getUserName()
+    {
+        return userName;
+    }
+
+    /**
+     * Returns the MKS Integrity Password for this APISession
+     *
+     * @return
+     */
+    public String getPassword()
+    {
+        if ( null != password && password.length() > 0 )
+        {
+            return password;
+        }
+        else
+        {
+            return "";
+        }
+    }
+
+    /**
+     * Returns the ScmLogger for this APISession
+     */
+    public ScmLogger getLogger()
+    {
+        return logger;
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/IntegrityScmProvider.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/IntegrityScmProvider.java?rev=1162334&r1=1162333&r2=1162334&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/IntegrityScmProvider.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/IntegrityScmProvider.java Sat Aug 27 12:39:21 2011
@@ -69,315 +69,344 @@ import org.codehaus.plexus.util.StringUt
 
 /**
  * MKS Integrity SCM Provider for Maven
- * @version $Id: IntegrityScmProvider.java 1.7 2011/08/22 13:06:46EDT Cletus D'Souza (dsouza) Exp  $
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityScmProvider.java 1.7 2011/08/22 13:06:46EDT Cletus D'Souza (dsouza) Exp  $
  * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="integrity"
+ * @since 1.6
  */
-public class IntegrityScmProvider extends AbstractScmProvider
+public class IntegrityScmProvider
+    extends AbstractScmProvider
 {
-	public static final String INTEGRITY_CM_URL = "[[user][/pass]@host[:port]]|configPath";
-	
-	/**
-	 * Returns the name of our SCM Provider
-	 */
+    public static final String INTEGRITY_CM_URL = "[[user][/pass]@host[:port]]|configPath";
+
+    /**
+     * Returns the name of our SCM Provider
+     */
     public String getScmType()
     {
         return "integrity";
     }
-	
+
     /**
-     * This class is the central point of the SCM provider. The Maven-SCM framework will know only this class in the provider, 
+     * This class is the central point of the SCM provider. The Maven-SCM framework will know only this class in the provider,
      * so this class will validate the scm url, populate the IntegrityScmProviderRepository and provide all commands that we support.
+     *
      * @param scmSpecificUrl The SCM URL specific to our implementation for this plugin
-     * @param delimiter The character that separates the information above
+     * @param delimiter      The character that separates the information above
      * @throws ScmRepositoryException
      */
-    public ScmProviderRepository makeProviderScmRepository(String scmSpecificUrl, char delimiter) throws ScmRepositoryException
+    public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
+        throws ScmRepositoryException
     {
-    	// Initialize our variables need to create the IntegrityScmProvderRepository
-    	String hostName = "";
-    	int port = 0;
-    	String userName = "";
-    	String password = "";
-    	String configPath = "";
-    	
-    	// Looking for a string in the following format:
-    	//	[[user][/pass]@host[:port]]|configPath
-    	// Where '|' is the delimiter...
-    	String[] tokens = StringUtils.split(scmSpecificUrl, String.valueOf(delimiter));
-    	// Expecting a minimum of one token to a maximum of two tokens
-    	if( tokens.length < 1 || tokens.length > 2 )
-    	{
-    		 throw new ScmRepositoryException("Invalid SCM URL '" + scmSpecificUrl + "'.  Expecting a url using format: " + INTEGRITY_CM_URL);
-    	}
-    	else
-    	{
-    		// Inspect the first token to see if it contains connection information
-    		if( tokens[0].indexOf('@') >= 0 )
-    		{
-    			// First split up the username and password string from the host:port information
-    			String userPassStr = tokens[0].substring(0, tokens[0].indexOf('@'));
-    			getLogger().debug("User/Password information supplied: " + userPassStr);
-    			String hostPortStr = tokens[0].substring(tokens[0].indexOf('@')+1, tokens[0].length());
-    			getLogger().debug("Host/Port information supplied: " + hostPortStr);
-    			
-    			if( userPassStr.length() > 0 )
-    			{
-    				// Next, make sure the username and password are separated using a forward slash '/'
-    				int userPassDelimIndx = userPassStr.indexOf('/'); 
-    				if(  userPassDelimIndx > 0 )
-    				{
-    					userName = userPassStr.substring(0, userPassStr.indexOf('/'));
-    					if( userPassStr.length() > (userPassDelimIndx+1) )
-    					{
-    						password = userPassStr.substring(userPassStr.indexOf('/')+1, userPassStr.length());
-    					}
-    				}
-    				else
-    				{
-    					userName = userPassStr;
-    				}
-    			}
-    			// Now, check to see what we've got for the host:port information
-    			if( hostPortStr.length() > 0 )
-    			{
-    				int hostPortDelimIndx = hostPortStr.indexOf(':'); 
-    				if(  hostPortDelimIndx > 0 )
-    				{
-    					hostName = hostPortStr.substring(0, hostPortStr.indexOf(':'));
-    					if( hostPortStr.length() > (hostPortDelimIndx+1) )
-    					{
-    						port = Integer.parseInt(hostPortStr.substring(hostPortStr.indexOf(':')+1, hostPortStr.length()));
-    					}
-    				}
-    				else
-    				{
-    					hostName = hostPortStr;
-    				}
-    			}
-    		}
-    		// Grab the last token (or first token depends how you look at it)
-    		configPath = tokens[tokens.length-1];
-    	}
-    	
-        return new IntegrityScmProviderRepository(hostName, port, userName, password, configPath, getLogger());
+        // Initialize our variables need to create the IntegrityScmProvderRepository
+        String hostName = "";
+        int port = 0;
+        String userName = "";
+        String password = "";
+        String configPath = "";
+
+        // Looking for a string in the following format:
+        //	[[user][/pass]@host[:port]]|configPath
+        // Where '|' is the delimiter...
+        String[] tokens = StringUtils.split( scmSpecificUrl, String.valueOf( delimiter ) );
+        // Expecting a minimum of one token to a maximum of two tokens
+        if ( tokens.length < 1 || tokens.length > 2 )
+        {
+            throw new ScmRepositoryException(
+                "Invalid SCM URL '" + scmSpecificUrl + "'.  Expecting a url using format: " + INTEGRITY_CM_URL );
+        }
+        else
+        {
+            // Inspect the first token to see if it contains connection information
+            if ( tokens[0].indexOf( '@' ) >= 0 )
+            {
+                // First split up the username and password string from the host:port information
+                String userPassStr = tokens[0].substring( 0, tokens[0].indexOf( '@' ) );
+                getLogger().debug( "User/Password information supplied: " + userPassStr );
+                String hostPortStr = tokens[0].substring( tokens[0].indexOf( '@' ) + 1, tokens[0].length() );
+                getLogger().debug( "Host/Port information supplied: " + hostPortStr );
+
+                if ( userPassStr.length() > 0 )
+                {
+                    // Next, make sure the username and password are separated using a forward slash '/'
+                    int userPassDelimIndx = userPassStr.indexOf( '/' );
+                    if ( userPassDelimIndx > 0 )
+                    {
+                        userName = userPassStr.substring( 0, userPassStr.indexOf( '/' ) );
+                        if ( userPassStr.length() > ( userPassDelimIndx + 1 ) )
+                        {
+                            password = userPassStr.substring( userPassStr.indexOf( '/' ) + 1, userPassStr.length() );
+                        }
+                    }
+                    else
+                    {
+                        userName = userPassStr;
+                    }
+                }
+                // Now, check to see what we've got for the host:port information
+                if ( hostPortStr.length() > 0 )
+                {
+                    int hostPortDelimIndx = hostPortStr.indexOf( ':' );
+                    if ( hostPortDelimIndx > 0 )
+                    {
+                        hostName = hostPortStr.substring( 0, hostPortStr.indexOf( ':' ) );
+                        if ( hostPortStr.length() > ( hostPortDelimIndx + 1 ) )
+                        {
+                            port = Integer.parseInt(
+                                hostPortStr.substring( hostPortStr.indexOf( ':' ) + 1, hostPortStr.length() ) );
+                        }
+                    }
+                    else
+                    {
+                        hostName = hostPortStr;
+                    }
+                }
+            }
+            // Grab the last token (or first token depends how you look at it)
+            configPath = tokens[tokens.length - 1];
+        }
+
+        return new IntegrityScmProviderRepository( hostName, port, userName, password, configPath, getLogger() );
     }
 
     /**
      * Maps to si connect and initialization of the project with si projectinfo
      */
     @Override
-    protected LoginScmResult login(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected LoginScmResult login( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
         IntegrityLoginCommand command = new IntegrityLoginCommand();
-        command.setLogger(getLogger());
-        return (LoginScmResult) command.execute(repository, fileSet, params);
+        command.setLogger( getLogger() );
+        return (LoginScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si rlog --rfilter=daterange:date1-date2
      */
     @Override
-    protected ChangeLogScmResult changelog(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException
-    {
-    	IntegrityChangeLogCommand command = new IntegrityChangeLogCommand();
-    	command.setLogger(getLogger());
-    	return (ChangeLogScmResult) command.execute(repository, fileSet, parameters);
+    protected ChangeLogScmResult changelog( ScmProviderRepository repository, ScmFileSet fileSet,
+                                            CommandParameters parameters )
+        throws ScmException
+    {
+        IntegrityChangeLogCommand command = new IntegrityChangeLogCommand();
+        command.setLogger( getLogger() );
+        return (ChangeLogScmResult) command.execute( repository, fileSet, parameters );
     }
 
     /**
      * Maps to si viewnonmembers and then si add for every non-member
      */
     @Override
-    protected AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected AddScmResult add( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityAddCommand command = new IntegrityAddCommand();
-    	command.setLogger(getLogger());
-    	return (AddScmResult) command.execute(repository, fileSet, params);
+        IntegrityAddCommand command = new IntegrityAddCommand();
+        command.setLogger( getLogger() );
+        return (AddScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si dropsandbox
      */
     @Override
-    protected RemoveScmResult remove(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected RemoveScmResult remove( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityRemoveCommand command = new IntegrityRemoveCommand();
-    	command.setLogger(getLogger());
-    	return (RemoveScmResult) command.execute(repository, fileSet, params);
+        IntegrityRemoveCommand command = new IntegrityRemoveCommand();
+        command.setLogger( getLogger() );
+        return (RemoveScmResult) command.execute( repository, fileSet, params );
     }
 
-    
+
     /**
      * Maps to a si ci
      */
     @Override
-    protected CheckInScmResult checkin(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected CheckInScmResult checkin( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityCheckInCommand command = new IntegrityCheckInCommand();
-    	command.setLogger(getLogger());
-    	return (CheckInScmResult) command.execute(repository, fileSet, params);
+        IntegrityCheckInCommand command = new IntegrityCheckInCommand();
+        command.setLogger( getLogger() );
+        return (CheckInScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si createsandbox and/or si resync
      */
     @Override
-    protected CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
-    {
-    	IntegrityCheckOutCommand command = new IntegrityCheckOutCommand();
-    	command.setLogger(getLogger());
-    	return (CheckOutScmResult) command.execute(repository, fileSet, params);
+    protected CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
+                                          CommandParameters params )
+        throws ScmException
+    {
+        IntegrityCheckOutCommand command = new IntegrityCheckOutCommand();
+        command.setLogger( getLogger() );
+        return (CheckOutScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si diff
      */
     @Override
-    protected DiffScmResult diff(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected DiffScmResult diff( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityDiffCommand command = new IntegrityDiffCommand();
-    	command.setLogger(getLogger());
-    	return (DiffScmResult) command.execute(repository, fileSet, params);
+        IntegrityDiffCommand command = new IntegrityDiffCommand();
+        command.setLogger( getLogger() );
+        return (DiffScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si makewritable
      */
     @Override
-    protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected EditScmResult edit( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityEditCommand command = new IntegrityEditCommand();
-    	command.setLogger(getLogger());
-    	return (EditScmResult) command.execute(repository, fileSet, params);
+        IntegrityEditCommand command = new IntegrityEditCommand();
+        command.setLogger( getLogger() );
+        return (EditScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si viewsandbox with a filter of locally changed files
      */
     @Override
-    protected StatusScmResult status(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityStatusCommand command = new IntegrityStatusCommand();
-    	command.setLogger(getLogger());
-    	return (StatusScmResult) command.execute(repository, fileSet, params);
+        IntegrityStatusCommand command = new IntegrityStatusCommand();
+        command.setLogger( getLogger() );
+        return (StatusScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si checkpoint
      */
     @Override
-    protected TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityTagCommand command = new IntegrityTagCommand();
-    	command.setLogger(getLogger());
-    	return (TagScmResult) command.execute(repository, fileSet, params);
+        IntegrityTagCommand command = new IntegrityTagCommand();
+        command.setLogger( getLogger() );
+        return (TagScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si revert
      */
     @Override
-    protected UnEditScmResult unedit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected UnEditScmResult unedit( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityUnEditCommand command = new IntegrityUnEditCommand();
-    	command.setLogger(getLogger());
-    	return (UnEditScmResult) command.execute(repository, fileSet, params);
+        IntegrityUnEditCommand command = new IntegrityUnEditCommand();
+        command.setLogger( getLogger() );
+        return (UnEditScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si resync
      */
     @Override
-    protected UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityUpdateCommand command = new IntegrityUpdateCommand();
-    	command.setLogger(getLogger());
-    	return (UpdateScmResult) command.execute(repository, fileSet, params);
+        IntegrityUpdateCommand command = new IntegrityUpdateCommand();
+        command.setLogger( getLogger() );
+        return (UpdateScmResult) command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si annotate
      */
     @Override
-    protected BlameScmResult blame(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected BlameScmResult blame( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityBlameCommand command = new IntegrityBlameCommand();
-    	command.setLogger(getLogger());
-    	return (BlameScmResult) command.execute(repository, fileSet, params);
+        IntegrityBlameCommand command = new IntegrityBlameCommand();
+        command.setLogger( getLogger() );
+        return (BlameScmResult) command.execute( repository, fileSet, params );
     }
-    
+
     /**
      * Maps to si viewproject
      */
     @Override
-    protected ListScmResult list(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected ListScmResult list( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityListCommand command = new IntegrityListCommand();
-    	command.setLogger(getLogger());
-    	return (ListScmResult) command.execute(repository, fileSet, params);
+        IntegrityListCommand command = new IntegrityListCommand();
+        command.setLogger( getLogger() );
+        return (ListScmResult) command.execute( repository, fileSet, params );
     }
-    
+
     /**
      * Maps to si projectco (no sandbox is used)
      */
     @Override
-    protected ExportScmResult export(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected ExportScmResult export( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityExportCommand command = new IntegrityExportCommand();
-    	command.setLogger(getLogger());
-    	return (ExportScmResult) command.execute(repository, fileSet, params);
+        IntegrityExportCommand command = new IntegrityExportCommand();
+        command.setLogger( getLogger() );
+        return (ExportScmResult) command.execute( repository, fileSet, params );
     }
-    
+
     /**
      * Maps to si createdevpath
      */
     @Override
-    protected BranchScmResult branch(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected BranchScmResult branch( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityBranchCommand command = new IntegrityBranchCommand();
-    	command.setLogger(getLogger());
-    	return (BranchScmResult) command.execute(repository, fileSet, params);
+        IntegrityBranchCommand command = new IntegrityBranchCommand();
+        command.setLogger( getLogger() );
+        return (BranchScmResult) command.execute( repository, fileSet, params );
     }
-    
+
     /**
      * Maps to si createsubproject
      */
     @Override
-    protected MkdirScmResult mkdir(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected MkdirScmResult mkdir( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityMkdirCommand command = new IntegrityMkdirCommand();
-    	command.setLogger(getLogger());
-    	return (MkdirScmResult) command.execute(repository, fileSet, params);
+        IntegrityMkdirCommand command = new IntegrityMkdirCommand();
+        command.setLogger( getLogger() );
+        return (MkdirScmResult) command.execute( repository, fileSet, params );
     }
-    
+
     /**
      * Maps to si memberinfo
      */
-    protected ScmResult fileinfo(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected ScmResult fileinfo( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityFileInfoCommand command = new IntegrityFileInfoCommand();
-    	command.setLogger(getLogger());
-    	return command.execute(repository, fileSet, params);
+        IntegrityFileInfoCommand command = new IntegrityFileInfoCommand();
+        command.setLogger( getLogger() );
+        return command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si lock
      */
-    protected ScmResult lock(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected ScmResult lock( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityLockCommand command = new IntegrityLockCommand();
-    	command.setLogger(getLogger());
-    	return command.execute(repository, fileSet, params);
+        IntegrityLockCommand command = new IntegrityLockCommand();
+        command.setLogger( getLogger() );
+        return command.execute( repository, fileSet, params );
     }
 
     /**
      * Maps to si unlock
      */
-    protected ScmResult unlock(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException
+    protected ScmResult unlock( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params )
+        throws ScmException
     {
-    	IntegrityUnlockCommand command = new IntegrityUnlockCommand(params.getString(CommandParameter.FILE));
-    	command.setLogger(getLogger());
-    	return command.execute(repository, fileSet, params);
-    }    
+        IntegrityUnlockCommand command = new IntegrityUnlockCommand( params.getString( CommandParameter.FILE ) );
+        command.setLogger( getLogger() );
+        return command.execute( repository, fileSet, params );
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Member.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Member.java?rev=1162334&r1=1162333&r2=1162334&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Member.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/Member.java Sat Aug 27 12:39:21 2011
@@ -18,222 +18,247 @@ package org.apache.maven.scm.provider.in
  * specific language governing permissions and limitations
  * under the License.
  */
- 
-import java.util.Date;
-import java.io.File;
 
 import com.mks.api.Command;
-import com.mks.api.Option;
 import com.mks.api.FileOption;
+import com.mks.api.Option;
 import com.mks.api.response.APIException;
 import com.mks.api.response.Response;
 import com.mks.api.response.WorkItem;
 
+import java.io.File;
+import java.util.Date;
+
 /**
  * This class represents an Integrity SCM Member
  * <br>It contains all the necessary metadata to check this file out individually
- * @version $Id: Member.java 1.2 2011/08/22 13:06:47EDT Cletus D'Souza (dsouza) Exp  $
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: Member.java 1.2 2011/08/22 13:06:47EDT Cletus D'Souza (dsouza) Exp  $
+ * @since 1.6
  */
 public class Member
 {
-	private String memberID;
-	private String memberName;
-	private Date memberTimestamp;
-	private String memberDescription;
-	private String projectConfigPath;
-	private String memberRev;
-	private File targetFile;
-	private String relativeFile;
-	private String lineTerminator;
-	private String overwriteExisting;
-	private String restoreTimestamp;
-	
-	/**
-	 * This class represents an MKS Integrity Source File
-	 * It needs the Member Name (relative path to pj), Full Member Path, Project Configuration Path, Revision,
-	 * Project's Root Path, and the current Workspace directory (to compute the working file path) for its
-	 * instantiation.  This helper class will be used to then perform a project checkout from the repository 
-	 * @param wi A MKS API Response Work Item representing metadata related to a Integrity Member
-	 * @param configPath Configuration Path for this file's project/subproject
-	 * @param projectRoot Full path to the root location for this file's parent project
-	 * @param workspaceDir Full path to the workspace root directory
-	 */
-	public Member(WorkItem wi, String configPath, String projectRoot, String workspaceDir)
-	{
-		// Initialize our parent with the information needed
-		this.projectConfigPath = configPath;
-		this.memberID = wi.getId();
-		this.memberName = wi.getField("name").getValueAsString();
-		this.memberRev = wi.getField("memberrev").getItem().getId();
-		this.memberTimestamp = wi.getField("membertimestamp").getDateTime();
-		if( null != wi.getField("memberdescription") && null != wi.getField("memberdescription").getValueAsString() )
-		{
-			this.memberDescription = wi.getField("memberdescription").getValueAsString();
-		}
-		else
-		{
-			this.memberDescription = new String("");
-		}
-		this.lineTerminator = "native";
-		this.overwriteExisting = "overwriteExisting";
-		this.restoreTimestamp = "restoreTimestamp";
-		this.relativeFile = this.memberName.substring(projectRoot.length());
-		this.targetFile = new File(workspaceDir + relativeFile);
-	}
-
-	/**
-	 * Returns a string representation of this file's full path name, where it will checked out to disk for the build.
-	 * @return
-	 */
-	public String getTargetFilePath()
-	{
-		return targetFile.getAbsolutePath();
-	}
-
-	/**
-	 * Returns a string representation of this member's revision
-	 * @return
-	 */
-	public String getRevision()
-	{
-		return memberRev;
-	}
-	
-	/**
-	 * Returns the date/time associated with this member revision
-	 * @return
-	 */
-	public Date getTimestamp()
-	{
-		return memberTimestamp;
-	}
-	
-	/**
-	 * Returns any check-in comments associated with this revision
-	 * @return
-	 */
-	public String getDescription()
-	{
-		return memberDescription;
-	}
-	
-	/**
-	 * Returns the full server-side member path for this member
-	 * @return
-	 */
-	public String getMemberName()
-	{
-		return memberName;
-	}
-
-	/**
-	 * Returns only the file name portion for this full server-side member path
-	 * @return
-	 */
-	public String getName()
-	{
-		if( memberID.indexOf('/') > 0 )
-		{
-			return memberID.substring(memberID.lastIndexOf('/')+1);
-		}
-		else if( memberID.indexOf('\\') > 0 )
-		{
-			return memberID.substring(memberID.lastIndexOf('\\')+1);
-		}
-		else
-		{
-			return memberID;
-		}
-	}
-	
-	/**
-	 * Optionally, one may set a line terminator, if the default is not desired.
-	 * @param lineTerminator
-	 */
-	public void setLineTerminator(String lineTerminator)
-	{
-		this.lineTerminator = lineTerminator;
-	}
-	
-	/**
-	 * Optionally, one may choose not to overwrite existing files, this may speed up the synchronization process.
-	 * @param overwriteExisting
-	 */
-	public void setOverwriteExisting(String overwriteExisting)
-	{
-		this.overwriteExisting = overwriteExisting; 
-	}
-	
-	/**
-	 * Optionally, one might want to restore the timestamp, if the build is smart not to recompile files that were not touched.
-	 * @param restoreTimestamp
-	 */
-	public void setRestoreTimestamp(boolean restoreTime)
-	{
-		if( restoreTime )
-		{
-			this.restoreTimestamp = "restoreTimestamp";
-		}
-		else
-		{
-			this.restoreTimestamp = "norestoreTimestamp";
-		}
-	}
-	
-	/**
-	 * Performs a checkout of this MKS Integrity Source File to a working file location on the build server represented by targetFile
-	 * @param api MKS API Session
-	 * @return true if the operation succeeded or false if failed
-	 * @throws APIException
-	 */
-	public boolean checkout(APISession api) throws APIException
-	{
-		// Make sure the directory is created
-		if( ! targetFile.getParentFile().isDirectory() )
-		{
-			targetFile.getParentFile().mkdirs();
-		}
-		// Construct the project check-co command
-		Command coCMD = new Command(Command.SI, "projectco");
-		coCMD.addOption(new Option(overwriteExisting));
-		coCMD.addOption(new Option("nolock"));
-		coCMD.addOption(new Option("project", projectConfigPath));
-		coCMD.addOption(new FileOption("targetFile", targetFile));
-		coCMD.addOption(new Option(restoreTimestamp));
-		coCMD.addOption(new Option("lineTerminator", lineTerminator));
-		coCMD.addOption(new Option("revision", memberRev));
-		// Add the member selection
-		coCMD.addSelection(memberID);
-		
-		// Execute the checkout command
-		Response res = api.runCommand(coCMD);
-		
-		// Return true if we were successful
-		if( res.getExitCode() == 0 )
-		{
-			return true;
-		}
-		// Otherwise return false...
-		else
-		{
-			return false;
-		}
-	}
-	
-	/**
-	 * Uses the name of file for equality check
-	 */
-	@Override
-	public boolean equals(Object o)
-	{
-		if( o instanceof Member )
-		{
-			if( null != o )
-			{
-				return ((Member)o).getMemberName().equals(this.getMemberName());
-			}
-		}
-		return false;
-	}
+    private String memberID;
+
+    private String memberName;
+
+    private Date memberTimestamp;
+
+    private String memberDescription;
+
+    private String projectConfigPath;
+
+    private String memberRev;
+
+    private File targetFile;
+
+    private String relativeFile;
+
+    private String lineTerminator;
+
+    private String overwriteExisting;
+
+    private String restoreTimestamp;
+
+    /**
+     * This class represents an MKS Integrity Source File
+     * It needs the Member Name (relative path to pj), Full Member Path, Project Configuration Path, Revision,
+     * Project's Root Path, and the current Workspace directory (to compute the working file path) for its
+     * instantiation.  This helper class will be used to then perform a project checkout from the repository
+     *
+     * @param wi           A MKS API Response Work Item representing metadata related to a Integrity Member
+     * @param configPath   Configuration Path for this file's project/subproject
+     * @param projectRoot  Full path to the root location for this file's parent project
+     * @param workspaceDir Full path to the workspace root directory
+     */
+    public Member( WorkItem wi, String configPath, String projectRoot, String workspaceDir )
+    {
+        // Initialize our parent with the information needed
+        this.projectConfigPath = configPath;
+        this.memberID = wi.getId();
+        this.memberName = wi.getField( "name" ).getValueAsString();
+        this.memberRev = wi.getField( "memberrev" ).getItem().getId();
+        this.memberTimestamp = wi.getField( "membertimestamp" ).getDateTime();
+        if ( null != wi.getField( "memberdescription" ) && null != wi.getField(
+            "memberdescription" ).getValueAsString() )
+        {
+            this.memberDescription = wi.getField( "memberdescription" ).getValueAsString();
+        }
+        else
+        {
+            this.memberDescription = new String( "" );
+        }
+        this.lineTerminator = "native";
+        this.overwriteExisting = "overwriteExisting";
+        this.restoreTimestamp = "restoreTimestamp";
+        this.relativeFile = this.memberName.substring( projectRoot.length() );
+        this.targetFile = new File( workspaceDir + relativeFile );
+    }
+
+    /**
+     * Returns a string representation of this file's full path name, where it will checked out to disk for the build.
+     *
+     * @return
+     */
+    public String getTargetFilePath()
+    {
+        return targetFile.getAbsolutePath();
+    }
+
+    /**
+     * Returns a string representation of this member's revision
+     *
+     * @return
+     */
+    public String getRevision()
+    {
+        return memberRev;
+    }
+
+    /**
+     * Returns the date/time associated with this member revision
+     *
+     * @return
+     */
+    public Date getTimestamp()
+    {
+        return memberTimestamp;
+    }
+
+    /**
+     * Returns any check-in comments associated with this revision
+     *
+     * @return
+     */
+    public String getDescription()
+    {
+        return memberDescription;
+    }
+
+    /**
+     * Returns the full server-side member path for this member
+     *
+     * @return
+     */
+    public String getMemberName()
+    {
+        return memberName;
+    }
+
+    /**
+     * Returns only the file name portion for this full server-side member path
+     *
+     * @return
+     */
+    public String getName()
+    {
+        if ( memberID.indexOf( '/' ) > 0 )
+        {
+            return memberID.substring( memberID.lastIndexOf( '/' ) + 1 );
+        }
+        else if ( memberID.indexOf( '\\' ) > 0 )
+        {
+            return memberID.substring( memberID.lastIndexOf( '\\' ) + 1 );
+        }
+        else
+        {
+            return memberID;
+        }
+    }
+
+    /**
+     * Optionally, one may set a line terminator, if the default is not desired.
+     *
+     * @param lineTerminator
+     */
+    public void setLineTerminator( String lineTerminator )
+    {
+        this.lineTerminator = lineTerminator;
+    }
+
+    /**
+     * Optionally, one may choose not to overwrite existing files, this may speed up the synchronization process.
+     *
+     * @param overwriteExisting
+     */
+    public void setOverwriteExisting( String overwriteExisting )
+    {
+        this.overwriteExisting = overwriteExisting;
+    }
+
+    /**
+     * Optionally, one might want to restore the timestamp, if the build is smart not to recompile files that were not touched.
+     *
+     * @param restoreTimestamp
+     */
+    public void setRestoreTimestamp( boolean restoreTime )
+    {
+        if ( restoreTime )
+        {
+            this.restoreTimestamp = "restoreTimestamp";
+        }
+        else
+        {
+            this.restoreTimestamp = "norestoreTimestamp";
+        }
+    }
+
+    /**
+     * Performs a checkout of this MKS Integrity Source File to a working file location on the build server represented by targetFile
+     *
+     * @param api MKS API Session
+     * @return true if the operation succeeded or false if failed
+     * @throws APIException
+     */
+    public boolean checkout( APISession api )
+        throws APIException
+    {
+        // Make sure the directory is created
+        if ( !targetFile.getParentFile().isDirectory() )
+        {
+            targetFile.getParentFile().mkdirs();
+        }
+        // Construct the project check-co command
+        Command coCMD = new Command( Command.SI, "projectco" );
+        coCMD.addOption( new Option( overwriteExisting ) );
+        coCMD.addOption( new Option( "nolock" ) );
+        coCMD.addOption( new Option( "project", projectConfigPath ) );
+        coCMD.addOption( new FileOption( "targetFile", targetFile ) );
+        coCMD.addOption( new Option( restoreTimestamp ) );
+        coCMD.addOption( new Option( "lineTerminator", lineTerminator ) );
+        coCMD.addOption( new Option( "revision", memberRev ) );
+        // Add the member selection
+        coCMD.addSelection( memberID );
+
+        // Execute the checkout command
+        Response res = api.runCommand( coCMD );
+
+        // Return true if we were successful
+        if ( res.getExitCode() == 0 )
+        {
+            return true;
+        }
+        // Otherwise return false...
+        else
+        {
+            return false;
+        }
+    }
+
+    /**
+     * Uses the name of file for equality check
+     */
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( o instanceof Member )
+        {
+            if ( null != o )
+            {
+                return ( (Member) o ).getMemberName().equals( this.getMemberName() );
+            }
+        }
+        return false;
+    }
 }