You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2005/02/03 00:48:20 UTC
svn commit: r151081 - in geronimo/trunk: etc/ modules/assembly/
modules/core/src/java/org/apache/geronimo/validator/ modules/webservices/
modules/webservices/src/ modules/webservices/src/java/
modules/webservices/src/java/org/ modules/webservices/src/java/org/apache/
modules/webservices/src/java/org/apache/geronimo/
modules/webservices/src/java/org/apache/geronimo/webservices/
Author: dblevins
Date: Wed Feb 2 15:48:14 2005
New Revision: 151081
URL: http://svn.apache.org/viewcvs?view=rev&rev=151081
Log:
Revising the WSContainer to better support rpc/encoded strictly against a lightweight WSDL->Java mapping.
Added:
geronimo/trunk/modules/webservices/
geronimo/trunk/modules/webservices/LICENSE.txt
geronimo/trunk/modules/webservices/NOTICE.txt
geronimo/trunk/modules/webservices/project.properties
geronimo/trunk/modules/webservices/project.xml
geronimo/trunk/modules/webservices/src/
geronimo/trunk/modules/webservices/src/java/
geronimo/trunk/modules/webservices/src/java/org/
geronimo/trunk/modules/webservices/src/java/org/apache/
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/Handler.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/LightWeightMappingValidator.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/PortComponent.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/ServiceImplBean.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WSDLVisitor.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceDescription.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServices.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServicesFactory.java
geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/webservices_1_1.xml
Modified:
geronimo/trunk/etc/project.properties
geronimo/trunk/modules/assembly/project.xml
geronimo/trunk/modules/core/src/java/org/apache/geronimo/validator/ValidationContext.java
Modified: geronimo/trunk/etc/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/etc/project.properties?view=diff&r1=151080&r2=151081
==============================================================================
--- geronimo/trunk/etc/project.properties (original)
+++ geronimo/trunk/etc/project.properties Wed Feb 2 15:48:14 2005
@@ -155,7 +155,7 @@
tomcat_version=5.5.4
velocity_version=1.4-rc1
xerces_version=2.6.2
-xfire_version=20041222
+xfire_version=20050202
xml_apis_version=1.0.b2
xml_resolver_version=1.1
xml_parser_apis_version=2.2.1
Modified: geronimo/trunk/modules/assembly/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/project.xml?view=diff&r1=151080&r2=151081
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml (original)
+++ geronimo/trunk/modules/assembly/project.xml Wed Feb 2 15:48:14 2005
@@ -994,15 +994,6 @@
</dependency>
<dependency>
- <groupId>xfire</groupId>
- <artifactId>xfire-jaxrpc</artifactId>
- <version>${xfire_version}</version>
- <properties>
- <repository>true</repository>
- </properties>
- </dependency>
-
- <dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>${wsdl4j_version}</version>
Modified: geronimo/trunk/modules/core/src/java/org/apache/geronimo/validator/ValidationContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/core/src/java/org/apache/geronimo/validator/ValidationContext.java?view=diff&r1=151080&r2=151081
==============================================================================
--- geronimo/trunk/modules/core/src/java/org/apache/geronimo/validator/ValidationContext.java (original)
+++ geronimo/trunk/modules/core/src/java/org/apache/geronimo/validator/ValidationContext.java Wed Feb 2 15:48:14 2005
@@ -16,16 +16,13 @@
*/
package org.apache.geronimo.validator;
-import java.util.Vector;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
+import java.util.*;
public class ValidationContext {
- protected Vector failures = new Vector();
- protected Vector warnings = new Vector();
- protected Vector errors = new Vector();
+ protected ArrayList failures = new ArrayList();
+ protected ArrayList warnings = new ArrayList();
+ protected ArrayList errors = new ArrayList();
protected Map attributes = new HashMap();
@@ -56,33 +53,27 @@
}
public void addWarning( ValidationWarning warning ) {
- warnings.addElement( warning );
+ warnings.add( warning );
}
public void addFailure(ValidationFailure failure) {
- failures.addElement( failure );
+ failures.add( failure );
}
public void addError(ValidationError error) {
- errors.addElement( error );
+ errors.add( error );
}
public ValidationFailure[] getFailures() {
- ValidationFailure[] tmp = new ValidationFailure[failures.size()];
- failures.copyInto( tmp );
- return tmp;
+ return (ValidationFailure[])failures.toArray(new ValidationFailure[0]);
}
public ValidationWarning[] getWarnings() {
- ValidationWarning[] tmp = new ValidationWarning[warnings.size()];
- warnings.copyInto( tmp );
- return tmp;
+ return (ValidationWarning[])failures.toArray(new ValidationWarning[0]);
}
public ValidationError[] getErrors() {
- ValidationError[] tmp = new ValidationError[errors.size()];
- errors.copyInto( tmp );
- return tmp;
+ return (ValidationError[])failures.toArray(new ValidationError[0]);
}
public boolean hasWarnings(){
Added: geronimo/trunk/modules/webservices/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/LICENSE.txt?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/LICENSE.txt (added)
+++ geronimo/trunk/modules/webservices/LICENSE.txt Wed Feb 2 15:48:14 2005
@@ -0,0 +1,203 @@
+
+ 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: geronimo/trunk/modules/webservices/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/NOTICE.txt?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/NOTICE.txt (added)
+++ geronimo/trunk/modules/webservices/NOTICE.txt Wed Feb 2 15:48:14 2005
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: geronimo/trunk/modules/webservices/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/project.properties?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/project.properties (added)
+++ geronimo/trunk/modules/webservices/project.properties Wed Feb 2 15:48:14 2005
@@ -0,0 +1,5 @@
+##
+## $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
+##
+
+maven.repo.remote=http://www.openejb.org/maven, http://www.ibiblio.org/maven
Added: geronimo/trunk/modules/webservices/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/project.xml?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/project.xml (added)
+++ geronimo/trunk/modules/webservices/project.xml Wed Feb 2 15:48:14 2005
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright 2003-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.
+-->
+
+<!-- $Rev: 111629 $ $Date: 2004-12-11 19:52:51 -0800 (Sat, 11 Dec 2004) $ -->
+
+<project>
+
+ <pomVersion>3</pomVersion>
+
+ <extend>../../etc/project.xml</extend>
+
+ <!-- ===================== -->
+ <!-- Module Identification -->
+ <!-- ===================== -->
+
+ <name>Geronimo :: Web Services</name>
+ <id>geronimo-webservices</id>
+ <shortDescription>Geronimo Web Services</shortDescription>
+ <description>Geronimo Web Services</description>
+ <url>http://incubator.apache.org/projects/geronimo/webservices/</url>
+ <siteDirectory>/www/incubator.apache.org/projects/geronimo/webservices</siteDirectory>
+ <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/webservices</distributionDirectory>
+
+ <package>org.apache.geronimo.webservices</package>
+
+ <!-- ============ -->
+ <!-- Dependencies -->
+ <!-- ============ -->
+
+ <dependencies>
+ <!-- Module Dependencies -->
+
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-common</artifactId>
+ <version>${geronimo_version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-core</artifactId>
+ <version>${geronimo_version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-j2ee</artifactId>
+ <version>${geronimo_version}</version>
+ </dependency>
+
+ <!-- Thirdparty -->
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-full</artifactId>
+ <version>${cglib_version}</version>
+ <url>http://cglib.sf.net/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons_logging_version}</version>
+ <url>http://jakarta.apache.org/commons/logging/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>castor</groupId>
+ <artifactId>castor</artifactId>
+ <version>${castor_version}</version>
+ <url>http://www.castor.org</url>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j_version}</version>
+ <url>http://jakarta.apache.org/log4j</url>
+ </dependency>
+
+ <dependency>
+ <groupId>xfire</groupId>
+ <artifactId>xfire</artifactId>
+ <version>${xfire_version}</version>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>xfire</groupId>
+ <artifactId>xfire-java</artifactId>
+ <version>${xfire_version}</version>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>${wsdl4j_version}</version>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ <version>${stax_version}</version>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>${stax_api_version}</version>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/java</directory>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Abstract*.java</exclude>
+ </excludes>
+ </unitTest>
+ </build>
+
+</project>
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/Handler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/Handler.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/Handler.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/Handler.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,140 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.util.ArrayList;
+
+public class Handler {
+ private String handlerName;
+ private String handlerClass;
+ private ArrayList soapHeaderList = new ArrayList();
+ private ArrayList soapRoleList = new ArrayList();
+
+ public String getHandlerName() {
+ return handlerName;
+ }
+
+ public void setHandlerName(String handlerName) {
+ this.handlerName = handlerName;
+ }
+
+ public String getHandlerClass() {
+ return handlerClass;
+ }
+
+ public void setHandlerClass(String handlerClass) {
+ this.handlerClass = handlerClass;
+ }
+
+
+ public void addSoapHeader(String soapHeader) throws IndexOutOfBoundsException {
+ soapHeaderList.add(soapHeader);
+ }
+
+ public void addSoapHeader(int index, String soapHeader) throws IndexOutOfBoundsException {
+ soapHeaderList.add(index, soapHeader);
+ }
+
+ public boolean removeSoapHeader(String soapHeader) {
+ return soapHeaderList.remove(soapHeader);
+ }
+
+ public String getSoapHeader(int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > soapHeaderList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ return (String) soapHeaderList.get(index);
+ }
+
+ public String[] getSoapHeader() {
+ int size = soapHeaderList.size();
+ String[] mArray = new String[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (String) soapHeaderList.get(index);
+ }
+ return mArray;
+ }
+
+ public void setSoapHeader(int index, String soapHeader) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > soapHeaderList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ soapHeaderList.set(index, soapHeader);
+ }
+
+ public void setSoapHeader(String[] soapHeaderArray) {
+ soapHeaderList.clear();
+ for (int i = 0; i < soapHeaderArray.length; i++) {
+ String soapHeader = soapHeaderArray[i];
+ soapHeaderList.add(soapHeader);
+ }
+ }
+
+ public void clearSoapHeader() {
+ soapHeaderList.clear();
+ }
+
+
+ public void addSoapRole(String soapRole) throws IndexOutOfBoundsException {
+ soapRoleList.add(soapRole);
+ }
+
+ public void addSoapRole(int index, String soapRole) throws IndexOutOfBoundsException {
+ soapRoleList.add(index, soapRole);
+ }
+
+ public boolean removeSoapRole(String soapRole) {
+ return soapRoleList.remove(soapRole);
+ }
+
+ public String getSoapRole(int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > soapRoleList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ return (String) soapRoleList.get(index);
+ }
+
+ public String[] getSoapRole() {
+ int size = soapRoleList.size();
+ String[] mArray = new String[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (String) soapRoleList.get(index);
+ }
+ return mArray;
+ }
+
+ public void setSoapRole(int index, String soapRole) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > soapRoleList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ soapRoleList.set(index, soapRole);
+ }
+
+ public void setSoapRole(String[] soapRoleArray) {
+ soapRoleList.clear();
+ for (int i = 0; i < soapRoleArray.length; i++) {
+ String soapRole = soapRoleArray[i];
+ soapRoleList.add(soapRole);
+ }
+ }
+
+ public void clearSoapRole() {
+ soapRoleList.clear();
+ }
+
+
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/LightWeightMappingValidator.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/LightWeightMappingValidator.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/LightWeightMappingValidator.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/LightWeightMappingValidator.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,123 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.util.ArrayList;
+import java.util.Map;
+import javax.wsdl.*;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.validator.ValidationContext;
+import org.apache.geronimo.validator.ValidationFailure;
+
+public class LightWeightMappingValidator extends WSDLVisitor {
+
+ private ArrayList operationNames;
+ private ValidationContext context;
+
+ private static final QName XSD_STRING = new QName("http://www.w3.org/2001/XMLSchema", "string");
+
+ public LightWeightMappingValidator(Definition definition) {
+ super(definition);
+ }
+
+ public ValidationContext validate() {
+ if (context == null) {
+ context = new ValidationContext(definition.getQName().toString());
+ walkTree();
+ }
+ return context;
+ }
+
+ public boolean isValid() {
+ ValidationContext context = validate();
+ return !context.hasFailures() && !context.hasErrors();
+ }
+
+ protected void begin() {
+ operationNames = new ArrayList();
+ }
+
+ protected void visit(Definition definition) {
+ if (definition.getServices().values().size() != 1) {
+ context.addFailure(new ValidationFailure("A lightweight RPC/Encoded service must contain only one Service"));
+ }
+ }
+
+ protected void visit(Output output) {
+ Map outputParts = output.getMessage().getParts();
+ if (outputParts.size() != 0 && outputParts.size() != 1) {
+ context.addFailure(new ValidationFailure("The output message must contain zero or one parts: " + output.getName()));
+ }
+
+ }
+
+ protected void visit(Operation operation) {
+ if (!operationNames.add(operation.getName())) {
+ context.addFailure(new ValidationFailure("No two operations can have the same name: " + operation.getName()));
+ }
+ }
+
+ protected void visit(Fault fault) {
+ Part message = fault.getMessage().getPart("message");
+ if (message == null) {
+ context.addFailure(new ValidationFailure("The fault message must contain one part named 'message' : " + fault.getName()));
+ } else if (!XSD_STRING.equals(message.getTypeName())) {
+ context.addFailure(new ValidationFailure("The fault message must contain one part of type 'xsd:string' : " + fault.getName()));
+ }
+ }
+
+
+ protected void visit(BindingInput bindingInput) {
+ SOAPBody body = getSOAPBody(bindingInput.getExtensibilityElements());
+ String encoding = body.getUse();
+ if (encoding == null || !encoding.equals("encoded")) {
+ context.addFailure(new ValidationFailure("The use attribute of the binding input operation must be 'encoded': " + bindingInput.getName()));
+ }
+ }
+
+ protected void visit(BindingOutput bindingOutput) {
+ SOAPBody body = getSOAPBody(bindingOutput.getExtensibilityElements());
+ String encoding = body.getUse();
+ if (encoding == null || !encoding.equals("encoded")) {
+ context.addFailure(new ValidationFailure("The use attribute of the binding output operation must be 'encoded': " + bindingOutput.getName()));
+ }
+ }
+
+ protected void visit(BindingFault bindingFault) {
+ SOAPBody body = getSOAPBody(bindingFault.getExtensibilityElements());
+ String encoding = body.getUse();
+ if (encoding == null || !encoding.equals("encoded")) {
+ context.addFailure(new ValidationFailure("The use attribute of the binding fault operation must be 'encoded': " + bindingFault.getName()));
+ }
+ }
+
+ protected void visit(Binding binding) {
+ SOAPBinding soapBinding = getSOAPBinding(binding);
+ if (soapBinding == null || soapBinding.getStyle() == null || !soapBinding.getStyle().equals("rpc")) {
+ context.addFailure(new ValidationFailure("The messaging style of the binding must be rpc: " + binding.getQName()));
+ }
+ }
+
+ protected void visit(Service service) {
+ if (service.getPorts().values().size() != 1) {
+ context.addFailure(new ValidationFailure("A lightweight RPC/Encoded service must contain only one Port"));
+ }
+ }
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/PortComponent.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/PortComponent.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/PortComponent.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/PortComponent.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,130 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class PortComponent {
+ private String portComponentName;
+ private String wsdlPort;
+ private String serviceEndpointInterface;
+ private ServiceImplBean serviceImplBean;
+
+ /**
+ * List of Handler objects
+ *
+ * @see org.apache.geronimo.webservices.Handler
+ */
+ private ArrayList handlerList = new ArrayList();
+ /**
+ * Map of Handler objects indexed by handlerName
+ *
+ * @see org.apache.geronimo.webservices.Handler#getHandlerName
+ */
+ private HashMap handlerMap = new HashMap();
+
+ public void addHandler(Handler handler) throws IndexOutOfBoundsException {
+ handlerList.add(handler);
+ handlerMap.put(handler.getHandlerName(), handler);
+ }
+
+ public void addHandler(int index, Handler handler) throws IndexOutOfBoundsException {
+ handlerList.add(index, handler);
+ handlerMap.put(handler.getHandlerName(), handler);
+ }
+
+ public boolean removeHandler(Handler handler) {
+ handlerMap.remove(handler.getHandlerName());
+ return handlerList.remove(handler);
+ }
+
+ public Handler getHandler(int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > handlerList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ return (Handler) handlerList.get(index);
+ }
+
+ public Handler[] getHandler() {
+ int size = handlerList.size();
+ Handler[] mArray = new Handler[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (Handler) handlerList.get(index);
+ }
+ return mArray;
+ }
+
+ public Handler getHandler(String handlerName) {
+ return (Handler) handlerMap.get(handlerName);
+ }
+
+ public void setHandler(int index, Handler handler) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > handlerList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ Handler removed = (Handler) handlerList.set(index, handler);
+ handlerMap.remove(removed.getHandlerName());
+ handlerMap.put(handler.getHandlerName(), handler);
+ }
+
+ public void setHandler(Handler[] handlerArray) {
+ handlerList.clear();
+ for (int i = 0; i < handlerArray.length; i++) {
+ Handler handler = handlerArray[i];
+ handlerList.add(handler);
+ handlerMap.put(handler.getHandlerName(), handler);
+ }
+ }
+
+ public void clearHandler() {
+ handlerList.clear();
+ handlerMap.clear();
+ }
+
+ public String getPortComponentName() {
+ return portComponentName;
+ }
+
+ public void setPortComponentName(String portComponentName) {
+ this.portComponentName = portComponentName;
+ }
+
+ public String getWsdlPort() {
+ return wsdlPort;
+ }
+
+ public void setWsdlPort(String wsdlPort) {
+ this.wsdlPort = wsdlPort;
+ }
+
+ public String getServiceEndpointInterface() {
+ return serviceEndpointInterface;
+ }
+
+ public void setServiceEndpointInterface(String serviceEndpointInterface) {
+ this.serviceEndpointInterface = serviceEndpointInterface;
+ }
+
+ public ServiceImplBean getServiceImplBean() {
+ return serviceImplBean;
+ }
+
+ public void setServiceImplBean(ServiceImplBean serviceImplBean) {
+ this.serviceImplBean = serviceImplBean;
+ }
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/ServiceImplBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/ServiceImplBean.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/ServiceImplBean.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/ServiceImplBean.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+public class ServiceImplBean {
+ private String serlvetLink;
+ private String ejbLink;
+
+ public String getSerlvetLink() {
+ return serlvetLink;
+ }
+
+ public void setSerlvetLink(String serlvetLink) {
+ this.serlvetLink = serlvetLink;
+ }
+
+ public String getEjbLink() {
+ return ejbLink;
+ }
+
+ public void setEjbLink(String ejbLink) {
+ this.ejbLink = ejbLink;
+ }
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WSDLVisitor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WSDLVisitor.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WSDLVisitor.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WSDLVisitor.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,187 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import javax.wsdl.*;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+public class WSDLVisitor {
+
+ protected final Definition definition;
+
+ public WSDLVisitor(Definition definition) {
+ this.definition = definition;
+ }
+
+ public void walkTree() {
+ begin();
+ try {
+ visit(definition);
+ Collection imports = definition.getImports().values();
+ for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
+ Import wsdlImport = (Import) iterator.next();
+ visit(wsdlImport);
+ }
+ visit(definition.getTypes());
+ Collection messages = definition.getMessages().values();
+ for (Iterator iterator = messages.iterator(); iterator.hasNext();) {
+ Message message = (Message) iterator.next();
+ visit(message);
+ Collection parts = message.getParts().values();
+ for (Iterator iterator2 = parts.iterator(); iterator2.hasNext();) {
+ Part part = (Part) iterator2.next();
+ visit(part);
+ }
+ }
+ Collection services = definition.getServices().values();
+ for (Iterator iterator = services.iterator(); iterator.hasNext();) {
+ Service service = (Service) iterator.next();
+ visit(service);
+ Collection ports = service.getPorts().values();
+ for (Iterator iterator1 = ports.iterator(); iterator1.hasNext();) {
+ Port port = (Port) iterator1.next();
+ visit(port);
+ Binding binding = port.getBinding();
+ visit(binding);
+ List bindingOperations = binding.getBindingOperations();
+ for (int i = 0; i < bindingOperations.size(); i++) {
+ BindingOperation bindingOperation = (BindingOperation) bindingOperations.get(i);
+ visit(bindingOperation);
+ visit(bindingOperation.getBindingInput());
+ visit(bindingOperation.getBindingOutput());
+ Collection bindingFaults = bindingOperation.getBindingFaults().values();
+ for (Iterator iterator2 = bindingFaults.iterator(); iterator2.hasNext();) {
+ BindingFault bindingFault = (BindingFault) iterator2.next();
+ visit(bindingFault);
+ }
+
+ }
+ PortType portType = binding.getPortType();
+ visit(portType);
+ List operations = portType.getOperations();
+ for (int i = 0; i < operations.size(); i++) {
+ Operation operation = (Operation) operations.get(i);
+ visit(operation);
+ {
+ Input input = operation.getInput();
+ visit(input);
+ }
+ {
+ Output output = operation.getOutput();
+ visit(output);
+ }
+ Collection faults = operation.getFaults().values();
+ for (Iterator iterator2 = faults.iterator(); iterator2.hasNext();) {
+ Fault fault = (Fault) iterator2.next();
+ visit(fault);
+ }
+
+ }
+ }
+ }
+ } catch(Exception e){
+ e.printStackTrace();
+ } finally {
+ end();
+ }
+ }
+
+ protected void begin() {
+ }
+
+ protected void end() {
+ }
+
+ protected void visit(Fault fault) {
+ }
+
+ protected void visit(Definition definition) {
+ }
+
+ protected void visit(Import wsdlImport) {
+ }
+
+ protected void visit(Types types) {
+ }
+
+ protected void visit(BindingFault bindingFault) {
+ }
+
+ protected void visit(BindingOutput bindingOutput) {
+ }
+
+ protected void visit(BindingInput bindingInput) {
+ }
+
+ protected void visit(Output output) {
+ }
+
+ protected void visit(Part part) {
+ }
+
+ protected void visit(Message message) {
+ }
+
+ protected void visit(Input input) {
+ }
+
+ protected void visit(Operation operation) {
+ }
+
+ protected void visit(PortType portType) {
+ }
+
+ protected void visit(BindingOperation bindingOperation) {
+ }
+
+ protected void visit(Binding binding) {
+ }
+
+ protected void visit(Port port) {
+ }
+
+ protected void visit(Service service) {
+ }
+
+ protected SOAPBody getSOAPBody(List extensibilityElements) {
+ SOAPBody body = null;
+ for (int j = 0; j < extensibilityElements.size(); j++) {
+ Object element = extensibilityElements.get(j);
+ if (element instanceof SOAPBody) {
+ body = (SOAPBody) element;
+ break;
+ }
+ }
+ return body;
+ }
+
+ protected SOAPBinding getSOAPBinding(Binding binding) {
+ SOAPBinding soapBinding = null;
+ List extensibilityElements = binding.getExtensibilityElements();
+ for (int i = 0; i < extensibilityElements.size(); i++) {
+ Object element = extensibilityElements.get(i);
+ if (element instanceof SOAPBinding) {
+ soapBinding = (SOAPBinding) element;
+ }
+ }
+ return soapBinding;
+ }
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceDescription.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceDescription.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceDescription.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceDescription.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,122 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class WebServiceDescription {
+ private String webServiceDescriptionName;
+ private String wsdlFile;
+ private String jaxrpcMappingFile;
+
+ /**
+ * List of PortComponent objects
+ *
+ * @see org.apache.geronimo.webservices.PortComponent
+ */
+ private ArrayList portComponentList = new ArrayList();
+ /**
+ * Map of PortComponent objects indexed by portComponentName
+ *
+ * @see org.apache.geronimo.webservices.PortComponent#getPortComponentName
+ */
+ private HashMap portComponentMap = new HashMap();
+
+ public String getWebServiceDescriptionName() {
+ return webServiceDescriptionName;
+ }
+
+ public void setWebServiceDescriptionName(String webServiceDescriptionName) {
+ this.webServiceDescriptionName = webServiceDescriptionName;
+ }
+
+ public String getWsdlFile() {
+ return wsdlFile;
+ }
+
+ public void setWsdlFile(String wsdlFile) {
+ this.wsdlFile = wsdlFile;
+ }
+
+ public String getJaxrpcMappingFile() {
+ return jaxrpcMappingFile;
+ }
+
+ public void setJaxrpcMappingFile(String jaxrpcMappingFile) {
+ this.jaxrpcMappingFile = jaxrpcMappingFile;
+ }
+
+ public void addPortComponent(PortComponent portComponent) throws IndexOutOfBoundsException {
+ portComponentList.add(portComponent);
+ portComponentMap.put(portComponent.getPortComponentName(), portComponent);
+ }
+
+ public void addPortComponent(int index, PortComponent portComponent) throws IndexOutOfBoundsException {
+ portComponentList.add(index, portComponent);
+ portComponentMap.put(portComponent.getPortComponentName(), portComponent);
+ }
+
+ public boolean removePortComponent(PortComponent portComponent) {
+ portComponentMap.remove(portComponent.getPortComponentName());
+ return portComponentList.remove(portComponent);
+ }
+
+ public PortComponent getPortComponent(int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > portComponentList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ return (PortComponent) portComponentList.get(index);
+ }
+
+ public PortComponent[] getPortComponent() {
+ int size = portComponentList.size();
+ PortComponent[] mArray = new PortComponent[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (PortComponent) portComponentList.get(index);
+ }
+ return mArray;
+ }
+
+ public PortComponent getPortComponent(String portComponentName) {
+ return (PortComponent) portComponentMap.get(portComponentName);
+ }
+
+ public void setPortComponent(int index, PortComponent portComponent) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > portComponentList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ PortComponent removed = (PortComponent) portComponentList.set(index, portComponent);
+ portComponentMap.remove(removed.getPortComponentName());
+ portComponentMap.put(portComponent.getPortComponentName(), portComponent);
+ }
+
+ public void setPortComponent(PortComponent[] portComponentArray) {
+ portComponentList.clear();
+ for (int i = 0; i < portComponentArray.length; i++) {
+ PortComponent portComponent = portComponentArray[i];
+ portComponentList.add(portComponent);
+ portComponentMap.put(portComponent.getPortComponentName(), portComponent);
+ }
+ }
+
+ public void clearPortComponent() {
+ portComponentList.clear();
+ portComponentMap.clear();
+ }
+
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServices.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServices.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServices.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServices.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,103 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+
+/**
+ * A dtd version of the J2EE webservices.xml file would look like this:
+ * <p/>
+ * webservices (webservice-description+)
+ * webservice-description (webservice-description-name, wsdl-file, jaxrpc-mapping-file, port-component+)
+ * port-component (port-component-name, wsdl-port, service-endpoint-interface, service-impl-bean, handler*)
+ * service-impl-bean (ejb-link|servlet-link)
+ * handler (handler-name, handler-class, init-param*, soap-header*, soap-role*)
+ */
+public class WebServices {
+ /**
+ * List of WebServiceDescription objects
+ *
+ * @see org.apache.geronimo.webservices.WebServiceDescription
+ */
+ private ArrayList webServiceDescriptionList = new ArrayList();
+ /**
+ * Map of WebServiceDescription objects indexed by webServiceDescriptionName
+ *
+ * @see org.apache.geronimo.webservices.WebServiceDescription#getWebServiceDescriptionName
+ */
+ private HashMap webServiceDescriptionMap = new HashMap();
+
+ public void addWebServiceDescription(WebServiceDescription webServiceDescription) throws IndexOutOfBoundsException {
+ webServiceDescriptionList.add(webServiceDescription);
+ webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription);
+ }
+
+ public void addWebServiceDescription(int index, WebServiceDescription webServiceDescription) throws IndexOutOfBoundsException {
+ webServiceDescriptionList.add(index, webServiceDescription);
+ webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription);
+ }
+
+ public boolean removeWebServiceDescription(WebServiceDescription webServiceDescription) {
+ webServiceDescriptionMap.remove(webServiceDescription.getWebServiceDescriptionName());
+ return webServiceDescriptionList.remove(webServiceDescription);
+ }
+
+ public WebServiceDescription getWebServiceDescription(int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > webServiceDescriptionList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ return (WebServiceDescription) webServiceDescriptionList.get(index);
+ }
+
+ public WebServiceDescription[] getWebServiceDescription() {
+ int size = webServiceDescriptionList.size();
+ WebServiceDescription[] mArray = new WebServiceDescription[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (WebServiceDescription) webServiceDescriptionList.get(index);
+ }
+ return mArray;
+ }
+
+ public WebServiceDescription getWebServiceDescription(String webServiceDescriptionName) {
+ return (WebServiceDescription) webServiceDescriptionMap.get(webServiceDescriptionName);
+ }
+
+ public void setWebServiceDescription(int index, WebServiceDescription webServiceDescription) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index > webServiceDescriptionList.size())) {
+ throw new IndexOutOfBoundsException();
+ }
+ WebServiceDescription removed = (WebServiceDescription) webServiceDescriptionList.set(index, webServiceDescription);
+ webServiceDescriptionMap.remove(removed.getWebServiceDescriptionName());
+ webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription);
+ }
+
+ public void setWebServiceDescription(WebServiceDescription[] webServiceDescriptionArray) {
+ clearWebServiceDescription();
+ for (int i = 0; i < webServiceDescriptionArray.length; i++) {
+ WebServiceDescription webServiceDescription = webServiceDescriptionArray[i];
+ webServiceDescriptionList.add(webServiceDescription);
+ webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription);
+ }
+ }
+
+ public void clearWebServiceDescription() {
+ webServiceDescriptionList.clear();
+ webServiceDescriptionMap.clear();
+ }
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServicesFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServicesFactory.java?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServicesFactory.java (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServicesFactory.java Wed Feb 2 15:48:14 2005
@@ -0,0 +1,75 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.webservices;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.exolab.castor.mapping.Mapping;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.Marshaller;
+import org.xml.sax.InputSource;
+
+public class WebServicesFactory {
+
+ private static WebServicesFactory webServicesFactory;
+
+ private final Mapping mapping;
+ private final Unmarshaller unmarshaller;
+
+ private WebServicesFactory() {
+ ClassLoader classLoader = WebServicesFactory.class.getClassLoader();
+ URL mappingUrl = classLoader.getResource("org/apache/geronimo/webservices/webservices_1_1.xml");
+
+ try {
+ mapping = new Mapping(classLoader);
+ mapping.loadMapping(mappingUrl);
+ unmarshaller = new Unmarshaller(mapping);
+ } catch (Exception e) {
+ throw (IllegalStateException)new IllegalStateException("Unable to initialize xml unmarshaller").initCause(e);
+ }
+ }
+
+ public static WebServicesFactory getInstance() {
+ if (webServicesFactory == null){
+ webServicesFactory = new WebServicesFactory();
+ }
+ return webServicesFactory;
+ }
+
+ public WebServices readXML(URL webservicesURL) throws DeploymentException {
+ InputStream in = null;
+ WebServices webservice = null;
+ try {
+ in = webservicesURL.openStream();
+ webservice = (WebServices) unmarshaller.unmarshal(new InputSource(in));
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch(Exception ignored) {
+ // Don't care
+ }
+ }
+ }
+ return webservice;
+ }
+
+}
Added: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/webservices_1_1.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/webservices_1_1.xml?view=auto&rev=151081
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/webservices_1_1.xml (added)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/webservices_1_1.xml Wed Feb 2 15:48:14 2005
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN"
+ "http://castor.exolab.org/mapping.dtd">
+
+<!--
+ A dtd version of the J2EE webservices.xml file would look like this:
+
+ webservices (webservice-description+)
+ webservice-description (webservice-description-name, wsdl-file, jaxrpc-mapping-file, port-component+)
+ port-component (port-component-name, wsdl-port, service-endpoint-interface, service-impl-bean, handler*)
+ service-impl-bean (ejb-link|servlet-link)
+ handler (handler-name, handler-class, init-param*, soap-header*, soap-role*)
+-->
+<mapping>
+ <class name="org.apache.geronimo.webservices.WebServices">
+ <map-to xml="webservices"/>
+ <field name="webServiceDescription" type="org.apache.geronimo.webservices.WebServiceDescription" collection="array">
+ <bind-xml name="webservice-description"/>
+ </field>
+ </class>
+
+ <class name="org.apache.geronimo.webservices.WebServiceDescription">
+ <map-to xml="webservices-description"/>
+ <field name="webServiceDescriptionName" type="java.lang.String">
+ <bind-xml name="webservice-description-name" node="element"/>
+ </field>
+ <field name="wsdlFile" type="java.lang.String">
+ <bind-xml name="wsdl-file" node="element"/>
+ </field>
+ <field name="jaxrpcMappingFile" type="java.lang.String">
+ <bind-xml name="jaxrpc-mapping-file" node="element"/>
+ </field>
+ <field name="portComponent" type="org.apache.geronimo.webservices.PortComponent" collection="array">
+ <bind-xml name="port-component"/>
+ </field>
+ </class>
+
+ <class name="org.apache.geronimo.webservices.PortComponent">
+ <map-to xml="port-component"/>
+ <field name="portComponentName" type="java.lang.String">
+ <bind-xml name="port-component-name" node="element"/>
+ </field>
+ <field name="wsdlPort" type="java.lang.String">
+ <bind-xml name="wsdl-port" node="element"/>
+ </field>
+ <field name="serviceEndpointInterface" type="java.lang.String">
+ <bind-xml name="service-endpoint-interface" node="element"/>
+ </field>
+ <field name="serviceImplBean" type="org.apache.geronimo.webservices.ServiceImplBean">
+ <bind-xml name="service-impl-bean" node="element"/>
+ </field>
+ <field name="handler" type="org.apache.geronimo.webservices.Handler" collection="array">
+ <bind-xml name="handler"/>
+ </field>
+ </class>
+
+ <class name="org.apache.geronimo.webservices.Handler">
+ <map-to xml="handler"/>
+ <field name="handlerName" type="java.lang.String">
+ <bind-xml name="handler-name" node="element"/>
+ </field>
+ <field name="handlerClass" type="java.lang.String">
+ <bind-xml name="handler-class" node="element"/>
+ </field>
+ <field name="soapHeader" type="java.lang.String" collection="array">
+ <bind-xml name="soap-header" node="element"/>
+ </field>
+ <field name="soapRole" type="java.lang.String" collection="array">
+ <bind-xml name="soap-role" node="element"/>
+ </field>
+ </class>
+
+</mapping>