maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1162334 [4/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...
Date Sat, 27 Aug 2011 12:39:22 GMT
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/remove/IntegrityRemoveCommand.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/command/remove/IntegrityRemoveCommand.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/command/remove/IntegrityRemoveCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/remove/IntegrityRemoveCommand.java
Sat Aug 27 12:39:21 2011
@@ -19,6 +19,8 @@ package org.apache.maven.scm.provider.in
  * under the License.
  */
 
+import com.mks.api.response.APIException;
+import com.mks.api.response.Response;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.command.remove.AbstractRemoveCommand;
@@ -28,43 +30,44 @@ import org.apache.maven.scm.provider.int
 import org.apache.maven.scm.provider.integrity.Sandbox;
 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
 
-import com.mks.api.response.APIException;
-import com.mks.api.response.Response;
-
 /**
  * MKS Integrity implementation for Maven's AbstractRemoveCommand
- * <br>This command will remove the registry entry for the current Sandbox 
- * @version $Id: IntegrityRemoveCommand.java 1.3 2011/08/22 13:06:35EDT Cletus D'Souza (dsouza)
Exp  $
+ * <br>This command will remove the registry entry for the current Sandbox
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityRemoveCommand.java 1.3 2011/08/22 13:06:35EDT Cletus D'Souza (dsouza)
Exp  $
+ * @since 1.6
  */
-public class IntegrityRemoveCommand extends AbstractRemoveCommand 
+public class IntegrityRemoveCommand
+    extends AbstractRemoveCommand
 {
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public RemoveScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet
fileSet, String message) throws ScmException 
-	{
-		getLogger().info("Attempting to un-register sandbox in directory " + fileSet.getBasedir().getAbsolutePath());
-		RemoveScmResult result;
-		IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository; 
-    	try    	
-    	{
-    		Sandbox siSandbox = iRepo.getSandbox();
-    		Response res = siSandbox.drop();
-    		int exitCode = res.getExitCode();
-    		boolean success = (exitCode == 0 ? true : false);
-    		result = new RemoveScmResult(res.getCommandString(), "", "Exit Code: " + exitCode,
success); 
-    	}
-    	catch(APIException aex)
-    	{
-    		ExceptionHandler eh = new ExceptionHandler(aex);
-    		getLogger().error("MKS API Exception: " + eh.getMessage());
-    		getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
-    		result = new RemoveScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false);
-    	}
-    	
-		return result;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public RemoveScmResult executeRemoveCommand( ScmProviderRepository repository, ScmFileSet
fileSet, String message )
+        throws ScmException
+    {
+        getLogger().info( "Attempting to un-register sandbox in directory " + fileSet.getBasedir().getAbsolutePath()
);
+        RemoveScmResult result;
+        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+        try
+        {
+            Sandbox siSandbox = iRepo.getSandbox();
+            Response res = siSandbox.drop();
+            int exitCode = res.getExitCode();
+            boolean success = ( exitCode == 0 ? true : false );
+            result = new RemoveScmResult( res.getCommandString(), "", "Exit Code: " + exitCode,
success );
+        }
+        catch ( APIException aex )
+        {
+            ExceptionHandler eh = new ExceptionHandler( aex );
+            getLogger().error( "MKS API Exception: " + eh.getMessage() );
+            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode()
);
+            result = new RemoveScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: "
+ eh.getExitCode(), false );
+        }
+
+        return result;
+    }
 
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommand.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/command/status/IntegrityStatusCommand.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/command/status/IntegrityStatusCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommand.java
Sat Aug 27 12:39:21 2011
@@ -19,11 +19,9 @@ package org.apache.maven.scm.provider.in
  * under the License.
  */
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import com.mks.api.response.APIException;
+import com.mks.api.response.Item;
+import com.mks.api.response.WorkItem;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
@@ -36,9 +34,10 @@ import org.apache.maven.scm.provider.int
 import org.apache.maven.scm.provider.integrity.Sandbox;
 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
 
-import com.mks.api.response.APIException;
-import com.mks.api.response.Item;
-import com.mks.api.response.WorkItem;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * MKS Integrity implementation for Maven's AbstractStatusCommand
@@ -46,68 +45,72 @@ import com.mks.api.response.WorkItem;
  * changed and dropped working files.  Additionally, this command
  * will also run a 'si viewnonmembers' command to report on all new
  * files added in the sandbox directory
