You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2006/07/11 21:33:22 UTC

svn commit: r420955 [2/8] - in /webservices/axis2/trunk/java/modules/jaxws: ./ src/javax/jws/ src/javax/xml/ws/handler/ src/org/apache/axis2/jaxws/ src/org/apache/axis2/jaxws/binding/ src/org/apache/axis2/jaxws/client/ src/org/apache/axis2/jaxws/core/ ...

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+
+/**
+ * The <code>org.apache.axis2.jaxws.core.MessageContext</code> is
+ * an interface that extends the JAX-WS 2.0 <code>javax.xml.ws.handler.MessageContext</code>
+ * defined in the spec.  This encapsulates all of the functionality needed
+ * of the MessageContext for the other JAX-WS spec pieces (the handlers 
+ * for example) and also provides the needed bits of contextual information 
+ * for the rest of the JAX-WS implementation.
+ * 
+ * Specifically, this is responsible for providing APIs so that the client 
+ * and server implementation portions can get to the Message, defined by the 
+ * Message Model format and also any metadata that is available.
+ */
+public class MessageContext {
+
+    private org.apache.axis2.context.MessageContext axisMsgCtx;
+    private Map<String, Object> properties;
+    private ServiceDescription serviceDesc;
+    private Mode mode;
+        
+    private OMElement message;  //FIXME: This is temporary until we integrate with the Message Model
+    
+    public MessageContext() {
+        axisMsgCtx = new org.apache.axis2.context.MessageContext();
+        properties = new HashMap<String, Object>();
+    }
+    
+    public Map<String, Object> getProperties() {   
+        return properties;
+    }
+    
+    public ServiceDescription getServiceDescription() {
+        return serviceDesc;
+    }
+    
+    public void setServiceDescription(ServiceDescription sd) {
+        serviceDesc = sd;
+    }
+    
+    public Mode getMode() {
+        return mode;
+    }
+    
+    public void setMode(Mode m) {
+        mode = m;
+    }
+    
+    public String getOperationName() {
+        return null;
+    }
+    
+    //FIXME: This is a temporary mechanism until the Message Model 
+    //implementation is available.
+    public void setMessageAsOM(OMElement msg) {
+        message = msg;
+    }
+    
+    public OMElement getMessageAsOM() {
+        return message;
+    }
+    
+    protected org.apache.axis2.context.MessageContext getAxisMessageContext() {
+        return axisMsgCtx;
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.core.controller;
+
+import java.util.concurrent.Future;
+
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.jaxws.BindingProvider;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The <tt>AxisInvocationController</tt> is a stateless entity used to
+ * invoke the Axis2 client APIs.  All of the information that the 
+ * AxisInvocationController needs should exist within the InvocatonContext
+ * that is passed in.  
+ * 
+ * The request information is passed in within the InvocationContext.  The
+ * AxisInvocationController assumes that there is a MessageContext within that
+ * InvocationContext that is populated with all of the information that it
+ * needs to invoke.  If not, an error will be returned.  Once the response 
+ * comes back, the information for that response will be held inside of the
+ * MessageContext representing the response, that exists in the 
+ * InvocationContext.
+ * 
+ * The AxisInvocationController supports four different invocation patterns:
+ * 
+ * 1) synchronous - This is represented by the {@link #invoke(InvocationContext)}
+ * method.  This is a blocking call to the Axis2 client.
+ * 
+ * 2) one-way - This is represented by the {@link #invokeOneWay(InvocationContext)}
+ * method.  This is a one-way invocation that only returns errors related
+ * to sending the message.  If an error occurs while processing, the client
+ * will not be notified.
+ * 
+ * 3) asynchronous (callback) - {@link #invokeAsync(InvocationContext, AsyncHandler)}
+ * 
+ * 4) asynchronous (polling) - {@link #invokeAsync(InvocationContext)}
+ */
+public class AxisInvocationController implements InvocationController {
+    
+    private static Log log = LogFactory.getLog(AxisInvocationController.class);
+    
+    /**
+     * Performs a synchronous (blocking) invocation of the client.
+     * 
+     * @param ic
+     * @return
+     */
+    public InvocationContext invoke(InvocationContext ic) {
+        if (log.isDebugEnabled()) {
+            log.debug("Invocation pattern: synchronous");
+        }
+        
+        // Check to make sure we at least have a valid InvocationContext
+        // and request MessageContext
+        if (ic == null) {
+            throw new WebServiceException("Cannot invoke; InvocationContext was null");
+        }
+        if (ic.getRequestMessageContext() == null) {
+            throw new WebServiceException("Cannot invoke; request MessageContext was null");
+        }
+        
+        // Setup the MessageContext for the response
+        MessageContext requestMsgCtx = ic.getRequestMessageContext();
+        MessageContext responseMsgCtx = new MessageContext();
+        ic.setResponseMessageContext(responseMsgCtx);
+        
+        ServiceClient client = ic.getServiceClient();        
+        if (client != null) {
+            // Get the target endpoint address and setup the TO endpoint 
+            // reference.  This tells us where the request is going.
+            String targetUrl = (String) requestMsgCtx.getProperties().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+            EndpointReference toEPR = new EndpointReference(targetUrl);
+            client.getOptions().setTo(toEPR);
+            
+            // Get the SOAP Action (if needed)
+            String soapAction = getSOAPAction(requestMsgCtx);
+            client.getOptions().setAction(soapAction);
+            
+            // Use the ServiceClient to send the request.
+            OMElement rspEnvelope = null;
+            try {
+                OMElement reqEnvelope = requestMsgCtx.getMessageAsOM();
+                rspEnvelope = client.sendReceive(ServiceClient.ANON_OUT_IN_OP, reqEnvelope);
+            } catch (AxisFault e) {
+                throw new WebServiceException(e);
+            }
+            
+            responseMsgCtx.setMessageAsOM(rspEnvelope);
+        }
+
+        return ic;
+    }
+    
+    /**
+     * Performs a one-way invocation of the client.  This is NOT a robust
+     * invocation, so any fault that occurs during the processing of the request
+     * will not be returned to the client.  Errors returned to the client are
+     * problems that occurred during the sending of the message to the server.
+     * 
+     * @param ic
+     */
+    public void invokeOneWay(InvocationContext ic) {
+        if (log.isDebugEnabled()) {
+            log.debug("Invocation pattern: one-way");
+        }
+        return;
+    }
+    
+    /**
+     * Performs an asynchronous (non-blocking) invocation of the client based 
+     * on a callback model.  The AsyncHandler that is passed in is the callback
+     * that the client programmer supplied when they invoked their JAX-WS
+     * Dispatch or their SEI-based dynamic proxy.  
+     * 
+     * @param ic
+     * @param callback
+     * @return
+     */
+    public Future<?> invokeAsync(InvocationContext ic, AsyncHandler callback) {
+        if (log.isDebugEnabled()) {
+            log.debug("Invocation pattern: async (callback)");
+        }
+        return null;
+    }
+    
+    /**
+     * Performs an asynchronous (non-blocking) invocation of the client based 
+     * on a polling model.  The Response object that is returned allows the 
+     * client programmer to poll against it to see if a response has been sent
+     * back by the server.
+     * 
+     * @param ic
+     * @return
+     */
+    public Response invokeAsync(InvocationContext ic) {
+        if (log.isDebugEnabled()) {
+            log.debug("Invocation pattern: async (polling)");
+        }
+        return null;
+    }
+    
+    /**
+     * Creates the OperationClient instance that will be invoked upon.
+     * 
+     * This will be used instead of the ServiceClient as we mature the 
+     * AxisInvocationController
+     */
+    /*
+    private OperationClient createOperationClient(MessageContext mc) {
+        OperationClient client = null;
+        String operationName = mc.getOperationName();
+        
+        if (operationName != null) {
+            AxisService service = mc.getMetadata();
+            AxisOperation operation = service.getOperation(new QName(operationName));
+            
+            if (operation == null) {
+                throw new WebServiceException("Operation not found.");
+            }
+            
+            try {
+                ServiceContext ctx = new ServiceContext(service, );
+                client = operation.createClient(ctx, null);
+                client.addMessageContext(null);
+            }
+            catch (AxisFault af) {
+                throw new WebServiceException(af);
+            }            
+        }
+        else {
+            throw new WebServiceException("Operation name not set.");
+        }
+        
+        return client;
+    }
+    */
+    
+    private String getSOAPAction(MessageContext ctx){
+        Boolean useSoapAction = (Boolean) ctx.getProperties().get(BindingProvider.SOAPACTION_USE_PROPERTY);
+        if(useSoapAction != null && useSoapAction.booleanValue()){
+            return (String) ctx.getProperties().get(BindingProvider.SOAPACTION_URI_PROPERTY);
+        }
+        
+        return null;
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,19 @@
+package org.apache.axis2.jaxws.core.controller;
+
+import java.util.concurrent.Future;
+
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+import org.apache.axis2.jaxws.core.InvocationContext;
+
+public interface InvocationController {
+    
+    public InvocationContext invoke(InvocationContext ic);
+    
+    public void invokeOneWay(InvocationContext ic);
+    
+    public Response invokeAsync(InvocationContext ic);
+    
+    public Future<?> invokeAsync(InvocationContext ic, AsyncHandler asyncHandler);
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.description;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.xml.namespace.QName;
+
+
+/**
+ * 
+ */
+/*
+Working-design information.
+
+Java Name: none [client]; Endpoint implementation class [server]
+
+Axis2 Delegate: none; Axis2 put this information into AxisService
+
+JSR-181 Annotations: TBD
+
+WSDL Elements
+<port
+
+JAX-WS Annotations: 
+@ServiceMode (value) [Server, jaxws.Provider?]
+@WebServiceProvider(wsdllocation, serviceName, portName, targetNamespace) [Server, jaxws.Provider]
+@BindingType(value) [Server, endpoint impl]
+TBD
+
+Properties available to JAXWS runtime: TBD
+
+ */
+/*
+ * TODO: EndpointDescription should be created AxisService objects and not directly from WSDL
+ * IMPORTANT NOTE: Axis2 currently only supports 1 service and 1 port under that service.  When that is
+ * fixed, that will probably have an impact on this class.  In particular, I think this should be created 
+ * somehow from an AxisService/AxisPort combination, and not directly from the WSDL.
+ */
+public class EndpointDescription {
+    private QName portQName;
+    // TODO: This needs to be a collection of handler descriptions; use JAX-WS Appendix B Handler Chain Configuration File Schema as a starting point
+    private ArrayList<String> handlerList = new ArrayList<String>();
+    
+    /**
+     * Create an EndpointDescription based on the WSDL port.  Note that per the JAX-WS Spec (Final Release, 4/19/2006
+     * Section 4.2.3 Proxies, page 55)the "namespace component of the port is the target namespace of the WSDL 
+     * definition document".
+     * 
+     * @param wsdlPort The WSDL Port tag for this EndpointDescription.
+     * @param definition The WSDL Definition target namespace used to create the port QName
+     */
+    EndpointDescription(Port wsdlPort, Definition definition) {
+        String localPart = wsdlPort.getName();
+        String namespace = definition.getTargetNamespace();
+        portQName = new QName(namespace, localPart);
+    }
+    public QName getPortQName() {
+        return portQName;
+    }
+    
+    /**
+     * Returns a live list describing the handlers on this port.
+     * TODO: This is currently returning List<String>, but it should return a HandlerDescritpion
+     * object that can represent a handler description from various Metadata (annotation, deployment descriptors, etc);
+     * use JAX-WS Appendix B Handler Chain Configuration File Schema as a starting point for HandlerDescription.
+     *  
+     * @return A List of handlers for this port.  The actual list is returned, and therefore can be modified.
+     */
+    public List<String> getHandlerList() {
+        return handlerList;
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.description;
+
+/**
+ * 
+ */
+/*
+Java Name: SEI Class name
+
+Axis2 Delegate: none
+
+JSR-181 Annotations: 
+@WebService Note this can be specified on the endpoint Impl without an SEI
+- name itÂ’s the PortType Class Name, one you get with getPort() call in Service Delegate [NT]
+- targetNamespace
+- serviceName default is portType+Service. Should we use this if Service.create call does not provide/have ServiceQname?[NT]
+- wsdlLocation if no wsdl location provided the read this annotation. Should this override what is client sets?[NT]
+- endpointInterface Will not be present on interfaces (SEI), so I will use this to figure out if the client Call is Extension of Service or is SEI by looking at this annotation. [NT]
+- portName ok so JSR 181 spec I have does not have this annotation but JAXWS spec I have has this. So if ServiceDelegate.getPort() does not have port name use this annotation and derive portName [NT]
+@SOAPBinding This one is important for Proxy especially. [NT]
+- style: DOCUMENT | RPC tells me if it is doc or rpc[NT]
+- use: LITERAL | ENCODED Always literal for IBM[NT]
+- parameterStyle:  BARE | WRAPPED tells me if the wsdl is wrapped or not wrapped [NT]
+@HandlerChain(file, name)
+TBD
+
+WSDL Elements
+<portType
+<binding used for operation parameter bindings below
+
+Properties available to JAXWS runtime: 
+getHandlerList() returns a live List of handlers which can be modified; this MUST be cloned before being used as an actual handler chain; Note this needs to consider if any @HandlerChain annotations are in the ServiceDescription as well
+TBD
+
+ */
+public class EndpointInterfaceDescription {
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/FaultDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/FaultDescription.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/FaultDescription.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/FaultDescription.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.description;
+
+/**
+ * 
+ */
+/*
+Workign-design information.
+
+Java Name: Exception class name
+
+Exception Holder Type
+Exception Holder Held Type
+
+Axis2 Delegate: TBD
+
+JSR-181 Annotations: TBD
+
+WSDL Elements: TBD
+
+JAX-WS Annotations:
+@WebFault(name, targetNamespace, faultBean)
+
+Properties available to JAXWS runtime: TBD
+
+ */
+public class FaultDescription {
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.description;
+
+/**
+ * 
+ */
+/*
+Java Name: Method name from SEI
+
+Axis2 Delegate: AxisOperation
+
+JSR-181 Annotations: 
+@WebMethod
+- operationName
+- action
+- exclude
+@Oneway So basically even if an operation has a return parameter it could be one way and in this case should we set the AxisOperatio mep to oneway?[NT]
+TBD
+
+WSDL Elements
+<portType  <operation
+
+JAX-WS Annotations
+@RequestWrapper
+- localName
+- targetNamespace
+- className
+@ResponseWrapper
+- localName
+- targetNamespace
+- className
+TBD
+
+Properties available to JAXWS runtime: 
+isWrapper()
+String getRequestWrapper JAXB Class
+String getResponseWrapper JAXB Class
+TBD
+
+ */
+public class OperationDescription {
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ParameterDescription.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.description;
+
+/**
+ * 
+ */
+/*
+Java Name: Parameter Name
+
+Java Signature Parameter Type:  Could be a holder class
+Java Signature ParameterHeldType if the Signature Parameter  Type is a holder class, then this is the held type
+
+Axis2 Delegate: TBD
+
+JSR-181 Annotations: 
+@WebParam(name, targetNamespace, mode, header, partName) [Input, Output]
+@WebResult(name, targetNamespace, header, partName) [Output only?]
+TBD
+
+WSDL Elements: TBD
+
+JAX-WS Annotations: TBD
+
+Properties available to JAXWS runtime: TBD
+
+ */
+public class ParameterDescription {
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.description;
+
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.OutInAxisOperation;
+import org.apache.axis2.description.OutOnlyAxisOperation;
+import org.apache.axis2.description.RobustOutOnlyAxisOperation;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.engine.AbstractDispatcher;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.axis2.jaxws.util.WSDLWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The JAX-WS Service metadata and root of the JAX-WS Descritpion hierachy.
+ */
+
+/*
+Working-design information.
+
+Description hierachy
+    ServiceDescription
+        EndpointDescription[]
+            EndpointInterfaceDescription
+                OperationDescription[]
+                    ParameterDescription Input[]
+                    ParameterDescription Output[]
+                    FaultDescription
+
+ServiceDescription:
+Corresponds to the generated Service class [client]; TBD [server]
+
+Java Name: Generated service class or null if dynamically configured service [client]; null [server]
+
+Axis2 Delegate: AxisService
+
+JSR-181 Annotations: 
+@HandlerChain(file, name) [per JAXWS p. 105] Affects all proxies and dispatches created using any port on this service
+TBD
+
+WSDL Elements: 
+<service
+
+JAX-WS Annotations: 
+@WebServiceClient(name, targetNamespace, wsdlLocation)
+@WebEndpoint(name) This is specified on the getPortName() methods on the service
+TBD
+
+Properties available to JAXWS runtime:
+getJAXInterface(QName port) Needed by HandlerResolver
+TBD
+
+ */
+
+public class ServiceDescription {
+    private AxisService axisService;
+
+    private URL wsdlURL;
+    private QName serviceQName;
+    private Class serviceClass;
+    
+    // TODO: Possibly remove Definition and delegate to the Defn on the AxisSerivce set as a paramater by WSDLtoAxisServicBuilder?
+    private WSDLWrapper wsdlWrapper; 
+    
+    private Hashtable<QName, EndpointDescription> endpointDescriptions = new Hashtable<QName, EndpointDescription>();
+    
+    private static final Log log = LogFactory.getLog(AbstractDispatcher.class);
+    
+    /**
+     * ServiceDescription contains the metadata (e.g. WSDL, annotations) relating to a Service.
+     * 
+     * @param wsdlURL  The WSDL file (this may be null).
+     * @param serviceQName  The name of the service in the WSDL.  This can not be null since a 
+     *   javax.xml.ws.Service can not be created with a null service QName.
+     * @param serviceClass  The JAX-WS service class.  This could be an instance of
+     *   javax.xml.ws.Service or a generated service subclass thereof.
+     */
+    public ServiceDescription(URL wsdlURL, QName serviceQName, Class serviceClass) {
+        if (serviceQName == null) {
+            throw new WebServiceException("Invalid Service QName; cannot be null");
+        }
+        if (serviceClass == null) {
+            throw new WebServiceException("Invalid Service Class; cannot be null");
+        }
+        if (!javax.xml.ws.Service.class.isAssignableFrom(serviceClass)) {
+            throw new WebServiceException("Invalid Service Class; must be assignable to javax.xml.ws.Service");
+        }
+        
+        this.wsdlURL = wsdlURL;
+        this.serviceQName = serviceQName;
+        this.serviceClass = serviceClass;
+        
+        setupWsdlDefinition();
+        setupAxisService();
+        buildDescriptionHierachy();
+    }
+    
+    /*=======================================================================*/
+    /*=======================================================================*/
+    // START of public accessor methods
+    
+    public EndpointDescription getEndpointDescription(QName portQName) {
+        return endpointDescriptions.get(portQName);
+    }
+    
+    public AxisService getAxisService() {
+        return axisService;
+    }
+    
+    // END of public accessor methods
+    /*=======================================================================*/
+    /*=======================================================================*/
+    
+    private void setupWsdlDefinition() {
+        // Note that there may be no WSDL provided, for example when called from 
+        // Service.create(QName serviceName).
+        if (wsdlURL != null) {
+            try {
+                wsdlWrapper = new WSDL4JWrapper(this.wsdlURL);
+            } catch (WSDLException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+                throw new WebServiceException("caught WSDL Exception" + e.getMessage());
+            }
+        }
+    }
+
+    private void setupAxisService() {
+        // TODO: Need to use MetaDataQuery validator to merge WSDL (if any) and annotations (if any)
+        
+        if (wsdlWrapper != null) {
+            buildAxisServiceFromWSDL();
+        }
+        else {
+            buildAxisServiceFromNoWSDL();
+        }
+    }
+
+    private void buildAxisServiceFromWSDL() {
+        // TODO: Change this to use WSDLToAxisServiceBuilder superclass
+        WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlWrapper.getDefinition(), serviceQName, null);
+        try {
+            axisService = serviceBuilder.populateService();
+        } catch (AxisFault e) {
+            // TODO Auto-generated catch block
+            log.warn("ServiceDescription: Caught exception creating AxisService", e);
+        }
+    }
+    
+    private void buildAxisServiceFromNoWSDL() {
+        // Patterned after ServiceClient.createAnonymousService()
+        String serviceName = null;
+        if (serviceQName != null) {
+            serviceName = serviceQName.getLocalPart();
+        }
+        else {
+            serviceName = ServiceClient.ANON_SERVICE;
+        }
+        // Make this service name unique.  The Axis2 engine assumes that a service it can not find is a client-side service.
+        // See org.apache.axis2.client.ServiceClient.configureServiceClient()
+        axisService = new AxisService(serviceName + this.hashCode());
+        axisService.addOperation(new RobustOutOnlyAxisOperation(ServiceClient.ANON_ROBUST_OUT_ONLY_OP));
+        axisService.addOperation(new OutOnlyAxisOperation(ServiceClient.ANON_OUT_ONLY_OP));
+        axisService.addOperation(new OutInAxisOperation(ServiceClient.ANON_OUT_IN_OP));
+    }
+    
+    private void buildDescriptionHierachy() {
+        // Create the EndpointDescription corresponding to the WSDL <port> tags
+        if (wsdlWrapper != null) {
+            buildEndpointDescriptionsFromWSDL();
+        }
+        // TODO: Need to create from Annotations (if no WSDL) and modify created ones based on annotations (if WSDL)
+        
+    }
+    
+    private void buildEndpointDescriptionsFromWSDL() {
+        // TODO: Currently Axis2 only supports 1 service and 1 port; that fix will likely affect this code
+        //       Until then, build the EndpointDescriptions directly from the WSDL.
+        Definition definition = wsdlWrapper.getDefinition();
+        Service service = definition.getService(serviceQName);
+        if (service == null) {
+            throw new WebServiceException("Service QName not found in WSDL");
+        }
+        
+        Map ports = service.getPorts();
+        if (ports != null && ports.size() > 0) {
+            Iterator portIterator = ports.values().iterator();
+            while (portIterator.hasNext()) {
+                Port wsdlPort = (Port) portIterator.next();
+                EndpointDescription endpointDescription = new EndpointDescription(wsdlPort, definition);
+                QName portQName = endpointDescription.getPortQName();
+                endpointDescriptions.put(portQName, endpointDescription); 
+            }
+        }
+    }
+    
+    // TODO: Remove these and replace with appropraite get* methods for WSDL information
+    public WSDLWrapper getWSDLWrapper() {
+        return wsdlWrapper;
+    }
+    public URL getWSDLLocation() {
+        return wsdlURL;
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,348 @@
+package org.apache.axis2.jaxws.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+
+public class HandlerChainProcessor {
+
+	public enum Direction {
+		IN, OUT
+	};
+
+	// the type of message, not indicative of one-way vs. request-response
+	public enum MEP {
+		REQUEST, RESPONSE
+	};
+	
+	private MessageContext mc;
+	private ArrayList<Handler> handlers = null;
+	
+	// track start/end of logical and protocol handlers in the list
+	// The two scenarios are:  1) run logical handlers only, 2) run all handlers
+	// logical start is always 0
+	// protocol start is always logicalLength + 1
+	// list end is always handlers.size()-1
+	private int logicalLength = 0; 
+	
+	private final static int SUCCESSFUL = 0;
+	private final static int FAILED = 1;
+	private final static int PROTOCOL_EXCEPTION = 2;
+	private final static int OTHER_EXCEPTION = 3;
+	// save it if Handler.handleMessage throws one in HandlerChainProcessor.handleMessage
+	private RuntimeException savedException;
+
+	/*
+	 * HandlerChainProcess expects null, empty list, or an already-sorted
+	 * list.  If the chain passed into here came from our HandlerChainResolver,
+	 * it is sorted already.  If a client app created or manipulated the list,
+	 * it may not be sorted.  The processChain and processFault methods check
+	 * for this by calling verifyChain.
+	 */
+	public HandlerChainProcessor(ArrayList<Handler> chain) {
+		if (chain == null) {
+			handlers = new ArrayList<Handler>();
+		}
+		else
+			handlers = chain;
+	}
+	
+	/*
+	 * verifyChain will check that the chain is properly sorted, since it may be
+	 * a chain built or modified by a client application.  Also keep track of
+	 * start/end for each type of handler.
+	 */
+	private void verifyChain() throws WebServiceException {
+		boolean protocolHandlersStarted = false;
+		for (Handler handlerClass : handlers) {
+			if (LogicalHandler.class.isAssignableFrom(handlerClass.getClass())) {
+				if (protocolHandlersStarted)
+					// TODO: NLS better error message
+					throw new WebServiceException("All logical handlers must come before all protocol handlers");
+				else {
+					logicalLength++;
+				}
+			}
+			else if (SOAPHandler.class.isAssignableFrom(handlerClass.getClass()))
+				protocolHandlersStarted = true;
+			else if (Handler.class.isAssignableFrom(handlerClass.getClass())) {
+				// TODO: NLS better error message
+				throw new WebServiceException("cannot implement Handler directly");
+			} else {
+				// TODO: NLS better error message
+				throw new WebServiceException("Some error");
+			}
+
+		}
+	}
+	
+
+	
+	/**
+	 * @param mc
+	 * By the time processChain method is called, we already have the sorted chain,
+	 * and now we have the direction, MEP, MessageContext, and if a response is expected.  We should
+	 * be able to handle everything from here, no pun intended.
+	 * 
+	 * Two things a user of processChain should check when the method completes:
+	 * 1.  Has the MessageContext.MESSAGE_OUTBOUND_PROPERTY changed, indicating reversal of message direction
+	 * 2.  Has the message been converted to a fault message? (indicated by a flag in the message)
+	 */
+	public void processChain(MessageContext mc, Direction direction, MEP mep, boolean expectResponse) {
+		// make sure it's set:
+		mc.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, (direction == Direction.OUT));
+		
+		this.mc = mc;
+		verifyChain();
+		
+		if (SOAPMessageContext.class.isAssignableFrom(mc.getClass())) {  // all handlers
+			if (direction == Direction.OUT) {  // 9.3.2 outbound
+				callGenericHandlers(mep, expectResponse, 0, handlers.size()-1, direction);
+			}
+			else { // IN case - 9.3.2 inbound
+				callGenericHandlers(mep, expectResponse, handlers.size()-1, 0, direction);
+			}
+		}
+		else {  // logical handlers only
+			if (direction == Direction.OUT) {  // 9.3.2 outbound
+				callGenericHandlers(mep, expectResponse, 0, logicalLength-1, direction);
+			}
+			else { // IN case - 9.3.2 inbound
+				callGenericHandlers(mep, expectResponse, logicalLength-1, 0, direction);
+			}
+		}
+	}
+	
+	
+	/*
+	 * This is the implementation of JAX-WS 2.0 section 9.3.2.1
+	 */
+	private void callGenericHandlers(MEP mep, boolean expectResponse, int start, int end, Direction direction) throws RuntimeException {
+		
+		// if this is a response message, expectResponse should always be false
+		if (mep == MEP.RESPONSE)
+			expectResponse = false;
+		
+		int i = start;
+		int result = SUCCESSFUL;
+		
+		// declared and initialized just in case we need them
+		// in a reverse flow situation
+		int newStart = 0, newStart_inclusive = 0, newEnd = 0;
+		Direction newDirection = direction;
+
+		if (direction == Direction.OUT) {
+			while ((i <= end) && (result == SUCCESSFUL)) {
+				result = handleMessage(((Handler)handlers.get(i)), mc, direction, expectResponse);
+				newStart = i-1;
+				newStart_inclusive = i;
+				newEnd = 0;
+				newDirection = Direction.IN;
+				i++;
+			}
+		}
+		else { // IN case
+			while ((i >= end) && (result == SUCCESSFUL)) {
+				result = handleMessage(((Handler)handlers.get(i)), mc, direction, expectResponse);
+				newStart = i+1;
+				newStart_inclusive = i;
+				newEnd = handlers.size()-1;
+				newDirection = Direction.OUT;
+				i--;
+			}
+		}
+		
+		if (newDirection == direction) // we didn't actually process anything, probably due to empty list
+			return;  // no need to continue
+		
+		// 9.3.2.3 in all situations, we want to close as many handlers as
+		// were invoked prior to completion or exception throwing
+		if (expectResponse) {
+			if (result == FAILED) {
+				// we should only use callGenericHandlers_avoidRecursion in this case
+				callGenericHandlers_avoidRecursion(newStart, newEnd, newDirection);
+				callCloseHandlers(newStart_inclusive, newEnd, newDirection);
+			} else if (result == PROTOCOL_EXCEPTION) {
+				try {
+					callGenericHandleFault(newStart, newEnd, newDirection);
+					callCloseHandlers(newStart_inclusive, newEnd, newDirection);
+				} catch (RuntimeException re) {
+					callCloseHandlers(newStart_inclusive, newEnd, newDirection);
+					// TODO: NLS log and throw
+					throw re;
+				}
+			} else if (result == OTHER_EXCEPTION) {
+				callCloseHandlers(newStart_inclusive, newEnd, newDirection);
+				// savedException initialized in HandlerChainProcessor.handleMessage
+				// TODO: NLS log and throw
+				throw savedException;
+			}
+		} else { // everything was successful OR finished processing handlers
+			callCloseHandlers(newStart_inclusive, newEnd, newDirection);
+		}
+		
+	}
+
+	
+	/*
+	 * callGenericHandlers_avoidRecursion should ONLY be called from one place.
+	 * We can safely assume no false returns and no exceptions will be thrown
+	 * from here since the handlers we will be calling have all already
+	 * succeeded in callGenericHandlers.
+	 */
+	private void callGenericHandlers_avoidRecursion(int start,
+			int end, Direction direction) {
+		int i = start;
+
+		if (direction == Direction.OUT) {
+			for (; i <= end; i++) {
+				((Handler) handlers.get(i)).handleMessage(mc);
+			}
+		} else { // IN case
+			for (; i >= end; i--) {
+				((Handler) handlers.get(i)).handleMessage(mc);
+			}
+		}
+	}
+	
+	
+	/**
+	 * Calls handleMessage on the Handler.
+	 * If an exception is thrown and a response is expected, the MessageContext is updated with the handler information
+	 * @returns SUCCESSFUL if successfully, UNSUCCESSFUL if false, EXCEPTION if exception thrown
+	 */
+	private int handleMessage(Handler handler, MessageContext mc, Direction direction,
+			boolean expectResponse) throws RuntimeException {
+		try {
+			boolean success = handler.handleMessage(mc);
+			if (success)
+				return SUCCESSFUL;
+			else {
+				if (expectResponse)
+					mc.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, (direction != Direction.OUT));
+				return FAILED;
+			}
+		} catch (RuntimeException re) {  // RuntimeException and ProtocolException
+			savedException = re;
+			if (expectResponse)
+				mc.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, (direction != Direction.OUT));
+			if (ProtocolException.class.isAssignableFrom(re.getClass())) {
+				convertToFaultMessage(mc, re);
+				return PROTOCOL_EXCEPTION;
+			}
+			return OTHER_EXCEPTION;
+		}
+
+	}
+	
+	
+	/*
+	 * start and end should be INclusive of the handlers that have already been
+	 * invoked on Handler.handleMessage or Handler.handleFault
+	 */
+	private void callCloseHandlers(int start, int end,
+			Direction direction) {
+
+		if (direction == Direction.OUT) {
+			for (int i = start; i <= end; i++) {
+				try {
+					((Handler) handlers.get(i)).close(mc);
+				} catch (Exception e) {
+					// TODO: log it, but otherwise ignore
+				}
+			}
+		} else { // IN case
+			for (int i = start; i >= end; i--) {
+				try {
+					((Handler) handlers.get(i)).close(mc);
+				} catch (Exception e) {
+					// TODO: log it, but otherwise ignore
+				}
+			}
+		}
+	}
+	
+	/*
+	 * callHandleFault is available for a server to use when the endpoint
+	 * throws an exception or a client when it gets a fault response message
+	 * 
+	 * In both cases, all of the handlers have run successfully in the
+	 * opposite direction as this call to callHandleFault, and thus
+	 * should be closed.
+	 */
+	public void processFault(SOAPMessageContext mc, Direction direction) {
+		
+		// direction.IN = client
+		// direction.OUT = server
+		
+		// make sure it's right:
+		mc.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, (direction == Direction.OUT));
+
+		verifyChain();
+		
+		try {
+			if (direction == Direction.OUT) {
+				callGenericHandleFault(0, handlers.size()-1, direction);
+			}
+			else { // IN case
+				callGenericHandleFault(handlers.size()-1, 0, direction);
+			}
+		} catch (RuntimeException re) {
+			// TODO: log it
+			throw re;
+		} finally {
+			// we can close all the Handlers in reverse order
+			if (direction == Direction.OUT) {
+				callCloseHandlers(handlers.size()-1, 0, Direction.IN);
+			}
+			else { // IN case
+				callCloseHandlers(0, handlers.size()-1, Direction.OUT);
+			}
+		}
+	}
+	
+
+	/*
+	 * The callGenericHandleFault caller is responsible for closing any invoked
+	 * Handlers.  We don't know how far the Handler.handleMessage calls got
+	 * before a failure may have occurred.
+	 * 
+	 * Regardless of the Handler.handleFault result, the flow is the same (9.3.2.2)
+	 */
+	private void callGenericHandleFault(int start, int end,
+			Direction direction) throws RuntimeException {
+		
+		int i = start;
+
+		if (direction == Direction.OUT) {
+			for (; i <= end; i++) {
+				if (((Handler) handlers.get(i)).handleFault(mc) == false) {
+					break;
+				}
+			}
+		} else { // IN case
+			for (; i >= end; i--) {
+				if (((Handler) handlers.get(i)).handleFault(mc) == false) {
+					break;
+				}
+			}
+		}
+	}
+	
+	
+	private void convertToFaultMessage(MessageContext mc, Exception e) {
+		// TODO: implement
+		// need to check if message is already a fault message or not,
+		// probably by way of a flag (isFault) in the MessageContext or Message
+	}
+	
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,161 @@
+package org.apache.axis2.jaxws.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.handler.soap.SOAPHandler;
+
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.spi.ServiceDelegate;
+
+/* 
+ * This class should be created by the ServiceDelegate.
+ * HandlerResolverImpl.getHandlerChain(PortInfo) will be called by the
+ * InvocationContext, and the return value will be set on the Binding
+ * under the BindingProvider.
+ * 
+ * HandlerResolverImpl.getHandlerChain(PortInfo) will be responsible for
+ * starting each Handler's lifecycle according to JAX-WS spec 9.3.1
+ */
+
+public class HandlerResolverImpl implements HandlerResolver {
+
+	/*
+	 * TODO:  is there any value/reason in caching the list we collect from the
+	 * ports?  It is a "live" list in the sense that we could possibly return
+	 * a List or ArrayList object to a service or client application, where
+	 * they could manipulate it.
+	 */
+
+	// we'll need to refer to this object to get the port, and thus handlers
+	private ServiceDelegate delegate;
+
+	public HandlerResolverImpl(ServiceDelegate delegate) {
+		this.delegate = delegate;
+	}
+
+	public List<Handler> getHandlerChain(PortInfo portinfo) {
+		// TODO:  would check and/or build cache here if implemented later
+		return resolveHandlers(portinfo);
+	}
+
+	/*
+	 * The list of handlers (rather, list of class names) is already
+	 * available per port.  Ports are stored under the ServiceDelegate
+	 * as PortData objects.
+	 * 
+	 * The resolveHandlers method is responsible for instantiating each Handler,
+	 * running the annotated PostConstruct method, sorting the list, resolving the list,
+	 * and returning it
+	 */
+	private List<Handler> resolveHandlers(PortInfo portinfo) throws WebServiceException {
+		EndpointDescription edesc = delegate.getServiceDescription().getEndpointDescription(portinfo.getPortName());
+		
+		ArrayList handlers = new ArrayList<Handler>();
+		ArrayList logicalHandlers = new ArrayList<Handler>();
+		ArrayList protocolHandlers = new ArrayList<Handler>();
+
+		/*
+		 * TODO: the list returned by getHandlerList() eventually will contain
+		 * more information than just a list of strings.  We will need to
+		 * do a better job checking that the return value (a HandlerDescription
+		 * object?) matches up with the PortInfo object before we add it to the
+		 * chain.
+		 */
+		
+		for (String portHandler : edesc.getHandlerList()) {
+			Handler handlerClass;
+			// instantiate portHandler class
+			try {
+				// TODO: ok to use system classloader?
+				handlerClass = (Handler) loadClass(portHandler).newInstance();
+				callHandlerPostConstruct(handlerClass);
+			} catch (ClassNotFoundException e) {
+				// TODO: should we just ignore this problem?
+				// TODO: NLS log and throw
+				throw new WebServiceException(e);
+			} catch (InstantiationException ie) {
+				// TODO: should we just ignore this problem?
+				// TODO: NLS log and throw
+				throw new WebServiceException(ie);
+			} catch (IllegalAccessException e) {
+				// TODO: should we just ignore this problem?
+				// TODO: NLS log and throw
+				throw new WebServiceException(e);
+			}
+			
+			// 9.2.1.2 sort them by Logical, then SOAP
+			if (LogicalHandler.class.isAssignableFrom(handlerClass.getClass()))
+				logicalHandlers.add((LogicalHandler)handlerClass);
+			else if (SOAPHandler.class.isAssignableFrom(handlerClass.getClass()))
+				// instanceof ProtocolHandler
+				protocolHandlers.add((SOAPHandler)handlerClass);
+			else if (Handler.class.isAssignableFrom(handlerClass.getClass())) {
+				// TODO: NLS better error message
+				throw new WebServiceException("cannot implement Handler directly");
+			} else {
+				// TODO: NLS better error message
+				throw new WebServiceException("Some error");
+			}
+		}
+		
+		handlers.addAll(logicalHandlers);
+		handlers.addAll(protocolHandlers);
+		return handlers;
+	}
+	
+	
+	private static Class loadClass(String clazz) throws ClassNotFoundException {
+		try {
+			return Class.forName(clazz, true, ClassLoader.getSystemClassLoader());
+		} catch (ClassNotFoundException e) {
+			throw e;
+		}
+	}
+
+
+	private static void callHandlerPostConstruct(Object handlerClass) {
+		/*
+		 * TODO apparently there's no javax.annotation.* package in Java
+		 * EE 5 ?? We need to call @PostConstruct method on handler if present
+		for (Method method : handlerClass.getClass().getMethods()) {
+			if (method.getAnnotation(javax.annotation.PostConstruct.class) != null) {
+				try {
+					method.invoke(handlerClass, new Object [0]);
+					break;
+				} catch (Exception e) {
+					// TODO: log it, but otherwise ignore
+				}
+			}
+		}
+		*/
+	}
+	
+	/*
+	 * Helper method to destroy all instantiated Handlers once the runtime
+	 * is done with them.
+	 */
+	public static void destroyHandlers(List<Handler> handlers) {
+		/*
+		 * TODO apparently there's no javax.annotation.* package in Java
+		 * EE 5 ?? We need to call @PostConstruct method on handler if present
+		for (Handler handler: handlers) {
+			for (Method method: handler.getClass().getMethods()) {
+				if (method.getAnnotation(javax.annotation.PreDestroy.class) != null) {
+					try {
+						method.invoke(handlerClass, new Object[0]);
+						break;
+					} catch (Exception e) {
+						// TODO: log it, but otherwise ignore
+					}
+				}
+			}
+		}
+		*/
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.handler;
+
+import javax.xml.ws.LogicalMessage;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+
+/**
+ * The LogicalMessageContext is a JAX-WS interface that is given
+ * to Logical handlers to provide access to the message and
+ * its associated properties.
+ */
+public class LogicalMessageContext extends ProtectedMessageContext
+    implements javax.xml.ws.handler.LogicalMessageContext {
+    
+    public LogicalMessageContext() {
+		super();
+	}
+
+	public LogicalMessageContext(MessageContext mc) {
+		super(mc);
+	}
+
+	public LogicalMessage getMessage() {
+        return null;
+    }
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/PortInfoImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/PortInfoImpl.java?rev=420955&r1=420954&r2=420955&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/PortInfoImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/PortInfoImpl.java Tue Jul 11 12:33:12 2006
@@ -17,6 +17,7 @@
 package org.apache.axis2.jaxws.handler;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
 
 public class PortInfoImpl implements PortData {
 	private QName serviceName = null;
@@ -25,9 +26,22 @@
 	private String serviceEndpoint = null;
 	
 
+	/**
+	 * @param serviceName
+	 * @param portName
+	 * @param bindingId
+	 * @param serviceEndpoint
+	 */
 	public PortInfoImpl(QName serviceName, QName portName, String bindingId, String serviceEndpoint) {
 		super();
-		// TODO Auto-generated constructor stub
+		if (serviceName == null)
+			throw new WebServiceException("serviceName cannot be null");
+		if (portName == null)
+			throw new WebServiceException("portName cannot be null");
+		if (bindingId == null)
+			throw new WebServiceException("bindingId cannot be null");
+		if (serviceEndpoint == null)
+			throw new WebServiceException("serviceEndpoint cannot be null");
 		this.serviceName = serviceName;
 		this.portName = portName;
 		this.bindingId = bindingId;
@@ -35,38 +49,71 @@
 	}
 
 	public QName getServiceName() {
-		// TODO Auto-generated method stub
 		return serviceName;
 	}
 
 	public QName getPortName() {
-		// TODO Auto-generated method stub
 		return portName;
 	}
 
 	public String getBindingID() {
-		// TODO Auto-generated method stub
 		return bindingId;
 	}
 	
+	public String getEndpointAddress(){
+		return serviceEndpoint;
+	}
+	
+	/* TODO:  I don't think we need the setters, let's leave the commented for now...
 	public void setServiceName(QName serviceName){
+		if (serviceName == null)
+			throw new RuntimeException("serviceName cannot be null");
 		this.serviceName = serviceName;
 	}
 	
 	public void setPortName(QName portName){
+		if (portName == null)
+			throw new RuntimeException("portName cannot be null");
 		this.portName = portName;
 	}
 	
 	public void setBindingID(String bindingId){
+		if (bindingId == null)
+			throw new RuntimeException("bindingId cannot be null");
 		this.bindingId = bindingId;
 	}
 	
 	public void setEndPointAddress(String serviceEndpoint){
+		if (serviceEndpoint == null)
+			throw new RuntimeException("serviceEndpoint cannot be null");
 		this.serviceEndpoint = serviceEndpoint;
 	}
+	*/
 	
-	public String getEndpointAddress(){
-		return serviceEndpoint;
+
+	/*
+	 * PortInfo may be used as a key in a HandlerResolver Map cache, so
+	 * let's override Object.equals and Object.hashcode
+	 */
+	public boolean equals(Object obj) {
+		if (obj instanceof PortData) {
+			PortData info = (PortData) obj;
+			if (bindingId.equals(info.getBindingID())
+					&& portName.equals(info.getPortName())
+					&& serviceName.equals(info.getServiceName())
+					&& serviceEndpoint.equals(info.getEndpointAddress())) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/*
+	 * PortInfo is used as a key in the HandlerResolver cache object, so
+	 * we must override Object.equals and Object.hashcode (just use someone
+	 * else's hashcode that we know works).
+	 */
+	public int hashCode() {
+		return bindingId.hashCode();
 	}
 }
-

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/ProtectedMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/ProtectedMessageContext.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/ProtectedMessageContext.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/ProtectedMessageContext.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.handler;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+
+/**
+ * The <tt>ProtectedMessageContext</tt> is the version of the MessageContext
+ * that will be given to application handlers as the handler list 
+ * is traversed.  Access to internal properties is limited by the protections
+ * built into this context.
+ * 
+ */
+public class ProtectedMessageContext implements javax.xml.ws.handler.MessageContext {
+    
+    private MessageContext msgContext;
+
+    public ProtectedMessageContext() {
+        //do nothing
+    }
+    
+    public ProtectedMessageContext(MessageContext mc) {
+        msgContext = mc;
+    }
+    
+    public Scope getScope(String s) {
+        return null;
+    }
+
+    public void setScope(String s, Scope scope) {
+        
+    }
+    
+    //--------------------------------------------------
+    // java.util.Map methods
+    //--------------------------------------------------
+    
+    public void clear() {
+        msgContext.getProperties().clear();
+    }
+
+    public boolean containsKey(Object key) {
+        return msgContext.getProperties().containsKey(key);
+    }
+
+    public boolean containsValue(Object value) {
+        return msgContext.getProperties().containsValue(value);
+    }
+
+    public Set entrySet() {
+        return msgContext.getProperties().entrySet();
+    }
+
+    public Object get(Object key) {
+        return msgContext.getProperties().get(key);
+    }
+
+    public boolean isEmpty() {
+        return msgContext.getProperties().isEmpty();
+    }
+
+    public Set keySet() {
+        return msgContext.getProperties().keySet();
+    }
+
+    public Object put(String key, Object value) {
+        return msgContext.getProperties().put(key, value);
+    }
+
+    public void putAll(Map t) {
+        msgContext.getProperties().putAll(t);        
+    }
+
+    public Object remove(Object key) {
+        return msgContext.getProperties().remove(key);
+    }
+
+    public int size() {
+        return msgContext.getProperties().size();
+    }
+
+    public Collection values() {
+        return msgContext.getProperties().values();
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.handler;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+
+/**
+ * The SOAPMessageContext is the context handed to SOAP-based application
+ * handlers.  It provides access to the SOAP message that represents the
+ * request or response via SAAJ.  It also allows access to any properties
+ * that have been registered and set on the MessageContext.
+ */
+public class SoapMessageContext extends ProtectedMessageContext 
+    implements javax.xml.ws.handler.soap.SOAPMessageContext {
+
+	
+    public SoapMessageContext() {
+		super();
+	}
+
+	public SoapMessageContext(MessageContext mc) {
+		super(mc);
+	}
+
+	public Object[] getHeaders(QName qname, JAXBContext jaxbcontext, boolean flag) {
+        return null;
+    }
+
+    public SOAPMessage getMessage() {
+        return null;
+    }
+
+    public Set<URI> getRoles() {
+        return null;
+    }
+
+    public void setMessage(SOAPMessage soapmessage) {
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/README.txt?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/README.txt (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/README.txt Tue Jul 11 12:33:12 2006
@@ -0,0 +1,6 @@
+This package will contain functionality to validate, process, and merge information provided 
+by annotation metadata and wsdl. The idea will be that the MDQ works off of collections of 
+WSMService objects as defined by the WSM project. Users will need to supply their own
+functionality that converts varying data into WSMService objects. For instance, users may 
+need a WSDL to WSMSerivce converter. Ideally, the MDQ will have knowledge of a single data 
+structure which will be a WSMService.
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/annotations/collector/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/annotations/collector/README.txt?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/annotations/collector/README.txt (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/annotations/collector/README.txt Tue Jul 11 12:33:12 2006
@@ -0,0 +1,4 @@
+This package will allow for independence of annotation collection techniques. There will be an 
+interface, AnnotationCollector, that defines a method which will return an array of WSMService 
+objects. These objects will be created by the collector after it has located all of the 
+annotations in the relevant class files.
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/input/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/input/README.txt?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/input/README.txt (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/input/README.txt Tue Jul 11 12:33:12 2006
@@ -0,0 +1,4 @@
+This package will represent the wrapper around a collection of WSMService objects. The wrapper 
+class will possibly contain some type of information that signifies how the WSMService objects 
+were created. This will allow the user to determine if the data was created from wsdl or class 
+file annotations.
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/output/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/output/README.txt?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/output/README.txt (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/mdq/output/README.txt Tue Jul 11 12:33:12 2006
@@ -0,0 +1,5 @@
+This package will be used to represent the data that is output as a result of MetaDataQuery 
+functionality. The output should be similar to the input, a collection of WSMService objects. 
+The WSMService objects will represent the merged data from both wsdl and annotations, if both 
+were present. The user will then write generators, similar to the WSM convention, that make use 
+of the data in the appropriate fashion.
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Attachment.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Attachment.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Attachment.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Attachment.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.message;
+
+/**
+ * Attachment
+ * non-xml portions of the message
+ */
+public interface Attachment {
+ // PlaceHolder
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.message;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.jaxws.message.factory.BlockFactory;
+
+/**
+ * Block
+ * A Block represents an xml element and associated sub-tree. 
+ * The name of the element must be defined by a root element in a schema.
+ * All prefixes within the subtree must correspond to namespace declarations defined
+ * within the tree.
+ * Many specifications refer to this as a "embedded document" or "xml block".  I chose
+ * the term, block, for simplicity.
+ *
+ * The block can be exposed as:
+ * 	* BusinessObject
+ * 	* StAX object
+ * 
+ * In addition, each of the accessors has a consume parameter.  If
+ * consume is true, the Block is no longer valid after the message is called.
+ * (i.e. the implementation does not need to cache the information)
+ *
+ */
+public interface Block {
+
+	/**
+	 * Get a reference to the Business Object represented by this Block
+	 * @param consume true if this is the last request on the block.
+	 * @return Object (JAXB, String etc.)
+	 * @throws XMLStreamException
+	 * @throws MessageException
+	 */
+	public Object getBusinessObject(boolean consume) throws XMLStreamException, MessageException;
+	
+	/**
+	 * GetBusinesContext
+	 * Some business objects have an associated context object (i.e. JAXBContext)
+	 * @return Context Object or null
+	 */
+	public Object getBusinessContext();
+	
+	/**
+	 * Get the XMLStreamReader represented by this Block
+	 * @param consume true if this is the last request on the block.
+	 * @return XMLStreamReader
+	 * @throws XMLStreamException
+	 */
+	public XMLStreamReader getXMLStreamReader(boolean consume) throws XMLStreamException, MessageException;
+	
+	/**
+	 * Get the OMElement represented by this Block.
+	 * This call always consumes the block because you are taking control of the underlying OM
+	 * @return
+	 * @throws XMLStreamException
+	 * @throws MessageException
+	 */
+	public OMElement getOMElement() throws XMLStreamException, MessageException;
+	
+    /**
+     * Write out the Block
+     * @param writer XMLStreamWriter
+     * @param consume true if this is the last request on the block.
+     * @throws XMLStreamException
+     * @trhows MessageException
+     */
+    public void outputTo(XMLStreamWriter writer, boolean consume) throws XMLStreamException, MessageException;	
+        
+    /**
+     * isConsumed
+     * Return true if the block is consumed.  Once consumed, the information in the 
+     * block is no longer available.
+     * @return true if the block is consumed (a method was called with consume=true)
+     */
+    public boolean isConsumed();
+    
+    /**
+     * Get a traceString...the trace string dumps the contents of the Block without forcing an underlying
+     * ill-performant transformation of the message.
+     * @boolean indent String containing indent characters
+     * @return String containing trace information
+     */
+    public String traceString(String indent);
+    
+    /**
+	 * @return If QName is available without doing an expensive parse of the business object, then return true
+	 * Otherwise return false
+	 * Note: This method should be used in situations where it would be nice to know the qname (like logging or a special check)
+	 * but we don't want to cause an ill-performant parse.
+	 */
+	public boolean isQNameAvailable();
+	
+    /**
+	 * Get the QName (namespace, localpart) of the Block.  Do not depend on prefix being set correctly.
+	 * Asking for the QName can cause a performant hit.
+	 * @see isQNameAvailable
+	 * @return QName of the block
+	 * @throw MessageException
+	 */
+	public QName getQName() throws MessageException;
+    
+	/**
+	 * Get BlockFactory 
+	 * @return BlockFactory that created the Block
+	 */
+	public BlockFactory getBlockFactory();
+	
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.message;
+
+import java.util.List;
+
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * Message
+ * 
+ * A Message represents the XML + Attachments
+ * 
+ * Most of the methods available on a message are only applicable to 
+ * the XML part of the Message.  See the XMLPart interface for an explantation of these methods.
+ * 
+ * @see org.apache.axis2.jaxws.message.XMLPart
+ * @see org.apache.axis2.jaxws.message.Attachment
+ * 
+ */
+public interface Message extends XMLPart {
+	
+	/**
+	 * Get the protocol for this Message (soap11, soap12, etc.)
+	 * @return Protocl
+	 */
+	public Protocol getProtocol();
+	
+	/**
+	 * getAsSOAPMessage
+	 * Get the xml part as a read/write SOAPEnvelope
+	 * @return SOAPEnvelope
+	 */
+	public SOAPMessage getAsSOAPMessage() throws MessageException;
+	
+	/**
+	 * Get the list of attachments for the message
+	 * @return List<Attachments>
+	 */
+	public List<Attachment> getAttachments();
+	
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageException.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageException.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.message;
+
+/**
+ * MessageException
+ * The apis defined in the JAX-WS Message sub-component will 
+ * throw this checked Exception when assertions fail or other probable
+ * failures occur.  Consumers of the Message sub-component should
+ * provide sufficient try/catch logic to handle these situtations.
+ * (@see org.apache.axis2.jaxws.message.MessageInternalException)
+ */
+public class MessageException extends Exception {
+
+	/**
+	 * @param message
+	 */
+	public MessageException(String message) {
+		super(message);
+	}
+
+	/**
+	 * @param message
+	 * @param cause
+	 */
+	public MessageException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * @param cause
+	 */
+	public MessageException(Throwable cause) {
+		super(cause);
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageInternalException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageInternalException.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageInternalException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/MessageInternalException.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.message;
+
+/**
+ * MessageInternalException
+ * The apis defined in the JAX-WS Message sub-component may 
+ * throw this unchecked Exception.  This exception is only thrown
+ * in situations that should never occur. 
+ * Consumers of the Message sub-component should
+ * provide sufficient try/catch logic to handle these situtations
+ * as they would other unchecked exceptions.
+ * (@see org.apache.axis2.jaxws.message.MessageException)
+ */
+public class MessageInternalException extends RuntimeException {
+
+	/**
+	 * @param message
+	 */
+	public MessageInternalException(String message) {
+		super(message);
+	}
+
+	/**
+	 * @param message
+	 * @param cause
+	 */
+	public MessageInternalException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * @param cause
+	 */
+	public MessageInternalException(Throwable cause) {
+		super(cause);
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java?rev=420955&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java Tue Jul 11 12:33:12 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.jaxws.message;
+
+/**
+ * Protocol
+ * Each message has a protocol (soap11, soap12, rest)
+ * This enum represents the protocol within the Message sub-component
+ */
+public enum Protocol {
+	soap11, soap12, rest, unknown
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org