Author: kentam Date: Thu Aug 26 16:22:42 2004 New Revision: 37100 Added: incubator/beehive/trunk/wsm/ incubator/beehive/trunk/wsm/build.xml (contents, props changed) incubator/beehive/trunk/wsm/drt/ incubator/beehive/trunk/wsm/drt/LICENSE.TXT incubator/beehive/trunk/wsm/drt/build.xml (contents, props changed) incubator/beehive/trunk/wsm/drt/tests/ incubator/beehive/trunk/wsm/drt/tests/Foo.java (contents, props changed) incubator/beehive/trunk/wsm/drt/tests/FooWSDL.xml incubator/beehive/trunk/wsm/drt/tests/FooWSDL.xml~ incubator/beehive/trunk/wsm/drt/tests/org/ incubator/beehive/trunk/wsm/drt/tests/org/apache/ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/MetaDataTest.java (contents, props changed) incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/wsdl/ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/wsdl/WSDLProcessorTest.java (contents, props changed) incubator/beehive/trunk/wsm/lib/ incubator/beehive/trunk/wsm/lib/xmltypes.jar (contents, props changed) incubator/beehive/trunk/wsm/src/ incubator/beehive/trunk/wsm/src/api/ incubator/beehive/trunk/wsm/src/runtime/ incubator/beehive/trunk/wsm/src/runtime/javax/ incubator/beehive/trunk/wsm/src/runtime/javax/jws/ incubator/beehive/trunk/wsm/src/runtime/javax/jws/HandlerChain.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/InitParam.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/Oneway.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/QName.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/SecurityIdentity.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/SecurityRoles.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebMethod.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebParam.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebResult.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebService.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/ incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/DocumentWrapper.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPBinding.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPMessageHandler.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPMessageHandlers.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/ incubator/beehive/trunk/wsm/src/runtime/org/apache/ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/InitParamInfo.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/InvalidFileType.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/QNameInfo.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SOAPMessageHandlersInfo.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SecurityRolesInfo.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SoapBindingInfo.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WSMProcessorException.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServiceMETHODMetadata.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServicePARAMETERMetadata.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServiceTYPEMetadata.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/ProcessorException.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessorFactory.java (contents, props changed) incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/wsdl/ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/wsdl/WSDLProcessor.java (contents, props changed) Modified: incubator/beehive/trunk/build.xml Log: Initial WSM prototype of the core as suggested in the proposal posted last week (see Beehive Wiki) that is based on Anil's posting from earlier this week.
The prototype provides a skeleton consisting of three main branches: 1) Object model The object model is a set of classes that acts as the repository for annotation metadata. The model is intended to be a simple Java Bean object structure organized around TYPE, METHOD and PARAMETER ElementTypes defined in JSR 181. The corresponding classes are: WebServiceTYPEMetadata, WebServiceMEHTODMetadata, and WebServicePARAMETERMetadata. There are one to many relationships between TYPE and METHODS, and between METHODS and PARAMETERS. There are get/set methods for simple attributes at each ElementType (eg. wsName or the WebService Name in WebServiceTYPEMetadata). For annotation data that requires complex structure (e.g. SoapBinding) or when there is a one to many relationship (e.g. SOAP Message handler at WebServiceTYPEMetadata) Info classes are used (e.g. SoapBindingInfo, or SOAPMessageHandlersInfo) to capture the metadata. The model can be initialized from source (using two phase APT processor) or class file (straight java 1.5 api). In either case the metadata is processed according to the rules of the 181 and the result is stored in the object model. The APT, or Class file processing is responsible for the declaration level validation. The model , on the other hand is responsible for overall validation of the meta data. The model is intended to be used throughout the application (ant tasks, command line applications such as Java2WSDL, Axis server etc). The model will be enhanced to support the use cases as they become more apparent. 2) JSR-181 processor The JSR-181 processor has an (apt) interface that can be used by IDEs, for instance. This interface works on annotated java source files and extends the TwoPhaseAnnotationProcessor (see controls subproject). Its main methods, check() and generate() are mainly invoked by the apt (through the TwoPhaseAnnotationProcessor's process() method). The WsmAnnotationProcessorFactory currently registers only for one annotation type, @WebService. Since check() work on the entire file, all further information is derived while @WebService is being processed. [On the other hand, this means that check() does currently not perform any validation tasks if a @WebService annotation is not present.] generate() only performs a simple print out of @WebService and all @WebMethod annotations -- for error checking (until unit tests for this module are in place). In the future, generate() will be called to generate all artifacts for a Web Service, while check() performs quick, low-cost error checks. >From the command line, the apt can be invoked with the >WsmAnnotationProcessorFactory like this (assuming the current directory is the >classpath root directory): apt -cp . -factory org.apache.beehive.wsm.runtime.processor.apt.WsmAnnotationProcessorFactory <name of annotated WebService file, e.g. <directory>/Foo.java> 3) XMLBeans The org.apache.beehive.wsm.wsdl.WSDLProcessor provides a (hopefully!) convenient way to work with WSDL documents. Behind the scenes, the WSDLProcessor loads a WSDL as XmlBeans and returns a DefinitionsDocument from which the entire WSDL can be examined or manipulated. Additionally, the DefinitionsDocument can write out its internal representation back to XML with any modifications now in place. Since the WSDL used by most web services consists of elements from both the wsdl schema (http://schemas.xmlsoap.org/wsdl/) and the wsdlsoap schema extension (http://schemas.xmlsoap.org/wsdl/soap/), the WSDLProcessor provides helper functions to navigate more eaily between the core wsdl elements and those provided by the extension. By loading the WSDL into XmlBean generated objects, the rest of the WSM system can read and write WSDL documents with a minimum of effort and no core dependencies on a specific web services implementation. Contributed by: Michael Merz, Jonathan Colwell, Daryoush Mehrtash, Anil Sharma Modified: incubator/beehive/trunk/build.xml ============================================================================== --- incubator/beehive/trunk/build.xml (original) +++ incubator/beehive/trunk/build.xml Thu Aug 26 16:22:42 2004 @@ -33,11 +33,13 @@ <target name="clean" description="Clean Beehive"> <ant dir="controls" target="clean" inheritAll="false"/> <ant dir="netui" target="clean" inheritAll="false"/> + <ant dir="wsm" target="clean" inheritAll="false"/> </target> <target name="deploy" description="Deploy Beehive"> <ant dir="controls" target="build" inheritAll="false"/> <ant dir="netui" target="deploy" inheritAll="false"/> + <ant dir="wsm" target="deploy" inheritAll="false"/> </target> <!-- ============================================= --> @@ -48,6 +50,7 @@ <target name="drt" description="Run the Beehive DRT suite"> <antcall target="controls.drt"/> <antcall target="netui.drt"/> + <antcall target="wsm.drt"/> </target> <target name="controls.drt" description="Run the Beehive/Controls DRT suite"> @@ -56,6 +59,10 @@ <target name="netui.drt" description="Run the Beehive/NetUI DRT suite"> <ant dir="netui" antfile="build.xml" target="drt" inheritAll="false"/> + </target> + + <target name="wsm.drt" description="Run the Beehive/WSM DRT suite"> + <ant dir="wsm" target="drt" inheritAll="false"/> </target> <!-- ============================================= --> Added: incubator/beehive/trunk/wsm/build.xml ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/build.xml Thu Aug 26 16:22:42 2004 @@ -0,0 +1,253 @@ +<!-- + Copyright 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. + + $Header:$ + --> + +<project name="wsm" default="usage" basedir="."> + + <property environment="os"/> + <property file="../beehive.properties"/> + + <!-- THE WSM BUILD REQUIRES JDK1.5. ATTEMPTS TO BUILD ON JDK1.4 WILL BE A NOOP --> + <condition property="isJDK15"> + <equals arg1="${ant.java.version}" arg2="1.5"/> + </condition> + + <property name="build.dir" value="build"/> + <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="api.dir" value="src/api"/> + <property name="api.classes" value="${classes.dir}/api"/> + + <property name="runtime.dir" value="src/runtime"/> + <property name="runtime.classes" value="${classes.dir}/runtime"/> + + <property name="wsm.jar" value="${jars.dir}/wsm.jar"/> + + <path id="api.classpath"> + </path> + + <path id="runtime.classpath"> + <pathelement location="${ant.jar}"/> + <pathelement location="${tools.jar}"/> + <pathelement location="${api.classes}"/> + <pathelement location="${xbean.jar}"/> + <pathelement location="${jsr173.jar}"/> + <pathelement location="${junit.jar}"/> + <pathelement location="${log4j.jar}"/> + <pathelement location="lib/xmltypes.jar"/> + <path id="${api.classpath}"/> + </path> + + <!-- ==================================================================== --> + <!-- usage - output usage --> + <!-- ==================================================================== --> + <target name="usage"> + <echo message="" /> + <echo message="" /> + <echo message="WSM Build file" /> + <echo message="================================================================" /> + <echo message="| Usage |" /> + <echo message="================================================================" /> + <echo message="" /> + <echo message="----------------------------------------------------------------" /> + <echo message="| Standard Targets |" /> + <echo message="----------------------------------------------------------------" /> + <echo message="build - build java classes and jar files" /> + <echo message="clean - remove build files" /> + <echo message="deploy - does nothing for this project" /> + <echo message="redeploy - do an "clean", ", "build" and "deploy"." /> + <echo message="docs - build the java docs" /> + <echo message="drt - runs the DRT (developer regression test)" /> + <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="================================================================" /> + <echo message="| NOTE: THE WSM PROJECT ONLY BUILDS ON JDK1.5 |" /> + <echo message="================================================================" /> + <echo message="" /> + <echo message="" /> + </target> + + <!-- ==================================================================== --> + <!-- Creates the output directories of the build. --> + <!-- ==================================================================== --> + <target name="dirs"> + <mkdir dir="${api.classes}"/> + <mkdir dir="${runtime.classes}"/> + <mkdir dir="${jars.dir}"/> + <mkdir dir="${docs.dir}"/> + </target> + + <!-- ==================================================================== --> + <!-- Compiles the source code of the project. --> + <!-- ==================================================================== --> + <target name="classes" 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> + + <!-- Build the runtime classes --> + <javac destdir="${runtime.classes}" classpathref="runtime.classpath" source="1.5" debug="on"> + <src path="${runtime.dir}"/> + </javac> + + <!-- 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> + + <!-- ==================================================================== --> + <!-- Jars up the classes, libraries, and resources. --> + <!-- ==================================================================== --> + <target name="build" depends="classes" if="isJDK15"> + <echo message="--------------------------------------------------" /> + <echo message="| WSM build starting |" /> + <echo message="--------------------------------------------------" /> + + <jar jarfile="${wsm.jar}" > + <fileset dir="${api.classes}" /> + <fileset dir="${runtime.classes}" /> + </jar> + + <echo message="--------------------------------------------------" /> + <echo message="| WSM build ending |" /> + <echo message="--------------------------------------------------" /> + </target> + + + <!-- ==================================================================== --> + <!-- build_all. build this project and all inter-project dependencies --> + <!-- ==================================================================== --> + <target name="build_all"> + <antcall target="build"/> + </target> + + <!-- ==================================================================== --> + <!-- clean --> + <!-- ==================================================================== --> + <target name="clean"> + <delete dir="${build.dir}"/> + <ant dir="drt" target="clean" inheritAll="false"/> + </target> + + <!-- ==================================================================== --> + <!-- clean_all --> + <!-- ==================================================================== --> + <target name="clean_all"> + <antcall target="clean"/> + </target> + + <!-- ==================================================================== --> + <!-- redeploy --> + <!-- ==================================================================== --> + <target name="redeploy"> + <antcall target="clean"/> + <antcall target="build"/> + <antcall target="deploy"/> + </target> + + <!-- ==================================================================== --> + <!-- redeploy_all --> + <!-- ==================================================================== --> + <target name="redeploy_all"> + <antcall target="clean_all"/> + <antcall target="build_all"/> + <antcall target="deploy_all"/> + </target> + + <!-- ==================================================================== --> + <!-- deploy --> + <!-- ==================================================================== --> + <target name="deploy" depends="build" if="isJDK15"> + <echo message="--------------------------------------------------" /> + <echo message="| WSM deploy starting |" /> + <echo message="--------------------------------------------------" /> + + <!-- Copy build output to client locations (lib dir of servers etc) --> + + <echo message="--------------------------------------------------" /> + <echo message="| WSM deploy ending |" /> + <echo message="--------------------------------------------------" /> + </target> + + <!-- ==================================================================== --> + <!-- deploy_all --> + <!-- ==================================================================== --> + <target name="deploy_all" > + <antcall target="deploy"/> + </target> + + <!-- ==================================================================== --> + <!-- minprod --> + <!-- ==================================================================== --> + <target name = "minprod"> + <echo message="--------------------------------------------------" /> + <echo message="| WSM minprod starting |" /> + <echo message="--------------------------------------------------" /> + + <antcall target="deploy" /> + + <echo message="--------------------------------------------------" /> + <echo message="| WSM minprod completed |" /> + <echo message="--------------------------------------------------" /> + </target> + + <!-- ==================================================================== --> + <!-- docs --> + <!-- ==================================================================== --> + <target name="docs" if="isJDK15"> + <javadoc + destdir="${docs.dir}" + maxmemory="256M" + windowtitle="WSM Documentation" + doctitle="Web Services Metadata" + version="true" + author="false" + use="true" + additionalparam="-breakiterator -noqualifier all" + useexternalfile="true" + classpathref="runtime.classpath" + source="1.5"> + <packageset dir="${api.dir}" defaultexcludes="yes"> + <include name="org/apache/beehive/wsm/**/*" /> + </packageset> + </javadoc> + </target> + + <!-- ==================================================================== --> + <!-- drt --> + <!-- ==================================================================== --> + <target name="drt" depends="deploy"> + <ant dir="./drt" target="drt" inheritAll="false"/> + </target> + +</project> Added: incubator/beehive/trunk/wsm/drt/LICENSE.TXT ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/LICENSE.TXT Thu Aug 26 16:22:42 2004 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. Added: incubator/beehive/trunk/wsm/drt/build.xml ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/build.xml Thu Aug 26 16:22:42 2004 @@ -0,0 +1,113 @@ +<?xml version="1.0" ?> + +<project name="wsmdrt" default="usage"> + + <property environment="os"/> + <property file="${os.BEEHIVE_HOME}/beehive.properties"/> + + <!-- New V9 DRT Domain specific properties --> + <property name="test.root" location="${basedir}"/> + <property name="tests.src" location="${test.root}/tests"/> + <property name="wsm.src" location="${test.root}/wsm"/> + <property name="build.dir" location="${test.root}/build"/> + <property name="build.classes" location="${build.dir}/classes"/> + <property name="build.tests" location="${build.dir}/classes/tests"/> + <property name="build.jars" location="${build.dir}/jars"/> + <property name="drt.logs" location="${test.root}/logs"/> + <condition property="drt.os" value="windows" > + <os family="windows" /> + </condition> + <condition property="drt.os" value="unix" > + <os family="unix" /> + </condition> + + <!-- =================================================================== --> + <!-- Usage - print the usage --> + <!-- ==================================================================== --> + <target name="usage"> + <echo message=""/> + <echo message=""/> + <echo message="WSM DRT Build file"/> + <echo message="================================================================"/> + <echo message="| Usage |"/> + <echo message="================================================================"/> + <echo message="----------------------------------------------------------------"/> + <echo message="| Standard Targets |"/> + <echo message="----------------------------------------------------------------"/> + <echo message="clean - Delete the junit classes."/> + <echo message="build - build the junit classes."/> + <echo message="----------------------------------------------------------------"/> + </target> + + <path id="drt.classpath"> + <pathelement location="${junit.jar}"/> + <pathelement location="${tools.jar}"/> + <pathelement path="${xbean.jar}" /> + <pathelement path="../lib/xmltypes.jar"/> + <pathelement path="../build/jars/wsm.jar"/> + </path> + + <target name="clean"> + <delete dir="${build.dir}"/> + <delete dir="${drt.logs}"/> + </target> + + <target name="dirs"> + <mkdir dir="${build.classes}" /> + <mkdir dir="${build.tests}" /> + <mkdir dir="${build.jars}" /> + <mkdir dir="${drt.logs}" /> + </target> + + <target name="build" depends="dirs"> + <ant target="build-tests" /> + </target> + + <target name="build-tests" depends="dirs"> + <!-- Build the test source directory --> + <javac srcdir="${tests.src}" + destdir="${build.tests}" + classpathref="drt.classpath" + debug="on" + optimize="on" + verbose="false" + failonerror="true" + /> + </target> + + <target name="run-drt"> + <echo message="** junit logfiles written to ${drt.logs} **" /> + <junit haltonerror="off" printsummary="on" tempdir="${build.dir}" > + <classpath> + <pathelement location="${build.tests}" /> + <pathelement path="${xbean.jar}" /> + <pathelement path="${jsr173.jar}" /> + <pathelement path="../lib/xmltypes.jar"/> + <pathelement path="../build/jars/wsm.jar"/> + </classpath> + <formatter type="plain" /> + <batchtest fork="off" filtertrace="off" todir="${drt.logs}" > + <fileset dir="tests"> + <include name="**/*Test.java" /> + <!-- exclude name="**/util/**.class" / --> + <!-- exclude name="**/AllTests.class" / --> + </fileset> + </batchtest> + </junit> + </target> + + <target name="drt" > + <echo message="--------------------------------------------------" /> + <echo message="| WSM drt starting |" /> + <echo message="--------------------------------------------------" /> + + <antcall target="clean" /> + <antcall target="build-tests" /> + <antcall target="run-drt" /> + + <echo message="--------------------------------------------------" /> + <echo message="| WSM drt ending |" /> + <echo message="--------------------------------------------------" /> + </target> + +</project> Added: incubator/beehive/trunk/wsm/drt/tests/Foo.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/tests/Foo.java Thu Aug 26 16:22:42 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", + endpointInterface = "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/drt/tests/FooWSDL.xml ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/tests/FooWSDL.xml Thu Aug 26 16:22:42 2004 @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions targetNamespace="http://www.superflaco.com/AnnotationTest" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.superflaco.com/AnnotationTest" xmlns:intf="http://www.superflaco.com/AnnotationTest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +<!--WSDL created by Apache Axis version: 1.2beta3 +Built on Aug 15, 2004 (04:32:00 PDT)--> + + <wsdl:message name="goHomeResponse"> + + <wsdl:part name="howdy" type="soapenc:string"/> + + </wsdl:message> + + <wsdl:message name="goHomeRequest"> + + </wsdl:message> + + <wsdl:message name="GoLocoResponse"> + + <wsdl:part name="result" type="xsd:boolean"/> + + </wsdl:message> + + <wsdl:message name="GoLocoRequest"> + + <wsdl:part name="in0" type="xsd:int"/> + + <wsdl:part name="detail" type="soapenc:string"/> + + </wsdl:message> + + <wsdl:portType name="Abacus"> + + <wsdl:operation name="GoLoco" parameterOrder="in0 detail"> + + <wsdl:input message="impl:GoLocoRequest" name="GoLocoRequest"/> + + <wsdl:output message="impl:GoLocoResponse" name="GoLocoResponse"/> + + </wsdl:operation> + + <wsdl:operation name="goHome"> + + <wsdl:input message="impl:goHomeRequest" name="goHomeRequest"/> + + <wsdl:output message="impl:goHomeResponse" name="goHomeResponse"/> + + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="FooSoapBinding" type="impl:Abacus"> + + <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + + <wsdl:operation name="GoLoco"> + + <wsdlsoap:operation soapAction="LocoAction"/> + + <wsdl:input name="GoLocoRequest"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:input> + + <wsdl:output name="GoLocoResponse"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="goHome"> + + <wsdlsoap:operation soapAction=""/> + + <wsdl:input name="goHomeRequest"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:input> + + <wsdl:output name="goHomeResponse"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:output> + + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="Cheetorama"> + + <wsdl:port binding="impl:FooSoapBinding" name="Foo"> + + <wsdlsoap:address location="http://localhost:8080/AnnotatedAxis/Foo.jws"/> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> Added: incubator/beehive/trunk/wsm/drt/tests/FooWSDL.xml~ ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/tests/FooWSDL.xml~ Thu Aug 26 16:22:42 2004 @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions targetNamespace="http://www.superflaco.com/AnnotationTest" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.superflaco.com/AnnotationTest" xmlns:intf="http://www.superflaco.com/AnnotationTest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +<!--WSDL created by Apache Axis version: 1.2beta3 +Built on Aug 15, 2004 (04:32:00 PDT)--> + + <wsdl:message name="goHomeResponse"> + + <wsdl:part name="howdy" type="soapenc:string"/> + + </wsdl:message> + + <wsdl:message name="goHomeRequest"> + + </wsdl:message> + + <wsdl:message name="GoLocoResponse"> + + <wsdl:part name="result" type="xsd:boolean"/> + + </wsdl:message> + + <wsdl:message name="GoLocoRequest"> + + <wsdl:part name="in0" type="xsd:int"/> + + <wsdl:part name="detail" type="soapenc:string"/> + + </wsdl:message> + + <wsdl:portType name="Abacus"> + + <wsdl:operation name="GoLoco" parameterOrder="in0 detail"> + + <wsdl:input message="impl:GoLocoRequest" name="GoLocoRequest"/> + + <wsdl:output message="impl:GoLocoResponse" name="GoLocoResponse"/> + + </wsdl:operation> + + <wsdl:operation name="goHome"> + + <wsdl:input message="impl:goHomeRequest" name="goHomeRequest"/> + + <wsdl:output message="impl:goHomeResponse" name="goHomeResponse"/> + + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="FooSoapBinding" type="impl:Abacus"> + + <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + + <wsdl:operation name="GoLoco"> + + <wsdlsoap:operation soapAction="LocoAction"/> + + <wsdl:input name="GoLocoRequest"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:input> + + <wsdl:output name="GoLocoResponse"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="goHome"> + + <wsdlsoap:operation soapAction=""/> + + <wsdl:input name="goHomeRequest"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:input> + + <wsdl:output name="goHomeResponse"> + + <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.superflaco.com/AnnotationTest" use="encoded"/> + + </wsdl:output> + + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="Cheetorama"> + + <wsdl:port binding="impl:FooSoapBinding" name="Foo"> + + <wsdlsoap:address location="http://localhost:8080/AnnotatedAxis/Foo.jws"/> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/MetaDataTest.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/MetaDataTest.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,30 @@ +package org.apache.beehive.wsm; + +import junit.framework.TestCase; +/* + * Created on Aug 23, 2004 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ + +/** + * @author dmehrtas + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +public class MetaDataTest extends TestCase { + + public void setUp( ) { + } + + public void tearDown( ) { + + } + public void testMetaDataFromCompiledClass() throws Exception { + WebServiceTYPEMetadata model= WebServiceTYPEMetadata.buildWSMetadata(Class.forName("Foo")); + assertTrue("Unexpected Webservice name", model.getWsName().compareTo("Abacus") == 0); + } + +} Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/wsdl/WSDLProcessorTest.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/wsdl/WSDLProcessorTest.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,153 @@ +/* + * Copyright 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. + * + * $Header:$ + */ +package org.apache.beehive.wsm.wsdl; + +import java.io.File; +import org.xmlsoap.schemas.wsdl.TBinding; +import org.xmlsoap.schemas.wsdl.TBindingOperation; +import org.xmlsoap.schemas.wsdl.TBindingOperationMessage; +import org.xmlsoap.schemas.wsdl.DefinitionsDocument; +import org.xmlsoap.schemas.wsdl.TDefinitions; +import org.xmlsoap.schemas.wsdl.TService; +import org.xmlsoap.schemas.wsdl.TPort; +import org.xmlsoap.schemas.wsdl.soap.TOperation; +import org.xmlsoap.schemas.wsdl.soap.TAddress; +import org.xmlsoap.schemas.wsdl.soap.TStyleChoice; +import org.xmlsoap.schemas.wsdl.soap.TBody; +import org.xmlsoap.schemas.wsdl.soap.UseChoice; +import junit.framework.TestCase; + + +/******************************************************************************* + * + * + */ +public class WSDLProcessorTest extends TestCase { + + private static final String BEEHIVE_HOME = System.getenv( "BEEHIVE_HOME" ); + + DefinitionsDocument doc; + + public void setUp() throws Exception + { + File f = new File( BEEHIVE_HOME, "wsm/drt/tests/FooWSDL.xml" ); + doc = WSDLProcessor.parseWSDL( f ); + } + + public void testSOAPActionChildren() throws Exception + { + assertNotNull(doc); + if (doc != null) { + TDefinitions tDefs = doc.getDefinitions(); + assertNotNull(tDefs); + if (tDefs != null) { + TBinding tBind = tDefs.getBindingArray(0); + assertNotNull(tBind); + if (tBind != null) { + TBindingOperation bOp = tBind.getOperationArray(0); + TOperation[] tOps = WSDLProcessor.getSOAPOperations(bOp); + for (TOperation op :tOps) { + assertEquals("Soap Actions did not match", op.getSoapAction(), "LocoAction"); + } + } + } + } + } + + public void testSOAPBindingChildren() throws Exception + { + assertNotNull(doc); + if (doc != null) { + TDefinitions tDefs = doc.getDefinitions(); + assertNotNull(tDefs); + if (tDefs != null) { + TBinding tBind = tDefs.getBindingArray(0); + assertNotNull(tBind); + if (tBind != null) { + org.xmlsoap.schemas.wsdl.soap.TBinding[] tBs = + WSDLProcessor.getSOAPBinding(tBind); + for (org.xmlsoap.schemas.wsdl.soap.TBinding tb : tBs) { + assertSame("Soap Styles not the same", + tb.getStyle(), + TStyleChoice.RPC); + assertEquals("SoapTransport mismatch", + tb.getTransport(), + "http://schemas.xmlsoap.org/soap/http"); + } + } + } + } + } + + public void testSOAPBodyChildren() throws Exception + { + assertNotNull(doc); + if (doc != null) { + TDefinitions tDefs = doc.getDefinitions(); + assertNotNull(tDefs); + if (tDefs != null) { + TBinding tBind = tDefs.getBindingArray(0); + assertNotNull(tBind); + if (tBind != null) { + TBindingOperation bOp = tBind.getOperationArray(0); + processBindingOperationMessage(bOp.getInput()); + processBindingOperationMessage(bOp.getOutput()); + } + } + } + } + + private void processBindingOperationMessage(TBindingOperationMessage tBom) + throws Exception + { + TBody[] bodies = WSDLProcessor.getSOAPBody(tBom); + for (TBody bod : bodies) { + assertEquals("Soap EncodingStyles did not match", + bod.getEncodingStyle().get(0), + "http://schemas.xmlsoap.org/soap/encoding/"); + assertEquals("Soap Namespaces did not match", + bod.getNamespace(), + "http://www.superflaco.com/AnnotationTest"); + assertSame("Soap Uses did not match", + bod.getUse(), + UseChoice.ENCODED); + } + } + + public void testSOAPAddressChildren() throws Exception + { + assertNotNull(doc); + if (doc != null) { + TDefinitions tDefs = doc.getDefinitions(); + assertNotNull(tDefs); + if (tDefs != null) { + TService srv = tDefs.getServiceArray(0); + assertNotNull(srv); + if (srv != null) { + TPort port = srv.getPortArray(0); + TAddress[] addrs = WSDLProcessor.getSOAPAddress(port); + for (TAddress addr : addrs) { + assertEquals("Soap Actions did not match", + addr.getLocation(), + "http://localhost:8080/AnnotatedAxis/Foo.jws"); + } + } + } + } + } +} Added: incubator/beehive/trunk/wsm/lib/xmltypes.jar ============================================================================== Binary file. No diff available. Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/HandlerChain.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/HandlerChain.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,36 @@ +package javax.jws; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The <code>HandlerChain</code> annotation associates the Web Service + * with an externally defined handler chain. This annotation is + * typically used in scenarios where embedding the handler configuration + * directly in the Java source is not appropriate; for example, where the + * handler configuration needs to be shared across multiple Web Services. + * + * It is an error to combine this annotation with the + * <code>SOAPMessageHandlerInfo</code> annotation. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.TYPE}) +public @interface HandlerChain { + + /** + * Location of the handler chain file. The location is a URL, which + * may be relative or absolute. Relative URLs are relative to + * the location of the Java WS file at the time of processing. + */ + String location(); + + /** + * The name of the handler chain within the file + */ + String name(); +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/InitParam.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/InitParam.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,16 @@ +package javax.jws; + +/** + * An initialization parameter for a handler. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ +public @interface InitParam { + + /** Name of the initialization parameter */ + public String name(); + + /** Value of the initialization parameter */ + public String value(); +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/Oneway.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/Oneway.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,21 @@ +package javax.jws; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * Indicates that the given @WebMethod has only an input message and no + * output. Typically, a oneway method returns the thread of control to the + * calling application prior to executing the actual business method. A 181 + * processor should report an error if an operation marked oneway as a return + * value, out/in-out parameters, or throws any exceptions. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.METHOD}) +public @interface Oneway { +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/QName.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/QName.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,15 @@ +package javax.jws; + +/** + * Annotation type representing an XML qualified name (QName). + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ +public @interface QName { + /** URI of the namespace to which this name belongs */ + String namespaceURI() default ""; + + /** Local name */ + String localName() default ""; +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/SecurityIdentity.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/SecurityIdentity.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,32 @@ +package javax.jws; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * Defines the identity the Web Service assumes during execution. Normally a + * Web Service assumes the identity of the authenticated caller. This + * annotation allows the developer to override this behavior so that the Web + * Service instead executes as a particular role. The role must map to + * user/group information in the container's security realm. <p/> + * + * This annotation is only supported by JSR 181 processors that target the + * J2EE platform. Processors targeting J2SE are not required to support this + * annotation. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.TYPE}) +public @interface SecurityIdentity { + + /** + * A Web Service that includes this member-value assumes the + * permission-level of the role specified and may access other resources + * accordingly. + */ + public String runAs() default ""; +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/SecurityRoles.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/SecurityRoles.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,46 @@ +package javax.jws; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * Defines a list of roles that are allowed to access the methods on the + * service. Roles may be applied at either the service (class) level or + * at the level of an individual method. The container is responsible + * for ensuring that only the security settings of the service can be + * honored.<p/> + * + * This annotation is only supported by JSR 181 processors that target the + * J2EE platform. Processors targeting J2SE are not required to support this + * annotation. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.TYPE, ElementType.METHOD}) +public @interface SecurityRoles { + /** + * Specifies a list of roles permitted to access the Web Service. If the + * <code>SecurityRoles</code> annotation is applied at the class level, + * then the roles referenced may access all individual methods within the + * Web Service. If the <code>SecurityRoles</code> annotation is applied + * at the method level, then the roles expand the list of roles allowed + * to access that method. This annotation is the equivalent of the + * <method-permission> deployment descriptor entry in ejb-jar.xml. + * The roles must map to user/group information in the container's + * security realm. + */ + public String[] rolesAllowed() default {}; + + /** + * Specifies a list of roles referenced by the Web Service. The Web + * Service may access other resources using the credentials of the roles + * listed. This annotation is the equivalent of the + * <security-role-ref> entry in ejb-jar.xml + */ + public String[] rolesReferenced() default {}; + +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebMethod.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebMethod.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,38 @@ +package javax.jws; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Specifies that the logic of the associated method is exposed as a Web + * Service operation, making it part of the Web Service's public + * contract. A client may invoke the Web Service using one of the + * available protocols and message formats. A WebMethod annotation is + * required for each method that is published by the Web Service. The + * associated method must be public and its parameters, return value, and + * exceptions must follow the rules defined in JAX-RPC 1.1 section 5. + * The method is not required to throw java.rmi.RemoteException. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.METHOD}) +public @interface WebMethod { + + /** + * Name of the WSDL <operation> matching this method. Defaults + * to the name of the Java method + */ + String operationName() default ""; + + /** + * The action for this operation. For SOAP binding, this determines + * the value of <code>soap:action</code> header. + * + */ + String action() default ""; +}; + Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebParam.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebParam.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,45 @@ +package javax.jws; + +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * Customizes the mapping of an individual parameter to a Web Service message + * part or element. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.PARAMETER}) +public @interface WebParam { + + /** + * The parameter mode + */ + public enum Mode { IN, OUT, INOUT }; + + /** + * Name of the parameter as it appears in the WSDL. Maps to the + * <code>wsdl:part</code> for RPC style bindings, and to an element + * name for document-style bindings. Defaults to the name of the + * parameter as it appears in the argument list. + */ + String name() default ""; + + /** + * The direction in which the parameter is flowing. One of IN, + * OUT, or INOUT. The OUT and INOUT modes may only be specified + * for parameter types that conform to the JAX-RPC definition + * of Holder types. + */ + Mode mode() default Mode.IN; + + /** + * If true, the parameter is pulled from a header rather then the + * message body. + */ + boolean header() default false; +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebResult.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebResult.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,25 @@ +package javax.jws; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Customizes the mapping of a method return value onto a WSDL message + * part or XML element. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.METHOD}) +public @interface WebResult { + + /** + * Name of the return value as it appears in the WSDL or XML. Used + * as the name of the wsdl:part for RPC bindings, and as the local name + * of the XML element matching the return value for document bindings. + */ + public String name() default "result"; +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebService.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/WebService.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,57 @@ +package javax.jws; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Specifies that a particular Java class implements a Web Service + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.TYPE}) +public @interface WebService { + /** + * Name of the Web service. Maps to the name of the <wsdl:portType> + */ + String name() default ""; + + + String serviceName() default ""; + + /** + * The location of a pre-defined WSDL describing the service. The + * <code>wsdlLocation</code> is a URL (relative or absolute) that refers + * to a pre-existing WSDL file. The presence of a + * <code>wsdlLocation</code> value indicates that the JSR 181 processor + * should not + * generate WSDL from the Java WS, but should instead provide feedback if + * the the Java WS is inconsistent with the <code>portType</code> and + * bindings declared in this WSDL. Note that a single WSDL file might + * contain multiple <code>portTypes</code> and multiple bindings. The + * annotations on the Java WS file determine the specific + * <code>portType</code> and bindings that correspond to the Web Service. + */ + String wsdlLocation() default ""; + + /** + * The XML namespace used for WSDL elements generated from this + * interface/class. + */ + String targetNamespace() default ""; + + /** + * + * The name of the Service Endpoint Interface defining the public + * contract to this object. For convenience, Java programmers may share + * the service endpoint interface as the interface between the client and + * server. This member-value allows the developer to explicitly control + * the name of the service endpoint interface. Defaults to an interface + * in the same package as the Web service implementation using the Web + * service name. + * + */ + String endpointInterface() default ""; +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/DocumentWrapper.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/DocumentWrapper.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,32 @@ +package javax.jws.soap; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.jws.QName; + +/** + * Defines the name and namespace for the wrapper elements of a document + * wrapped operation. This annotation may only be applied to operations + * that are of the document wrapped style. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.METHOD}) +public @interface DocumentWrapper { + /** + * Name and namespace URI of the XML element that wraps the request + * parameters + */ + QName requestElement() default @QName(); + + /** + * Name and namespace URI of the XML element that wraps the response + * parameters. It is an error to specify this value for @Oneway + * methods. + */ + QName responseElement() default @QName(); +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPBinding.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPBinding.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,89 @@ +package javax.jws.soap; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * Specifies the mapping of the Web Service onto the SOAP message protocol. + * The <code>SOAPBinding</code> annotation may be applied at either the class + * or method level. If applied at the class level, the annotation affects the + * SOAP binding for all operations on the Web Service. If applied at the + * method level, the annotation overrides any settings applied at the class + * level for that individual method. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.TYPE, ElementType.METHOD}) +public @interface SOAPBinding { + + /** + * The encoding style for messages sent to and from the Web Service + */ + public enum Style { + /** Messages are encoded document style */ + DOCUMENT, + + /** Messages are encoded in RPC style */ + RPC, + DEFAULT + }; + + /** + * The message formatting style. + */ + public enum Use { + /** Messages are formatted according to their predefined XSD schema */ + LITERAL, + + /** Messages are formatted according to SOAP section 5 */ + ENCODED, + DEFAULT + }; + + /** + * The parameter style for methods on this Web Service. + */ + public enum ParameterStyle { + + /** + * Each parameter is encoded as its own child element following the + * SOAP body. + */ + BARE, + + /** + * Parameters are wrapped with a single element following the SOAP + * body. The name and namespace of the wrapper elements may be + * controlled through the <code>DocumentWrapper.requestElement</code> + * and <code>DocumentWrapper.responseElement</code> + * + */ + WRAPPED, + DEFAULT + }; + + /** + * Defines the encoding style for messages send to and from the + * Web Service. + * + */ + Style style() default Style.DEFAULT; + + /** + * Defines the formatting style for messages sent to and from the Web + * Service. + */ + Use use() default Use.DEFAULT; + + /** + * The default parameter style for SOAP request and responses sent to and + * from methods on the Web Service. The parameter style controls whether + * the parameters are wrapped within a single element following the SOAP + * body. This member-value is only used for document/literal Web Services. + */ + ParameterStyle parameterStyle() default ParameterStyle.WRAPPED; +} Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPMessageHandler.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPMessageHandler.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,29 @@ +package javax.jws.soap; + +import javax.jws.InitParam; +import javax.jws.QName; + +/** + * Defines the configuration for a SOAP message handler which runs before + * and after the business method of a service. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ +public @interface SOAPMessageHandler { + + /** Name of the handler */ + String name() default ""; + + /** Name of the handler class */ + String className(); + + /** Initialization parameters for the handler */ + InitParam[] initParams() default {}; + + /** List of SOAP roles implemented by the handler */ + String[] roles() default {}; + + /** List of SOAP headers processed by the handler */ + QName[] headers() default {}; +}; Added: incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPMessageHandlers.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/javax/jws/soap/SOAPMessageHandlers.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,25 @@ +package javax.jws.soap; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * Specifies a list of SOAP protocol handlers that run before and after + * business methods on the Web Service. These handlers are called in + * response to SOAP messages targeting the service. The handler API and + * processing rules are described in JAX-RPC 1.1, section 12. + * + * It is an error to combine this annotation with the <code>HandlerChain</code> + * annotation. + * + * @author Copyright (c) 2003-2005 BEA Systems, Inc. + * + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED]({ElementType.TYPE}) +public @interface SOAPMessageHandlers { + /** The list of SOAP message handlers */ + public SOAPMessageHandler[] value(); +}; Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/InitParamInfo.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/InitParamInfo.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,57 @@ +package org.apache.beehive.wsm; + +import org.apache.beehive.wsm.WSMProcessorException; + +import javax.jws.InitParam; +/* + * Copyright 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. + * + * $Header:$ + */ +public class InitParamInfo { + + + String name; + String value; + + /** + * @return Returns the name. + */ + public String getName() { + return name; + } + /** + * @param name The name to set. + */ + public void setName(String name) { + this.name = name; + } + /** + * @return Returns the value. + */ + public String getValue() { + return value; + } + /** + * @param value The value to set. + */ + public void setValue(String value) { + this.value = value; + } + public InitParamInfo() { + } + + +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/InvalidFileType.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/InvalidFileType.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,53 @@ +package org.apache.beehive.wsm; +/* + * Copyright 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. + * + * $Header:$ + */ + +public class InvalidFileType extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * + */ + public InvalidFileType() { + super(); + } + + /** + * @param arg0 + */ + public InvalidFileType(String arg0) { + super(arg0); + } + + /** + * @param arg0 + * @param arg1 + */ + public InvalidFileType(String arg0, Throwable arg1) { + super(arg0, arg1); + } + + /** + * @param arg0 + */ + public InvalidFileType(Throwable arg0) { + super(arg0); + } + +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/QNameInfo.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/QNameInfo.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,63 @@ +package org.apache.beehive.wsm; + +import javax.jws.QName; +/* + * Copyright 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. + * + * $Header:$ + */ +public class QNameInfo { + + private String namespaceURI = null; + private String localName = null; + + public QNameInfo(QName qName) { + this.namespaceURI = qName.namespaceURI(); + this.localName = qName.localName(); + + } + + public QNameInfo() { + } + + + public QNameInfo(String namespaceURI, String localName) { + this.namespaceURI = namespaceURI; + this.localName = localName; + } + + public String getNamespaceURI() { + return namespaceURI; + } + + public String getLocalName() { + return localName; + } + + /** + * @param localName The localName to set. + */ + public void setLocalName(String localName) { + this.localName = localName; + } + /** + * @param namespaceURI The namespaceURI to set. + */ + public void setNamespaceURI(String namespaceURI) { + this.namespaceURI = namespaceURI; + } + + +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SOAPMessageHandlersInfo.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SOAPMessageHandlersInfo.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,97 @@ +package org.apache.beehive.wsm; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; + +import javax.jws.InitParam; +import javax.jws.QName; + + +/* + * Copyright 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. + * + * $Header:$ + */ + +public class SOAPMessageHandlersInfo { + String name; + String className; + Collection<InitParam> params = new ArrayList<InitParam>(); + Collection<String> roles = new ArrayList<String>(); + Collection<QName> headers = new ArrayList<QName>(); + /** + * @return Returns the className. + */ + public String getClassName() { + return className; + } + /** + * @param className The className to set. + */ + public void setClassName(String className) { + this.className = className; + } + /** + * @return Returns the name. + */ + public String getName() { + return name; + } + /** + * @param name The name to set. + */ + public void setName(String name) { + this.name = name; + } + /** + * @return Returns the headers. + */ + public Collection<QName> getHeaders() { + return Collections.unmodifiableCollection(headers); + } + + public void addHeader(QName header) { + headers.add(header); + } + /** + * @return Returns the params. + */ + public Collection<InitParam> getParams() { + return Collections.unmodifiableCollection(params); + } + + public void addInitParam(InitParam param) { + params.add(param); + } + + public void addInitParam(Collection<InitParam> params) { + params.addAll(params); + } + /** + * @return Returns the roles. + */ + public Collection<String> getRoles() { + return Collections.unmodifiableCollection(roles); + } + + public void addRoles(String role) { + roles.add(role); + } + + public void addRoles(Collection<String> roles) { + roles.addAll(roles); + } +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SecurityRolesInfo.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SecurityRolesInfo.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,59 @@ +package org.apache.beehive.wsm; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +/* + * Copyright 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. + * + * $Header:$ + */ + +public class SecurityRolesInfo { + + Collection<String> rolesAllowed = new ArrayList<String>(); + Collection<String> rolesReferenced = new ArrayList<String>(); + + /** + * @return Returns the wrRolesAllowed. + */ + public Collection<String> getRolesAllowed() { + return Collections.unmodifiableCollection(rolesAllowed); + } + + public void addRolesAllowed(String role) { + rolesAllowed.add(role); + } + + public void addRolesAllowed(Collection<String> roles) { + rolesAllowed.addAll(roles); + } + /** + * @return Returns the wrRolesReferenced. + */ + public Collection<String> getWrRolesReferenced() { + return Collections.unmodifiableCollection(rolesReferenced); + } + + public void addRolesReferenced(String role) { + rolesReferenced.add(role); + } + + public void addRolesReferenced(Collection<String> roles) { + rolesReferenced.addAll(roles); + } + +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SoapBindingInfo.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/SoapBindingInfo.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,65 @@ +package org.apache.beehive.wsm; + +import javax.jws.soap.SOAPBinding; + +/* + * Copyright 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. + * + * $Header:$ + */ + +public class SoapBindingInfo { + SOAPBinding.Style style; + SOAPBinding.Use use; + SOAPBinding.ParameterStyle parameterStyle; + + + /** + * @return Returns the parameterStyle. + */ + public SOAPBinding.ParameterStyle getParameterStyle() { + return parameterStyle; + } + /** + * @param parameterStyle The parameterStyle to set. + */ + public void setParameterStyle(SOAPBinding.ParameterStyle parameterStyle) { + this.parameterStyle = parameterStyle; + } + /** + * @return Returns the style. + */ + public SOAPBinding.Style getStyle() { + return style; + } + /** + * @param style The style to set. + */ + public void setStyle(SOAPBinding.Style style) { + this.style = style; + } + /** + * @return Returns the use. + */ + public SOAPBinding.Use getUse() { + return use; + } + /** + * @param use The use to set. + */ + public void setUse(SOAPBinding.Use use) { + this.use = use; + } +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WSMProcessorException.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WSMProcessorException.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,39 @@ +package org.apache.beehive.wsm; + +/* + * Copyright 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. + * + * $Header:$ + */ +public class WSMProcessorException extends RuntimeException { + + public WSMProcessorException() { + super(); + } + + public WSMProcessorException(String msg) { + super(msg); + } + + public WSMProcessorException(String msg, Throwable t) { + super(msg, t); + } + + public WSMProcessorException(Throwable t) { + super(t); + } + + //more??? +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServiceMETHODMetadata.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServiceMETHODMetadata.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,164 @@ +package org.apache.beehive.wsm; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +/* + * Copyright 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. + * + * $Header:$ + */ + +public class WebServiceMETHODMetadata { + String wmOperationName; + String wmAction; + + boolean oneWay; // should be called oOneWay, but that looks strange! + + List<WebServicePARAMETERMetadata> params = new ArrayList<WebServicePARAMETERMetadata>(); + + String wrName; // webresults + + SoapBindingInfo soapBinding; + + String dwRequestElement; + String dwResponseElement; + + SecurityRolesInfo securityRoles; + private String javaMethodName; + private String javaReturnType; + + public WebServiceMETHODMetadata(String javaMethodName, String javaReturnType) { + this.javaMethodName = javaMethodName; + this.javaReturnType = javaReturnType; + } + + + /** + * @return Returns the dwRequestElement. + */ + public String getDwRequestElement() { + return dwRequestElement; + } + /** + * @param dwRequestElement The dwRequestElement to set. + */ + public void setDwRequestElement(String dwRequestElement) { + this.dwRequestElement = dwRequestElement; + } + /** + * @return Returns the dwResponseElement. + */ + public String getDwResponseElement() { + return dwResponseElement; + } + /** + * @param dwResponseElement The dwResponseElement to set. + */ + public void setDwResponseElement(String dwResponseElement) { + this.dwResponseElement = dwResponseElement; + } + /** + * @return Returns the oneWay. + */ + public boolean isOneWay() { + return oneWay; + } + /** + * @param oneWay The oneWay to set. + */ + public void setOneWay(boolean oneWay) { + this.oneWay = oneWay; + } + /** + * @return Returns the securityRoles. + */ + public SecurityRolesInfo getSecurityRoles() { + return securityRoles; + } + /** + * @param securityRoles The securityRoles to set. + */ + public void setSecurityRoles(SecurityRolesInfo securityRoles) { + this.securityRoles = securityRoles; + } + /** + * @return Returns the soapBinding. + */ + public SoapBindingInfo getSoapBinding() { + return soapBinding; + } + /** + * @param soapBinding The soapBinding to set. + */ + public void setSoapBinding(SoapBindingInfo soapBinding) { + this.soapBinding = soapBinding; + } + /** + * @return Returns the wmAction. + */ + public String getWmAction() { + return wmAction; + } + /** + * @param wmAction The wmAction to set. + */ + public void setWmAction(String wmAction) { + this.wmAction = wmAction; + } + /** + * @return Returns the wmOperationName. + */ + public String getWmOperationName() { + return wmOperationName; + } + /** + * @param wmOperationName The wmOperationName to set. + */ + public void setWmOperationName(String wmOperationName) { + this.wmOperationName = wmOperationName; + } + /** + * @return Returns the wrName. + */ + public String getWrName() { + return wrName; + } + /** + * @param wrName The wrName to set. + */ + public void setWrName(String wrName) { + this.wrName = wrName; + } + /** + * @return Returns the params. + */ + public List<WebServicePARAMETERMetadata> getParams() { + return Collections.unmodifiableList(params); + } + + public void addParams(WebServicePARAMETERMetadata param) { + params.add(param); + } + + public String getJavaMethodName() { + return javaMethodName; + } + + public String getJavaReturnType() { + return javaReturnType; + } +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServicePARAMETERMetadata.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServicePARAMETERMetadata.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,83 @@ +package org.apache.beehive.wsm; +/* + * Copyright 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. + * + * $Header:$ + */ + +import javax.jws.WebParam; + +public class WebServicePARAMETERMetadata { + + String wpName; + WebParam.Mode wpMode; + boolean wpHeader; + private String javaType; + + + public WebServicePARAMETERMetadata(String javaType) { + this.javaType = javaType; + } + /** + * @return Returns the wpHeader. + */ + public boolean isWpHeader() { + return wpHeader; + } + /** + * @param wpHeader The wpHeader to set. + */ + public void setWpHeader(boolean wpHeader) { + this.wpHeader = wpHeader; + } + /** + * @return Returns the wpMode. + */ + public WebParam.Mode getWpMode() { + return wpMode; + } + /** + * @param wpMode The wpMode to set. + */ + public void setWpMode(WebParam.Mode wpMode) { + this.wpMode = wpMode; + } + /** + * @return Returns the wpName. + */ + public String getWpName() { + return wpName; + } + /** + * @param wpName The wpName to set. + */ + public void setWpName(String wpName) { + this.wpName = wpName; + } + /** + * + */ + public WebServicePARAMETERMetadata() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @return Returns the javaType. + */ + public String getJavaType() { + return javaType; + } +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServiceTYPEMetadata.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/WebServiceTYPEMetadata.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,292 @@ +package org.apache.beehive.wsm; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import javax.jws.*; +import javax.jws.soap.*; + +import org.apache.beehive.wsm.wsdl.WSDLProcessor; +import org.apache.xmlbeans.XmlException; +import org.xmlsoap.schemas.wsdl.DefinitionsDocument; +/* + * Copyright 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. + * + * $Header:$ + */ + +public class WebServiceTYPEMetadata { + + String wsName; + + String wsServiceName; + + String wsWsdlLocation; + + String wsTargetNamespace; + + Collection<WebServiceMETHODMetadata> methods = new ArrayList<WebServiceMETHODMetadata>(); + + SoapBindingInfo soapBinding; + + String hcFileName; + + String hcName; + + Map<String, SOAPMessageHandlersInfo> soapHandlers = new HashMap<String, SOAPMessageHandlersInfo>(); + + SecurityRolesInfo securityRoles; + + String siRunAs; + + private String javaFQClassName; + + + + + static public WebServiceTYPEMetadata buildWSMetadata(Class clazz) { + WebServiceTYPEMetadata model = new WebServiceTYPEMetadata(clazz.getName()); + //set the webservice annotation + WebService webServiceAnnotation = (WebService)clazz.getAnnotation(WebService.class); + model.setFromAnnotation(webServiceAnnotation); + SOAPBinding soapBindingAnnotation = (SOAPBinding)clazz.getAnnotation(SOAPBinding.class); + model.setFromAnnotation(soapBindingAnnotation); + //TODO: Add the rest from Anil code here. + + return model; + } + + private void setFromAnnotation(WebService annotation) { + setWsName( annotation.name()); + setWsServiceName(annotation.serviceName()); + setWsTargetNamespace(annotation.targetNamespace()); + setWsWsdlLocation(annotation.wsdlLocation()); + + } + + private void setFromAnnotation(SOAPBinding annotation) { + //TODO: From Anil code + } + + private void setFromAnnotation(HandlerChain annotation) { + //TODO: From Anil code + + } + private void setFromAnnotation(SOAPMessageHandler annotation) { + //TODO: From Anil code + + } + private void setFromAnnotation(SecurityRoles annotation) { + //TODO: From Anil code + + } + private void setFromAnnotation(SecurityIdentity annotation) { + //TODO: From Anil code + + } + + static public WebServiceTYPEMetadata buildWSMetadata(String filename) + throws InvalidFileType { + if (filename.endsWith(".java") || filename.endsWith(".jws")) { + //TODO: get the object model from 2 phase processor + return null; + } else { + throw new InvalidFileType( + "File: " + + filename + + " is not supported. Only .java, .jws, and .class files are supported"); + } + } + + + // Constructor + public WebServiceTYPEMetadata(String javaFQClassName) { + this.javaFQClassName = javaFQClassName; + } + + public boolean validate() { + //TODO: Implement the validate for the object model + return true; + } + + public DefinitionsDocument getWSDLAsDocument() throws IOException, + XmlException { + return WSDLProcessor.parseWSDL(getWsWsdlLocation()); + } + + + /** + * @return Returns the hcFileName. + */ + public String getHcFileName() { + return hcFileName; + } + + /** + * @param hcFileName + * The hcFileName to set. + */ + public void setHcFileName(String hcFileName) { + this.hcFileName = hcFileName; + } + + /** + * @return Returns the hcName. + */ + public String getHcName() { + return hcName; + } + + /** + * @param hcName + * The hcName to set. + */ + public void setHcName(String hcName) { + this.hcName = hcName; + } + + /** + * @return Returns the securityRoles. + */ + public SecurityRolesInfo getSecurityRoles() { + return securityRoles; + } + + /** + * @param securityRoles + * The securityRoles to set. + */ + public void setSecurityRoles(SecurityRolesInfo securityRoles) { + this.securityRoles = securityRoles; + } + + /** + * @return Returns the siRunAs. + */ + public String getSiRunAs() { + return siRunAs; + } + + /** + * @param siRunAs + * The siRunAs to set. + */ + public void setSiRunAs(String siRunAs) { + this.siRunAs = siRunAs; + } + + /** + * @return Returns the soapBinding. + */ + public SoapBindingInfo getSoapBinding() { + return soapBinding; + } + + /** + * @param soapBinding + * The soapBinding to set. + */ + public void setSoapBinding(SoapBindingInfo soapBinding) { + this.soapBinding = soapBinding; + } + + /** + * @return Returns the wsName. + */ + public String getWsName() { + return wsName; + } + + /** + * @param wsName + * The wsName to set. + */ + public void setWsName(String wsName) { + this.wsName = wsName; + } + + /** + * @return Returns the wsServiceName. + */ + public String getWsServiceName() { + return wsServiceName; + } + + /** + * @param wsServiceName + * The wsServiceName to set. + */ + public void setWsServiceName(String wsServiceName) { + this.wsServiceName = wsServiceName; + } + + /** + * @return Returns the wsTargetNamespace. + */ + public String getWsTargetNamespace() { + return wsTargetNamespace; + } + + /** + * @param wsTargetNamespace + * The wsTargetNamespace to set. + */ + public void setWsTargetNamespace(String wsTargetNamespace) { + this.wsTargetNamespace = wsTargetNamespace; + } + + /** + * @return Returns the wsWsdlLocation. + */ + public String getWsWsdlLocation() { + return wsWsdlLocation; + } + + /** + * @param wsWsdlLocation + * The wsWsdlLocation to set. + */ + public void setWsWsdlLocation(String wsWsdlLocation) { + this.wsWsdlLocation = wsWsdlLocation; + } + + /** + * @return Returns the methods. + */ + public Collection<WebServiceMETHODMetadata> getMethods() { + return Collections.unmodifiableCollection(methods); + } + + public void addMethod(WebServiceMETHODMetadata method) { + methods.add(method); + } + + /** + * @return Returns the soapHandlers. + */ + public Map<String, SOAPMessageHandlersInfo> getSoapHandlers() { + return soapHandlers; + } + + /** + * @return Returns the wsJavaFQClassName. + */ + public String getJavaFQClassName() { + return javaFQClassName; + } +} \ No newline at end of file Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/ProcessorException.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/ProcessorException.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,33 @@ +package org.apache.beehive.wsm.runtime.processor; + +/* + * Copyright 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. + * + * $Header:$ + */ + + +/** + * A simple exception wrapper class used for processor failures. + * It subclasses runtime exception because user errors that result in code + * generation failures are reported through the APT messager class. + */ +public class ProcessorException extends RuntimeException +{ + public ProcessorException(String msg, Exception e) { super(msg, e); } + public ProcessorException(String msg) { super(msg); } + public ProcessorException(Exception e) { super("Code Generation Exception", e); } +} + Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/TwoPhaseAnnotationProcessor.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,154 @@ +package org.apache.beehive.wsm.runtime.processor.apt; + +/* + * Copyright 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. + * + * $Header:$ + */ + +import java.io.IOException; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +import com.sun.mirror.apt.AnnotationProcessor; +import com.sun.mirror.apt.AnnotationProcessorEnvironment; +import com.sun.mirror.declaration.AnnotationTypeDeclaration; +import com.sun.mirror.declaration.Declaration; + +import org.apache.beehive.wsm.runtime.processor.ProcessorException; + +/** + * The TwoPhaseAnnotationProcessor class is an abstract class that implements the APT + * AnnotationProcessor interface. It breaks the work of the process() method of the + * AnnotationProcessor down into two distinct phases, represented as abstract method + * of TwoPhaseAnnotationProcessor that are to be implemented by concrete subclasses. + * <p> + * The two phases of processing are: + * <ul> + * <li>The <b>check</b> phase is used to validate input Declarations that have been + * annotated with annotations claimed by the processor to ensure that it + * is semantically valid. If the presence of the input Declaration implies the need + * to add new files, and those files need to be visible during the check phase for + * other Declarations, then the AnnotationProcessorEnvironment's Filer API should be + * used to add those files in this phase. The adding of such files at this point + * should typically not result in their emission to persistent storage (i.e. disk), + * but rather be kept in memory to be referenced by the check phase of other + * Declarations. + * <li>The <b>generate</b> phase will actually emit any source, binary, or class files + * that are derived from the input Declaration, including files added via the Filer + * API during the check phase. The Filer API may also be used in this phase to add + * new files, however, such additions will not be visible during the check phase of + * any Declarations. + * </ul> + * <p> + * The benefits of breaking process() down into check() and generate() phases are: + * <ol> + * <li>Makes it possible to perform the semantic validation of Declarations without + * necessarily resulting in code generation. + * <li>Provides a clearer association between input Declarations and generator output. + * </ol> + * TwoPhaseAnnotationProcessor is intended provide a uniform mechanism for writing + * AnnotationProcessor implementations that can be used in tooling environments more + * sophisticated than command-line tools (that may not do all their work on source + * in a single pass). Such environments will typically also provide implementations + * of the AnnotationProcessorEnvironment and associated interfaces (Messager, + * Filer etc). + */ +abstract public class TwoPhaseAnnotationProcessor implements AnnotationProcessor +{ + public TwoPhaseAnnotationProcessor(Set<AnnotationTypeDeclaration> atds, + AnnotationProcessorEnvironment env) + { + _atds = atds; + _env = env; + } + + /** + * Implements AnnotationProcessor.process() as two phases, "check" and "generate". + */ + public void process() + { + check(); + generate(); + } + + /** + * Performs semantic validation of input Declarations that are annotated with + * annotations claimed by this AnnotationProcessor. + */ + public void check() + { + for (AnnotationTypeDeclaration atd : _atds) + { + Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd); + for (Declaration decl : decls) + { + check(decl); + } + } + } + + /** + * Emits additional artifacts for input Declarations that are annotated with + * annotations claimed by this AnnotationProcessor. + */ + public void generate() throws ProcessorException + { + for (AnnotationTypeDeclaration atd : _atds) + { + Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd); + for (Declaration decl : decls) + { + generate(decl); + } + } + } + + /** + * The check method is responsible for all semantic validation of the input Declaration. + * <p> + * All semantic warnings/errors associated with the input Declaration should + * be output during check via a Messager obtained from the + * AnnotationProcessorEnvironment. + * <p> + * If the presence of the input Declaration implies the need to add new files, + * and those files need to be visible during the check phase for + * other Declarations, then the AnnotationProcessorEnvironment's Filer API should be + * used to add those files in this phase. The adding of such files at this point + * should typically not result in their emission to persistent storage (i.e. disk), + * but rather be kept in memory to be referenced by the check phase of other + * Declarations. + */ + abstract public void check(Declaration decl); + + /** + * The generate method is responsible for the generation of any additional artifacts + * (source, class, or binary) that are derived from the input Declaration. + */ + abstract public void generate(Declaration decl); + + protected AnnotationProcessorEnvironment getAnnotationProcessorEnvironment() + { + return _env; + } + + Set<AnnotationTypeDeclaration> _atds; + AnnotationProcessorEnvironment _env; +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessor.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,339 @@ +package org.apache.beehive.wsm.runtime.processor.apt; + +/* + * Copyright 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. + * + * $Header:$ + */ + +import java.io.IOException; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +import java.lang.annotation.Annotation; + +import com.sun.mirror.apt.AnnotationProcessor; +import com.sun.mirror.apt.AnnotationProcessorFactory; +import com.sun.mirror.apt.AnnotationProcessorEnvironment; + +import com.sun.mirror.declaration.AnnotationMirror; +import com.sun.mirror.declaration.AnnotationTypeDeclaration; +import com.sun.mirror.declaration.ClassDeclaration; +import com.sun.mirror.declaration.Declaration; +import com.sun.mirror.declaration.MethodDeclaration; +import com.sun.mirror.declaration.ParameterDeclaration; + +import org.apache.beehive.wsm.runtime.processor.ProcessorException; + +import org.apache.beehive.wsm.*; + + +/** + * FIXME Should this also generate a new source file and/or class file that + * contains default values as specified in JSR-181? + */ +public class WsmAnnotationProcessor extends TwoPhaseAnnotationProcessor +{ + /** + * Constructor. + * @param atds + * @param env + * @return + */ + public WsmAnnotationProcessor(Set<AnnotationTypeDeclaration> atds, + AnnotationProcessorEnvironment env) + { + super(atds, env); + } + + public WebServiceTYPEMetadata getObjectModel() + { + return this.wstm; + } + + @Override + public void check(Declaration decl) + { + // we're only interested in class declarations + if (! (decl instanceof ClassDeclaration)) + { + return; // todo Handle error properly / throw exception + } + + // get & store object model + if (null != (decl.getAnnotation(javax.jws.WebService.class))) + { + this.wstm = getWebServiceTYPEMetadata((ClassDeclaration) decl); + } + } + + @Override + public void generate(Declaration decl) + { + // todo: on demand code generation + + // todo: do something useful with this.wstm, the object model + printObjectModel(); + + // todo: these print statement are for demonstration purposes only + } + + /** + * Builds the metadata structure that describes the Web service defined + * in the source file. + * Encapsulates JSR-181 data and procedures. + * @param decl + * @return + */ + private WebServiceTYPEMetadata getWebServiceTYPEMetadata(ClassDeclaration decl) + { + // @WebService + javax.jws.WebService ws = decl.getAnnotation(javax.jws.WebService.class); + if (null == ws) + { + throw new IllegalArgumentException(); + } + WebServiceTYPEMetadata wstm = + new WebServiceTYPEMetadata(decl.getQualifiedName()); + + // name: JSR-181 default value + if ((null == ws.name ()) || (0 == ws.name().length())) + { + wstm.setWsName(decl.getSimpleName()); + } + else + { + wstm.setWsName(ws.name()); + } + + // serviceName: JSR-181 default value + if ((null == ws.serviceName()) || (0 == ws.serviceName().length())) + { + wstm.setWsServiceName(decl.getSimpleName() + "Service"); + } + else + { + wstm.setWsServiceName(ws.serviceName()); + } + + // wsdlLocation: set JSR-181 default value + wstm.setWsWsdlLocation(ws.wsdlLocation()); + + // targetNamespace: set JSR-181 default value + if ((null == ws.targetNamespace()) || (0 == ws.targetNamespace().length())) + { + wstm.setWsTargetNamespace(decl.getPackage().getQualifiedName()); + // todo: check if namespace is correct + } + else + { + wstm.setWsTargetNamespace(ws.targetNamespace()); + } + + // @SOAPBinding + javax.jws.soap.SOAPBinding sb; + if (null != (sb = decl.getAnnotation(javax.jws.soap.SOAPBinding.class))) + { + // todo + } + + // @HandlerChain + javax.jws.HandlerChain hc; + if (null != (hc = decl.getAnnotation(javax.jws.HandlerChain.class))) + { + // todo + } + + // @SecurityIdentity + javax.jws.SecurityIdentity si; + if (null != (si = decl.getAnnotation(javax.jws.SecurityIdentity.class))) + { + // todo + } + + // @SecurityRoles + javax.jws.SecurityRoles sr; + if (null != (sr = decl.getAnnotation(javax.jws.SecurityRoles.class))) + { + // todo + } + + this.wstm = wstm; + + // delegate handling of annotated methods + for ( MethodDeclaration md : decl.getMethods() ) + { + if (null != (md.getAnnotation(javax.jws.WebMethod.class))) + { + wstm.addMethod(getWebServiceMETHODMetadata(md)); + } + } + + // todo semantic checking for annotated web service + + return wstm; + } + + private WebServiceMETHODMetadata getWebServiceMETHODMetadata(MethodDeclaration decl) + { + // @WebMethod + javax.jws.WebMethod wm = decl.getAnnotation(javax.jws.WebMethod.class); + if (null == wm) + { + throw new IllegalArgumentException(); + } + WebServiceMETHODMetadata wsmm = new WebServiceMETHODMetadata( + decl.getSimpleName(), + decl.getReturnType().getClass().getName() + ); + + // operationName: set JSR-181 default value + if ((null == wm.operationName()) || (0 == wm.operationName().length())) + { + wsmm.setWmOperationName(decl.getSimpleName()); + } + else + { + wsmm.setWmOperationName(wm.operationName()); + } + + // action: set JSR-181 default value + if ((null == wm.action()) || (0 == wm.action().length())) + { + wsmm.setWmAction(wstm.getWsTargetNamespace() + "/" + decl.getSimpleName()); + } + else + { + wsmm.setWmAction(wm.action()); + } + + // @WebResult + javax.jws.WebResult wr; + if (null != (wr = decl.getAnnotation(javax.jws.WebResult.class))) + { + // todo + } + + // @Oneway + javax.jws.Oneway ow; + if (null != (ow = decl.getAnnotation(javax.jws.Oneway.class))) + { + // todo + } + + // @DocumentWrapper + javax.jws.soap.DocumentWrapper dw; + if (null != (dw = decl.getAnnotation(javax.jws.soap.DocumentWrapper.class))) + { + // todo + } + + // @SOAPMessageHandlers + javax.jws.soap.SOAPMessageHandlers smh; + if (null != (smh = decl.getAnnotation(javax.jws.soap.SOAPMessageHandlers.class))) + { + // todo + } + + // delegate handling of annotated parameters + for ( ParameterDeclaration pd : decl.getParameters() ) + { + if (null != (pd.getAnnotation(javax.jws.WebParam.class))) + { + wsmm.addParams(getWebServicePARAMETERMetadata(pd)); + } + } + + // todo semantic checking for annotated method + + return wsmm; + } + + private WebServicePARAMETERMetadata getWebServicePARAMETERMetadata(ParameterDeclaration decl) + { + // @WebParam + javax.jws.WebParam wp = decl.getAnnotation(javax.jws.WebParam.class); + if (null == wp) + { + throw new IllegalArgumentException(); + } + WebServicePARAMETERMetadata wspm = new WebServicePARAMETERMetadata(); + + // name: set JSR-181 default value + if ((null == wp.name()) || (0 == wp.name().length())) + { + wspm.setWpName(decl.getSimpleName()); + } + else + { + wspm.setWpName(wp.name()); + } + + // mode: set JSR-181 default value + wspm.setWpMode(wp.mode()); + + // header: set JSR-181 default value + wspm.setWpHeader(wp.header()); + + // todo semantic checking for annotated parameter + + return wspm; + } + + private WebServiceTYPEMetadata wstm; + + // private and temporary test methods + + private void printObjectModel() + { + System.out.println(wsToString()); + } + + private String wsToString() + { + StringBuffer sb = new StringBuffer(); + + sb.append("@WebService(\n"); + sb.append("\tname=\"" + wstm.getWsName() + "\"\n"); + sb.append("\tserviceName=\"" + wstm.getWsServiceName() + "\"\n"); + sb.append("\ttargetNamespace=\"" + wstm.getWsTargetNamespace() + "\"\n"); + sb.append("\twsdlLocation=\"" + wstm.getWsWsdlLocation() + "\"\n"); + sb.append(")\n"); + + for ( WebServiceMETHODMetadata wsmm : wstm.getMethods() ) + { + sb.append(wmToString(wsmm) + "\n"); + } + + return sb.toString(); + } + + private String wmToString(WebServiceMETHODMetadata wsmm) + { + StringBuffer sb = new StringBuffer(); + + sb.append("@WebMethod(\n"); + sb.append("\toperationName=\"" + wsmm.getWmOperationName() + "\"\n"); + sb.append("\taction=\"" + wsmm.getWmAction() + "\"\n"); + sb.append(")\n"); + + return sb.toString(); + } +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessorFactory.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/processor/apt/WsmAnnotationProcessorFactory.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,55 @@ +package org.apache.beehive.wsm.runtime.processor.apt; + +/* + * Copyright 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. + * + * $Header:$ + */ + +import static java.util.Arrays.*; +import java.util.ArrayList; +import java.util.Collection; +import static java.util.Collections.*; +import java.util.Set; + +import com.sun.mirror.apt.AnnotationProcessor; +import com.sun.mirror.apt.AnnotationProcessorFactory; +import com.sun.mirror.apt.AnnotationProcessorEnvironment; +import com.sun.mirror.declaration.AnnotationTypeDeclaration; + +public class WsmAnnotationProcessorFactory implements AnnotationProcessorFactory +{ + private static final Collection<String> supportedAnnotations = + unmodifiableCollection( + asList(new String[] { "javax.jws.WebService" })); + + private static final Collection<String> supportedOptions = emptySet(); + + public Collection<String> supportedAnnotationTypes() + { + return supportedAnnotations; + } + + public Collection<String> supportedOptions() + { + return supportedOptions; + } + + public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, + AnnotationProcessorEnvironment env) + { + return new WsmAnnotationProcessor(atds, env); + } +} Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/wsdl/WSDLProcessor.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/wsdl/WSDLProcessor.java Thu Aug 26 16:22:42 2004 @@ -0,0 +1,116 @@ +/* + * Copyright 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. + * + * $Header:$ + */ + +package org.apache.beehive.wsm.wsdl; + +import java.lang.reflect.Array; +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import org.xmlsoap.schemas.wsdl.DefinitionsDocument; +import org.xmlsoap.schemas.wsdl.TDefinitions; +import org.xmlsoap.schemas.wsdl.TBindingOperation; +import org.xmlsoap.schemas.wsdl.TBindingOperationMessage; +import org.xmlsoap.schemas.wsdl.TBinding; +import org.xmlsoap.schemas.wsdl.TDefinitions; +import org.xmlsoap.schemas.wsdl.TPort; + +import org.apache.xmlbeans.SchemaType; +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; + + +/******************************************************************************* + * + * + */ +public class WSDLProcessor { + + private DefinitionsDocument mDefDoc; + + public static DefinitionsDocument parseWSDL(String wsdlLocation) + throws IOException, MalformedURLException, XmlException + { + if (wsdlLocation.indexOf("://") > 2) { + return parseWSDL(new URL(wsdlLocation)); + } + else { + return parseWSDL(new File(wsdlLocation)); + } + } + + public static DefinitionsDocument parseWSDL(File wsdlFile) + throws IOException, XmlException + { + return DefinitionsDocument.Factory.parse(wsdlFile); + } + + public static DefinitionsDocument parseWSDL(URL wsdlURL) + throws IOException, MalformedURLException, XmlException + { + return DefinitionsDocument.Factory.parse(wsdlURL); + } + + public static org.xmlsoap.schemas.wsdl.soap.TOperation[] + getSOAPOperations(TBindingOperation bo) + throws IllegalAccessException, NoSuchFieldException + { + return selectChildren(bo, org.xmlsoap.schemas.wsdl.soap.TOperation.class); + } + + public static org.xmlsoap.schemas.wsdl.soap.TBinding[] + getSOAPBinding(TBinding b) + throws IllegalAccessException, NoSuchFieldException + { + return selectChildren(b, org.xmlsoap.schemas.wsdl.soap.TBinding.class); + } + + public static org.xmlsoap.schemas.wsdl.soap.TBody[] + getSOAPBody(TBindingOperationMessage bom) + throws IllegalAccessException, NoSuchFieldException + { + return selectChildren(bom, org.xmlsoap.schemas.wsdl.soap.TBody.class); + } + + public static org.xmlsoap.schemas.wsdl.soap.TAddress[] + getSOAPAddress(TPort port) + throws IllegalAccessException, NoSuchFieldException + { + return selectChildren(port, org.xmlsoap.schemas.wsdl.soap.TAddress.class); + } + + private static <T extends XmlObject> T[] selectChildren(XmlObject parent, + Class<T> childClass) + throws IllegalAccessException, NoSuchFieldException + { + + // retrieve the SchemaType from the static type field + SchemaType st = (SchemaType)childClass.getField("type").get(null); + + XmlObject[] kids = parent.selectChildren(st.getDocumentElementName()); + T[] castKids = (T[])Array.newInstance(childClass, kids.length); + + for (int j = 0; j < castKids.length; j++) { + + castKids[j] = childClass.cast(kids[j]); + } + return castKids; + } +}
