org.openscm.kundo.plugins.InstallDeployDelegate.groovy Maven / Gradle / Ivy
package org.openscm.kundo.plugins
/*
* Copyright (C) 2008 The Ultimate People Company Ltd ("UPCO").
*
* Licensed 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.openscm.kundo.plugins.context.BuildContext
import org.openscm.kundo.common.logging.SimpleLogger
/**
* Install Artifact Delegate
* @author Ben Leedham
* @version 1.0.0
*
* Description: Delegate to populate either a local or remote repository with an artifact or pom
*
* The install deploy delegate will install or deploy an artifact or a pom depending on which target is called.
*
* doInstallArtifact: Installs an artifact to your local dependency cache.
* doInstallPom: Installs a pom file to your local dependency cache.
* doDeployArtifact: Deploys an artifact to a remote repository specified in either a pom or a settings file.
* doDeployPom: Deploys a pom to a remote repository specified in either a pom or a settings file.
*
*
*/
/*
* @ant-target doInstallArtifact doInstallPom doDeployArtifact doDeployPom
*/
class InstallDeployDelegate extends AbstractDependenciesDelegate {
/**
* Constructor
* @param ant AntBuilder instance
* @param buildContext BuildContext instance
*/
InstallDeployDelegate( AntBuilder ant, BuildContext buildContext ){
super( ant, buildContext)
}
/*
* A property to decide if install or deploy should be used
*/
protected String method
/*
* A property to decide what should be installed artifact or pom
*/
protected String type
/**
* Setter method for member variable method
* @param method String representation of the method to use install/deploy
*/
void setMethod( String method ){
this.method = method
}
/**
* Setter method for member variable type
* @param type String representation of the artifact type pom/artifact
*/
void setType( String type ){
this.type = type
}
/**
* delegate implementation method to be called by doExecute
*
*/
void doInstallDeploy(){
if( log.isDebugEnabled() ){
log.debug( "Entering -InstallDeployDelegate.doInstallDeploy( )" )
}
this.pomLocation = buildContext.get( "pom.location" )
if( log.isDebugEnabled() ){
log.debug("pomLocation : $pomLocation")
log.debug("method : $method")
}
if( type.equals( "pom" ) ){
installDeploy( "", pomLocation, method )
}else if( type.equals( "artifact" ) ){
def artifactLocation = buildContext.get( "artifact.location" )
if( log.isDebugEnabled() )
log.debug("artifactLocation : $artifactLocation")
installDeploy( artifactLocation, pomLocation, method )
}
if( log.isDebugEnabled() ){
log.debug( "Exiting -InstallDeployDelegate.doInstallDeploy( )" )
}
}
/**
* Concrete implementation of the AbstractPluginTargetDelegate.execute() method
*/
void doExecute(){
doInstallDeploy()
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy