axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject svn commit: r612147 [8/17] - in /webservices/axis2/branches/java/jaxws21: ./ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/schema...
Date Tue, 15 Jan 2008 16:22:27 GMT
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java Tue Jan 15 08:21:22 2008
@@ -18,33 +18,26 @@
  */
 package org.apache.axis2.jaxws.message.databinding.impl;
 
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMDataSourceExt;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.datasource.XMLStringDataSource;
+import org.apache.axis2.datasource.jaxb.JAXBDSContext;
+import org.apache.axis2.datasource.jaxb.JAXBDataSource;
 import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.message.attachments.JAXBAttachmentMarshaller;
-import org.apache.axis2.jaxws.message.attachments.JAXBAttachmentUnmarshaller;
 import org.apache.axis2.jaxws.message.databinding.JAXBBlock;
 import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
-import org.apache.axis2.jaxws.message.databinding.JAXBUtils;
-import org.apache.axis2.jaxws.message.databinding.XSDListUtils;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 import org.apache.axis2.jaxws.message.impl.BlockImpl;
 import org.apache.axis2.jaxws.message.util.XMLStreamWriterWithOS;
-import org.apache.axis2.jaxws.spi.Constants;
-import org.apache.axis2.jaxws.utility.XMLRootElementUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
-import javax.xml.bind.JAXBIntrospector;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -54,12 +47,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-import java.text.ParseException;
 
 /**
  * JAXBBlockImpl <p/> A Block containing a JAXB business object (either a JAXBElement or an object
@@ -99,63 +87,46 @@
         super(omElement, busContext, qName, factory);
     }
 
-    @Override
     protected Object _getBOFromReader(XMLStreamReader reader, Object busContext)
         throws XMLStreamException, WebServiceException {
         // Get the JAXBBlockContext. All of the necessry information is recorded on it
         JAXBBlockContext ctx = (JAXBBlockContext) busContext;
         
-        // retrieve the stored classloader if it is present
-        MessageContext msgContext = getParent() != null ? getParent().getMessageContext() : null;
-        ClassLoader cl = null;
-        if(msgContext != null) {
-            cl = (ClassLoader) msgContext.getProperty(Constants.CACHE_CLASSLOADER);
-        }
         try {
-            // TODO Re-evaluate Unmarshall construction w/ MTOM
-            
-            Unmarshaller u = JAXBUtils.getJAXBUnmarshaller(ctx.getJAXBContext(cl));
-
-            if (DEBUG_ENABLED) {
-                log.debug("Adding JAXBAttachmentUnmarshaller to Unmarshaller");
-            }
-
-            Message msg = getParent();
-
-            JAXBAttachmentUnmarshaller aum = new JAXBAttachmentUnmarshaller(msg);
-            u.setAttachmentUnmarshaller(aum);
-
-            Object jaxb = null;
-
-            // Unmarshal into the business object.
-            if (ctx.getProcessType() == null) {
-                jaxb = unmarshalByElement(u, reader); // preferred and always used for
-                                                        // style=document
-            } else {
-                jaxb =
-                        unmarshalByType(u,
-                                        reader,
-                                        ctx.getProcessType(),
-                                        ctx.isxmlList(),
-                                        ctx.getConstructionType());
-            }
-
-            // Successfully unmarshalled the object
-            JAXBUtils.releaseJAXBUnmarshaller(ctx.getJAXBContext(cl), u);
-            
-            // Don't close the reader.  The reader is owned by the caller, and it
-            // may contain other xml instance data (other than this JAXB object)
-            // reader.close();
-            return jaxb;
+            busObject = ctx.unmarshal(reader);
         } catch (JAXBException je) {
             if (DEBUG_ENABLED) {
                 try {
-                    log.debug("JAXBContext for unmarshal failure:" + ctx.getJAXBContext(cl));
+                    log.debug("JAXBContext for unmarshal failure:" + 
+                              ctx.getJAXBContext(ctx.getClassLoader()));
                 } catch (Exception e) {
                 }
             }
             throw ExceptionFactory.makeWebServiceException(je);
         }
+        return busObject;
+    }
+    
+    @Override
+    protected Object _getBOFromOM(OMElement omElement, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        
+        // Shortcut to get business object from existing data source
+        if (omElement instanceof OMSourcedElement) {
+            OMDataSource ds = ((OMSourcedElement) omElement).getDataSource();
+            if (ds instanceof JAXBDataSource) {
+                // Update the business context to use the one provided
+                // by the datasource
+                try {
+                    JAXBDSContext dsContext = ((JAXBDataSource) ds).getContext();
+                    busContext = new JAXBBlockContext(dsContext.getJAXBContext());
+                } catch (JAXBException e) {
+                    throw ExceptionFactory.makeWebServiceException(e);
+                }
+                return ((JAXBDataSource) ds).getObject();
+            }
+        }
+        return super._getBOFromOM(omElement, busContext);
     }
 
     /**
@@ -194,47 +165,13 @@
         throws XMLStreamException, WebServiceException {
         JAXBBlockContext ctx = (JAXBBlockContext) busContext;
         
-        // retrieve the stored classloader if it is present
-        MessageContext msgContext = getParent() != null ? getParent().getMessageContext() : null;
-        ClassLoader cl = null;
-        if(msgContext != null) {
-            cl = (ClassLoader) msgContext.getProperty(Constants.CACHE_CLASSLOADER);
-        }
         try {
-            // Very easy, use the Context to get the Marshaller.
-            // Use the marshaller to write the object.
-            Marshaller m = JAXBUtils.getJAXBMarshaller(ctx.getJAXBContext(cl));
-
-
-            if (DEBUG_ENABLED) {
-                log.debug("Adding JAXBAttachmentMarshaller to Marshaller");
-            }
-
-            Message msg = getParent();
-
-            // Pool
-            JAXBAttachmentMarshaller am = new JAXBAttachmentMarshaller(msg, writer);
-            m.setAttachmentMarshaller(am);
-
-
-            // Marshal the object
-            if (ctx.getProcessType() == null) {
-                marshalByElement(busObject, m, writer, !am.isXOPPackage());
-            } else {
-                marshalByType(busObject,
-                              m,
-                              writer,
-                              ctx.getProcessType(),
-                              ctx.isxmlList(),
-                              ctx.getConstructionType());
-            }
-
-            // Successfully marshalled the data
-            JAXBUtils.releaseJAXBMarshaller(ctx.getJAXBContext(cl), m);
+            ctx.marshal(busObject, writer);
         } catch (JAXBException je) {
             if (DEBUG_ENABLED) {
                 try {
-                    log.debug("JAXBContext for marshal failure:" + ctx.getJAXBContext(cl));
+                    log.debug("JAXBContext for marshal failure:" + 
+                              ctx.getJAXBContext(ctx.getClassLoader()));
                 } catch (Exception e) {
                 }
             }
@@ -242,354 +179,6 @@
         }
     }
 
-    /**
-     * Get the QName from the jaxb object
-     * 
-     * @param jaxb
-     * @param jbc
-     * @throws WebServiceException
-     */
-    private static QName getQName(Object jaxb, JAXBBlockContext ctx, Message msg) throws JAXBException {
-        
-        // retrieve the stored classloader if it is present
-        MessageContext msgContext = msg != null ? msg.getMessageContext() : null;
-        ClassLoader cl = null;
-        if(msgContext != null) {
-            cl = (ClassLoader) msgContext.getProperty(Constants.CACHE_CLASSLOADER);
-        }
-        
-        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(ctx.getJAXBContext(cl));
-        QName qName = jbi.getElementName(jaxb);
-        JAXBUtils.releaseJAXBIntrospector(ctx.getJAXBContext(cl), jbi);
-        return qName;
-    }
-
-    /**
-     * Preferred way to marshal objects.
-     * 
-     * @param b Object that can be rendered as an element and the element name is known by the
-     * Marshaller
-     * @param m Marshaller
-     * @param writer XMLStreamWriter
-     */
-    private static void marshalByElement(final Object b, final Marshaller m, 
-                                         final XMLStreamWriter writer,
-                                         final boolean optimize) throws WebServiceException {
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                // Marshalling directly to the output stream is faster than marshalling through the
-                // XMLStreamWriter. 
-                // Take advantage of this optimization if there is an output stream.
-                try {
-                    OutputStream os = (optimize) ? getOutputStream(writer) : null;
-                    if (os != null) {
-                        if (DEBUG_ENABLED) {
-                            log.debug("Invoking marshalByElement.  " +
-                                        "Marshaling to an OutputStream. " +
-                                      "Object is "
-                                      + getDebugName(b));
-                        }
-                        writer.flush();
-                        m.marshal(b, os);
-                    } else {
-                        if (DEBUG_ENABLED) {
-                            log.debug("Invoking marshalByElement.  " +
-                                        "Marshaling to an XMLStreamWriter. " +
-                                      "Object is "
-                                      + getDebugName(b));
-                        }
-                        m.marshal(b, writer);
-                    }
-                } catch (Exception e) {
-                    throw ExceptionFactory.makeWebServiceException(e);
-                }
-                return null;
-            }});
-    }
-
-    /**
-     * Preferred way to unmarshal objects
-     * 
-     * @param u Unmarshaller
-     * @param reader XMLStreamReader
-     * @return Object that represents an element
-     * @throws WebServiceException
-     */
-    private static Object unmarshalByElement(final Unmarshaller u, final XMLStreamReader reader)
-        throws WebServiceException {
-        try {
-            if (DEBUG_ENABLED) {
-                log.debug("Invoking unMarshalByElement");
-            }
-            return AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    try {
-                        return u.unmarshal(reader);
-                    } catch (Exception e) {
-                        throw ExceptionFactory.makeWebServiceException(e);
-                    }
-                }
-            });
-
-        } catch (Exception e) {
-            throw ExceptionFactory.makeWebServiceException(e);
-        }
-    }
-
-    /**
-     * Marshal objects by type
-     * 
-     * @param b Object that can be rendered as an element, but the element name is not known to the
-     * schema (i.e. rpc)
-     * @param m Marshaller
-     * @param writer XMLStreamWriter
-     * @param type
-     */
-    private static void marshalByType(final Object b, final Marshaller m,
-                                      final XMLStreamWriter writer, final Class type,
-                                      final boolean isList, final JAXBUtils.CONSTRUCTION_TYPE ctype)
-        throws WebServiceException {
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                try {
-
-                    // NOTE
-                    // Example:
-                    // <xsd:simpleType name="LongList">
-                    // <xsd:list>
-                    // <xsd:simpleType>
-                    // <xsd:restriction base="xsd:unsignedInt"/>
-                    // </xsd:simpleType>
-                    // </xsd:list>
-                    // </xsd:simpleType>
-                    // <element name="myLong" nillable="true" type="impl:LongList"/>
-                    //
-                    // LongList will be represented as an int[]
-                    // On the wire myLong will be represented as a list of integers
-                    // with intervening whitespace
-                    // <myLong>1 2 3</myLong>
-                    //
-                    // Unfortunately, we are trying to marshal by type. Therefore
-                    // we want to marshal an element (foo) that is unknown to schema.
-                    // If we use the normal marshal code, the wire will look like
-                    // this (which is incorrect):
-                    // <foo><item>1</item><item>2</item><item>3</item></foo>
-                    //
-                    // The solution is to detect this situation and marshal the
-                    // String instead. Then we get the correct wire format:
-                    // <foo>1 2 3</foo>
-                    Object jbo = b;
-
-                    if (isList || (type != null && type.isArray())) {
-                        if (DEBUG_ENABLED) {
-                            log.debug("marshalling type which is a List or Array");
-                        }
-                        // We conver to xsdListString only if the type is not known
-                        // to the context. In case a jaxbcontext is created from package
-                        // the array types or list are not know to the context.
-                        if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH) {
-                            QName qName = XMLRootElementUtil.getXmlRootElementQNameFromObject(b);
-                            String text = XSDListUtils.toXSDListString(getTypeEnabledObject(b));
-                            jbo = new JAXBElement(qName, String.class, text);
-                        } else if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY) {
-                            // do nothing common array types should be know to the jaxbcontext.
-                            // so do not use xsdListString conversion.
-                        }
-                    }
-
-                    // When JAXBContext is created using a context path, it will not include Enum
-                    // classes.
-                    // These classes have @XmlEnum annotation but not @XmlType/@XmlElement, so the
-                    // user will see MarshallingEx, class not known to ctxt.
-                    // 
-                    // This is a jax-b defect, for now this fix is in place to pass CTS. This only
-                    // fixes the
-                    // situation where the enum is the top-level object (e.g., message-part in
-                    // rpc-lit scenario)
-                    //
-                    // Sample of what enum looks like:
-                    // @XmlEnum public enum EnumString {
-                    // @XmlEnumValue("String1") STRING_1("String1"),
-                    // @XmlEnumValue("String2") STRING_2("String2");
-                    // ... }
-                    if (type.isEnum()) {
-                        if (b != null) {
-                            if (DEBUG_ENABLED) {
-                                log.debug("marshalByType. Marshaling " + type.getName()
-                                        + " as Enum");
-                            }
-                            JAXBElement jbe = (JAXBElement) b;
-                            String value = XMLRootElementUtil.getEnumValue((Enum) jbe.getValue());
-
-                            jbo = new JAXBElement(jbe.getName(), String.class, value);
-                        }
-                    }
-
-                    if (DEBUG_ENABLED) {
-                        log.debug("Invoking marshalByType.  " +
-                                        "Marshaling to an XMLStreamWriter. Object is "
-                                + getDebugName(b));
-                    }
-                    m.marshal(jbo, writer);
-
-                } catch (Exception e) {
-                    throw ExceptionFactory.makeWebServiceException(e);
-                }
-                return null;
-            }
-        });
-    }
-
-    /**
-     * The root element being read is defined by schema/JAXB; however its contents are known by
-     * schema/JAXB. Therefore we use unmarshal by the declared type (This method is used to
-     * unmarshal rpc elements)
-     * 
-     * @param u Unmarshaller
-     * @param reader XMLStreamReader
-     * @param type Class
-     * @return Object
-     * @throws WebServiceException
-     */
-    private static Object unmarshalByType(final Unmarshaller u, final XMLStreamReader reader,
-                                          final Class type, final boolean isList,
-                                          final JAXBUtils.CONSTRUCTION_TYPE ctype)
-        throws WebServiceException {
-
-        if (DEBUG_ENABLED) {
-            log.debug("Invoking unmarshalByType.");
-        }
-
-        return AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                try {
-                    // Unfortunately RPC is type based. Thus a
-                    // declared type must be used to unmarshal the xml.
-                    Object jaxb;
-
-                    if (!isList) {
-                        // case: We are not unmarshalling an xsd:list but an Array.
-
-                        if (type.isArray()) {
-                            // If the context is created using package
-                            // we will not have common arrays or type array in the context
-                            // so let use a differet way to unmarshal this type
-                            if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH) {
-                                jaxb = unmarshalAsListOrArray(reader, u, type);
-                            }
-                            // list on client array on server, Can happen only in start from java
-                            // case.
-                            else if ((ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY)) {
-                                // The type could be any Object or primitive
-                                // I will first unmarshall the xmldata to a String[]
-                                // Then use the unmarshalled jaxbElement to create
-                                // proper type Object Array.
-                                jaxb = u.unmarshal(reader, String[].class);
-                                Object typeObj = getTypeEnabledObject(jaxb);
-                                // Now convert String Array in to the required Type Array.
-                                if (getTypeEnabledObject(typeObj) instanceof String[]) {
-                                    String[] strArray = (String[]) typeObj;
-                                    String strTokens = new String();
-                                    for (String str : strArray) {
-                                        strTokens = strTokens + " " + str;
-                                    }
-                                    QName qName =
-                                            XMLRootElementUtil.
-                                            getXmlRootElementQNameFromObject(jaxb);
-                                    Object obj = XSDListUtils.fromXSDListString(strTokens, type);
-                                    jaxb = new JAXBElement(qName, type, obj);
-                                }
-                            } else {
-                                jaxb = u.unmarshal(reader, type);
-                            }
-
-                        } else if (type.isEnum()) {
-                            // When JAXBContext is created using a context path, it will not 
-                            // include Enum classes.
-                            // These classes have @XmlEnum annotation but not @XmlType/@XmlElement,
-                            // so the user will see MarshallingEx, class not known to ctxt.
-                            // 
-                            // This is a jax-b defect, for now this fix is in place to pass CTS.
-                            // This only fixes the
-                            // situation where the enum is the top-level object (e.g., message-part
-                            // in rpc-lit scenario)
-                            //
-                            // Sample of what enum looks like:
-                            // @XmlEnum public enum EnumString {
-                            // @XmlEnumValue("String1") STRING_1("String1"),
-                            // @XmlEnumValue("String2") STRING_2("String2");
-                            //
-                            // public static getValue(String){} <-- resolves a "value" to an emum
-                            // object
-                            // ... }
-                            if (DEBUG_ENABLED) {
-                                log.debug("unmarshalByType. Unmarshalling " + type.getName()
-                                        + " as Enum");
-                            }
-
-                            JAXBElement<String> enumValue = u.unmarshal(reader, String.class);
-
-                            if (enumValue != null) {
-                                Method m =
-                                        type.getMethod("fromValue", new Class[] { String.class });
-                                jaxb = m.invoke(null, new Object[] { enumValue.getValue() });
-                            } else {
-                                jaxb = null;
-                            }
-                        }
-                        //Normal case: We are not unmarshalling a xsd:list or Array
-                        else {
-                            jaxb = u.unmarshal(reader, type);
-                        }
-
-                    } else {
-                        // If this is an xsd:list, we need to return the appropriate
-                        // list or array (see NOTE above)
-                        // First unmarshal as a String
-                        //Second convert the String into a list or array
-                        jaxb = unmarshalAsListOrArray(reader, u, type);
-                    }
-                    return jaxb;
-                } catch (Exception e) {
-                    throw ExceptionFactory.makeWebServiceException(e);
-                }
-            }
-        });
-    }
-
-    /**
-     * convert the String into a list or array
-     * @param <T>
-     * @param jaxb
-     * @param type
-     * @return
-     * @throws IllegalAccessException
-     * @throws ParseException
-     * @throws NoSuchMethodException
-     * @throws InstantiationException
-     * @throws DatatypeConfigurationException
-     * @throws InvocationTargetException
-     */
-    private static Object unmarshalAsListOrArray(XMLStreamReader reader, Unmarshaller u, 
-                                                 Class type)
-        throws IllegalAccessException, ParseException,NoSuchMethodException,InstantiationException,
-        DatatypeConfigurationException,InvocationTargetException,JAXBException {
-        //If this is an xsd:list, we need to return the appropriate
-        // list or array (see NOTE above)
-        // First unmarshal as a String
-        Object jaxb = u.unmarshal(reader, String.class);
-        //Second convert the String into a list or array
-        if (getTypeEnabledObject(jaxb) instanceof String) {
-            QName qName = XMLRootElementUtil.getXmlRootElementQNameFromObject(jaxb);
-            Object obj = XSDListUtils.fromXSDListString((String) getTypeEnabledObject(jaxb), type);
-            return new JAXBElement(qName, type, obj);
-        } else {
-            return jaxb;
-        }
-
-    }
-
-
     public boolean isElementData() {
         return true;
     }
@@ -625,6 +214,15 @@
     public boolean isDestructiveWrite() {
         return false;
     }
+    
+    public OMDataSourceExt copy() throws OMException {
+        
+        if (DEBUG_ENABLED) {
+            log.debug("Making a copy of the JAXB object");
+        }
+        return new JAXBDataSource(this.getObject(), 
+                                  (JAXBDSContext) this.getBusinessContext());
+    }
 
     public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
         try {
@@ -636,38 +234,13 @@
         }
     }
 
-    /**
-     * Return type enabled object
-     *
-     * @param obj type or element enabled object
-     * @return type enabled object
-     */
-    static Object getTypeEnabledObject(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        if (obj instanceof JAXBElement) {
-            return ((JAXBElement) obj).getValue();
+    public void setParent(Message message) {
+        if (busContext != null) {
+            ((JAXBBlockContext) busContext).setMessage(message);
         }
-        return obj;
+        super.setParent(message);
     }
 
-    private static String getDebugName(Object o) {
-        return (o == null) ? "null" : o.getClass().getCanonicalName();
-    }
+    
 
-    /**
-     * If the writer is backed by an OutputStream, then return the OutputStream
-     * @param writer
-     * @return OutputStream or null
-     */
-    private static OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException {
-        if (writer.getClass() == MTOMXMLStreamWriter.class) {
-            return ((MTOMXMLStreamWriter) writer).getOutputStream();
-        }
-        if (writer.getClass() == XMLStreamWriterWithOS.class) {
-            return ((XMLStreamWriterWithOS) writer).getOutputStream();
-        }
-        return null;
-    }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java Tue Jan 15 08:21:22 2008
@@ -66,6 +66,18 @@
         OMElement om = (OMElement)busObj;
         return om.getXMLStreamReader();
     }
+    
+    @Override
+    protected Object _getBOFromOM(OMElement om, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        return om;
+    }
+    
+    @Override
+    protected OMElement _getOMFromBO(Object busObject, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        return (OMElement) busObject;
+    }
 
     @Override
     protected void _outputFromBO(Object busObject, Object busContext, XMLStreamWriter writer)

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java Tue Jan 15 08:21:22 2008
@@ -18,9 +18,12 @@
  */
 package org.apache.axis2.jaxws.message.databinding.impl;
 
+import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axis2.datasource.SourceDataSource;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.i18n.Messages;
@@ -157,6 +160,41 @@
         return new StreamSource(sr);
 
     }
+    
+    @Override
+    protected Object _getBOFromOM(OMElement omElement, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        Object busObject;
+        
+        // Shortcut to get business object from existing data source
+        if (omElement instanceof OMSourcedElement) {
+            OMDataSource ds = ((OMSourcedElement) omElement).getDataSource();
+            if (ds instanceof SourceDataSource) {
+                return ((SourceDataSource) ds).getObject();
+            }
+        }
+        
+        // If the message is a fault, there are some special gymnastics that we have to do
+        // to get this working for all of the handler scenarios.  
+        boolean hasFault = false;
+        if ((parent != null && parent.isFault()) || 
+            omElement.getQName().getLocalPart().equals(SOAP11Constants.SOAPFAULT_LOCAL_NAME)) {
+            hasFault = true;
+        }
+        
+        // Transform reader into business object
+        if (!hasFault) {
+            busObject = super._getBOFromOM(omElement, busContext);
+        }
+        else {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            omElement.serialize(baos);
+            
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            busObject = new StreamSource(bais);
+        }
+        return busObject;
+    }
 
     @Override
     protected XMLStreamReader _getReaderFromBO(Object busObj, Object busContext)
@@ -286,56 +324,6 @@
         return cl;
     }
     
-    
-    /* (non-Javadoc)
-     * @see org.apache.axis2.jaxws.message.Block#getBusinessObject(boolean)
-     */
-    public Object getBusinessObject(boolean consume) throws XMLStreamException,
-                                                    WebServiceException {
-        if (consumed) {
-            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("BlockImplErr1",
-                                                                               this.getClass()
-                                                                                   .getName()));
-        }
-        
-        if (busObject != null) {
-            busObject = _getBOFromBO(busObject, busContext, consume);
-        } else {
-            // If the message is a fault, there are some special gymnastics that we have to do
-            // to get this working for all of the handler scenarios.  
-            boolean hasFault = false;
-            if ((parent != null && parent.isFault()) || 
-                omElement.getQName().getLocalPart().equals(SOAP11Constants.SOAPFAULT_LOCAL_NAME)) {
-                hasFault = true;
-            }
-            
-            // Transform reader into business object
-            if (!hasFault) {
-                XMLStreamReader reader;
-                if (omElement.getBuilder() != null && !omElement.getBuilder().isCompleted()) {
-                    reader = omElement.getXMLStreamReaderWithoutCaching();
-                } else {
-                    reader = omElement.getXMLStreamReader();
-                }
-                busObject = _getBOFromReader(reader, busContext);    
-            }
-            else {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                omElement.serialize(baos);
-                
-                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-                busObject = new StreamSource(bais);
-            }
-            
-            omElement = null;
-        }
-
-        // Save the businessObject in a local variable
-        // so that we can reset the Block if consume was indicated
-        Object newBusObject = busObject;
-        setConsumed(consume);
-        return newBusObject;
-    }
     
     public void close() {
         return; // Nothing to close

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java Tue Jan 15 08:21:22 2008
@@ -18,8 +18,13 @@
  */
 package org.apache.axis2.jaxws.message.databinding.impl;
 
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMDataSourceExt;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.datasource.XMLStringDataSource;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.message.databinding.XMLStringBlock;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
@@ -30,6 +35,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.ws.WebServiceException;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -66,15 +72,27 @@
         super(omElement, null, qName, factory);
     }
 
-    @Override
     protected Object _getBOFromReader(XMLStreamReader reader, Object busContext)
             throws XMLStreamException {
         // Create a Reader2Writer converter and get the output as a String
         Reader2Writer r2w = new Reader2Writer(reader);
         return r2w.getAsString();
     }
-
+    
     @Override
+    protected Object _getBOFromOM(OMElement omElement, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        
+        // Shortcut to get business object from existing data source
+        if (omElement instanceof OMSourcedElement) {
+            OMDataSource ds = ((OMSourcedElement) omElement).getDataSource();
+            if (ds instanceof XMLStringDataSource) {
+                return ((XMLStringDataSource) ds).getObject();
+            }
+        }
+        return super._getBOFromOM(omElement, busContext);
+    }
+
     protected XMLStreamReader _getReaderFromBO(Object busObj, Object busContext)
             throws XMLStreamException {
         // Create an XMLStreamReader from the inputFactory using the String as the sources
@@ -83,7 +101,6 @@
         return StAXUtils.createXMLStreamReader(sr);
     }
 
-    @Override
     protected void _outputFromBO(Object busObject, Object busContext, XMLStreamWriter writer)
             throws XMLStreamException {
         // There is no fast way to output the String to a writer, so get the reader
@@ -124,6 +141,10 @@
 
     public boolean isDestructiveWrite() {
         return false;
+    }
+    
+    public OMDataSourceExt copy() throws OMException {
+        return new XMLStringDataSource((String) getObject());
     }
 
 

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java Tue Jan 15 08:21:22 2008
@@ -142,13 +142,7 @@
             busObject = _getBOFromBO(busObject, busContext, consume);
         } else {
             // Transform reader into business object
-            XMLStreamReader reader;
-            if (omElement.getBuilder() != null && !omElement.getBuilder().isCompleted()) {
-                reader = omElement.getXMLStreamReaderWithoutCaching();
-            } else {
-                reader = omElement.getXMLStreamReader();
-            }
-            busObject = _getBOFromReader(reader, busContext);
+            busObject = _getBOFromOM(omElement, busContext);
             omElement = null;
         }
 
@@ -158,6 +152,7 @@
         setConsumed(consume);
         return newBusObject;
     }
+    
 
     /* (non-Javadoc)
       * @see org.apache.axis2.jaxws.message.Block#getQName()
@@ -282,13 +277,12 @@
         } else if (busObject != null) {
             // Getting the reader does not destroy the BusinessObject
             busObject = _getBOFromBO(busObject, busContext, consume);
-            XMLStreamReader newReader = _getReaderFromBO(busObject, busContext);
-            StAXOMBuilder builder = new StAXOMBuilder(newReader);
-            newOMElement = builder.getDocumentElement();
+            newOMElement = _getOMFromBO(busObject, busContext);
         }
         setConsumed(consume);
         return newOMElement;
     }
+    
 
     /* (non-Javadoc)
       * @see org.apache.axis2.jaxws.message.Block#isConsumed()
@@ -338,17 +332,7 @@
                     Messages.getMessage("BlockImplErr1", this.getClass().getName()));
         }
         if (omElement != null) {
-            if (consume) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Write using OMElement.serializeAndConsume");
-                }
-                omElement.serializeAndConsume(writer);
-            } else {
-                if (log.isDebugEnabled()) {
-                    log.debug("Write Using OMElement.serialize");
-                }
-                omElement.serialize(writer);
-            }
+            _outputFromOM(omElement, writer, consume);
         } else if (busObject != null) {
             if (log.isDebugEnabled()) {
                 log.debug("Write business object");
@@ -444,6 +428,24 @@
     protected abstract Object _getBOFromReader(XMLStreamReader reader, Object busContext)
             throws XMLStreamException, WebServiceException;
 
+    
+    /**
+     * Default method for getting business object from OM.
+     * Derived classes may override this method to get the business object from a
+     * data source.
+     * 
+     * @param om
+     * @param busContext
+     * @return Business Object
+     * @throws XMLStreamException
+     * @throws WebServiceException
+     */
+    protected Object _getBOFromOM(OMElement omElement, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        XMLStreamReader reader = _getReaderFromOM(omElement);
+        return _getBOFromReader(reader, busContext);
+    }
+    
     /**
      * Get an XMLStreamReader for the BusinessObject The derived Block must implement this method
      *
@@ -453,6 +455,35 @@
      */
     protected abstract XMLStreamReader _getReaderFromBO(Object busObj, Object busContext)
             throws XMLStreamException, WebServiceException;
+    
+    /**
+     * @param omElement
+     * @return XMLStreamReader
+     */
+    protected XMLStreamReader _getReaderFromOM(OMElement omElement) {
+        XMLStreamReader reader;
+        if (omElement.getBuilder() != null && !omElement.getBuilder().isCompleted()) {
+            reader = omElement.getXMLStreamReaderWithoutCaching();
+        } else {
+            reader = omElement.getXMLStreamReader();
+        }
+        return reader;
+    }
+    
+    /**
+     * @param busObject
+     * @param busContext
+     * @return OMElement
+     * @throws XMLStreamException
+     * @throws WebServiceException
+     */
+    protected OMElement _getOMFromBO(Object busObject, Object busContext)
+        throws XMLStreamException, WebServiceException {
+        // Getting the reader does not destroy the BusinessObject
+        XMLStreamReader newReader = _getReaderFromBO(busObject, busContext);
+        StAXOMBuilder builder = new StAXOMBuilder(newReader);
+        return builder.getDocumentElement();
+    }
 
     /**
      * Output Reader contents to a Writer. The default implementation is probably sufficient for most
@@ -466,6 +497,29 @@
             throws XMLStreamException {
         Reader2Writer r2w = new Reader2Writer(reader);
         r2w.outputTo(writer);
+    }
+    
+    /**
+     * Output OMElement contents to a Writer. The default implementation is probably sufficient for most
+     * derived classes.
+     *
+     * @param om
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void _outputFromOM(OMElement omElement, XMLStreamWriter writer, boolean consume)
+            throws XMLStreamException {
+        if (consume) {
+            if (log.isDebugEnabled()) {
+                log.debug("Write using OMElement.serializeAndConsume");
+            }
+            omElement.serializeAndConsume(writer);
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("Write Using OMElement.serialize");
+            }
+            omElement.serialize(writer);
+        }
     }
     
     /* (non-Javadoc)

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java Tue Jan 15 08:21:22 2008
@@ -152,8 +152,9 @@
                 // Okay
             } else
             if (qName.getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                throw ExceptionFactory.
-                    makeWebServiceException(Messages.getMessage("restWithSOAPErr"));
+                // throw ExceptionFactory.
+                //    makeWebServiceException(Messages.getMessage("restWithSOAPErr"));
+                // Okey
             } else {
                 content = _createSpine(Protocol.rest, Style.DOCUMENT, 0, root);
                 contentType = SPINE;

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java Tue Jan 15 08:21:22 2008
@@ -45,20 +45,45 @@
 import org.apache.axis2.jaxws.server.ServiceInstanceFactoryImpl;
 import org.apache.axis2.jaxws.server.dispatcher.factory.EndpointDispatcherFactory;
 import org.apache.axis2.jaxws.server.dispatcher.factory.EndpointDispatcherFactoryImpl;
+import org.apache.axis2.jaxws.server.endpoint.injection.WebServiceContextInjector;
+import org.apache.axis2.jaxws.server.endpoint.injection.impl.WebServiceContextInjectorImpl;
 import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.impl.EndpointLifecycleManagerFactoryImpl;
 import org.apache.axis2.jaxws.utility.ExecutorFactory;
 import org.apache.axis2.jaxws.utility.JAXWSExecutorFactory;
 
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.util.Map;
 
-/** FactoryRegistry Registry containing Factories related to the JAX-WS Implementation */
-public class FactoryRegistry {
+import javax.xml.ws.WebServiceContext;
 
-    private final static Map<Class, Object> table;
+/** 
+ * FactoryRegistry Registry containing Factories related to the JAX-WS Implementation.
+ * The expected scenario is:
+ *   1) Most or all of the factories are registered during startup.
+ *   2) There are a large number of getFactory calls
+ *   3) There may be an infrequent call to setFactory.
+ *   
+ * Thus a "copy on put" approach is used.  This ensures that the "gets" are 
+ * fast (because they are unsynchronized).  The "puts" are slower because they
+ * create a new copy of the HashMap.
+ * See http://www.ibm.com/developerworks/java/library/j-hashmap.html
+ **/
+public class FactoryRegistry {
 
+    private static volatile Map<Class, Object> table;
+    private static Object lockbox = new Object();
+    
     static {
-        table = new Hashtable<Class, Object>();
+        init();
+    }
+    
+    private static final void init() {
+        
+        // An unsynchronized Map is used to ensure that gets are fast.
+        table = new HashMap<Class, Object>();
+        
+        // Load Factories
         table.put(XMLStringBlockFactory.class, new XMLStringBlockFactoryImpl());
         table.put(EndpointDispatcherFactory.class, new EndpointDispatcherFactoryImpl());
         table.put(JAXBBlockFactory.class, new JAXBBlockFactoryImpl());
@@ -68,13 +93,22 @@
         table.put(MessageFactory.class, new MessageFactoryImpl());
         table.put(XMLPartFactory.class, new XMLPartFactoryImpl());
         table.put(SAAJConverterFactory.class, new SAAJConverterFactoryImpl());
-        table.put(EndpointLifecycleManagerFactory.class, new EndpointLifecycleManagerFactory());
+        table.put(EndpointLifecycleManagerFactory.class, new EndpointLifecycleManagerFactoryImpl());
         table.put(HandlerLifecycleManagerFactory.class, new HandlerLifecycleManagerFactory());
         table.put(ClassFinderFactory.class, new ClassFinderFactory());
         table.put(JAXWSEndpointReferenceFactory.class, new JAXWSEndpointReferenceFactoryImpl());
         table.put(Axis2EndpointReferenceFactory.class, new Axis2EndpointReferenceFactoryImpl());
         table.put(ExecutorFactory.class, new JAXWSExecutorFactory());
         table.put(ServiceInstanceFactory.class, new ServiceInstanceFactoryImpl());
+        
+        // register the implementation responsible for both WebServiceContext 
+        // injection and the updating of the WebServiceContext instances that
+        // have already been injected, we will register these by two different
+        // classes because it is possible that the implementation is in different
+        // classes
+        WebServiceContextInjectorImpl wsciImpl = new WebServiceContextInjectorImpl();
+        table.put(WebServiceContext.class, wsciImpl);
+        table.put(WebServiceContextInjector.class, wsciImpl);
     }
 
     /** FactoryRegistry is currently a static singleton */
@@ -82,21 +116,26 @@
     }
 
     /**
-     * getFactory
-     *
+     * Get the factory.  This may be called frequently.
      * @param intface of the Factory
      * @return Object that is the factory implementation for the intface
      */
     public static Object getFactory(Class intface) {
-        return table.get(intface);
+        Map m = table;
+        return m.get(intface);
     }
 
     /**
-     * setFactory
+     * Add the factory.  This should be called infrequently.
      * @param intface
      * @param factoryObject
      */
     public static void setFactory(Class intface, Object factoryObject) {
-        table.put(intface, factoryObject);
+        synchronized(lockbox) {
+            // Use copy and put approach to ensure that "get" speed is fast.
+            Map<Class, Object> newMap = new HashMap<Class, Object>(table);
+            newMap.put(intface, factoryObject);
+            table = newMap;
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java Tue Jan 15 08:21:22 2008
@@ -199,12 +199,13 @@
             eic.setHandlers(new HandlerResolverImpl(endpointDesc.getServiceDescription()).getHandlerChain(endpointDesc.getPortInfo()));
         }
 
-        if (!Utils.bindingTypesMatch(request, endpointDesc.getServiceDescription())) {
-            Protocol protocol = request.getMessage().getProtocol();
-            MessageContext faultContext = Utils.createVersionMismatchMessage(request, protocol);
-            eic.setResponseMessageContext(faultContext);
-            return false;
-        }
+        //Not needed since this is already handled when eic reaches this level
+        //if (!Utils.bindingTypesMatch(request, endpointDesc.getServiceDescription())) {
+        //    Protocol protocol = request.getMessage().getProtocol();
+        //    MessageContext faultContext = Utils.createVersionMismatchMessage(request, protocol);
+        //    eic.setResponseMessageContext(faultContext);
+        //    return false;
+        //}
 
         MessageContext responseMsgContext = null;
 

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java Tue Jan 15 08:21:22 2008
@@ -19,6 +19,9 @@
 
 package org.apache.axis2.jaxws.server;
 
+import javax.xml.ws.Binding;
+import javax.xml.ws.WebServiceException;
+
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.OperationContext;
@@ -43,9 +46,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.ws.Binding;
-import javax.xml.ws.WebServiceException;
-
 /**
  * The JAXWSMessageReceiver is the entry point, from the server's perspective, to the JAX-WS code.
  * This will be called by the Axis Engine and is the end of the chain from an Axis2 perspective.
@@ -80,8 +80,8 @@
 
         org.apache.axis2.description.Parameter svcClassParam =
                 service.getParameter(PARAM_SERVICE_CLASS);
-
         try {
+
             if (svcClassParam == null) {
                 throw new RuntimeException(
                         Messages.getMessage("JAXWSMessageReceiverNoServiceClass"));

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java Tue Jan 15 08:21:22 2008
@@ -19,7 +19,9 @@
 package org.apache.axis2.jaxws.server.dispatcher;
 
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.binding.BindingUtils;
 import org.apache.axis2.jaxws.context.utils.ContextUtils;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.core.util.MessageContextUtils;
@@ -41,8 +43,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.ws.soap.SOAPBinding;
-import org.apache.axis2.AxisFault;
 import java.lang.reflect.Method;
 import java.util.concurrent.Executor;
 import java.util.concurrent.FutureTask;
@@ -216,9 +216,8 @@
         endpointDesc = mc.getEndpointDescription();
         String bindingType = endpointDesc.getBindingType();
         if (bindingType != null) {
-            if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
-                    || bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
-                mc.getMessage().setMTOMEnabled(true);
+            if (BindingUtils.isMTOMBinding(bindingType)) {
+        		mc.getMessage().setMTOMEnabled(true);
             }
         }
         
@@ -311,8 +310,7 @@
 
         String bindingType = epDesc.getBindingType();
         if (bindingType != null) {
-            if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) || 
-                bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+            if (BindingUtils.isMTOMBinding(bindingType)) {
                 if (log.isDebugEnabled()) {
                     log.debug("MTOM enabled for the response message.");
                 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java Tue Jan 15 08:21:22 2008
@@ -19,6 +19,7 @@
 package org.apache.axis2.jaxws.server.dispatcher;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.binding.BindingUtils;
 import org.apache.axis2.jaxws.context.utils.ContextUtils;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.core.util.MessageContextUtils;
@@ -52,7 +53,6 @@
 import javax.xml.ws.Provider;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
-import javax.xml.ws.soap.SOAPBinding;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
@@ -261,10 +261,9 @@
             // Enable MTOM if indicated by the binding
             String bindingType = endpointDesc.getBindingType();
             if (bindingType != null) {
-                if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
-                        bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
-                    message.setMTOMEnabled(true);
-                }
+            	if (BindingUtils.isMTOMBinding(bindingType)) {
+            		message.setMTOMEnabled(true);
+            	}
             }
 
             // Save off the protocol info so we can use it when creating the response message.
@@ -343,10 +342,9 @@
             // Enable MTOM if indicated by the binding
             String bindingType = endpointDesc.getBindingType();
             if (bindingType != null) {
-                if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
-                        || bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
-                    m.setMTOMEnabled(true);
-                }
+            	if (BindingUtils.isMTOMBinding(bindingType)) {
+                	m.setMTOMEnabled(true);
+            	}
             }
 
             response = MessageContextUtils.createResponseMessageContext(request);
@@ -608,23 +606,22 @@
     }
     
     private void initialize(MessageContext mc) {
-    	
+
         mc.setOperationName(mc.getAxisMessageContext().getAxisOperation().getName());
 
         endpointDesc = mc.getEndpointDescription();
         String bindingType = endpointDesc.getBindingType();
 
         if (bindingType != null) {
-            if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
-                    || bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+            if (BindingUtils.isMTOMBinding(bindingType)) {
                 mc.getMessage().setMTOMEnabled(true);
             }
         }
-        
+
         //Set SOAP Operation Related properties in SOAPMessageContext.
 
-        ContextUtils.addWSDLProperties_provider(mc);    
-        }
+        ContextUtils.addWSDLProperties_provider(mc);
+    }
 
 
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java Tue Jan 15 08:21:22 2008
@@ -20,7 +20,7 @@
 package org.apache.axis2.jaxws.server.endpoint;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.binding.SOAPBinding;
+import org.apache.axis2.jaxws.binding.BindingUtils;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.core.util.MessageContextUtils;
 import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -75,12 +75,10 @@
                     log.debug("        binding type: " + bindingType);
                 }
                 
-                if (protocol.equals(Protocol.soap11)) {
-                    return (SOAPBinding.SOAP11HTTP_BINDING.equalsIgnoreCase(bindingType)) ||
-                            (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equalsIgnoreCase(bindingType));
+                if (protocol.equals(Protocol.soap11)) { 
+                	return (BindingUtils.isSOAP11Binding(bindingType));
                 } else if (protocol.equals(Protocol.soap12)) {
-                    return (SOAPBinding.SOAP12HTTP_BINDING.equalsIgnoreCase(bindingType)) ||
-                            (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equalsIgnoreCase(bindingType));
+                	return (BindingUtils.isSOAP12Binding(bindingType));               	
                 } else if (protocol.equals(Protocol.rest)) {
                     return HTTPBinding.HTTP_BINDING.equalsIgnoreCase(bindingType);
                 }                

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java Tue Jan 15 08:21:22 2008
@@ -22,9 +22,15 @@
 
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.injection.ResourceInjectionException;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.server.endpoint.injection.ResourceInjector;
 import org.apache.axis2.jaxws.server.endpoint.injection.impl.WebServiceContextInjectorImpl;
 
+/**
+ * This class is is responsible for creating instances that can 
+ * handle resource injection.
+ *
+ */
 public class ResourceInjectionFactory {
 
     /**
@@ -35,12 +41,25 @@
         // TODO Auto-generated constructor stub
     }
 
+    /**
+     * This method retrieves the appropriate ResourceInjector instance
+     * based on the type that is supplied.
+     * 
+     */
     public static ResourceInjector createResourceInjector(Class resourceType)
-            throws ResourceInjectionException {
-        if (resourceType == WebServiceContext.class ||
-                resourceType.isAssignableFrom(WebServiceContext.class)) {
-            return new WebServiceContextInjectorImpl();
+        throws ResourceInjectionException {
+        Object obj = FactoryRegistry.getFactory(resourceType);
+        ResourceInjector injector = null;
+
+        // make sure we have a ResourceInjector instance
+        if (obj instanceof ResourceInjector) {
+            injector = (ResourceInjector) obj;
         }
-        throw new ResourceInjectionException(Messages.getMessage("ResourceInjectionFactoryErr1"));
+
+        if (injector == null) {
+            throw new ResourceInjectionException(Messages.getMessage("ResourceInjectionFactoryErr1"));
+        }
+
+        return injector;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java Tue Jan 15 08:21:22 2008
@@ -18,28 +18,13 @@
  */
 package org.apache.axis2.jaxws.server.endpoint.lifecycle.factory;
 
-import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
 import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl;
 
-public class EndpointLifecycleManagerFactory {
-
-    public EndpointLifecycleManagerFactory() {
-        super();
-    }
+public interface EndpointLifecycleManagerFactory {
 
     public EndpointLifecycleManager createEndpointLifecycleManager(Object endpointInstance)
-            throws EndpointLifecycleException {
-        if (endpointInstance == null) {
-            throw new EndpointLifecycleException(
-                    Messages.getMessage("EndpointLifecycleManagerImplErr1"));
-        }
-        return new EndpointLifecycleManagerImpl(endpointInstance);
-    }
-
-    public EndpointLifecycleManager createEndpointLifecycleManager() {
+                                                                                           throws EndpointLifecycleException;
 
-        return new EndpointLifecycleManagerImpl();
-    }
+    public EndpointLifecycleManager createEndpointLifecycleManager();
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java Tue Jan 15 08:21:22 2008
@@ -47,11 +47,12 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class EndpointLifecycleManagerImpl extends BaseLifecycleManager implements EndpointLifecycleManager {
+public class EndpointLifecycleManagerImpl extends BaseLifecycleManager implements
+        EndpointLifecycleManager {
     public static final String WEBSERVICE_MESSAGE_CONTEXT = "javax.xml.ws.WebServiceContext";
     private static final Log log = LogFactory.getLog(EndpointLifecycleManagerImpl.class);
 
-    public EndpointLifecycleManagerImpl(Object endpointInstance) {      
+    public EndpointLifecycleManagerImpl(Object endpointInstance) {
         this.instance = endpointInstance;
     }
 
@@ -62,22 +63,18 @@
       * @see org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager#createServiceInstance(org.apache.axis2.jaxws.core.MessageContext, java.lang.Class)
       */
     public Object createServiceInstance(MessageContext mc, Class serviceImplClass)
-            throws LifecycleException, ResourceInjectionException {
+                                                                                  throws LifecycleException,
+                                                                                  ResourceInjectionException {
         org.apache.axis2.context.MessageContext msgContext = mc.getAxisMessageContext();
 
         // Get the ServiceDescription and injectionDesc which contain
         // cached information
         ServiceDescription serviceDesc = mc.getEndpointDescription().getServiceDescription();
-        ResourceInjectionServiceRuntimeDescription injectionDesc = null;
-        if (serviceDesc != null) {
-            injectionDesc =
-                    ResourceInjectionServiceRuntimeDescriptionFactory
-                            .get(serviceDesc, serviceImplClass);
-        }
+        ResourceInjectionServiceRuntimeDescription injectionDesc =
+                getInjectionDesc(serviceDesc, serviceImplClass);
+
 
-        // See if there is an existing service object
-        ServiceContext serviceContext = msgContext.getServiceContext();
-        Object serviceimpl = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
+        Object serviceimpl = retrieveServiceInstance(mc);
         if (serviceimpl != null) {
             this.instance = serviceimpl;
 
@@ -87,16 +84,8 @@
 
             // If resource injection is needed, create the SOAPMessageContext and update the WebServiceContext
             // Create MessageContext for current invocation.
-            if (injectionDesc != null && injectionDesc.hasResourceAnnotation()) {
-                javax.xml.ws.handler.MessageContext soapMessageContext =
-                        createSOAPMessageContext(mc);
-                //Get WebServiceContext from ServiceContext
-                WebServiceContext ws =
-                        (WebServiceContext)serviceContext.getProperty(WEBSERVICE_MESSAGE_CONTEXT);
-                //Add the MessageContext for current invocation
-                if (ws != null) {
-                    updateWebServiceContext(ws, soapMessageContext);
-                }
+            if (hasResourceAnnotation(injectionDesc)) {
+                performWebServiceContextUpdate(mc);
             }
 
             //since service impl is there in service context , take that from there
@@ -112,35 +101,118 @@
 
             // If resource injection is needed, create the SOAPMessageContext and build the WebServiceContext
             // Create MessageContext for current invocation.
-            if (injectionDesc != null && injectionDesc.hasResourceAnnotation()) {
-                javax.xml.ws.handler.MessageContext soapMessageContext =
-                        createSOAPMessageContext(mc);
-                // Create WebServiceContext
-                WebServiceContextImpl wsContext = new WebServiceContextImpl();
-                //Add MessageContext for this request.
-                wsContext.setSoapMessageContext(soapMessageContext);
-                // Inject WebServiceContext
-                injectWebServiceContext(mc, wsContext, serviceimpl);
-                serviceContext.setProperty(WEBSERVICE_MESSAGE_CONTEXT, wsContext);
+            if (hasResourceAnnotation(injectionDesc)) {
+                performWebServiceContextInjection(mc, serviceimpl);
             }
 
+
             //Invoke PostConstruct
             if (injectionDesc != null && injectionDesc.getPostConstructMethod() != null) {
                 invokePostConstruct(injectionDesc.getPostConstructMethod());
             }
+            ServiceContext serviceContext = msgContext.getServiceContext();
             serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
             return serviceimpl;
         }
     }
 
+    /**
+     * This method locates an existing service implementation instance if
+     * one has been previously stored away.
+     */
+    protected Object retrieveServiceInstance(MessageContext mc) {
+        Object instance = null;
+        ServiceContext serviceContext = mc.getAxisMessageContext().getServiceContext();
+        instance = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
+        return instance;
+    }
+
+    /**
+     * This method will provide the necessary function in order to inject
+     * a WebServiceContext instance on a member of the service implementation class.
+     */
+    protected void performWebServiceContextInjection(MessageContext mc, Object serviceImpl)
+                                                                                           throws ResourceInjectionException {
+        WebServiceContext wsContext = createWebServiceContext(mc);
+        // Inject WebServiceContext
+        injectWebServiceContext(mc, wsContext, serviceImpl);
+        saveWebServiceContext(mc, wsContext);
+    }
+
+    /**
+     * This method will provide the necessary function in order to update
+     * an existing WebServiceContext instance with a MessageContext for
+     * the current request.
+     */
+    protected void performWebServiceContextUpdate(MessageContext mc)
+                                                                    throws ResourceInjectionException {
+        javax.xml.ws.handler.MessageContext soapMessageContext = createSOAPMessageContext(mc);
+        ServiceContext serviceContext = mc.getAxisMessageContext().getServiceContext();
+
+        //Get WebServiceContext from ServiceContext
+        WebServiceContext ws =
+                (WebServiceContext) serviceContext.getProperty(WEBSERVICE_MESSAGE_CONTEXT);
+
+        //Add the MessageContext for current invocation
+        if (ws != null) {
+            updateWebServiceContext(ws, soapMessageContext);
+        }
+    }
+
+    /**
+     * This method will provide the function necessary to save the WebServiceContext
+     * associated with the endpoint.
+     */
+    protected void saveWebServiceContext(MessageContext mc, WebServiceContext wsContext) {
+        ServiceContext sc = mc.getAxisMessageContext().getServiceContext();
+        sc.setProperty(WEBSERVICE_MESSAGE_CONTEXT, wsContext);
+    }
+
+    /**
+     * This method will be responsible for creating an instance of a WebServiceContext
+     * and initializing the instance with a MessageContext.
+     */
+    protected WebServiceContext createWebServiceContext(MessageContext mc) {
+        javax.xml.ws.handler.MessageContext soapMessageContext = createSOAPMessageContext(mc);
+        // Create WebServiceContext
+        WebServiceContextImpl wsContext = new WebServiceContextImpl();
+        //Add MessageContext for this request.
+        wsContext.setSoapMessageContext(soapMessageContext);
+        return wsContext;
+    }
+
+    /**
+     * This method will retrieve a ResourceInjectionServiceRuntimeDescription if one
+     * is associated with the current ServiceDescription.
+     */
+    protected ResourceInjectionServiceRuntimeDescription getInjectionDesc(
+                                                                          ServiceDescription serviceDesc,
+                                                                          Class serviceImplClass) {
+        ResourceInjectionServiceRuntimeDescription injectionDesc = null;
+        if (serviceDesc != null) {
+            injectionDesc =
+                    ResourceInjectionServiceRuntimeDescriptionFactory.get(serviceDesc,
+                                                                          serviceImplClass);
+        }
+
+        return injectionDesc;
+    }
+
+    /**
+     * This method indicates whether or not we need to perform WebServiceContext injection
+     * on a field within our endpoint instance.
+     */
+    protected boolean hasResourceAnnotation(ResourceInjectionServiceRuntimeDescription injectionDesc) {
+        return (injectionDesc != null && injectionDesc.hasResourceAnnotation());
+    }
+
     private Object createServiceInstance(AxisService service, Class serviceImplClass) {
         if (log.isDebugEnabled()) {
             log.debug("Creating new instance of service endpoint");
         }
 
         if (serviceImplClass == null) {
-            throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
-                    "EndpointControllerErr5"));
+            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("EndpointControllerErr5"));
         }
 
         Object instance = null;
@@ -151,51 +223,53 @@
 
                 Parameter serviceObjectParam =
                         service.getParameter(Constants.SERVICE_OBJECT_SUPPLIER);
-                Class serviceObjectMaker = Loader.loadClass(classLoader, ((String)
-                        serviceObjectParam.getValue()).trim());
+                Class serviceObjectMaker =
+                        Loader.loadClass(classLoader,
+                                         ((String) serviceObjectParam.getValue()).trim());
 
                 // Find static getServiceObject() method, call it if there
-                Method method = serviceObjectMaker.
-                        getMethod("getServiceObject",
-                                new Class[]{AxisService.class});
+                Method method =
+                        serviceObjectMaker.getMethod("getServiceObject",
+                                                     new Class[] { AxisService.class });
                 if (method != null) {
-                    return method.invoke(serviceObjectMaker.newInstance(), new Object[]{service});
+                    return method.invoke(serviceObjectMaker.newInstance(), new Object[] { service });
                 }
             }
             instance = serviceImplClass.newInstance();
         } catch (IllegalAccessException e) {
-            throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
-                    "EndpointControllerErr6", serviceImplClass.getName()));
+            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("EndpointControllerErr6",
+                                                                               serviceImplClass.getName()));
         } catch (InstantiationException e) {
-            throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
-                    "EndpointControllerErr6", serviceImplClass.getName()));
+            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("EndpointControllerErr6",
+                                                                               serviceImplClass.getName()));
         } catch (Exception e) {
-            throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
-                    "EndpointControllerErr6", serviceImplClass.getName()));
+            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("EndpointControllerErr6",
+                                                                               serviceImplClass.getName()));
         }
 
         return instance;
     }
 
-    private javax.xml.ws.handler.MessageContext createSOAPMessageContext(MessageContext mc) {
+    protected javax.xml.ws.handler.MessageContext createSOAPMessageContext(MessageContext mc) {
         SoapMessageContext soapMessageContext =
-                (SoapMessageContext)MessageContextFactory.createSoapMessageContext(mc);
+                (SoapMessageContext) MessageContextFactory.createSoapMessageContext(mc);
         ContextUtils.addProperties(soapMessageContext, mc);
         return soapMessageContext;
     }
 
-    private void injectWebServiceContext(MessageContext mc, WebServiceContext wsContext,
-                                         Object serviceInstance) throws ResourceInjectionException {
+    protected void injectWebServiceContext(MessageContext mc, WebServiceContext wsContext,
+                                           Object serviceInstance)
+                                                                  throws ResourceInjectionException {
         ResourceInjector ri =
                 ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
         ri.inject(wsContext, serviceInstance);
     }
 
-    private void updateWebServiceContext(WebServiceContext wsContext,
-                                         javax.xml.ws.handler.MessageContext soapMessageContext)
-            throws ResourceInjectionException {
-        WebServiceContextInjector wci = (WebServiceContextInjector)ResourceInjectionFactory
-                .createResourceInjector(WebServiceContext.class);
+    protected void updateWebServiceContext(WebServiceContext wsContext,
+                                           javax.xml.ws.handler.MessageContext soapMessageContext)
+                                                                                                  throws ResourceInjectionException {
+        WebServiceContextInjector wci =
+                (WebServiceContextInjector) ResourceInjectionFactory.createResourceInjector(WebServiceContextInjector.class);
         wci.addMessageContext(wsContext, soapMessageContext);
 
     }



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


Mime
View raw message