Jonathan--

 Very cool, thanks!  Certainly not a huge deal; just a consistency thing.

 :)

Eddie



Jonathan Colwell wrote:

Hi Eddie,

I'll ask Michael to rearrange the jars and switch over to the common
log4j jar.

When I tossed all these jars in there together I had just grabbed them
from the AXIS build and it was just too easy to grab the big pile of
libraries that I knew played well together.


thanks,

Jonathan

-----Original Message-----
From: Eddie O'Neil Sent: Thursday, September 09, 2004 12:54 PM
To: Beehive Dev
Subject: Re: svn commit: rev 43630 - in incubator/beehive/trunk/wsm: .
lib src/runtime/org/apache/beehive/wsm/axis
src/runtime/org/apache/beehive/wsm/util test test/webapps
test/webapps/AnnotatedAxis test/webapps/AnnotatedAxis/WEB-INF
test/webapps/AnnotatedAxis/WE


Michael--

 Hey, a couple of comments about this change:

1) we're trying to use <subproject>/external as the location of externally referenced JARs rather than <subproject>/lib. So, at least according to the project layout plan on the wiki, the Axis JARs would live there.
2) there's a copy of Log4J 1.2.8 available in $BEEHIVE_HOME/external, and Beehive as a whole (at least as far as I know) is using this version, so maybe WSM's Axis snapshot can also use the same version.


 Anyway, my $0.02.

Thanks!

Eddie



[EMAIL PROTECTED] wrote:



Author: mmerz
Date: Thu Sep  9 12:43:48 2004
New Revision: 43630

Added:
incubator/beehive/trunk/wsm/lib/axis-ant.jar (contents, props


changed)


incubator/beehive/trunk/wsm/lib/axis.jar (contents, props changed)
incubator/beehive/trunk/wsm/lib/commons-discovery.jar (contents,


props changed)


incubator/beehive/trunk/wsm/lib/commons-logging.jar (contents,


props changed)


incubator/beehive/trunk/wsm/lib/jaxrpc.jar (contents, props


changed)


incubator/beehive/trunk/wsm/lib/log4j-1.2.8.jar (contents, props


changed)


incubator/beehive/trunk/wsm/lib/log4j.properties
incubator/beehive/trunk/wsm/lib/saaj.jar (contents, props changed)
incubator/beehive/trunk/wsm/lib/wsdl4j.jar (contents, props


changed)


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Anno
tatedJWSHandler.java


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Axis
Hook.java


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Depl
oymentDumper.java


 incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/



incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/Clas
spathUtils.java


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/Java
ArchiveFilter.java


 incubator/beehive/trunk/wsm/test/
 incubator/beehive/trunk/wsm/test/webapps/
 incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/
 incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/Foo.jws
 incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/



incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/Bar.java


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/Foo.java


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/dump.bat


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/setEnv.bat


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/classes/


 incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/lib/



incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/lib/log4j
.properties


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/server-co
nfig.wsdd


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/web.xml


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/happyaxis.jsp
incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/index.html
Modified:
incubator/beehive/trunk/wsm/build.xml
Log:
Initial checkin of code connecting the JSR-181 object model to AXIS.


More details about AXIS WSM can be found on the Beehive Wiki:
http://wiki.apache.org/beehive/axis_2dspecific_20implementation


Contributor: Jonathan Colwell



Modified: incubator/beehive/trunk/wsm/build.xml
=======================================================================


=======


--- incubator/beehive/trunk/wsm/build.xml       (original)
+++ incubator/beehive/trunk/wsm/build.xml       Thu Sep  9 12:43:48 2004
@@ -31,6 +31,11 @@
 <property name="classes.dir" value="${build.dir}/classes" />
 <property name="jars.dir" value="${build.dir}/jars"/>
 <property name="docs.dir" value="${build.dir}/docs"/>
+  <property name="test.dir" value="test"/>
+  <property name="webapps.dir" value="${test.dir}/webapps"/>
+  <property name="dist.dir" value="${build.dir}/dist"/>
+  <property name="webapps.dist.dir" value="${dist.dir}/webapps"/>
+  <property name="axis.dir" value="AnnotatedAxis"/>

 <property name="api.dir" value="src/api"/>
 <property name="api.classes" value="${classes.dir}/api"/>
@@ -38,7 +43,11 @@
 <property name="runtime.dir" value="src/runtime"/>
 <property name="runtime.classes" value="${classes.dir}/runtime"/>

+  <property name="lib.dir" value="lib"/>
+
 <property name="wsm.jar" value="${jars.dir}/wsm.jar"/>
+  <property name="wsm-axis.jar" value="${jars.dir}/wsm-axis.jar"/>
+

 <path id="api.classpath">
 </path>
@@ -51,10 +60,28 @@
   <pathelement location="${jsr173.jar}"/>
   <pathelement location="${junit.jar}"/>
   <pathelement location="${log4j.jar}"/>
-    <pathelement location="lib/xmltypes.jar"/>
-    <path id="${api.classpath}"/>
+    <pathelement location="${lib.dir}/xmltypes.jar"/>
+    <path refid="api.classpath"/>
+    <pathelement location="${api.classes}"/>
 </path>

+<fileset id="axis.jars" dir="${lib.dir}">
+ <include name="wsdl4j.jar"/>
+ <include name="saaj.jar"/>
+ <include name="jaxrpc.jar"/>
+ <include name="commons-logging.jar"/>
+ <include name="commons-discovery.jar"/>
+ <include name="axis-ant.jar"/>
+ <include name="axis.jar"/>
+</fileset>
+
+<path id="axis.classpath">
+ <fileset refid="axis.jars"/>
+ <pathelement location="${os.JAVA_HOME}/lib/tools.jar"/>
+ <path refid="runtime.classpath"/>
+ <pathelement location="${runtime.classes}"/>
+</path>
+
<!--


==================================================================== -->


<!-- usage - output usage -->
<!--


==================================================================== -->


@@ -69,18 +96,26 @@
<echo


message="---------------------------------------------------------------
-" />


<echo message="| Standard Targets


|" />


<echo


message="---------------------------------------------------------------
-" />


- <echo message="build - build java classes and jar files" />
+ <echo message="build - build core WSM classes and jar files"


/>


+ <echo message="build_axis - build AXIS dependent classes and jar


files" />


+ <echo message="build_all - build all classes and jar files" />
<echo message="clean - remove build files" />
- <echo message="deploy - does nothing for this project" />
+ <echo message="deploy - prepares an axis webapp suitable for


deployment"/>


+ <echo message=" to a servlet container" />
<echo message="redeploy - do an &quot;clean&quot;, &quot;,


&quot;build&quot; and &quot;deploy&quot;." />


<echo message="docs - build the java docs" />
- <echo message="drt - runs the DRT (developer regression


test)" />


+ <echo message="drt - runs the DRT (developer regression


test) on the"/>


+ <echo message=" core WSM components" />
<echo message="" />
<echo


message="---------------------------------------------------------------
-" />


<echo message="| Project-Specific Targets


|" />


<echo


message="---------------------------------------------------------------
-" />


<echo message="dirs - Creates the output directories of the


build."/>


- <echo message="classes - Compiles the source code of the


project."/>


+ <echo message="classes - Compiles the core source code of the


project and"/>


+ <echo message=" copies properties and templates into


the build."/>


+ <echo message="api - Compiles the api source code of the


project."/>


+ <echo message="runtime - Compiles the runtime source code of


the project."/>


+ <echo message="axis - Compiles the axis dependent source


code of the project."/>


<echo


message="===============================================================
=" />


<echo message="| NOTE: THE WSM PROJECT ONLY BUILDS ON JDK1.5


|" />


<echo


message="===============================================================
=" />


@@ -101,30 +136,43 @@
<!--


==================================================================== -->


<!-- Compiles the source code of the project. -->
<!--


==================================================================== -->


- <target name="classes" depends="dirs" if="isJDK15">
- + <target name="classes" depends="api, runtime" if="isJDK15">
+ <!-- Copy template files into the build -->
+ <copy todir="${runtime.classes}" overwrite="true" >
+ <fileset dir="${runtime.dir}"


includes="**/*.template,**/*.vm,META-INF/**" />


+ </copy>
+
+ <!-- Copy property files into the build -->
+ <copy todir="${runtime.classes}" overwrite="true" >
+ <fileset dir="${runtime.dir}" includes="**/*.properties" />
+ </copy>
+ </target>
+
+ <target name="api" depends="dirs" if="isJDK15">
<!-- Build the API classes -->
<javac destdir="${api.classes}" classpathref="api.classpath"


source="1.5" debug="on" >


     <src path="${api.dir}"/>
   </javac>
+  </target>

