activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r518632 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/xbean/ activemq-core/src/main/resources/META-INF/services/org/apache/activemq/broker/ assembly/src/test/java/org/apache/activemq/config/
Date Thu, 15 Mar 2007 14:10:25 GMT
Author: jstrachan
Date: Thu Mar 15 07:10:24 2007
New Revision: 518632

URL: http://svn.apache.org/viewvc?view=rev&rev=518632
Log:
rolled back the creation of the file: scheme and made the xbean: scheme handle files or URLs
as well as classpath resources

Removed:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/FileXBeanBrokerFactory.java
    activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/broker/file
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
    activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java?view=diff&rev=518632&r1=518631&r2=518632
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
Thu Mar 15 07:10:24 2007
@@ -17,15 +17,22 @@
  */
 package org.apache.activemq.xbean;
 
-import java.beans.PropertyEditorManager;
-import java.net.URI;
-
-import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.BrokerFactoryHandler;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
+import org.apache.xbean.spring.context.impl.URIEditor;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.apache.xbean.spring.context.impl.URIEditor;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+import org.springframework.util.ResourceUtils;
+
+import java.beans.PropertyEditorManager;
+import java.io.File;
+import java.net.URI;
+import java.net.MalformedURLException;
 
 /**
  * @version $Revision$
@@ -68,7 +75,19 @@
         return broker;
     }
 
-    protected ApplicationContext createApplicationContext(String uri) {
-        return new ClassPathXmlApplicationContext(uri);
+    protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException
{
+        System.out.println("####ĂŠattempting to figure out the type of resource: " + uri);
+        Resource resource;
+        File file = new File(uri);
+        if (file.exists()) {
+            resource = new FileSystemResource(uri);
+        }
+        else if (ResourceUtils.isUrl(uri)) {
+            resource = new UrlResource(uri);
+        }
+        else {
+            resource = new ClassPathResource(uri);
+        }
+        return new ResourceXmlApplicationContext(resource);
     }
 }

Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java?view=diff&rev=518632&r1=518631&r2=518632
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
(original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
Thu Mar 15 07:10:24 2007
@@ -55,7 +55,7 @@
 
     protected void setUp() throws Exception {
         System.setProperty("activemq.base", "target");
-        broker = BrokerFactory.createBroker("file:src/release/conf/activemq.xml");
+        broker = BrokerFactory.createBroker("xbean:src/release/conf/activemq.xml");
     }
 
     protected void tearDown() throws Exception {



Mime
View raw message