You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2013/11/23 10:49:30 UTC
[07/10] Added .gitattributes to enforce proper line endings,
remaining incorrect files fixed.
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameConsumer.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameConsumer.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameConsumer.java
index 86c3047..0036199 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameConsumer.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/blame/IntegrityBlameConsumer.java
@@ -1,97 +1,97 @@
-package org.apache.maven.scm.provider.integrity.command.blame;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.scm.command.blame.BlameLine;
-import org.apache.maven.scm.log.ScmLogger;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.cli.StreamConsumer;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Helper class to consume the standard output from running the IntegrityBlameCommand
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityBlameConsumer.java 1.2 2011/08/22 13:06:16EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityBlameConsumer
- implements StreamConsumer
-{
- private ScmLogger logger;
-
- private List<BlameLine> blameList;
-
- private SimpleDateFormat dateFormat;
-
- /**
- * IntegrityBlameConsumer constructor requires a ScmLogger to log all the activity
- *
- * @param logger ScmLogger object
- */
- public IntegrityBlameConsumer( ScmLogger logger )
- {
- this.logger = logger;
- this.blameList = new ArrayList<BlameLine>();
- this.dateFormat = new SimpleDateFormat( "MMM dd, yyyy z" );
- }
-
- /**
- * {@inheritDoc}
- */
- public void consumeLine( String line )
- {
- // Parse the annotate output which should return the three pieces of data
- logger.debug( line );
- if ( null != line && line.trim().length() > 0 )
- {
- String[] tokens = StringUtils.split( line, "\t" );
- if ( tokens.length != 3 )
- {
- logger.warn( "Failed to parse line: " + line );
- }
- else
- {
- try
- {
- blameList.add( new BlameLine( dateFormat.parse( tokens[0] ), tokens[1], tokens[2] ) );
- }
- catch ( ParseException e )
- {
- logger.error( "Failed to date string: " + tokens[0] );
- }
- }
- }
- }
-
- /**
- * Returns a list of BlameLine objects found from parsing the 'si annotate' output
- *
- * @return
- */
- public List<BlameLine> getBlameList()
- {
- return blameList;
- }
-}
+package org.apache.maven.scm.provider.integrity.command.blame;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.command.blame.BlameLine;
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Helper class to consume the standard output from running the IntegrityBlameCommand
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityBlameConsumer.java 1.2 2011/08/22 13:06:16EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityBlameConsumer
+ implements StreamConsumer
+{
+ private ScmLogger logger;
+
+ private List<BlameLine> blameList;
+
+ private SimpleDateFormat dateFormat;
+
+ /**
+ * IntegrityBlameConsumer constructor requires a ScmLogger to log all the activity
+ *
+ * @param logger ScmLogger object
+ */
+ public IntegrityBlameConsumer( ScmLogger logger )
+ {
+ this.logger = logger;
+ this.blameList = new ArrayList<BlameLine>();
+ this.dateFormat = new SimpleDateFormat( "MMM dd, yyyy z" );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void consumeLine( String line )
+ {
+ // Parse the annotate output which should return the three pieces of data
+ logger.debug( line );
+ if ( null != line && line.trim().length() > 0 )
+ {
+ String[] tokens = StringUtils.split( line, "\t" );
+ if ( tokens.length != 3 )
+ {
+ logger.warn( "Failed to parse line: " + line );
+ }
+ else
+ {
+ try
+ {
+ blameList.add( new BlameLine( dateFormat.parse( tokens[0] ), tokens[1], tokens[2] ) );
+ }
+ catch ( ParseException e )
+ {
+ logger.error( "Failed to date string: " + tokens[0] );
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns a list of BlameLine objects found from parsing the 'si annotate' output
+ *
+ * @return
+ */
+ public List<BlameLine> getBlameList()
+ {
+ return blameList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommand.java
index 1093990..39252c9 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommand.java
@@ -1,89 +1,89 @@
-package org.apache.maven.scm.provider.integrity.command.branch;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * 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.ScmFile;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmResult;
-import org.apache.maven.scm.command.branch.AbstractBranchCommand;
-import org.apache.maven.scm.command.branch.BranchScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-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 java.util.ArrayList;
-
-/**
- * MKS Integrity implementation for Maven's AbstractBranchCommand
- * <br>For a normal and variant configuration, a fresh checkpoint is executed
- * prior to creating a Development Path (branch). In the case of a build
- * configuration, the specified checkpoint revision is used to create
- * the Development Path
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityBranchCommand.java 1.3 2011/08/22 13:06:17EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityBranchCommand
- extends AbstractBranchCommand
-{
- /**
- * {@inheritDoc}
- */
- @Override
- public BranchScmResult executeBranchCommand( ScmProviderRepository repository, ScmFileSet fileSet,
- String branchName, String message )
- throws ScmException
- {
- BranchScmResult result;
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- Project siProject = iRepo.getProject();
- getLogger().info(
- "Attempting to branch project " + siProject.getProjectName() + " using branch name '" + branchName + "'" );
- try
- {
- Project.validateTag( branchName );
- Response res = siProject.createDevPath( branchName );
- int exitCode = res.getExitCode();
- boolean success = ( exitCode == 0 ? true : false );
- ScmResult scmResult = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
- result = new BranchScmResult( new ArrayList<ScmFile>(), scmResult );
- }
- 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 BranchScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
- }
- catch ( Exception e )
- {
- getLogger().error( "Failed to checkpoint project! " + e.getMessage() );
- result = new BranchScmResult( "si createdevpath", e.getMessage(), "", false );
- }
-
- return result;
- }
-
-}
+package org.apache.maven.scm.provider.integrity.command.branch;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * 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.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.command.branch.AbstractBranchCommand;
+import org.apache.maven.scm.command.branch.BranchScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+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 java.util.ArrayList;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractBranchCommand
+ * <br>For a normal and variant configuration, a fresh checkpoint is executed
+ * prior to creating a Development Path (branch). In the case of a build
+ * configuration, the specified checkpoint revision is used to create
+ * the Development Path
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityBranchCommand.java 1.3 2011/08/22 13:06:17EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityBranchCommand
+ extends AbstractBranchCommand
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public BranchScmResult executeBranchCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+ String branchName, String message )
+ throws ScmException
+ {
+ BranchScmResult result;
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ Project siProject = iRepo.getProject();
+ getLogger().info(
+ "Attempting to branch project " + siProject.getProjectName() + " using branch name '" + branchName + "'" );
+ try
+ {
+ Project.validateTag( branchName );
+ Response res = siProject.createDevPath( branchName );
+ int exitCode = res.getExitCode();
+ boolean success = ( exitCode == 0 ? true : false );
+ ScmResult scmResult = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
+ result = new BranchScmResult( new ArrayList<ScmFile>(), scmResult );
+ }
+ 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 BranchScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
+ }
+ catch ( Exception e )
+ {
+ getLogger().error( "Failed to checkpoint project! " + e.getMessage() );
+ result = new BranchScmResult( "si createdevpath", e.getMessage(), "", false );
+ }
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommand.java
index ef2acde..22ca7a8 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommand.java
@@ -1,93 +1,93 @@
-package org.apache.maven.scm.provider.integrity.command.changelog;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import com.mks.api.response.APIException;
-import org.apache.maven.scm.ScmBranch;
-import org.apache.maven.scm.ScmException;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmResult;
-import org.apache.maven.scm.command.changelog.AbstractChangeLogCommand;
-import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.integrity.ExceptionHandler;
-import org.apache.maven.scm.provider.integrity.Sandbox;
-import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-
-import java.util.Date;
-
-/**
- * MKS Integrity implementation for Maven's AbstractChangeLogCommand
- * <br>Currently there is a limitation in the 'si rlog' command where changes
- * can't be limited to a normal/variant/build configuration. In other
- * words all revisions modified within the date range will be picked up
- * for the Change Log report. By default the Change Log is grouped by
- * Change Package ID. However, if no Change Package is found or Change
- * Packages are not in use, then all the changes are grouped in one big
- * Change Log Set
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityChangeLogCommand.java 1.3 2011/08/22 13:06:19EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityChangeLogCommand
- extends AbstractChangeLogCommand
-{
- /**
- * {@inheritDoc}
- */
- @Override
- public ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet,
- Date startDate, Date endDate, ScmBranch branch,
- String datePattern )
- throws ScmException
- {
- // First lets validate the date range provided
- if ( null == startDate || null == endDate )
- {
- throw new ScmException( "Both 'startDate' and 'endDate' must be specified!" );
- }
- if ( startDate.after( endDate ) )
- {
- throw new ScmException( "'stateDate' is not allowed to occur after 'endDate'!" );
- }
- getLogger().info(
- "Attempting to obtain change log for date range: '" + Sandbox.RLOG_DATEFORMAT.format( startDate ) + "' to '"
- + Sandbox.RLOG_DATEFORMAT.format( endDate ) + "'" );
- ChangeLogScmResult result;
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- try
- {
- result = new ChangeLogScmResult( iRepo.getSandbox().getChangeLog( startDate, endDate ),
- new ScmResult( "si rlog", "", "", true ) );
- }
- 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 ChangeLogScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
- }
-
- return result;
- }
-
-}
+package org.apache.maven.scm.provider.integrity.command.changelog;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.mks.api.response.APIException;
+import org.apache.maven.scm.ScmBranch;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.command.changelog.AbstractChangeLogCommand;
+import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.integrity.ExceptionHandler;
+import org.apache.maven.scm.provider.integrity.Sandbox;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+
+import java.util.Date;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractChangeLogCommand
+ * <br>Currently there is a limitation in the 'si rlog' command where changes
+ * can't be limited to a normal/variant/build configuration. In other
+ * words all revisions modified within the date range will be picked up
+ * for the Change Log report. By default the Change Log is grouped by
+ * Change Package ID. However, if no Change Package is found or Change
+ * Packages are not in use, then all the changes are grouped in one big
+ * Change Log Set
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityChangeLogCommand.java 1.3 2011/08/22 13:06:19EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityChangeLogCommand
+ extends AbstractChangeLogCommand
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+ Date startDate, Date endDate, ScmBranch branch,
+ String datePattern )
+ throws ScmException
+ {
+ // First lets validate the date range provided
+ if ( null == startDate || null == endDate )
+ {
+ throw new ScmException( "Both 'startDate' and 'endDate' must be specified!" );
+ }
+ if ( startDate.after( endDate ) )
+ {
+ throw new ScmException( "'stateDate' is not allowed to occur after 'endDate'!" );
+ }
+ getLogger().info(
+ "Attempting to obtain change log for date range: '" + Sandbox.RLOG_DATEFORMAT.format( startDate ) + "' to '"
+ + Sandbox.RLOG_DATEFORMAT.format( endDate ) + "'" );
+ ChangeLogScmResult result;
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ try
+ {
+ result = new ChangeLogScmResult( iRepo.getSandbox().getChangeLog( startDate, endDate ),
+ new ScmResult( "si rlog", "", "", true ) );
+ }
+ 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 ChangeLogScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
+ }
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommand.java
index 703f921..0bf6576 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommand.java
@@ -1,69 +1,69 @@
-package org.apache.maven.scm.provider.integrity.command.checkin;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.scm.ScmException;
-import org.apache.maven.scm.ScmFile;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmResult;
-import org.apache.maven.scm.ScmVersion;
-import org.apache.maven.scm.command.checkin.AbstractCheckInCommand;
-import org.apache.maven.scm.command.checkin.CheckInScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.integrity.Sandbox;
-import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-
-import java.util.List;
-
-/**
- * MKS Integrity implementation for Maven's AbstractCheckInCommand
- * <br>The check-in command will also drop any files that are missing from the working directory
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityCheckInCommand.java 1.3 2011/08/22 13:06:20EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityCheckInCommand
- extends AbstractCheckInCommand
-{
- /**
- * {@inheritDoc}
- */
- @Override
- public CheckInScmResult executeCheckInCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
- ScmVersion scmVersion )
- throws ScmException
- {
- getLogger().info( "Attempting to check-in updates from sandbox " + fileSet.getBasedir().getAbsolutePath() );
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- Sandbox siSandbox = iRepo.getSandbox();
- List<ScmFile> changedFiles = siSandbox.checkInUpdates( message );
- if ( siSandbox.getOverallCheckInSuccess() )
- {
- return new CheckInScmResult( "si ci/drop", changedFiles );
- }
- else
- {
- return new CheckInScmResult( changedFiles,
- new ScmResult( "si ci/drop", "There was a problem updating the repository", "",
- false ) );
- }
- }
-}
+package org.apache.maven.scm.provider.integrity.command.checkin;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmVersion;
+import org.apache.maven.scm.command.checkin.AbstractCheckInCommand;
+import org.apache.maven.scm.command.checkin.CheckInScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.integrity.Sandbox;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+
+import java.util.List;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractCheckInCommand
+ * <br>The check-in command will also drop any files that are missing from the working directory
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityCheckInCommand.java 1.3 2011/08/22 13:06:20EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityCheckInCommand
+ extends AbstractCheckInCommand
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CheckInScmResult executeCheckInCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
+ ScmVersion scmVersion )
+ throws ScmException
+ {
+ getLogger().info( "Attempting to check-in updates from sandbox " + fileSet.getBasedir().getAbsolutePath() );
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ Sandbox siSandbox = iRepo.getSandbox();
+ List<ScmFile> changedFiles = siSandbox.checkInUpdates( message );
+ if ( siSandbox.getOverallCheckInSuccess() )
+ {
+ return new CheckInScmResult( "si ci/drop", changedFiles );
+ }
+ else
+ {
+ return new CheckInScmResult( changedFiles,
+ new ScmResult( "si ci/drop", "There was a problem updating the repository", "",
+ false ) );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommand.java
index 23bdcd6..fd148fb 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommand.java
@@ -1,120 +1,120 @@
-package org.apache.maven.scm.provider.integrity.command.checkout;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-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.ScmFileSet;
-import org.apache.maven.scm.ScmVersion;
-import org.apache.maven.scm.command.checkout.AbstractCheckOutCommand;
-import org.apache.maven.scm.command.checkout.CheckOutScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.integrity.ExceptionHandler;
-import org.apache.maven.scm.provider.integrity.Sandbox;
-import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-
-/**
- * MKS Integrity implementation for Maven's AbstractCheckOutCommand
- * <br>The Checkout command will create a fresh sandbox in the checkoutDirectory
- * <br>Since, Maven deletes the prior checkout folder, this command will check
- * for a prior sandbox in the checkout directory and if a sandbox was found,
- * then the command will resynchronize the sandbox.
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityCheckOutCommand.java 1.3 2011/08/22 13:06:21EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityCheckOutCommand
- extends AbstractCheckOutCommand
-{
- /**
- * Overridden function that performs a checkout (resynchronize) operation against an MKS Source Project
- * This function ignores the scmVerion and recursive arguments passed into this function as while there is
- * a suitable equivalent to checkout/resynchronize by label/revision, it doesn't make sense for the way
- * Maven seems to want to execute this command. Hence we will create/resynchronize a sandbox, which will
- * be recursive in nature. If the user chooses to checkout a specific versioned configuration (checkpoint),
- * then that information will be contained in the Configuration Path obtained from the IntegrityScmProviderRepository
- */
- @Override
- public CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repository, ScmFileSet fileSet,
- ScmVersion scmVersion, boolean recursive )
- throws ScmException
- {
- CheckOutScmResult result;
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- try
- {
- getLogger().info(
- "Attempting to checkout source for project " + iRepo.getProject().getConfigurationPath() );
- String checkoutDir = System.getProperty( "checkoutDirectory" );
- // Override the sandbox definition, if a checkout directory is specified for this command
- Sandbox siSandbox;
- if ( null != checkoutDir && checkoutDir.length() > 0 )
- {
- siSandbox = new Sandbox( iRepo.getAPISession(), iRepo.getProject(), checkoutDir );
- iRepo.setSandbox( siSandbox );
- }
- else
- {
- siSandbox = iRepo.getSandbox();
- }
- getLogger().info( "Sandbox location is " + siSandbox.getSandboxDir() );
- // Now attempt to create the sandbox, if it doesn't already exist
- if ( siSandbox.create() )
- {
- // Resynchronize the new or previously created sandbox
- Response res = siSandbox.resync();
- // Lets output what we got from running this command
- 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() : "" ) );
- }
- }
- int exitCode = res.getExitCode();
- boolean success = ( exitCode == 0 ? true : false );
- result = new CheckOutScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
- }
- else
- {
- result = new CheckOutScmResult( "si createsandbox", "Failed to create sandbox!", "", 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 CheckOutScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
- }
-
- return result;
- }
-
-}
+package org.apache.maven.scm.provider.integrity.command.checkout;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+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.ScmFileSet;
+import org.apache.maven.scm.ScmVersion;
+import org.apache.maven.scm.command.checkout.AbstractCheckOutCommand;
+import org.apache.maven.scm.command.checkout.CheckOutScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.integrity.ExceptionHandler;
+import org.apache.maven.scm.provider.integrity.Sandbox;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractCheckOutCommand
+ * <br>The Checkout command will create a fresh sandbox in the checkoutDirectory
+ * <br>Since, Maven deletes the prior checkout folder, this command will check
+ * for a prior sandbox in the checkout directory and if a sandbox was found,
+ * then the command will resynchronize the sandbox.
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityCheckOutCommand.java 1.3 2011/08/22 13:06:21EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityCheckOutCommand
+ extends AbstractCheckOutCommand
+{
+ /**
+ * Overridden function that performs a checkout (resynchronize) operation against an MKS Source Project
+ * This function ignores the scmVerion and recursive arguments passed into this function as while there is
+ * a suitable equivalent to checkout/resynchronize by label/revision, it doesn't make sense for the way
+ * Maven seems to want to execute this command. Hence we will create/resynchronize a sandbox, which will
+ * be recursive in nature. If the user chooses to checkout a specific versioned configuration (checkpoint),
+ * then that information will be contained in the Configuration Path obtained from the IntegrityScmProviderRepository
+ */
+ @Override
+ public CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+ ScmVersion scmVersion, boolean recursive )
+ throws ScmException
+ {
+ CheckOutScmResult result;
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ try
+ {
+ getLogger().info(
+ "Attempting to checkout source for project " + iRepo.getProject().getConfigurationPath() );
+ String checkoutDir = System.getProperty( "checkoutDirectory" );
+ // Override the sandbox definition, if a checkout directory is specified for this command
+ Sandbox siSandbox;
+ if ( null != checkoutDir && checkoutDir.length() > 0 )
+ {
+ siSandbox = new Sandbox( iRepo.getAPISession(), iRepo.getProject(), checkoutDir );
+ iRepo.setSandbox( siSandbox );
+ }
+ else
+ {
+ siSandbox = iRepo.getSandbox();
+ }
+ getLogger().info( "Sandbox location is " + siSandbox.getSandboxDir() );
+ // Now attempt to create the sandbox, if it doesn't already exist
+ if ( siSandbox.create() )
+ {
+ // Resynchronize the new or previously created sandbox
+ Response res = siSandbox.resync();
+ // Lets output what we got from running this command
+ 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() : "" ) );
+ }
+ }
+ int exitCode = res.getExitCode();
+ boolean success = ( exitCode == 0 ? true : false );
+ result = new CheckOutScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
+ }
+ else
+ {
+ result = new CheckOutScmResult( "si createsandbox", "Failed to create sandbox!", "", 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 CheckOutScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
+ }
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffCommand.java
index e9a4d6e..0066f90 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffCommand.java
@@ -1,103 +1,103 @@
-package org.apache.maven.scm.provider.integrity.command.diff;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.scm.ScmException;
-import org.apache.maven.scm.ScmFile;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmResult;
-import org.apache.maven.scm.ScmVersion;
-import org.apache.maven.scm.command.diff.AbstractDiffCommand;
-import org.apache.maven.scm.command.diff.DiffScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.integrity.APISession;
-import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-import org.codehaus.plexus.util.cli.CommandLineException;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * MKS Integrity implementation for Maven's AbstractDiffCommand
- * <br>Since MKS Integrity doesn't have a notion of arbitrarily differencing
- * by a revision across the sandbox, this command will difference the
- * current Sandbox working file against the server version.
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityDiffCommand.java 1.4 2011/08/24 10:29:08EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityDiffCommand
- extends AbstractDiffCommand
-{
- /**
- * Since we can't arbitrarily apply the same start and end revisions to all files in the sandbox,
- * this command will be adapted to show differences between the local version and the repository
- */
- @Override
- public DiffScmResult executeDiffCommand( ScmProviderRepository repository, ScmFileSet fileSet,
- ScmVersion startRevision, ScmVersion endRevision )
- throws ScmException
- {
- DiffScmResult result;
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- APISession api = iRepo.getAPISession();
- getLogger().info( "Showing differences bettween local files in " + fileSet.getBasedir().getAbsolutePath()
- + " and server project " + iRepo.getConfigruationPath() );
-
- // Since the si diff command is not completely API ready, we will use the CLI for this command
- Commandline shell = new Commandline();
- shell.setWorkingDirectory( fileSet.getBasedir() );
- shell.setExecutable( "si" );
- shell.createArg().setValue( "diff" );
- shell.createArg().setValue( "--hostname=" + api.getHostName() );
- shell.createArg().setValue( "--port=" + api.getPort() );
- shell.createArg().setValue( "--user=" + api.getUserName() );
- shell.createArg().setValue( "-R" );
- shell.createArg().setValue( "--filter=changed:all" );
- shell.createArg().setValue( "--filter=format:text" );
- IntegrityDiffConsumer shellConsumer = new IntegrityDiffConsumer( getLogger() );
-
- try
- {
- getLogger().debug( "Executing: " + shell.getCommandline() );
- int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer,
- new CommandLineUtils.StringStreamConsumer() );
- boolean success = ( exitCode == 128 ? false : true );
- ScmResult scmResult =
- new ScmResult( shell.getCommandline().toString(), "", "Exit Code: " + exitCode, success );
- // Since we can't really parse the differences output, we'll just have to go by the command output
- // Returning a DiffScmResult(List changedFiles, Map differences, String patch, ScmResult result) to avoid an NPE
- // in org.codehaus.plexus.util.FileUtils.fileWrite(FileUtils.java:426)
- return new DiffScmResult( new ArrayList<ScmFile>(), new HashMap<String, CharSequence>(), "", scmResult );
-
- }
- catch ( CommandLineException cle )
- {
- getLogger().error( "Command Line Exception: " + cle.getMessage() );
- result = new DiffScmResult( shell.getCommandline().toString(), cle.getMessage(), "", false );
- }
-
- return result;
- }
-
-}
+package org.apache.maven.scm.provider.integrity.command.diff;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmVersion;
+import org.apache.maven.scm.command.diff.AbstractDiffCommand;
+import org.apache.maven.scm.command.diff.DiffScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.integrity.APISession;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractDiffCommand
+ * <br>Since MKS Integrity doesn't have a notion of arbitrarily differencing
+ * by a revision across the sandbox, this command will difference the
+ * current Sandbox working file against the server version.
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityDiffCommand.java 1.4 2011/08/24 10:29:08EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityDiffCommand
+ extends AbstractDiffCommand
+{
+ /**
+ * Since we can't arbitrarily apply the same start and end revisions to all files in the sandbox,
+ * this command will be adapted to show differences between the local version and the repository
+ */
+ @Override
+ public DiffScmResult executeDiffCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+ ScmVersion startRevision, ScmVersion endRevision )
+ throws ScmException
+ {
+ DiffScmResult result;
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ APISession api = iRepo.getAPISession();
+ getLogger().info( "Showing differences bettween local files in " + fileSet.getBasedir().getAbsolutePath()
+ + " and server project " + iRepo.getConfigruationPath() );
+
+ // Since the si diff command is not completely API ready, we will use the CLI for this command
+ Commandline shell = new Commandline();
+ shell.setWorkingDirectory( fileSet.getBasedir() );
+ shell.setExecutable( "si" );
+ shell.createArg().setValue( "diff" );
+ shell.createArg().setValue( "--hostname=" + api.getHostName() );
+ shell.createArg().setValue( "--port=" + api.getPort() );
+ shell.createArg().setValue( "--user=" + api.getUserName() );
+ shell.createArg().setValue( "-R" );
+ shell.createArg().setValue( "--filter=changed:all" );
+ shell.createArg().setValue( "--filter=format:text" );
+ IntegrityDiffConsumer shellConsumer = new IntegrityDiffConsumer( getLogger() );
+
+ try
+ {
+ getLogger().debug( "Executing: " + shell.getCommandline() );
+ int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer,
+ new CommandLineUtils.StringStreamConsumer() );
+ boolean success = ( exitCode == 128 ? false : true );
+ ScmResult scmResult =
+ new ScmResult( shell.getCommandline().toString(), "", "Exit Code: " + exitCode, success );
+ // Since we can't really parse the differences output, we'll just have to go by the command output
+ // Returning a DiffScmResult(List changedFiles, Map differences, String patch, ScmResult result) to avoid an NPE
+ // in org.codehaus.plexus.util.FileUtils.fileWrite(FileUtils.java:426)
+ return new DiffScmResult( new ArrayList<ScmFile>(), new HashMap<String, CharSequence>(), "", scmResult );
+
+ }
+ catch ( CommandLineException cle )
+ {
+ getLogger().error( "Command Line Exception: " + cle.getMessage() );
+ result = new DiffScmResult( shell.getCommandline().toString(), cle.getMessage(), "", false );
+ }
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffConsumer.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffConsumer.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffConsumer.java
index 409d789..f43053d 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffConsumer.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/diff/IntegrityDiffConsumer.java
@@ -1,53 +1,53 @@
-package org.apache.maven.scm.provider.integrity.command.diff;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.scm.log.ScmLogger;
-import org.codehaus.plexus.util.cli.StreamConsumer;
-
-/**
- * Helper class to consume the standard output from running the IntegrityDiffCommand
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityDiffConsumer.java 1.2 2011/08/22 13:06:24EDT Cletus D'Souza (dsouza) Exp $
- */
-public class IntegrityDiffConsumer
- implements StreamConsumer
-{
- private ScmLogger logger;
-
- /**
- * IntegrityDiffConsumer constructor requires a ScmLogger object to log all activity
- *
- * @param logger ScmLogger object
- */
- public IntegrityDiffConsumer( ScmLogger logger )
- {
- this.logger = logger;
- }
-
- /**
- * {@inheritDoc}
- */
- public void consumeLine( String line )
- {
- logger.info( line );
- }
-}
+package org.apache.maven.scm.provider.integrity.command.diff;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Helper class to consume the standard output from running the IntegrityDiffCommand
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityDiffConsumer.java 1.2 2011/08/22 13:06:24EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityDiffConsumer
+ implements StreamConsumer
+{
+ private ScmLogger logger;
+
+ /**
+ * IntegrityDiffConsumer constructor requires a ScmLogger object to log all activity
+ *
+ * @param logger ScmLogger object
+ */
+ public IntegrityDiffConsumer( ScmLogger logger )
+ {
+ this.logger = logger;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void consumeLine( String line )
+ {
+ logger.info( line );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/edit/IntegrityEditCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/edit/IntegrityEditCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/edit/IntegrityEditCommand.java
index 0c14905..7927d64 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/edit/IntegrityEditCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/edit/IntegrityEditCommand.java
@@ -1,74 +1,74 @@
-package org.apache.maven.scm.provider.integrity.command.edit;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * 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.edit.AbstractEditCommand;
-import org.apache.maven.scm.command.edit.EditScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.integrity.ExceptionHandler;
-import org.apache.maven.scm.provider.integrity.Sandbox;
-import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-
-/**
- * MKS Integrity implementation for Maven's AbstractEditCommand
- * <br>Since it does not make sense to lock all files in the Sandbox,
- * this command will make all of the working files writable in the Sandbox
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityEditCommand.java 1.3 2011/08/22 13:06:25EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityEditCommand
- extends AbstractEditCommand
-{
- /**
- * {@inheritDoc}
- */
- @Override
- public EditScmResult executeEditCommand( ScmProviderRepository repository, ScmFileSet fileSet )
- throws ScmException
- {
- getLogger().info( "Attempting make files writeable in Sandbox " + fileSet.getBasedir().getAbsolutePath() );
- EditScmResult result;
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- try
- {
- Sandbox siSandbox = iRepo.getSandbox();
- Response res = siSandbox.makeWriteable();
- int exitCode = res.getExitCode();
- boolean success = ( exitCode == 0 ? true : false );
- result = new EditScmResult( 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 EditScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
- }
-
- return result;
- }
-
-}
+package org.apache.maven.scm.provider.integrity.command.edit;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * 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.edit.AbstractEditCommand;
+import org.apache.maven.scm.command.edit.EditScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.integrity.ExceptionHandler;
+import org.apache.maven.scm.provider.integrity.Sandbox;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractEditCommand
+ * <br>Since it does not make sense to lock all files in the Sandbox,
+ * this command will make all of the working files writable in the Sandbox
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityEditCommand.java 1.3 2011/08/22 13:06:25EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityEditCommand
+ extends AbstractEditCommand
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EditScmResult executeEditCommand( ScmProviderRepository repository, ScmFileSet fileSet )
+ throws ScmException
+ {
+ getLogger().info( "Attempting make files writeable in Sandbox " + fileSet.getBasedir().getAbsolutePath() );
+ EditScmResult result;
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ try
+ {
+ Sandbox siSandbox = iRepo.getSandbox();
+ Response res = siSandbox.makeWriteable();
+ int exitCode = res.getExitCode();
+ boolean success = ( exitCode == 0 ? true : false );
+ result = new EditScmResult( 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 EditScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
+ }
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/8ad9801d/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommand.java b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommand.java
index 6de01cc..2aaa045 100644
--- a/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommand.java
+++ b/maven-scm-providers/maven-scm-provider-integrity/src/main/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommand.java
@@ -1,120 +1,120 @@
-package org.apache.maven.scm.provider.integrity.command.export;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import com.mks.api.response.APIException;
-import org.apache.maven.scm.ScmException;
-import org.apache.maven.scm.ScmFile;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmFileStatus;
-import org.apache.maven.scm.ScmVersion;
-import org.apache.maven.scm.command.export.AbstractExportCommand;
-import org.apache.maven.scm.command.export.ExportScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.integrity.ExceptionHandler;
-import org.apache.maven.scm.provider.integrity.Member;
-import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * MKS Integrity implementation for Maven's AbstractExportCommand
- * <br>Since the IntegrityCheckoutCommand creates a fresh Sandbox in the checkoutDirectory,
- * it does not make sense for the IntegrityExportCommand to essentially do the same thing.
- * <br>Hence, this command does not create a Sandbox, instead the entire project contents
- * are exported to the exportDirectory using the 'si projectco' command.
- * <br>This gives the user the option of exporting a fresh copy of the repository void of
- * any project.pj files
- *
- * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
- * @version $Id: IntegrityExportCommand.java 1.3 2011/08/22 13:06:26EDT Cletus D'Souza (dsouza) Exp $
- * @since 1.6
- */
-public class IntegrityExportCommand
- extends AbstractExportCommand
-{
- /**
- * {@inheritDoc}
- */
- @Override
- public ExportScmResult executeExportCommand( ScmProviderRepository repository, ScmFileSet fileSet,
- ScmVersion scmVersion, String outputDirectory )
- throws ScmException
- {
- // First lets figure out where we need to export files to...
- String exportDir = outputDirectory;
- exportDir =
- ( ( null != exportDir && exportDir.length() > 0 ) ? exportDir : fileSet.getBasedir().getAbsolutePath() );
- // Let the user know where we're going to be exporting the files...
- getLogger().info( "Attempting to export files to " + exportDir );
- ExportScmResult result;
- IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
- try
- {
- // Lets set our overall export success flag
- boolean exportSuccess = true;
- // Perform a fresh checkout of each file in the member list...
- List<Member> projectMembers = iRepo.getProject().listFiles( exportDir );
- // Initialize the list of files we actually exported...
- List<ScmFile> scmFileList = new ArrayList<ScmFile>();
- for ( Iterator<Member> it = projectMembers.iterator(); it.hasNext(); )
- {
- Member siMember = it.next();
- try
- {
- getLogger().info( "Attempting to export file: " + siMember.getTargetFilePath() + " at revision "
- + siMember.getRevision() );
- siMember.checkout( iRepo.getAPISession() );
- scmFileList.add( new ScmFile( siMember.getTargetFilePath(), ScmFileStatus.UNKNOWN ) );
- }
- catch ( APIException ae )
- {
- exportSuccess = false;
- ExceptionHandler eh = new ExceptionHandler( ae );
- getLogger().error( "MKS API Exception: " + eh.getMessage() );
- getLogger().debug( eh.getCommand() + " exited with return code " + eh.getExitCode() );
- }
- }
- // Lets advice the user that we've checked out all the members
- getLogger().info(
- "Exported " + scmFileList.size() + " files out of a total of " + projectMembers.size() + " files!" );
- if ( exportSuccess )
- {
- result = new ExportScmResult( "si co", scmFileList );
- }
- else
- {
- result = new ExportScmResult( "si co", "Failed to export all files!", "", exportSuccess );
- }
- }
- 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 ExportScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
- }
-
- return result;
- }
-
-}
+package org.apache.maven.scm.provider.integrity.command.export;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.mks.api.response.APIException;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmVersion;
+import org.apache.maven.scm.command.export.AbstractExportCommand;
+import org.apache.maven.scm.command.export.ExportScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.integrity.ExceptionHandler;
+import org.apache.maven.scm.provider.integrity.Member;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * MKS Integrity implementation for Maven's AbstractExportCommand
+ * <br>Since the IntegrityCheckoutCommand creates a fresh Sandbox in the checkoutDirectory,
+ * it does not make sense for the IntegrityExportCommand to essentially do the same thing.
+ * <br>Hence, this command does not create a Sandbox, instead the entire project contents
+ * are exported to the exportDirectory using the 'si projectco' command.
+ * <br>This gives the user the option of exporting a fresh copy of the repository void of
+ * any project.pj files
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityExportCommand.java 1.3 2011/08/22 13:06:26EDT Cletus D'Souza (dsouza) Exp $
+ * @since 1.6
+ */
+public class IntegrityExportCommand
+ extends AbstractExportCommand
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExportScmResult executeExportCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+ ScmVersion scmVersion, String outputDirectory )
+ throws ScmException
+ {
+ // First lets figure out where we need to export files to...
+ String exportDir = outputDirectory;
+ exportDir =
+ ( ( null != exportDir && exportDir.length() > 0 ) ? exportDir : fileSet.getBasedir().getAbsolutePath() );
+ // Let the user know where we're going to be exporting the files...
+ getLogger().info( "Attempting to export files to " + exportDir );
+ ExportScmResult result;
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
+ try
+ {
+ // Lets set our overall export success flag
+ boolean exportSuccess = true;
+ // Perform a fresh checkout of each file in the member list...
+ List<Member> projectMembers = iRepo.getProject().listFiles( exportDir );
+ // Initialize the list of files we actually exported...
+ List<ScmFile> scmFileList = new ArrayList<ScmFile>();
+ for ( Iterator<Member> it = projectMembers.iterator(); it.hasNext(); )
+ {
+ Member siMember = it.next();
+ try
+ {
+ getLogger().info( "Attempting to export file: " + siMember.getTargetFilePath() + " at revision "
+ + siMember.getRevision() );
+ siMember.checkout( iRepo.getAPISession() );
+ scmFileList.add( new ScmFile( siMember.getTargetFilePath(), ScmFileStatus.UNKNOWN ) );
+ }
+ catch ( APIException ae )
+ {
+ exportSuccess = false;
+ ExceptionHandler eh = new ExceptionHandler( ae );
+ getLogger().error( "MKS API Exception: " + eh.getMessage() );
+ getLogger().debug( eh.getCommand() + " exited with return code " + eh.getExitCode() );
+ }
+ }
+ // Lets advice the user that we've checked out all the members
+ getLogger().info(
+ "Exported " + scmFileList.size() + " files out of a total of " + projectMembers.size() + " files!" );
+ if ( exportSuccess )
+ {
+ result = new ExportScmResult( "si co", scmFileList );
+ }
+ else
+ {
+ result = new ExportScmResult( "si co", "Failed to export all files!", "", exportSuccess );
+ }
+ }
+ 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 ExportScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
+ }
+
+ return result;
+ }
+
+}