cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1230569 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/configuration/ common/wstx-msv-validation/src/main/resources/META-INF/cxf/ common/xerces-xsd-validation/src/main/resources/META-INF/cxf/ integratio...
Date Thu, 12 Jan 2012 14:47:09 GMT
Author: dkulp
Date: Thu Jan 12 14:47:08 2012
New Revision: 1230569

URL: http://svn.apache.org/viewvc?rev=1230569&view=rev
Log:
Allow bus extensions to be marked optional which allows them to not be
loaded at all if dependencies are not available.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/Bus.java
    cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java
    cxf/trunk/common/wstx-msv-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
    cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/trunk/rt/transports/http/pom.xml
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
    cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/rt/ws/security/src/main/resources/META-INF/cxf/bus-extensions.txt

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/Bus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/Bus.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/Bus.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/Bus.java Thu Jan 12 14:47:08 2012
@@ -39,6 +39,9 @@ public interface Bus extends Interceptor
     
     <T> void setExtension(T extension, Class<T> extensionType);
     
+    boolean hasExtensionByName(String name);
+    
+    
     String getId();
     
     void shutdown(boolean wait);

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java Thu
Jan 12 14:47:08 2012
@@ -93,4 +93,6 @@ public interface ConfiguredBeanLocator {
          */
         boolean beanLoaded(String name, T bean);
     }
+
+    boolean hasBeanOfName(String name);
 }

Modified: cxf/trunk/common/wstx-msv-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/common/wstx-msv-validation/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/common/wstx-msv-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
(original)
+++ cxf/trunk/common/wstx-msv-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
Thu Jan 12 14:47:08 2012
@@ -1 +1 @@
-org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl:org.apache.cxf.io.StaxValidationManager:true
+org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl:org.apache.cxf.io.StaxValidationManager:true:true

Modified: cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
(original)
+++ cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
Thu Jan 12 14:47:08 2012
@@ -1 +1 @@
-org.apache.cxf.xsdvalidation.XercesXsdValidationImpl:org.apache.cxf.common.xmlschema.XmlSchemaValidationManager:true
+org.apache.cxf.xsdvalidation.XercesXsdValidationImpl:org.apache.cxf.common.xmlschema.XmlSchemaValidationManager:true:true

Modified: cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java (original)
+++ cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java Thu
Jan 12 14:47:08 2012
@@ -52,7 +52,10 @@ public class DummyBus extends AbstractBa
         throwException = false;
     }
     
-    
+    public boolean hasExtensionByName(String name) {
+        return false;
+    }
+
     public static Bus init(String[] args) throws BusException {
         
         initializeCount++;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Thu Jan 12 14:47:08
2012
@@ -111,6 +111,22 @@ public class CXFBusImpl extends Abstract
         return null;
     }
     
+    public boolean hasExtensionByName(String name) {
+        for (Class<?> c : extensions.keySet()) {
+            if (name.equals(c.getName())) {
+                return true;
+            }
+        }
+        ConfiguredBeanLocator loc = (ConfiguredBeanLocator)extensions.get(ConfiguredBeanLocator.class);
+        if (loc == null) {
+            loc = createConfiguredBeanLocator();
+        }
+        if (loc != null) {
+            return loc.hasBeanOfName(name);
+        }
+        return false;
+    }
+    
     protected synchronized ConfiguredBeanLocator createConfiguredBeanLocator() {
         ConfiguredBeanLocator loc = (ConfiguredBeanLocator)extensions.get(ConfiguredBeanLocator.class);
         if (loc == null) {
@@ -132,6 +148,9 @@ public class CXFBusImpl extends Abstract
                 public <T> T getBeanOfType(String name, Class<T> type) {
                     return null;
                 }
+                public boolean hasBeanOfName(String name) {
+                    return false;
+                }
             };
             this.setExtension(loc, ConfiguredBeanLocator.class);
         }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
Thu Jan 12 14:47:08 2012
@@ -185,4 +185,13 @@ public class BlueprintBeanLocator implem
         return orig.hasConfiguredPropertyValue(beanName, propertyName, value);
     }
 
+    @Override
+    public boolean hasBeanOfName(String name) {
+        ComponentMetadata cmd = getComponentMetadata(name);
+        if (cmd instanceof BeanMetadata) {
+            return true;
+        }        
+        return orig.hasBeanOfName(name);
+    }
+
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java Thu Jan 12
14:47:08 2012
@@ -37,6 +37,8 @@ public class Extension {
     protected Collection<String> namespaces = new ArrayList<String>();
     protected Object args[];
     protected Object obj;
+    protected boolean optional;
+    protected boolean notFound;
     
     public Extension() {
     }
@@ -64,6 +66,14 @@ public class Extension {
         intf = ext.intf;
         classloader = ext.classloader;
         args = ext.args;
+        optional = ext.optional;
+    }
+    
+    public void setOptional(boolean b) {
+        optional = b;
+    }
+    public boolean isOptional() {
+        return optional;
     }
     
     public String getName() {
@@ -108,6 +118,7 @@ public class Extension {
     
     public void setClassname(String i) {
         clazz = null;
+        notFound = false;
         className = i;
     }
        
@@ -117,6 +128,7 @@ public class Extension {
 
     public void setInterfaceName(String i) {
         interfaceName = i;
+        notFound = false;
     }
 
     public boolean isDeferred() {
@@ -135,32 +147,45 @@ public class Extension {
         args = a;
     }
     
-    public Class<?> getClassObject(ClassLoader cl) {
-        if (clazz == null) {
-            if (classloader != null) {
-                try {
-                    clazz = classloader.loadClass(className);
-                    return clazz;
-                } catch (ClassNotFoundException nex) {
-                    //ignore, fall into the stuff below
-                }
-            }                
+    private  Class<?> tryClass(String name, ClassLoader cl) {
+        if (classloader != null) {
+            try {
+                return classloader.loadClass(name);
+            } catch (Throwable nex) {
+                //ignore, fall into the stuff below
+            }
+        }                
+        try {
+            return cl.loadClass(name);
+        } catch (Throwable ex) {
             try {
-                clazz = cl.loadClass(className);
-            } catch (ClassNotFoundException ex) {
-                try {
-                    // using the extension classloader as a fallback
-                    clazz = this.getClass().getClassLoader().loadClass(className);
-                } catch (ClassNotFoundException nex) {
+                // using the extension classloader as a fallback
+                return this.getClass().getClassLoader().loadClass(name);
+            } catch (Throwable nex) {
+                notFound = true;
+                if (!optional) {
                     throw new ExtensionException(nex);
                 }
             }
         }
+        return null;
+    }
+    
+    public Class<?> getClassObject(ClassLoader cl) {
+        if (notFound) {
+            return null;
+        }
+        if (clazz == null) {
+            clazz = tryClass(className, cl);
+        }
         return clazz;
     }
     public Object load(ClassLoader cl, Bus b) {
         try {
             Class<?> cls = getClassObject(cl);
+            if (notFound) {
+                return null;
+            }
             try {
                 //if there is a Bus constructor, use it.
                 if (b != null && args == null) {
@@ -200,30 +225,10 @@ public class Extension {
     }
     
     public Class<?> loadInterface(ClassLoader cl) {
-        if (intf != null) {
+        if (intf != null || notFound) {
             return intf;
         }
-        if (classloader != null) {
-            try {
-                intf = classloader.loadClass(interfaceName);
-                if (intf != null) {
-                    return intf;
-                }
-            } catch (ClassNotFoundException nex) {
-                //ignore, fall into the stuff below
-            }
-        }                
-
-        try {
-            intf = cl.loadClass(interfaceName);
-        } catch (ClassNotFoundException ex) {
-            try {
-                // using the extension classloader as a fallback
-                intf = this.getClass().getClassLoader().loadClass(interfaceName);
-            } catch (ClassNotFoundException nex) {
-                throw new ExtensionException(nex);
-            }
-        }
+        intf = tryClass(interfaceName, cl);
         return intf;
     }
     

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
Thu Jan 12 14:47:08 2012
@@ -134,12 +134,19 @@ public class ExtensionManagerImpl implem
     }
     public synchronized <T> void activateAllByType(Class<T> type) {
         for (Extension e : all.values()) {
-            if (e.getLoadedObject() == null
-                && type.isAssignableFrom(e.getClassObject(loader))) {
-                loadAndRegister(e);
+            if (e.getLoadedObject() == null) {
+                Class<?> cls = e.getClassObject(loader);
+                if (cls != null && type.isAssignableFrom(cls)) {
+                    loadAndRegister(e);
+                }
             }
         }        
     }
+    
+    public boolean hasBeanOfName(String name) {
+        return all.containsKey(name);
+    }
+
     final void load(String resource) throws IOException {
         if (loader != getClass().getClassLoader()) {
             load(resource, getClass().getClassLoader());
@@ -231,12 +238,15 @@ public class ExtensionManagerImpl implem
 
     public synchronized <T> T getExtension(String name, Class<T> type) {
         Extension e = all.get(name);
-        if (e != null
-            && type.isAssignableFrom(e.getClassObject(loader))) {
-            if (e.getLoadedObject() == null) {
-                loadAndRegister(e);
+        if (e != null) {
+            Class<?> cls = e.getClassObject(loader);
+        
+            if (cls != null && type.isAssignableFrom(e.getClassObject(loader))) {
+                if (e.getLoadedObject() == null) {
+                    loadAndRegister(e);
+                }
+                return type.cast(e.getLoadedObject());
             }
-            return type.cast(e.getLoadedObject());
         }
         return null;
     }
@@ -267,7 +277,8 @@ public class ExtensionManagerImpl implem
     public List<String> getBeanNamesOfType(Class<?> type) {
         List<String> ret = new LinkedList<String>();
         for (Extension ex : all.values()) {
-            if (type.isAssignableFrom(ex.getClassObject(loader))) {
+            Class<?> cls = ex.getClassObject(loader);
+            if (cls != null && type.isAssignableFrom(cls)) {
                 ret.add(ex.getName());
             }            
         }
@@ -286,7 +297,8 @@ public class ExtensionManagerImpl implem
     public synchronized <T> Collection<? extends T> getBeansOfType(Class<T>
type) {
         List<T> ret = new LinkedList<T>();
         for (Extension ex : all.values()) {
-            if (type.isAssignableFrom(ex.getClassObject(loader))) {
+            Class<?> cls = ex.getClassObject(loader);
+            if (cls != null && type.isAssignableFrom(cls)) {
                 if (ex.getLoadedObject() == null) {
                     loadAndRegister(ex);
                 }
@@ -299,7 +311,8 @@ public class ExtensionManagerImpl implem
         boolean loaded = false;
         for (Extension ex : all.values()) {
             Class<?> cls = ex.getClassObject(loader);
-            if (ex.getLoadedObject() == null 
+            if (cls != null 
+                && ex.getLoadedObject() == null 
                 && type.isAssignableFrom(cls)
                 && listener.loadBean(ex.getName(), cls.asSubclass(type))) {
                 loadAndRegister(ex);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
Thu Jan 12 14:47:08 2012
@@ -56,7 +56,7 @@ public class TextExtensionFragmentParser
     /**
      * Reads extension definitions from a Text file and instantiates them
      * The text file has the following syntax
-     * classname:interfacename:deferred(true|false)
+     * classname:interfacename:deferred(true|false):optional(true|false)
      * 
      * @param is stream to read the extension from
      * @return list of Extensions
@@ -97,6 +97,9 @@ public class TextExtensionFragmentParser
         if (parts.length >= 3) {
             ext.setDeferred(Boolean.parseBoolean(parts[2]));
         }
+        if (parts.length >= 4) {
+            ext.setOptional(Boolean.parseBoolean(parts[3]));
+        }
         return ext;
     }
     

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java Thu Jan 12
14:47:08 2012
@@ -77,4 +77,8 @@ public class OSGiBeanLocator implements 
     public List<String> getBeanNamesOfType(Class<?> type) {
         return cbl.getBeanNamesOfType(type);
     }
+    @Override
+    public boolean hasBeanOfName(String name) {
+        return cbl.hasBeanOfName(name);
+    }
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java Thu Jan
12 14:47:08 2012
@@ -288,4 +288,12 @@ public class SpringBeanLocator implement
         return lst;
     }
 
+    @Override
+    public boolean hasBeanOfName(String name) {
+        if (context.containsBean(name)) {
+            return true;
+        }
+        return orig.hasBeanOfName(name);
+    }
+
 }

Modified: cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Thu Jan 12 14:47:08 2012
@@ -69,7 +69,6 @@ import org.apache.cxf.transports.http.co
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
-import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.EasyMock;
 import org.eclipse.jetty.http.HttpFields;
@@ -571,8 +570,8 @@ public class JettyHTTPDestinationTest ex
             bus = EasyMock.createMock(Bus.class);
             bus.getExtension(EndpointResolverRegistry.class);
             EasyMock.expectLastCall().andReturn(null);
-            bus.getExtension(PolicyEngine.class);          
-            EasyMock.expectLastCall().andReturn(null);
+            bus.hasExtensionByName("org.apache.cxf.ws.policy.PolicyEngine");
+            EasyMock.expectLastCall().andReturn(false);
             bus.getExtension(ClassLoader.class);
             EasyMock.expectLastCall().andReturn(this.getClass().getClassLoader());
             EasyMock.replay(bus);

Modified: cxf/trunk/rt/transports/http/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/pom.xml?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/pom.xml (original)
+++ cxf/trunk/rt/transports/http/pom.xml Thu Jan 12 14:47:08 2012
@@ -63,6 +63,7 @@
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-policy</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Jan 12 14:47:08 2012
@@ -72,7 +72,6 @@ import org.apache.cxf.transport.https.Ce
 import org.apache.cxf.transport.https.SSLUtils;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.apache.cxf.wsdl.WSDLLibrary;
 
@@ -420,11 +419,8 @@ public abstract class AbstractHTTPDestin
     }
 
     private void initConfig() {
-        PolicyEngine engine = bus.getExtension(PolicyEngine.class);
-        // for a decoupled endpoint there is no service info
-        if (null != engine && engine.isEnabled() 
-            && null != endpointInfo.getService()) {
-            server = PolicyUtils.getServer(engine, endpointInfo, this);
+        if (bus.hasExtensionByName("org.apache.cxf.ws.policy.PolicyEngine")) {
+            server = PolicyUtils.getServer(bus, endpointInfo, this);
         }
         if (null == server && WSDLLibrary.isAvailable()) {
             server = endpointInfo.getTraversedExtensor(

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Thu Jan 12 14:47:08 2012
@@ -85,7 +85,6 @@ import org.apache.cxf.transports.http.co
 import org.apache.cxf.workqueue.AutomaticWorkQueue;
 import org.apache.cxf.workqueue.WorkQueueManager;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.ws.policy.PolicyEngine;
 
 import static org.apache.cxf.message.Message.DECOUPLED_CHANNEL_MESSAGE;
 
@@ -304,10 +303,10 @@ public class HTTPConduit 
         
         // wsdl extensors are superseded by policies which in        
         // turn are superseded by injection                          
-        PolicyEngine pe = bus.getExtension(PolicyEngine.class);      
-        if (null != pe && pe.isEnabled() && endpointInfo.getService() !=
null) {                          
+        if (bus.hasExtensionByName("org.apache.cxf.ws.policy.PolicyEngine")
+            && endpointInfo.getService() != null) {                         
             clientSidePolicy =                                       
-                PolicyUtils.getClient(pe, endpointInfo, this);              
+                PolicyUtils.getClient(bus, endpointInfo, this);              
         }
         CXFAuthenticator.addAuthenticator();
     }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
Thu Jan 12 14:47:08 2012
@@ -26,6 +26,7 @@ import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
@@ -136,17 +137,18 @@ public final class PolicyUtils {
         }
         return compatible;
     }
-  
+
     /**
      * Returns a HTTPClientPolicy that is compatible with the assertions included in the
      * service and endpoint policy subjects, or null if there are no such assertions.
-     * @param pe the policy engine
+     * @param bus the bus
      * @param ei the endpoint info
      * @param c the conduit
      * @return the compatible policy
      * @throws PolicyException if no compatible HTTPClientPolicy can be determined
      */
-    public static HTTPClientPolicy getClient(PolicyEngine pe, EndpointInfo ei, Conduit c)
{
+    public static HTTPClientPolicy getClient(Bus bus, EndpointInfo ei, Conduit c) {
+        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         Collection<Assertion> alternative = pe.getClientEndpointPolicy(ei, c).getChosenAlternative();
         HTTPClientPolicy compatible = null;
         for (Assertion a : alternative) {
@@ -166,17 +168,18 @@ public final class PolicyUtils {
         }
         return compatible;
     }
-    
+
     /**
      * Returns a HTTPServerPolicy that is compatible with the assertions included in the
      * service and endpoint policy subjects, or null if there are no such assertions.
-     * @param pe the policy engine
+     * @param bus the bus
      * @param ei the endpoint info
      * @param d the destination
      * @return the compatible policy
      * @throws PolicyException if no compatible HTTPServerPolicy can be determined
      */
-    public static HTTPServerPolicy getServer(PolicyEngine pe, EndpointInfo ei, Destination
d) {
+    public static HTTPServerPolicy getServer(Bus b, EndpointInfo ei, Destination d) {
+        PolicyEngine pe = b.getExtension(PolicyEngine.class);
         Collection<Assertion> alternative = pe.getServerEndpointPolicy(ei, d).getChosenAlternative();
         HTTPServerPolicy compatible = null;
         for (Assertion a : alternative) {
@@ -634,6 +637,10 @@ public final class PolicyUtils {
         return s1 == null || s2 == null || s1.equals(s2);
     }
     
+    
+    
+    
+    
     private static HTTPClientPolicy getClient(Collection<Assertion> alternative) {
     
         HTTPClientPolicy compatible = null;
         for (Assertion a : alternative) {

Modified: cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt Thu Jan
12 14:47:08 2012
@@ -1,6 +1,6 @@
 org.apache.cxf.transport.http.HTTPTransportFactory::true
 org.apache.cxf.transport.http.HTTPWSDLExtensionLoader::true
-org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder::true
-org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder::true
-org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider::true
+org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder::true:true
+org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder::true:true
+org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider::true:true
 

Modified: cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/bus-extensions.txt Thu Jan 12 14:47:08
2012
@@ -1,4 +1,4 @@
-org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder::true
-org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder::true
-org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider::true
-org.apache.cxf.ws.addressing.AddressingWSDLExtensionLoader::true
+org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder::true:true
+org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder::true:true
+org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider::true:true
+org.apache.cxf.ws.addressing.AddressingWSDLExtensionLoader::true:true

Modified: cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt Thu Jan 12 14:47:08
2012
@@ -7,7 +7,7 @@ org.apache.cxf.ws.policy.PolicyAnnotatio
 org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider::true
 org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry::true
 org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder::true
-org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider::true
+org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider::true:true
 # MTOM Policy Support
 org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder::true
 org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider::true

Modified: cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt Thu Jan 12 14:47:08
2012
@@ -1,4 +1,4 @@
 org.apache.cxf.ws.rm.RMManager::true
-org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider::true
-org.apache.cxf.ws.rm.policy.RMAssertionBuilder::true
+org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider::true:true
+org.apache.cxf.ws.rm.policy.RMAssertionBuilder::true:true
 

Modified: cxf/trunk/rt/ws/security/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1230569&r1=1230568&r2=1230569&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/ws/security/src/main/resources/META-INF/cxf/bus-extensions.txt Thu Jan 12
14:47:08 2012
@@ -1 +1 @@
-org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader::true
+org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader::true:true



Mime
View raw message