You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2012/08/29 12:32:11 UTC
svn commit: r1378496 [2/3] - in /qpid/trunk/qpid/java:
bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/
broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/
broker/ broker/src/main/java/org/...
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java Wed Aug 29 10:32:08 2012
@@ -23,7 +23,6 @@ package org.apache.qpid.server.store.der
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
@@ -41,7 +40,6 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -55,12 +53,9 @@ import org.apache.qpid.framing.AMQShortS
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.federation.Bridge;
-import org.apache.qpid.server.federation.BrokerLink;
import org.apache.qpid.server.message.EnqueableMessage;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler;
-import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler;
import org.apache.qpid.server.store.ConfiguredObjectHelper;
import org.apache.qpid.server.store.ConfiguredObjectRecord;
import org.apache.qpid.server.store.Event;
@@ -572,8 +567,7 @@ public class DerbyMessageStore implement
BindingRecoveryHandler brh = qrh.completeQueueRecovery();
_configuredObjectHelper.recoverBindings(brh, configuredObjects);
- BrokerLinkRecoveryHandler lrh = brh.completeBindingRecovery();
- recoverBrokerLinks(lrh);
+ brh.completeBindingRecovery();
}
catch (SQLException e)
{
@@ -581,144 +575,6 @@ public class DerbyMessageStore implement
}
}
- private void recoverBrokerLinks(final ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler lrh)
- throws SQLException
- {
- _logger.info("Recovering broker links...");
-
- Connection conn = null;
- try
- {
- conn = newAutoCommitConnection();
-
- PreparedStatement stmt = conn.prepareStatement(SELECT_ALL_FROM_LINKS);
-
- try
- {
- ResultSet rs = stmt.executeQuery();
-
- try
- {
-
- while(rs.next())
- {
- UUID id = new UUID(rs.getLong(2), rs.getLong(1));
- long createTime = rs.getLong(3);
- Blob argumentsAsBlob = rs.getBlob(4);
-
- byte[] dataAsBytes = argumentsAsBlob.getBytes(1,(int) argumentsAsBlob.length());
-
- DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dataAsBytes));
- int size = dis.readInt();
-
- Map<String,String> arguments = new HashMap<String, String>();
-
- for(int i = 0; i < size; i++)
- {
- arguments.put(dis.readUTF(), dis.readUTF());
- }
-
- ConfigurationRecoveryHandler.BridgeRecoveryHandler brh = lrh.brokerLink(id, createTime, arguments);
-
- recoverBridges(brh, id);
-
- }
- }
- catch (IOException e)
- {
- throw new SQLException(e.getMessage(), e);
- }
- finally
- {
- rs.close();
- }
- }
- finally
- {
- stmt.close();
- }
-
- }
- finally
- {
- if(conn != null)
- {
- conn.close();
- }
- }
-
- }
-
- private void recoverBridges(final ConfigurationRecoveryHandler.BridgeRecoveryHandler brh, final UUID linkId)
- throws SQLException
- {
- _logger.info("Recovering bridges for link " + linkId + "...");
-
- Connection conn = null;
- try
- {
- conn = newAutoCommitConnection();
-
- PreparedStatement stmt = conn.prepareStatement(SELECT_ALL_FROM_BRIDGES);
-
- try
- {
- stmt.setLong(1, linkId.getLeastSignificantBits());
- stmt.setLong(2, linkId.getMostSignificantBits());
-
- ResultSet rs = stmt.executeQuery();
-
- try
- {
-
- while(rs.next())
- {
- UUID id = new UUID(rs.getLong(2), rs.getLong(1));
- long createTime = rs.getLong(3);
- Blob argumentsAsBlob = rs.getBlob(6);
-
- byte[] dataAsBytes = argumentsAsBlob.getBytes(1,(int) argumentsAsBlob.length());
-
- DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dataAsBytes));
- int size = dis.readInt();
-
- Map<String,String> arguments = new HashMap<String, String>();
-
- for(int i = 0; i < size; i++)
- {
- arguments.put(dis.readUTF(), dis.readUTF());
- }
-
- brh.bridge(id, createTime, arguments);
-
- }
- brh.completeBridgeRecoveryForLink();
- }
- catch (IOException e)
- {
- throw new SQLException(e.getMessage(), e);
- }
- finally
- {
- rs.close();
- }
- }
- finally
- {
- stmt.close();
- }
-
- }
- finally
- {
- if(conn != null)
- {
- conn.close();
- }
- }
-
- }
-
@Override
public void close() throws Exception
{
@@ -975,71 +831,6 @@ public class DerbyMessageStore implement
}
}
- @Override
- public void createBrokerLink(final BrokerLink link) throws AMQStoreException
- {
- _logger.debug("public void createBrokerLink(BrokerLink = " + link + "): called");
-
- if (_stateManager.isInState(State.ACTIVE))
- {
- try
- {
- Connection conn = newAutoCommitConnection();
-
- PreparedStatement stmt = conn.prepareStatement(FIND_LINK);
- try
- {
-
- stmt.setLong(1, link.getQMFId().getLeastSignificantBits());
- stmt.setLong(2, link.getQMFId().getMostSignificantBits());
- ResultSet rs = stmt.executeQuery();
- try
- {
-
- // If we don't have any data in the result set then we can add this queue
- if (!rs.next())
- {
- PreparedStatement insertStmt = conn.prepareStatement(INSERT_INTO_LINKS);
-
- try
- {
-
- insertStmt.setLong(1, link.getQMFId().getLeastSignificantBits());
- insertStmt.setLong(2, link.getQMFId().getMostSignificantBits());
- insertStmt.setLong(3, link.getCreateTime());
-
- byte[] argumentBytes = convertStringMapToBytes(link.getArguments());
- ByteArrayInputStream bis = new ByteArrayInputStream(argumentBytes);
-
- insertStmt.setBinaryStream(4,bis,argumentBytes.length);
-
- insertStmt.execute();
- }
- finally
- {
- insertStmt.close();
- }
- }
- }
- finally
- {
- rs.close();
- }
- }
- finally
- {
- stmt.close();
- }
- conn.close();
-
- }
- catch (SQLException e)
- {
- throw new AMQStoreException("Error writing " + link + " to database: " + e.getMessage(), e);
- }
- }
- }
-
private byte[] convertStringMapToBytes(final Map<String, String> arguments) throws AMQStoreException
{
byte[] argumentBytes;
@@ -1072,139 +863,7 @@ public class DerbyMessageStore implement
return argumentBytes;
}
- @Override
- public void deleteBrokerLink(final BrokerLink link) throws AMQStoreException
- {
- _logger.debug("public void deleteBrokerLink( " + link + "): called");
- Connection conn = null;
- PreparedStatement stmt = null;
- try
- {
- conn = newAutoCommitConnection();
- stmt = conn.prepareStatement(DELETE_FROM_LINKS);
- stmt.setLong(1, link.getQMFId().getLeastSignificantBits());
- stmt.setLong(2, link.getQMFId().getMostSignificantBits());
- int results = stmt.executeUpdate();
-
- if (results == 0)
- {
- throw new AMQStoreException("Link " + link + " not found");
- }
- }
- catch (SQLException e)
- {
- throw new AMQStoreException("Error deleting Link " + link + " from database: " + e.getMessage(), e);
- }
- finally
- {
- closePreparedStatement(stmt);
- closeConnection(conn);
- }
-
-
- }
-
- @Override
- public void createBridge(final Bridge bridge) throws AMQStoreException
- {
- _logger.debug("public void createBridge(BrokerLink = " + bridge + "): called");
- if (_stateManager.isInState(State.ACTIVE))
- {
- try
- {
- Connection conn = newAutoCommitConnection();
-
- PreparedStatement stmt = conn.prepareStatement(FIND_BRIDGE);
- try
- {
-
- UUID id = bridge.getQMFId();
- stmt.setLong(1, id.getLeastSignificantBits());
- stmt.setLong(2, id.getMostSignificantBits());
- ResultSet rs = stmt.executeQuery();
- try
- {
-
- // If we don't have any data in the result set then we can add this queue
- if (!rs.next())
- {
- PreparedStatement insertStmt = conn.prepareStatement(INSERT_INTO_BRIDGES);
-
- try
- {
-
- insertStmt.setLong(1, id.getLeastSignificantBits());
- insertStmt.setLong(2, id.getMostSignificantBits());
-
- insertStmt.setLong(3, bridge.getCreateTime());
-
- UUID linkId = bridge.getLink().getQMFId();
- insertStmt.setLong(4, linkId.getLeastSignificantBits());
- insertStmt.setLong(5, linkId.getMostSignificantBits());
-
- byte[] argumentBytes = convertStringMapToBytes(bridge.getArguments());
- ByteArrayInputStream bis = new ByteArrayInputStream(argumentBytes);
-
- insertStmt.setBinaryStream(6,bis,argumentBytes.length);
-
- insertStmt.execute();
- }
- finally
- {
- insertStmt.close();
- }
- }
- }
- finally
- {
- rs.close();
- }
- }
- finally
- {
- stmt.close();
- }
- conn.close();
-
- }
- catch (SQLException e)
- {
- throw new AMQStoreException("Error writing " + bridge + " to database: " + e.getMessage(), e);
- }
- }
- }
-
- @Override
- public void deleteBridge(final Bridge bridge) throws AMQStoreException
- {
- _logger.debug("public void deleteBridge( " + bridge + "): called");
- Connection conn = null;
- PreparedStatement stmt = null;
- try
- {
- conn = newAutoCommitConnection();
- stmt = conn.prepareStatement(DELETE_FROM_BRIDGES);
- stmt.setLong(1, bridge.getQMFId().getLeastSignificantBits());
- stmt.setLong(2, bridge.getQMFId().getMostSignificantBits());
- int results = stmt.executeUpdate();
-
- if (results == 0)
- {
- throw new AMQStoreException("Bridge " + bridge + " not found");
- }
- }
- catch (SQLException e)
- {
- throw new AMQStoreException("Error deleting bridge " + bridge + " from database: " + e.getMessage(), e);
- }
- finally
- {
- closePreparedStatement(stmt);
- closeConnection(conn);
- }
-
- }
@Override
public Transaction newTransaction()
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java Wed Aug 29 10:32:08 2012
@@ -27,11 +27,6 @@ import org.apache.qpid.common.AMQPFilter
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.ConfiguredObject;
-import org.apache.qpid.server.configuration.SessionConfig;
-import org.apache.qpid.server.configuration.SubscriptionConfig;
-import org.apache.qpid.server.configuration.SubscriptionConfigType;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.filter.FilterManagerFactory;
import org.apache.qpid.server.flow.FlowCreditManager;
@@ -61,8 +56,7 @@ import java.util.concurrent.locks.Reentr
* Encapsulation of a supscription to a queue. <p/> Ties together the protocol session of a subscriber, the consumer tag
* that was given out by the broker and the channel id. <p/>
*/
-public abstract class SubscriptionImpl implements Subscription, FlowCreditManager.FlowCreditManagerListener,
- SubscriptionConfig
+public abstract class SubscriptionImpl implements Subscription, FlowCreditManager.FlowCreditManagerListener
{
private StateListener _stateListener = new StateListener()
@@ -91,7 +85,6 @@ public abstract class SubscriptionImpl i
private final long _subscriptionID;
private LogSubject _logSubject;
private LogActor _logActor;
- private UUID _qmfId;
private final AtomicLong _deliveredCount = new AtomicLong(0);
private final AtomicLong _deliveredBytes = new AtomicLong(0);
@@ -373,11 +366,6 @@ public abstract class SubscriptionImpl i
return _channel;
}
- public ConfigStore getConfigStore()
- {
- return getQueue().getConfigStore();
- }
-
public Long getDelivered()
{
return _deliveredCount.get();
@@ -391,9 +379,6 @@ public abstract class SubscriptionImpl i
}
_queue = queue;
- _qmfId = getConfigStore().createId();
- getConfigStore().addConfiguredObject(this);
-
_logSubject = new SubscriptionLogSubject(this);
_logActor = new SubscriptionActor(CurrentActor.get().getRootMessageLogger(), this);
@@ -547,8 +532,6 @@ public abstract class SubscriptionImpl i
{
_stateChangeLock.unlock();
}
- getConfigStore().removeConfiguredObject(this);
-
//Log Subscription closed
CurrentActor.get().message(_logSubject, SubscriptionMessages.CLOSE());
}
@@ -752,11 +735,6 @@ public abstract class SubscriptionImpl i
return "WINDOW";
}
- public SessionConfig getSessionConfig()
- {
- return getChannel();
- }
-
public boolean isBrowsing()
{
return isBrowser();
@@ -767,32 +745,16 @@ public abstract class SubscriptionImpl i
return true;
}
- @Override
- public UUID getQMFId()
- {
- return _qmfId;
- }
-
public boolean isDurable()
{
return false;
}
- public SubscriptionConfigType getConfigType()
- {
- return SubscriptionConfigType.getInstance();
- }
-
public boolean isExclusive()
{
return getQueue().hasExclusiveSubscriber();
}
- public ConfiguredObject getParent()
- {
- return getSessionConfig();
- }
-
public String getName()
{
return String.valueOf(_consumerTag);
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java Wed Aug 29 10:32:08 2012
@@ -24,11 +24,6 @@ import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.ConfiguredObject;
-import org.apache.qpid.server.configuration.SessionConfig;
-import org.apache.qpid.server.configuration.SubscriptionConfig;
-import org.apache.qpid.server.configuration.SubscriptionConfigType;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.flow.CreditCreditManager;
@@ -86,7 +81,7 @@ import java.util.concurrent.atomic.Atomi
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCreditManagerListener, SubscriptionConfig, LogSubject
+public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCreditManagerListener, LogSubject
{
private final long _subscriptionID;
@@ -125,7 +120,6 @@ public class Subscription_0_10 implement
private LogActor _logActor;
private final Map<String, Object> _properties = new ConcurrentHashMap<String, Object>();
- private UUID _qmfId;
private String _traceExclude;
private String _trace;
private final long _createTime = System.currentTimeMillis();
@@ -192,8 +186,6 @@ public class Subscription_0_10 implement
Map<String, Object> arguments = queue.getArguments();
_traceExclude = (String) arguments.get("qpid.trace.exclude");
_trace = (String) arguments.get("qpid.trace.id");
- _qmfId = getConfigStore().createId();
- getConfigStore().addConfiguredObject(this);
String filterLogString = null;
_logActor = GenericActor.getInstance(this);
@@ -283,7 +275,6 @@ public class Subscription_0_10 implement
}
}
_creditManager.removeListener(this);
- getConfigStore().removeConfiguredObject(this);
CurrentActor.get().message(getLogSubject(), SubscriptionMessages.CLOSE());
}
finally
@@ -295,11 +286,6 @@ public class Subscription_0_10 implement
}
- public ConfigStore getConfigStore()
- {
- return getQueue().getConfigStore();
- }
-
public Long getDelivered()
{
return _deliveredCount.get();
@@ -970,12 +956,6 @@ public class Subscription_0_10 implement
return _session;
}
-
- public SessionConfig getSessionConfig()
- {
- return getSessionModel();
- }
-
public boolean isBrowsing()
{
return _acquireMode == MessageAcquireMode.NOT_ACQUIRED;
@@ -986,20 +966,11 @@ public class Subscription_0_10 implement
return getQueue().hasExclusiveSubscriber();
}
- public ConfiguredObject getParent()
- {
- return getSessionConfig();
- }
-
public boolean isDurable()
{
return false;
}
- public SubscriptionConfigType getConfigType()
- {
- return SubscriptionConfigType.getInstance();
- }
public boolean isExplicitAcknowledge()
{
@@ -1011,12 +982,6 @@ public class Subscription_0_10 implement
return _flowMode.toString();
}
- @Override
- public UUID getQMFId()
- {
- return _qmfId;
- }
-
public String getName()
{
return _destination;
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java Wed Aug 29 10:32:08 2012
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.transport;
+import java.net.SocketAddress;
import java.security.Principal;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -30,7 +31,6 @@ import java.util.concurrent.atomic.Atomi
import javax.security.auth.Subject;
import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.configuration.ConnectionConfig;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -55,7 +55,6 @@ import static org.apache.qpid.server.log
public class ServerConnection extends Connection implements AMQConnectionModel, LogSubject, AuthorizationHolder
{
- private ConnectionConfig _config;
private Runnable _onOpenTask;
private AtomicBoolean _logClosed = new AtomicBoolean(false);
private LogActor _actor = GenericActor.getInstance(this);
@@ -147,16 +146,6 @@ public class ServerConnection extends Co
initialiseStatistics();
}
- public void setConnectionConfig(final ConnectionConfig config)
- {
- _config = config;
- }
-
- public ConnectionConfig getConfig()
- {
- return _config;
- }
-
public void onOpen(final Runnable task)
{
_onOpenTask = task;
@@ -228,7 +217,7 @@ public class ServerConnection extends Co
MessageFormat.format(CONNECTION_FORMAT,
getConnectionId(),
getClientId(),
- getConfig().getAddress(),
+ getRemoteAddressString(),
getVirtualHost().getName())
+ "] ";
}
@@ -238,7 +227,7 @@ public class ServerConnection extends Co
MessageFormat.format(USER_FORMAT,
getConnectionId(),
getClientId(),
- getConfig().getAddress())
+ getRemoteAddressString())
+ "] ";
}
@@ -247,7 +236,7 @@ public class ServerConnection extends Co
return "[" +
MessageFormat.format(SOCKET_FORMAT,
getConnectionId(),
- getConfig().getAddress())
+ getRemoteAddressString())
+ "] ";
}
}
@@ -417,7 +406,7 @@ public class ServerConnection extends Co
public String getRemoteAddressString()
{
- return getConfig().getAddress();
+ return String.valueOf(getRemoteAddress());
}
public String getUserName()
@@ -489,4 +478,16 @@ public class ServerConnection extends Co
{
_peerPrincipal = peerPrincipal;
}
+
+ @Override
+ public void setRemoteAddress(SocketAddress remoteAddress)
+ {
+ super.setRemoteAddress(remoteAddress);
+ }
+
+ @Override
+ public void setLocalAddress(SocketAddress localAddress)
+ {
+ super.setLocalAddress(localAddress);
+ }
}
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java Wed Aug 29 10:32:08 2012
@@ -28,12 +28,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.UUID;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
import org.apache.qpid.common.ServerPropertyNames;
import org.apache.qpid.properties.ConnectionStartProperties;
-import org.apache.qpid.protocol.ProtocolEngine;
-import org.apache.qpid.server.configuration.BrokerConfig;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import org.apache.qpid.server.registry.IApplicationRegistry;
import org.apache.qpid.server.security.SecurityManager;
@@ -61,7 +60,7 @@ public class ServerConnectionDelegate ex
public ServerConnectionDelegate(IApplicationRegistry appRegistry, String localFQDN, SubjectCreator subjectCreator)
{
- this(createConnectionProperties(appRegistry.getBrokerConfig()), Collections.singletonList((Object)"en_US"), appRegistry, localFQDN, subjectCreator);
+ this(createConnectionProperties(appRegistry), Collections.singletonList((Object)"en_US"), appRegistry, localFQDN, subjectCreator);
}
private ServerConnectionDelegate(Map<String, Object> properties,
@@ -78,11 +77,23 @@ public class ServerConnectionDelegate ex
_subjectCreator = subjectCreator;
}
- private static Map<String, Object> createConnectionProperties(final BrokerConfig brokerConfig)
+ private static List<String> getFeatures(IApplicationRegistry appRegistry)
+ {
+ final List<String> features = new ArrayList<String>();
+ if (!appRegistry.getConfiguration().getDisabledFeatures().contains(ServerPropertyNames.FEATURE_QPID_JMS_SELECTOR))
+ {
+ features.add(ServerPropertyNames.FEATURE_QPID_JMS_SELECTOR);
+ }
+
+ return Collections.unmodifiableList(features);
+ }
+
+ private static Map<String, Object> createConnectionProperties(final IApplicationRegistry applicationRegistry)
{
final Map<String,Object> map = new HashMap<String,Object>(2);
- map.put(ServerPropertyNames.FEDERATION_TAG, brokerConfig.getFederationTag());
- final List<String> features = brokerConfig.getFeatures();
+ // Federation tag is used by the client to identify the broker instance
+ map.put(ServerPropertyNames.FEDERATION_TAG, applicationRegistry.getBrokerId().toString());
+ final List<String> features = getFeatures(applicationRegistry);
if (features != null && features.size() > 0)
{
map.put(ServerPropertyNames.QPID_FEATURES, features);
@@ -174,7 +185,7 @@ public class ServerConnectionDelegate ex
{
sconn.setVirtualHost(vhost);
- if (!vhost.getSecurityManager().accessVirtualhost(vhostName, ((ProtocolEngine) sconn.getConfig()).getRemoteAddress()))
+ if (!vhost.getSecurityManager().accessVirtualhost(vhostName, sconn.getRemoteAddress()))
{
sconn.setState(Connection.State.CLOSING);
sconn.invoke(new ConnectionClose(ConnectionCloseCode.CONNECTION_FORCED, "Permission denied '"+vhostName+"'"));
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java Wed Aug 29 10:32:08 2012
@@ -44,11 +44,6 @@ import org.apache.qpid.AMQStoreException
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.protocol.ProtocolEngine;
import org.apache.qpid.server.TransactionTimeoutHelper;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.ConfiguredObject;
-import org.apache.qpid.server.configuration.ConnectionConfig;
-import org.apache.qpid.server.configuration.SessionConfig;
-import org.apache.qpid.server.configuration.SessionConfigType;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -91,7 +86,7 @@ import static org.apache.qpid.server.log
import static org.apache.qpid.util.Serial.gt;
public class ServerSession extends Session
- implements AuthorizationHolder, SessionConfig,
+ implements AuthorizationHolder,
AMQSessionModel, LogSubject, AsyncAutoCommitTransaction.FutureRecorder
{
private static final Logger _logger = LoggerFactory.getLogger(ServerSession.class);
@@ -100,8 +95,7 @@ public class ServerSession extends Sessi
private static final int PRODUCER_CREDIT_TOPUP_THRESHOLD = 1 << 30;
private static final int UNFINISHED_COMMAND_QUEUE_THRESHOLD = 500;
- private final UUID _id;
- private ConnectionConfig _connectionConfig;
+ private final UUID _id = UUID.randomUUID();
private long _createTime = System.currentTimeMillis();
private LogActor _actor = GenericActor.getInstance(this);
@@ -147,19 +141,12 @@ public class ServerSession extends Sessi
private final TransactionTimeoutHelper _transactionTimeoutHelper;
- ServerSession(Connection connection, SessionDelegate delegate, Binary name, long expiry)
- {
- this(connection, delegate, name, expiry, ((ServerConnection)connection).getConfig());
- }
- public ServerSession(Connection connection, SessionDelegate delegate, Binary name, long expiry, ConnectionConfig connConfig)
+ public ServerSession(Connection connection, SessionDelegate delegate, Binary name, long expiry)
{
super(connection, delegate, name, expiry);
- _connectionConfig = connConfig;
_transaction = new AsyncAutoCommitTransaction(this.getMessageStore(),this);
_logSubject = new ChannelLogSubject(this);
- _id = getConfigStore().createId();
- getConfigStore().addConfiguredObject(this);
_transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject);
}
@@ -184,12 +171,6 @@ public class ServerSession extends Sessi
invoke(new MessageStop(""));
}
- private ConfigStore getConfigStore()
- {
- return getConnectionConfig().getConfigStore();
- }
-
-
@Override
protected boolean isFull(int id)
{
@@ -389,8 +370,6 @@ public class ServerSession extends Sessi
}
_messageDispositionListenerMap.clear();
- getConfigStore().removeConfiguredObject(this);
-
for (Task task : _taskList)
{
task.doTask(this);
@@ -682,23 +661,7 @@ public class ServerSession extends Sessi
public VirtualHost getVirtualHost()
{
- return (VirtualHost) _connectionConfig.getVirtualHost();
- }
-
- @Override
- public UUID getQMFId()
- {
- return _id;
- }
-
- public SessionConfigType getConfigType()
- {
- return SessionConfigType.getInstance();
- }
-
- public ConfiguredObject getParent()
- {
- return getVirtualHost();
+ return getConnection().getVirtualHost();
}
public boolean isDurable()
@@ -706,44 +669,16 @@ public class ServerSession extends Sessi
return false;
}
- public boolean isAttached()
- {
- return true;
- }
-
- public long getDetachedLifespan()
- {
- return 0;
- }
-
- public Long getExpiryTime()
- {
- return null;
- }
-
- public Long getMaxClientRate()
- {
- return null;
- }
-
- public ConnectionConfig getConnectionConfig()
- {
- return _connectionConfig;
- }
-
- public String getSessionName()
- {
- return getName().toString();
- }
public long getCreateTime()
{
return _createTime;
}
- public void mgmtClose()
+ @Override
+ public UUID getId()
{
- close();
+ return _id;
}
public AMQConnectionModel getConnectionModel()
@@ -878,9 +813,7 @@ public class ServerSession extends Sessi
? getConnection().getConnectionId()
: -1;
- String remoteAddress = _connectionConfig instanceof ProtocolEngine
- ? ((ProtocolEngine) _connectionConfig).getRemoteAddress().toString()
- : "";
+ String remoteAddress = String.valueOf(getConnection().getRemoteAddress());
return "[" +
MessageFormat.format(CHANNEL_FORMAT,
connectionId,
@@ -1065,14 +998,16 @@ public class ServerSession extends Sessi
super.setClose(close);
}
- public int compareTo(AMQSessionModel session)
+ @Override
+ public int getConsumerCount()
{
- return getQMFId().compareTo(session.getQMFId());
+ return _subscriptions.values().size();
}
@Override
- public int getConsumerCount()
+ public int compareTo(AMQSessionModel o)
{
- return _subscriptions.values().size();
+ return getId().compareTo(o.getId());
}
+
}
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java Wed Aug 29 10:32:08 2012
@@ -25,13 +25,10 @@ import java.util.UUID;
import java.util.concurrent.ScheduledFuture;
import org.apache.qpid.common.Closeable;
import org.apache.qpid.server.binding.BindingFactory;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.VirtualHostConfig;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.federation.BrokerLink;
import org.apache.qpid.server.protocol.v1_0.LinkRegistry;
import org.apache.qpid.server.queue.QueueRegistry;
import org.apache.qpid.server.registry.IApplicationRegistry;
@@ -41,7 +38,7 @@ import org.apache.qpid.server.store.Dura
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.txn.DtxRegistry;
-public interface VirtualHost extends DurableConfigurationStore.Source, VirtualHostConfig, Closeable, StatisticsGatherer
+public interface VirtualHost extends DurableConfigurationStore.Source, Closeable, StatisticsGatherer
{
IConnectionRegistry getConnectionRegistry();
@@ -81,21 +78,8 @@ public interface VirtualHost extends Dur
BindingFactory getBindingFactory();
- void createBrokerConnection(String transport,
- String host,
- int port,
- String vhost,
- boolean durable,
- String authMechanism, String username, String password);
-
- public BrokerLink createBrokerConnection(UUID id, long createTime, Map<String,String> arguments);
-
- ConfigStore getConfigStore();
-
DtxRegistry getDtxRegistry();
- void removeBrokerConnection(BrokerLink brokerLink);
-
LinkRegistry getLinkRegistry(String remoteContainerId);
ScheduledFuture<?> scheduleTask(long delay, Runnable timeoutTask);
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java Wed Aug 29 10:32:08 2012
@@ -35,7 +35,6 @@ import org.apache.qpid.framing.AMQShortS
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.binding.BindingFactory;
import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.federation.BrokerLink;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.messages.TransactionLogMessages;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
@@ -65,7 +64,6 @@ public class VirtualHostConfigRecoveryHa
ConfigurationRecoveryHandler.QueueRecoveryHandler,
ConfigurationRecoveryHandler.ExchangeRecoveryHandler,
ConfigurationRecoveryHandler.BindingRecoveryHandler,
- ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler,
MessageStoreRecoveryHandler,
MessageStoreRecoveryHandler.StoredMessageRecoveryHandler,
TransactionLogRecoveryHandler,
@@ -190,19 +188,6 @@ public class VirtualHostConfigRecoveryHa
{
}
- public BridgeRecoveryHandler brokerLink(final UUID id,
- final long createTime,
- final Map<String, String> arguments)
- {
- BrokerLink blink = _virtualHost.createBrokerConnection(id, createTime, arguments);
- return new BridgeRecoveryHandlerImpl(blink);
-
- }
-
- public void completeBrokerLinkRecovery()
- {
- }
-
public void dtxRecord(long format, byte[] globalId, byte[] branchId,
Transaction.Record[] enqueues,
Transaction.Record[] dequeues)
@@ -412,9 +397,8 @@ public class VirtualHostConfigRecoveryHa
}
- public BrokerLinkRecoveryHandler completeBindingRecovery()
+ public void completeBindingRecovery()
{
- return this;
}
public void complete()
@@ -529,22 +513,4 @@ public class VirtualHostConfigRecoveryHa
}
}
- private class BridgeRecoveryHandlerImpl implements BridgeRecoveryHandler
- {
- private final BrokerLink _blink;
-
- public BridgeRecoveryHandlerImpl(final BrokerLink blink)
- {
- _blink = blink;
- }
-
- public void bridge(final UUID id, final long createTime, final Map<String, String> arguments)
- {
- _blink.createBridge(id, createTime, arguments);
- }
-
- public void completeBridgeRecoveryForLink()
- {
- }
- }
}
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java Wed Aug 29 10:32:08 2012
@@ -35,12 +35,8 @@ import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.server.binding.BindingFactory;
-import org.apache.qpid.server.configuration.BrokerConfig;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.ConfiguredObject;
import org.apache.qpid.server.configuration.ExchangeConfiguration;
import org.apache.qpid.server.configuration.QueueConfiguration;
-import org.apache.qpid.server.configuration.VirtualHostConfigType;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.ConnectionRegistry;
import org.apache.qpid.server.connection.IConnectionRegistry;
@@ -49,7 +45,6 @@ import org.apache.qpid.server.exchange.D
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.federation.BrokerLink;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.messages.VirtualHostMessages;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
@@ -79,24 +74,18 @@ public class VirtualHostImpl implements
private static final int HOUSEKEEPING_SHUTDOWN_TIMEOUT = 5;
- private final UUID _qmfId;
-
private final String _name;
private final UUID _id;
private final long _createTime = System.currentTimeMillis();
- private final ConcurrentHashMap<BrokerLink,BrokerLink> _links = new ConcurrentHashMap<BrokerLink, BrokerLink>();
-
private final ScheduledThreadPoolExecutor _houseKeepingTasks;
private final IApplicationRegistry _appRegistry;
private final SecurityManager _securityManager;
- private final BrokerConfig _brokerConfig;
-
private final VirtualHostConfiguration _vhostConfig;
private final QueueRegistry _queueRegistry;
@@ -133,12 +122,10 @@ public class VirtualHostImpl implements
}
_appRegistry = appRegistry;
- _brokerConfig = _appRegistry.getBrokerConfig();
_vhostConfig = hostConfig;
_name = _vhostConfig.getName();
_dtxRegistry = new DtxRegistry();
- _qmfId = _appRegistry.getConfigStore().createId();
_id = UUIDGenerator.generateVhostUUID(_name);
CurrentActor.get().message(VirtualHostMessages.CREATED(_name));
@@ -187,22 +174,6 @@ public class VirtualHostImpl implements
return _id;
}
- @Override
- public UUID getQMFId()
- {
- return _qmfId;
- }
-
- public VirtualHostConfigType getConfigType()
- {
- return VirtualHostConfigType.getInstance();
- }
-
- public ConfiguredObject getParent()
- {
- return getBroker();
- }
-
public boolean isDurable()
{
return false;
@@ -468,16 +439,6 @@ public class VirtualHostImpl implements
return _name;
}
- public BrokerConfig getBroker()
- {
- return _brokerConfig;
- }
-
- public String getFederationTag()
- {
- return _brokerConfig.getFederationTag();
- }
-
public long getCreateTime()
{
return _createTime;
@@ -604,51 +565,6 @@ public class VirtualHostImpl implements
_dataReceived = new StatisticsCounter("bytes-received-" + getName());
}
- public BrokerLink createBrokerConnection(UUID id, long createTime, Map<String,String> arguments)
- {
- BrokerLink blink = new BrokerLink(this, id, createTime, arguments);
- // TODO - cope with duplicate broker link creation requests
- _links.putIfAbsent(blink,blink);
- getConfigStore().addConfiguredObject(blink);
- return blink;
- }
-
- public void createBrokerConnection(final String transport,
- final String host,
- final int port,
- final String vhost,
- final boolean durable,
- final String authMechanism,
- final String username,
- final String password)
- {
- BrokerLink blink = new BrokerLink(this, transport, host, port, vhost, durable, authMechanism, username, password);
-
- // TODO - cope with duplicate broker link creation requests
- _links.putIfAbsent(blink,blink);
- getConfigStore().addConfiguredObject(blink);
-
- }
-
- public void removeBrokerConnection(final String transport,
- final String host,
- final int port,
- final String vhost)
- {
- removeBrokerConnection(new BrokerLink(this, transport, host, port, vhost, false, null,null,null));
-
- }
-
- public void removeBrokerConnection(BrokerLink blink)
- {
- blink = _links.get(blink);
- if(blink != null)
- {
- blink.close();
- getConfigStore().removeConfiguredObject(blink);
- }
- }
-
public synchronized LinkRegistry getLinkRegistry(String remoteContainerId)
{
LinkRegistry linkRegistry = _linkRegistry.get(remoteContainerId);
@@ -660,11 +576,6 @@ public class VirtualHostImpl implements
return linkRegistry;
}
- public ConfigStore getConfigStore()
- {
- return getApplicationRegistry().getConfigStore();
- }
-
public DtxRegistry getDtxRegistry()
{
return _dtxRegistry;
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java Wed Aug 29 10:32:08 2012
@@ -1,59 +1,58 @@
-/*
- *
- * 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.qpid.server.virtualhost;
-
-import org.apache.qpid.common.Closeable;
-import org.apache.qpid.server.configuration.ConfigStore;
+/*
+ *
+ * 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.qpid.server.virtualhost;
+
+import org.apache.qpid.common.Closeable;
import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-
-import java.util.ArrayList;
-import java.util.Collection;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-public class VirtualHostRegistry implements Closeable
-{
- private final Map<String, VirtualHost> _registry = new ConcurrentHashMap<String, VirtualHost>();
-
-
- private String _defaultVirtualHostName;
- private ApplicationRegistry _applicationRegistry;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+public class VirtualHostRegistry implements Closeable
+{
+ private final Map<String, VirtualHost> _registry = new ConcurrentHashMap<String, VirtualHost>();
+
+
+ private String _defaultVirtualHostName;
+ private ApplicationRegistry _applicationRegistry;
private final Collection<RegistryChangeListener> _listeners =
Collections.synchronizedCollection(new ArrayList<RegistryChangeListener>());
-
- public VirtualHostRegistry(ApplicationRegistry applicationRegistry)
- {
- _applicationRegistry = applicationRegistry;
- }
-
- public synchronized void registerVirtualHost(VirtualHost host) throws Exception
- {
- if(_registry.containsKey(host.getName()))
- {
- throw new Exception("Virtual Host with name " + host.getName() + " already registered.");
- }
- _registry.put(host.getName(),host);
+
+ public VirtualHostRegistry(ApplicationRegistry applicationRegistry)
+ {
+ _applicationRegistry = applicationRegistry;
+ }
+
+ public synchronized void registerVirtualHost(VirtualHost host) throws Exception
+ {
+ if(_registry.containsKey(host.getName()))
+ {
+ throw new Exception("Virtual Host with name " + host.getName() + " already registered.");
+ }
+ _registry.put(host.getName(),host);
synchronized (_listeners)
{
for(RegistryChangeListener listener : _listeners)
@@ -61,11 +60,11 @@ public class VirtualHostRegistry impleme
listener.virtualHostRegistered(host);
}
}
- }
-
- public synchronized void unregisterVirtualHost(VirtualHost host)
- {
- _registry.remove(host.getName());
+ }
+
+ public synchronized void unregisterVirtualHost(VirtualHost host)
+ {
+ _registry.remove(host.getName());
synchronized (_listeners)
{
for(RegistryChangeListener listener : _listeners)
@@ -73,57 +72,52 @@ public class VirtualHostRegistry impleme
listener.virtualHostUnregistered(host);
}
}
- }
-
- public VirtualHost getVirtualHost(String name)
- {
- if(name == null || name.trim().length() == 0 || "/".equals(name.trim()))
- {
- name = getDefaultVirtualHostName();
- }
-
- return _registry.get(name);
- }
-
- public VirtualHost getDefaultVirtualHost()
- {
- return getVirtualHost(getDefaultVirtualHostName());
- }
-
- private String getDefaultVirtualHostName()
- {
- return _defaultVirtualHostName;
- }
-
- public void setDefaultVirtualHostName(String defaultVirtualHostName)
- {
- _defaultVirtualHostName = defaultVirtualHostName;
- }
-
-
- public Collection<VirtualHost> getVirtualHosts()
- {
- return new ArrayList<VirtualHost>(_registry.values());
- }
-
- public ApplicationRegistry getApplicationRegistry()
- {
- return _applicationRegistry;
- }
-
- public ConfigStore getConfigStore()
- {
- return _applicationRegistry.getConfigStore();
- }
-
- public void close()
- {
- for (VirtualHost virtualHost : getVirtualHosts())
- {
- virtualHost.close();
- }
-
- }
+ }
+
+ public VirtualHost getVirtualHost(String name)
+ {
+ if(name == null || name.trim().length() == 0 || "/".equals(name.trim()))
+ {
+ name = getDefaultVirtualHostName();
+ }
+
+ return _registry.get(name);
+ }
+
+ public VirtualHost getDefaultVirtualHost()
+ {
+ return getVirtualHost(getDefaultVirtualHostName());
+ }
+
+ private String getDefaultVirtualHostName()
+ {
+ return _defaultVirtualHostName;
+ }
+
+ public void setDefaultVirtualHostName(String defaultVirtualHostName)
+ {
+ _defaultVirtualHostName = defaultVirtualHostName;
+ }
+
+
+ public Collection<VirtualHost> getVirtualHosts()
+ {
+ return new ArrayList<VirtualHost>(_registry.values());
+ }
+
+ public ApplicationRegistry getApplicationRegistry()
+ {
+ return _applicationRegistry;
+ }
+
+ public void close()
+ {
+ for (VirtualHost virtualHost : getVirtualHosts())
+ {
+ virtualHost.close();
+ }
+
+ }
public static interface RegistryChangeListener
{
@@ -137,4 +131,4 @@ public class VirtualHostRegistry impleme
_listeners.add(listener);
}
-}
+}
Propchange: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java Wed Aug 29 10:32:08 2012
@@ -238,12 +238,11 @@ public class VirtualHostConfigurationTes
VirtualHost vhost =
ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(getName());
- assertEquals("Default houseKeeping task count incorrect.", 2,
+ assertEquals("Default houseKeeping task count incorrect.", 1,
vhost.getHouseKeepingTaskCount());
- // Currently the two are tasks:
- // ExpiredMessageTask from VirtualHost
- // UpdateTask from the QMF ManagementExchange
+ // Currently the task is:
+ // ExpiredMessageTask from VirtualHostC
}
/**
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java Wed Aug 29 10:32:08 2012
@@ -29,7 +29,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
@@ -83,7 +82,7 @@ public class AbstractHeadersExchangeTest
protected void unbind(TestQueue queue, String... bindings) throws AMQException
{
String queueName = queue.getName();
- exchange.onUnbind(new Binding(null, null, queueName, queue, exchange, getHeadersMap(bindings)));
+ exchange.onUnbind(new Binding(null, queueName, queue, exchange, getHeadersMap(bindings)));
}
protected int getCount()
@@ -95,7 +94,7 @@ public class AbstractHeadersExchangeTest
{
TestQueue queue = new TestQueue(new AMQShortString(queueName));
queues.add(queue);
- exchange.onBind(new Binding(null, null, key, queue, exchange, args));
+ exchange.onBind(new Binding(null, key, queue, exchange, args));
return queue;
}
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java Wed Aug 29 10:32:08 2012
@@ -160,7 +160,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -171,7 +171,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
matchHeaders.setString("B", "Value of B");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -181,7 +181,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Altered value of A");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertFalse(new HeadersBinding(b).matches(matchHeaders));
}
@@ -192,7 +192,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -204,7 +204,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertFalse(new HeadersBinding(b).matches(matchHeaders));
}
@@ -217,7 +217,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
matchHeaders.setString("B", "Value of B");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -231,7 +231,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("B", "Value of B");
matchHeaders.setString("C", "Value of C");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -245,7 +245,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("B", "Altered value of B");
matchHeaders.setString("C", "Value of C");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertFalse(new HeadersBinding(b).matches(matchHeaders));
}
@@ -256,7 +256,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -268,7 +268,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -281,7 +281,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("A", "Value of A");
matchHeaders.setString("B", "Value of B");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -295,7 +295,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("B", "Value of B");
matchHeaders.setString("C", "Value of C");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -309,7 +309,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("B", "Altered value of B");
matchHeaders.setString("C", "Value of C");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertTrue(new HeadersBinding(b).matches(matchHeaders));
}
@@ -323,7 +323,7 @@ public class HeadersBindingTest extends
matchHeaders.setString("B", "Altered value of B");
matchHeaders.setString("C", "Value of C");
- Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders);
+ Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders);
assertFalse(new HeadersBinding(b).matches(matchHeaders));
}
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java Wed Aug 29 10:32:08 2012
@@ -66,7 +66,7 @@ public class TopicExchangeTest extends I
public void testNoRoute() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a*#b", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.*.#.b",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.*.#.b",queue, _exchange, null));
IncomingMessage message = createMessage("a.b");
@@ -78,7 +78,7 @@ public class TopicExchangeTest extends I
public void testDirectMatch() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "ab", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.b",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null));
IncomingMessage message = createMessage("a.b");
@@ -105,7 +105,7 @@ public class TopicExchangeTest extends I
public void testStarMatch() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a*", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.*",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.*",queue, _exchange, null));
IncomingMessage message = createMessage("a.b");
@@ -144,7 +144,7 @@ public class TopicExchangeTest extends I
public void testHashMatch() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.#",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.#",queue, _exchange, null));
IncomingMessage message = createMessage("a.b.c");
@@ -207,7 +207,7 @@ public class TopicExchangeTest extends I
public void testMidHash() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.*.#.b",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.*.#.b",queue, _exchange, null));
IncomingMessage message = createMessage("a.c.d.b");
@@ -237,7 +237,7 @@ public class TopicExchangeTest extends I
public void testMatchafterHash() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.*.#.b.c",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.*.#.b.c",queue, _exchange, null));
IncomingMessage message = createMessage("a.c.b.b");
@@ -283,7 +283,7 @@ public class TopicExchangeTest extends I
public void testHashAfterHash() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.*.#.b.c.#.d",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.*.#.b.c.#.d",queue, _exchange, null));
IncomingMessage message = createMessage("a.c.b.b.c");
@@ -310,7 +310,7 @@ public class TopicExchangeTest extends I
public void testHashHash() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.#.*.#.d",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.#.*.#.d",queue, _exchange, null));
IncomingMessage message = createMessage("a.c.b.b.c");
@@ -336,7 +336,7 @@ public class TopicExchangeTest extends I
public void testSubMatchFails() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.b.c.d",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.b.c.d",queue, _exchange, null));
IncomingMessage message = createMessage("a.b.c");
@@ -366,7 +366,7 @@ public class TopicExchangeTest extends I
public void testMoreRouting() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.b",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null));
IncomingMessage message = createMessage("a.b.c");
@@ -381,7 +381,7 @@ public class TopicExchangeTest extends I
public void testMoreQueue() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null);
- _exchange.registerQueue(new Binding(null, null, "a.b",queue, _exchange, null));
+ _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null));
IncomingMessage message = createMessage("a");
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java Wed Aug 29 10:32:08 2012
@@ -23,9 +23,6 @@ package org.apache.qpid.server.queue;
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.server.binding.Binding;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.ConfiguredObject;
-import org.apache.qpid.server.configuration.QueueConfigType;
import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.logging.LogSubject;
@@ -106,11 +103,6 @@ public class MockAMQQueue implements AMQ
return 0;
}
- public ConfigStore getConfigStore()
- {
- return getVirtualHost().getConfigStore();
- }
-
public long getMessageDequeueCount()
{
return 0;
@@ -186,22 +178,6 @@ public class MockAMQQueue implements AMQ
return null;
}
- @Override
- public UUID getQMFId()
- {
- return null;
- }
-
- public QueueConfigType getConfigType()
- {
- return null;
- }
-
- public ConfiguredObject getParent()
- {
- return null;
- }
-
public boolean isDurable()
{
return false;
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java Wed Aug 29 10:32:08 2012
@@ -51,10 +51,6 @@ import org.apache.qpid.server.message.En
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.MockStoredMessage;
-import org.apache.qpid.server.store.ConfigurationRecoveryHandler;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.MessageStoreRecoveryHandler;
-import org.apache.qpid.server.store.TransactionLogRecoveryHandler;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BindingRecoveryHandler;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler.ExchangeRecoveryHandler;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler.QueueRecoveryHandler;
@@ -76,7 +72,6 @@ public class DurableConfigurationStoreTe
private QueueRecoveryHandler _queueRecoveryHandler;
private ExchangeRecoveryHandler _exchangeRecoveryHandler;
private BindingRecoveryHandler _bindingRecoveryHandler;
- private ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler _linkRecoveryHandler;
private MessageStoreRecoveryHandler _messageStoreRecoveryHandler;
private StoredMessageRecoveryHandler _storedMessageRecoveryHandler;
private TransactionLogRecoveryHandler _logRecoveryHandler;
@@ -116,7 +111,6 @@ public class DurableConfigurationStoreTe
when(_recoveryHandler.begin(isA(MessageStore.class))).thenReturn(_exchangeRecoveryHandler);
when(_exchangeRecoveryHandler.completeExchangeRecovery()).thenReturn(_queueRecoveryHandler);
when(_queueRecoveryHandler.completeQueueRecovery()).thenReturn(_bindingRecoveryHandler);
- when(_bindingRecoveryHandler.completeBindingRecovery()).thenReturn(_linkRecoveryHandler);
when(_logRecoveryHandler.begin(any(MessageStore.class))).thenReturn(_queueEntryRecoveryHandler);
when(_queueEntryRecoveryHandler.completeQueueEntryRecovery()).thenReturn(_dtxRecordRecoveryHandler);
when(_exchange.getNameShortString()).thenReturn(AMQShortString.valueOf(EXCHANGE_NAME));
@@ -161,7 +155,7 @@ public class DurableConfigurationStoreTe
public void testBindQueue() throws Exception
{
AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false);
- Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), null, ROUTING_KEY, queue,
+ Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
_exchange, FieldTable.convertToMap(_bindingArgs));
_store.bindQueue(binding);
@@ -175,7 +169,7 @@ public class DurableConfigurationStoreTe
public void testUnbindQueue() throws Exception
{
AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false);
- Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), null, ROUTING_KEY, queue,
+ Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
_exchange, FieldTable.convertToMap(_bindingArgs));
_store.bindQueue(binding);
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java Wed Aug 29 10:32:08 2012
@@ -294,17 +294,12 @@ public class MockSubscription implements
private static class MockSessionModel implements AMQSessionModel
{
+ private final UUID _id = UUID.randomUUID();
@Override
- public int compareTo(AMQSessionModel o)
- {
- return 0;
- }
-
- @Override
- public UUID getQMFId()
+ public UUID getId()
{
- return null;
+ return _id;
}
@Override
@@ -409,6 +404,12 @@ public class MockSubscription implements
{
return 0;
}
+
+ @Override
+ public int compareTo(AMQSessionModel o)
+ {
+ return getId().compareTo(o.getId());
+ }
}
private static class MockConnectionModel implements AMQConnectionModel
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java Wed Aug 29 10:32:08 2012
@@ -71,10 +71,9 @@ public class SubscriptionFactoryImplTest
ServerConnection conn = new ServerConnection(1);
ProtocolEngine_0_10 engine = new ProtocolEngine_0_10(conn, new TestNetworkConnection(), getRegistry());
conn.setVirtualHost(getVirtualHost());
- conn.setConnectionConfig(engine);
ServerSessionDelegate sesDel = new ServerSessionDelegate();
Binary name = new Binary(new byte[]{new Byte("1")});
- ServerSession session = new ServerSession(conn, sesDel, name, 0, engine);
+ ServerSession session = new ServerSession(conn, sesDel, name, 0);
Subscription sub_0_10 = SubscriptionFactoryImpl.INSTANCE.createSubscription(session, "1", MessageAcceptMode.EXPLICIT,
MessageAcquireMode.PRE_ACQUIRED, MessageFlowMode.WINDOW, new WindowCreditManager(), null, null);
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java Wed Aug 29 10:32:08 2012
@@ -1,5 +1,4 @@
/*
- *
* 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
@@ -16,13 +15,9 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.qpid.server.transport;
-import java.util.UUID;
-
-import org.apache.qpid.server.configuration.MockConnectionConfig;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -43,25 +38,19 @@ public class ServerSessionTest extends I
public void testCompareTo() throws Exception
{
ServerConnection connection = new ServerConnection(1);
- connection.setConnectionConfig(createConnectionConfig());
+ connection.setVirtualHost(_virtualHost);
ServerSession session1 = new ServerSession(connection, new ServerSessionDelegate(),
- new Binary(getName().getBytes()), 0 , connection.getConfig());
+ new Binary(getName().getBytes()), 0);
// create a session with the same name but on a different connection
ServerConnection connection2 = new ServerConnection(2);
- connection2.setConnectionConfig(createConnectionConfig());
+ connection2.setVirtualHost(_virtualHost);
ServerSession session2 = new ServerSession(connection2, new ServerSessionDelegate(),
- new Binary(getName().getBytes()), 0 , connection2.getConfig());
+ new Binary(getName().getBytes()), 0);
assertFalse("Unexpected compare result", session1.compareTo(session2) == 0);
assertEquals("Unexpected compare result", 0, session1.compareTo(session1));
}
- private MockConnectionConfig createConnectionConfig()
- {
- return new MockConnectionConfig(UUID.randomUUID(), null, null,
- false, 1, _virtualHost, "address", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE,
- "authid", "remoteProcessName", new Integer(1967), new Integer(1970), _virtualHost.getConfigStore(), Boolean.FALSE);
- }
}
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java Wed Aug 29 10:32:08 2012
@@ -22,7 +22,6 @@ package org.apache.qpid.server.txn;
import org.apache.commons.lang.NotImplementedException;
-import org.apache.qpid.server.configuration.SessionConfig;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -68,11 +67,6 @@ class MockServerMessage implements Serve
throw new NotImplementedException();
}
- public SessionConfig getSessionConfig()
- {
- throw new NotImplementedException();
- }
-
public String getRoutingKey()
{
throw new NotImplementedException();
Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java?rev=1378496&r1=1378495&r2=1378496&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java Wed Aug 29 10:32:08 2012
@@ -22,16 +22,10 @@ package org.apache.qpid.server.virtualho
import java.util.concurrent.ScheduledFuture;
import org.apache.qpid.server.binding.BindingFactory;
-import org.apache.qpid.server.configuration.BrokerConfig;
-import org.apache.qpid.server.configuration.ConfigStore;
-import org.apache.qpid.server.configuration.ConfiguredObject;
-import org.apache.qpid.server.configuration.VirtualHostConfig;
-import org.apache.qpid.server.configuration.VirtualHostConfigType;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.federation.BrokerLink;
import org.apache.qpid.server.protocol.v1_0.LinkRegistry;
import org.apache.qpid.server.queue.QueueRegistry;
import org.apache.qpid.server.registry.IApplicationRegistry;
@@ -58,18 +52,6 @@ public class MockVirtualHost implements
}
- public void createBrokerConnection(String transport, String host, int port,
- String vhost, boolean durable, String authMechanism,
- String username, String password)
- {
-
- }
-
- public BrokerLink createBrokerConnection(final UUID id, final long createTime, final Map<String, String> arguments)
- {
- return null;
- }
-
public IApplicationRegistry getApplicationRegistry()
{
return null;
@@ -90,11 +72,6 @@ public class MockVirtualHost implements
return null;
}
- public ConfigStore getConfigStore()
- {
- return null;
- }
-
public DtxRegistry getDtxRegistry()
{
return null;
@@ -160,12 +137,6 @@ public class MockVirtualHost implements
return null;
}
-
- public void removeBrokerConnection(BrokerLink brokerLink)
- {
-
- }
-
public LinkRegistry getLinkRegistry(String remoteContainerId)
{
return null;
@@ -186,25 +157,6 @@ public class MockVirtualHost implements
}
- public BrokerConfig getBroker()
- {
- return null;
- }
-
- public String getFederationTag()
- {
- return null;
- }
-
- public void setBroker(BrokerConfig brokerConfig)
- {
-
- }
-
- public VirtualHostConfigType getConfigType()
- {
- return null;
- }
public long getCreateTime()
{
@@ -216,17 +168,6 @@ public class MockVirtualHost implements
return null;
}
- @Override
- public UUID getQMFId()
- {
- return null;
- }
-
- public ConfiguredObject<VirtualHostConfigType, VirtualHostConfig> getParent()
- {
- return null;
- }
-
public boolean isDurable()
{
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org