+ <target name="runtime" depends="api" if="isJDK15">
<!-- Build the runtime classes -->
<javac destdir="${runtime.classes}"


classpathref="runtime.classpath" source="1.5" debug="on">


     <src path="${runtime.dir}"/>
+      <exclude name="**/axis/**"/>
   </javac>
+  </target>

- <!-- Copy template files into the build -->
- <copy todir="${runtime.classes}" overwrite="true" >
- <fileset dir="${runtime.dir}"


includes="**/*.template,**/*.vm,META-INF/**" />


- </copy>
+ <target name="axis" depends="runtime" if="isJDK15">
+ <!-- Build the axis classes -->
+ <javac destdir="${runtime.classes}" classpathref="axis.classpath"


source="1.5" debug="on">


+      <src path="${runtime.dir}"/>
+      <include name="**/axis/**"/>
+    </javac>
+  </target>

-    <!-- Copy property files into the build -->
-    <copy todir="${runtime.classes}" overwrite="true" >
-      <fileset dir="${runtime.dir}" includes="**/*.properties" />
-    </copy>


- </target>

<!--


==================================================================== -->


 <!-- Jars up the classes, libraries, and resources. -->
@@ -136,7 +184,9 @@

   <jar jarfile="${wsm.jar}" >
       <fileset dir="${api.classes}" />
-        <fileset dir="${runtime.classes}" />
+        <fileset dir="${runtime.classes}">
+            <exclude name="**/axis/**"/>
+        </fileset>
   </jar>

<echo message="--------------------------------------------------"


/>


@@ -145,12 +195,28 @@
 </target>


+ <target name="build_axis" depends="axis" if="isJDK15">
+ <echo message="--------------------------------------------------"


/>


+ <echo message="| WSM-AXIS build starting


|" />


+ <echo message="--------------------------------------------------"


/>


+
+ <jar jarfile="${wsm-axis.jar}" >
+ <fileset dir="${runtime.classes}">
+ <include name="**/axis/**"/>
+ </fileset>
+ </jar>
+
+ <echo message="--------------------------------------------------"


/>


+ <echo message="| WSM-AXIS build ending


|" />


+ <echo message="--------------------------------------------------"


/>


+ </target>
+
+
<!--


==================================================================== -->


<!-- build_all. build this project and all inter-project


dependencies -->


<!--


==================================================================== -->


-  <target name="build_all">
-    <antcall target="build"/>
-  </target>
+  <target name="build_all" depends="build, build_axis"/>
+

<!--


==================================================================== -->


<!-- clean -->
@@ -188,13 +254,23 @@
<!--


==================================================================== -->


<!-- deploy -->
<!--


==================================================================== -->


- <target name="deploy" depends="build" if="isJDK15">
+ <target name="deploy" depends="build_all" if="isJDK15">
<echo message="--------------------------------------------------"


/>


<echo message="| WSM deploy starting |" />
<echo message="--------------------------------------------------"


/>


- <!-- Copy build output to client locations (lib dir of servers


etc) -->


-
+ <mkdir dir="${webapps.dist.dir}"/>
+ <copy todir="${webapps.dist.dir}/${axis.dir}">
+ <fileset dir="${webapps.dir}/${axis.dir}"/>
+ </copy>
+ <copy todir="${webapps.dist.dir}/${axis.dir}/WEB-INF/lib">
+ <fileset refid="axis.jars"/>
+ </copy>
+ <copy todir="${webapps.dist.dir}/${axis.dir}/WEB-INF/lib">
+ <fileset dir="${jars.dir}" includes="**/*.jar"/>
+ </copy>
+ <copy file="${log4j.jar}"
+ todir="${webapps.dist.dir}/${axis.dir}/WEB-INF/lib"/>
<echo message="--------------------------------------------------"


/>


<echo message="| WSM deploy ending |" />
<echo message="--------------------------------------------------"


/>


@@ -248,8 +324,8 @@
<!--


==================================================================== -->


<!-- drt -->
<!--


==================================================================== -->


-  <target name="drt" depends="deploy">
-    <ant dir="./drt" target="drt" inheritAll="false"/>
+  <target name="drt" depends="build">
+    <ant dir="drt" target="drt" inheritAll="false"/>
 </target>

</project>

Added: incubator/beehive/trunk/wsm/lib/axis-ant.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/axis.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/commons-discovery.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/commons-logging.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/jaxrpc.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/log4j-1.2.8.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/log4j.properties
=======================================================================


=======


--- (empty file)
+++ incubator/beehive/trunk/wsm/lib/log4j.properties Thu Sep 9


12:43:48 2004


@@ -0,0 +1,20 @@
+# Set root category priority to INFO and its only appender to CONSOLE.

+log4j.rootCategory=INFO, CONSOLE

+#log4j.rootCategory=INFO, CONSOLE, LOGFILE

+

+# Set the enterprise logger category to FATAL and its only appender to


CONSOLE.


+log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE

+

+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.

+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

+log4j.appender.CONSOLE.Threshold=INFO

+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout

+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n

+

+# LOGFILE is set to be a File appender using a PatternLayout.

+log4j.appender.LOGFILE=org.apache.log4j.FileAppender

+log4j.appender.LOGFILE.File=axis.log

+log4j.appender.LOGFILE.Append=true

+log4j.appender.LOGFILE.Threshold=INFO

+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout

+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x -


%m%n


Added: incubator/beehive/trunk/wsm/lib/saaj.jar
=======================================================================


=======


Binary file. No diff available.

Added: incubator/beehive/trunk/wsm/lib/wsdl4j.jar
=======================================================================


=======


Binary file. No diff available.

Added:


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Anno
tatedJWSHandler.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Anno
tatedJWSHandler.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,459 @@
+/*

+ * Copyright 2001-2004 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.

+ */

+

+package org.apache.beehive.wsm.axis;

+

+import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;

+import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;

+import


org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata;


+import


org.apache.beehive.wsm.jsr181.processor.reflection.WsmReflectionAnnotati
onProcessor;


+

+import java.io.File;

+import java.io.FileFilter;

+import java.io.FileInputStream;

+import java.io.FileReader;

+import java.io.FileWriter;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.FileNotFoundException;

+import java.net.URL;

+import java.net.URLClassLoader;

+import java.net.URLDecoder;

+import java.util.HashMap;

+import java.util.Iterator;

+import java.util.List;

+import java.util.StringTokenizer;

+import java.util.jar.Attributes;

+import java.util.jar.JarFile;

+import java.util.jar.JarInputStream;

+import java.util.jar.Manifest;

+

+import org.apache.axis.AxisFault;

+import org.apache.axis.AxisProperties;

+import org.apache.axis.Constants;

+import org.apache.axis.MessageContext;

+import org.apache.axis.components.compiler.Compiler;

+import org.apache.axis.components.compiler.CompilerError;

+import org.apache.axis.components.compiler.CompilerFactory;

+import org.apache.axis.components.logger.LogFactory;

+import org.apache.axis.description.ServiceDesc;

+import org.apache.axis.handlers.JWSHandler;

+import org.apache.axis.handlers.soap.SOAPService;

+import org.apache.axis.providers.java.RPCProvider;

+import org.apache.axis.transport.http.HTTPConstants;

+import org.apache.axis.utils.ClassUtils;

+import org.apache.axis.utils.JWSClassLoader;

+import org.apache.axis.utils.Messages;

+import org.apache.axis.utils.XMLUtils;

+import org.apache.beehive.wsm.util.ClasspathUtils;

+import org.apache.commons.logging.Log;

+import org.w3c.dom.Document;

+import org.w3c.dom.Element;

+

+/*********************************************************************


**********


+ * A few annotation specific things added and lots of code copied

+ * from the JWSHandler base class by

+ *

+ * @author Jonathan Colwell ([EMAIL PROTECTED])

+ *

+ * but most of the code was written by:

+ * @author Glen Daniels ([EMAIL PROTECTED])

+ * @author Doug Davis ([EMAIL PROTECTED])

+ * @author Sam Ruby ([EMAIL PROTECTED])

+ *

+ */