- * @version $Id: IntegrityStatusCommand.java 1.6 2011/08/22 13:06:36EDT Cletus D'Souza (dsouza)
Exp  $
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityStatusCommand.java 1.6 2011/08/22 13:06:36EDT Cletus D'Souza (dsouza)
Exp  $
+ * @since 1.6
  */
-public class IntegrityStatusCommand extends AbstractStatusCommand 
+public class IntegrityStatusCommand
+    extends AbstractStatusCommand
 {
-	/**
-	 * {@inheritDoc}
-	 */	
-	@Override
-	public StatusScmResult executeStatusCommand(ScmProviderRepository repository, ScmFileSet
fileSet) throws ScmException 
-	{
-		StatusScmResult result;
-		IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
-		getLogger().info("Status of files changed in sandbox " + fileSet.getBasedir().getAbsolutePath());
-    	try
-    	{
-    		// Initialize the list of ScmFile objects for the StatusScmResult
-    		List<ScmFile> scmFileList = new ArrayList<ScmFile>();		
-
-    		// Get a listing for all the changes in the sandbox
-    		Sandbox siSandbox = iRepo.getSandbox();
-    		// Get the excludes and includes list from the configuration
-    		String excludes = Sandbox.formatFilePatterns(fileSet.getExcludes());
-    		String includes = Sandbox.formatFilePatterns(fileSet.getIncludes());    	
-
-    		// Get the new members found in the sandbox
-    		List<ScmFile> newMemberList = siSandbox.getNewMembers(excludes, includes);
-    		// Update the scmFileList with our updates
-    		scmFileList.addAll(newMemberList);
-    		
-    		// Get the changed/dropped members from the sandbox
-			List<WorkItem> changeList = siSandbox.getChangeList();
-			for( Iterator<WorkItem> wit = changeList.iterator(); wit.hasNext(); )
-			{
-				WorkItem wi = wit.next();
-        		File memberFile = new File(wi.getField("name").getValueAsString());
-        		// Separate the changes into files that have been updated and deleted files
-        		if( siSandbox.hasWorkingFile((Item)wi.getField("wfdelta").getValue()) )
-        		{
-        			scmFileList.add(new ScmFile(memberFile.getAbsolutePath(), ScmFileStatus.UPDATED));
	                		
-            	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public StatusScmResult executeStatusCommand( ScmProviderRepository repository, ScmFileSet
fileSet )
+        throws ScmException
+    {
+        StatusScmResult result;
+        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+        getLogger().info( "Status of files changed in sandbox " + fileSet.getBasedir().getAbsolutePath()
);
+        try
+        {
+            // Initialize the list of ScmFile objects for the StatusScmResult
+            List<ScmFile> scmFileList = new ArrayList<ScmFile>();
+
+            // Get a listing for all the changes in the sandbox
+            Sandbox siSandbox = iRepo.getSandbox();
+            // Get the excludes and includes list from the configuration
+            String excludes = Sandbox.formatFilePatterns( fileSet.getExcludes() );
+            String includes = Sandbox.formatFilePatterns( fileSet.getIncludes() );
+
+            // Get the new members found in the sandbox
+            List<ScmFile> newMemberList = siSandbox.getNewMembers( excludes, includes
);
+            // Update the scmFileList with our updates
+            scmFileList.addAll( newMemberList );
+
+            // Get the changed/dropped members from the sandbox
+            List<WorkItem> changeList = siSandbox.getChangeList();
+            for ( Iterator<WorkItem> wit = changeList.iterator(); wit.hasNext(); )
+            {
+                WorkItem wi = wit.next();
+                File memberFile = new File( wi.getField( "name" ).getValueAsString() );
+                // Separate the changes into files that have been updated and deleted files
+                if ( siSandbox.hasWorkingFile( (Item) wi.getField( "wfdelta" ).getValue()
) )
+                {
+                    scmFileList.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.UPDATED
) );
+                }
                 else
                 {
-                    scmFileList.add(new ScmFile(memberFile.getAbsolutePath(), ScmFileStatus.DELETED));
	                		
+                    scmFileList.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.DELETED
) );
                 }
-			}
-			
-	    	if( scmFileList.size() == 0 )
-	    	{
-	    		getLogger().info("No local changes found!");
-	    	}
-			result = new StatusScmResult(scmFileList, new ScmResult("si viewsandbox", "", "", true));

-    	}
-    	catch(APIException aex)
-    	{
-    		ExceptionHandler eh = new ExceptionHandler(aex);
-    		getLogger().error("MKS API Exception: " + eh.getMessage());
-    		getLogger().debug(eh.getCommand() + " exited with return code " + eh.getExitCode());
-    		result = new StatusScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false);
-    	}
-    	
-		return result;
-	}
+            }
+
+            if ( scmFileList.size() == 0 )
+            {
+                getLogger().info( "No local changes found!" );
+            }
+            result = new StatusScmResult( scmFileList, new ScmResult( "si viewsandbox", "",
"", true ) );
+        }
+        catch ( APIException aex )
+        {
+            ExceptionHandler eh = new ExceptionHandler( aex );
+            getLogger().error( "MKS API Exception: " + eh.getMessage() );
+            getLogger().debug( eh.getCommand() + " exited with return code " + eh.getExitCode()
);
+            result = new StatusScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: "
+ eh.getExitCode(), false );
+        }
+
+        return result;
+    }
 
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommand.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/command/tag/IntegrityTagCommand.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/command/tag/IntegrityTagCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommand.java
Sat Aug 27 12:39:21 2011
@@ -19,6 +19,11 @@ package org.apache.maven.scm.provider.in
  * under the License.
  */
 
