From 2ab55ddb1d004ade70d365f0ecf6f1ff1ceb98a0 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Tue, 20 Dec 2005 12:28:05 +0000 Subject: [PATCH] added WebSphere 5.1 version of a JNDI context that works nicely with ActiveMQ git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@357969 13f79535-47bb-0310-9956-ffa450edef68 --- .../ActiveMQWASInitialContextFactory.java | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 activemq-core/src/main/java/org/activemq/jndi/ActiveMQWASInitialContextFactory.java diff --git a/activemq-core/src/main/java/org/activemq/jndi/ActiveMQWASInitialContextFactory.java b/activemq-core/src/main/java/org/activemq/jndi/ActiveMQWASInitialContextFactory.java new file mode 100644 index 0000000000..c11f80441d --- /dev/null +++ b/activemq-core/src/main/java/org/activemq/jndi/ActiveMQWASInitialContextFactory.java @@ -0,0 +1,104 @@ +/** + * + * Copyright 2005 Pawel Tucholski + * + * Licensed 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.activemq.jndi; + +import javax.naming.Context; +import javax.naming.NamingException; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; + +/** + * This implementation of InitialContextFactory should be used + * when ActiveMQ is used as WebSphere Generic JMS Provider. It is proved that it + * works on WebSphere 5.1. The reason for using this class is that custom + * property defined for Generic JMS Provider are passed to InitialContextFactory + * only if it begins with java.naming or javax.naming prefix. Additionaly + * provider url for the JMS provider can not contain ',' character that is + * necessary when the list of nodes is provided. So the role of this class is to + * transform properties before passing it to ActiveMQInitialContextFactory. + * + * @author Pawel Tucholski + */ +public class ActiveMQWASInitialContextFactory extends ActiveMQInitialContextFactory { + + /** + * @see javax.naming.spi.InitialContextFactory#getInitialContext(java.util.Hashtable) + */ + public Context getInitialContext(Hashtable environment) throws NamingException { + + return super.getInitialContext(transformEnvironment(environment)); + } + + /** + * Performs following transformation of properties: + *