added a file: based handler for the broker factory

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@517671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-03-13 12:47:19 +00:00
parent 0ae6a1d6aa
commit ea42012ef1
3 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,36 @@
/**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.xbean;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
import org.springframework.context.ApplicationContext;
/**
* @version $Revision$
*/
public class FileXBeanBrokerFactory extends XBeanBrokerFactory {
@Override
protected ApplicationContext createApplicationContext(String uri) {
String name = uri.toString();
if (name.startsWith("//")) {
name = name.substring(2);
}
return new FileSystemXmlApplicationContext(name);
}
}

View File

@ -23,6 +23,7 @@ import java.net.URI;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.BrokerFactory.BrokerFactoryHandler;
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;
@ -38,7 +39,7 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler {
public BrokerService createBroker(URI config) throws Exception {
String uri = config.getSchemeSpecificPart();
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(uri);
ApplicationContext context = createApplicationContext(uri);
BrokerService broker = null;
try {
@ -67,4 +68,7 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler {
return broker;
}
protected ApplicationContext createApplicationContext(String uri) {
return new ClassPathXmlApplicationContext(uri);
}
}

View File

@ -0,0 +1 @@
class=org.apache.activemq.xbean.FileXBeanBrokerFactory