You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2007/05/03 02:14:31 UTC

svn commit: r534662 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: addressing/ deployment/ engine/ i18n/ transport/local/

Author: gdaniels
Date: Wed May  2 17:14:31 2007
New Revision: 534662

URL: http://svn.apache.org/viewvc?view=rev&rev=534662
Log:
Fix AXIS2-2612.  I'm not going to close the bug yet because I still need to check in another test case.  Replace missing header code in DispatchPhase - this is also pending a wider-scoped review by myself and Deepal.

Fix poor message in resource.properties

Add debugging to local transport message senders

Add ability to directly deploy modules via filename into AxisConfiguration 

Remove unused variable in ModuleDeployer

Remove incorrect JavaDoc link in EPR

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalResponder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalTransportSender.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java Wed May  2 17:14:31 2007
@@ -365,7 +365,7 @@
      * @param localName
      * @param prefix
      * @throws AxisFault
-     * @deprecated use {@link EndpointReferenceHelper#toOM(EndpointReference, QName, String)} instead.
+     * @deprecated use EndpointReferenceHelper#toOM(EndpointReference, QName, String) instead.
      */
     public OMElement toOM(String nsurl, String localName, String prefix) throws AxisFault {
         OMFactory fac = OMAbstractFactory.getOMFactory();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java Wed May  2 17:14:31 2007
@@ -37,7 +37,6 @@
 public class ModuleDeployer implements Deployer {
 
     private static final Log log = LogFactory.getLog(ModuleDeployer.class);
-    private ConfigurationContext configCtx;
     private AxisConfiguration axisConfig;
 
 
@@ -50,7 +49,6 @@
 
     //To initialize the deployer
     public void init(ConfigurationContext configCtx) {
-        this.configCtx = configCtx;
         this.axisConfig = configCtx.getAxisConfiguration();
     }
     //Will process the file and add that to axisConfig

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Wed May  2 17:14:31 2007
@@ -22,6 +22,8 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.dataretrieval.AxisDataLocator;
 import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.ModuleDeployer;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.*;
 import org.apache.axis2.i18n.Messages;
@@ -37,6 +39,7 @@
 import java.net.URL;
 import java.security.PrivilegedAction;
 import java.util.*;
+import java.io.File;
 
 /**
  * Class AxisConfiguration
@@ -212,6 +215,15 @@
         // Registering the policy assertions that are local to the system
         registerLocalPolicyAssertions(module);
 
+    }
+
+    public void deployModule(String moduleFileName) throws DeploymentException {
+        File moduleFile = new File(moduleFileName);
+        if (!moduleFile.exists()) {
+            throw new DeploymentException("Module archive '" + moduleFileName + "' doesn't exist");
+        }
+        DeploymentFileData dfd = new DeploymentFileData(moduleFile, new ModuleDeployer(this));
+        dfd.deploy();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java Wed May  2 17:14:31 2007
@@ -19,7 +19,10 @@
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004_Constants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPHeader;
 
+import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -71,6 +74,7 @@
                     operation = null;
                 }
             }
+            msgContext.setAxisOperation(operation);
         }
 
         // If we still don't have an operation, fault.
@@ -80,8 +84,6 @@
                                                             : ""), msgContext.getWSAAction()));
         }
 
-        msgContext.setAxisOperation(operation);
-        
         validateTransport(msgContext);
 
         loadContexts(service, msgContext);
@@ -144,6 +146,8 @@
         }
         if (Constants.SCOPE_TRANSPORT_SESSION.equals(scope)) {
             fillContextsFromSessionContext(msgContext);
+        } else if (Constants.SCOPE_SOAP_SESSION.equals(scope)) {
+            extractServiceGroupContextId(msgContext);
         }
 
         AxisOperation axisOperation = msgContext.getAxisOperation();
@@ -261,4 +265,19 @@
             sessionContext.addServiceGroupContext(serviceGroupContext);
         }
     }
+
+    private static final QName SERVICE_GROUP_QNAME = new QName(Constants.AXIS2_NAMESPACE_URI,
+                                                               Constants.SERVICE_GROUP_ID,
+                                                               Constants.AXIS2_NAMESPACE_PREFIX);
+
+    private void extractServiceGroupContextId(MessageContext msgContext) throws AxisFault {
+        SOAPHeader soapHeader = msgContext.getEnvelope().getHeader();
+        if (soapHeader != null) {
+            OMElement serviceGroupId = soapHeader.getFirstChildWithName(SERVICE_GROUP_QNAME);
+            if (serviceGroupId != null) {
+                msgContext.setServiceGroupContextId(serviceGroupId.getText());
+            }
+        }
+    }
+
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties Wed May  2 17:14:31 2007
@@ -101,7 +101,7 @@
 confignotfound=The system cannot find the axis2.xml file.
 pathtoconfigcanotnull=The path to axis2.xml file cannot be NULL.
 modulevalfailed=Module validation failed: {0}
-invalidphase=The phases are not valid.  Recheck the axis2.xml file {0} for the {1} handler.
+invalidphase=Did not find the desired phase ''{0}'' while deploying handler ''{1}''.
 dispatchPhaseNotFoundOnInflow=The '"Dispatch'" phase is not found on the global '"InFlow'" phase of the axis2.xml file. Make sure the phase is within the axis2.xml file.
 #invalidmoduleref=The {0} service refers to the {1} module, which is not valid.
 invalidmodulerefbyop={0} operation refers to the {1} module, which is not valid.

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalResponder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalResponder.java?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalResponder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalResponder.java Wed May  2 17:14:31 2007
@@ -27,13 +27,18 @@
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.io.OutputStream;
+import java.io.ByteArrayOutputStream;
 
 /**
  * LocalResponder
  */
 public class LocalResponder extends AbstractHandler implements TransportSender {
+    protected static final Log log = LogFactory.getLog(LocalResponder.class);
+    
     LocalTransportSender sender;
 
     public LocalResponder(LocalTransportSender sender) {
@@ -70,6 +75,12 @@
             epr = msgContext.getTo();
         }
 
+        if (log.isDebugEnabled()) {
+            ByteArrayOutputStream os = new ByteArrayOutputStream();
+            TransportUtils.writeMessage(msgContext, os);
+            log.debug("Response - " + new String(os.toByteArray()));
+        }
+        
         if (epr != null) {
             if (!epr.hasNoneAddress()) {
                 out = sender.getResponse();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalTransportSender.java?view=diff&rev=534662&r1=534661&r2=534662
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/local/LocalTransportSender.java Wed May  2 17:14:31 2007
@@ -27,6 +27,8 @@
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -35,6 +37,8 @@
 import java.io.OutputStream;
 
 public class LocalTransportSender extends AbstractHandler implements TransportSender {
+    protected static final Log log = LogFactory.getLog(LocalTransportSender.class);
+
     private ByteArrayOutputStream response;
 
     public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
@@ -66,6 +70,12 @@
 
         OutputStream out;
         EndpointReference epr = msgContext.getTo();
+
+        if (log.isDebugEnabled()) {
+            ByteArrayOutputStream os = new ByteArrayOutputStream();
+            TransportUtils.writeMessage(msgContext, os);
+            log.debug("Sending - " + new String(os.toByteArray()));
+        }
 
         if (epr != null) {
             if (!epr.hasNoneAddress()) {



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