org.codehaus.mojo.weblogic.WsdlGenMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weblogic-maven-plugin Show documentation
Show all versions of weblogic-maven-plugin Show documentation
This plugin will support various tasks within the Weblogic 8.1,
9.x, 10.x and 12.x environment. This version starts to support weblogic 10 and
11. The mojo supports such tasks as deploy,
undeploy,clientgen,servicegen, and appc are supported as well as
many others. The plugin uses exposed API's that are subject to
change but have been tested in 8.1 SP 4-6 and 9.0 - 9.2 MP3, 10.x.
There are two versions of the plugin to support the two
environments based on differences in the JDK. The 9.x version is
currently being refactored to support the standard JSR supported
deployment interface. The code used in the plugin has been
contributed to the Cargo project however to date has not be
integrated into the codebase. Please feel free to suggest
improvements or help support this plugin effort.
The newest version!
package org.codehaus.mojo.weblogic;
/*
* Copyright 2008 The Apache Software Foundation.
*
* 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.apache.maven.plugin.MojoExecutionException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
import org.codehaus.mojo.weblogic.util.WeblogicMojoUtilities;
import weblogic.ant.taskdefs.webservices.wsdlgen.WSDLGen;
import java.io.File;
/**
* This class generates wsdl from ear/war package
*
* @author Jon Osborn
* @version $Id: WsdlGenMojo.java 17525 2012-09-16 13:39:50Z jonnio $
* @description Run wsdlgen on an ear.
* @goal wsdlgen
* @requiresDependencyResolution compile
*/
public class WsdlGenMojo
extends AbstractWeblogicMojo
{
/**
* The service name to generate the wsdl for
*
* @parameter
* @required
*/
private String serviceName;
/**
* The war name inside of the ear that contains the services
*
* @parameter
* @required
*/
private String warName;
/**
* The wsdl file to output when complete.
*
* @parameter expression="${project.build.directory}/${project.build.finalName}.wsdl"
*/
private String wsdlFile;
/**
* The default endpoint address
*
* @parameter default-value="http://localhost:7001/"
*/
private String defaultEndpoint;
/**
* The input ear file to use with the wsdl gen. If this is null the service
* will look in the dependencies for an ear file to use
*/
private String earFileName;
/**
* Set to false to not overwrite existing resources.
*
* @parameter default-value="true"
*/
private boolean overwrite;
/**
* Execute the wsdlgen step to leave the artifacts around
*/
public void execute()
throws MojoExecutionException
{
super.execute();
if ( getLog().isInfoEnabled() )
{
getLog().info( "Weblogic wsdl gen beginning " );
}
File earFile;
if ( this.earFileName == null )
{
earFile = WeblogicMojoUtilities.getEarFileName( getArtifacts() );
}
else
{
earFile = new File( this.earFileName );
}
final String classPath = WeblogicMojoUtilities
.getDependencies( getArtifacts() );
if ( getLog().isInfoEnabled() )
{
getLog().info( "Weblogic wsdl gen for ear " + earFile );
}
try
{
final WSDLGen wsdl = new WSDLGen();
final Project antProject = new Project();
antProject.setName( "wsdlgen" );
wsdl.setProject( antProject );
wsdl.setClasspath( new Path( antProject, classPath ) );
wsdl.setEar( earFile );
wsdl.setWarName( this.warName );
final File wsdlFileFile = new File( this.wsdlFile );
wsdl.setWsdlFile( wsdlFileFile );
wsdl.setServiceName( this.serviceName );
wsdl.execute();
}
catch ( Exception ex )
{
getLog().error( "Exception encountered during WSDLGen processing ", ex );
throw new MojoExecutionException( "Exception encountered during WSDLGen processing", ex );
}
finally
{
WeblogicMojoUtilities.unsetWeblogicProtocolHandler();
}
}
/**
* Getter for the service name
*
* @return the service name
*/
public String getServiceName()
{
return serviceName;
}
/**
* Setter for the service name
*
* @param serviceName the service name to set
*/
public void setServiceName( String serviceName )
{
this.serviceName = serviceName;
}
public String getWarName()
{
return warName;
}
public void setWarName( String warName )
{
this.warName = warName;
}
public String getWsdlFile()
{
return wsdlFile;
}
public void setWsdlFile( String wsdlFile )
{
this.wsdlFile = wsdlFile;
}
public String getDefaultEndpoint()
{
return defaultEndpoint;
}
public void setDefaultEndpoint( String defaultEndpoint )
{
this.defaultEndpoint = defaultEndpoint;
}
public String getEarFileName()
{
return earFileName;
}
public void setEarFileName( String earFileName )
{
this.earFileName = earFileName;
}
public boolean isOverwrite()
{
return overwrite;
}
public void setOverwrite( boolean overwrite )
{
this.overwrite = overwrite;
}
/**
* toString method: creates a String representation of the object
*
* @return the String representation
*/
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append( "WsdlGenMojo[" );
buffer.append( "earFileName = " ).append( earFileName );
buffer.append( ", warName = " ).append( warName );
buffer.append( ", serviceName = " ).append( serviceName );
buffer.append( ", overwrite = " ).append( overwrite );
buffer.append( "]" );
return buffer.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy