cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r665814 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ common/common/src/main/java/org/apache/cxf/common/classloader/ integration/jbi/src/test/java/org/apache/cxf/jbi/se/ rt/core/...
Date Mon, 09 Jun 2008 18:24:36 GMT
Author: dkulp
Date: Mon Jun  9 11:24:35 2008
New Revision: 665814

URL: http://svn.apache.org/viewvc?rev=665814&view=rev
Log:
Update a couple things to we can remove some SuppressWarngings things
Update the locating of cxf.xml to also check if the passed in location is a URL and also try
our classloader utils.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
    cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitManagerTest.java
    cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitTest.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java?rev=665814&r1=665813&r2=665814&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java Mon Jun  9 11:24:35 2008
@@ -147,7 +147,6 @@
      * default search algorithm.
      * @return a new BusFactory to be used to create Bus objects
      */
-    @SuppressWarnings("unchecked")
     public static BusFactory newInstance(String className) {
         BusFactory instance = null;
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java?rev=665814&r1=665813&r2=665814&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
Mon Jun  9 11:24:35 2008
@@ -67,7 +67,7 @@
      */
     @SuppressWarnings("unchecked")
     public JaxbAssertionBuilder(String className, QName qn) throws JAXBException, ClassNotFoundException
{
-        this(ClassLoaderUtils.loadClass(className, JaxbAssertionBuilder.class), qn);
+        this((Class<T>)ClassLoaderUtils.loadClass(className, JaxbAssertionBuilder.class),
qn);
     }
     
     /**

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java?rev=665814&r1=665813&r2=665814&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
Mon Jun  9 11:24:35 2008
@@ -113,7 +113,8 @@
      * @param callingClass The Class object of the calling object
      * @throws ClassNotFoundException If the class cannot be found anywhere.
      */
-    public static Class loadClass(String className, Class callingClass) throws ClassNotFoundException
{
+    public static Class<?> loadClass(String className, Class<?> callingClass)
+        throws ClassNotFoundException {
         try {
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
 
@@ -127,7 +128,8 @@
         }
     }
 
-    private static Class loadClass2(String className, Class callingClass) throws ClassNotFoundException
{
+    private static Class<?> loadClass2(String className, Class<?> callingClass)
+        throws ClassNotFoundException {
         try {
             return Class.forName(className);
         } catch (ClassNotFoundException ex) {

Modified: cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitManagerTest.java?rev=665814&r1=665813&r2=665814&view=diff
==============================================================================
--- cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitManagerTest.java
(original)
+++ cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitManagerTest.java
Mon Jun  9 11:24:35 2008
@@ -29,7 +29,6 @@
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.configuration.Configurer;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Assert;
@@ -40,8 +39,6 @@
     
     private static final Logger LOG = LogUtils.getL7dLogger(CXFServiceUnitManagerTest.class);
 
-    private static final String CXF_CONFIG = 
-        "/components/CXFServiceEngine/version_1/META-INF/cxf-config.xml";
     private CXFServiceUnitManager csuManager;
     private ComponentContext ctx = EasyMock.createMock(ComponentContext.class);
     private Bus bus;    
@@ -50,8 +47,6 @@
     public void setUp() throws Exception {
         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
         
-        System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME, 
-            getClass().getResource(CXF_CONFIG).toString());
         bus = new SpringBusFactory().createBus();
         ComponentClassLoader componentClassLoader = 
             new ComponentClassLoader(new URL[0], getClass().getClassLoader());

Modified: cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitTest.java?rev=665814&r1=665813&r2=665814&view=diff
==============================================================================
--- cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitTest.java
(original)
+++ cxf/trunk/integration/jbi/src/test/java/org/apache/cxf/jbi/se/CXFServiceUnitTest.java
Mon Jun  9 11:24:35 2008
@@ -31,7 +31,6 @@
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.jbi.JBITransportFactory;
 import org.easymock.classextension.EasyMock;
@@ -46,8 +45,6 @@
     private static final String ROOT_PATH =
         "/service-assemblies/cxf-demo-service-assembly/version_1/sus/"
             + "CXFServiceEngine/JBIDemoSE_AProvider";
-    private static final String CXF_CONFIG =
-        "/components/CXFServiceEngine/version_1/META-INF/cxf-config.xml";
     private CXFServiceUnit csu;
     private CXFServiceUnitManager csuManager;
     private ComponentContext ctx = EasyMock.createMock(ComponentContext.class);
@@ -61,8 +58,6 @@
         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
         absCsuPath = getClass().getResource(ROOT_PATH).toURI().getPath();
         
-        System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME,
-            getClass().getResource(CXF_CONFIG).toString());
         bus = new SpringBusFactory().createBus();
               
         ComponentClassLoader componentClassLoader =

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java?rev=665814&r1=665813&r2=665814&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java Mon
Jun  9 11:24:35 2008
@@ -31,6 +31,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurer;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -136,10 +137,36 @@
             usingDefault = true;
         }
         for (String cfgFile : cfgFiles) {
-            ClassPathResource cpr = new ClassPathResource(cfgFile);
-            if (cpr.exists()) {
-                resources.add(cpr);
+            boolean found = false;
+            Resource cpr = new ClassPathResource(cfgFile);
+            if (!cpr.exists()) {
+                try {
+                    //see if it's a URL
+                    URL url = new URL(cfgFile);
+                    cpr = new UrlResource(url);
+                    if (cpr.exists()) {
+                        resources.add(cpr);
+                        found = true;
+                    }
+                } catch (MalformedURLException e) {
+                    //ignore
+                }
+                if (!found) {
+                    //try loading it our way
+                    URL url = ClassLoaderUtils.getResource(cfgFile, this.getClass());
+                    if (url != null) {
+                        cpr = new UrlResource(url);
+                        if (cpr.exists()) {
+                            resources.add(cpr);
+                            found = true;
+                        }
+                    }
+                }
             } else {
+                resources.add(cpr);
+                found = true;
+            }
+            if (!found) {
                 if (!usingDefault) {
                     LogUtils.log(LOG, Level.WARNING, "USER_CFG_FILE_NOT_FOUND_MSG", cfgFile);
                 } else {



Mime
View raw message