ACTIVEMQ6-6 - remove SPI usage
https://issues.apache.org/jira/browse/ACTIVEMQ6-6 Removed the jboss security implementations and also implemented the location of Transaction Managers using Service Loader and removed the jboss implementation.
This commit is contained in:
parent
46182e4155
commit
e34fd09ce3
|
@ -36,6 +36,11 @@
|
|||
<artifactId>activemq-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-service-extensions</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.jms</groupId>
|
||||
<artifactId>jboss-jms-api_2.0_spec</artifactId>
|
||||
|
|
|
@ -86,14 +86,6 @@ public interface JMSBridge extends ActiveMQComponent
|
|||
|
||||
void setClientID(String clientID);
|
||||
|
||||
String getTransactionManagerLocatorClass();
|
||||
|
||||
void setTransactionManagerLocatorClass(String transactionManagerLocatorClass);
|
||||
|
||||
String getTransactionManagerLocatorMethod();
|
||||
|
||||
void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod);
|
||||
|
||||
boolean isAddMessageIDInHeader();
|
||||
|
||||
void setAddMessageIDInHeader(boolean value);
|
||||
|
|
|
@ -78,14 +78,6 @@ public interface JMSBridgeControl extends ActiveMQComponentControl
|
|||
|
||||
void setClientID(String clientID);
|
||||
|
||||
String getTransactionManagerLocatorClass();
|
||||
|
||||
void setTransactionManagerLocatorClass(String transactionManagerLocatorClass);
|
||||
|
||||
String getTransactionManagerLocatorMethod();
|
||||
|
||||
void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod);
|
||||
|
||||
boolean isAddMessageIDInHeader();
|
||||
|
||||
void setAddMessageIDInHeader(boolean value);
|
||||
|
|
|
@ -136,16 +136,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont
|
|||
return bridge.getTargetUsername();
|
||||
}
|
||||
|
||||
public String getTransactionManagerLocatorClass()
|
||||
{
|
||||
return bridge.getTransactionManagerLocatorClass();
|
||||
}
|
||||
|
||||
public String getTransactionManagerLocatorMethod()
|
||||
{
|
||||
return bridge.getTransactionManagerLocatorMethod();
|
||||
}
|
||||
|
||||
public boolean isAddMessageIDInHeader()
|
||||
{
|
||||
return bridge.isAddMessageIDInHeader();
|
||||
|
@ -233,16 +223,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont
|
|||
bridge.setTargetUsername(name);
|
||||
}
|
||||
|
||||
public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass)
|
||||
{
|
||||
bridge.setTransactionManagerLocatorClass(transactionManagerLocatorClass);
|
||||
}
|
||||
|
||||
public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod)
|
||||
{
|
||||
bridge.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod);
|
||||
}
|
||||
|
||||
// Constants -----------------------------------------------------
|
||||
|
||||
// Attributes ----------------------------------------------------
|
||||
|
|
|
@ -36,7 +36,6 @@ import javax.transaction.Transaction;
|
|||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.TransactionRolledbackException;
|
||||
import javax.transaction.xa.XAResource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Enumeration;
|
||||
|
@ -66,6 +65,7 @@ import org.apache.activemq.jms.client.ActiveMQMessage;
|
|||
import org.apache.activemq.jms.server.ActiveMQJMSServerBundle;
|
||||
import org.apache.activemq.jms.server.recovery.ActiveMQRegistryBase;
|
||||
import org.apache.activemq.jms.server.recovery.XARecoveryConfig;
|
||||
import org.apache.activemq.service.extensions.ServiceUtils;
|
||||
import org.apache.activemq.utils.ClassloadingUtil;
|
||||
import org.apache.activemq.utils.DefaultSensitiveStringCodec;
|
||||
import org.apache.activemq.utils.PasswordMaskingUtil;
|
||||
|
@ -167,10 +167,6 @@ public final class JMSBridgeImpl implements JMSBridge
|
|||
|
||||
private int forwardMode;
|
||||
|
||||
private String transactionManagerLocatorClass = "org.apache.activemq.integration.jboss.tm.JBoss5TransactionManagerLocator";
|
||||
|
||||
private String transactionManagerLocatorMethod = "getTm";
|
||||
|
||||
private MBeanServer mbeanServer;
|
||||
|
||||
private ObjectName objectName;
|
||||
|
@ -404,7 +400,7 @@ public final class JMSBridgeImpl implements JMSBridge
|
|||
|
||||
checkParams();
|
||||
|
||||
TransactionManager tm = getTm();
|
||||
TransactionManager tm = ServiceUtils.getTransactionManager();
|
||||
|
||||
// There may already be a JTA transaction associated to the thread
|
||||
|
||||
|
@ -839,27 +835,6 @@ public final class JMSBridgeImpl implements JMSBridge
|
|||
this.clientID = clientID;
|
||||
}
|
||||
|
||||
public String getTransactionManagerLocatorClass()
|
||||
{
|
||||
return transactionManagerLocatorClass;
|
||||
}
|
||||
|
||||
public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass)
|
||||
{
|
||||
checkBridgeNotStarted();
|
||||
this.transactionManagerLocatorClass = transactionManagerLocatorClass;
|
||||
}
|
||||
|
||||
public String getTransactionManagerLocatorMethod()
|
||||
{
|
||||
return transactionManagerLocatorMethod;
|
||||
}
|
||||
|
||||
public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod)
|
||||
{
|
||||
this.transactionManagerLocatorMethod = transactionManagerLocatorMethod;
|
||||
}
|
||||
|
||||
public boolean isAddMessageIDInHeader()
|
||||
{
|
||||
return addMessageIDInHeader;
|
||||
|
@ -1038,7 +1013,7 @@ public final class JMSBridgeImpl implements JMSBridge
|
|||
ActiveMQJMSBridgeLogger.LOGGER.trace("Starting JTA transaction");
|
||||
}
|
||||
|
||||
TransactionManager tm = getTm();
|
||||
TransactionManager tm = ServiceUtils.getTransactionManager();
|
||||
|
||||
// Set timeout to a large value since we do not want to time out while waiting for messages
|
||||
// to arrive - 10 years should be enough
|
||||
|
@ -1061,33 +1036,6 @@ public final class JMSBridgeImpl implements JMSBridge
|
|||
return tx;
|
||||
}
|
||||
|
||||
private TransactionManager getTm()
|
||||
{
|
||||
if (tm == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object o = safeInitNewInstance(transactionManagerLocatorClass);
|
||||
Method m = o.getClass().getMethod(transactionManagerLocatorMethod);
|
||||
tm = (TransactionManager) m.invoke(o);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new IllegalStateException("unable to create TransactionManager from " + transactionManagerLocatorClass +
|
||||
"." +
|
||||
transactionManagerLocatorMethod,
|
||||
e);
|
||||
}
|
||||
|
||||
if (tm == null)
|
||||
{
|
||||
throw new IllegalStateException("Cannot locate a transaction manager");
|
||||
}
|
||||
}
|
||||
|
||||
return tm;
|
||||
}
|
||||
|
||||
private Connection createConnection(final String username, final String password,
|
||||
final ConnectionFactoryFactory cff,
|
||||
final String clientID,
|
||||
|
|
|
@ -75,10 +75,6 @@ public interface ActiveMQRALogger extends BasicLogger
|
|||
@Message(id = 151005, value = "awaiting ActiveMQ Server availability", format = Message.Format.MESSAGE_FORMAT)
|
||||
void awaitingJMSServerCreation();
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 152000, value = "It wasn''t possible to lookup for a Transaction Manager through the configured properties TransactionManagerLocatorClass and TransactionManagerLocatorMethod\nActiveMQ Resource Adapter won''t be able to set and verify transaction timeouts in certain cases.", format = Message.Format.MESSAGE_FORMAT)
|
||||
void noTXLocator();
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 152001, value = "problem resetting ActiveMQ xa session after failure", format = Message.Format.MESSAGE_FORMAT)
|
||||
void problemResettingXASession();
|
||||
|
|
|
@ -58,18 +58,6 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements
|
|||
*/
|
||||
private Boolean localTx = false;
|
||||
|
||||
|
||||
/**
|
||||
* Class used to locate the Transaction Manager.
|
||||
* Using JBoss5 as the default locator
|
||||
*/
|
||||
private String transactionManagerLocatorClass = "org.apache.activemq.integration.jboss.tm.JBoss5TransactionManagerLocator;org.apache.activemq.integration.jboss.tm.JBoss4TransactionManagerLocator";
|
||||
|
||||
/**
|
||||
* Method used to locate the TM
|
||||
*/
|
||||
private String transactionManagerLocatorMethod = "getTm;getTM";
|
||||
|
||||
private static final int DEFAULT_SETUP_ATTEMPTS = -1;
|
||||
|
||||
private static final long DEFAULT_SETUP_INTERVAL = 2 * 1000;
|
||||
|
@ -236,27 +224,6 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements
|
|||
this.localTx = localTx;
|
||||
}
|
||||
|
||||
|
||||
public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass)
|
||||
{
|
||||
this.transactionManagerLocatorClass = transactionManagerLocatorClass;
|
||||
}
|
||||
|
||||
public String getTransactionManagerLocatorClass()
|
||||
{
|
||||
return transactionManagerLocatorClass;
|
||||
}
|
||||
|
||||
public String getTransactionManagerLocatorMethod()
|
||||
{
|
||||
return transactionManagerLocatorMethod;
|
||||
}
|
||||
|
||||
public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod)
|
||||
{
|
||||
this.transactionManagerLocatorMethod = transactionManagerLocatorMethod;
|
||||
}
|
||||
|
||||
public int getSetupAttempts()
|
||||
{
|
||||
return setupAttempts;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.activemq.ra;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.transaction.TransactionManager;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
@ -254,39 +253,6 @@ public final class ActiveMQRaUtils
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Resource adapter can't depend on any provider's specific library. Because of that we use reflection to locate the
|
||||
* transaction manager during startup.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* TODO: https://jira.jboss.org/browse/HORNETQ-417
|
||||
* We should use a proper SPI instead of reflection
|
||||
* We would need to define a proper SPI package for this.
|
||||
*/
|
||||
public static TransactionManager locateTM(final String locatorClass, final String locatorMethod)
|
||||
{
|
||||
return AccessController.doPrivileged(new PrivilegedAction<TransactionManager>()
|
||||
{
|
||||
public TransactionManager run()
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
Class<?> aClass = loader.loadClass(locatorClass);
|
||||
Object o = aClass.newInstance();
|
||||
Method m = aClass.getMethod(locatorMethod);
|
||||
return (TransactionManager) m.invoke(o);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
ActiveMQRALogger.LOGGER.debug(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Within AS7 the RA is loaded by JCA. properties can only be passed in String form. However if
|
||||
* RA is configured using jgroups stack, we need to pass a Channel object. As is impossible with
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
|
|||
import org.apache.activemq.ra.inflow.ActiveMQActivation;
|
||||
import org.apache.activemq.ra.inflow.ActiveMQActivationSpec;
|
||||
import org.apache.activemq.ra.recovery.RecoveryManager;
|
||||
import org.apache.activemq.service.extensions.ServiceUtils;
|
||||
import org.apache.activemq.utils.SensitiveDataCodec;
|
||||
import org.jgroups.JChannel;
|
||||
|
||||
|
@ -247,7 +248,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
|
|||
ActiveMQRALogger.LOGGER.trace("start(" + ctx + ")");
|
||||
}
|
||||
|
||||
locateTM();
|
||||
tm = ServiceUtils.getTransactionManager();
|
||||
|
||||
recoveryManager.start(useAutoRecovery);
|
||||
|
||||
|
@ -1810,24 +1811,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
|
|||
return defaultActiveMQConnectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param transactionManagerLocatorClass
|
||||
* @see ActiveMQRAProperties#setTransactionManagerLocatorClass(java.lang.String)
|
||||
*/
|
||||
public void setTransactionManagerLocatorClass(String transactionManagerLocatorClass)
|
||||
{
|
||||
raProperties.setTransactionManagerLocatorClass(transactionManagerLocatorClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see ActiveMQRAProperties#getTransactionManagerLocatorClass()
|
||||
*/
|
||||
public String getTransactionManagerLocatorClass()
|
||||
{
|
||||
return raProperties.getTransactionManagerLocatorClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see ActiveMQRAProperties#getJgroupsChannelLocatorClass()
|
||||
|
@ -1864,24 +1847,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
|
|||
raProperties.setJgroupsChannelRefName(jgroupsChannelRefName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see ActiveMQRAProperties#getTransactionManagerLocatorMethod()
|
||||
*/
|
||||
public String getTransactionManagerLocatorMethod()
|
||||
{
|
||||
return raProperties.getTransactionManagerLocatorMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param transactionManagerLocatorMethod
|
||||
* @see ActiveMQRAProperties#setTransactionManagerLocatorMethod(java.lang.String)
|
||||
*/
|
||||
public void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod)
|
||||
{
|
||||
raProperties.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod);
|
||||
}
|
||||
|
||||
public ActiveMQConnectionFactory createActiveMQConnectionFactory(final ConnectionFactoryProperties overrideProperties)
|
||||
{
|
||||
ActiveMQConnectionFactory cf;
|
||||
|
@ -2173,31 +2138,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
|
|||
return map;
|
||||
}
|
||||
|
||||
private void locateTM()
|
||||
{
|
||||
String[] locatorClasses = raProperties.getTransactionManagerLocatorClass().split(";");
|
||||
String[] locatorMethods = raProperties.getTransactionManagerLocatorMethod().split(";");
|
||||
|
||||
for (int i = 0; i < locatorClasses.length; i++)
|
||||
{
|
||||
tm = ActiveMQRaUtils.locateTM(locatorClasses[i], locatorMethods[i]);
|
||||
if (tm != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tm == null)
|
||||
{
|
||||
ActiveMQRALogger.LOGGER.noTXLocator();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveMQRALogger.LOGGER.debug("TM located = " + tm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setParams(final ActiveMQConnectionFactory cf,
|
||||
final ConnectionFactoryProperties overrideProperties)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
<groupId>org.jboss.logging</groupId>
|
||||
<artifactId>jboss-logging-processor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -16,10 +16,13 @@
|
|||
*/
|
||||
package org.apache.activemq.service.extensions;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.xa.XAResource;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.apache.activemq.service.extensions.transactions.TransactionManagerLocator;
|
||||
import org.apache.activemq.service.extensions.xa.ActiveMQXAResourceWrapper;
|
||||
import org.apache.activemq.service.extensions.xa.ActiveMQXAResourceWrapperFactory;
|
||||
import org.apache.activemq.service.extensions.xa.ActiveMQXAResourceWrapperFactoryImpl;
|
||||
|
@ -32,6 +35,10 @@ public class ServiceUtils
|
|||
{
|
||||
private static ActiveMQXAResourceWrapperFactory activeMQXAResourceWrapperFactory;
|
||||
|
||||
private static TransactionManager transactionManager;
|
||||
|
||||
private static boolean transactionManagerLoaded = false;
|
||||
|
||||
private static ActiveMQXAResourceWrapperFactory getActiveMQXAResourceWrapperFactory()
|
||||
{
|
||||
if (activeMQXAResourceWrapperFactory == null)
|
||||
|
@ -46,6 +53,20 @@ public class ServiceUtils
|
|||
return getActiveMQXAResourceWrapperFactory().wrap(xaResource, properties);
|
||||
}
|
||||
|
||||
public static synchronized TransactionManager getTransactionManager()
|
||||
{
|
||||
if (!transactionManagerLoaded)
|
||||
{
|
||||
Iterator<TransactionManagerLocator> it = ServiceLoader.load(TransactionManagerLocator.class).iterator();
|
||||
if (it.hasNext())
|
||||
{
|
||||
transactionManager = it.next().getTransactionManager();
|
||||
}
|
||||
transactionManagerLoaded = true;
|
||||
}
|
||||
return transactionManager;
|
||||
}
|
||||
|
||||
private static void setActiveMQXAResourceWrapperFactory(Iterable<ActiveMQXAResourceWrapperFactory> iterable)
|
||||
{
|
||||
if (iterable.iterator().hasNext())
|
||||
|
|
|
@ -14,19 +14,14 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.integration.jboss.tm;
|
||||
package org.apache.activemq.service.extensions.transactions;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
import org.jboss.tm.TransactionManagerLocator;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
*/
|
||||
public class JBoss4TransactionManagerLocator
|
||||
public interface TransactionManagerLocator
|
||||
{
|
||||
public TransactionManager getTm()
|
||||
{
|
||||
return TransactionManagerLocator.getInstance().locate();
|
||||
}
|
||||
TransactionManager getTransactionManager();
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* 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.service.extensions.tests.transactions;
|
||||
|
||||
import org.apache.activemq.service.extensions.transactions.TransactionManagerLocator;
|
||||
|
||||
import javax.transaction.HeuristicMixedException;
|
||||
import javax.transaction.HeuristicRollbackException;
|
||||
import javax.transaction.InvalidTransactionException;
|
||||
import javax.transaction.NotSupportedException;
|
||||
import javax.transaction.RollbackException;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.Transaction;
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
*/
|
||||
public class DummyTransactionManagerLocator implements TransactionManagerLocator,TransactionManager
|
||||
{
|
||||
@Override
|
||||
public void begin() throws NotSupportedException, SystemException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() throws SystemException
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction getTransaction() throws SystemException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume(Transaction transaction) throws IllegalStateException, InvalidTransactionException, SystemException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback() throws IllegalStateException, SecurityException, SystemException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRollbackOnly() throws IllegalStateException, SystemException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransactionTimeout(int i) throws SystemException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction suspend() throws SystemException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionManager getTransactionManager()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -14,19 +14,21 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.integration.jboss.tm;
|
||||
package org.apache.activemq.service.extensions.tests.transactions;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
import org.jboss.tm.TransactionManagerLocator;
|
||||
import org.apache.activemq.service.extensions.ServiceUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
*/
|
||||
public class JBoss5TransactionManagerLocator
|
||||
public class TransactionManagerLocatorTest extends Assert
|
||||
{
|
||||
public TransactionManager getTm()
|
||||
@Test
|
||||
public void getTM()
|
||||
{
|
||||
return TransactionManagerLocator.locateTransactionManager();
|
||||
assertNotNull(ServiceUtils.getTransactionManager());
|
||||
assertEquals(ServiceUtils.getTransactionManager().getClass(), DummyTransactionManagerLocator.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.apache.activemq.service.extensions.tests.transactions.DummyTransactionManagerLocator
|
|
@ -1,61 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-pom</artifactId>
|
||||
<version>6.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>activemq-jboss-as-integration</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>ActiveMQ6 JBoss AS Integration</name>
|
||||
|
||||
<properties>
|
||||
<activemq.basedir>${project.basedir}/../..</activemq.basedir>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jboss.logging</groupId>
|
||||
<artifactId>jboss-logging-processor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
JBoss Logging
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.jboss.logging</groupId>
|
||||
<artifactId>jboss-logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.security</groupId>
|
||||
<artifactId>jboss-security-spi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.security</groupId>
|
||||
<artifactId>jbosssx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-ejb_3.0_spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss</groupId>
|
||||
<artifactId>jboss-transaction-spi</artifactId>
|
||||
</dependency>
|
||||
<!--this for xa recovery-->
|
||||
<dependency>
|
||||
<groupId>org.jboss.jbossts.jts</groupId>
|
||||
<artifactId>jbossjts-jacorb</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* 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.integration.jboss;
|
||||
|
||||
|
||||
import org.jboss.logging.annotations.MessageBundle;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
* 3/12/12
|
||||
*
|
||||
* Logger Code 13
|
||||
*
|
||||
* each message id must be 6 digits long starting with 13, the 3rd digit should be 9
|
||||
*
|
||||
* so 139000 to 139999
|
||||
*/
|
||||
@MessageBundle(projectCode = "AMQ")
|
||||
public class ActiveMQJBossBundle
|
||||
{
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
* 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.integration.jboss;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.annotations.Cause;
|
||||
import org.jboss.logging.annotations.LogMessage;
|
||||
import org.jboss.logging.annotations.Message;
|
||||
import org.jboss.logging.annotations.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
* 3/15/12
|
||||
*
|
||||
* Logger Code 13
|
||||
*
|
||||
* each message id must be 6 digits long starting with 13, the 3rd digit donates the level so
|
||||
*
|
||||
* INF0 1
|
||||
* WARN 2
|
||||
* DEBUG 3
|
||||
* ERROR 4
|
||||
* TRACE 5
|
||||
* FATAL 6
|
||||
*
|
||||
* so an INFO message would be 131000 to 131999
|
||||
*/
|
||||
@MessageLogger(projectCode = "AMQ")
|
||||
public interface ActiveMQJBossLogger extends BasicLogger
|
||||
{
|
||||
/**
|
||||
* The jboss integration logger.
|
||||
*/
|
||||
ActiveMQJBossLogger LOGGER = Logger.getMessageLogger(ActiveMQJBossLogger.class, ActiveMQJBossLogger.class.getPackage().getName());
|
||||
|
||||
@LogMessage(level = Logger.Level.INFO)
|
||||
@Message(id = 131001, value = "Security Context Setting Subject = {0}",
|
||||
format = Message.Format.MESSAGE_FORMAT)
|
||||
void settingSecuritySubject(Subject subject);
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 132001, value = "An error happened while setting the context",
|
||||
format = Message.Format.MESSAGE_FORMAT)
|
||||
void errorSettingSecurityContext(@Cause Throwable Throwable);
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* 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.integration.jboss.security;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.jboss.security.SecurityAssociation;
|
||||
|
||||
/** A collection of privileged actions for this package
|
||||
* @author Scott.Stark@jboss.org
|
||||
* @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
|
||||
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
|
||||
* @author <a href="mailto:anil.saldhana@jboss.com">anil saldhana</a>
|
||||
* @version $Revison: 1.0$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
* Created Oct 21, 2009
|
||||
*/
|
||||
public class AS4SecurityActions
|
||||
{
|
||||
interface PrincipalInfoAction
|
||||
{
|
||||
PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction()
|
||||
{
|
||||
public void push(final Principal principal, final Object credential, final Subject subject)
|
||||
{
|
||||
AccessController.doPrivileged(new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
SecurityAssociation.pushSubjectContext(subject, principal, credential);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void dup()
|
||||
{
|
||||
AccessController.doPrivileged(new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
SecurityAssociation.dupSubjectContext();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void pop()
|
||||
{
|
||||
AccessController.doPrivileged(new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
SecurityAssociation.popSubjectContext();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction()
|
||||
{
|
||||
public void push(final Principal principal, final Object credential, final Subject subject)
|
||||
{
|
||||
SecurityAssociation.pushSubjectContext(subject, principal, credential);
|
||||
}
|
||||
|
||||
public void dup()
|
||||
{
|
||||
SecurityAssociation.dupSubjectContext();
|
||||
}
|
||||
|
||||
public void pop()
|
||||
{
|
||||
SecurityAssociation.popSubjectContext();
|
||||
}
|
||||
};
|
||||
|
||||
void push(Principal principal, Object credential, Subject subject);
|
||||
|
||||
void dup();
|
||||
|
||||
void pop();
|
||||
}
|
||||
|
||||
static void pushSubjectContext(final Principal principal, final Object credential, final Subject subject)
|
||||
{
|
||||
if (System.getSecurityManager() == null)
|
||||
{
|
||||
PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject);
|
||||
}
|
||||
}
|
||||
|
||||
static void popSubjectContext()
|
||||
{
|
||||
if (System.getSecurityManager() == null)
|
||||
{
|
||||
PrincipalInfoAction.NON_PRIVILEGED.pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrincipalInfoAction.PRIVILEGED.pop();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,313 +0,0 @@
|
|||
/**
|
||||
* 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.integration.jboss.security;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.naming.InitialContext;
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.apache.activemq.core.security.CheckType;
|
||||
import org.apache.activemq.core.security.Role;
|
||||
import org.apache.activemq.core.server.ActiveMQComponent;
|
||||
import org.apache.activemq.integration.jboss.ActiveMQJBossLogger;
|
||||
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
|
||||
import org.jboss.security.AuthenticationManager;
|
||||
import org.jboss.security.RealmMapping;
|
||||
import org.jboss.security.SecurityContext;
|
||||
import org.jboss.security.SecurityContextAssociation;
|
||||
import org.jboss.security.SimplePrincipal;
|
||||
|
||||
/**
|
||||
* This implementation delegates to the JBoss AS security interfaces (which in turn use JAAS)
|
||||
* It can be used when running ActiveMQ in JBoss AS
|
||||
*
|
||||
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
|
||||
* @author <a href="tim.fox@jboss.com">Tim Fox</a>
|
||||
*/
|
||||
public class JBossASSecurityManager implements ActiveMQSecurityManager, ActiveMQComponent
|
||||
{
|
||||
// Static --------------------------------------------------------
|
||||
|
||||
// Attributes ----------------------------------------------------
|
||||
|
||||
private final boolean trace = ActiveMQJBossLogger.LOGGER.isTraceEnabled();
|
||||
|
||||
/**
|
||||
* the realmmapping
|
||||
*/
|
||||
private RealmMapping realmMapping;
|
||||
|
||||
/**
|
||||
* the JAAS Authentication Manager
|
||||
*/
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
/**
|
||||
* The JNDI name of the AuthenticationManager(and RealmMapping since they are the same object).
|
||||
*/
|
||||
private String securityDomainName = "java:/jaas/activemq";
|
||||
|
||||
private boolean started;
|
||||
|
||||
private boolean isAs5 = true;
|
||||
|
||||
private boolean allowClientLogin = false;
|
||||
|
||||
private boolean authoriseOnClientLogin = false;
|
||||
|
||||
public boolean validateUser(final String user, final String password)
|
||||
{
|
||||
SimplePrincipal principal = new SimplePrincipal(user);
|
||||
|
||||
char[] passwordChars = null;
|
||||
|
||||
if (password != null)
|
||||
{
|
||||
passwordChars = password.toCharArray();
|
||||
}
|
||||
|
||||
Subject subject = new Subject();
|
||||
|
||||
return authenticationManager.isValid(principal, passwordChars, subject);
|
||||
}
|
||||
|
||||
public boolean validateUserAndRole(final String user,
|
||||
final String password,
|
||||
final Set<Role> roles,
|
||||
final CheckType checkType)
|
||||
{
|
||||
if (allowClientLogin && SecurityContextAssociation.isClient())
|
||||
{
|
||||
return authoriseOnClientLogin ? useClientAuthentication(roles, checkType) : true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return useConnectionAuthentication(user, password, roles, checkType);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean useConnectionAuthentication(final String user,
|
||||
final String password,
|
||||
final Set<Role> roles,
|
||||
final CheckType checkType)
|
||||
{
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>()
|
||||
{
|
||||
public Boolean run()
|
||||
{
|
||||
|
||||
SimplePrincipal principal = user == null ? null : new SimplePrincipal(user);
|
||||
|
||||
char[] passwordChars = null;
|
||||
|
||||
if (password != null)
|
||||
{
|
||||
passwordChars = password.toCharArray();
|
||||
}
|
||||
|
||||
Subject subject = new Subject();
|
||||
|
||||
boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
|
||||
// Authenticate. Successful authentication will place a new SubjectContext on thread local,
|
||||
// which will be used in the authorization process. However, we need to make sure we clean up
|
||||
// thread local immediately after we used the information, otherwise some other people
|
||||
// security my be screwed up, on account of thread local security stack being corrupted.
|
||||
if (authenticated)
|
||||
{
|
||||
pushSecurityContext(principal, passwordChars, subject);
|
||||
Set<Principal> rolePrincipals = getRolePrincipals(checkType, roles);
|
||||
|
||||
authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals);
|
||||
|
||||
if (trace)
|
||||
{
|
||||
ActiveMQJBossLogger.LOGGER.trace("user " + user +
|
||||
(authenticated ? " is " : " is NOT ") +
|
||||
"authorized");
|
||||
}
|
||||
popSecurityContext();
|
||||
}
|
||||
return authenticated;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean useClientAuthentication(final Set<Role> roles, final CheckType checkType)
|
||||
{
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>()
|
||||
{
|
||||
public Boolean run()
|
||||
{
|
||||
SecurityContext sc = SecurityContextAssociation.getSecurityContext();
|
||||
Principal principal = sc.getUtil().getUserPrincipal();
|
||||
|
||||
char[] passwordChars = (char[])sc.getUtil().getCredential();
|
||||
|
||||
Subject subject = sc.getSubjectInfo().getAuthenticatedSubject();
|
||||
|
||||
boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
|
||||
|
||||
if (authenticated)
|
||||
{
|
||||
Set<Principal> rolePrincipals = getRolePrincipals(checkType, roles);
|
||||
|
||||
authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals);
|
||||
|
||||
if (trace)
|
||||
{
|
||||
ActiveMQJBossLogger.LOGGER.trace("user " + principal.getName() +
|
||||
(authenticated ? " is " : " is NOT ") +
|
||||
"authorized");
|
||||
}
|
||||
}
|
||||
return authenticated;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void popSecurityContext()
|
||||
{
|
||||
if (isAs5)
|
||||
{
|
||||
SecurityActions.popSubjectContext();
|
||||
}
|
||||
else
|
||||
{
|
||||
AS4SecurityActions.popSubjectContext();
|
||||
}
|
||||
}
|
||||
|
||||
private void pushSecurityContext(final SimplePrincipal principal, final char[] passwordChars, final Subject subject)
|
||||
{
|
||||
if (isAs5)
|
||||
{
|
||||
SecurityActions.pushSubjectContext(principal, passwordChars, subject, securityDomainName);
|
||||
}
|
||||
else
|
||||
{
|
||||
AS4SecurityActions.pushSubjectContext(principal, passwordChars, subject);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRole(final String user, final String role)
|
||||
{
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void addUser(final String user, final String password)
|
||||
{
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void removeRole(final String user, final String role)
|
||||
{
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void removeUser(final String user)
|
||||
{
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void setDefaultUser(final String username)
|
||||
{
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
private Set<Principal> getRolePrincipals(final CheckType checkType, final Set<Role> roles)
|
||||
{
|
||||
Set<Principal> principals = new HashSet<Principal>();
|
||||
for (Role role : roles)
|
||||
{
|
||||
if (checkType.hasRole(role))
|
||||
{
|
||||
principals.add(new SimplePrincipal(role.getName()));
|
||||
}
|
||||
}
|
||||
return principals;
|
||||
}
|
||||
|
||||
public void setRealmMapping(final RealmMapping realmMapping)
|
||||
{
|
||||
this.realmMapping = realmMapping;
|
||||
}
|
||||
|
||||
public void setAuthenticationManager(final AuthenticationManager authenticationManager)
|
||||
{
|
||||
this.authenticationManager = authenticationManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* lifecycle method, needs to be called
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public synchronized void start() throws Exception
|
||||
{
|
||||
if (started)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InitialContext ic = new InitialContext();
|
||||
authenticationManager = (AuthenticationManager)ic.lookup(securityDomainName);
|
||||
realmMapping = (RealmMapping)authenticationManager;
|
||||
|
||||
started = true;
|
||||
}
|
||||
|
||||
public synchronized void stop()
|
||||
{
|
||||
if (!started)
|
||||
{
|
||||
return;
|
||||
}
|
||||
started = false;
|
||||
}
|
||||
|
||||
public synchronized boolean isStarted()
|
||||
{
|
||||
return started;
|
||||
}
|
||||
|
||||
public void setSecurityDomainName(final String securityDomainName)
|
||||
{
|
||||
this.securityDomainName = securityDomainName;
|
||||
}
|
||||
|
||||
public void setAs5(final boolean as5)
|
||||
{
|
||||
isAs5 = as5;
|
||||
}
|
||||
|
||||
public void setAllowClientLogin(final boolean allowClientLogin)
|
||||
{
|
||||
this.allowClientLogin = allowClientLogin;
|
||||
}
|
||||
|
||||
public void setAuthoriseOnClientLogin(final boolean authoriseOnClientLogin)
|
||||
{
|
||||
this.authoriseOnClientLogin = authoriseOnClientLogin;
|
||||
}
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
/**
|
||||
* 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.integration.jboss.security;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.apache.activemq.integration.jboss.ActiveMQJBossLogger;
|
||||
import org.jboss.security.SecurityContext;
|
||||
import org.jboss.security.SecurityContextAssociation;
|
||||
import org.jboss.security.SecurityContextFactory;
|
||||
|
||||
/** A collection of privileged actions for this package
|
||||
* @author Scott.Stark@jboss.org
|
||||
* @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
|
||||
* @author <a her="mailto:tim.fox@jboss.com">Tim Fox</a>
|
||||
* @version $Revison: 1.0$
|
||||
*/
|
||||
class SecurityActions
|
||||
{
|
||||
interface PrincipalInfoAction
|
||||
{
|
||||
PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction()
|
||||
{
|
||||
public void push(final Principal principal,
|
||||
final Object credential,
|
||||
final Subject subject,
|
||||
final String securityDomain)
|
||||
{
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
ActiveMQJBossLogger.LOGGER.settingSecuritySubject(subject);
|
||||
// SecurityAssociation.pushSubjectContext(subject, principal, credential);
|
||||
SecurityContext sc = SecurityContextAssociation.getSecurityContext();
|
||||
if (sc == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
sc = SecurityContextFactory.createSecurityContext(principal,
|
||||
credential,
|
||||
subject,
|
||||
securityDomain);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.getUtil().createSubjectInfo(principal, credential, subject);
|
||||
}
|
||||
|
||||
SecurityContextAssociation.setSecurityContext(sc);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
ActiveMQJBossLogger.LOGGER.errorSettingSecurityContext(t);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void pop()
|
||||
{
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
// SecurityAssociation.popSubjectContext();
|
||||
SecurityContextAssociation.clearSecurityContext();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction()
|
||||
{
|
||||
public void push(final Principal principal,
|
||||
final Object credential,
|
||||
final Subject subject,
|
||||
final String securityDomain)
|
||||
{
|
||||
// SecurityAssociation.pushSubjectContext(subject, principal, credential);
|
||||
SecurityContext sc = SecurityContextAssociation.getSecurityContext();
|
||||
if (sc == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
sc = SecurityContextFactory.createSecurityContext(principal, credential, subject, securityDomain);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.getUtil().createSubjectInfo(principal, credential, subject);
|
||||
}
|
||||
SecurityContextAssociation.setSecurityContext(sc);
|
||||
}
|
||||
|
||||
public void pop()
|
||||
{
|
||||
// SecurityAssociation.popSubjectContext();
|
||||
SecurityContextAssociation.clearSecurityContext();
|
||||
}
|
||||
};
|
||||
|
||||
void push(Principal principal, Object credential, Subject subject, String securityDomain);
|
||||
|
||||
void pop();
|
||||
}
|
||||
|
||||
static void pushSubjectContext(final Principal principal,
|
||||
final Object credential,
|
||||
final Subject subject,
|
||||
final String securityDomainName)
|
||||
{
|
||||
if (System.getSecurityManager() == null)
|
||||
{
|
||||
PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject, securityDomainName);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject, securityDomainName);
|
||||
}
|
||||
}
|
||||
|
||||
static void popSubjectContext()
|
||||
{
|
||||
if (System.getSecurityManager() == null)
|
||||
{
|
||||
PrincipalInfoAction.NON_PRIVILEGED.pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrincipalInfoAction.PRIVILEGED.pop();
|
||||
}
|
||||
}
|
||||
}
|
9
pom.xml
9
pom.xml
|
@ -220,6 +220,11 @@
|
|||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--this specifically for the JMS Bridge-->
|
||||
<dependency>
|
||||
|
@ -489,7 +494,6 @@
|
|||
<module>activemq-rest</module>
|
||||
<module>activemq-tools</module>
|
||||
<module>activemq-service-extensions</module>
|
||||
<module>integration/activemq-jboss-as-integration</module>
|
||||
<module>integration/activemq-spring-integration</module>
|
||||
<module>integration/activemq-aerogear-integration</module>
|
||||
<module>integration/activemq-vertx-integration</module>
|
||||
|
@ -517,7 +521,6 @@
|
|||
<module>activemq-rest</module>
|
||||
<module>activemq-tools</module>
|
||||
<module>activemq-service-extensions</module>
|
||||
<module>integration/activemq-jboss-as-integration</module>
|
||||
<module>integration/activemq-spring-integration</module>
|
||||
<module>integration/activemq-aerogear-integration</module>
|
||||
<module>integration/activemq-vertx-integration</module>
|
||||
|
@ -555,7 +558,6 @@
|
|||
<module>activemq-rest</module>
|
||||
<module>activemq-tools</module>
|
||||
<module>activemq-service-extensions</module>
|
||||
<module>integration/activemq-jboss-as-integration</module>
|
||||
<module>integration/activemq-spring-integration</module>
|
||||
<module>integration/activemq-aerogear-integration</module>
|
||||
<module>integration/activemq-vertx-integration</module>
|
||||
|
@ -589,7 +591,6 @@
|
|||
<module>activemq-rest</module>
|
||||
<module>activemq-tools</module>
|
||||
<module>activemq-service-extensions</module>
|
||||
<module>integration/activemq-jboss-as-integration</module>
|
||||
<module>integration/activemq-spring-integration</module>
|
||||
<module>integration/activemq-aerogear-integration</module>
|
||||
<module>integration/activemq-vertx-integration</module>
|
||||
|
|
|
@ -90,9 +90,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase
|
|||
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
|
||||
resourceAdapter = qResourceAdapter;
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass(DummyTMLocator.class.getName());
|
||||
qResourceAdapter.setTransactionManagerLocatorMethod("getTM");
|
||||
|
||||
MyBootstrapContext ctx = new MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setConnectorClassName(NETTY_CONNECTOR_FACTORY);
|
||||
|
@ -170,9 +167,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase
|
|||
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
|
||||
resourceAdapter = qResourceAdapter;
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass(DummyTMLocator.class.getName());
|
||||
qResourceAdapter.setTransactionManagerLocatorMethod("getTM");
|
||||
|
||||
MyBootstrapContext ctx = new MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setConnectorClassName(NETTY_CONNECTOR_FACTORY);
|
||||
|
|
|
@ -2371,8 +2371,6 @@ public class JMSBridgeTest extends BridgeTestBase
|
|||
null,
|
||||
null,
|
||||
false);
|
||||
bridge.setTransactionManagerLocatorClass(this.getClass().getName());
|
||||
bridge.setTransactionManagerLocatorMethod("getNewTm");
|
||||
bridge.start();
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -197,8 +197,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase
|
|||
protected ActiveMQResourceAdapter newResourceAdapter()
|
||||
{
|
||||
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.setTransactionManagerLocatorMethod("");
|
||||
qResourceAdapter.setConnectorClassName(UnitTestCase.INVM_CONNECTOR_FACTORY);
|
||||
return qResourceAdapter;
|
||||
}
|
||||
|
@ -209,8 +207,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase
|
|||
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
|
||||
qResourceAdapter.setReconnectAttempts(-1);
|
||||
qResourceAdapter.setCallTimeout(500L);
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.setTransactionManagerLocatorMethod("");
|
||||
qResourceAdapter.setRetryInterval(500L);
|
||||
MyBootstrapContext ctx = new MyBootstrapContext();
|
||||
qResourceAdapter.start(ctx);
|
||||
|
@ -551,8 +547,6 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase
|
|||
public void testNonDurableSubscriptionDeleteAfterCrash() throws Exception
|
||||
{
|
||||
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.setTransactionManagerLocatorMethod("");
|
||||
MyBootstrapContext ctx = new MyBootstrapContext();
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
|
|
|
@ -99,9 +99,6 @@ public abstract class ActiveMQRATestBase extends JMSTestBase
|
|||
protected ActiveMQResourceAdapter newResourceAdapter()
|
||||
{
|
||||
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
|
||||
// We don't have a TM on these tests.. This would cause the lookup to take at least 10 seconds if we didn't set to ""
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.setTransactionManagerLocatorMethod("");
|
||||
qResourceAdapter.setConnectorClassName(UnitTestCase.INVM_CONNECTOR_FACTORY);
|
||||
return qResourceAdapter;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,6 @@ public class JMSContextTest extends ActiveMQRATestBase
|
|||
roles.add(role);
|
||||
server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles);
|
||||
resourceAdapter = new ActiveMQResourceAdapter();
|
||||
resourceAdapter.setTransactionManagerLocatorClass(JMSContextTest.class.getName());
|
||||
resourceAdapter.setTransactionManagerLocatorMethod("getTm");
|
||||
|
||||
resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName());
|
||||
MyBootstrapContext ctx = new MyBootstrapContext();
|
||||
|
|
|
@ -96,8 +96,6 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase
|
|||
server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles);
|
||||
|
||||
resourceAdapter = new ActiveMQResourceAdapter();
|
||||
resourceAdapter.setTransactionManagerLocatorClass(JMSContextTest.class.getName());
|
||||
resourceAdapter.setTransactionManagerLocatorMethod("getTm");
|
||||
resourceAdapter.setEntries("[\"java://jmsXA\"]");
|
||||
|
||||
resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName());
|
||||
|
@ -288,8 +286,6 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase
|
|||
{
|
||||
setupDLQ(10);
|
||||
resourceAdapter = newResourceAdapter();
|
||||
resourceAdapter.setTransactionManagerLocatorClass(JMSContextTest.class.getName());
|
||||
resourceAdapter.setTransactionManagerLocatorMethod("getTm");
|
||||
DummyTransactionManager.tm.tx = new DummyTransaction();
|
||||
MyBootstrapContext ctx = new MyBootstrapContext();
|
||||
resourceAdapter.start(ctx);
|
||||
|
|
|
@ -69,8 +69,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
ra.setConnectorClassName("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory");
|
||||
ra.setUserName("userGlobal");
|
||||
ra.setPassword("passwordGlobal");
|
||||
ra.setTransactionManagerLocatorClass("");
|
||||
ra.setTransactionManagerLocatorMethod("");
|
||||
ra.start(new org.apache.activemq.tests.unit.ra.BootstrapContext());
|
||||
|
||||
Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection();
|
||||
|
@ -131,7 +129,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectorClassName(UnitTestCase.INVM_CONNECTOR_FACTORY);
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -363,7 +360,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -390,7 +386,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -419,7 +414,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -446,7 +440,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setDiscoveryInitialWaitTimeout(1L);
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -469,10 +462,8 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
|
||||
qResourceAdapter.setDiscoveryAddress("231.7.7.7");
|
||||
|
||||
// qResourceAdapter.getTransactionManagerLocatorClass
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
|
@ -504,7 +495,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setHA(true);
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -528,7 +518,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -552,7 +541,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -577,7 +565,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setReconnectAttempts(100);
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -601,7 +588,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -625,7 +611,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setConnectionParameters("server-id=0");
|
||||
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
spec.setResourceAdapter(qResourceAdapter);
|
||||
|
@ -654,7 +639,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
qResourceAdapter.setUseMaskedPassword(true);
|
||||
qResourceAdapter.setPassword(mask);
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
|
||||
assertEquals("helloworld", qResourceAdapter.getPassword());
|
||||
|
@ -699,7 +683,6 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
|
|||
|
||||
qResourceAdapter.setPassword(mask);
|
||||
|
||||
qResourceAdapter.setTransactionManagerLocatorClass("");
|
||||
qResourceAdapter.start(ctx);
|
||||
|
||||
assertEquals("helloworld", qResourceAdapter.getPassword());
|
||||
|
|
|
@ -280,18 +280,6 @@ public class ActiveMQResourceAdapterConfigTest extends UnitTestCase
|
|||
" <config-property-type>long</config-property-type>\n" +
|
||||
" <config-property-value></config-property-value>\n" +
|
||||
" </config-property>\n" +
|
||||
" <config-property>" +
|
||||
" <description></description>" +
|
||||
" <config-property-name>TransactionManagerLocatorMethod</config-property-name>" +
|
||||
" <config-property-type>java.lang.String</config-property-type>" +
|
||||
" <config-property-value></config-property-value>" +
|
||||
" </config-property>" +
|
||||
" <config-property>" +
|
||||
" <description></description>" +
|
||||
" <config-property-name>TransactionManagerLocatorClass</config-property-name>" +
|
||||
" <config-property-type>java.lang.String</config-property-type>" +
|
||||
" <config-property-value></config-property-value>" +
|
||||
" </config-property>" +
|
||||
" <config-property>\n" +
|
||||
" <description>How many attempts should be made when connecting the MDB</description>\n" +
|
||||
" <config-property-name>SetupAttempts</config-property-name>\n" +
|
||||
|
|
|
@ -50,8 +50,6 @@ public class ConnectionFactoryPropertiesTest extends UnitTestCase
|
|||
UNSUPPORTED_RA_PROPERTIES.add("discoveryInitialWaitTimeout");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("connectionParameters");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("connectorClassName");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("transactionManagerLocatorClass");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("transactionManagerLocatorMethod");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("managedConnectionFactory");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("jndiParams");
|
||||
UNSUPPORTED_RA_PROPERTIES.add("password");
|
||||
|
|
|
@ -476,8 +476,6 @@ public class ResourceAdapterTest extends ServiceTestBase
|
|||
ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
|
||||
ra.setUserName("userGlobal");
|
||||
ra.setPassword("passwordGlobal");
|
||||
ra.setTransactionManagerLocatorClass("");
|
||||
ra.setTransactionManagerLocatorMethod("");
|
||||
ra.start(new org.apache.activemq.tests.unit.ra.BootstrapContext());
|
||||
|
||||
Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection();
|
||||
|
@ -532,8 +530,6 @@ public class ResourceAdapterTest extends ServiceTestBase
|
|||
ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
|
||||
ra.setUserName("badUser");
|
||||
ra.setPassword("badPassword");
|
||||
ra.setTransactionManagerLocatorClass("");
|
||||
ra.setTransactionManagerLocatorMethod("");
|
||||
ra.start(new org.apache.activemq.tests.unit.ra.BootstrapContext());
|
||||
|
||||
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
|
||||
|
|
Loading…
Reference in New Issue