Index: pom.xml
===================================================================
--- pom.xml (revision 10022)
+++ pom.xml (working copy)
@@ -11,7 +11,7 @@
weblogic-maven-plugin
maven-plugin
Weblogic Maven Plugin
- 2.9.2-SNAPSHOT
+ 2.9.3-SNAPSHOT
2005
This plugin will support various tasks within the Weblogic 8.1
@@ -95,6 +95,12 @@
webservices
[9.0,11.0)
+
+ weblogic
+ com.bea.core.utils.full
+ 1.4.0.0
+ provided
+
org.apache.maven.shared
maven-plugin-testing-harness
@@ -126,4 +132,11 @@
+
+
+ localRepository
+ Local Repository
+ file://${HOMEDRIVE}/Docume~1/${USERNAME}/.m2/repository
+
+
\ No newline at end of file
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
--- .settings/org.eclipse.jdt.core.prefs (revision 0)
+++ .settings/org.eclipse.jdt.core.prefs (revision 0)
@@ -0,0 +1,5 @@
+#Sat Jun 20 17:00:42 PDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.source=1.3
Index: .settings/org.maven.ide.eclipse.prefs
===================================================================
--- .settings/org.maven.ide.eclipse.prefs (revision 0)
+++ .settings/org.maven.ide.eclipse.prefs (revision 0)
@@ -0,0 +1,9 @@
+#Sat Jun 20 17:00:25 PDT 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Index: src/main/java/org/codehaus/mojo/weblogic/ClientGen10Mojo.java
===================================================================
--- src/main/java/org/codehaus/mojo/weblogic/ClientGen10Mojo.java (revision 0)
+++ src/main/java/org/codehaus/mojo/weblogic/ClientGen10Mojo.java (revision 0)
@@ -0,0 +1,402 @@
+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.wsee.tools.anttasks.ClientGenTask;
+
+import java.io.File;
+
+/**
+ * Runs Client Gen on a given WSDL. This client gen uses the BEA refactored client gen tool
+ * first appearing in weblogic 9. This is the preferred client gen tool for Weblogic 9.0 and
+ * newer.
+ *
+ * @author Jon Osborn
+ * @version $Id: ClientGen10Mojo.java 8652 2009-01-13 01:13:28Z jonnio $
+ * @description This mojo will run client gen on a given WSDL. This client gen uses the BEA refactored client gen tool
+ * first appearing in weblogic 9. This is the preferred client gen tool for Weblogic 10.0 and newer.
+ * @goal clientgen10
+ * @requiresDependencyResolution compile
+ */
+public class ClientGen10Mojo
+ extends AbstractWeblogicMojo
+{
+
+ /**
+ * The filename of the war file to find the services. The file path is
+ * extracted from the artifact list.
+ *
+ * @parameter
+ */
+ private String warFileName;
+
+ /**
+ * The wsdl to client gen from. If warFileName is specified, this parameter
+ * is the root relative file to use when creating the URI for the wsdl.
+ *
+ * @parameter
+ */
+ private String inputWSDL;
+
+ /**
+ * The directory to output the generated code to.
+ *
+ * @parameter default-value="${basedir}/src/main/java"
+ */
+ private String outputDir;
+
+ /**
+ * The package name of the output code.
+ *
+ * @parameter default-value="com.test.webservice"
+ */
+ private String packageName;
+
+ /**
+ * The name of the service.
+ *
+ * @parameter
+ */
+ private String serviceName;
+
+ /**
+ * Output verbose messages
+ *
+ * @parameter default-value="false"
+ */
+ private boolean verbose;
+
+ /**
+ * Whether or not to use server types from the ear file in the client jar.
+ *
+ * @parameter default-value="false"
+ */
+ private boolean useServerTypes;
+
+ /**
+ * Sets whether or not to create the type conversions for a web service in
+ * the client.
+ *
+ * @parameter default-value="true"
+ */
+ private boolean autotype;
+
+ /**
+ * Sets whether or not to use the jaxRPCWrappedArrayStyle
+ *
+ * @parameter default-value="true"
+ */
+ private boolean jaxRPCWrappedArrayStyle;
+
+ /**
+ * This method will run client gen on the given WSDL.
+ *
+ * @throws MojoExecutionException Thrown if we fail to obtain the WSDL.
+ */
+ public void execute()
+ throws MojoExecutionException
+ {
+ super.execute();
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( "Weblogic client gen beginning " );
+ }
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( " Detailed client gen settings information " + this.toString() );
+ }
+
+ try
+ {
+ final ClientGenTask clientGen = new ClientGenTask();
+ // Set the classpath
+ final Project project = new Project();
+ project.setName( "clientgen" );
+ final Path path = new Path( project, WeblogicMojoUtilities
+ .getDependencies( this.getArtifacts(), this.getPluginArtifacts() ) );
+ clientGen.setProject( project );
+ clientGen.setClasspath( path );
+ clientGen.setVerbose( this.verbose );
+ clientGen.setDestDir( new File( this.outputDir ) );
+ clientGen.setPackageName( this.packageName );
+ clientGen.setIncludeGlobalTypes( this.useServerTypes );
+ clientGen.setJaxRPCWrappedArrayStyle( this.jaxRPCWrappedArrayStyle );
+ String wsdlUri;
+ if ( this.warFileName != null )
+ {
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info(
+ " calculating wsdl URI from warFileName " + this.warFileName + " with wsdl " + this.inputWSDL );
+ }
+ wsdlUri = "jar:file:" + WeblogicMojoUtilities.getWarFileName( this.getArtifacts(), this.warFileName ) +
+ "!" + this.inputWSDL;
+ new File( this.inputWSDL ).toURI().toString();
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( " using " + wsdlUri + " for clientgen." );
+ }
+ }
+ else if ( this.inputWSDL.startsWith( "http" ) )
+ {
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( " using " + this.inputWSDL + " for clientgen." );
+ }
+ wsdlUri = this.inputWSDL;
+ }
+ else
+ {
+ wsdlUri = new File( this.inputWSDL ).toURI().toString();
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( " using " + wsdlUri + " for clientgen." );
+ }
+ }
+ clientGen.setWsdl( wsdlUri );
+ // set the service name if it is specified
+ if ( this.serviceName != null )
+ {
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( " generating client for service '" + this.serviceName + "'." );
+ }
+ clientGen.setServiceName( this.serviceName );
+ }
+ clientGen.execute();
+ }
+ catch ( Exception ex )
+ {
+ getLog().error( "Exception encountered during client gen", ex );
+ throw new MojoExecutionException( "Exception encountered during listapps", ex );
+ }
+ finally
+ {
+ WeblogicMojoUtilities.unsetWeblogicProtocolHandler();
+ }
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( "Weblogic client gen successful " );
+ }
+ }
+
+ /**
+ * Getter for property input WSDL.
+ *
+ * @return The value of input WSDL.
+ */
+ public String getInputWSDL()
+ {
+ return this.inputWSDL;
+ }
+
+ /**
+ * Setter for the input WSDL.
+ *
+ * @param inInputWSDL The value of input WSDL.
+ */
+ public void setInputWSDL( final String inInputWSDL )
+ {
+ this.inputWSDL = inInputWSDL;
+ }
+
+ /**
+ * Getter for property output dir.
+ *
+ * @return The value of output dir.
+ */
+ public String getOutputDir()
+ {
+ return this.outputDir;
+ }
+
+ /**
+ * Setter for the output dir.
+ *
+ * @param inOutputDir The value of output dir.
+ */
+ public void setOutputDir( final String inOutputDir )
+ {
+ this.outputDir = inOutputDir;
+ }
+
+ /**
+ * Getter for property package name.
+ *
+ * @return The value of package name.
+ */
+ public String getPackageName()
+ {
+ return this.packageName;
+ }
+
+ /**
+ * Setter for the package name.
+ *
+ * @param inPackageName The value of package name.
+ */
+ public void setPackageName( String inPackageName )
+ {
+ this.packageName = inPackageName;
+ }
+
+ /**
+ * Getter for property service name.
+ *
+ * @return The value of service name.
+ */
+ public String getServiceName()
+ {
+ return this.serviceName;
+ }
+
+ /**
+ * Setter for the service name.
+ *
+ * @param inServiceName The value of service name.
+ */
+ public void setServiceName( final String inServiceName )
+ {
+ this.serviceName = inServiceName;
+ }
+
+ /**
+ * toString method: creates a String representation of the object
+ *
+ * @return the String representation
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "ClientGen10Mojo[" );
+ buffer.append( "inputWSDL = " ).append( inputWSDL );
+ buffer.append( ", outputDir = " ).append( outputDir );
+ buffer.append( ", packageName = " ).append( packageName );
+ buffer.append( ", serviceName = " ).append( serviceName );
+ buffer.append( ", useServerTypes = " ).append( useServerTypes );
+ buffer.append( ", autotype = " ).append( autotype );
+ buffer.append( "]" );
+ return buffer.toString();
+ }
+
+ /**
+ * Getter for server types
+ *
+ * @return true if the client gen should use server type information
+ */
+ public boolean isUseServerTypes()
+ {
+ return useServerTypes;
+ }
+
+ /**
+ * Setter for server types
+ *
+ * @param useServerTypes - true if the client gen should use server types
+ */
+ public void setUseServerTypes( boolean useServerTypes )
+ {
+ this.useServerTypes = useServerTypes;
+ }
+
+ /**
+ * Getter for verbose messages
+ *
+ * @return true if the client gen should use verbose output
+ */
+ public boolean isVerbose()
+ {
+ return this.verbose;
+ }
+
+ /**
+ * Setter for verbose messages
+ *
+ * @param verbose - true of the clientgen should use verbose output
+ */
+ public void setVerbose( boolean verbose )
+ {
+ this.verbose = verbose;
+ }
+
+
+ /**
+ * Getter for autoType
+ *
+ * @return true if clientgen shoud autotype from the wsdl
+ */
+ public boolean isAutotype()
+ {
+ return this.autotype;
+ }
+
+ /**
+ * Setter for autoType
+ *
+ * @param autotype - true if the client should autotype
+ */
+ public void setAutotype( boolean autotype )
+ {
+ this.autotype = autotype;
+ }
+
+ /**
+ * Getter for warFileName
+ *
+ * @return the warFileName
+ */
+ public String getWarFileName()
+ {
+ return this.warFileName;
+ }
+
+ /**
+ * Setter for warFileName
+ *
+ * @param warFileName - the warFileName to set
+ */
+ public void setWarFileName( String warFileName )
+ {
+ this.warFileName = warFileName;
+ }
+
+ /**
+ * Getter for jaxRPCWrappedArrayStyle
+ *
+ * @return the jaxRPCWrappedArrayStyle
+ */
+ public boolean isJaxRPCWrappedArrayStyle()
+ {
+ return jaxRPCWrappedArrayStyle;
+ }
+
+ /**
+ * Setter for jaxRPCWrappedArrayStyle
+ *
+ * @param jaxRPCWrappedArrayStyle the jaxRPCWrappedArrayStyle to set
+ */
+ public void setJaxRPCWrappedArrayStyle( boolean jaxRPCWrappedArrayStyle )
+ {
+ this.jaxRPCWrappedArrayStyle = jaxRPCWrappedArrayStyle;
+ }
+}
Index: src/main/java/org/codehaus/mojo/weblogic/util/WeblogicMojoUtilities.java
===================================================================
--- src/main/java/org/codehaus/mojo/weblogic/util/WeblogicMojoUtilities.java (revision 10022)
+++ src/main/java/org/codehaus/mojo/weblogic/util/WeblogicMojoUtilities.java (working copy)
@@ -48,7 +48,7 @@
{
if ( "weblogic.utils".equals(System.getProperty("java.protocol.handler.pkgs") ) )
{
- System.setProperty( "java.protocol.handler.pkgs", null );
+ System.clearProperty( "java.protocol.handler.pkgs" );
}
}
Index: src/test/java/org/codehaus/mojo/weblogic/SimpleGoalMojoTest.java
===================================================================
--- src/test/java/org/codehaus/mojo/weblogic/SimpleGoalMojoTest.java (revision 10022)
+++ src/test/java/org/codehaus/mojo/weblogic/SimpleGoalMojoTest.java (working copy)
@@ -128,6 +128,21 @@
}
/**
+ * Test that we can find the deploy goal
+ *
+ * @throws Exception when the lookup fails
+ * @see org.codehaus.mojo.weblogic.ClientGen10Mojo
+ */
+ public void testMojoClientGen10Goal()
+ throws Exception
+ {
+
+ final ClientGen10Mojo mojo = (ClientGen10Mojo) lookupMojo( "clientgen10", this.testPom );
+
+ assertNotNull( mojo );
+ }
+
+ /**
* Test an invalid goal to be sure the valid ones are 'real'.
*
* @throws Exception - throws exception when something fails.