Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/QNameHolder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/QNameHolder.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/QNameHolder.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/QNameHolder.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,44 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.holders; + +import javax.xml.namespace.QName; + +/** + * Holder for <code>QName</code>s. + * + * @version 1.0 + */ +public final class QNameHolder implements Holder { + + /** The <code>QName</code> contained by this holder. */ + public QName value; + + /** + * Make a new <code>QNameHolder</code> with a <code>null</code> value. + */ + public QNameHolder() {} + + /** + * Make a new <code>QNameHolder</code> with <code>value</code> as + * the value. + * + * @param value the <code>QName</code> to hold + */ + public QNameHolder(QName value) { + this.value = value; + } +}
Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortHolder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortHolder.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortHolder.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortHolder.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,42 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.holders; + +/** + * Holder for <code>short</code>s. + * + * @version 1.0 + */ +public final class ShortHolder implements Holder { + + /** The <code>short</code> contained by this holder. */ + public short value; + + /** + * Make a new <code>ShortHolder</code> with a <code>null</code> value. + */ + public ShortHolder() {} + + /** + * Make a new <code>ShortHolder</code> with <code>value</code> as + * the value. + * + * @param value the <code>short</code> to hold + */ + public ShortHolder(short value) { + this.value = value; + } +} Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortWrapperHolder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortWrapperHolder.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortWrapperHolder.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/ShortWrapperHolder.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,42 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.holders; + +/** + * Holder for <code>Short</code>s. + * + * @version 1.0 + */ +public final class ShortWrapperHolder implements Holder { + + /** The <code>Short</code> contained by this holder. */ + public Short value; + + /** + * Make a new <code>ShortWrapperHolder</code> with a <code>null</code> value. + */ + public ShortWrapperHolder() {} + + /** + * Make a new <code>ShortWrapperHolder</code> with <code>value</code> as + * the value. + * + * @param value the <code>Short</code> to hold + */ + public ShortWrapperHolder(Short value) { + this.value = value; + } +} Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/StringHolder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/StringHolder.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/StringHolder.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/holders/StringHolder.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,42 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.holders; + +/** + * Holder for <code>String</code>s. + * + * @version 1.0 + */ +public final class StringHolder implements Holder { + + /** The <code>String</code> contained by this holder. */ + public String value; + + /** + * Make a new <code>StringHolder</code> with a <code>null</code> value. + */ + public StringHolder() {} + + /** + * Make a new <code>StringHolder</code> with <code>value</code> as + * the value. + * + * @param value the <code>String</code> to hold + */ + public StringHolder(String value) { + this.value = value; + } +} Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServiceLifecycle.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServiceLifecycle.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServiceLifecycle.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServiceLifecycle.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,62 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.server; + +import javax.xml.rpc.ServiceException; + +/** + * The <code>javax.xml.rpc.server.ServiceLifecycle</code> defines a lifecycle interface for a + * JAX-RPC service endpoint. If the service endpoint class implements the + * <code>ServiceLifeycle</code> interface, the servlet container based JAX-RPC runtime system + * is required to manage the lifecycle of the corresponding service endpoint objects. + * + * @version 1.0 + */ +public interface ServiceLifecycle { + + /** + * Used for initialization of a service endpoint. After a service + * endpoint instance (an instance of a service endpoint class) is + * instantiated, the JAX-RPC runtime system invokes the + * <code>init</code> method. The service endpoint class uses the + * <code>init</code> method to initialize its configuration + * and setup access to any external resources. The context parameter + * in the <code>init</code> method enables the endpoint instance to + * access the endpoint context provided by the underlying JAX-RPC + * runtime system. + * <p> + * The init method implementation should typecast the context + * parameter to an appropriate Java type. For service endpoints + * deployed on a servlet container based JAX-RPC runtime system, + * the <code>context</code> parameter is of the Java type + * <code>javax.xml.rpc.server.ServletEndpointContext</code>. The + * <code>ServletEndpointContext</code> provides an endpoint context + * maintained by the underlying servlet container based JAX-RPC + * runtime system + * <p> + * @param context Endpoint context for a JAX-RPC service endpoint + * @throws ServiceException If any error in initialization of the service endpoint; or if any + * illegal context has been provided in the init method + */ + public abstract void init(Object context) throws ServiceException; + + /** + * JAX-RPC runtime system ends the lifecycle of a service endpoint instance by + * invoking the destroy method. The service endpoint releases its resources in + * the implementation of the destroy method. + */ + public abstract void destroy(); +} Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServletEndpointContext.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServletEndpointContext.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServletEndpointContext.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/server/ServletEndpointContext.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,116 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.server; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSession; +import javax.xml.rpc.handler.MessageContext; +import java.security.Principal; + +/** + * The <code>ServletEndpointContext</code> provides an endpoint + * context maintained by the underlying servlet container based + * JAX-RPC runtime system. For service endpoints deployed on a + * servlet container based JAX-RPC runtime system, the context + * parameter in the <code>ServiceLifecycle.init</code> method is + * required to be of the Java type + * <code>javax.xml.rpc.server.ServletEndpointContext</code>. + * <p> + * A servlet container based JAX-RPC runtime system implements + * the <code>ServletEndpointContext</code> interface. The JAX-RPC + * runtime system is required to provide appropriate session, + * message context, servlet context and user principal information + * per method invocation on the endpoint class. + * + * @version 1.0 + */ +public interface ServletEndpointContext { + + /** + * The method <code>getMessageContext</code> returns the + * <code>MessageContext</code> targeted for this endpoint instance. + * This enables the service endpoint instance to acccess the + * <code>MessageContext</code> propagated by request + * <code>HandlerChain</code> (and its contained <code>Handler</code> + * instances) to the target endpoint instance and to share any + * SOAP message processing related context. The endpoint instance + * can access and manipulate the <code>MessageContext</code> + * and share the SOAP message processing related context with + * the response <code>HandlerChain</code>. + * + * @return MessageContext; If there is no associated + * <code>MessageContext</code>, this method returns + * <code>null</code>. + * @throws java.lang.IllegalStateException if this method is invoked outside a + * remote method implementation by a service endpoint instance. + */ + public MessageContext getMessageContext(); + + /** + * Returns a <code>java.security.Principal</code> instance that + * contains the name of the authenticated user for the current + * method invocation on the endpoint instance. This method returns + * <code>null</code> if there is no associated principal yet. + * The underlying JAX-RPC runtime system takes the responsibility + * of providing the appropriate authenticated principal for a + * remote method invocation on the service endpoint instance. + * + * @return A <code>java.security.Principal</code> for the + * authenticated principal associated with the current + * invocation on the servlet endpoint instance; + * Returns <code>null</code> if there no authenticated + * user associated with a method invocation. + */ + public Principal getUserPrincipal(); + + /** + * The <code>getHttpSession</code> method returns the current + * HTTP session (as a <code>javax.servlet.http.HTTPSession</code>). + * When invoked by the service endpoint within a remote method + * implementation, the <code>getHttpSession</code> returns the + * HTTP session associated currently with this method invocation. + * This method returns <code>null</code> if there is no HTTP + * session currently active and associated with this service + * endpoint. An endpoint class should not rely on an active + * HTTP session being always there; the underlying JAX-RPC + * runtime system is responsible for managing whether or not + * there is an active HTTP session. + * <p> + * The getHttpSession method throws <code>JAXRPCException</code> + * if invoked by an non HTTP bound endpoint. + * + * @return The HTTP session associated with the current + * invocation or <code>null</code> if there is no active session. + * @throws javax.xml.rpc.JAXRPCException - If this method invoked by a non-HTTP bound + * endpoints. + */ + public HttpSession getHttpSession(); + + /** + * The method <code>getServletContext</code> returns the + * <code>ServletContex</code>t associated with the web + * application that contain this endpoint. According to + * the Servlet specification, There is one context per web + * application (installed as a WAR) per JVM . A servlet + * based service endpoint is deployed as part of a web + * application. + * + * @return the current <code>ServletContext</code> + */ + public ServletContext getServletContext(); + + public boolean isUserInRole(java.lang.String s); +} Added: geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/soap/SOAPFaultException.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/soap/SOAPFaultException.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/soap/SOAPFaultException.java (added) +++ geronimo/trunk/specs/jaxrpc/src/javax/xml/rpc/soap/SOAPFaultException.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,113 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.rpc.soap; + +import javax.xml.namespace.QName; +import javax.xml.soap.Detail; + +/** + * The <code>SOAPFaultException</code> exception represents a + * SOAP fault. + * <p> + * The message part in the SOAP fault maps to the contents of + * <code>faultdetail</code> element accessible through the + * <code>getDetail</code> method on the <code>SOAPFaultException</code>. + * The method <code>createDetail</code> on the + * <code>javax.xml.soap.SOAPFactory</code> creates an instance + * of the <code>javax.xml.soap.Detail</code>. + * <p> + * The <code>faultstring</code> provides a human-readable + * description of the SOAP fault. The <code>faultcode</code> + * element provides an algorithmic mapping of the SOAP fault. + * <p> + * Refer to SOAP 1.1 and WSDL 1.1 specifications for more + * details of the SOAP faults. + * + * @version 1.0 + */ +public class SOAPFaultException extends RuntimeException { + + /** + * Constructor for SOAPFaultException. + * + * @param faultcode <code>QName</code> for the SOAP faultcode + * @param faultstring <code>faultstring</code> element of SOAP fault + * @param faultactor <code>faultactor</code> element of SOAP fault + * @param detail <code>faultdetail</code> element of SOAP fault + */ + public SOAPFaultException(QName faultcode, String faultstring, + String faultactor, Detail detail) { + + super(faultstring); + + this.faultcode = faultcode; + this.faultstring = faultstring; + this.faultactor = faultactor; + this.detail = detail; + } + + /** + * Gets the <code>faultcode</code> element. The <code>faultcode</code> element provides an algorithmic + * mechanism for identifying the fault. SOAP defines a small set of SOAP fault codes covering + * basic SOAP faults. + * @return QName of the faultcode element + */ + public QName getFaultCode() { + return faultcode; + } + + /** + * Gets the <code>faultstring</code> element. The faultstring provides a human-readable description of + * the SOAP fault and is not intended for algorithmic processing. + * @return <code>faultstring</code> element of the SOAP fault + */ + public String getFaultString() { + return faultstring; + } + + /** + * Gets the <code>faultactor</code> element. The <code>faultactor</code> + * element provides information about which SOAP node on the SOAP message + * path caused the fault to happen. It indicates the source of the fault. + * + * @return <code>faultactor</code> element of the SOAP fault + */ + public String getFaultActor() { + return faultactor; + } + + /** + * Gets the detail element. The detail element is intended for carrying + * application specific error information related to the SOAP Body. + * + * @return <code>detail</code> element of the SOAP fault + */ + public Detail getDetail() { + return detail; + } + + /** Qualified name of the faultcode. */ + private QName faultcode; + + /** The faultstring element of the SOAP fault. */ + private String faultstring; + + /** Faultactor element of the SOAP fault. */ + private String faultactor; + + /** Detail element of the SOAP fault. */ + private Detail detail; +} Added: geronimo/trunk/specs/qname/LICENSE.txt URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/qname/LICENSE.txt?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/qname/LICENSE.txt (added) +++ geronimo/trunk/specs/qname/LICENSE.txt Tue Feb 8 22:00:44 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/specs/qname/NOTICE.txt URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/qname/NOTICE.txt?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/qname/NOTICE.txt (added) +++ geronimo/trunk/specs/qname/NOTICE.txt Tue Feb 8 22:00:44 2005 @@ -0,0 +1,3 @@ +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + Added: geronimo/trunk/specs/qname/project.xml URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/qname/project.xml?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/qname/project.xml (added) +++ geronimo/trunk/specs/qname/project.xml Tue Feb 8 22:00:44 2005 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> + +<project> + <pomVersion>3</pomVersion> + <extend>../../etc/project.xml</extend> + + <name>Geronimo :: javax.xml.namespace.QName API</name> + <groupId>geronimo-spec</groupId> + <id>geronimo-spec-qname</id> + <shortDescription>javax.xml.namespace.QName API</shortDescription> + <description></description> + <siteDirectory></siteDirectory> + <distributionDirectory></distributionDirectory> + + <package>javax.xml.namespace</package> + + <currentVersion>${geronimo_spec_qname_version}</currentVersion> + +</project> Added: geronimo/trunk/specs/qname/src/javax/xml/namespace/QName.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/qname/src/javax/xml/namespace/QName.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/qname/src/javax/xml/namespace/QName.java (added) +++ geronimo/trunk/specs/qname/src/javax/xml/namespace/QName.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,229 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.namespace; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; + +/** + * <code>QName</code> class represents the value of a qualified name + * as specified in <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML + * Schema Part2: Datatypes specification</a>. + * <p> + * The value of a QName contains a <b>namespaceURI</b>, a <b>localPart</b> and a + * <b>prefix</b>. The localPart provides the local part of the qualified name. + * The namespaceURI is a URI reference identifying the namespace. + * + * @version 1.1 + */ +public class QName implements Serializable { + + /** Comment/shared empty <code>String</code>. */ + private static final String emptyString = "".intern(); + + private String namespaceURI; + + private String localPart; + + private String prefix; + + /** + * Constructor for the QName. + * + * @param localPart local part of the QName + */ + public QName(String localPart) { + this(emptyString, localPart, emptyString); + } + + /** + * Constructor for the QName. + * + * @param namespaceURI namespace URI for the QName + * @param localPart local part of the QName. + */ + public QName(String namespaceURI, String localPart) { + this(namespaceURI, localPart, emptyString); + } + + /** + * Constructor for the QName. + * + * @param namespaceURI Namespace URI for the QName + * @param localPart Local part of the QName. + * @param prefix Prefix of the QName. + */ + public QName(String namespaceURI, String localPart, String prefix) { + this.namespaceURI = (namespaceURI == null) + ? emptyString + : namespaceURI.intern(); + if (localPart == null) { + throw new IllegalArgumentException("invalid QName local part"); + } else { + this.localPart = localPart.intern(); + } + + if (prefix == null) { + throw new IllegalArgumentException("invalid QName prefix"); + } else { + this.prefix = prefix.intern(); + } + } + + /** + * Gets the namespace URI for this QName. + * + * @return namespace URI + */ + public String getNamespaceURI() { + return namespaceURI; + } + + /** + * Gets the local part for this QName. + * + * @return the local part + */ + public String getLocalPart() { + return localPart; + } + + /** + * Gets the prefix for this QName. + * + * @return the prefix + */ + public String getPrefix() { + return prefix; + } + + /** + * Returns a string representation of this QName. + * + * @return a string representation of the QName + */ + public String toString() { + + return ((namespaceURI == emptyString) + ? localPart + : '{' + namespaceURI + '}' + localPart); + } + + /** + * Tests this QName for equality with another object. + * <p> + * If the given object is not a QName or is null then this method + * returns <tt>false</tt>. + * <p> + * For two QNames to be considered equal requires that both + * localPart and namespaceURI must be equal. This method uses + * <code>String.equals</code> to check equality of localPart + * and namespaceURI. Any class that extends QName is required + * to satisfy this equality contract. + * <p> + * This method satisfies the general contract of the <code>Object.equals</code> method. + * + * @param obj the reference object with which to compare + * + * @return <code>true</code> if the given object is identical to this + * QName: <code>false</code> otherwise. + */ + public boolean equals(Object obj) { + + if (obj == this) { + return true; + } + + if (!(obj instanceof QName)) { + return false; + } + + if ((namespaceURI == ((QName) obj).namespaceURI) + && (localPart == ((QName) obj).localPart)) { + return true; + } + + return false; + } + + /** + * Returns a QName holding the value of the specified String. + * <p> + * The string must be in the form returned by the QName.toString() + * method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}" + * part being optional. + * <p> + * This method doesn't do a full validation of the resulting QName. + * In particular, it doesn't check that the resulting namespace URI + * is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting + * local part is a legal NCName per the XML Namespaces specification. + * + * @param s the string to be parsed + * @throws java.lang.IllegalArgumentException If the specified String cannot be parsed as a QName + * @return QName corresponding to the given String + */ + public static QName valueOf(String s) { + + if ((s == null) || s.equals("")) { + throw new IllegalArgumentException("invalid QName literal"); + } + + if (s.charAt(0) == '{') { + int i = s.indexOf('}'); + + if (i == -1) { + throw new IllegalArgumentException("invalid QName literal"); + } + + if (i == s.length() - 1) { + throw new IllegalArgumentException("invalid QName literal"); + } else { + return new QName(s.substring(1, i), s.substring(i + 1)); + } + } else { + return new QName(s); + } + } + + /** + * Returns a hash code value for this QName object. The hash code + * is based on both the localPart and namespaceURI parts of the + * QName. This method satisfies the general contract of the + * <code>Object.hashCode</code> method. + * + * @return a hash code value for this Qname object + */ + public int hashCode() { + return namespaceURI.hashCode() ^ localPart.hashCode(); + } + + /** + * Ensure that deserialization properly interns the results. + * @param in the ObjectInputStream to be read + * @throws IOException if there was a failure in the object input stream + * @throws ClassNotFoundException if the class of any sub-objects could + * not be found + */ + private void readObject(ObjectInputStream in) throws + IOException, ClassNotFoundException { + in.defaultReadObject(); + + namespaceURI = namespaceURI.intern(); + localPart = localPart.intern(); + prefix = prefix.intern(); + } +} Added: geronimo/trunk/specs/saaj/LICENSE.txt URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/LICENSE.txt?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/LICENSE.txt (added) +++ geronimo/trunk/specs/saaj/LICENSE.txt Tue Feb 8 22:00:44 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/specs/saaj/NOTICE.txt URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/NOTICE.txt?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/NOTICE.txt (added) +++ geronimo/trunk/specs/saaj/NOTICE.txt Tue Feb 8 22:00:44 2005 @@ -0,0 +1,3 @@ +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + Added: geronimo/trunk/specs/saaj/project.xml URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/project.xml?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/project.xml (added) +++ geronimo/trunk/specs/saaj/project.xml Tue Feb 8 22:00:44 2005 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> + +<project> + <pomVersion>3</pomVersion> + <extend>../../etc/project.xml</extend> + + <name>Geronimo :: SOAP with Attachments API for Java (SAAJ)</name> + <groupId>geronimo-spec</groupId> + <id>geronimo-spec-saaj</id> + <shortDescription>SOAP with Attachments API for Java (SAAJ)</shortDescription> + <description></description> + <siteDirectory></siteDirectory> + <distributionDirectory></distributionDirectory> + + <package>javax.xml.soap</package> + + <currentVersion>${geronimo_spec_saaj_version}</currentVersion> + +</project> Added: geronimo/trunk/specs/saaj/src/javax/xml/soap/AttachmentPart.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/src/javax/xml/soap/AttachmentPart.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/src/javax/xml/soap/AttachmentPart.java (added) +++ geronimo/trunk/specs/saaj/src/javax/xml/soap/AttachmentPart.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,407 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.soap; + +import javax.activation.DataHandler; +import java.util.Iterator; + +/** + * <P>A single attachment to a <CODE>SOAPMessage</CODE> object. A + * <CODE>SOAPMessage</CODE> object may contain zero, one, or many + * <CODE>AttachmentPart</CODE> objects. Each <CODE> + * AttachmentPart</CODE> object consists of two parts, + * application-specific content and associated MIME headers. The + * MIME headers consists of name/value pairs that can be used to + * identify and describe the content.</P> + * + * <P>An <CODE>AttachmentPart</CODE> object must conform to + * certain standards.</P> + * + * <OL> + * <LI>It must conform to <A href= + * "http://www.ietf.org/rfc/rfc2045.txt">MIME [RFC2045] + * standards</A></LI> + * + * <LI>It MUST contain content</LI> + * + * <LI> + * The header portion MUST include the following header: + * + * <UL> + * <LI> + * <CODE>Content-Type</CODE><BR> + * This header identifies the type of data in the content + * of an <CODE>AttachmentPart</CODE> object and MUST + * conform to [RFC2045]. The following is an example of a + * Content-Type header: + * <PRE> + * Content-Type: application/xml + * + * </PRE> + * The following line of code, in which <CODE>ap</CODE> is + * an <CODE>AttachmentPart</CODE> object, sets the header + * shown in the previous example. + * <PRE> + * ap.setMimeHeader("Content-Type", "application/xml"); + * + * </PRE> + * + * <P></P> + * </LI> + * </UL> + * </LI> + * </OL> + * + * <P>There are no restrictions on the content portion of an + * <CODE>AttachmentPart</CODE> object. The content may be anything + * from a simple plain text object to a complex XML document or + * image file.</P> + * + * <P>An <CODE>AttachmentPart</CODE> object is created with the + * method <CODE>SOAPMessage.createAttachmentPart</CODE>. After + * setting its MIME headers, the <CODE>AttachmentPart</CODE> + * object is added to the message that created it with the method + * <CODE>SOAPMessage.addAttachmentPart</CODE>.</P> + * + * <P>The following code fragment, in which <CODE>m</CODE> is a + * <CODE>SOAPMessage</CODE> object and <CODE>contentStringl</CODE> + * is a <CODE>String</CODE>, creates an instance of <CODE> + * AttachmentPart</CODE>, sets the <CODE>AttachmentPart</CODE> + * object with some content and header information, and adds the + * <CODE>AttachmentPart</CODE> object to the <CODE> + * SOAPMessage</CODE> object.</P> + * <PRE> + * AttachmentPart ap1 = m.createAttachmentPart(); + * ap1.setContent(contentString1, "text/plain"); + * m.addAttachmentPart(ap1); + * </PRE> + * + * <P>The following code fragment creates and adds a second <CODE> + * AttachmentPart</CODE> instance to the same message. <CODE> + * jpegData</CODE> is a binary byte buffer representing the jpeg + * file.</P> + * <PRE> + * AttachmentPart ap2 = m.createAttachmentPart(); + * byte[] jpegData = ...; + * ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg"); + * m.addAttachmentPart(ap2); + * </PRE> + * + * <P>The <CODE>getContent</CODE> method retrieves the contents + * and header from an <CODE>AttachmentPart</CODE> object. + * Depending on the <CODE>DataContentHandler</CODE> objects + * present, the returned <CODE>Object</CODE> can either be a typed + * Java object corresponding to the MIME type or an <CODE> + * InputStream</CODE> object that contains the content as + * bytes.</P> + * <PRE> + * String content1 = ap1.getContent(); + * java.io.InputStream content2 = ap2.getContent(); + * </PRE> + * The method <CODE>clearContent</CODE> removes all the content + * from an <CODE>AttachmentPart</CODE> object but does not affect + * its header information. + * <PRE> + * ap1.clearContent(); + * </PRE> + */ +public abstract class AttachmentPart { + + // fixme: should this constructor be protected? + /** Create a new AttachmentPart. */ + public AttachmentPart() {} + + /** + * Returns the number of bytes in this <CODE> + * AttachmentPart</CODE> object. + * @return the size of this <CODE>AttachmentPart</CODE> object + * in bytes or -1 if the size cannot be determined + * @throws SOAPException if the content of this + * attachment is corrupted of if there was an exception + * while trying to determine the size. + */ + public abstract int getSize() throws SOAPException; + + /** + * Clears out the content of this <CODE> + * AttachmentPart</CODE> object. The MIME header portion is left + * untouched. + */ + public abstract void clearContent(); + + /** + * Gets the content of this <code>AttachmentPart</code> object as a Java + * object. The type of the returned Java object depends on (1) the + * <code>DataContentHandler</code> object that is used to interpret the bytes + * and (2) the <code>Content-Type</code> given in the header. + * <p> + * For the MIME content types "text/plain", "text/html" and "text/xml", the + * <code>DataContentHandler</code> object does the conversions to and + * from the Java types corresponding to the MIME types. + * For other MIME types,the <code>DataContentHandler</code> object + * can return an <code>InputStream</code> object that contains the content data + * as raw bytes. + * <p> + * A JAXM-compliant implementation must, as a minimum, return a + * <code>java.lang.String</code> object corresponding to any content + * stream with a <code>Content-Type</code> value of + * <code>text/plain</code>, a + * <code>javax.xml.transform.StreamSource</code> object corresponding to a + * content stream with a <code>Content-Type</code> value of + * <code>text/xml</code>, a <code>java.awt.Image</code> object + * corresponding to a content stream with a + * <code>Content-Type</code> value of <code>image/gif</code> or + * <code>image/jpeg</code>. For those content types that an + * installed <code>DataContentHandler</code> object does not understand, the + * <code>DataContentHandler</code> object is required to return a + * <code>java.io.InputStream</code> object with the raw bytes. + * + * @return a Java object with the content of this <CODE> + * AttachmentPart</CODE> object + * @throws SOAPException if there is no content set + * into this <CODE>AttachmentPart</CODE> object or if there + * was a data transformation error + */ + public abstract Object getContent() throws SOAPException; + + /** + * Sets the content of this attachment part to that of the + * given <CODE>Object</CODE> and sets the value of the <CODE> + * Content-Type</CODE> header to the given type. The type of the + * <CODE>Object</CODE> should correspond to the value given for + * the <CODE>Content-Type</CODE>. This depends on the particular + * set of <CODE>DataContentHandler</CODE> objects in use. + * @param object the Java object that makes up + * the content for this attachment part + * @param contentType the MIME string that + * specifies the type of the content + * @throws java.lang.IllegalArgumentException if + * the contentType does not match the type of the content + * object, or if there was no <CODE> + * DataContentHandler</CODE> object for this content + * object + * @see #getContent() getContent() + */ + public abstract void setContent(Object object, String contentType); + + /** + * Gets the <CODE>DataHandler</CODE> object for this <CODE> + * AttachmentPart</CODE> object. + * @return the <CODE>DataHandler</CODE> object associated with + * this <CODE>AttachmentPart</CODE> object + * @throws SOAPException if there is + * no data in this <CODE>AttachmentPart</CODE> object + */ + public abstract DataHandler getDataHandler() throws SOAPException; + + /** + * Sets the given <CODE>DataHandler</CODE> object as the + * data handler for this <CODE>AttachmentPart</CODE> object. + * Typically, on an incoming message, the data handler is + * automatically set. When a message is being created and + * populated with content, the <CODE>setDataHandler</CODE> + * method can be used to get data from various data sources into + * the message. + * @param datahandler <CODE>DataHandler</CODE> object to + * be set + * @throws java.lang.IllegalArgumentException if + * there was a problem with the specified <CODE> + * DataHandler</CODE> object + */ + public abstract void setDataHandler(DataHandler datahandler); + + /** + * Gets the value of the MIME header whose name is + * "Content-Id". + * @return a <CODE>String</CODE> giving the value of the + * "Content-Id" header or <CODE>null</CODE> if there is + * none + * @see #setContentId(java.lang.String) setContentId(java.lang.String) + */ + public String getContentId() { + + String as[] = getMimeHeader("Content-Id"); + + if (as != null && as.length > 0) { + return as[0]; + } else { + return null; + } + } + + /** + * Gets the value of the MIME header + * "Content-Location". + * @return a <CODE>String</CODE> giving the value of the + * "Content-Location" header or <CODE>null</CODE> if there + * is none + */ + public String getContentLocation() { + + String as[] = getMimeHeader("Content-Location"); + + if (as != null && as.length > 0) { + return as[0]; + } else { + return null; + } + } + + /** + * Gets the value of the MIME header "Content-Type". + * @return a <CODE>String</CODE> giving the value of the + * "Content-Type" header or <CODE>null</CODE> if there is + * none + */ + public String getContentType() { + + String as[] = getMimeHeader("Content-Type"); + + if (as != null && as.length > 0) { + return as[0]; + } else { + return null; + } + } + + /** + * Sets the MIME header "Content-Id" with the given + * value. + * @param contentId a <CODE>String</CODE> giving + * the value of the "Content-Id" header + * @throws java.lang.IllegalArgumentException if + * there was a problem with the specified <CODE> + * contentId</CODE> value + * @see #getContentId() getContentId() + */ + public void setContentId(String contentId) { + setMimeHeader("Content-Id", contentId); + } + + /** + * Sets the MIME header "Content-Location" with the given + * value. + * @param contentLocation a <CODE>String</CODE> + * giving the value of the "Content-Location" header + * @throws java.lang.IllegalArgumentException if + * there was a problem with the specified content + * location + */ + public void setContentLocation(String contentLocation) { + setMimeHeader("Content-Location", contentLocation); + } + + /** + * Sets the MIME header "Content-Type" with the given + * value. + * @param contentType a <CODE>String</CODE> + * giving the value of the "Content-Type" header + * @throws java.lang.IllegalArgumentException if + * there was a problem with the specified content type + */ + public void setContentType(String contentType) { + setMimeHeader("Content-Type", contentType); + } + + /** + * Removes all MIME headers that match the given name. + * @param header - the string name of the MIME + * header/s to be removed + */ + public abstract void removeMimeHeader(String header); + + /** Removes all the MIME header entries. */ + public abstract void removeAllMimeHeaders(); + + /** + * Gets all the values of the header identified by the given + * <CODE>String</CODE>. + * @param name the name of the header; example: + * "Content-Type" + * @return a <CODE>String</CODE> array giving the value for the + * specified header + * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String) + */ + public abstract String[] getMimeHeader(String name); + + /** + * Changes the first header entry that matches the given name + * to the given value, adding a new header if no existing + * header matches. This method also removes all matching + * headers but the first. + * + * <P>Note that RFC822 headers can only contain US-ASCII + * characters.</P> + * @param name a <CODE>String</CODE> giving the + * name of the header for which to search + * @param value a <CODE>String</CODE> giving the + * value to be set for the header whose name matches the + * given name + * @throws java.lang.IllegalArgumentException if + * there was a problem with the specified mime header name + * or value + */ + public abstract void setMimeHeader(String name, String value); + + /** + * Adds a MIME header with the specified name and value to + * this <CODE>AttachmentPart</CODE> object. + * + * <P>Note that RFC822 headers can contain only US-ASCII + * characters.</P> + * @param name a <CODE>String</CODE> giving the + * name of the header to be added + * @param value a <CODE>String</CODE> giving the + * value of the header to be added + * @throws java.lang.IllegalArgumentException if + * there was a problem with the specified mime header name + * or value + */ + public abstract void addMimeHeader(String name, String value); + + /** + * Retrieves all the headers for this <CODE> + * AttachmentPart</CODE> object as an iterator over the <CODE> + * MimeHeader</CODE> objects. + * @return an <CODE>Iterator</CODE> object with all of the Mime + * headers for this <CODE>AttachmentPart</CODE> object + */ + public abstract Iterator getAllMimeHeaders(); + + /** + * Retrieves all <CODE>MimeHeader</CODE> objects that match + * a name in the given array. + * @param names a <CODE>String</CODE> array with + * the name(s) of the MIME headers to be returned + * @return all of the MIME headers that match one of the names + * in the given array as an <CODE>Iterator</CODE> + * object + */ + public abstract Iterator getMatchingMimeHeaders(String names[]); + + /** + * Retrieves all <CODE>MimeHeader</CODE> objects whose name + * does not match a name in the given array. + * @param names a <CODE>String</CODE> array with + * the name(s) of the MIME headers not to be returned + * @return all of the MIME headers in this <CODE> + * AttachmentPart</CODE> object except those that match one + * of the names in the given array. The nonmatching MIME + * headers are returned as an <CODE>Iterator</CODE> + * object. + */ + public abstract Iterator getNonMatchingMimeHeaders(String names[]); +} Added: geronimo/trunk/specs/saaj/src/javax/xml/soap/Detail.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/src/javax/xml/soap/Detail.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/src/javax/xml/soap/Detail.java (added) +++ geronimo/trunk/specs/saaj/src/javax/xml/soap/Detail.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,65 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.soap; + +import java.util.Iterator; + +/** + * A container for <code>DetailEntry</code> objects. <code>DetailEntry</code> + * objects give detailed error information that is application-specific and + * related to the <code>SOAPBody</code> object that contains it. + * <P> + * A <code>Detail</code> object, which is part of a <code>SOAPFault</code> + * object, can be retrieved using the method <code>SOAPFault.getDetail</code>. + * The <code>Detail</code> interface provides two methods. One creates a new + * <code>DetailEntry</code> object and also automatically adds it to + * the <code>Detail</code> object. The second method gets a list of the + * <code>DetailEntry</code> objects contained in a <code>Detail</code> + * object. + * <P> + * The following code fragment, in which <i>sf</i> is a <code>SOAPFault</code> + * object, gets its <code>Detail</code> object (<i>d</i>), adds a new + * <code>DetailEntry</code> object to <i>d</i>, and then gets a list of all the + * <code>DetailEntry</code> objects in <i>d</i>. The code also creates a + * <code>Name</code> object to pass to the method <code>addDetailEntry</code>. + * The variable <i>se</i>, used to create the <code>Name</code> object, + * is a <code>SOAPEnvelope</code> object. + * <PRE> + * Detail d = sf.getDetail(); + * Name name = se.createName("GetLastTradePrice", "WOMBAT", + * "http://www.wombat.org/trader"); + * d.addDetailEntry(name); + * Iterator it = d.getDetailEntries(); + * </PRE> + */ +public interface Detail extends SOAPFaultElement { + + /** + * Creates a new <code>DetailEntry</code> object with the given + * name and adds it to this <code>Detail</code> object. + * @param name a <code>Name</code> object identifying the new <code>DetailEntry</code> object + * @return DetailEntry. + * @throws SOAPException thrown when there is a problem in adding a DetailEntry object to this Detail object. + */ + public abstract DetailEntry addDetailEntry(Name name) throws SOAPException; + + /** + * Gets a list of the detail entries in this <code>Detail</code> object. + * @return an <code>Iterator</code> object over the <code>DetailEntry</code> + * objects in this <code>Detail</code> object + */ + public abstract Iterator getDetailEntries(); +} Added: geronimo/trunk/specs/saaj/src/javax/xml/soap/DetailEntry.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/src/javax/xml/soap/DetailEntry.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/src/javax/xml/soap/DetailEntry.java (added) +++ geronimo/trunk/specs/saaj/src/javax/xml/soap/DetailEntry.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,25 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.soap; + +/** + * The content for a <code>Detail</code> object, giving details for + * a <code>SOAPFault</code> object. A <code>DetailEntry</code> object, + * which carries information about errors related to the <code>SOAPBody</code> + * object that contains it, is application-specific. + * <P> + */ +public interface DetailEntry extends SOAPElement {} Added: geronimo/trunk/specs/saaj/src/javax/xml/soap/FactoryFinder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/saaj/src/javax/xml/soap/FactoryFinder.java?view=auto&rev=153028 ============================================================================== --- geronimo/trunk/specs/saaj/src/javax/xml/soap/FactoryFinder.java (added) +++ geronimo/trunk/specs/saaj/src/javax/xml/soap/FactoryFinder.java Tue Feb 8 22:00:44 2005 @@ -0,0 +1,153 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.xml.soap; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.InputStreamReader; + +import java.util.Properties; + +/** + * This class is used to locate factory classes for javax.xml.soap. + * It has package scope since it is not part of JAXM and should not + * be accessed from other packages. + */ +class FactoryFinder { + /** + * instantiates an object go the given classname. + * + * @param factoryClassName + * @return a factory object + * @throws SOAPException + */ + private static Object newInstance(String factoryClassName) throws SOAPException { + ClassLoader classloader = null; + try { + classloader = Thread.currentThread().getContextClassLoader(); + } catch (Exception exception) { + throw new SOAPException(exception.toString(), exception); + } + + try { + Class factory = null; + if (classloader == null) { + factory = Class.forName(factoryClassName); + } else { + try { + factory = classloader.loadClass(factoryClassName); + } catch (ClassNotFoundException cnfe) {} + } + if (factory == null) { + classloader = FactoryFinder.class.getClassLoader(); + factory = classloader.loadClass(factoryClassName); + } + return factory.newInstance(); + } catch (ClassNotFoundException classnotfoundexception) { + throw new SOAPException("Provider " + factoryClassName + " not found", classnotfoundexception); + } catch (Exception exception) { + throw new SOAPException("Provider " + factoryClassName + " could not be instantiated: " + exception, exception); + } + } + + /** + * Instantiates a factory object given the factory's property name and the + * default class name. + * + * @param factoryPropertyName + * @param defaultFactoryClassName + * @return a factory object + * @throws SOAPException + */ + static Object find(String factoryPropertyName, String defaultFactoryClassName) throws SOAPException { + try { + String factoryClassName = System.getProperty(factoryPropertyName); + if (factoryClassName != null) { + return newInstance(factoryClassName); + } + } catch (SecurityException securityexception) {} + + try { + String propertiesFileName = System.getProperty("java.home") + + File.separator + "lib" + + File.separator + "jaxm.properties"; + File file = new File(propertiesFileName); + if (file.exists()) { + FileInputStream fileInput = new FileInputStream(file); + Properties properties = new Properties(); + properties.load(fileInput); + fileInput.close(); + String factoryClassName = properties.getProperty(factoryPropertyName); + return newInstance(factoryClassName); + } + } catch (Exception exception1) {} + + String factoryResource = "META-INF/services/" + factoryPropertyName; + + try { + InputStream inputstream = getResource(factoryResource); + if (inputstream != null) { + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream, "UTF-8")); + String factoryClassName = bufferedreader.readLine(); + bufferedreader.close(); + if ((factoryClassName != null) && !"".equals(factoryClassName)) { + return newInstance(factoryClassName); + } + } + } catch (Exception exception2) {} + + if (defaultFactoryClassName == null) { + throw new SOAPException("Provider for " + factoryPropertyName + " cannot be found", null); + } else { + return newInstance(defaultFactoryClassName); + } + } + + /** + * Returns an input stream for the specified resource. + * + * <p>This method will firstly try + * <code>ClassLoader.getSystemResourceAsStream()</code> then + * the class loader of the current thread with + * <code>getResourceAsStream()</code> and finally attempt + * <code>getResourceAsStream()</code> on + * <code>FactoryFinder.class.getClassLoader()</code>. + * + * @param factoryResource the resource name + * @return an InputStream that can be used to read that resource, or + * <code>null</code> if the resource could not be resolved + */ + private static InputStream getResource(String factoryResource) { + ClassLoader classloader = null; + try { + classloader = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException securityexception) {} + + InputStream inputstream; + if (classloader == null) { + inputstream = ClassLoader.getSystemResourceAsStream(factoryResource); + } else { + inputstream = classloader.getResourceAsStream(factoryResource); + } + + if (inputstream == null) { + inputstream = FactoryFinder.class.getClassLoader().getResourceAsStream(factoryResource); + } + return inputstream; + } +}