[jbossws-commits] JBossWS SVN: r17658 - in stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf: policy and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Jun 6 14:24:57 EDT 2013


Author: alessio.soldano at jboss.com
Date: 2013-06-06 14:24:57 -0400 (Thu, 06 Jun 2013)
New Revision: 17658

Modified:
   stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
   stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
   stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachment.java
   stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java
Log:
Misc fixes / additions


Modified: stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
===================================================================
--- stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java	2013-06-06 09:46:13 UTC (rev 17657)
+++ stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java	2013-06-06 18:24:57 UTC (rev 17658)
@@ -200,4 +200,8 @@
     @LogMessage(level = DEBUG)
     @Message(id = 24091, value = "Could not get WSDL from %s, aborting soap:address rewrite.")
     void abortSoapAddressRewrite(String wsdlLocation, @Cause Throwable cause);
+    
+    @LogMessage(level = INFO)
+    @Message(id = 24092, value = "Adding %s policy attachment with id='%s' to honor requirement from %s.")
+    void addingPolicyAttachment(Object placement, String refId, Class<?> cls);
 }

Modified: stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
===================================================================
--- stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java	2013-06-06 09:46:13 UTC (rev 17657)
+++ stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java	2013-06-06 18:24:57 UTC (rev 17658)
@@ -211,4 +211,7 @@
     @Message(id = 24090, value = "Could not read from config file: %s")
     RuntimeException couldNotReadConfigFile(String file);
     
+    @Message(id = 24093, value = "Error parsing policy attachment: %s")
+    RuntimeException errorParsingPolicyAttachment(String uri, @Cause Throwable cause);
+    
 }

Modified: stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachment.java
===================================================================
--- stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachment.java	2013-06-06 09:46:13 UTC (rev 17657)
+++ stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicyAttachment.java	2013-06-06 18:24:57 UTC (rev 17658)
@@ -32,6 +32,7 @@
 import org.apache.cxf.resource.ExtendedURIResolver;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.policy.PolicyConstants;
+import org.jboss.wsf.stack.cxf.Messages;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -116,7 +117,7 @@
       }
       catch (Exception e)
       {
-         throw new RuntimeException(e);
+         throw Messages.MESSAGES.errorParsingPolicyAttachment(uri, e);
       }
       finally
       {

Modified: stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java
===================================================================
--- stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java	2013-06-06 09:46:13 UTC (rev 17657)
+++ stack/cxf/branches/JBWS-3648/modules/client/src/main/java/org/jboss/wsf/stack/cxf/policy/PolicySetsAnnotationListener.java	2013-06-06 18:24:57 UTC (rev 17658)
@@ -21,6 +21,8 @@
  */
 package org.jboss.wsf.stack.cxf.policy;
 
+import static org.jboss.wsf.stack.cxf.Loggers.ROOT_LOGGER;
+
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.HashMap;
@@ -58,6 +60,7 @@
 public class PolicySetsAnnotationListener implements FactoryBeanListener
 {
    private final Map<Class<?>, EndpointPolicyAttachments> epaMap = new HashMap<Class<?>, EndpointPolicyAttachments>(); //usare la SEI come class
+   private static final Logger LOG = Logger.getLogger(PolicySetsAnnotationListener.class);
    private PolicyAttachmentStore store;
    
    public PolicySetsAnnotationListener() {
@@ -96,21 +99,22 @@
 
          case ENDPOINT_SELECTED : {
             Class<?> cls = (Class<?>) args[2];
-            //Class<?> implCls = (Class<?>) args[3];
+            Class<?> implCls = (Class<?>) args[3];
             Endpoint ep = (Endpoint) args[1];
-            if (ep.getEndpointInfo().getInterface() != null)
-            {
-               addPolicies(factory, ep, cls);
-            }
+//            if (ep.getEndpointInfo().getInterface() != null)
+//            {
+//               addPolicies(factory, ep, cls);
+//            }
+            addPolicies(factory, ep, cls, implCls);
             break;
          }
 
-         case INTERFACE_OPERATION_BOUND : { //TODO possibly remove either this block or next one
-            OperationInfo inf = (OperationInfo) args[0];
-            Method m = (Method) args[1];
-            addPolicies(factory, inf, m);
-            break;
-         }
+//         case INTERFACE_OPERATION_BOUND : { //TODO possibly remove either this block or next one
+//            OperationInfo inf = (OperationInfo) args[0];
+//            Method m = (Method) args[1];
+//            addPolicies(factory, inf, m);
+//            break;
+//         }
 
          case BINDING_OPERATION_CREATED :
             BindingOperationInfo boi = (BindingOperationInfo) args[1];
@@ -153,9 +157,17 @@
       }
    }
    
-   private void addPolicies(AbstractServiceFactoryBean factory, Endpoint ep, Class<?> cls)
+   private void addPolicies(AbstractServiceFactoryBean factory, Endpoint ep, Class<?> seiCls, Class<?> implCls)
    {
-      final EndpointPolicyAttachments epa = getEndpointPolicyAttachment(cls);
+      EndpointPolicyAttachments epa = null;
+      Class<?> cls = seiCls;
+      if (ep.getEndpointInfo().getInterface() != null) {
+         epa = getEndpointPolicyAttachment(seiCls);
+      }
+      if (epa == null) {
+         cls = implCls;
+         epa = getEndpointPolicyAttachment(implCls);
+      }
       if (epa != null) {
          final BindingInfo binf = ep.getBinding().getBindingInfo();
          final ServiceInfo si = ep.getService().getServiceInfos().get(0);
@@ -219,27 +231,29 @@
 
    private void addPolicy(AbstractPropertiesHolder place, ServiceInfo service, PolicyAttachment pa, Class<?> cls, String defName)
    {
+      LOG.info("***** " + place + ", " + pa.getPlacement() + ", " + service + ", " + cls + ", " + defName);
       Element el = addPolicy(service, pa, cls, defName);
-      if (el != null)
-      {
+//      if (el != null)
+//      {
          UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
          uee.setElement(el);
          uee.setRequired(true);
          uee.setElementType(DOMUtils.getElementQName(el));
          place.addExtensor(uee);
-      }
+//      }
    }
 
    private Element addPolicy(ServiceInfo service, PolicyAttachment pa, Class<?> cls, String defName)
    {
       Element element = pa.read(defName);
-      if (element == null)
-      {
-         return null;
-      }
+//      if (element == null)
+//      {
+//         return null;
+//      }
 
       // might have been updated on load policy
       String refId = getPolicyId(element);
+      ROOT_LOGGER.addingPolicyAttachment(pa.getPlacement(), refId, cls);
 
       if (service.getDescription() == null && cls != null)
       {



More information about the jbossws-commits mailing list