+public class AnnotatedJWSHandler extends JWSHandler {

+

+

+  /**

+ * If our path ends in the right file extension (*.jws), handle all


the


+   * work necessary to compile the source file if it needs it, and set

+   * up the "proxy" RPC service surrounding it as the MessageContext's

+   * active service.

+   *

+ */

+ protected void setupService(MessageContext msgContext) throws


Exception {


+    // FORCE the targetService to be JWS if the URL is right.

+    String realpath = msgContext.getStrProp(Constants.MC_REALPATH);

+    String extension = (String)getOption(OPTION_JWS_FILE_EXTENSION);

+    if (extension == null) extension = DEFAULT_JWS_FILE_EXTENSION;

+

+    if ((realpath!=null) && (realpath.endsWith(extension))) {

+ /* Grab the *.jws filename from the context - should have been


*/


+ /* placed there by another handler (ie. HTTPActionHandler)


*/


+


/***************************************************************/


+      String   jwsFile = realpath;

+      String rel = msgContext.getStrProp(Constants.MC_RELATIVE_PATH);

+

+      // Check for file existance, report error with

+      // relative path to avoid giving out directory info.

+      File  f2 = new File( jwsFile );

+      if (!f2.exists()) {

+        throw new FileNotFoundException(rel);

+      }

+

+      if (rel.charAt(0) == '/') {

+        rel = rel.substring(1);

+      }

+

+      int lastSlash = rel.lastIndexOf('/');

+      String dir = null;

+

+      if (lastSlash > 0) {

+        dir = rel.substring(0, lastSlash);

+      }

+

+      String file = rel.substring(lastSlash + 1);

+

+ String outdir = msgContext.getStrProp( Constants.MC_JWS_CLASSDIR


);


+      if ( outdir == null ) outdir = "." ;

+

+      // Build matching directory structure under the output

+      // directory.  In other words, if we have:

+      //    /webroot/jws1/Foo.jws

+      //

+      // That will be compiled to:

+      //    .../jwsOutputDirectory/jws1/Foo.class

+      if (dir != null) {

+        outdir = outdir + File.separator + dir;

+      }

+

+      // Confirm output directory exists.  If not, create it IF we're

+      // allowed to.

+      // !!! TODO: add a switch to control this.

+      File outDirectory = new File(outdir);

+      if (!outDirectory.exists()) {

+        outDirectory.mkdirs();

+      }

+

+      if (log.isDebugEnabled())

+        log.debug("jwsFile: " + jwsFile );

+

+ String jFile = outdir + File.separator + file.substring(0,


file.length()-3) +


+        "java" ;

+ String cFile = outdir + File.separator + file.substring(0,


file.length()-3) +


+        "class" ;

+

+      if (log.isDebugEnabled()) {

+        log.debug("jFile: " + jFile );

+        log.debug("cFile: " + cFile );

+        log.debug("outdir: " + outdir);

+      }

+

+      File  f1 = new File( cFile );

+

+      /* Get the class */

+      /*****************/

+      String clsName = null ;

+      //clsName = msgContext.getStrProp(Constants.MC_RELATIVE_PATH);

+      if ( clsName == null ) clsName = f2.getName();

+      if ( clsName != null && clsName.charAt(0) == '/' )

+        clsName = clsName.substring(1);

+

+      clsName = clsName.substring( 0, clsName.length()-4 );

+      clsName = clsName.replace('/', '.');

+

+      if (log.isDebugEnabled())

+        log.debug("ClsName: " + clsName );

+

+      /* Check to see if we need to recompile */

+      /****************************************/

+      if ( !f1.exists() || f2.lastModified() > f1.lastModified() ) {

+        /* If the class file doesn't exist, or it's older than the */

+        /* java file then recompile the java file.                 */

+        /* Start by copying the *.jws file to *.java               */

+        /***********************************************************/

+        log.debug(Messages.getMessage("compiling00", jwsFile) );

+        log.debug(Messages.getMessage("copy00", jwsFile, jFile) );

+        FileReader fr = new FileReader( jwsFile );

+        FileWriter fw = new FileWriter( jFile );

+        char[] buf = new char[4096];

+        int    rc ;

+        while ( (rc = fr.read( buf, 0, 4095)) >= 0 )

+          fw.write( buf, 0, rc );

+        fw.close();

+        fr.close();

+

+        /* Now run javac on the *.java file */

+        /************************************/

+        log.debug("javac " + jFile );

+        // Process proc = rt.exec( "javac " + jFile );

+        // proc.waitFor();

+        Compiler          compiler = CompilerFactory.getCompiler();

+

+        compiler.setClasspath(getDefaultClasspath(msgContext));

+        compiler.setDestination(outdir);

+        compiler.addFile(jFile);

+

+        boolean result   = compiler.compile();

+

+        /* Delete the temporary *.java file and check return code */

+        /**********************************************************/

+        (new File(jFile)).delete();

+

+        if ( !result ) {

+ /* Delete the *class file - sometimes it gets created even


*/


+ /* when there are errors - so erase it so it doesn't


*/


+ /* confuse us.


*/


+


/***********************************************************/


+          (new File(cFile)).delete();

+

+          Document doc = XMLUtils.newDocument();

+

+          Element         root = doc.createElementNS("", "Errors");

+          StringBuffer message = new StringBuffer("Error compiling ");

+          message.append(jFile);

+          message.append(":\n");

+

+          List errors = compiler.getErrors();

+          int count = errors.size();

+          for (int i = 0; i < count; i++) {

+            CompilerError error = (CompilerError) errors.get(i);

+            if (i > 0) message.append("\n");

+            message.append("Line ");

+            message.append(error.getStartLine());

+            message.append(", column ");

+            message.append(error.getStartColumn());

+            message.append(": ");

+            message.append(error.getMessage());

+          }

+ root.appendChild( doc.createTextNode( message.toString() )


);


+          throw new AxisFault( "Server.compileError",

+ Messages.getMessage("badCompile00",


jFile),


+                               null, new Element[] { root } );

+        }

+        ClassUtils.removeClassLoader( clsName );

+        // And clean out the cached service.

+        soapServices.remove(clsName);

+      }

+

+      ClassLoader cl = ClassUtils.getClassLoader(clsName);

+      if (cl == null) {

+        cl = new JWSClassLoader(clsName,

+                                msgContext.getClassLoader(),

+                                cFile);

+      }

+

+      msgContext.setClassLoader(cl);

+

+      WebServiceTYPEMetadata wsm = WsmReflectionAnnotationProcessor

+          .getObjectModel(cl.loadClass(clsName));

+

+      /* Create a new RPCProvider - this will be the "service"   */

+ /* that we invoke.


*/


+


/******************************************************************/


+      // Cache the rpc service created to handle the class.  The cache

+ // is based on class name, so only one .jws/.jwr class can be


active


+      // in the system at a time.

+      SOAPService rpc = (SOAPService)soapServices.get(clsName);

+      if (rpc == null) {

+        rpc = new SOAPService(new RPCProvider());

+        rpc.setName(wsm.getWsName());

+        rpc.setOption(RPCProvider.OPTION_CLASSNAME, clsName );

+        rpc.setEngine(msgContext.getAxisEngine());

+

+        /* Support specification of "allowedMethods" as a parameter.

+ String allowed =


(String)getOption(RPCProvider.OPTION_ALLOWEDMETHODS);


+           if (allowed == null) allowed = "*";

+        */

+

+

+        // Take the setting for the scope option from the handler

+        // parameter named "scope"

+        String scope = (String)getOption(RPCProvider.OPTION_SCOPE);

+                if (scope == null) scope = "Request";

+        rpc.setOption(RPCProvider.OPTION_SCOPE, scope);

+

+        ServiceDesc sd = AxisHook.createServiceDesc(wsm, cl);

+        rpc.setServiceDescription(sd);

+

+        List allowedMethodNames = sd.getAllowedMethods();

+        Iterator allowIt = allowedMethodNames.iterator();

+        StringBuffer sb = new StringBuffer();

+        boolean firstPass = true;

+        while (allowIt.hasNext()) {

+          if (firstPass) {

+            sb.append(' ');

+            firstPass = false;

+          }

+          sb.append(((String)allowIt.next()));

+        }

+ rpc.setOption(RPCProvider.OPTION_ALLOWEDMETHODS,


sb.toString());

+ rpc.setOption(RPCProvider.OPTION_WSDL_PORTTYPE,


wsm.getWsName());


+        rpc.setOption(RPCProvider.OPTION_WSDL_SERVICEELEMENT,

+                      wsm.getWsServiceName());

+ rpc.setOption(RPCProvider.OPTION_WSDL_TARGETNAMESPACE,

+                      wsm.getWsTargetNamespace());

+

+        rpc.setStyle(sd.getStyle());

+        rpc.setUse(sd.getUse());

+

+ // NOTE [EMAIL PROTECTED] 2004-Aug-16 -- not needed anymore I


think


+        //rpc.getInitializedServiceDesc(msgContext);

+

+ soapServices.put(clsName, rpc);

+      }

+

+      // Set engine, which hooks up type mappings.

+      rpc.setEngine(msgContext.getAxisEngine());

+

+      rpc.init();   // ??

+

+      // OK, this is now the destination service!

+      msgContext.setService( rpc );

+    }

+

+    if (log.isDebugEnabled()) {

+      log.debug("Exit: JWSHandler::invoke");

+    }

+ }

+

+  private String getDefaultClasspath(MessageContext msgContext)

+  {

+    StringBuffer classpath = new StringBuffer();

+

+    ClassLoader cl = Thread.currentThread().getContextClassLoader();

+    fillClassPath(cl, classpath);

+

+    // Just to be safe (the above doesn't seem to return the webapp

+    // classpath in all cases), manually do this:

+

+    String webBase = (String)msgContext.getProperty(

+


HTTPConstants.MC_HTTP_SERVLETLOCATION);


+    if (webBase != null) {

+      classpath.append(webBase + File.separatorChar + "classes" +

+                       File.pathSeparatorChar);

+      try {

+        String libBase = webBase + File.separatorChar + "lib";

+        File libDir = new File(libBase);

+        String [] jarFiles = libDir.list();

+        for (int i = 0; i < jarFiles.length; i++) {

+          String jarFile = jarFiles[i];

+          if (jarFile.endsWith(".jar")) {

+            classpath.append(libBase +

+                             File.separatorChar +

+                             jarFile +

+                             File.pathSeparatorChar);

+          }

+        }

+      } catch (Exception e) {

+        // Oh well.  No big deal.

+      }

+    }

+

+    // axis.ext.dirs can be used in any appserver

+    getClassPathFromDirectoryProperty(classpath, "axis.ext.dirs");

+

+ // classpath used by Jasper

+ getClassPathFromProperty(classpath,


"org.apache.catalina.jsp_classpath");


+

+    // websphere stuff.

+    getClassPathFromProperty(classpath, "ws.ext.dirs");

+ getClassPathFromProperty(classpath,


"com.ibm.websphere.servlet.application.classpath");


+

+    // java class path

+    getClassPathFromProperty(classpath, "java.class.path");

+

+    // Load jars from java external directory

+    getClassPathFromDirectoryProperty(classpath, "java.ext.dirs");

+

+    // boot classpath isn't found in above search

+    getClassPathFromProperty(classpath, "sun.boot.class.path");

+

+    return classpath.toString();

+  }

+

+ private void getClassPathFromDirectoryProperty(StringBuffer


classpath, String property) {


+    String dirs = AxisProperties.getProperty(property);

+    String path = null;

+    try {

+      path = ClasspathUtils.expandDirs(dirs);

+    } catch (Exception e) {

+      // Oh well.  No big deal.

+    }

+    if( path!= null) {

+      classpath.append(path);

+      classpath.append(File.pathSeparatorChar);

+    }

+  }

+

+ private void getClassPathFromProperty(StringBuffer classpath, String


property) {


+    String path = AxisProperties.getProperty(property);

+    if( path  != null) {

+      classpath.append(path);

+      classpath.append(File.pathSeparatorChar);

+    }

+  }

+

+  /**

+   * Walk the classloader hierarchy and add to the classpath

+ *

+   * @param cl

+   * @param classpath

+   */

+  private void fillClassPath(ClassLoader cl, StringBuffer classpath) {

+    while (cl != null) {

+      if (cl instanceof URLClassLoader) {

+        URL[] urls = ((URLClassLoader) cl).getURLs();

+        for (int i = 0; (urls != null) && i < urls.length; i++) {

+          String path = urls[i].getPath();

+          //If it is a drive letter, adjust accordingly.

+ if (path.length() >= 3 && path.charAt(0) == '/' &&


path.charAt(2) == ':')


+            path = path.substring(1);

+          classpath.append(URLDecoder.decode(path));

+          classpath.append(File.pathSeparatorChar);

+

+          // if its a jar extract Class-Path entries from manifest

+          File file = new File(urls[i].getFile());

+          if (file.isFile()) {

+            FileInputStream fis = null;

+            try {

+              fis = new FileInputStream(file);

+

+              if (isJar(fis)) {

+                JarFile jar = new JarFile(file);

+                Manifest manifest = jar.getManifest();

+                if (manifest != null) {

+ Attributes attributes =


manifest.getMainAttributes();


+                  if (attributes != null) {

+ String s =


attributes.getValue(Attributes.Name.CLASS_PATH);


+                    String base = file.getParent();

+

+                    if (s != null) {

+ StringTokenizer st = new StringTokenizer(s, "


");


+                      while (st.hasMoreTokens()) {

+                        String t = st.nextToken();

+ classpath.append(base + File.separatorChar +


t);


+                        classpath.append(File.pathSeparatorChar);

+                      }

+                    }

+                  }

+                }

+              }

+            } catch (IOException ioe) {

+              if (fis != null)

+                try {

+                  fis.close();

+                } catch (IOException ioe2) {

+                }

+            }

+          }

+        }

+      }

+      cl = cl.getParent();

+    }

+  }

+}


Added:


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Axis
Hook.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Axis
Hook.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,140 @@
+/*

+ * Copyright 2001-2004 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.

+ */

+

+package org.apache.beehive.wsm.axis;

+

+import java.lang.reflect.Method;

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.List;

+

+import javax.xml.namespace.QName;

+

+import org.apache.axis.wsdl.fromJava.Emitter;

+import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;

+import org.apache.axis.description.ServiceDesc;

+import org.apache.axis.description.JavaServiceDesc;

+import org.apache.axis.description.ParameterDesc;

+import org.apache.axis.description.OperationDesc;

+import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;

+import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;

+import


org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata;


+

+import javax.jws.WebParam;

+

+/*********************************************************************


**********


+ *

+ *

+ * @author Jonathan Colwell

+ */

+public class AxisHook {

+

+ public static ServiceDesc createServiceDesc(WebServiceTYPEMetadata


wsm,


+                                                ClassLoader cl)

+        throws ClassNotFoundException, NoSuchMethodException

+    {

+

+        JavaServiceDesc sd = new JavaServiceDesc();

+

+        if (cl == null) {

+            /*

+ * NOTE [EMAIL PROTECTED] 2004-Aug-30 -- if no classloader

+             * was provided, use the one that loaded this Class

+             */

+            cl = AxisHook.class.getClassLoader();

+        }

+

+        Class serviceClass = cl.loadClass(wsm.getJavaFQClassName());

+

+        String portType = wsm.getWsName();

+        sd.setName(portType);

+        sd.setImplClass(serviceClass);

+

+        String targetNamespace = wsm.getWsTargetNamespace();

+        sd.setDefaultNamespace(targetNamespace);

+

+ Collection<WebServiceMETHODMetadata> methods =


wsm.getMethods();


+        List<String> allowedMethods = new ArrayList<String>();

+        for (WebServiceMETHODMetadata meth : methods) {

+

+            String operationName = meth.getWmOperationName();

+

+            if (operationName != null && operationName.length() > 0) {

+

+                OperationDesc od = new OperationDesc();

+

+                String javaMethodName = meth.getJavaMethodName();

+                od.setElementQName(new QName(operationName));

+                od.setName(javaMethodName);

+                allowedMethods.add(javaMethodName);

+

+                od.setSoapAction(meth.getWmAction());

+

+ od.setReturnQName(new QName(meth.getWrName()));

+

+                od.setReturnClass(meth.getJavaReturnType());

+                //      od.setReturnHeader(

+

+ List<WebServicePARAMETERMetadata> parameters =


meth.getParams();


+ List<Class> paramClasses = new ArrayList<Class>();





+

+                for (WebServicePARAMETERMetadata param : parameters) {

+

+                    ParameterDesc pd = new ParameterDesc();

+                    pd.setName(param.getWpName());

+                    Class paramType = param.getJavaType();

+                    pd.setJavaType(paramType);

+                    paramClasses.add(paramType);

+

+                    WebParam.Mode mo = param.getWpMode();

+                    switch (mo) {

+                    case OUT:

+                        pd.setMode(ParameterDesc.OUT);

+                        pd.setInHeader(false);

+                        pd.setOutHeader(param.isWpHeader());

+                        break;

+

+                    case INOUT:

+                        pd.setMode(ParameterDesc.INOUT);

+                        boolean header = param.isWpHeader();

+                        pd.setInHeader(header);

+                        pd.setOutHeader(header);

+                        break;

+

+                    case IN:

+                    default:

+                        pd.setMode(ParameterDesc.IN);

+                        pd.setInHeader(param.isWpHeader());

+                        pd.setOutHeader(false);

+                    }

+                    od.addParameter(pd);

+                }

+

+                Method javaMethod = serviceClass

+                    .getMethod(meth.getJavaMethodName(),

+ paramClasses.toArray(new


Class[paramClasses.size()]));


+

+                od.setMethod(javaMethod);

+

+                sd.addOperationDesc(od);

+            }

+        }

+        sd.setAllowedMethods(allowedMethods);

+

+        return sd;

+    }

+}

+


Added:


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Depl
oymentDumper.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/Depl
oymentDumper.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,200 @@
+/*

+ * DeploymentDumper.java

+ *

+ * Copyright 2001-2004 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.

+ *

+ *

+ * Original author: Jonathan Colwell

+ */

+package org.apache.beehive.wsm.axis;

+

+import com.sun.tools.apt.main.Main;

+

+import java.lang.reflect.Method;

+import java.io.FileOutputStream;

+import java.io.OutputStreamWriter;

+import java.io.Writer;

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.List;

+import java.util.Set;

+

+import javax.xml.namespace.QName;

+import javax.jws.WebParam;

+

+import org.apache.axis.server.AxisServer;

+import org.apache.axis.configuration.FileProvider;

+import org.apache.axis.deployment.wsdd.WSDDDeployment;

+import org.apache.axis.deployment.wsdd.WSDDOperation;

+import org.apache.axis.deployment.wsdd.WSDDService;

+import org.apache.axis.description.JavaServiceDesc;

+import org.apache.axis.description.ServiceDesc;

+import org.apache.axis.description.OperationDesc;

+import org.apache.axis.description.ParameterDesc;

+import org.apache.axis.encoding.SerializationContext;

+import org.apache.axis.handlers.soap.SOAPService;

+import org.apache.axis.providers.java.RPCProvider;

+import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;

+import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;

+import


org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata;


+import


org.apache.beehive.wsm.jsr181.processor.apt.WsmAnnotationProcessor;


+

+/*********************************************************************


**********


+ *

+ *

+ * @author Jonathan Colwell

+ */

+public class DeploymentDumper {

+

+    /**

+ * FIXME [EMAIL PROTECTED] 2004-Sep-08 -- come up with a better


solution for


+ * providing the args to APT as well as providing the WSDD file


names


+     *

+     * Currently, the usage is:

+ * <output wsdd> <input wsdd> <assorted APT and javac options>


<source files>


+     */

+    public static void main(String[] args) throws Exception

+    {

+        if (args.length > 2) {

+            String wsddOut = args[0];

+            String wsddIn = args[1];

+            int len = args.length - 2;

+            String[] aptArgs = new String[len];

+            System.arraycopy(args, 2, aptArgs, 0, len);

+            for (String arg : aptArgs) {

+                System.out.println(arg);

+            }

+

+            Main apt = new Main("AxisApt");

+

+            if (0 == apt.compile(aptArgs)) {

+                DeploymentDumper dd = new DeploymentDumper();

+


dd.createAxisDeployment(dd.retrieveWebServiceMetadata(),


+                                        wsddOut,

+                                        wsddIn);

+

+            }

+        }

+    }

+

+ public void


createAxisDeployment(Collection<WebServiceTYPEMetadata> wsms,


+                                     String newConfigFilename,

+                                     String existingConfigFilename)

+        throws Exception

+    {

+        Writer fw = new OutputStreamWriter

+            (new FileOutputStream(newConfigFilename), "UTF-8");

+        SerializationContext serial = new SerializationContext(fw);

+        serial.setPretty(true);

+ serial.writeString("<?xml version=\"1.0\"


encoding=\"UTF-8\"?>\n");


+

+        if (existingConfigFilename != null) {

+ FileProvider fp = new


FileProvider(existingConfigFilename);


+

+            /*

+ * NOTE [EMAIL PROTECTED] 2004-Sep-08 -- I don't really


want


+ * to configure an engine here but I just need the


FileProvider


+ * to process the loaded WSDD. Find out if there is a


more

+             * "correct" way to accomplish this.

+             *

+ * an unfortunate side effect of using this default call


to

+ * configureEngine is that a default server-config.wsdd


appears in


+             * the current directory.

+             */

+            fp.configureEngine(new AxisServer());

+

+            WSDDDeployment dep = fp.getDeployment();

+

+            if (dep != null) {

+

+               for (WebServiceTYPEMetadata wsm : wsms) {

+                    WSDDService wsds = new WSDDService();

+

+                    JavaServiceDesc sd = (JavaServiceDesc)

+                        AxisHook.createServiceDesc(wsm, getClass()

+                                                   .getClassLoader());

+                    wsds.setName(sd.getName());

+                    /*

+ * NOTE [EMAIL PROTECTED] 2004-Sep-08 --

+ * the default namespace needs to be spcified


somehow but


+ * doing so here causes weirdness when the


webservice runs


+ wsds.setQName(new


QName(sd.getDefaultNamespace(),


+                                              sd.getName()));

+                     */

+


wsds.setProviderQName(wsds.QNAME_JAVARPC_PROVIDER);

+                    wsds.setUse(sd.getUse());

+                    wsds.setStyle(sd.getStyle());

+

+                    /*

+ * NOTE [EMAIL PROTECTED] 2004-Sep-08 -- I want to


prevent

+ * the JavaServiceDesc from introspecting itself


when I call


+ * getOperations() but it complained when I tried


to set the

+ * impl class back to null after having set it


when creating

+ * the servicedesc. In any case the resulting


operations

+                     * shown in the resulting WSDD look correct.

+                     */

+                    // sd.setImplClass(null);

+

+                    List<OperationDesc> ops = (List<OperationDesc>)sd

+                        .getOperations();

+

+                    for (OperationDesc op : ops) {

+                        wsds.addOperation(new WSDDOperation(op));

+                    }

+

+                    List allowedMethods = sd.getAllowedMethods();

+ StringBuffer allowedNames = new


StringBuffer(allowedMethods


+


.size());


+                    boolean firstRun = true;

+                    for (Object methName : allowedMethods) {

+                        if (firstRun) {

+                            firstRun = false;

+                        }

+                        else {

+                            allowedNames.append(' ');

+                        }

+                        allowedNames.append((String)methName);

+                    }

+ wsds.setParameter("allowedMethods",


allowedNames.toString());


+ wsds.setParameter("className",


sd.getImplClass().getName());


+

+

+                    /*

+ * NOTE [EMAIL PROTECTED] 2004-Sep-08 -- addService


is

+ * protected in WSDDDeployment, but deployService

+                     * appears to work for now.

+                     */

+                    dep.deployService(wsds);

+                }

+               dep.writeToContext(serial);

+            }

+        }

+        fw.close();

+    }

+

+ protected Collection<WebServiceTYPEMetadata>


retrieveWebServiceMetadata()


+    {

+ Collection<WebServiceTYPEMetadata> meta =

+            new ArrayList<WebServiceTYPEMetadata>();

+

+ Set<String> keys =


WsmAnnotationProcessor.getObjectModelNames();


+        for (String key : keys) {

+            meta.add((WebServiceTYPEMetadata)WsmAnnotationProcessor

+                .getObjectModel(key));

+        }

+ return meta;

+    }

+}


Added:


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/Clas
spathUtils.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/Clas
spathUtils.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,62 @@
+/*

+ * ClasspathUtils.java

+ *

+ * Copyright 2001-2004 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.

+ *

+ */

+package org.apache.beehive.wsm.util;

+

+import java.io.File;

+import java.util.StringTokenizer;

+

+import org.apache.beehive.wsm.util.JavaArchiveFilter;

+

+/*********************************************************************


**********


+ *

+ *

+ * @author Jonathan Colwell

+ */

+public class ClasspathUtils {

+

+  /**

+   * Function borrowed from org.apache.axis.handlers.JWSHandler

+   *

+ * Expand a directory path or list of directory paths


(File.pathSeparator


+ * delimited) into a list of file paths of all the jar files in


those


+   * directories.

+   *

+ * @param dirPaths The string containing the directory path or list


of


+   *           directory paths.

+ * @return The file paths of the jar files in the directories. This


is an


+ * empty string if no files were found, and is terminated


by an


+   *           additional pathSeparator in all other cases.

+   */

+    public static String expandDirs(String dirPaths) {

+ StringTokenizer st = new StringTokenizer(dirPaths,


File.pathSeparator);


+        StringBuffer buffer = new StringBuffer();

+        while (st.hasMoreTokens()) {

+            String d = st.nextToken();

+            File dir = new File(d);

+            if (dir.isDirectory()) {

+                File[] files = dir.listFiles(new JavaArchiveFilter());

+                for (int i = 0; i < files.length; i++) {

+


buffer.append(files[i]).append(File.pathSeparator);


+                }

+            }

+        }

+        return buffer.toString();

+    }

+}


Added:


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/Java
ArchiveFilter.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/util/Java
ArchiveFilter.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,34 @@
+/*

+ * JavaArchiveFilter.java

+ *

+ * Copyright 2001-2004 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.

+ *

+ */

+package org.apache.beehive.wsm.util;

+

+import java.io.File;

+import java.io.FileFilter;

+

+/*********************************************************************


**********


+ * This class stolen from an package private inner class of

+ * org.apache.axis.handlers.JWSHandler

+ */

+public class JavaArchiveFilter implements FileFilter {

+    public boolean accept(File file) {

+        String name = file.getName().toLowerCase();

+        return (name.endsWith(".jar") || name.endsWith(".zip"));

+    }

+}


Added: incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/Foo.jws
=======================================================================


=======


--- (empty file)
+++ incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/Foo.jws


Thu Sep 9 12:43:48 2004


@@ -0,0 +1,46 @@
+/*

+ * Copyright 2001-2004 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 javax.jws.Oneway;

+import javax.jws.WebMethod;

+import javax.jws.WebParam;

+import javax.jws.WebResult;

+import javax.jws.WebService;

+

+/*********************************************************************


**********


+ *

+ *

+ * @author Jonathan Colwell

+ */

[EMAIL PROTECTED](name = "Abacus",

+            serviceName = "Cheetorama",

+ targetNamespace =


"http://www.superflaco.com/AnnotationTest";)


+  public class Foo {

+

+    @WebMethod(operationName = "GoLoco", action="LocoAction")

+      @WebResult

+      public boolean getNutty(@WebParam int level,

+ @WebParam(name="detail") String detail)


{


+

+      return (level > 5);

+    }

+

+ @WebMethod @Oneway public String goHome(@WebParam(name="when")


long time)


+    {

+      return "Now";

+    }

+  }


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/Bar.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/Bar.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,46 @@
+/*

+ * Copyright 2001-2004 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 javax.jws.Oneway;

+import javax.jws.WebMethod;

+import javax.jws.WebParam;

+import javax.jws.WebResult;

+import javax.jws.WebService;

+

+/*********************************************************************


**********


+ *

+ *

+ * @author Jonathan Colwell

+ */

[EMAIL PROTECTED](name = "Milk",

+            serviceName = "Chocolate",

+            targetNamespace = "http://www.superflaco.com/Cocoa";)

+  public class Bar {

+

+    @WebMethod(operationName = "EatCookie", action="ChompChomp")

+      @WebResult

+      public String eatDough(@WebParam int chipCount,

+                             @WebParam String flavor) {

+

+ return flavor + ((chipCount > 5) ? " is Yummy" : " is


boring");


+    }

+

+ @WebMethod @WebResult(name = "cookiesInside") public int


openCookieJar()


+    {

+        return 123;

+    }

+  }


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/Foo.java


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/Foo.java Thu Sep 9 12:43:48 2004


@@ -0,0 +1,51 @@
+/*

+ * Copyright 2001-2004 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 javax.jws.Oneway;

+import javax.jws.WebMethod;

+import javax.jws.WebParam;

+import javax.jws.WebResult;

+import javax.jws.WebService;

+

+/*********************************************************************


**********


+ *

+ *

+ * @author Jonathan Colwell

+ */

[EMAIL PROTECTED](name = "Abacus",

+            serviceName = "Cheetorama",

+ targetNamespace =


"http://www.superflaco.com/AnnotationTest";)


+  public class Foo {

+

+    @WebMethod(operationName = "GoLoco", action="LocoAction")

+      @WebResult

+      public boolean getNutty(@WebParam int level,

+ @WebParam(name="detail") String detail)


{


+

+      return (level > 5);

+    }

+

+    @WebMethod @WebResult(name = "howdy") public String goHome()

+    {

+      try {

+          return "wutup!";

+      }

+      catch (Exception e) {

+        return e.toString();

+      }

+    }

+  }


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/dump.bat


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/dump.bat Thu Sep 9 12:43:48 2004


@@ -0,0 +1,5 @@
+call setEnv

+

+%JAVA_HOME%\bin\java org.apache.beehive.wsm.axis.DeploymentDumper


..\annotated-server-config.wsdd ..\server-config.wsdd -classpath
%classpath% -factory
org.apache.beehive.wsm.jsr181.processor.apt.WsmAnnotationProcessorFactor
y -d ..\classes Bar.java Foo.java


+

+del server-config.wsdd


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/setEnv.bat


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/Annotatio
nBasedDeployment/setEnv.bat Thu Sep 9 12:43:48 2004


@@ -0,0 +1 @@
+set


classpath=..\classes;%JAVA_HOME%\lib\tools.jar;..\lib\axis.jar;..\lib\ja
xrpc.jar;..\lib\wsm.jar;..\lib\wsm-axis.jar;..\lib\commons-logging.jar;.
.\lib\saaj.jar;..\lib\wsdl4j.jar;..\lib\;..\lib\jaxrpc.jar;..\lib\common
s-discovery.jar;..\lib\log4j-1.2.8.jar


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/lib/log4j
.properties


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/lib/log4j
.properties Thu Sep 9 12:43:48 2004


@@ -0,0 +1,20 @@
+# Set root category priority to INFO and its only appender to CONSOLE.

+log4j.rootCategory=INFO, CONSOLE

+#log4j.rootCategory=INFO, CONSOLE, LOGFILE

+

+# Set the enterprise logger category to FATAL and its only appender to


CONSOLE.


+log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE

+

+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.

+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

+log4j.appender.CONSOLE.Threshold=INFO

+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout

+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n

+

+# LOGFILE is set to be a File appender using a PatternLayout.

+log4j.appender.LOGFILE=org.apache.log4j.FileAppender

+log4j.appender.LOGFILE.File=axis.log

+log4j.appender.LOGFILE.Append=true

+log4j.appender.LOGFILE.Threshold=INFO

+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout

+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x -


%m%n


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/server-co
nfig.wsdd


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/server-co
nfig.wsdd Thu Sep 9 12:43:48 2004


@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<deployment xmlns="http://xml.apache.org/axis/wsdd/";


xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>


+ <globalConfiguration>
+ <parameter name="adminPassword" value="admin"/>
+ <parameter name="disablePrettyXML" value="true"/>
+ <parameter name="attachments.implementation"


value="org.apache.axis.attachments.AttachmentsImpl"/>


+ <parameter name="sendXsiTypes" value="true"/>
+ <parameter name="sendMultiRefs" value="true"/>
+ <parameter name="sendXMLDeclaration" value="true"/>
+ <requestFlow>
+ <handler


type="java:org.apache.beehive.wsm.axis.AnnotatedJWSHandler">


+ <parameter name="scope" value="session"/>
+ </handler>
+ <handler


type="java:org.apache.beehive.wsm.axis.AnnotatedJWSHandler">


+ <parameter name="scope" value="request"/>
+ <parameter name="extension" value=".jwr"/>
+ </handler>
+ </requestFlow>
+ </globalConfiguration>
+ <handler name="LocalResponder"


type="java:org.apache.axis.transport.local.LocalResponder"/>


+ <handler name="URLMapper"


type="java:org.apache.axis.handlers.http.URLMapper"/>


+ <handler name="Authenticate"


type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>


+ <service name="AdminService" provider="java:MSG">
+ <parameter name="allowedMethods" value="AdminService"/>
+ <parameter name="enableRemoteAdmin" value="false"/>
+ <parameter name="className" value="org.apache.axis.utils.Admin"/>
+ <namespace>http://xml.apache.org/axis/wsdd/</namespace>
+ </service>
+ <service name="Version" provider="java:RPC">
+ <parameter name="allowedMethods" value="getVersion"/>
+ <parameter name="className" value="org.apache.axis.Version"/>
+ </service>
+ <transport name="http">
+ <requestFlow>
+ <handler type="URLMapper"/>
+ <handler


type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>


+ </requestFlow>
+ <parameter name="qs:list"


value="org.apache.axis.transport.http.QSListHandler"/>


+ <parameter name="qs:wsdl"


value="org.apache.axis.transport.http.QSWSDLHandler"/>


+ <parameter name="qs:method"


value="org.apache.axis.transport.http.QSMethodHandler"/>


+ </transport>
+ <transport name="local">
+  <responseFlow>
+   <handler type="LocalResponder"/>
+  </responseFlow>
+ </transport>
+</deployment>


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/web.xml


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/WEB-INF/web.xml
Thu Sep 9 12:43:48 2004


@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
+
+<web-app>
+ <display-name>Apache-Axis</display-name>
+ + <listener>
+


<listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</
listener-class>


+ </listener>
+ + <servlet>
+ <servlet-name>AxisServlet</servlet-name>
+ <display-name>Apache-Axis Servlet</display-name>
+ <servlet-class>
+ org.apache.axis.transport.http.AxisServlet
+ </servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>AdminServlet</servlet-name>
+ <display-name>Axis Admin Servlet</display-name>
+ <servlet-class>
+ org.apache.axis.transport.http.AdminServlet
+ </servlet-class>
+ <load-on-startup>100</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>SOAPMonitorService</servlet-name>
+ <display-name>SOAPMonitorService</display-name>
+ <servlet-class>
+ org.apache.axis.monitor.SOAPMonitorService
+ </servlet-class>
+ <init-param>
+ <param-name>SOAPMonitorPort</param-name>
+ <param-value>5001</param-value>
+ </init-param>
+ <load-on-startup>100</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>AxisServlet</servlet-name>
+ <url-pattern>/servlet/AxisServlet</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>AxisServlet</servlet-name>
+ <url-pattern>*.jws</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>AxisServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>SOAPMonitorService</servlet-name>
+ <url-pattern>/SOAPMonitor</url-pattern>
+ </servlet-mapping>
+
+ <!-- uncomment this if you want the admin servlet -->
+ <!--
+ <servlet-mapping>
+ <servlet-name>AdminServlet</servlet-name>
+ <url-pattern>/servlet/AdminServlet</url-pattern>
+ </servlet-mapping>
+ -->
+
+ <session-config>
+ <!-- Default to 5 minute session timeouts -->
+ <session-timeout>5</session-timeout>
+ </session-config>
+
+ <!-- currently the W3C havent settled on a media type for WSDL;
+ http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
+ for now we go with the basic 'it's XML' response -->
+ <mime-mapping>
+ <extension>wsdl</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+ +
+ <mime-mapping>
+ <extension>xsd</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.jws</welcome-file>
+ </welcome-file-list>
+
+</web-app>


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/happyaxis.jsp


=======================================================================


=======


--- (empty file)
+++


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/happyaxis.jsp
Thu Sep 9 12:43:48 2004


@@ -0,0 +1,488 @@
+<html>

+<%@ page import="java.io.InputStream,

+                 java.io.IOException,

+                 javax.xml.parsers.SAXParser,

+                 javax.xml.parsers.SAXParserFactory"

+   session="false" %>

+ <%

+    /*

+ * Copyright 2002,2004 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.

+ */

+%>

+<head>

+<title>Axis Happiness Page</title>

+</head>

+<body bgcolor='#ffffff'>

+<%!

+

+    /*

+ * Happiness tests for axis. These look at the classpath and warn


if things


+     * are missing. Normally addng this much code in a JSP page is mad

+ * but here we want to validate JSP compilation too, and have a


drop-in


+     * page for easy re-use

+     * @author Steve 'configuration problems' Loughran

+     * @author dims

+     * @author Brian Ewins

+     */

+

+

+    /**

+     * Get a string providing install information.

+     * TODO: make this platform aware and give specific hints

+     */

+    public String getInstallHints(HttpServletRequest request) {

+

+        String hint=

+ "<B><I>Note:</I></B> On Tomcat 4.x and Java1.4, you may


need to put libraries that contain "


+ +"java.* or javax.* packages into


CATALINA_HOME/common/lib"


+            +"<br>jaxrpc.jar and saaj.jar are two such libraries.";

+        return hint;

+    }

+

+    /**

+     * test for a class existing

+     * @param classname

+     * @return class iff present

+     */

+    Class classExists(String classname) {

+        try {

+            return Class.forName(classname);

+        } catch (ClassNotFoundException e) {

+            return null;

+        }

+    }

+

+    /**

+     * test for resource on the classpath

+     * @param resource

+     * @return true iff present

+     */

+    boolean resourceExists(String resource) {

+        boolean found;

+ InputStream


instream=this.getClass().getResourceAsStream(resource);


+        found=instream!=null;

+        if(instream!=null) {

+            try {

+                instream.close();

+            } catch (IOException e) {

+            }

+        }

+        return found;

+    }

+

+    /**

+     * probe for a class, print an error message is missing

+     * @param out stream to print stuff

+     * @param category text like "warning" or "error"

+     * @param classname class to look for

+     * @param jarFile where this class comes from

+     * @param errorText extra error text

+     * @param homePage where to d/l the library

+     * @return the number of missing classes

+     * @throws IOException

+     */

+    int probeClass(JspWriter out,

+                   String category,

+                   String classname,

+                   String jarFile,

+                   String description,

+                   String errorText,

+                   String homePage) throws IOException {

+        try {

+            Class clazz = classExists(classname);

+            if(clazz == null)  {

+               String url="";

+               if(homePage!=null) {

+ url="<br> See <a


href="+homePage+">"+homePage+"</a>";


+               }

+ out.write("<p>"+category+": could not find class


"+classname


+                   +" from file <b>"+jarFile

+                   +"</b><br>  "+errorText

+                   +url

+                   +"<p>");

+               return 1;

+            } else {

+               String location = getLocation(out, clazz);

+               if(location == null) {

+ out.write("Found "+ description + " (" + classname +


")<br>");


+               }

+               else {

+ out.write("Found "+ description + " (" + classname +


") at " + location + "<br>");


+               }

+               return 0;

+            }

+ } catch(NoClassDefFoundError ncdfe) {

+            String url="";

+            if(homePage!=null) {

+                url="<br>  See <a href="+homePage+">"+homePage+"</a>";

+            }

+            out.write("<p>"+category+": could not find a dependency"

+                    +" of class "+classname

+                    +" from file <b>"+jarFile

+                    +"</b><br> "+errorText

+                    +url

+                    +"<br>The root cause was: "+ncdfe.getMessage()

+ +"<br>This can happen e.g. if "+classname+" is in"





+                    +" the 'common' classpath, but a dependency like "

+ +" activation.jar is only in the webapp


classpath."


+                    +"<p>");

+            return 1;

+        }

+    }

+

+    /**

+     * get the location of a class

+     * @param out

+     * @param clazz

+     * @return the jar file or path where a class was found

+     */

+

+    String getLocation(JspWriter out,

+                       Class clazz) {

+        try {

+ java.net.URL url =


clazz.getProtectionDomain().getCodeSource().getLocation();


+            String location = url.toString();

+            if(location.startsWith("jar")) {

+ url =


((java.net.JarURLConnection)url.openConnection()).getJarFileURL();


+                location = url.toString();

+ }

+

+            if(location.startsWith("file")) {

+                java.io.File file = new java.io.File(url.getFile());

+                return file.getAbsolutePath();

+            } else {

+                return url.toString();

+            }

+        } catch (Throwable t){

+        }

+        return "an unknown location";

+    }

+

+    /**

+     * a class we need if a class is missing

+     * @param out stream to print stuff

+     * @param classname class to look for

+     * @param jarFile where this class comes from

+     * @param errorText extra error text

+     * @param homePage where to d/l the library

+     * @throws IOException when needed

+     * @return the number of missing libraries (0 or 1)

+     */

+    int needClass(JspWriter out,

+                   String classname,

+                   String jarFile,

+                   String description,

+                   String errorText,

+                   String homePage) throws IOException {

+        return probeClass(out,

+                "<b>Error</b>",

+                classname,

+                jarFile,

+                description,

+                errorText,

+                homePage);

+    }

+

+    /**

+     * print warning message if a class is missing

+     * @param out stream to print stuff

+     * @param classname class to look for

+     * @param jarFile where this class comes from

+     * @param errorText extra error text

+     * @param homePage where to d/l the library

+     * @throws IOException when needed

+     * @return the number of missing libraries (0 or 1)

+     */

+    int wantClass(JspWriter out,

+                   String classname,

+                   String jarFile,

+                   String description,

+                   String errorText,

+                   String homePage) throws IOException {

+        return probeClass(out,

+                "<b>Warning</b>",

+                classname,

+                jarFile,

+                description,

+                errorText,

+                homePage);

+    }

+

+    /**

+     * probe for a resource existing,

+     * @param out

+     * @param resource

+     * @param errorText

+     * @throws Exception

+     */

+    int wantResource(JspWriter out,

+                      String resource,

+                      String errorText) throws Exception {

+        if(!resourceExists(resource)) {

+ out.write("<p><b>Warning</b>: could not find resource


"+resource


+                        +"<br>"

+                        +errorText);

+            return 0;

+        } else {

+            out.write("found "+resource+"<br>");

+            return 1;

+        }

+    }

+

+

+    /**

+     *  get servlet version string

+     *

+     */

+

+    public String getServletVersion() {

+        ServletContext context=getServletConfig().getServletContext();

+        int major = context.getMajorVersion();

+        int minor = context.getMinorVersion();

+ return Integer.toString(major) + '.' +


Integer.toString(minor);


+    }

+

+

+

+    /**

+     * what parser are we using.

+     * @return the classname of the parser

+     */

+    private String getParserName() {

+        SAXParser saxParser = getSAXParser();

+        if (saxParser == null) {

+            return "Could not create an XML Parser";

+        }

+

+        // check to what is in the classname

+        String saxParserName = saxParser.getClass().getName();

+        return saxParserName;

+    }

+

+    /**

+     * Create a JAXP SAXParser

+     * @return parser or null for trouble

+     */

+    private SAXParser getSAXParser() {

+ SAXParserFactory saxParserFactory =


SAXParserFactory.newInstance();


+        if (saxParserFactory == null) {

+            return null;

+        }

+        SAXParser saxParser = null;

+        try {

+            saxParser = saxParserFactory.newSAXParser();

+        } catch (Exception e) {

+        }

+        return saxParser;

+    }

+

+    /**

+     * get the location of the parser

+     * @return path or null for trouble in tracking it down

+     */

+

+    private String getParserLocation(JspWriter out) {

+        SAXParser saxParser = getSAXParser();

+        if (saxParser == null) {

+            return null;

+        }

+        String location = getLocation(out,saxParser.getClass());

+        return location;

+    }

+    %>

+<html><head><title>Axis Happiness Page</title></head>

+<body>

+<h1>Axis Happiness Page</h1>

+<h2>Examining webapp configuration</h2>

+

+<p>

+<h3>Needed Components</h3>

+<%

+    int needed=0,wanted=0;

+

+    /**

+     * the essentials, without these Axis is not going to work

+     */

+    needed=needClass(out, "javax.xml.soap.SOAPMessage",

+            "saaj.jar",

+            "SAAJ API",

+            "Axis will not work",

+            "http://xml.apache.org/axis/";);

+

+    needed+=needClass(out, "javax.xml.rpc.Service",

+            "jaxrpc.jar",

+            "JAX-RPC API",

+            "Axis will not work",

+            "http://xml.apache.org/axis/";);

+

+ needed+=needClass(out,


"org.apache.axis.transport.http.AxisServlet",


+            "axis.jar",

+            "Apache-Axis",

+            "Axis will not work",

+            "http://xml.apache.org/axis/";);

+

+    needed+=needClass(out, "org.apache.commons.discovery.Resource",

+            "commons-discovery.jar",

+            "Jakarta-Commons Discovery",

+            "Axis will not work",

+            "http://jakarta.apache.org/commons/discovery.html";);

+

+    needed+=needClass(out, "org.apache.commons.logging.Log",

+            "commons-logging.jar",

+            "Jakarta-Commons Logging",

+            "Axis will not work",

+            "http://jakarta.apache.org/commons/logging.html";);

+

+    needed+=needClass(out, "org.apache.log4j.Layout",

+            "log4j-1.2.8.jar",

+            "Log4j",

+            "Axis may not work",

+            "http://jakarta.apache.org/log4j";);

+

+ //should we search for a javax.wsdl file here, to hint that it


needs


+ //to go into an approved directory? because we dont seem to need


to do that.


+    needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",

+            "wsdl4j.jar",

+            "IBM's WSDL4Java",

+            "Axis will not work",

+            null);

+

+    needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",

+            "xerces.jar",

+            "JAXP implementation",

+            "Axis will not work",

+            "http://xml.apache.org/xerces-j/";);

