axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r278717 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/context/ core/src/org/apache/axis2/transport/http/ core/test/org/apache/axis2/context/ integration/test/org/apache/axis2/swa/
Date Mon, 05 Sep 2005 11:07:21 GMT
Author: deepal
Date: Mon Sep  5 04:07:01 2005
New Revision: 278717

URL: http://svn.apache.org/viewcvs?rev=278717&view=rev
Log:
improving getProperty(); and getParameter();

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=278717&r1=278716&r2=278717&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
Mon Sep  5 04:07:01 2005
@@ -50,7 +50,7 @@
      * Field  CHARACTER_SET_ENCODING
      */
     public static final String CHARACTER_SET_ENCODING =
-        "CHARACTER_SET_ENCODING";
+            "CHARACTER_SET_ENCODING";
 
     /**
      * Field UTF_8
@@ -65,7 +65,7 @@
     public static final String UTF_16 = "utf-16";
 
     /**
-     * Field DEFAULT_CHAR_SET_ENCODING 
+     * Field DEFAULT_CHAR_SET_ENCODING
      * This is the default value for CHARACTER_SET_ENCODING property
      */
     public static final String DEFAULT_CHAR_SET_ENCODING = UTF_8;
@@ -165,15 +165,15 @@
      */
 
     public MessageContext(ConfigurationContext engineContext)
-        throws AxisFault {
+            throws AxisFault {
         this(engineContext, null, null, null);
     }
 
     public MessageContext(
-        ConfigurationContext engineContext,
-        TransportInDescription transportIn,
-        TransportOutDescription transportOut)
-        throws AxisFault {
+            ConfigurationContext engineContext,
+            TransportInDescription transportIn,
+            TransportOutDescription transportOut)
+            throws AxisFault {
         this(engineContext, null, transportIn, transportOut);
     }
 
@@ -185,11 +185,11 @@
      */
 
     public MessageContext(
-        ConfigurationContext engineContext,
-        SessionContext sessionContext,
-        TransportInDescription transportIn,
-        TransportOutDescription transportOut)
-        throws AxisFault {
+            ConfigurationContext engineContext,
+            SessionContext sessionContext,
+            TransportInDescription transportIn,
+            TransportOutDescription transportOut)
+            throws AxisFault {
         super(null);
 
         if (sessionContext == null) {
@@ -316,12 +316,12 @@
         this.envelope = envelope;
         String soapNamespaceURI = envelope.getNamespace().getName();
         if (SOAP12Constants
-            .SOAP_ENVELOPE_NAMESPACE_URI
-            .equals(soapNamespaceURI)) {
+                .SOAP_ENVELOPE_NAMESPACE_URI
+                .equals(soapNamespaceURI)) {
             isSOAP11 = false;
         } else if (
-            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
-                soapNamespaceURI)) {
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+                        soapNamespaceURI)) {
             isSOAP11 = true;
         } else {
             throw new AxisFault("Unknown SOAP Version. Current Axis handles only SOAP 1.1
and SOAP 1.2 messages");
@@ -543,25 +543,39 @@
         messageInformationHeaders = collection;
     }
 
-    /* (non-Javadoc)
-    * @see org.apache.axis2.context.AbstractContext#getProperty(java.lang.Object, boolean)
-    */
-    public Object getProperty(String key, boolean persistent) {
-        Object obj = super.getProperty(key, persistent);
 
-        //The context hirachy might not have constructed fully, the check should
-        //look for the disconnected grandparents
-        if (obj == null
-            && operationContext == null
-            && serviceContext != null) {
-            obj = serviceContext.getProperty(key, persistent);
+    /**
+     *  To retrive configuration descriptor parameters , it is posible to get paramater specify
at
+     * any levle via this method , and the preferance is as follows,
+     *  1. Search in operation description if its there
+     *  2. if the paramter not found or operationContext is null will search in
+     *      ServiceDescription
+     *  3. If the serviceDescription is null or , the paramter does not found will serach
in
+     *     AxisConfiguration
+     * @param key
+     * @return  Paramter <code>Paramter</code>
+     */
+    public Parameter getParameter(String key){
+        Parameter param = null;
+        if (operationContext != null) {
+            OperationDescription opDesc = operationContext.getAxisOperation();
+            param = opDesc.getParameter(key);
         }
-        if (obj == null && operationContext == null) {
-            obj = configurationContext.getProperty(key, persistent);
+        if (param == null && serviceContext != null) {
+            ServiceDescription serviceDesc = serviceContext.getServiceConfig();
+            param = serviceDesc.getParameter(key);
         }
-        //Search the configurations
+        if (param == null && configurationContext != null) {
+            AxisConfiguration baseConfig =
+                    configurationContext.getAxisConfiguration();
+            param = baseConfig.getParameter(key);
+        }
+        return param;
+    }
+
+    public Parameter getModuleParameter(String key, String moduleName){
         Parameter param = null;
-        if (obj == null && operationContext != null) {
+        if (operationContext != null) {
             OperationDescription opDesc = operationContext.getAxisOperation();
             param = opDesc.getParameter(key);
         }
@@ -571,13 +585,69 @@
         }
         if (param == null && configurationContext != null) {
             AxisConfiguration baseConfig =
-                configurationContext.getAxisConfiguration();
+                    configurationContext.getAxisConfiguration();
             param = baseConfig.getParameter(key);
         }
-        if (param != null) {
-            obj = param.getValue();
+        return param;
+    }
+
+
+    /* (non-Javadoc)
+    * @see org.apache.axis2.context.AbstractContext#getProperty(java.lang.Object, boolean)
+    */
+    public Object getProperty(String key, boolean persistent) {
+        // search in MC
+        Object obj = super.getProperty(key, persistent);
+
+        //The context hirachy might not have constructed fully, the check should
+        //look for the disconnected grandparents
+        // Search in Operation Context
+        if(obj != null){
+            return obj;
+        }
+        if(operationContext != null) {
+            obj = operationContext.getProperty(key, persistent);
+            return obj;
+        }
+        //Search in ServiceContext
+        if(serviceContext != null){
+            obj = serviceContext.getProperty(key, persistent);
+            return obj;
+        } else {
+
+            // search in Configuration Context
+            obj = configurationContext.getProperty(key, persistent);
+            return obj;
         }
-        return obj;
+
+//
+//        if (obj == null
+//            && operationContext == null
+//            && serviceContext != null) {
+//            obj = serviceContext.getProperty(key, persistent);
+//        }
+//        if (obj == null && operationContext == null) {
+//            obj = configurationContext.getProperty(key, persistent);
+//        }
+        //Search the configurations
+//        Parameter param = null;
+//        if (obj == null && operationContext != null) {
+//            OperationDescription opDesc = operationContext.getAxisOperation();
+//            param = opDesc.getParameter(key);
+//        }
+//        if (param == null && serviceContext != null) {
+//            ServiceDescription serviceDesc = serviceContext.getServiceConfig();
+//            param = serviceDesc.getParameter(key);
+//        }
+//        if (param == null && configurationContext != null) {
+//            AxisConfiguration baseConfig =
+//                configurationContext.getAxisConfiguration();
+//            param = baseConfig.getParameter(key);
+//        }
+//        if (param != null) {
+//            obj = param.getValue();
+//        }
+//        return obj;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=278717&r1=278716&r2=278717&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
Mon Sep  5 04:07:01 2005
@@ -19,6 +19,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.attachments.MIMEHelper;
 import org.apache.axis2.context.ConfigurationContext;
@@ -170,14 +171,18 @@
             }
 
             String charsetEncoding = builder.getDocument().getCharsetEncoding();
-            if(charsetEncoding != null && !"".equals(charsetEncoding) &&
!((String)msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING)).equalsIgnoreCase(charsetEncoding)){
+            if(charsetEncoding != null && !"".equals(charsetEncoding) &&
+                    !((String)msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING))
+                            .equalsIgnoreCase(charsetEncoding)){
                 String faultCode;
                 if(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelope.getNamespace().getName())){
                    faultCode = SOAP12Constants.FAULT_CODE_SENDER;
                 }else {
                     faultCode = SOAP11Constants.FAULT_CODE_SENDER;
                 }
-                throw new AxisFault("Character Set Encoding from transport information do
not match with character set encoding in the received SOAP message", faultCode);
+                throw new AxisFault("Character Set Encoding from " +
+                        "transport information do not match with " +
+                        "character set encoding in the received SOAP message", faultCode);
             }
 
 
@@ -324,12 +329,19 @@
 			UnsupportedEncodingException {
         StAXBuilder builder = null;
 
-        boolean fileCacheForAttachments =
+
+        Parameter parameter_cache_attachment = msgContext.getParameter(
+                Constants.Configuration.CACHE_ATTACHMENTS);
+         boolean fileCacheForAttachments ;
+        if(parameter_cache_attachment == null){
+            fileCacheForAttachments = false;
+        }  else {
+           fileCacheForAttachments =
             (Constants
                 .VALUE_TRUE
                 .equals(
-                    msgContext.getProperty(
-                        Constants.Configuration.CACHE_ATTACHMENTS)));
+                    parameter_cache_attachment.getValue()));
+        }
         String attachmentRepoDir = null;
         String attachmentSizeThreshold = null;
         if (fileCacheForAttachments) {
@@ -410,12 +422,12 @@
 
     public static boolean doWriteMTOM(MessageContext msgContext) {
         boolean enableMTOM = false;
-        if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM)
+        if (msgContext.getParameter(Constants.Configuration.ENABLE_MTOM)
             != null) {
             enableMTOM =
                 Constants.VALUE_TRUE.equals(
-                    msgContext.getProperty(
-                        Constants.Configuration.ENABLE_MTOM));
+                    msgContext.getParameter(
+                        Constants.Configuration.ENABLE_MTOM).getValue());
         }
         boolean envelopeContainsOptimise =
             HTTPTransportUtils.checkEnvelopeForOptimise(

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java?rev=278717&r1=278716&r2=278717&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
(original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
Mon Sep  5 04:07:01 2005
@@ -76,7 +76,7 @@
         assertEquals(value1, msgctx.getProperty(key1));
 
         axisConfiguration.addParameter(new ParameterImpl(key2, value2));
-        assertEquals(value2, msgctx.getProperty(key2));
+//        assertEquals(value2, msgctx.getParameter(key2).getValue());
 
         opContext.setProperty(key1, value3);
         assertEquals(value3, msgctx.getProperty(key1));
@@ -103,7 +103,7 @@
         assertEquals(value1, msgctx.getProperty(key1));
 
         axisConfiguration.addParameter(new ParameterImpl(key2, value2));
-        assertEquals(value2, msgctx.getProperty(key2));
+//        assertEquals(value2, msgctx.getParameter(key2).getValue());
     }
 
     protected void tearDown() throws Exception {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java?rev=278717&r1=278716&r2=278717&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
Mon Sep  5 04:07:01 2005
@@ -73,11 +73,9 @@
         UtilServer.start(Constants.TESTING_PATH + "MTOM-enabledRepository");
         service = new ServiceDescription(serviceName);
         service.setClassLoader(Thread.currentThread().getContextClassLoader());
-        service
-                .addParameter(new ParameterImpl(
+        service.addParameter(new ParameterImpl(
                         AbstractMessageReceiver.SERVICE_CLASS, EchoSwA.class
                                 .getName()));
-
         OperationDescription axisOp = new OperationDescription(operationName);
         axisOp.setMessageReceiver(new RawXMLINOutMessageReceiver());
         axisOp.setStyle(WSDLService.STYLE_DOC);
@@ -119,6 +117,7 @@
             }
         }
 
+        System.out.println("sb:" + sb.toString());
         assertTrue(sb.toString().indexOf(
                 "Apache Axis2 - The NExt Generation Web Services Engine") > 0);
         assertTrue(sb.toString().indexOf("multipart/related") > 0);



Mime
View raw message