001 package org.apache.maven.scm.provider.integrity.command.checkin;
002
003 /**
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022 import org.apache.maven.scm.ScmException;
023 import org.apache.maven.scm.ScmFile;
024 import org.apache.maven.scm.ScmFileSet;
025 import org.apache.maven.scm.ScmResult;
026 import org.apache.maven.scm.ScmVersion;
027 import org.apache.maven.scm.command.checkin.AbstractCheckInCommand;
028 import org.apache.maven.scm.command.checkin.CheckInScmResult;
029 import org.apache.maven.scm.provider.ScmProviderRepository;
030 import org.apache.maven.scm.provider.integrity.Sandbox;
031 import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
032
033 import java.util.List;
034
035 /**
036 * MKS Integrity implementation for Maven's AbstractCheckInCommand
037 * <br>The check-in command will also drop any files that are missing from the working directory
038 *
039 * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
040 * @version $Id: IntegrityCheckInCommand.java 1.3 2011/08/22 13:06:20EDT Cletus D'Souza (dsouza) Exp $
041 * @since 1.6
042 */
043 public class IntegrityCheckInCommand
044 extends AbstractCheckInCommand
045 {
046 /**
047 * {@inheritDoc}
048 */
049 @Override
050 public CheckInScmResult executeCheckInCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
051 ScmVersion scmVersion )
052 throws ScmException
053 {
054 getLogger().info( "Attempting to check-in updates from sandbox " + fileSet.getBasedir().getAbsolutePath() );
055 IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
056 Sandbox siSandbox = iRepo.getSandbox();
057 List<ScmFile> changedFiles = siSandbox.checkInUpdates( message );
058 if ( siSandbox.getOverallCheckInSuccess() )
059 {
060 return new CheckInScmResult( "si ci/drop", changedFiles );
061 }
062 else
063 {
064 return new CheckInScmResult( changedFiles,
065 new ScmResult( "si ci/drop", "There was a problem updating the repository", "",
066 false ) );
067 }
068 }
069 }