+

+    needed+=needClass(out,"javax.activation.DataHandler",

+            "activation.jar",

+            "Activation API",

+            "Axis will not work",

+


"http://java.sun.com/products/javabeans/glasgow/jaf.html";);


+%>

+<h3>Optional Components</h3>

+<%

+    /*

+     * now the stuff we can live without

+     */

+    wanted+=wantClass(out,"javax.mail.internet.MimeMessage",

+            "mail.jar",

+            "Mail API",

+            "Attachments will not work",

+            "http://java.sun.com/products/javamail/";);

+

+    wanted+=wantClass(out,"org.apache.xml.security.Init",

+            "xmlsec.jar",

+            "XML Security API",

+            "XML Security is not supported",

+            "http://xml.apache.org/security/";);

+

+    wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",

+            "jsse.jar or java1.4+ runtime",

+            "Java Secure Socket Extension",

+            "https is not supported",

+            "http://java.sun.com/products/jsse/";);

+    /*

+     * resources on the classpath path

+     */

+    /* broken; this is a file, not a resource

+    wantResource(out,"/server-config.wsdd",

+            "There is no server configuration file;"

+            +"run AdminClient to create one");

+    */

+    /* add more libraries here */

+

+    out.write("<h3>");

+    //is everythng we need here

+    if(needed==0) {

+       //yes, be happy

+        out.write("<i>The core axis libraries are present. </i>");

+    } else {

+        //no, be very unhappy

+


response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);