+import com.mks.api.response.APIException;
+import com.mks.api.response.Response;
+import com.mks.api.response.WorkItem;
+import groovy.lang.Binding;
+import groovy.lang.GroovyShell;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmTagParameters;
@@ -28,98 +33,101 @@ import org.apache.maven.scm.provider.Scm
 import org.apache.maven.scm.provider.integrity.ExceptionHandler;
 import org.apache.maven.scm.provider.integrity.Project;
 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-
-import groovy.lang.Binding;
-import groovy.lang.GroovyShell;
 import org.codehaus.groovy.control.CompilationFailedException;
 import org.codehaus.groovy.control.CompilerConfiguration;
 
-
-import com.mks.api.response.APIException;
-import com.mks.api.response.Response;
-import com.mks.api.response.WorkItem;
-
 /**
  * MKS Integrity implementation of Maven's AbstractTagCommand
  * <br>This command will execute a 'si checkpoint' command using a groovy
- * script for evaluating the tag (label) name 
- * @version $Id: IntegrityTagCommand.java 1.4 2011/08/22 13:06:38EDT Cletus D'Souza (dsouza)
Exp  $
+ * script for evaluating the tag (label) name
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityTagCommand.java 1.4 2011/08/22 13:06:38EDT Cletus D'Souza (dsouza)
Exp  $
+ * @since 1.6
  */
