You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2009/02/10 23:58:01 UTC

svn commit: r743151 - in /ode/trunk: axis2-war/src/test/java/org/apache/ode/axis2/rampart/policy/ axis2/src/main/java/org/apache/ode/axis2/hooks/

Author: midon
Date: Tue Feb 10 22:58:00 2009
New Revision: 743151

URL: http://svn.apache.org/viewvc?rev=743151&view=rev
Log:
ODE-509 (part of ODE-415): support encrypted body with axis2 >1.3

Modified:
    ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/rampart/policy/SecuredProcessesTest.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java

Modified: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/rampart/policy/SecuredProcessesTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/rampart/policy/SecuredProcessesTest.java?rev=743151&r1=743150&r2=743151&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/rampart/policy/SecuredProcessesTest.java (original)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/rampart/policy/SecuredProcessesTest.java Tue Feb 10 22:58:00 2009
@@ -57,7 +57,7 @@
     public Object[][] testPolicySamples() throws Exception {
         File[] samples = new File(getClass().getClassLoader().getResource(testDir).getFile()).listFiles(new FileFilter() {
             public boolean accept(File pathname) {
-                return pathname.isDirectory() && pathname.getName().matches("process-sample0[12]");
+                return pathname.isDirectory() && pathname.getName().matches("process-sample0\\d");
             }
         });
         Object[][] bundles = new Object[samples.length][];

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java?rev=743151&r1=743150&r2=743151&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java Tue Feb 10 22:58:00 2009
@@ -55,7 +55,7 @@
         // way to identify the operation.
         String action = messageContext.getWSAAction();
         if (action != null) {
-            log.debug(Messages.getMessage("checkingoperation", action));
+            if(log.isDebugEnabled()) log.debug(Messages.getMessage("checkingoperation", action));
             operation = service.getOperationByAction(action);
             if (operation != null)
                 return operation;
@@ -67,11 +67,11 @@
         OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
         if (bodyFirstChild != null) {
             String localName = bodyFirstChild.getLocalName();
-            log.debug("Checking for Operation using SOAP message body's first child's local name : "
+            if(log.isDebugEnabled()) log.debug("Checking for Operation using SOAP message body's first child's local name : "
                             + localName);
             operation = service.getOperation(new QName(localName));
             if (operation != null) {
-                log.debug("Found operation " + operation);
+                if(log.isDebugEnabled()) log.debug("Found operation " + operation);
                 return operation;
             }
 
@@ -97,7 +97,7 @@
                 return operation;
             }
         }
-        log.warn("No operation has been found!");
+        if(log.isWarnEnabled()) log.warn("No operation has been found!");
         return null;
     }
 

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java?rev=743151&r1=743150&r2=743151&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java Tue Feb 10 22:58:00 2009
@@ -21,6 +21,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.util.PolicyUtil;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
@@ -32,8 +33,11 @@
 import org.apache.commons.collections.map.MultiKeyMap;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.rampart.RampartMessageData;
+import org.apache.neethi.Policy;
 
 import javax.xml.namespace.QName;
+import java.util.ArrayList;
 
 /**
  * Dispatches the service based on the information from the target endpoint URL.
@@ -59,7 +63,8 @@
         EndpointReference toEPR = messageContext.getTo();
 
         if (toEPR != null) {
-            log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
+            if (log.isDebugEnabled())
+                log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
 
             // The only thing we understand if a service name that
             // follows /processes/ in the request URL.
@@ -68,11 +73,20 @@
                 AxisConfiguration registry =
                         messageContext.getConfigurationContext().getAxisConfiguration();
                 AxisService service = registry.getService(path);
-                log.debug("Found service in registry from name " + path + ": " + service);
+                if (log.isDebugEnabled()) log.debug("Found service in registry from name " + path + ": " + service);
+
+                // Axis2 >1.3 is less clever than 1.3. See ODE-509
+                // We have to do additional work for him.
+                Policy policy = PolicyUtil.getMergedPolicy(new ArrayList(service.getPolicySubject().getAttachedPolicyComponents()), service);
+                if (policy != null) {
+                    if (log.isDebugEnabled()) log.debug("Apply policy: " + policy.getName());
+                    messageContext.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
+                }
+
                 return service;
             }
         }
-        log.warn("No service has been found!");
+        if (log.isWarnEnabled()) log.warn("No service has been found!");
         return null;
     }