001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.scm.command.untag; 020 021import org.apache.maven.scm.CommandParameter; 022import org.apache.maven.scm.CommandParameters; 023import org.apache.maven.scm.ScmException; 024import org.apache.maven.scm.ScmFileSet; 025import org.apache.maven.scm.ScmResult; 026import org.apache.maven.scm.ScmUntagParameters; 027import org.apache.maven.scm.command.AbstractCommand; 028import org.apache.maven.scm.provider.ScmProviderRepository; 029 030/** {@inheritDoc} */ 031public abstract class AbstractUntagCommand extends AbstractCommand { 032 /** 033 * execute untag command 034 * 035 * @param repository scm repo 036 * @param fileSet set of files (unused) 037 * @param scmUntagParameters parameters used by untag implementations 038 * @return result of untag command 039 * @throws ScmException in case of error 040 */ 041 protected abstract ScmResult executeUntagCommand( 042 ScmProviderRepository repository, ScmFileSet fileSet, ScmUntagParameters scmUntagParameters) 043 throws ScmException; 044 045 /** {@inheritDoc} */ 046 @Override 047 public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) 048 throws ScmException { 049 String tagName = parameters.getString(CommandParameter.TAG_NAME); 050 String message = parameters.getString(CommandParameter.MESSAGE, "[maven-scm] remove tag " + tagName); 051 ScmUntagParameters scmUntagParameters = new ScmUntagParameters(tagName, message); 052 053 return executeUntagCommand(repository, fileSet, scmUntagParameters); 054 } 055}