+        out.write("<i>"

+                +needed

+                +" core axis librar"

+                +(needed==1?"y is":"ies are")

+                +" missing</i>");

+    }

+    //now look at wanted stuff

+    if(wanted>0) {

+        out.write("<i>"

+                +wanted

+                +" optional axis librar"

+                +(wanted==1?"y is":"ies are")

+                +" missing</i>");

+    } else {

+        out.write("The optional components are present.");

+    }

+    out.write("</h3>");

+    //hint if anything is missing

+    if(needed>0 || wanted>0 ) {

+        out.write(getInstallHints(request));

+    }

+

+    %>

+    <p>

+ <B><I>Note:</I></B> Even if everything this page probes for is


present, there is no guarantee your


+ web service will work, because there are many configuration


options that we do


+ not check for. These tests are <i>necessary</i> but not


<i>sufficient</i>


+    <hr>

+

+    <h2>Examining Application Server</h2>

+    <%

+        String servletVersion=getServletVersion();

+        String xmlParser=getParserName();

+        String xmlParserLocation = getParserLocation(out);

+

+    %>

+    <table>

+ <tr><td>Servlet version</td><td><%= servletVersion


%></td></tr>


+        <tr><td>XML Parser</td><td><%= xmlParser %></td></tr>

+ <tr><td>XML ParserLocation</td><td><%= xmlParserLocation


