a minor refactor to make it easier to extend ConnectionInfo/ConnectionContext without having to change code in the AbstractConnection in the future - such as to support new certificate or security token mechanisms. For background see thread: http://www.nabble.com/Certificate-login-tf2029724.html#a5583011

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@427507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-08-01 09:50:46 +00:00
parent c45c69b30a
commit 794acb667c
2 changed files with 12 additions and 6 deletions

View File

@ -541,19 +541,15 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
public Response processAddConnection(ConnectionInfo info) throws Exception {
// Setup the context.
String clientId = info.getClientId();
ConnectionContext context = new ConnectionContext();
ConnectionContext context = new ConnectionContext(info);
context.setConnection(this);
context.setBroker(broker);
context.setConnector(connector);
context.setTransactions(new ConcurrentHashMap());
context.setClientId(clientId);
context.setUserName(info.getUserName());
context.setConnectionId(info.getConnectionId());
context.setWireFormatInfo(wireFormatInfo);
this.manageable = info.isManageable();
connectionStates.put(info.getConnectionId(), new ConnectionState(info, context));
broker.addConnection(context, info);
if (info.isManageable() && broker.isFaultTolerantConfiguration()){

View File

@ -21,6 +21,7 @@ import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
import org.apache.activemq.broker.region.MessageReference;
import org.apache.activemq.command.ConnectionId;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.command.WireFormatInfo;
import org.apache.activemq.filter.MessageEvaluationContext;
import org.apache.activemq.security.MessageAuthorizationPolicy;
@ -54,6 +55,15 @@ public class ConnectionContext {
private final MessageEvaluationContext messageEvaluationContext = new MessageEvaluationContext();
public ConnectionContext() {
}
public ConnectionContext(ConnectionInfo info) {
setClientId(info.getClientId());
setUserName(info.getUserName());
setConnectionId(info.getConnectionId());
}
public SecurityContext getSecurityContext() {
return securityContext;
}