-public class IntegrityTagCommand extends AbstractTagCommand 
+public class IntegrityTagCommand
+    extends AbstractTagCommand
 {
-	/**
-	 * {@inheritDoc}
-	 */	
-	@Override
-	public TagScmResult executeTagCommand(ScmProviderRepository repository, ScmFileSet fileSet,
String tagName, ScmTagParameters scmTagParameters) throws ScmException 
-	{
-		getLogger().info("Attempting to checkpoint project associated with sandbox " + fileSet.getBasedir().getAbsolutePath());
-		TagScmResult result;
-		String message = scmTagParameters.getMessage();
-		IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
-		
-		try
-		{
-			// First validate the checkpoint label string by evaluating the groovy script
-			String chkptLabel = evalGroovyExpression(tagName);
-			Project.validateTag(chkptLabel);
-			String msg = ((null == message || message.length() == 0) ? System.getProperty("message")
: message);
-			// Get information about the Project
-			Project siProject = iRepo.getProject();
-			// Ensure this is not a build project configuration
-			if( ! siProject.isBuild() )
-			{
-				Response res = siProject.checkpoint(msg, chkptLabel);
-	    		int exitCode = res.getExitCode();
-	    		boolean success = (exitCode == 0 ? true : false);
-				WorkItem wi = res.getWorkItem(siProject.getConfigurationPath());
-				String chkpt = wi.getResult().getField("resultant").getItem().getId();
-				getLogger().info("Successfully checkpointed project " + siProject.getConfigurationPath()
+ 
-											" with label '" + chkptLabel + "', new revision is " + chkpt);
-				result = new TagScmResult(res.getCommandString(), wi.getResult().getMessage(), "Exit
Code: " + exitCode, success);
-			}
-			else
-			{
-				getLogger().error("Cannot checkpoint a build project configuration: " + siProject.getConfigurationPath()
+ "!");
-				result = new TagScmResult("si checkpoint", "Cannot checkpoint a build project configuration!",
"", false);
-			}
-		}
-		catch(CompilationFailedException cfe)
-		{
-    		getLogger().error("Groovy Compilation Exception: " + cfe.getMessage());
-    		result = new TagScmResult("si checkpoint", cfe.getMessage(), "", false);    					
-		}
-    	catch(APIException aex)
-    	{
-    		ExceptionHandler eh = new ExceptionHandler(aex);
-    		getLogger().error("MKS API Exception: " + eh.getMessage());
-    		getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
-    		result = new TagScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false);
-    	}   
-    	catch(Exception e)
-    	{
-    		getLogger().error("Failed to checkpoint project! " + e.getMessage());
-    		result = new TagScmResult("si checkpoint", e.getMessage(), "", false);    		
-    	}
-		return result;
-	}
-	
-	public String evalGroovyExpression(String expression)
-	{
-		Binding binding = new Binding();
-		binding.setVariable("env", System.getenv());
-		binding.setVariable("sys", System.getProperties());
-		CompilerConfiguration config = new CompilerConfiguration();
-		GroovyShell shell = new GroovyShell(binding, config);
-		Object result = shell.evaluate("return \"" + expression + "\"");
-		if( result == null )
-		{
-			return "";
-		}
-		else
-		{
-			return result.toString().trim();
-		}
-	}	
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public TagScmResult executeTagCommand( ScmProviderRepository repository, ScmFileSet fileSet,
String tagName,
+                                           ScmTagParameters scmTagParameters )
+        throws ScmException
+    {
+        getLogger().info(
+            "Attempting to checkpoint project associated with sandbox " + fileSet.getBasedir().getAbsolutePath()
);
+        TagScmResult result;
+        String message = scmTagParameters.getMessage();
+        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+
+        try
+        {
+            // First validate the checkpoint label string by evaluating the groovy script
+            String chkptLabel = evalGroovyExpression( tagName );
+            Project.validateTag( chkptLabel );
+            String msg = ( ( null == message || message.length() == 0 ) ? System.getProperty(
"message" ) : message );
+            // Get information about the Project
+            Project siProject = iRepo.getProject();
+            // Ensure this is not a build project configuration
+            if ( !siProject.isBuild() )
+            {
+                Response res = siProject.checkpoint( msg, chkptLabel );
+                int exitCode = res.getExitCode();
+                boolean success = ( exitCode == 0 ? true : false );
+                WorkItem wi = res.getWorkItem( siProject.getConfigurationPath() );
+                String chkpt = wi.getResult().getField( "resultant" ).getItem().getId();
+                getLogger().info(
+                    "Successfully checkpointed project " + siProject.getConfigurationPath()
+ " with label '"
+                        + chkptLabel + "', new revision is " + chkpt );
+                result =
+                    new TagScmResult( res.getCommandString(), wi.getResult().getMessage(),
"Exit Code: " + exitCode,
+                                      success );
+            }
+            else
+            {
+                getLogger().error(
+                    "Cannot checkpoint a build project configuration: " + siProject.getConfigurationPath()
+ "!" );
+                result =
+                    new TagScmResult( "si checkpoint", "Cannot checkpoint a build project
configuration!", "", false );
+            }
+        }
+        catch ( CompilationFailedException cfe )
+        {
+            getLogger().error( "Groovy Compilation Exception: " + cfe.getMessage() );
+            result = new TagScmResult( "si checkpoint", cfe.getMessage(), "", false );
+        }
+        catch ( APIException aex )
+        {
+            ExceptionHandler eh = new ExceptionHandler( aex );
+            getLogger().error( "MKS API Exception: " + eh.getMessage() );
+            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode()
);
+            result = new TagScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " +
eh.getExitCode(), false );
+        }
+        catch ( Exception e )
+        {
+            getLogger().error( "Failed to checkpoint project! " + e.getMessage() );
+            result = new TagScmResult( "si checkpoint", e.getMessage(), "", false );
+        }
+        return result;
+    }
+
+    public String evalGroovyExpression( String expression )
+    {
+        Binding binding = new Binding();
+        binding.setVariable( "env", System.getenv() );
+        binding.setVariable( "sys", System.getProperties() );
+        CompilerConfiguration config = new CompilerConfiguration();
+        GroovyShell shell = new GroovyShell( binding, config );
+        Object result = shell.evaluate( "return \"" + expression + "\"" );
+        if ( result == null )
+        {
+            return "";
+        }
+        else
+        {
+            return result.toString().trim();
+        }
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommand.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/command/unedit/IntegrityUnEditCommand.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/command/unedit/IntegrityUnEditCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommand.java
Sat Aug 27 12:39:21 2011
@@ -19,6 +19,8 @@ package org.apache.maven.scm.provider.in
  * under the License.
  */
 
+import com.mks.api.response.APIException;
+import com.mks.api.response.Response;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.command.unedit.AbstractUnEditCommand;
@@ -28,43 +30,44 @@ import org.apache.maven.scm.provider.int
 import org.apache.maven.scm.provider.integrity.Sandbox;
 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
 
-import com.mks.api.response.APIException;
-import com.mks.api.response.Response;
-
 /**
  * MKS Integrity implementation of Maven's AbstractUnEditCommand
  * <br>This command will execute a 'si revert' command which will revert
  * any modified working files back to their server versions
- * @version $Id: IntegrityUnEditCommand.java 1.4 2011/08/22 13:06:39EDT Cletus D'Souza (dsouza)
Exp  $
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityUnEditCommand.java 1.4 2011/08/22 13:06:39EDT Cletus D'Souza (dsouza)
Exp  $
+ * @since 1.6
  */
-public class IntegrityUnEditCommand extends AbstractUnEditCommand
+public class IntegrityUnEditCommand
+    extends AbstractUnEditCommand
 {
-	/**
-	 * {@inheritDoc}
-	 */	
-	@Override
-	public UnEditScmResult executeUnEditCommand(ScmProviderRepository repository, ScmFileSet
fileSet) throws ScmException
-	{
-		getLogger().info("Attempting to revert members in sandbox " + fileSet.getBasedir().getAbsolutePath());
-		IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
-		UnEditScmResult result;		
-    	try
-    	{
-    		Sandbox siSandbox = iRepo.getSandbox();
-    		Response res = siSandbox.revertMembers();
-    		int exitCode = res.getExitCode();
-    		boolean success = (exitCode == 0 ? true : false);
-    		result = new UnEditScmResult(res.getCommandString(), "", "Exit Code: " + exitCode,
success); 
-    	}
-    	catch(APIException aex)
-    	{
-    		ExceptionHandler eh = new ExceptionHandler(aex);
-    		getLogger().error("MKS API Exception: " + eh.getMessage());
-    		getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
-    		result = new UnEditScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false);
-    	}
-    	
-		return result;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public UnEditScmResult executeUnEditCommand( ScmProviderRepository repository, ScmFileSet
fileSet )
+        throws ScmException
+    {
+        getLogger().info( "Attempting to revert members in sandbox " + fileSet.getBasedir().getAbsolutePath()
);
+        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+        UnEditScmResult result;
+        try
+        {
+            Sandbox siSandbox = iRepo.getSandbox();
+            Response res = siSandbox.revertMembers();
+            int exitCode = res.getExitCode();
+            boolean success = ( exitCode == 0 ? true : false );
+            result = new UnEditScmResult( res.getCommandString(), "", "Exit Code: " + exitCode,
success );
+        }
+        catch ( APIException aex )
+        {
+            ExceptionHandler eh = new ExceptionHandler( aex );
+            getLogger().error( "MKS API Exception: " + eh.getMessage() );
+            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode()
);
+            result = new UnEditScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: "
+ eh.getExitCode(), false );
+        }
+
+        return result;
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/unlock/IntegrityUnlockCommand.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/command/unlock/IntegrityUnlockCommand.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/command/unlock/IntegrityUnlockCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/unlock/IntegrityUnlockCommand.java
Sat Aug 27 12:39:21 2011
@@ -19,8 +19,8 @@ package org.apache.maven.scm.provider.in
  * under the License.
  */
 
-import java.io.File;
-
+import com.mks.api.response.APIException;
+import com.mks.api.response.Response;
 import org.apache.maven.scm.CommandParameter;
 import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmException;
@@ -32,72 +32,78 @@ import org.apache.maven.scm.provider.int
 import org.apache.maven.scm.provider.integrity.Sandbox;
 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
 
-import com.mks.api.response.APIException;
-import com.mks.api.response.Response;
+import java.io.File;
 
 /**
  * MKS Integrity implementation of Maven's AbstractUnlockCommand
- * <br>This command will run a 'si unlock' command for the specified filename 
- * @version $Id: IntegrityUnlockCommand.java 1.3 2011/08/22 13:06:40EDT Cletus D'Souza (dsouza)
Exp  $
+ * <br>This command will run a 'si unlock' command for the specified filename
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityUnlockCommand.java 1.3 2011/08/22 13:06:40EDT Cletus D'Souza (dsouza)
Exp  $
+ * @since 1.6
  */
-public class IntegrityUnlockCommand extends AbstractUnlockCommand 
+public class IntegrityUnlockCommand
+    extends AbstractUnlockCommand
 {
-	// This command will require the filename argument to be supplied for its execution
-	private String filename;
-	
-	/**
-	 * IntegrityUnlockCommand constructor requires a filename argument to be supplied for its
execution
-	 * <br>This avoids having to run the unlock command across the entire Sandbox.
-	 * @param filename Relative path of the file needed to be unlocked
-	 */
-	public IntegrityUnlockCommand(String filename)
-	{
-		this.filename = filename;
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */	
-	@Override
-	public ScmResult executeUnlockCommand(ScmProviderRepository repository, File workingDirectory)
throws ScmException 
-	{
-		getLogger().info("Attempting to unlock file: " + filename);		
-		if( null == filename || filename.length() == 0 )
-		{
-			throw new ScmException("A single filename is required to execute the unlock command!");
-		}
-
-		ScmResult result;
-		IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository; 
-    	try
-    	{
-    		Sandbox siSandbox = iRepo.getSandbox();
-    		File memberFile = new File(workingDirectory.getAbsoluteFile() + File.separator + filename);

-    		Response res = siSandbox.unlock(memberFile, filename);
-    		int exitCode = res.getExitCode();
-    		boolean success = (exitCode == 0 ? true : false);
-    		result = new ScmResult(res.getCommandString(), "", "Exit Code: " + exitCode, success);

-    	}
-    	catch(APIException aex)
-    	{
-    		ExceptionHandler eh = new ExceptionHandler(aex);
-    		getLogger().error("MKS API Exception: " + eh.getMessage());
-    		getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
-    		result = new ScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false);
-    	}
-    	
-    	return result;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	protected ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters) throws ScmException 
-	{
-		filename = parameters.getString(CommandParameter.FILE);
-		return executeUnlockCommand(repository, fileSet.getBasedir());
-	}
+    // This command will require the filename argument to be supplied for its execution
+    private String filename;
+
+    /**
+     * IntegrityUnlockCommand constructor requires a filename argument to be supplied for
its execution
+     * <br>This avoids having to run the unlock command across the entire Sandbox.
+     *
+     * @param filename Relative path of the file needed to be unlocked
+     */
+    public IntegrityUnlockCommand( String filename )
+    {
+        this.filename = filename;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ScmResult executeUnlockCommand( ScmProviderRepository repository, File workingDirectory
)
+        throws ScmException
+    {
+        getLogger().info( "Attempting to unlock file: " + filename );
+        if ( null == filename || filename.length() == 0 )
+        {
+            throw new ScmException( "A single filename is required to execute the unlock
command!" );
+        }
+
+        ScmResult result;
+        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+        try
+        {
+            Sandbox siSandbox = iRepo.getSandbox();
+            File memberFile = new File( workingDirectory.getAbsoluteFile() + File.separator
+ filename );
+            Response res = siSandbox.unlock( memberFile, filename );
+            int exitCode = res.getExitCode();
+            boolean success = ( exitCode == 0 ? true : false );
+            result = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode,
success );
+        }
+        catch ( APIException aex )
+        {
+            ExceptionHandler eh = new ExceptionHandler( aex );
+            getLogger().error( "MKS API Exception: " + eh.getMessage() );
+            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode()
);
+            result = new ScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false );
+        }
+
+        return result;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+                                        CommandParameters parameters )
+        throws ScmException
+    {
+        filename = parameters.getString( CommandParameter.FILE );
+        return executeUnlockCommand( repository, fileSet.getBasedir() );
+    }
 
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommand.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/command/update/IntegrityUpdateCommand.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/command/update/IntegrityUpdateCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommand.java
Sat Aug 27 12:39:21 2011
@@ -19,9 +19,12 @@ package org.apache.maven.scm.provider.in
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.mks.api.response.APIException;
+import com.mks.api.response.Response;
+import com.mks.api.response.Result;
+import com.mks.api.response.WorkItem;
+import com.mks.api.response.WorkItemIterator;
+import com.mks.api.si.SIModelTypeName;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
@@ -36,78 +39,80 @@ import org.apache.maven.scm.provider.int
 import org.apache.maven.scm.provider.integrity.command.changelog.IntegrityChangeLogCommand;
 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
 
-import com.mks.api.response.APIException;
-import com.mks.api.response.Response;
-import com.mks.api.response.Result;
-import com.mks.api.response.WorkItem;
-import com.mks.api.response.WorkItemIterator;
-import com.mks.api.si.SIModelTypeName;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * MKS Integrity implementation of Maven's AbstractUpdateCommand
- * <br>This command will execute a 'si resync' to synchronize the sandbox with the
server revisions. 
- * @version $Id: IntegrityUpdateCommand.java 1.3 2011/08/22 13:06:42EDT Cletus D'Souza (dsouza)
Exp  $
+ * <br>This command will execute a 'si resync' to synchronize the sandbox with the
server revisions.
+ *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityUpdateCommand.java 1.3 2011/08/22 13:06:42EDT Cletus D'Souza (dsouza)
Exp  $
+ * @since 1.6
  */
-public class IntegrityUpdateCommand extends AbstractUpdateCommand 
+public class IntegrityUpdateCommand
+    extends AbstractUpdateCommand
 {
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public UpdateScmResult executeUpdateCommand(ScmProviderRepository repository, ScmFileSet
fileSet, ScmVersion scmVersion) throws ScmException 
-	{
-		getLogger().info("Attempting to synchronize sandbox in " + fileSet.getBasedir().getAbsolutePath());
-		List<ScmFile> updatedFiles = new ArrayList<ScmFile>();
-		IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
-		Sandbox siSandbox = iRepo.getSandbox();
-		try
-		{
-			// Make sure we've got a valid sandbox, otherwise create it...
-			if( siSandbox.create() )
-			{
-				Response res = siSandbox.resync();
-    			// Lets capture what we got from running this resync
-    			WorkItemIterator wit = res.getWorkItems();
-    			while(wit.hasNext())
-    			{
-    				WorkItem wi = wit.next();
-    				if( wi.getModelType().equals(SIModelTypeName.MEMBER) )
-    				{
-    					Result message = wi.getResult();
-    					getLogger().debug(wi.getDisplayId() + " " + (null != message ? message.getMessage()
: ""));
-    					if( null != message && message.getMessage().length() > 0 )
-    					{
-    						updatedFiles.add(new ScmFile(wi.getDisplayId(), 
-    								message.getMessage().equalsIgnoreCase("removed") ? 
-    										ScmFileStatus.DELETED : ScmFileStatus.UPDATED));
-    					}
-    				}
-    			}
-				return new UpdateScmResult(res.getCommandString(), updatedFiles);
-			}
-			else
-			{
-				return new UpdateScmResult("si resync", "Failed to synchronize workspace", "", false);
-			}
-		}
-    	catch(APIException aex)
-    	{
-    		ExceptionHandler eh = new ExceptionHandler(aex);
-    		getLogger().error("MKS API Exception: " + eh.getMessage());
-    		getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
-    		return new UpdateScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(),
false);
-    	}
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public UpdateScmResult executeUpdateCommand( ScmProviderRepository repository, ScmFileSet
fileSet,
+                                                 ScmVersion scmVersion )
+        throws ScmException
+    {
+        getLogger().info( "Attempting to synchronize sandbox in " + fileSet.getBasedir().getAbsolutePath()
);
+        List<ScmFile> updatedFiles = new ArrayList<ScmFile>();
+        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+        Sandbox siSandbox = iRepo.getSandbox();
+        try
+        {
+            // Make sure we've got a valid sandbox, otherwise create it...
+            if ( siSandbox.create() )
+            {
+                Response res = siSandbox.resync();
+                // Lets capture what we got from running this resync
+                WorkItemIterator wit = res.getWorkItems();
+                while ( wit.hasNext() )
+                {
+                    WorkItem wi = wit.next();
+                    if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
+                    {
+                        Result message = wi.getResult();
+                        getLogger().debug( wi.getDisplayId() + " " + ( null != message ?
message.getMessage() : "" ) );
+                        if ( null != message && message.getMessage().length() >
0 )
+                        {
+                            updatedFiles.add( new ScmFile( wi.getDisplayId(),
+                                                           message.getMessage().equalsIgnoreCase(
"removed" )
+                                                               ? ScmFileStatus.DELETED
+                                                               : ScmFileStatus.UPDATED )
);
+                        }
+                    }
+                }
+                return new UpdateScmResult( res.getCommandString(), updatedFiles );
+            }
+            else
+            {
+                return new UpdateScmResult( "si resync", "Failed to synchronize workspace",
"", false );
+            }
+        }
+        catch ( APIException aex )
+        {
+            ExceptionHandler eh = new ExceptionHandler( aex );
+            getLogger().error( "MKS API Exception: " + eh.getMessage() );
+            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode()
);
+            return new UpdateScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " +
eh.getExitCode(), false );
+        }
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	protected ChangeLogCommand getChangeLogCommand() 
-	{
-    	IntegrityChangeLogCommand command = new IntegrityChangeLogCommand();
-    	command.setLogger(getLogger());
-    	return command;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ChangeLogCommand getChangeLogCommand()
+    {
+        IntegrityChangeLogCommand command = new IntegrityChangeLogCommand();
+        command.setLogger( getLogger() );
+        return command;
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepository.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/repository/IntegrityScmProviderRepository.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/repository/IntegrityScmProviderRepository.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepository.java
Sat Aug 27 12:39:21 2011
@@ -31,14 +31,20 @@ import org.apache.maven.scm.provider.int
  *
  * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
  * @version $Id: IntegrityScmProviderRepository.java 1.2 2011/08/22 13:06:43EDT Cletus D'Souza
(dsouza) Exp  $
+ * @since 1.6
  */
-public class IntegrityScmProviderRepository extends ScmProviderRepositoryWithHost {
+public class IntegrityScmProviderRepository
+    extends ScmProviderRepositoryWithHost
+{
     // Configuration Path for the MKS Integrity SCM Project
     private String configurationPath;
+
     // MKS API Session
     private APISession api;
+
     // Encapsulation for our MKS Integrity SCM Project
     private Project siProject;
+
     // Encapsulation for our MKS Integrity SCM Sandbox
     private Sandbox siSandbox;
 
@@ -52,15 +58,17 @@ public class IntegrityScmProviderReposit
      * @param configPath MKS Integrity SCM Project Configuration Path
      * @param logger     Maven ScmLogger object
      */
-    public IntegrityScmProviderRepository(String host, int port, String user, String paswd,
String configPath, ScmLogger logger) {
+    public IntegrityScmProviderRepository( String host, int port, String user, String paswd,
String configPath,
+                                           ScmLogger logger )
+    {
         super();
-        setHost(host);
-        setPort(port);
-        setUser(user);
-        setPassword(paswd);
+        setHost( host );
+        setPort( port );
+        setUser( user );
+        setPassword( paswd );
         configurationPath = configPath;
-        api = new APISession(logger);
-        logger.debug("Configuration Path: " + configurationPath);
+        api = new APISession( logger );
+        logger.debug( "Configuration Path: " + configurationPath );
     }
 
     /**
@@ -68,7 +76,8 @@ public class IntegrityScmProviderReposit
      *
      * @return MKS Integrity SCM Project object
      */
-    public Project getProject() {
+    public Project getProject()
+    {
         return siProject;
     }
 
@@ -77,7 +86,8 @@ public class IntegrityScmProviderReposit
      *
      * @param project MKS Integrity SCM Project object
      */
-    public void setProject(Project project) {
+    public void setProject( Project project )
+    {
         siProject = project;
     }
 
@@ -86,7 +96,8 @@ public class IntegrityScmProviderReposit
      *
      * @return MKS Integrity SCM Sandbox object
      */
-    public Sandbox getSandbox() {
+    public Sandbox getSandbox()
+    {
         return siSandbox;
     }
 
@@ -95,7 +106,8 @@ public class IntegrityScmProviderReposit
      *
      * @param sandbox MKS Integrity SCM Sandbox object
      */
-    public void setSandbox(Sandbox sandbox) {
+    public void setSandbox( Sandbox sandbox )
+    {
         siSandbox = sandbox;
     }
 
@@ -104,7 +116,8 @@ public class IntegrityScmProviderReposit
      *
      * @return MKS Integrity API Session
      */
-    public APISession getAPISession() {
+    public APISession getAPISession()
+    {
         return api;
     }
 
@@ -113,7 +126,8 @@ public class IntegrityScmProviderReposit
      *
      * @return MKS Integrity SCM Project Configuration Path
      */
-    public String getConfigruationPath() {
+    public String getConfigruationPath()
+    {
         return configurationPath;
     }
 }



Mime
View raw message