001package 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 022import org.apache.maven.scm.ScmException; 023import org.apache.maven.scm.ScmFile; 024import org.apache.maven.scm.ScmFileSet; 025import org.apache.maven.scm.ScmResult; 026import org.apache.maven.scm.ScmVersion; 027import org.apache.maven.scm.command.checkin.AbstractCheckInCommand; 028import org.apache.maven.scm.command.checkin.CheckInScmResult; 029import org.apache.maven.scm.provider.ScmProviderRepository; 030import org.apache.maven.scm.provider.integrity.Sandbox; 031import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository; 032 033import 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 * @since 1.6 041 */ 042public class IntegrityCheckInCommand 043 extends AbstractCheckInCommand 044{ 045 /** 046 * {@inheritDoc} 047 */ 048 @Override 049 public CheckInScmResult executeCheckInCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message, 050 ScmVersion scmVersion ) 051 throws ScmException 052 { 053 getLogger().info( "Attempting to check-in updates from sandbox " + fileSet.getBasedir().getAbsolutePath() ); 054 IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository; 055 Sandbox siSandbox = iRepo.getSandbox(); 056 List<ScmFile> changedFiles = siSandbox.checkInUpdates( message ); 057 if ( siSandbox.getOverallCheckInSuccess() ) 058 { 059 return new CheckInScmResult( "si ci/drop", changedFiles ); 060 } 061 else 062 { 063 return new CheckInScmResult( changedFiles, 064 new ScmResult( "si ci/drop", "There was a problem updating the repository", "", 065 false ) ); 066 } 067 } 068}