All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.mojo.was6.WsInstallAppMojo Maven / Gradle / Ivy

Go to download

Tools for working with IBM WebSphere 6.0.x and 6.1.x. This plugin works along with an installation of WebSphere Application Server or Process Server - standalone or ND installation, to provide automated tasks for: generating RMIC stubs, starting/stopping servers, installing/updating/uninstalling EARs to application servers, run serviceDeploy and run arbitrary scripts with wsadmin.

There is a newer version: 1.2.1
Show newest version
package org.codehaus.mojo.was6;

import java.io.File;

import org.apache.maven.plugin.MojoExecutionException;
import org.dom4j.Document;

/**
 * Installs an EAR into WebSphere Application Server.
 * 
 * @goal installApp
 * @author David J. M. Karlsen
 */
public class WsInstallAppMojo
    extends AbstractAppMojo
{
    /**
     * Flag for updating existing application or installing a brand new.
     * 
     * @parameter expression="${was6.updateExisting}" default-value="true"
     */
    private boolean updateExisting;

    /**
     * Name of target cluster to deploy to.
     * 
     * @parameter expression="${was6.targetCluster}"
     */
    private String targetCluster;
    
    /**
     * The target cell for deployment.
     * @parameter expression="${was6.targetCell}"
     */
    private String targetCell;
    
    /**
     * The target node for deployment.
     * @parameter expression="${was6.targetNode}"
     */
    private String targetNode;
    
    /**
     * The target server for deployment.
     * @parameter expression="${was6.targetServer}"
     */
    private String targetServer;

    /**
     * EAR archive to deploy.
     * 
     * @parameter expression="${was6.earFile}" default-value="${project.artifact.file}"
     */
    private File earFile;

    /**
     * {@inheritDoc}
     */
    protected String getTaskName()
    {
        return "wsInstallApp";
    }

    /**
     * {@inheritDoc}
     */
    protected void configureBuildScript( Document document )
        throws MojoExecutionException
    {
        super.configureBuildScript( document );

        if ( earFile == null ) {
            throw new MojoExecutionException( "Earfile not specified" );
        }
        if ( !earFile.canRead() )
        {
            throw new MojoExecutionException( "Bad archive: " + earFile.getAbsolutePath() );
        }
        configureTaskAttribute( document, "ear", earFile.getAbsolutePath() );

        StringBuffer options = new StringBuffer();

        options.append( "-appname " ).append( applicationName );

        if ( updateExisting )
        {
            options.append( " -update" );
        }

        if ( targetCluster != null )
        {
            options.append( " -cluster " ).append( targetCluster );
        }
        
        if ( targetCell != null )
        {
            options.append( " -cell " ).append( targetCell );
        }
        
        if ( targetNode != null )
        {
            options.append( " -node " ).append( targetNode );
        }
        
        if ( targetServer != null )
        {
            options.append( " -server " ).append( targetServer );
        }

        configureTaskAttribute( document, "options", options );
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy