axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r279598 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/receivers/ databinding/src/org/apache/axis2/databinding/ xml/src/org/apache/axis2/om/impl/ xml/src/org/apache/axis2/om/impl/...
Date Thu, 08 Sep 2005 19:00:12 GMT
Author: gdaniels
Date: Thu Sep  8 12:00:05 2005
New Revision: 279598

URL: http://svn.apache.org/viewcvs?rev=279598&view=rev
Log:
Cleanup, and unconfuse logic for writing namespaces.  Also swich on namespace repairing for
auto-prefixing.

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=279598&r1=279597&r2=279598&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
Thu Sep  8 12:00:05 2005
@@ -221,7 +221,7 @@
             ((AxisConfigurationImpl) axisConfig).setRepository(axis2repository);
             validateSystemPredefinedPhases();
             ((AxisConfigurationImpl) axisConfig).setPhasesinfo(phasesinfo);
-            engagdeModules();
+            engageModules();
         } catch (AxisFault axisFault) {
             log.info(Messages.getMessage(DeploymentErrorMsgs.MODULE_VAL_FAILED, axisFault.getMessage()));
             throw new DeploymentException(axisFault);
@@ -263,7 +263,7 @@
         try {
             ((AxisConfigurationImpl) axisConfig).setRepository(axis2repository);
             ((AxisConfigurationImpl) axisConfig).setPhasesinfo(phasesinfo);
-            engagdeModules();
+            engageModules();
         } catch (AxisFault axisFault) {
             log.info(Messages.getMessage(DeploymentErrorMsgs.MODULE_VAL_FAILED, axisFault.getMessage()));
             throw new DeploymentException(axisFault);
@@ -316,7 +316,7 @@
      * This methode used to check the modules referd by server.xml
      * are exist , or they have deployed
      */
-    private void engagdeModules() throws AxisFault {
+    private void engageModules() throws AxisFault {
         // ArrayList modules = DeploymentData.getInstance().getModules();
         // PhaseResolver resolver = new PhaseResolver(axisConfig);
         for (Iterator iterator = modulelist.iterator(); iterator.hasNext();) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java?rev=279598&r1=279597&r2=279598&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
Thu Sep  8 12:00:05 2005
@@ -33,15 +33,15 @@
                                              MessageContext outMessage)
             throws AxisFault;
 
-    public final void receive(MessageContext messgeCtx) throws AxisFault {
-        MessageContext newmsgCtx =
-                new MessageContext(messgeCtx.getSystemContext(),
-                        messgeCtx.getSessionContext(),
-                        messgeCtx.getTransportIn(),
-                        messgeCtx.getTransportOut());
+    public final void receive(MessageContext msgContext) throws AxisFault {
+        MessageContext outMsgContext =
+                new MessageContext(msgContext.getSystemContext(),
+                        msgContext.getSessionContext(),
+                        msgContext.getTransportIn(),
+                        msgContext.getTransportOut());
 
         MessageInformationHeaders oldMessageInfoHeaders =
-                messgeCtx.getMessageInformationHeaders();
+                msgContext.getMessageInformationHeaders();
         MessageInformationHeaders messageInformationHeaders =
                 new MessageInformationHeaders();
         messageInformationHeaders.setMessageId(UUIDGenerator.getUUID());
@@ -52,28 +52,28 @@
         messageInformationHeaders.setRelatesTo(
                 new RelatesTo(oldMessageInfoHeaders.getMessageId(),
                         AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));
-        newmsgCtx.setMessageInformationHeaders(messageInformationHeaders);
-        newmsgCtx.setOperationContext(messgeCtx.getOperationContext());
-        newmsgCtx.setServiceContext(messgeCtx.getServiceContext());
-        newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,
-                messgeCtx.getProperty(MessageContext.TRANSPORT_OUT));
-        newmsgCtx.setProperty(HTTPConstants.HTTPOutTransportInfo,
-                messgeCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
+        outMsgContext.setMessageInformationHeaders(messageInformationHeaders);
+        outMsgContext.setOperationContext(msgContext.getOperationContext());
+        outMsgContext.setServiceContext(msgContext.getServiceContext());
+        outMsgContext.setProperty(MessageContext.TRANSPORT_OUT,
+                msgContext.getProperty(MessageContext.TRANSPORT_OUT));
+        outMsgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
+                msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo));
         
         //Setting the charater set encoding
-        newmsgCtx.setProperty(MessageContext.CHARACTER_SET_ENCODING, messgeCtx
+        outMsgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, msgContext
 				.getProperty(MessageContext.CHARACTER_SET_ENCODING));
         
-        newmsgCtx.setDoingREST(messgeCtx.isDoingREST());
-        newmsgCtx.setDoingMTOM(messgeCtx.isDoingMTOM());
-        newmsgCtx.setServerSide(messgeCtx.isServerSide());
+        outMsgContext.setDoingREST(msgContext.isDoingREST());
+        outMsgContext.setDoingMTOM(msgContext.isDoingMTOM());
+        outMsgContext.setServerSide(msgContext.isServerSide());
 
-        invokeBusinessLogic(messgeCtx, newmsgCtx);
+        invokeBusinessLogic(msgContext, outMsgContext);
 
         AxisEngine engine =
                 new AxisEngine(
-                        messgeCtx.getOperationContext().getServiceContext()
+                        msgContext.getOperationContext().getServiceContext()
                 .getEngineContext());
-        engine.send(newmsgCtx);
+        engine.send(outMsgContext);
     }
 }

Modified: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java?rev=279598&r1=279597&r2=279598&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java
(original)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java
Thu Sep  8 12:00:05 2005
@@ -15,6 +15,8 @@
 */
 package org.apache.axis2.databinding;
 
+import org.apache.axis.xsd.Constants;
+
 import javax.xml.namespace.QName;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLStreamWriter;
@@ -28,10 +30,15 @@
  * SerializationContext
  */
 public class SerializationContext {
+    // Multiref modes
     public static final int NO_MULTIREFS = 0;
     public static final int SOAP11_MULTIREFS = 1;
     public static final int SOAP12_MULTIREFS = 2;
 
+    // Null handling modes
+    public static final int NULL_OMIT = 0;
+    public static final int NULL_NILLABLE = 1;
+
     static final QName MULTIREF_QNAME = new QName("MultiRef");
 
     Map multirefObjects = null;
@@ -78,15 +85,29 @@
     public void serializeElement(QName qname,
                                  Object obj,
                                  Serializer serializer) throws Exception {
+        serializeElement(qname, obj, NULL_OMIT, serializer);
+    }
+
+    public void serializeElement(QName qname,
+                                 Object obj,
+                                 int nullHandlingMode,
+                                 Serializer serializer) throws Exception {
+        if (obj == null) {
+            switch (nullHandlingMode) {
+                case NULL_NILLABLE:
+                    // write xsi:nil
+                    writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart());
+                    writer.writeAttribute(Constants.URI_2001_SCHEMA_XSI,
+                                          "nil",
+                                          "true");
+                    writer.writeEndElement();
+                default:
+                    return;
+            }
+
+        }
+
         writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart());
-//        if (attributes != null) {
-//            for (Iterator i = attributes.keySet().iterator(); i.hasNext();) {
-//                QName attrQName = (QName) i.next();
-//                writer.writeAttribute(attrQName.getNamespaceURI(),
-//                                      attrQName.getLocalPart(),
-//                                      (String)attributes.get(attrQName));
-//            }
-//        }
         serializer.serialize(obj, this);
     }
 

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java?rev=279598&r1=279597&r2=279598&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
Thu Sep  8 12:00:05 2005
@@ -86,7 +86,7 @@
             this.charSetEncoding = DEFAULT_CHAR_SET_ENCODING;
 
         XMLOutputFactory factory = XMLOutputFactory.newInstance();
-//        factory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+        factory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
         if (doOptimize) {
             bufferedSoapOutStream = new ByteArrayOutputStream();
             xmlWriter = factory.createXMLStreamWriter(bufferedSoapOutStream,

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java?rev=279598&r1=279597&r2=279598&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
Thu Sep  8 12:00:05 2005
@@ -89,9 +89,8 @@
             String uri = namespace.getName();
             String prefix = writer.getPrefix(uri);
             String ns_prefix = namespace.getPrefix();
-            if (prefix == null && namespace.getName() != null) {
+            if (ns_prefix != null && !ns_prefix.equals(prefix)) {
                 writer.writeNamespace(ns_prefix, namespace.getName());
-                writer.setPrefix(ns_prefix, uri);
             }
         }
     }



Mime
View raw message