%></td></tr>


+    </table>

+<% if(xmlParser.indexOf("crimson")>=0) { %>

+    <p>

+ <b>We recommend <a href="http://xml.apache.org/xerces2-j/";>Xerces


2</a>


+        over Crimson as the XML parser for Axis</b>

+    </p>

+<%    } %>

+

+    <h2>Examining System Properties</h2>

+<%

+ /**

+     * Dump the system properties

+     */

+    java.util.Enumeration e=null;

+    try {

+        e= System.getProperties().propertyNames();

+    } catch (SecurityException se) {

+    }

+    if(e!=null) {

+        out.write("<pre>");

+        for (;e.hasMoreElements();) {

+            String key = (String) e.nextElement();

+            out.write(key + "=" + System.getProperty(key)+"\n");

+        }

+        out.write("</pre><p>");

+    } else {

+        out.write("System properties are not accessible<p>");

+    }

+%>

+    <hr>

+ Platform: <%=


getServletConfig().getServletContext().getServerInfo() %>


+</body>

+</html>

+

+


Added:


incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/index.html


=======================================================================


=======


--- (empty file)
+++ incubator/beehive/trunk/wsm/test/webapps/AnnotatedAxis/index.html


Thu Sep 9 12:43:48 2004


@@ -0,0 +1,45 @@
+<html>

