001package org.apache.maven.scm.provider.cvslib.command.status;
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.ScmFileSet;
024import org.apache.maven.scm.command.status.AbstractStatusCommand;
025import org.apache.maven.scm.command.status.StatusScmResult;
026import org.apache.maven.scm.provider.ScmProviderRepository;
027import org.apache.maven.scm.provider.cvslib.command.CvsCommand;
028import org.apache.maven.scm.provider.cvslib.command.CvsCommandUtils;
029import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
030import org.codehaus.plexus.util.cli.Commandline;
031
032/**
033 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
034 *
035 */
036public abstract class AbstractCvsStatusCommand
037    extends AbstractStatusCommand
038    implements CvsCommand
039{
040    /** {@inheritDoc} */
041    protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet )
042        throws ScmException
043    {
044        CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
045
046        Commandline cl = CvsCommandUtils.getBaseCommand( "update", repository, fileSet, "-n" );
047
048        cl.createArg().setValue( "-d" );
049
050        if ( getLogger().isInfoEnabled() )
051        {
052            getLogger().info( "Executing: " + cl );
053            getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
054        }
055
056        return executeCvsCommand( cl );
057    }
058
059    protected abstract StatusScmResult executeCvsCommand( Commandline cl )
060        throws ScmException;
061}