+

+<head>

+<meta http-equiv="Content-Type"

+content="text/html; charset=iso-8859-1">

+<title>Apache-Axis</title>

+</head>

+

+<body bgcolor="#FFFFFF">

+

+<h1 align="center">Apache-AXIS</h1>

+

+<p>Hello! <em>Welcome</em> to Apache-Axis -- now with


Annotations!.</p>


+

+<p>What do you want to do today?</p>

+

+<ul>

+    <li><a href="happyaxis.jsp">Validate</a>

+        the local installation's configuration<br>

+        <i>see below if this does not work.</i></li>

+    <li><a href="servlet/AxisServlet">View</a>

+        the list of deployed Web services</li>

+    <li><a href="Foo.jws?method=GoLoco&in0=99&detail=randomText">

+        Call a local endpoint</a> by its Annotated name (or see its

+        <a href="Foo.jws?wsdl">WSDL</a>).

+    <li><a href="http://xml.apache.org/axis";>Visit</a>

+        the Apache-Axis Home Page</li>

+</ul>

+

+This is a prototype implementation of JSR-181 intended to simply


explore how difficult it is to make the existing AXIS JWS system support
Annotations. This is not a complete implementation of JSR-181 but it
does cover many of the key features. One should also keep in mind that
there is no intention that this code be considered as anything more than
a somewhat functional draft whipped up in just a few days. Comments and
criticism are welcome especially considering that the author only
started looking at the internals of AXIS on August 10, 2004 and may have
misunderstood how it actually functions.


+

+

+<h3>Validating Axis</h3>

+

+If the "happyaxis" validation page displays an exception instead of a

+status page, the likely cause is that you have multiple XML parsers in

+your classpath. Clean up your classpath by eliminating extraneous


parsers.


+

+<p>

+If you have problems getting Axis to work, consult the Axis

+<a

+href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages";>W


iki</a>


+and then try the Axis user mailing list.

+</body>

+</html>










Reply via email to