[jboss-cvs] JBoss Messaging SVN: r3798 - in trunk: src/main/org/jboss/messaging/core and 30 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 26 03:33:28 EST 2008
Author: timfox
Date: 2008-02-26 03:33:27 -0500 (Tue, 26 Feb 2008)
New Revision: 3798
Added:
trunk/src/main/org/jboss/messaging/core/MessagingException.java
trunk/src/main/org/jboss/messaging/core/deployers/
trunk/src/main/org/jboss/messaging/core/deployers/Deployable.java
trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java
trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
trunk/src/main/org/jboss/messaging/core/deployers/queue/
trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/security/
trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java
trunk/src/main/org/jboss/messaging/core/remoting/RemotingException.java
trunk/src/main/org/jboss/messaging/core/security/SecurityStoreImpl.java
Removed:
trunk/src/main/org/jboss/messaging/core/DestinationType.java
trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java
trunk/src/main/org/jboss/messaging/core/security/SecurityMetadataStore.java
trunk/src/main/org/jboss/messaging/deployers/
trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java
trunk/src/main/org/jboss/messaging/util/MessageQueueNameHelper.java
trunk/src/main/org/jboss/messaging/util/MessagingException.java
trunk/src/main/org/jboss/messaging/util/NotYetImplementedException.java
trunk/src/main/org/jboss/messaging/util/RemotingException.java
trunk/src/main/org/jboss/messaging/util/Util.java
trunk/src/main/org/jboss/messaging/util/WeakHashSet.java
trunk/tests/src/org/jboss/test/messaging/jms/util/MessageQueueNameHelperTest.java
trunk/tests/src/org/jboss/test/messaging/util/UtilTest.java
Modified:
trunk/src/main/org/jboss/messaging/core/MessagingServer.java
trunk/src/main/org/jboss/messaging/core/client/ClientBrowser.java
trunk/src/main/org/jboss/messaging/core/client/ClientConnection.java
trunk/src/main/org/jboss/messaging/core/client/ClientConnectionFactory.java
trunk/src/main/org/jboss/messaging/core/client/ClientConsumer.java
trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java
trunk/src/main/org/jboss/messaging/core/client/ClientSession.java
trunk/src/main/org/jboss/messaging/core/client/FailureListener.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientBrowserImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionInternal.java
trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnection.java
trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/impl/ConnectionManagerImpl.java
trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java
trunk/src/main/org/jboss/messaging/core/impl/MessagingServerPacketHandler.java
trunk/src/main/org/jboss/messaging/core/impl/ServerBrowserImpl.java
trunk/src/main/org/jboss/messaging/core/impl/ServerConnectionPacketHandler.java
trunk/src/main/org/jboss/messaging/core/impl/ServerConsumerPacketHandler.java
trunk/src/main/org/jboss/messaging/core/impl/ServerPacketHandlerSupport.java
trunk/src/main/org/jboss/messaging/core/impl/ServerProducerPacketHandler.java
trunk/src/main/org/jboss/messaging/core/impl/ServerSessionImpl.java
trunk/src/main/org/jboss/messaging/core/impl/ServerSessionPacketHandler.java
trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java
trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java
trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerManagementImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/Interceptor.java
trunk/src/main/org/jboss/messaging/core/remoting/codec/MessagingExceptionMessageCodec.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/FailureNotifier.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaKeepAliveFactory.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java
trunk/src/main/org/jboss/messaging/core/remoting/wireformat/MessagingExceptionMessage.java
trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
trunk/src/main/org/jboss/messaging/jms/JBossDestination.java
trunk/src/main/org/jboss/messaging/jms/JBossTopic.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java
trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java
trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java
trunk/src/main/org/jboss/messaging/jms/client/JMSExceptionHelper.java
trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/JMSServerDeployer.java
trunk/src/main/org/jboss/messaging/jms/server/JMSServerManagerImpl.java
trunk/src/main/org/jboss/messaging/util/HierarchicalObjectRepository.java
trunk/src/main/org/jboss/messaging/util/Match.java
trunk/tests/src/org/jboss/jms/server/deployer/test/unit/DeployerTest.java
trunk/tests/src/org/jboss/jms/server/security/test/unit/SecurityDeployerTest.java
trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterTest.java
trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptor.java
trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptorB.java
trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ClientKeepAliveTest.java
trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/MinaKeepAliveFactoryTest.java
trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ServerKeepAliveTest.java
trunk/tests/src/org/jboss/messaging/deployers/queue/tests/unit/QueueSettingsDeployerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
trunk/tests/src/org/jboss/test/messaging/jms/network/ClientNetworkFailureTest.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java
trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteContext.java
trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
Package restructuring part II (still not complete)
Deleted: trunk/src/main/org/jboss/messaging/core/DestinationType.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/DestinationType.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/DestinationType.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.core;
-
-/**
- *
- * A DestinationType
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public enum DestinationType
-{
- QUEUE, TOPIC;
-
- public static DestinationType fromInt(int i)
- {
- switch (i)
- {
- case 0:
- return QUEUE;
- case 1:
- return TOPIC;
- default:
- throw new IllegalArgumentException("Invalid int " + i);
- }
- }
-
- public static int toInt(DestinationType type)
- {
- switch (type)
- {
- case QUEUE:
- return 0;
- case TOPIC:
- return 1;
- default:
- throw new IllegalArgumentException("Invalid type " + type);
- }
- }
-}
Copied: trunk/src/main/org/jboss/messaging/core/MessagingException.java (from rev 3793, trunk/src/main/org/jboss/messaging/util/MessagingException.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/MessagingException.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/MessagingException.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core;
+
+/**
+ *
+ * A MessagingException
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class MessagingException extends Exception
+{
+ private static final long serialVersionUID = -4802014152804997417L;
+
+ // Error codes -------------------------------------------------
+
+ public static final int INTERNAL_ERROR = 000;
+
+ public static final int UNSUPPORTED_PACKET = 001;
+
+ public static final int NOT_CONNECTED = 002;
+
+ public static final int CONNECTION_TIMEDOUT = 003;
+
+
+ public static final int QUEUE_DOES_NOT_EXIST = 100;
+
+ public static final int QUEUE_EXISTS = 101;
+
+ public static final int OBJECT_CLOSED = 102;
+
+ public static final int INVALID_FILTER_EXPRESSION = 103;
+
+ public static final int ILLEGAL_STATE = 104;
+
+ public static final int SECURITY_EXCEPTION = 105;
+
+ public static final int ADDRESS_DOES_NOT_EXIST = 106;
+
+ public static final int ADDRESS_EXISTS = 107;
+
+ private int code;
+
+ public MessagingException()
+ {
+ }
+
+ public MessagingException(int code)
+ {
+ this.code = code;
+ }
+
+ public MessagingException(int code, String msg)
+ {
+ super(msg);
+
+ this.code = code;
+ }
+
+ public int getCode()
+ {
+ return code;
+ }
+
+ public String toString()
+ {
+ return "MessagingException[errorCode=" + code + " message=" + getMessage() + "]";
+ }
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/MessagingServer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/MessagingServer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -26,6 +26,7 @@
import org.jboss.messaging.core.remoting.RemotingService;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.core.security.SecurityStore;
import org.jboss.messaging.util.HierarchicalRepository;
import org.jboss.messaging.util.Version;
@@ -71,6 +72,8 @@
PostOffice getPostOffice();
HierarchicalRepository<HashSet<Role>> getSecurityRepository();
+
+ SecurityStore getSecurityStore();
HierarchicalRepository<QueueSettings> getQueueSettingsRepository();
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientBrowser.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientBrowser.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientBrowser.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -8,7 +8,7 @@
package org.jboss.messaging.core.client;
import org.jboss.messaging.core.Message;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientConnection.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientConnection.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -7,7 +7,7 @@
package org.jboss.messaging.core.client;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientConnectionFactory.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientConnectionFactory.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -21,7 +21,7 @@
*/
package org.jboss.messaging.core.client;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.util.Version;
/**
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientConsumer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientConsumer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientConsumer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -8,7 +8,7 @@
package org.jboss.messaging.core.client;
import org.jboss.messaging.core.Message;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -8,7 +8,7 @@
package org.jboss.messaging.core.client;
import org.jboss.messaging.core.Message;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientSession.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientSession.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientSession.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -9,9 +9,9 @@
import javax.transaction.xa.XAResource;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.wireformat.SessionBindingQueryResponseMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionQueueQueryResponseMessage;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/client/FailureListener.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/FailureListener.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/FailureListener.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -21,7 +21,7 @@
*/
package org.jboss.messaging.core.client;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientBrowserImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientBrowserImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientBrowserImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -22,6 +22,7 @@
package org.jboss.messaging.core.client.impl;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientBrowser;
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionBrowserHasNextMessageMessage;
@@ -31,7 +32,6 @@
import org.jboss.messaging.core.remoting.wireformat.SessionBrowserNextMessageMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionBrowserNextMessageResponseMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionBrowserResetMessage;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -23,13 +23,13 @@
import java.io.Serializable;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientConnection;
import org.jboss.messaging.core.client.ClientConnectionFactory;
import org.jboss.messaging.core.remoting.RemotingConfiguration;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionRequest;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
import org.jboss.messaging.util.Version;
/**
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -26,6 +26,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
@@ -34,7 +35,6 @@
import org.jboss.messaging.core.remoting.wireformat.ConnectionStartMessage;
import org.jboss.messaging.core.remoting.wireformat.ConnectionStopMessage;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* The client-side Connection connectionFactory class.
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -26,6 +26,7 @@
import java.util.concurrent.TimeUnit;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.PriorityLinkedList;
import org.jboss.messaging.core.client.MessageHandler;
import org.jboss.messaging.core.impl.PriorityLinkedListImpl;
@@ -34,7 +35,6 @@
import org.jboss.messaging.core.remoting.wireformat.ConsumerFlowTokenMessage;
import org.jboss.messaging.core.remoting.wireformat.DeliverMessage;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -6,9 +6,9 @@
*/
package org.jboss.messaging.core.client.impl;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.remoting.wireformat.DeliverMessage;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -22,11 +22,11 @@
package org.jboss.messaging.core.client.impl;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.AcknowledgementHandler;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.remoting.wireformat.ProducerSendMessage;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* The client-side Producer connectionFactory class.
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -33,6 +33,7 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientBrowser;
import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.client.ClientProducer;
@@ -76,7 +77,6 @@
import org.jboss.messaging.core.remoting.wireformat.SessionXASuspendMessage;
import org.jboss.messaging.jms.client.SelectorTranslator;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionInternal.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionInternal.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionInternal.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -7,10 +7,10 @@
package org.jboss.messaging.core.client.impl;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientBrowser;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnection.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnection.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,8 +1,8 @@
package org.jboss.messaging.core.client.impl;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnectionImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/RemotingConnectionImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -24,6 +24,7 @@
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.jboss.messaging.core.remoting.ConnectorRegistrySingleton.REGISTRY;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.NIOConnector;
import org.jboss.messaging.core.remoting.NIOSession;
@@ -31,7 +32,6 @@
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
import org.jboss.messaging.core.remoting.wireformat.MessagingExceptionMessage;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
*
Copied: trunk/src/main/org/jboss/messaging/core/deployers/Deployable.java (from rev 3793, trunk/src/main/org/jboss/messaging/deployers/Deployable.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/Deployable.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/deployers/Deployable.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,41 @@
+package org.jboss.messaging.core.deployers;
+
+import java.net.URL;
+
+/**
+ * Extended to allow objects to be deployed via the Deploymwntmanager
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public interface Deployable
+{
+ /**
+ * The name of the configuration file name to look for for deployment
+ *
+ * @return The name of the config file
+ */
+ public String getConfigFileName();
+
+ /**
+ * Deploy the URL for the first time
+ *
+ * @param url The resource todeploy
+ * @throws Exception .
+ */
+ public void deploy(URL url) throws Exception;
+
+ /**
+ * Redeploys a URL if changed
+ *
+ * @param url The resource to redeploy
+ * @throws Exception .
+ */
+ public void redeploy(URL url) throws Exception;
+
+ /**
+ * Undeploys a resource that has been removed
+ * @param url The Resource that was deleted
+ * @throws Exception .
+ */
+ public void undeploy(URL url) throws Exception;
+}
Copied: trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java (from rev 3793, trunk/src/main/org/jboss/messaging/deployers/Deployer.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.deployers;
+
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.MessagingComponent;
+import org.jboss.messaging.util.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * abstract class that helps with deployment of messaging components.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public abstract class Deployer implements Deployable, MessagingComponent
+{
+ private static Logger log = Logger.getLogger(Deployer.class);
+ protected static final String NAME_ATTR = "name";
+
+ private HashMap<URL, HashMap<String, Node>> configuration = new HashMap<URL, HashMap<String, Node>>();
+
+ /**
+ * adds a URL to the already configured set of url's this deployer is handling
+ * @param url The URL to add
+ * @param name the name of the element
+ * @param e .
+ */
+ public void addToConfiguration(URL url, String name, Node e)
+ {
+ if (configuration.get(url) == null)
+ {
+ configuration.put(url, new HashMap<String, Node>());
+ }
+ configuration.get(url).put(name, e);
+ }
+
+ /**
+ * Redeploys a URL if changed
+ *
+ * @param url The resource to redeploy
+ * @throws Exception .
+ */
+ public void redeploy(URL url) throws Exception
+ {
+ Element e = getRootElement(url);
+ ArrayList<String> added = new ArrayList<String>();
+ //pull out the elements that need deploying
+ String elements[] = getElementTagName();
+ for (String element : elements)
+ {
+ NodeList children = e.getElementsByTagName(element);
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node node = children.item(i);
+ String name = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
+ added.add(name);
+ //if this has never been deployed deploy
+ if (configuration.get(url) == null || (configuration.get(url) != null && configuration.get(url).get(name) == null))
+ {
+ log.info(new StringBuilder(name).append(" doesn't exist deploying"));
+ deploy(node);
+ }
+ //or if it has changed redeploy
+ else if (hasNodeChanged(url, node, name))
+ {
+ log.info(new StringBuilder(name).append(" has changed redeploying"));
+ undeploy(node);
+ deploy(node);
+ addToConfiguration(url, name, node);
+ }
+
+ }
+ }
+ //now check for anything thathas been removed and undeploy
+ if (configuration.get(url) != null)
+ {
+ Set<String> keys = configuration.get(url).keySet();
+ ArrayList<String> removed = new ArrayList<String>();
+
+ for (String key : keys)
+ {
+ if(!added.contains(key))
+ {
+ undeploy(configuration.get(url).get(key));
+ removed.add(key);
+ }
+ }
+ for (String s : removed)
+ {
+ configuration.get(url).remove(s);
+ }
+ }
+ }
+
+ protected Element getRootElement(URL url)
+ throws Exception
+ {
+ return XMLUtil.urlToElement(url);
+ }
+
+ private boolean hasNodeChanged(URL url, Node child, String name)
+ {
+ String newTextContent = child.getTextContent();
+ String origTextContent = configuration.get(url).get(name).getTextContent();
+ return !newTextContent.equals(origTextContent);
+ }
+
+ /**
+ * Undeploys a resource that has been removed
+ * @param url The Resource that was deleted
+ * @throws Exception .
+ */
+ public void undeploy(URL url) throws Exception
+ {
+ Set<String> keys = configuration.get(url).keySet();
+ for (String key : keys)
+ {
+ undeploy(configuration.get(url).get(key));
+ }
+ configuration.remove(url);
+ }
+
+ /**
+ * Deploy the URL for the first time
+ *
+ * @param url The resource todeploy
+ * @throws Exception .
+ */
+ public void deploy(URL url) throws Exception
+ {
+ Element e = getRootElement(url);
+ //find all thenodes to deploy
+ String elements[] = getElementTagName();
+ for (String element : elements)
+ {
+ NodeList children = e.getElementsByTagName(element);
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node node = children.item(i);
+ Node keyNode = node.getAttributes().getNamedItem(getKeyAttribute());
+ if(keyNode == null)
+ {
+ log.error("key attribuet missing for configuration " + node);
+ continue;
+ }
+ String name = keyNode.getNodeValue();
+ log.info(new StringBuilder("deploying ").append(name));
+ try
+ {
+ deploy(node);
+ }
+ catch (Exception e1)
+ {
+ log.error(new StringBuilder("Unable to deploy node ").append(node), e1);
+ continue;
+ }
+ addToConfiguration(url, name, node);
+ }
+ }
+ }
+
+ /**
+ * the key attribute for theelement, usually 'name' but can be overridden
+ * @return the key attribute
+ */
+ public String getKeyAttribute()
+ {
+ return NAME_ATTR;
+ }
+
+ //register with the deploymenmt manager
+ public void start() throws Exception
+ {
+ DeploymentManager.getInstance().registerDeployable(this);
+ }
+
+ //undeploy everything
+ public void stop() throws Exception
+ {
+ Collection<HashMap<String, Node>> urls = configuration.values();
+ for (HashMap<String, Node> hashMap : urls)
+ {
+ for (Node node : hashMap.values())
+ {
+ try
+ {
+ undeploy(node);
+ }
+ catch (Exception e)
+ {
+ log.warn("problem undeploying " + node, e);
+ }
+ }
+ }
+ DeploymentManager.getInstance().unregisterDeployable(this);
+ }
+
+ /**
+ * the names of the elements to deploy
+ * @return the names of the elements todeploy
+ */
+ public abstract String[] getElementTagName();
+
+
+ /**
+ * deploy an element
+ * @param node the element to deploy
+ * @throws Exception .
+ */
+ public abstract void deploy(Node node)
+ throws Exception;
+
+ /**
+ * undeploys an element
+ * @param node the element to undeploy
+ * @throws Exception .
+ */
+ public abstract void undeploy(Node node)
+ throws Exception;
+
+}
Copied: trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java (from rev 3794, trunk/src/main/org/jboss/messaging/deployers/DeploymentManager.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,334 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.deployers;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.logging.Logger;
+
+/**
+ * This class manages any configuration files available. It will notify any deployers registered with it on changes.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class DeploymentManager implements Runnable
+{
+ private static final Logger log = Logger.getLogger(DeploymentManager.class);
+ //use the singleton pattern we only need one of these
+ private static DeploymentManager singleton;
+ //these are the list of deployers, typically destination and connection factory.
+ private static ArrayList<Deployable> deployables = new ArrayList<Deployable>();
+ //any config files deployed and the time they were deployed
+ private static HashMap<URL, Long> deployed = new HashMap<URL, Long>();
+ // the list of URL's to deploy
+ private static ArrayList<URL> toDeploy = new ArrayList<URL>();
+ //the list of URL's to undeploy if removed
+ private static ArrayList<URL> toUndeploy = new ArrayList<URL>();
+ //the list of URL's to redeploy if changed
+ private static ArrayList<URL> toRedeploy = new ArrayList<URL>();
+ private static ScheduledExecutorService scheduler;
+
+ //we want to use a singleton
+ private DeploymentManager()
+ {
+
+ }
+
+ public static DeploymentManager getInstance() throws Exception
+ {
+ //if the first time initialise and get the URL's to deploy
+ if (singleton == null)
+ {
+ singleton = new DeploymentManager();
+ //get the URL's to deploy and add them to the list with the timestamp
+ Collection<ConfigurationURL> configurations = getConfigurations();
+ for (ConfigurationURL configuration : configurations)
+ {
+ Iterator<URL> urls = configuration.getUrls();
+ while (urls.hasNext())
+ {
+ URL url = urls.next();
+ log.info(new StringBuilder("adding url ").append(url).append(" to be deployed"));
+ deployed.put(url, new File(url.getFile()).lastModified());
+ }
+ }
+
+ // Get the scheduler
+ scheduler = Executors.newSingleThreadScheduledExecutor();
+
+ scheduler.scheduleAtFixedRate(singleton, 10, 5, TimeUnit.SECONDS);
+ }
+ return singleton;
+ }
+
+ /**
+ * will return any resources available
+ *
+ * @return a set of configurationUrls
+ * @throws IOException .
+ */
+ private static Collection<ConfigurationURL> getConfigurations() throws IOException
+ {
+ HashMap<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
+ for (Deployable deployable : deployables)
+ {
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployable.getConfigFileName());
+
+ if(!configurations.keySet().contains(deployable.getConfigFileName()))
+ {
+ ConfigurationURL conf = new ConfigurationURL(urls, deployable.getConfigFileName());
+ configurations.put(deployable.getConfigFileName(), conf);
+ }
+ else
+ {
+ configurations.get(deployable.getConfigFileName()).add(urls);
+ }
+ }
+ return configurations.values();
+ }
+
+ /**
+ * registers a deployable object which will handle the deployment of URL's
+ *
+ * @param deployable The deployable object
+ * @throws Exception .
+ */
+ public void registerDeployable(Deployable deployable) throws Exception
+ {
+ synchronized (this)
+ {
+ deployables.add(deployable);
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployable.getConfigFileName());
+ while (urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
+ if (!deployed.keySet().contains(url))
+ {
+ deployed.put(url, new File(url.getFile()).lastModified());
+ }
+ try
+ {
+ log.info(new StringBuilder("Deploying ").append(deployable).append(" with url").append(url));
+ deployable.deploy(url);
+
+ }
+ catch (Exception e)
+ {
+ log.error(new StringBuilder("Error deploying ").append(url), e);
+ }
+ }
+ }
+ }
+
+ public void unregisterDeployable(Deployable deployable)
+ {
+ deployables.remove(deployable);
+ if(deployables.size() == 0)
+ {
+ if (scheduler != null)
+ {
+ scheduler.shutdown();
+ scheduler = null;
+ }
+ }
+ }
+ /**
+ * called by the ExecutorService every n seconds
+ */
+ public void run()
+ {
+ synchronized (this)
+ {
+ try
+ {
+ scan();
+ }
+ catch (Exception e)
+ {
+ log.warn("error scanning for URL's " + e);
+ }
+ }
+ }
+
+ /**
+ * scans for changes to any of the configuration files registered
+ *
+ * @throws Exception .
+ */
+ private void scan() throws Exception
+ {
+ Collection<ConfigurationURL> configurations = getConfigurations();
+ for (ConfigurationURL configuration : configurations)
+ {
+ Iterator<URL> urls = configuration.getUrls();
+ while (urls.hasNext())
+ {
+ URL url = urls.next();
+ if (!deployed.keySet().contains(url))
+ {
+ log.info(new StringBuilder("adding url ").append(url).append(" to be deployed"));
+ toDeploy.add(url);
+ }
+ else if (new File(url.getFile()).lastModified() > deployed.get(url))
+ {
+ log.info(new StringBuilder("adding url ").append(url).append(" to be redeployed"));
+ toRedeploy.add(url);
+ }
+ }
+ for (URL url : deployed.keySet())
+ {
+ if (!new File(url.getFile()).exists())
+ {
+ log.info(new StringBuilder("adding url ").append(url).append(" to be undeployed"));
+ toUndeploy.add(url);
+ }
+ }
+ }
+
+ for (URL url : toDeploy)
+ {
+ deploy(url);
+ }
+ for (URL url : toRedeploy)
+ {
+ redeploy(url);
+ }
+ for (URL url : toUndeploy)
+ {
+ undeploy(url);
+ }
+ toRedeploy.clear();
+ toUndeploy.clear();
+ toDeploy.clear();
+ }
+
+ /**
+ * undeploys a url, delegates to appropiate registered deployables
+ * @param url the url to undeploy
+ */
+ private void undeploy(URL url)
+ {
+ deployed.remove(url);
+
+ for (Deployable deployable : deployables)
+ {
+ try
+ {
+ log.info(new StringBuilder("Undeploying ").append(deployable).append(" with url").append(url));
+ deployable.undeploy(url);
+ }
+ catch (Exception e)
+ {
+ log.error(new StringBuilder("Error undeploying ").append(url), e);
+ }
+ }
+ }
+
+ /**
+ * redeploys a url, delegates to appropiate registered deployables
+ * @param url the url to redeploy
+ */
+ private void redeploy(URL url)
+ {
+ deployed.put(url, new File(url.getFile()).lastModified());
+ for (Deployable deployable : deployables)
+ {
+ try
+ {
+ log.info(new StringBuilder("Redeploying ").append(deployable).append(" with url").append(url));
+ deployable.redeploy(url);
+ }
+ catch (Exception e)
+ {
+ log.error(new StringBuilder("Error redeploying ").append(url), e);
+ }
+ }
+ }
+
+ /**
+ * deploys a url, delegates to appropiate registered deployables
+ * @param url the url to deploy
+ * @throws Exception .
+ */
+ private void deploy(URL url)
+ throws Exception
+ {
+ deployed.put(url, new File(url.getFile()).lastModified());
+ for (Deployable deployable : deployables)
+ {
+ try
+ {
+ log.info(new StringBuilder("Deploying ").append(deployable).append(" with url").append(url));
+ deployable.deploy(url);
+ }
+ catch (Exception e)
+ {
+ log.error(new StringBuilder("Error deploying ").append(url), e);
+ }
+ }
+ }
+
+ static class ConfigurationURL
+ {
+ private ArrayList<URL> urls = new ArrayList<URL>();
+ private String configFileName;
+
+ public ConfigurationURL(Enumeration<URL> urls, String configFileName)
+ {
+ while (urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
+ this.urls.add(url);
+ }
+ this.configFileName = configFileName;
+ }
+
+ public Iterator<URL> getUrls()
+ {
+ return urls.iterator();
+ }
+
+ public String getConfigFileName()
+ {
+ return configFileName;
+ }
+
+ public void add(Enumeration<URL> urls)
+ {
+ while (urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
+ this.urls.add(url);
+ }
+ }
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/core/deployers/queue (from rev 3793, trunk/src/main/org/jboss/messaging/deployers/queue)
Deleted: trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/deployers/queue/QueueSettingsDeployer.java 2008-02-25 17:38:14 UTC (rev 3793)
+++ trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.deployers.queue;
-
-import org.jboss.messaging.core.QueueSettings;
-import org.jboss.messaging.core.PostOffice;
-import org.jboss.messaging.deployers.Deployer;
-import org.jboss.messaging.util.HierarchicalRepository;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * A deployer for creating a set of queue settings and adding them to a repository
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class QueueSettingsDeployer extends Deployer
-{
- /**
- * The repository to add to
- */
- HierarchicalRepository<QueueSettings> queueSettingsRepository;
-
- PostOffice postOffice;
- private static final String CLUSTERED_NODE_NAME = "clustered";
- private static final String DLQ_NODE_NAME = "dlq";
- private static final String EXPIREY_QUEUE_NODE_NAME = "expiry-queue";
- private static final String REDELIVERY_DELAY_NODE_NAME = "redelivery-delay";
- private static final String MAX_SIZE_NODE_NAME = "max-size";
- private static final String DISTRIBUTION_POLICY_CLASS_NODE_NAME = "distribution-policy-class";
- private static final String MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME = "message-counter-history-day-limit";
-
- public void setQueueSettingsRepository(HierarchicalRepository<QueueSettings> queueSettingsRepository)
- {
- this.queueSettingsRepository = queueSettingsRepository;
- }
-
- public void setPostOffice(PostOffice postOffice)
- {
- this.postOffice = postOffice;
- }
-
- /**
- * the names of the elements to deploy
- * @return the names of the elements todeploy
- */
- public String[] getElementTagName()
- {
- return new String[]{"queue-settings"};
- }
-
- /**
- * deploy an element
- * @param node the element to deploy
- * @throws Exception .
- */
- public void deploy(Node node) throws Exception
- {
- String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- NodeList children = node.getChildNodes();
- QueueSettings queueSettings = new QueueSettings();
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
- if(CLUSTERED_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- queueSettings.setClustered(Boolean.valueOf(child.getTextContent()));
- }
- if(DLQ_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- String queueName = child.getTextContent();
- if(postOffice.getBinding(queueName) == null)
- {
-
- postOffice.addBinding(queueName, queueName, null, true, false);
- }
- queueSettings.setDLQ(postOffice.getBinding(queueName).getQueue());
- }
- if(EXPIREY_QUEUE_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- String queueName = child.getTextContent();
- if(postOffice.getBinding(queueName) == null)
- {
- postOffice.addBinding(queueName, queueName, null, true, false);
- }
- queueSettings.setExpiryQueue(postOffice.getBinding(queueName).getQueue());
- }
- if(REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- queueSettings.setRedeliveryDelay(Long.valueOf(child.getTextContent()));
- }
- if(MAX_SIZE_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- queueSettings.setMaxSize(Integer.valueOf(child.getTextContent()));
- }
- if(DISTRIBUTION_POLICY_CLASS_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- queueSettings.setDistributionPolicyClass(child.getTextContent());
- }
- if(MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- queueSettings.setMessageCounterHistoryDayLimit(Integer.valueOf(child.getTextContent()));
- }
- }
-
-
-
- queueSettingsRepository.addMatch(match, queueSettings);
- }
-
- /**
- * The name of the configuration file name to look for for deployment
- *
- * @return The name of the config file
- */
- public String getConfigFileName()
- {
- return "queues.xml";
- }
-
- /**
- * undeploys an element
- * @param node the element to undeploy
- * @throws Exception .
- */
- public void undeploy(Node node) throws Exception
- {
- String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- queueSettingsRepository.removeMatch(match);
- }
-
- /**
- * the key attribute for theelement, usually 'name' but can be overridden
- * @return the key attribute
- */
- public String getKeyAttribute()
- {
- return "match";
- }
-
-}
Copied: trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java (from rev 3797, trunk/src/main/org/jboss/messaging/deployers/queue/QueueSettingsDeployer.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/deployers/queue/QueueSettingsDeployer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.deployers.queue;
+
+import org.jboss.messaging.core.QueueSettings;
+import org.jboss.messaging.core.PostOffice;
+import org.jboss.messaging.core.deployers.Deployer;
+import org.jboss.messaging.util.HierarchicalRepository;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * A deployer for creating a set of queue settings and adding them to a repository
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class QueueSettingsDeployer extends Deployer
+{
+ /**
+ * The repository to add to
+ */
+ HierarchicalRepository<QueueSettings> queueSettingsRepository;
+
+ PostOffice postOffice;
+ private static final String CLUSTERED_NODE_NAME = "clustered";
+ private static final String DLQ_NODE_NAME = "dlq";
+ private static final String EXPIREY_QUEUE_NODE_NAME = "expiry-queue";
+ private static final String REDELIVERY_DELAY_NODE_NAME = "redelivery-delay";
+ private static final String MAX_SIZE_NODE_NAME = "max-size";
+ private static final String DISTRIBUTION_POLICY_CLASS_NODE_NAME = "distribution-policy-class";
+ private static final String MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME = "message-counter-history-day-limit";
+
+ public void setQueueSettingsRepository(HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ {
+ this.queueSettingsRepository = queueSettingsRepository;
+ }
+
+ public void setPostOffice(PostOffice postOffice)
+ {
+ this.postOffice = postOffice;
+ }
+
+ /**
+ * the names of the elements to deploy
+ * @return the names of the elements todeploy
+ */
+ public String[] getElementTagName()
+ {
+ return new String[]{"queue-settings"};
+ }
+
+ /**
+ * deploy an element
+ * @param node the element to deploy
+ * @throws Exception .
+ */
+ public void deploy(Node node) throws Exception
+ {
+ String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
+ NodeList children = node.getChildNodes();
+ QueueSettings queueSettings = new QueueSettings();
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node child = children.item(i);
+ if(CLUSTERED_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ queueSettings.setClustered(Boolean.valueOf(child.getTextContent()));
+ }
+ if(DLQ_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ String queueName = child.getTextContent();
+ if(postOffice.getBinding(queueName) == null)
+ {
+
+ postOffice.addBinding(queueName, queueName, null, true, false);
+ }
+ queueSettings.setDLQ(postOffice.getBinding(queueName).getQueue());
+ }
+ if(EXPIREY_QUEUE_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ String queueName = child.getTextContent();
+ if(postOffice.getBinding(queueName) == null)
+ {
+ postOffice.addBinding(queueName, queueName, null, true, false);
+ }
+ queueSettings.setExpiryQueue(postOffice.getBinding(queueName).getQueue());
+ }
+ if(REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ queueSettings.setRedeliveryDelay(Long.valueOf(child.getTextContent()));
+ }
+ if(MAX_SIZE_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ queueSettings.setMaxSize(Integer.valueOf(child.getTextContent()));
+ }
+ if(DISTRIBUTION_POLICY_CLASS_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ queueSettings.setDistributionPolicyClass(child.getTextContent());
+ }
+ if(MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ queueSettings.setMessageCounterHistoryDayLimit(Integer.valueOf(child.getTextContent()));
+ }
+ }
+
+
+
+ queueSettingsRepository.addMatch(match, queueSettings);
+ }
+
+ /**
+ * The name of the configuration file name to look for for deployment
+ *
+ * @return The name of the config file
+ */
+ public String getConfigFileName()
+ {
+ return "queues.xml";
+ }
+
+ /**
+ * undeploys an element
+ * @param node the element to undeploy
+ * @throws Exception .
+ */
+ public void undeploy(Node node) throws Exception
+ {
+ String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
+ queueSettingsRepository.removeMatch(match);
+ }
+
+ /**
+ * the key attribute for theelement, usually 'name' but can be overridden
+ * @return the key attribute
+ */
+ public String getKeyAttribute()
+ {
+ return "match";
+ }
+
+}
Copied: trunk/src/main/org/jboss/messaging/core/deployers/security (from rev 3793, trunk/src/main/org/jboss/messaging/deployers/security)
Deleted: trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/deployers/security/SecurityDeployer.java 2008-02-25 17:38:14 UTC (rev 3793)
+++ trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,146 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.deployers.security;
-
-import org.jboss.jms.server.security.Role;
-import org.jboss.messaging.deployers.Deployer;
-import org.jboss.messaging.util.HierarchicalRepository;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-
-/**
- * Deploys the security settings into a security repository and adds them to the security store.
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class SecurityDeployer extends Deployer
-{
-
- private static final String PERMISSION_ELEMENT_NAME = "permission";
- private static final String TYPE_ATTR_NAME = "type";
- private static final String ROLES_ATTR_NAME = "roles";
- private static final String QUEUES_XML = "queues.xml";
- private static final String MATCH = "match";
- private static final String SECURITY_ELEMENT_NAME = "security";
-
- /**
- * The repository to add to
- */
- private HierarchicalRepository<HashSet<Role>> securityRepository;
-
- /**
- * the names of the elements to deploy
- * @return the names of the elements todeploy
- */
- public String[] getElementTagName()
- {
- return new String[]{SECURITY_ELEMENT_NAME};
- }
-
- /**
- * the key attribute for theelement, usually 'name' but can be overridden
- * @return the key attribute
- */
- public String getKeyAttribute()
- {
- return MATCH;
- }
-
- public void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository)
- {
- this.securityRepository = securityRepository;
- }
-
- /**
- * deploy an element
- * @param node the element to deploy
- * @throws Exception .
- */
- public void deploy(Node node) throws Exception
- {
- HashSet<Role> securityRoles = new HashSet<Role>();
- ArrayList<String> create = new ArrayList<String>();
- ArrayList<String> write = new ArrayList<String>();
- ArrayList<String> read = new ArrayList<String>();
- ArrayList<String> allRoles = new ArrayList<String>();
- String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
-
- if (PERMISSION_ELEMENT_NAME.equalsIgnoreCase(child.getNodeName()))
- {
- String type = child.getAttributes().getNamedItem(TYPE_ATTR_NAME).getNodeValue();
- String roleString = child.getAttributes().getNamedItem(ROLES_ATTR_NAME).getNodeValue();
- String[] roles = roleString.split(",");
- for (String role : roles)
- {
- if (Role.CREATE_NAME.equals(type))
- {
- create.add(role.trim());
- }
- else if (Role.WRITE_NAME.equals(type))
- {
- write.add(role.trim());
- }
- else if (Role.READ_NAME.equals(type))
- {
- read.add(role);
- }
- if (!allRoles.contains(role.trim()))
- allRoles.add(role.trim());
- }
- }
-
- }
- for (String role : allRoles)
- {
- securityRoles.add(new Role(role, read.contains(role), write.contains(role), create.contains(role)));
- }
- securityRepository.addMatch(match, securityRoles);
- }
-
- /**
- * undeploys an element
- * @param node the element to undeploy
- * @throws Exception .
- */
- public void undeploy(Node node) throws Exception
- {
- String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- securityRepository.removeMatch(match);
- }
-
- /**
- * The name of the configuration file name to look for for deployment
- *
- * @return The name of the config file
- */
- public String getConfigFileName()
- {
- return QUEUES_XML;
- }
-}
Copied: trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java (from rev 3797, trunk/src/main/org/jboss/messaging/deployers/security/SecurityDeployer.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/deployers/security/SecurityDeployer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.deployers.security;
+
+import org.jboss.messaging.core.deployers.Deployer;
+import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.util.HierarchicalRepository;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+/**
+ * Deploys the security settings into a security repository and adds them to the security store.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class SecurityDeployer extends Deployer
+{
+
+ private static final String PERMISSION_ELEMENT_NAME = "permission";
+ private static final String TYPE_ATTR_NAME = "type";
+ private static final String ROLES_ATTR_NAME = "roles";
+ private static final String QUEUES_XML = "queues.xml";
+ private static final String MATCH = "match";
+ private static final String SECURITY_ELEMENT_NAME = "security";
+
+ /**
+ * The repository to add to
+ */
+ private HierarchicalRepository<HashSet<Role>> securityRepository;
+
+ /**
+ * the names of the elements to deploy
+ * @return the names of the elements todeploy
+ */
+ public String[] getElementTagName()
+ {
+ return new String[]{SECURITY_ELEMENT_NAME};
+ }
+
+ /**
+ * the key attribute for theelement, usually 'name' but can be overridden
+ * @return the key attribute
+ */
+ public String getKeyAttribute()
+ {
+ return MATCH;
+ }
+
+ public void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository)
+ {
+ this.securityRepository = securityRepository;
+ }
+
+ /**
+ * deploy an element
+ * @param node the element to deploy
+ * @throws Exception .
+ */
+ public void deploy(Node node) throws Exception
+ {
+ HashSet<Role> securityRoles = new HashSet<Role>();
+ ArrayList<String> create = new ArrayList<String>();
+ ArrayList<String> write = new ArrayList<String>();
+ ArrayList<String> read = new ArrayList<String>();
+ ArrayList<String> allRoles = new ArrayList<String>();
+ String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node child = children.item(i);
+
+ if (PERMISSION_ELEMENT_NAME.equalsIgnoreCase(child.getNodeName()))
+ {
+ String type = child.getAttributes().getNamedItem(TYPE_ATTR_NAME).getNodeValue();
+ String roleString = child.getAttributes().getNamedItem(ROLES_ATTR_NAME).getNodeValue();
+ String[] roles = roleString.split(",");
+ for (String role : roles)
+ {
+ if (Role.CREATE_NAME.equals(type))
+ {
+ create.add(role.trim());
+ }
+ else if (Role.WRITE_NAME.equals(type))
+ {
+ write.add(role.trim());
+ }
+ else if (Role.READ_NAME.equals(type))
+ {
+ read.add(role);
+ }
+ if (!allRoles.contains(role.trim()))
+ allRoles.add(role.trim());
+ }
+ }
+
+ }
+ for (String role : allRoles)
+ {
+ securityRoles.add(new Role(role, read.contains(role), write.contains(role), create.contains(role)));
+ }
+ securityRepository.addMatch(match, securityRoles);
+ }
+
+ /**
+ * undeploys an element
+ * @param node the element to undeploy
+ * @throws Exception .
+ */
+ public void undeploy(Node node) throws Exception
+ {
+ String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
+ securityRepository.removeMatch(match);
+ }
+
+ /**
+ * The name of the configuration file name to look for for deployment
+ *
+ * @return The name of the config file
+ */
+ public String getConfigFileName()
+ {
+ return QUEUES_XML;
+ }
+}
Modified: trunk/src/main/org/jboss/messaging/core/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ConnectionManagerImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ConnectionManagerImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -30,13 +30,12 @@
import java.util.Map.Entry;
import org.jboss.messaging.core.ConnectionManager;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.ServerConnection;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.client.impl.JMSClientVMIdentifier;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
-import org.jboss.messaging.util.Util;
/**
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
@@ -93,8 +92,7 @@
clients.put(remotingClientSessionID, clientVMID);
- log.debug("registered connection " + endpoint + " as " +
- Util.guidToString(remotingClientSessionID));
+ log.debug("registered connection " + endpoint + " as " + remotingClientSessionID);
}
public synchronized ServerConnection unregisterConnection(String remotingClientSessionID,
Modified: trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -141,6 +141,7 @@
if (maxDeliveries > 0 && deliveryCount >= maxDeliveries)
{
Queue DLQ = queue.getQueueSettings().getMatch(queue.getName()).getDLQ();
+
if (DLQ != null)
{
Message copyMessage = makeCopyForDLQOrExpiry(false, persistenceManager);
Modified: trunk/src/main/org/jboss/messaging/core/impl/MessagingServerPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/MessagingServerPacketHandler.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/MessagingServerPacketHandler.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -24,13 +24,13 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.CREATECONNECTION;
import org.jboss.logging.Logger;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.MessagingServer;
import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionRequest;
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
-import org.jboss.messaging.util.MessagingException;
/**
* A packet handler for all packets that need to be handled at the server level
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerBrowserImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerBrowserImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerBrowserImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -34,6 +34,7 @@
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.ServerSession;
import org.jboss.messaging.core.impl.filter.FilterImpl;
@@ -45,7 +46,6 @@
import org.jboss.messaging.core.remoting.wireformat.SessionBrowserHasNextMessageResponseMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionBrowserNextMessageResponseMessage;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* Concrete implementation of BrowserEndpoint.
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerConnectionPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerConnectionPacketHandler.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerConnectionPacketHandler.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -26,13 +26,13 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.CONN_START;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.CONN_STOP;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.ServerConnection;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.ConnectionCreateSessionMessage;
import org.jboss.messaging.core.remoting.wireformat.NullPacket;
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerConsumerPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerConsumerPacketHandler.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerConsumerPacketHandler.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -24,13 +24,13 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.CLOSE;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.CONS_FLOWTOKEN;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.ServerConsumer;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.ConsumerFlowTokenMessage;
import org.jboss.messaging.core.remoting.wireformat.NullPacket;
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerPacketHandlerSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerPacketHandlerSupport.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerPacketHandlerSupport.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -22,11 +22,11 @@
package org.jboss.messaging.core.impl;
import org.jboss.logging.Logger;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.PacketHandler;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.MessagingExceptionMessage;
import org.jboss.messaging.core.remoting.wireformat.Packet;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerProducerPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerProducerPacketHandler.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerProducerPacketHandler.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -25,6 +25,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.CONS_FLOWTOKEN;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.PROD_SEND;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.ServerProducer;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.ConsumerFlowTokenMessage;
@@ -32,7 +33,6 @@
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
import org.jboss.messaging.core.remoting.wireformat.ProducerSendMessage;
-import org.jboss.messaging.util.MessagingException;
public class ServerProducerPacketHandler extends ServerPacketHandlerSupport
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerSessionImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerSessionImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -41,6 +41,7 @@
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.PersistenceManager;
import org.jboss.messaging.core.PostOffice;
import org.jboss.messaging.core.Queue;
@@ -64,7 +65,6 @@
import org.jboss.messaging.core.security.CheckType;
import org.jboss.messaging.core.security.SecurityStore;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* Session implementation
Modified: trunk/src/main/org/jboss/messaging/core/impl/ServerSessionPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ServerSessionPacketHandler.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/ServerSessionPacketHandler.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -50,6 +50,7 @@
import javax.transaction.xa.Xid;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.ServerSession;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.NullPacket;
@@ -78,7 +79,6 @@
import org.jboss.messaging.core.remoting.wireformat.SessionXASetTimeoutMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionXASetTimeoutResponseMessage;
import org.jboss.messaging.core.remoting.wireformat.SessionXAStartMessage;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -26,8 +26,8 @@
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* This class implements a JBoss Messaging filter
Modified: trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -34,6 +34,7 @@
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.PersistenceManager;
import org.jboss.messaging.core.PostOffice;
import org.jboss.messaging.core.Queue;
@@ -41,7 +42,6 @@
import org.jboss.messaging.core.impl.BindingImpl;
import org.jboss.messaging.util.ConcurrentHashSet;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -44,6 +44,8 @@
import org.jboss.messaging.core.QueueSettings;
import org.jboss.messaging.core.ResourceManager;
import org.jboss.messaging.core.ServerConnection;
+import org.jboss.messaging.core.deployers.queue.QueueSettingsDeployer;
+import org.jboss.messaging.core.deployers.security.SecurityDeployer;
import org.jboss.messaging.core.impl.ConnectionManagerImpl;
import org.jboss.messaging.core.impl.MessagingServerPacketHandler;
import org.jboss.messaging.core.impl.QueueFactoryImpl;
@@ -60,17 +62,13 @@
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
import org.jboss.messaging.core.security.NullAuthenticationManager;
import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.security.SecurityMetadataStore;
-import org.jboss.messaging.deployers.queue.QueueSettingsDeployer;
-import org.jboss.messaging.deployers.security.SecurityDeployer;
-import org.jboss.messaging.util.ExceptionUtil;
+import org.jboss.messaging.core.security.SecurityStore;
+import org.jboss.messaging.core.security.SecurityStoreImpl;
import org.jboss.messaging.util.HierarchicalObjectRepository;
import org.jboss.messaging.util.HierarchicalRepository;
import org.jboss.messaging.util.Version;
import org.jboss.security.AuthenticationManager;
-import javax.jms.Destination;
-
/**
* A Messaging Server
*
@@ -99,7 +97,7 @@
// wired components
- private SecurityMetadataStore securityStore;
+ private SecurityStoreImpl securityStore;
private ConnectionManagerImpl connectionManager;
private MemoryManager memoryManager = new SimpleMemoryManager();
private MessageCounterManager messageCounterManager;
@@ -151,125 +149,108 @@
public synchronized void start() throws Exception
{
- try
+ log.debug("starting MessagingServer");
+
+ if (started)
{
- log.debug("starting MessagingServer");
+ return;
+ }
- if (started)
- {
- return;
- }
+ if (configuration.getMessagingServerID() < 0)
+ {
+ throw new IllegalStateException("MessagingServer ID not set");
+ }
- if (configuration.getMessagingServerID() < 0)
+ log.debug(this + " starting");
+
+ // Create the wired components
+
+ securityStore = new SecurityStoreImpl(configuration.getSecurityInvalidationInterval());
+ securityRepository.setDefault(new HashSet<Role>());
+ securityStore.setSecurityRepository(securityRepository);
+ securityStore.setAuthenticationManager(authenticationManager);
+ securityDeployer = new SecurityDeployer();
+ securityDeployer.setSecurityRepository(securityRepository);
+ queueSettingsDeployer = new QueueSettingsDeployer();
+ queueSettingsRepository.setDefault(new QueueSettings());
+ queueSettingsDeployer.setQueueSettingsRepository(queueSettingsRepository);
+ scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize());
+ queueFactory = new QueueFactoryImpl(scheduledExecutor);
+ queueFactory.setQueueSettingsRepository(queueSettingsRepository);
+ connectionManager = new ConnectionManagerImpl();
+ memoryManager = new SimpleMemoryManager();
+ messageCounterManager = new MessageCounterManager(configuration.getMessageCounterSamplePeriod());
+ configuration.addPropertyChangeListener(new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent evt)
{
- throw new IllegalStateException("MessagingServer ID not set");
+ if (evt.getPropertyName().equals("messageCounterSamplePeriod"))
+ messageCounterManager.reschedule(configuration.getMessageCounterSamplePeriod());
}
+ });
+ postOffice = new PostOfficeImpl(configuration.getMessagingServerID(),
+ persistenceManager, queueFactory, configuration.isStrictTck());
+ queueSettingsDeployer.setPostOffice(postOffice);
- log.debug(this + " starting");
+ if (createTransport)
+ {
+ remotingService.start();
+ }
+ // Start the wired components
+ securityDeployer.start();
+ connectionManager.start();
+ remotingService.addFailureListener(connectionManager);
+ memoryManager.start();
+ postOffice.start();
+ queueSettingsDeployer.start();
+ MessagingServerPacketHandler serverPacketHandler = new MessagingServerPacketHandler(this);
+ getRemotingService().getDispatcher().register(serverPacketHandler);
- // Create the wired components
-
- securityStore = new SecurityMetadataStore(configuration.getSecurityInvalidationInterval());
- securityRepository.setDefault(new HashSet<Role>());
- securityStore.setSecurityRepository(securityRepository);
- securityStore.setAuthenticationManager(authenticationManager);
- securityDeployer = new SecurityDeployer();
- securityDeployer.setSecurityRepository(securityRepository);
- queueSettingsDeployer = new QueueSettingsDeployer();
- queueSettingsRepository.setDefault(new QueueSettings());
- queueSettingsDeployer.setQueueSettingsRepository(queueSettingsRepository);
- scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize());
- queueFactory = new QueueFactoryImpl(scheduledExecutor);
- queueFactory.setQueueSettingsRepository(queueSettingsRepository);
- connectionManager = new ConnectionManagerImpl();
- memoryManager = new SimpleMemoryManager();
- messageCounterManager = new MessageCounterManager(configuration.getMessageCounterSamplePeriod());
- configuration.addPropertyChangeListener(new PropertyChangeListener()
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ for (String interceptorClass : configuration.getDefaultInterceptors())
+ {
+ try
{
- public void propertyChange(PropertyChangeEvent evt)
- {
- if (evt.getPropertyName().equals("messageCounterSamplePeriod"))
- messageCounterManager.reschedule(configuration.getMessageCounterSamplePeriod());
- }
- });
- postOffice = new PostOfficeImpl(configuration.getMessagingServerID(),
- persistenceManager, queueFactory, configuration.isStrictTck());
- queueSettingsDeployer.setPostOffice(postOffice);
-
- if (createTransport)
- {
- remotingService.start();
+ Class clazz = loader.loadClass(interceptorClass);
+ getRemotingService().addInterceptor((Interceptor) clazz.newInstance());
}
- // Start the wired components
- securityDeployer.start();
- connectionManager.start();
- remotingService.addFailureListener(connectionManager);
- memoryManager.start();
- postOffice.start();
- queueSettingsDeployer.start();
- MessagingServerPacketHandler serverPacketHandler = new MessagingServerPacketHandler(this);
- getRemotingService().getDispatcher().register(serverPacketHandler);
-
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- for (String interceptorClass : configuration.getDefaultInterceptors())
+ catch (Exception e)
{
- try
- {
- Class clazz = loader.loadClass(interceptorClass);
- getRemotingService().addInterceptor((Interceptor) clazz.newInstance());
- }
- catch (Exception e)
- {
- log.warn("Error instantiating interceptor \"" + interceptorClass + "\"", e);
- }
+ log.warn("Error instantiating interceptor \"" + interceptorClass + "\"", e);
}
-
- started = true;
- log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
- configuration.getMessagingServerID() + "] started");
}
- catch (Throwable t)
- {
- throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
- }
+
+ started = true;
}
public synchronized void stop() throws Exception
{
- try
+ if (!started)
{
- if (!started)
- {
- return;
- }
+ return;
+ }
- log.info(this + " is Stopping. NOTE! Stopping the server peer cleanly will NOT cause failover to occur");
+ log.info(this + " is Stopping. NOTE! Stopping the server peer cleanly will NOT cause failover to occur");
- started = false;
+ started = false;
- // Stop the wired components
- securityDeployer.stop();
- queueSettingsDeployer.stop();
- connectionManager.stop();
- remotingService.removeFailureListener(connectionManager);
- connectionManager = null;
- memoryManager.stop();
- memoryManager = null;
- messageCounterManager.stop();
- messageCounterManager = null;
- postOffice.stop();
- postOffice = null;
- scheduledExecutor.shutdown();
- scheduledExecutor = null;
- if (createTransport)
- {
- remotingService.stop();
- }
- log.info("JMS " + this + " stopped");
- }
- catch (Throwable t)
+ // Stop the wired components
+ securityDeployer.stop();
+ queueSettingsDeployer.stop();
+ connectionManager.stop();
+ remotingService.removeFailureListener(connectionManager);
+ connectionManager = null;
+ memoryManager.stop();
+ memoryManager = null;
+ messageCounterManager.stop();
+ messageCounterManager = null;
+ postOffice.stop();
+ postOffice = null;
+ scheduledExecutor.shutdown();
+ scheduledExecutor = null;
+ if (createTransport)
{
- throw ExceptionUtil.handleJMXInvocation(t, this + " stopService");
+ remotingService.stop();
}
}
@@ -489,6 +470,11 @@
{
return queueSettingsRepository;
}
+
+ public SecurityStore getSecurityStore()
+ {
+ return securityStore;
+ }
public void setAuthenticationManager(AuthenticationManager authenticationManager)
{
Modified: trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerManagementImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerManagementImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerManagementImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -38,6 +38,7 @@
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.MessagingComponent;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.MessagingServer;
import org.jboss.messaging.core.MessagingServerManagement;
import org.jboss.messaging.core.Queue;
@@ -46,7 +47,6 @@
import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
import org.jboss.messaging.core.impl.filter.FilterImpl;
import org.jboss.messaging.core.impl.messagecounter.MessageCounter;
-import org.jboss.messaging.util.MessagingException;
import javax.management.StandardMBean;
import javax.management.ObjectName;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/Interceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/Interceptor.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/Interceptor.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -7,8 +7,8 @@
package org.jboss.messaging.core.remoting;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.wireformat.Packet;
-import org.jboss.messaging.util.MessagingException;
/**
*
Copied: trunk/src/main/org/jboss/messaging/core/remoting/RemotingException.java (from rev 3793, trunk/src/main/org/jboss/messaging/util/RemotingException.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/RemotingException.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/remoting/RemotingException.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.core.remoting;
+
+import org.jboss.messaging.core.MessagingException;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class RemotingException extends MessagingException
+{
+
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -6849945921631932738L;
+
+ // Attributes ----------------------------------------------------
+
+ private String sessionID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public RemotingException(int code, String message, String sessionID)
+ {
+ super(code, message);
+ this.sessionID = sessionID;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getSessionID()
+ {
+ return sessionID;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/codec/MessagingExceptionMessageCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/codec/MessagingExceptionMessageCodec.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/codec/MessagingExceptionMessageCodec.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -8,8 +8,8 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.EXCEPTION;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.wireformat.MessagingExceptionMessage;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/FailureNotifier.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/FailureNotifier.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/FailureNotifier.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -6,7 +6,7 @@
*/
package org.jboss.messaging.core.remoting.impl.mina;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -29,17 +29,17 @@
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.ssl.SslFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.KeepAliveFactory;
import org.jboss.messaging.core.remoting.NIOConnector;
import org.jboss.messaging.core.remoting.NIOSession;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.RemotingConfiguration;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
import org.jboss.messaging.core.remoting.wireformat.Ping;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -9,14 +9,14 @@
import org.apache.mina.common.IoHandlerAdapter;
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.reqres.Response;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.PacketSender;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.core.remoting.wireformat.Ping;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaKeepAliveFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaKeepAliveFactory.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaKeepAliveFactory.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -8,12 +8,12 @@
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.keepalive.KeepAliveMessageFactory;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.KeepAliveFactory;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.core.remoting.wireformat.Ping;
import org.jboss.messaging.core.remoting.wireformat.Pong;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -27,14 +27,14 @@
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.beans.metadata.api.annotations.Uninstall;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.Interceptor;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.RemotingConfiguration;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.core.remoting.RemotingService;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/wireformat/MessagingExceptionMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/wireformat/MessagingExceptionMessage.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/remoting/wireformat/MessagingExceptionMessage.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -8,7 +8,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.EXCEPTION;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Deleted: trunk/src/main/org/jboss/messaging/core/security/SecurityMetadataStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/SecurityMetadataStore.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/security/SecurityMetadataStore.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,284 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.core.security;
-
-import java.security.Principal;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-
-import org.jboss.messaging.core.ServerConnection;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.HierarchicalRepository;
-import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.security.AuthenticationManager;
-import org.jboss.security.RealmMapping;
-import org.jboss.security.SimplePrincipal;
-
-/**
- * The JBM SecurityStore implementation
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- *
- * Parts based on old version by:
- *
- * @author Peter Antman
- * @author <a href="mailto:Scott.Stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- *
- * @version $Revision$
- *
- * $Id$
- */
-public class SecurityMetadataStore implements SecurityStore
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(SecurityMetadataStore.class);
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean trace = log.isTraceEnabled();
-
- private HierarchicalRepository<HashSet<Role>> securityRepository;
-
- private AuthenticationManager authenticationManager;
-
- private RealmMapping realmMapping;
-
- private Set<String> readCache = new ConcurrentHashSet<String>();
-
- private Set<String> writeCache = new ConcurrentHashSet<String>();
-
- private Set<String> createCache = new ConcurrentHashSet<String>();
-
- private long invalidationInterval;
-
- private long lastCheck;
-
- // Constructors --------------------------------------------------
-
- public SecurityMetadataStore(long invalidationInterval)
- {
- this.invalidationInterval = invalidationInterval;
- }
-
- // SecurityManager implementation --------------------------------
-
- public Subject authenticate(String user, String password) throws Exception
- {
- if (trace) { log.trace("authenticating user " + user); }
-
- SimplePrincipal principal = new SimplePrincipal(user);
-
- char[] passwordChars = null;
-
- if (password != null)
- {
- passwordChars = password.toCharArray();
- }
-
- Subject subject = new Subject();
-
- boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
-
- if (authenticated)
- {
- // Warning! This "taints" thread local. Make sure you pop it off the stack as soon as
- // you're done with it.
- SecurityActions.pushSubjectContext(principal, passwordChars, subject);
-
- return subject;
- }
- else
- {
- throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "User " + user + " is NOT authenticated");
- }
- }
-
- public void check(String address, CheckType checkType, ServerConnection conn) throws Exception
- {
- if (trace) { log.trace("checking access permissions to " + address); }
-
- if (checkCached(address, checkType))
- {
- // OK
- return;
- }
-
- // Authenticate. Successful autentication 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.
-
- authenticate(conn.getUsername(), conn.getPassword());
-
- // Authorize
- try
- {
- if (!authorize(conn.getUsername(), address, checkType))
- {
- String msg = "User: " + conn.getUsername() +
- " is not authorized to " +
- (checkType == CheckType.READ ? "read from" :
- checkType == CheckType.WRITE ? "write to" : "create durable sub on") +
- " destination " + address;
-
- throw new MessagingException(MessagingException.SECURITY_EXCEPTION, msg);
- }
- }
- finally
- {
- // pop the Messaging SecurityContext, it did its job
- SecurityActions.popSubjectContext();
- }
-
- // if we get here we're granted, add to the cache
-
- switch (checkType.type)
- {
- case CheckType.TYPE_READ:
- {
- readCache.add(address);
- break;
- }
- case CheckType.TYPE_WRITE:
- {
- writeCache.add(address);
- break;
- }
- case CheckType.TYPE_CREATE:
- {
- createCache.add(address);
- break;
- }
- default:
- {
- throw new IllegalArgumentException("Invalid checkType:" + checkType);
- }
- }
- }
-
- // Public --------------------------------------------------------
-
- public void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository)
- {
- this.securityRepository = securityRepository;
- }
-
- public void setAuthenticationManager(AuthenticationManager authenticationManager)
- {
- this.authenticationManager = authenticationManager;
-
- this.realmMapping = (RealmMapping) authenticationManager;
- }
-
- // Protected -----------------------------------------------------
-
- // Package Private -----------------------------------------------
-
- // Private -------------------------------------------------------
-
- private boolean checkCached(String dest, CheckType checkType)
- {
- long now = System.currentTimeMillis();
-
- boolean granted = false;
-
- if (now - lastCheck > invalidationInterval)
- {
- readCache.clear();
-
- writeCache.clear();
-
- createCache.clear();
- }
- else
- {
- switch (checkType.type)
- {
- case CheckType.TYPE_READ:
- {
- granted = readCache.contains(dest);
- break;
- }
- case CheckType.TYPE_WRITE:
- {
- granted = writeCache.contains(dest);
- break;
- }
- case CheckType.TYPE_CREATE:
- {
- granted = createCache.contains(dest);
- break;
- }
- default:
- {
- throw new IllegalArgumentException("Invalid checkType:" + checkType);
- }
- }
- }
-
- lastCheck = now;
-
- return granted;
- }
-
- private boolean authorize(String user, String destination, CheckType checkType)
- {
- if (trace) { log.trace("authorizing user " + user + " for destination " + destination); }
-
- HashSet<Role> roles = securityRepository.getMatch(destination);
-
- Principal principal = user == null ? null : new SimplePrincipal(user);
-
- Set rolePrincipals = getRolePrincipals(checkType, roles);
-
- boolean hasRole = realmMapping.doesUserHaveRole(principal, rolePrincipals);
-
- if (trace) { log.trace("user " + user + (hasRole ? " is " : " is NOT ") + "authorized"); }
-
- return hasRole;
- }
-
- private Set getRolePrincipals(CheckType checkType, HashSet<Role> roles)
- {
- Set<SimplePrincipal> principals = new HashSet<SimplePrincipal>();
- for (Role role : roles)
- {
- if((checkType.equals(CheckType.CREATE) && role.isCreate()) ||
- (checkType.equals(CheckType.WRITE) && role.isWrite()) ||
- (checkType.equals(CheckType.READ) && role.isRead()))
- {
- principals.add(new SimplePrincipal(role.getName()));
- }
- }
- return principals;
- }
-
- // Inner class ---------------------------------------------------
-}
Modified: trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -42,4 +42,6 @@
void check(String address, CheckType checkType, ServerConnection conn) throws Exception;
void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository);
+
+ void invalidateCache();
}
Copied: trunk/src/main/org/jboss/messaging/core/security/SecurityStoreImpl.java (from rev 3794, trunk/src/main/org/jboss/messaging/core/security/SecurityMetadataStore.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/SecurityStoreImpl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/security/SecurityStoreImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -0,0 +1,289 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.security;
+
+import java.security.Principal;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+import org.jboss.messaging.core.MessagingException;
+import org.jboss.messaging.core.ServerConnection;
+import org.jboss.messaging.util.ConcurrentHashSet;
+import org.jboss.messaging.util.HierarchicalRepository;
+import org.jboss.messaging.util.Logger;
+import org.jboss.security.AuthenticationManager;
+import org.jboss.security.RealmMapping;
+import org.jboss.security.SimplePrincipal;
+
+/**
+ * The JBM SecurityStore implementation
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ *
+ * Parts based on old version by:
+ *
+ * @author Peter Antman
+ * @author <a href="mailto:Scott.Stark at jboss.org">Scott Stark</a>
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ *
+ * @version $Revision$
+ *
+ * $Id$
+ */
+public class SecurityStoreImpl implements SecurityStore
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(SecurityStoreImpl.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private boolean trace = log.isTraceEnabled();
+
+ private HierarchicalRepository<HashSet<Role>> securityRepository;
+
+ private AuthenticationManager authenticationManager;
+
+ private RealmMapping realmMapping;
+
+ private Set<String> readCache = new ConcurrentHashSet<String>();
+
+ private Set<String> writeCache = new ConcurrentHashSet<String>();
+
+ private Set<String> createCache = new ConcurrentHashSet<String>();
+
+ private long invalidationInterval;
+
+ private long lastCheck;
+
+ // Constructors --------------------------------------------------
+
+ public SecurityStoreImpl(long invalidationInterval)
+ {
+ this.invalidationInterval = invalidationInterval;
+ }
+
+ // SecurityManager implementation --------------------------------
+
+ public Subject authenticate(String user, String password) throws Exception
+ {
+ if (trace) { log.trace("authenticating user " + user); }
+
+ SimplePrincipal principal = new SimplePrincipal(user);
+
+ char[] passwordChars = null;
+
+ if (password != null)
+ {
+ passwordChars = password.toCharArray();
+ }
+
+ Subject subject = new Subject();
+
+ boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
+
+ if (authenticated)
+ {
+ // Warning! This "taints" thread local. Make sure you pop it off the stack as soon as
+ // you're done with it.
+ SecurityActions.pushSubjectContext(principal, passwordChars, subject);
+
+ return subject;
+ }
+ else
+ {
+ throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "User " + user + " is NOT authenticated");
+ }
+ }
+
+ public void check(String address, CheckType checkType, ServerConnection conn) throws Exception
+ {
+ if (trace) { log.trace("checking access permissions to " + address); }
+
+ if (checkCached(address, checkType))
+ {
+ // OK
+ return;
+ }
+
+ // Authenticate. Successful autentication 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.
+
+ authenticate(conn.getUsername(), conn.getPassword());
+
+ // Authorize
+ try
+ {
+ if (!authorize(conn.getUsername(), address, checkType))
+ {
+ String msg = "User: " + conn.getUsername() +
+ " is not authorized to " +
+ (checkType == CheckType.READ ? "read from" :
+ checkType == CheckType.WRITE ? "write to" : "create durable sub on") +
+ " destination " + address;
+
+ throw new MessagingException(MessagingException.SECURITY_EXCEPTION, msg);
+ }
+ }
+ finally
+ {
+ // pop the Messaging SecurityContext, it did its job
+ SecurityActions.popSubjectContext();
+ }
+
+ // if we get here we're granted, add to the cache
+
+ switch (checkType.type)
+ {
+ case CheckType.TYPE_READ:
+ {
+ readCache.add(address);
+ break;
+ }
+ case CheckType.TYPE_WRITE:
+ {
+ writeCache.add(address);
+ break;
+ }
+ case CheckType.TYPE_CREATE:
+ {
+ createCache.add(address);
+ break;
+ }
+ default:
+ {
+ throw new IllegalArgumentException("Invalid checkType:" + checkType);
+ }
+ }
+ }
+
+ public void invalidateCache()
+ {
+ readCache.clear();
+
+ writeCache.clear();
+
+ createCache.clear();
+ }
+
+ // Public --------------------------------------------------------
+
+ public void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository)
+ {
+ this.securityRepository = securityRepository;
+ }
+
+ public void setAuthenticationManager(AuthenticationManager authenticationManager)
+ {
+ this.authenticationManager = authenticationManager;
+
+ this.realmMapping = (RealmMapping) authenticationManager;
+ }
+
+ // Protected -----------------------------------------------------
+
+ // Package Private -----------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private boolean checkCached(String dest, CheckType checkType)
+ {
+ long now = System.currentTimeMillis();
+
+ boolean granted = false;
+
+ if (now - lastCheck > invalidationInterval)
+ {
+ invalidateCache();
+ }
+ else
+ {
+ switch (checkType.type)
+ {
+ case CheckType.TYPE_READ:
+ {
+ granted = readCache.contains(dest);
+ break;
+ }
+ case CheckType.TYPE_WRITE:
+ {
+ granted = writeCache.contains(dest);
+ break;
+ }
+ case CheckType.TYPE_CREATE:
+ {
+ granted = createCache.contains(dest);
+ break;
+ }
+ default:
+ {
+ throw new IllegalArgumentException("Invalid checkType:" + checkType);
+ }
+ }
+ }
+
+ lastCheck = now;
+
+ return granted;
+ }
+
+ private boolean authorize(String user, String destination, CheckType checkType)
+ {
+ if (trace) { log.trace("authorizing user " + user + " for destination " + destination); }
+
+ HashSet<Role> roles = securityRepository.getMatch(destination);
+
+ Principal principal = user == null ? null : new SimplePrincipal(user);
+
+ Set rolePrincipals = getRolePrincipals(checkType, roles);
+
+ boolean hasRole = realmMapping.doesUserHaveRole(principal, rolePrincipals);
+
+ if (trace) { log.trace("user " + user + (hasRole ? " is " : " is NOT ") + "authorized"); }
+
+ return hasRole;
+ }
+
+ private Set getRolePrincipals(CheckType checkType, HashSet<Role> roles)
+ {
+ Set<SimplePrincipal> principals = new HashSet<SimplePrincipal>();
+ for (Role role : roles)
+ {
+ if((checkType.equals(CheckType.CREATE) && role.isCreate()) ||
+ (checkType.equals(CheckType.WRITE) && role.isWrite()) ||
+ (checkType.equals(CheckType.READ) && role.isRead()))
+ {
+ principals.add(new SimplePrincipal(role.getName()));
+ }
+ }
+ return principals;
+ }
+
+ // Inner class ---------------------------------------------------
+}
Modified: trunk/src/main/org/jboss/messaging/jms/JBossDestination.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/JBossDestination.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/JBossDestination.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -41,6 +41,11 @@
// Static --------------------------------------------------------
+ protected static String escape(String input)
+ {
+ return input.replace("\\", "\\\\").replace(".", "\\.");
+ }
+
// Attributes ----------------------------------------------------
protected String name;
Modified: trunk/src/main/org/jboss/messaging/jms/JBossTopic.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/JBossTopic.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/JBossTopic.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -24,6 +24,8 @@
import javax.jms.JMSException;
import javax.jms.Topic;
+import org.jboss.messaging.util.Pair;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -41,11 +43,61 @@
// Static --------------------------------------------------------
+ private static final char SEPARATOR = '.';
+
public static String createQueueNameForDurableSubscription(String clientID, String subscriptionName)
{
- return clientID + "." + subscriptionName;
+ return escape(clientID) + SEPARATOR + escape(subscriptionName);
}
+ public static Pair<String, String> decomposeQueueNameForDurableSubscription(String queueName)
+ {
+ StringBuffer[] parts = new StringBuffer[2];
+ int currentPart = 0;
+
+ parts[0] = new StringBuffer();
+ parts[1] = new StringBuffer();
+
+ int pos = 0;
+ while (pos < queueName.length())
+ {
+ char ch = queueName.charAt(pos);
+ pos++;
+
+ if (ch == SEPARATOR)
+ {
+ currentPart++;
+ if (currentPart >= parts.length)
+ {
+ throw new IllegalArgumentException("Invalid message queue name: " + queueName);
+ }
+
+ continue;
+ }
+
+ if (ch == '\\')
+ {
+ if (pos >= queueName.length())
+ {
+ throw new IllegalArgumentException("Invalid message queue name: " + queueName);
+ }
+ ch = queueName.charAt(pos);
+ pos++;
+ }
+
+ parts[currentPart].append(ch);
+ }
+
+ if (currentPart != 1)
+ {
+ throw new IllegalArgumentException("Invalid message queue name: " + queueName);
+ }
+
+ Pair<String, String> pair = new Pair<String, String>(parts[0].toString(), parts[1].toString());
+
+ return pair;
+ }
+
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
@@ -78,8 +130,7 @@
{
return "JBossTopic[" + name + "]";
}
-
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -43,12 +43,12 @@
import javax.jms.XATopicConnection;
import javax.jms.XATopicSession;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientConnection;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.client.impl.ClientConnectionInternal;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
import org.jboss.messaging.util.Version;
/**
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -39,11 +39,11 @@
import javax.naming.NamingException;
import javax.naming.Reference;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientConnection;
import org.jboss.messaging.core.client.ClientConnectionFactory;
import org.jboss.messaging.jms.SerializableObjectRefAddr;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -38,10 +38,10 @@
import javax.jms.MessageNotReadableException;
import javax.jms.MessageNotWriteableException;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.impl.MessageImpl;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -32,10 +32,10 @@
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.client.MessageHandler;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -40,10 +40,10 @@
import javax.jms.Topic;
import javax.jms.TopicPublisher;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.jms.JBossDestination;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -28,9 +28,9 @@
import javax.jms.QueueBrowser;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientBrowser;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -57,6 +57,7 @@
import javax.jms.XATopicSession;
import javax.transaction.xa.XAResource;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.ClientBrowser;
import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.client.ClientProducer;
@@ -69,7 +70,6 @@
import org.jboss.messaging.jms.JBossTemporaryTopic;
import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JMSExceptionHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JMSExceptionHelper.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JMSExceptionHelper.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -26,7 +26,7 @@
import javax.jms.JMSException;
import javax.jms.JMSSecurityException;
-import org.jboss.messaging.util.MessagingException;
+import org.jboss.messaging.core.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -25,9 +25,9 @@
import javax.jms.Session;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.MessageHandler;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
/**
*
Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerDeployer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerDeployer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -22,8 +22,8 @@
package org.jboss.messaging.jms.server;
import org.jboss.logging.Logger;
-import org.jboss.messaging.deployers.DeploymentManager;
-import org.jboss.messaging.deployers.Deployer;
+import org.jboss.messaging.core.deployers.Deployer;
+import org.jboss.messaging.core.deployers.DeploymentManager;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManagerImpl.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManagerImpl.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -21,44 +21,35 @@
*/
package org.jboss.messaging.jms.server;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.jms.Message;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.MessagingServerManagement;
import org.jboss.messaging.core.Queue;
-import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.ServerConnection;
import org.jboss.messaging.core.ServerSession;
import org.jboss.messaging.core.client.ClientConnectionFactory;
-import org.jboss.messaging.core.impl.ServerConnectionImpl;
-import org.jboss.messaging.core.impl.ServerSessionImpl;
-import org.jboss.messaging.core.impl.server.SubscriptionInfo;
-import org.jboss.messaging.core.impl.messagecounter.MessageCounter;
import org.jboss.messaging.core.impl.filter.FilterImpl;
-import org.jboss.messaging.deployers.Deployer;
-import org.jboss.messaging.deployers.DeploymentManager;
+import org.jboss.messaging.core.impl.messagecounter.MessageCounter;
+import org.jboss.messaging.core.impl.server.SubscriptionInfo;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.client.JBossMessage;
-import org.jboss.messaging.jms.server.MessageStatistics;
import org.jboss.messaging.util.JNDIUtil;
-import org.jboss.messaging.util.MessageQueueNameHelper;
-import org.jboss.aop.microcontainer.aspects.jmx.JMX;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.jboss.messaging.util.Pair;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.jms.Message;
-import javax.management.StandardMBean;
-import javax.management.ObjectName;
-import javax.management.MBeanServer;
-import java.util.*;
-import java.lang.management.ManagementFactory;
-
/**
* A Deployer used to create and add to JNDI queues, topics and connection factories. Typically this would only be used
* in an app server env.
@@ -631,9 +622,9 @@
if (queue.isDurable())
{
- MessageQueueNameHelper helper = MessageQueueNameHelper.createHelper(queue.getName());
- subName = helper.getSubName();
- clientID = helper.getClientId();
+ Pair<String, String> pair = JBossTopic.decomposeQueueNameForDurableSubscription(queue.getName());
+ clientID = pair.a;
+ subName = pair.b;
}
SubscriptionInfo info = new SubscriptionInfo(queue.getName(), queue.isDurable(), subName, clientID,
Deleted: trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.util;
-
-
-/**
- * A ExceptionUtil
-
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class ExceptionUtil
-{
- private static final Logger log = Logger.getLogger(ExceptionUtil.class);
-
-
- /*
- * This method is used to log any Throwables occurring in the execution of JMX methods before
- * propagating them back to the caller.
- * If we don't log them then we have no record of them occurring on the server.
- */
- public static Exception handleJMXInvocation(Throwable t, String msg)
- {
- log.error(msg, t);
-
- if (t instanceof RuntimeException)
- {
- throw (RuntimeException)t;
- }
- else if (t instanceof Error)
- {
- throw (Error)t;
- }
- else if (t instanceof Exception)
- {
- //Some other non RuntimeException
- return (Exception)t;
- }
- else
- {
- //Some other subclass of Throwable
- throw new RuntimeException(msg);
- }
- }
-}
Modified: trunk/src/main/org/jboss/messaging/util/HierarchicalObjectRepository.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/HierarchicalObjectRepository.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/HierarchicalObjectRepository.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -21,12 +21,16 @@
*/
package org.jboss.messaging.util;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.jboss.messaging.core.Mergeable;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.lang.reflect.ParameterizedType;
-
/**
* allows objects to be mapped against a regex pattern and held in order in a list
*
Modified: trunk/src/main/org/jboss/messaging/util/Match.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Match.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/Match.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -21,11 +21,10 @@
*/
package org.jboss.messaging.util;
-
import java.util.regex.Pattern;
/**
- * a Match is the holder for the match string and the object to hold against it.
+ a Match is the holder for the match string and the object to hold against it.
*/
public class Match<T>
{
Deleted: trunk/src/main/org/jboss/messaging/util/MessageQueueNameHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/MessageQueueNameHelper.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/MessageQueueNameHelper.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.util;
-
-
-/**
- * A MessageQueueNameHelper
- *
- * By convention, we name durable topic message queue names in the following way:
- *
- * <clientid>.<sub_name>
- *
- * This is a helper class to aid in converting between the string form and the client id
- * and subscription name and vice versa
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class MessageQueueNameHelper
-{
- private String clientId;
-
- private String subName;
-
- private static char ESCAPE = '\\';
- private static char SEPARATOR_CHAR = '.';
- private static String SEPARATOR = ".";
-
- private MessageQueueNameHelper(String messageQueueName)
- {
- if (messageQueueName == null)
- {
- throw new IllegalArgumentException("Message queue name is null");
- }
-
- StringBuffer[] parts = new StringBuffer[2];
- int currentPart = 0;
-
- parts[0] = new StringBuffer();
- parts[1] = new StringBuffer();
-
- int pos = 0;
- while (pos < messageQueueName.length())
- {
- char ch = messageQueueName.charAt(pos);
- pos++;
-
- if (ch == SEPARATOR_CHAR)
- {
- currentPart++;
- if (currentPart >= parts.length)
- {
- throw new IllegalArgumentException("Invalid message queue name: " + messageQueueName);
- }
-
- continue;
- }
-
- if (ch == ESCAPE)
- {
- if (pos >= messageQueueName.length())
- {
- throw new IllegalArgumentException("Invalid message queue name: " + messageQueueName);
- }
- ch = messageQueueName.charAt(pos);
- pos++;
- }
-
- parts[currentPart].append(ch);
- }
-
- if (currentPart != 1)
- {
- throw new IllegalArgumentException("Invalid message queue name: " + messageQueueName);
- }
-
- clientId = parts[0].toString();
- subName = parts[1].toString();
- }
-
- private static String escape(String input)
- {
- return input.replace("\\", "\\\\").replace(".", "\\.");
- }
-
- public String getClientId()
- {
- return clientId;
- }
-
- public String getSubName()
- {
- return subName;
- }
-
- public static MessageQueueNameHelper createHelper(String messageQueueName)
- {
- return new MessageQueueNameHelper(messageQueueName);
- }
-
- public static String createSubscriptionName(String clientID, String subName)
- {
- if (clientID == null)
- {
- throw new IllegalArgumentException("clientID name is null");
- }
- if (subName == null)
- {
- throw new IllegalArgumentException("Subscription name is null");
- }
-
- return escape(clientID) + SEPARATOR + escape(subName);
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/MessagingException.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/MessagingException.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/MessagingException.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.util;
-
-/**
- *
- * A MessagingException
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class MessagingException extends Exception
-{
- private static final long serialVersionUID = -4802014152804997417L;
-
- // Error codes -------------------------------------------------
-
- public static final int INTERNAL_ERROR = 000;
-
- public static final int UNSUPPORTED_PACKET = 001;
-
- public static final int NOT_CONNECTED = 002;
-
- public static final int CONNECTION_TIMEDOUT = 003;
-
-
- public static final int QUEUE_DOES_NOT_EXIST = 100;
-
- public static final int QUEUE_EXISTS = 101;
-
- public static final int OBJECT_CLOSED = 102;
-
- public static final int INVALID_FILTER_EXPRESSION = 103;
-
- public static final int ILLEGAL_STATE = 104;
-
- public static final int SECURITY_EXCEPTION = 105;
-
- public static final int ADDRESS_DOES_NOT_EXIST = 106;
-
- public static final int ADDRESS_EXISTS = 107;
-
- private int code;
-
- public MessagingException()
- {
- }
-
- public MessagingException(int code)
- {
- this.code = code;
- }
-
- public MessagingException(int code, String msg)
- {
- super(msg);
-
- this.code = code;
- }
-
- public int getCode()
- {
- return code;
- }
-
- public String toString()
- {
- return "MessagingException[errorCode=" + code + " message=" + getMessage() + "]";
- }
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/NotYetImplementedException.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/NotYetImplementedException.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/NotYetImplementedException.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.util;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class NotYetImplementedException extends RuntimeException
-{
- // Constants -----------------------------------------------------
-
- private static final long serialVersionUID = 3795167990062836913L;
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public NotYetImplementedException()
- {
- super();
- }
-
- public NotYetImplementedException(String msg)
- {
- super(msg);
- }
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/src/main/org/jboss/messaging/util/RemotingException.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/RemotingException.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/RemotingException.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.messaging.util;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class RemotingException extends MessagingException
-{
-
- // Constants -----------------------------------------------------
-
- private static final long serialVersionUID = -6849945921631932738L;
-
- // Attributes ----------------------------------------------------
-
- private String sessionID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public RemotingException(int code, String message, String sessionID)
- {
- super(code, message);
- this.sessionID = sessionID;
- }
-
- // Public --------------------------------------------------------
-
- public String getSessionID()
- {
- return sessionID;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/src/main/org/jboss/messaging/util/Util.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Util.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/Util.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,145 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.util;
-
-import java.io.StringReader;
-import java.sql.Connection;
-
-import javax.jms.DeliveryMode;
-import javax.jms.Session;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class Util
- {
- // Constants -----------------------------------------------------
-
- public static Logger log = Logger.getLogger(Util.class);
-
- // Static --------------------------------------------------------
-
- public static String guidToString(Object o)
- {
- if (o == null)
- {
- return "null";
- }
- if (!(o instanceof String))
- {
- return o.toString();
- }
- String s = (String)o;
- int idx = s.lastIndexOf('-', s.lastIndexOf('-') - 1);
- if (idx < 0)
- {
- return s;
- }
- return "...-" + s.substring(idx + 1);
- }
-
-
-
- public static String transactionIsolationToString(int level)
- {
- return
- level == Connection.TRANSACTION_NONE ? "NONE" :
- level == Connection.TRANSACTION_READ_UNCOMMITTED ? "READ_UNCOMMITTED" :
- level == Connection.TRANSACTION_READ_COMMITTED ? "READ_COMMITTED" :
- level == Connection.TRANSACTION_REPEATABLE_READ ? "REPEATABLE_READ" :
- level == Connection.TRANSACTION_SERIALIZABLE ? "SERIALIZABLE" :
- "UNKNOWN";
- }
-
- /**
- * TODO this is a duplicate of test.XMLUtil.stringToElement().
- * Only used by ServerPeer.createDestination(). Get rid of this when I fix that method.
- */
- public static Element stringToElement(String s) throws Exception
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- Document doc = parser.parse(new InputSource(new StringReader(s)));
- return doc.getDocumentElement();
- }
-
- public static String deliveryMode(int m)
- {
- if (m == DeliveryMode.NON_PERSISTENT)
- {
- return "NON_PERSISTENT";
- }
- if (m == DeliveryMode.PERSISTENT)
- {
- return "PERSISTENT";
- }
- return "UNKNOWN";
- }
-
- public static String acknowledgmentMode(int ack)
- {
- if (ack == Session.AUTO_ACKNOWLEDGE)
- {
- return "AUTO_ACKNOWLEDGE";
- }
- if (ack == Session.CLIENT_ACKNOWLEDGE)
- {
- return "CLIENT_ACKNOWLEDGE";
- }
- if (ack == Session.DUPS_OK_ACKNOWLEDGE)
- {
- return "DUPS_OK_ACKNOWLEDGE";
- }
- if (ack == Session.SESSION_TRANSACTED)
- {
- return "SESSION_TRANSACTED";
- }
- return "UNKNOWN";
- }
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- private Util()
- {
- }
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/src/main/org/jboss/messaging/util/WeakHashSet.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/WeakHashSet.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/src/main/org/jboss/messaging/util/WeakHashSet.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.util;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class WeakHashSet<Key> extends AbstractHashSet<Key>
-{
- public WeakHashSet()
- {
- super();
- }
-
-
- protected Map buildInternalHashMap()
- {
- return new WeakHashMap();
- }
-}
Modified: trunk/tests/src/org/jboss/jms/server/deployer/test/unit/DeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/jms/server/deployer/test/unit/DeployerTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/jms/server/deployer/test/unit/DeployerTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -23,7 +23,8 @@
import junit.framework.TestCase;
-import org.jboss.messaging.deployers.Deployer;
+
+import org.jboss.messaging.core.deployers.Deployer;
import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Modified: trunk/tests/src/org/jboss/jms/server/security/test/unit/SecurityDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/jms/server/security/test/unit/SecurityDeployerTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/jms/server/security/test/unit/SecurityDeployerTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -23,8 +23,8 @@
import junit.framework.TestCase;
import org.easymock.EasyMock;
+import org.jboss.messaging.core.deployers.security.SecurityDeployer;
import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.deployers.security.SecurityDeployer;
import org.jboss.messaging.util.HierarchicalRepository;
import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Element;
Modified: trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -23,9 +23,9 @@
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.impl.MessageImpl;
import org.jboss.messaging.core.impl.filter.FilterImpl;
-import org.jboss.messaging.util.MessagingException;
import org.jboss.test.messaging.JBMBaseTestCase;
/**
Modified: trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptor.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptor.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptor.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -9,11 +9,11 @@
import java.util.concurrent.atomic.AtomicInteger;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.Interceptor;
import org.jboss.messaging.core.remoting.wireformat.DeliverMessage;
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
public class DummyInterceptor implements Interceptor
{
Modified: trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptorB.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptorB.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/core/remoting/impl/integration/DummyInterceptorB.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -9,10 +9,10 @@
import java.util.concurrent.atomic.AtomicInteger;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.Interceptor;
import org.jboss.messaging.core.remoting.wireformat.Packet;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.MessagingException;
public class DummyInterceptorB implements Interceptor
{
Modified: trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ClientKeepAliveTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ClientKeepAliveTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ClientKeepAliveTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -22,17 +22,17 @@
import junit.framework.TestCase;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.KeepAliveFactory;
import org.jboss.messaging.core.remoting.NIOSession;
import org.jboss.messaging.core.remoting.RemotingConfiguration;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.core.remoting.impl.mina.ClientKeepAliveFactory;
import org.jboss.messaging.core.remoting.impl.mina.MinaConnector;
import org.jboss.messaging.core.remoting.impl.mina.MinaService;
import org.jboss.messaging.core.remoting.wireformat.Ping;
import org.jboss.messaging.core.remoting.wireformat.Pong;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/MinaKeepAliveFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/MinaKeepAliveFactoryTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/MinaKeepAliveFactoryTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -17,11 +17,11 @@
import junit.framework.TestCase;
import org.apache.mina.common.IoSession;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.remoting.KeepAliveFactory;
import org.jboss.messaging.core.remoting.impl.mina.FailureNotifier;
import org.jboss.messaging.core.remoting.impl.mina.MinaKeepAliveFactory;
import org.jboss.messaging.core.remoting.wireformat.Pong;
-import org.jboss.messaging.util.MessagingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ServerKeepAliveTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ServerKeepAliveTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/core/remoting/impl/mina/integration/test/ServerKeepAliveTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -16,16 +16,16 @@
import junit.framework.TestCase;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.NIOSession;
import org.jboss.messaging.core.remoting.RemotingConfiguration;
+import org.jboss.messaging.core.remoting.RemotingException;
import org.jboss.messaging.core.remoting.impl.mina.MinaConnector;
import org.jboss.messaging.core.remoting.impl.mina.MinaService;
import org.jboss.messaging.core.remoting.impl.mina.ServerKeepAliveFactory;
import org.jboss.messaging.core.remoting.wireformat.Ping;
import org.jboss.messaging.core.remoting.wireformat.Pong;
-import org.jboss.messaging.util.MessagingException;
-import org.jboss.messaging.util.RemotingException;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/deployers/queue/tests/unit/QueueSettingsDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/deployers/queue/tests/unit/QueueSettingsDeployerTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/messaging/deployers/queue/tests/unit/QueueSettingsDeployerTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
import org.easymock.EasyMock;
import org.jboss.messaging.core.QueueSettings;
-import org.jboss.messaging.deployers.queue.QueueSettingsDeployer;
+import org.jboss.messaging.core.deployers.queue.QueueSettingsDeployer;
import org.jboss.messaging.util.HierarchicalRepository;
import org.jboss.messaging.util.XMLUtil;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -786,9 +786,11 @@
protected void tearDown() throws Exception
{
super.tearDown();
+
+ servers.get(0).invalidateSecurity();
setSecurityConfig(oldDefaultConfig);
- configureSecurityForDestination("Queue1",true, null);
+ configureSecurityForDestination("Queue1", true, null);
configureSecurityForDestination("Queue2", true, null);
configureSecurityForDestination("Topic1", false, null);
configureSecurityForDestination("Topic2", false, null);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/network/ClientNetworkFailureTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/network/ClientNetworkFailureTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/jms/network/ClientNetworkFailureTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -32,10 +32,10 @@
import javax.jms.JMSException;
import javax.jms.QueueConnection;
+import org.jboss.messaging.core.MessagingException;
import org.jboss.messaging.core.client.FailureListener;
import org.jboss.messaging.core.remoting.RemotingConfiguration;
import org.jboss.messaging.core.remoting.impl.mina.MinaService;
-import org.jboss.messaging.util.MessagingException;
import org.jboss.test.messaging.jms.JMSTestCase;
/**
Deleted: trunk/tests/src/org/jboss/test/messaging/jms/util/MessageQueueNameHelperTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/util/MessageQueueNameHelperTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/jms/util/MessageQueueNameHelperTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.messaging.jms.util;
-
-import junit.framework.TestCase;
-
-import org.jboss.messaging.util.MessageQueueNameHelper;
-
-
-public class MessageQueueNameHelperTest extends TestCase
-{
- // Constants -----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public MessageQueueNameHelperTest(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void testQueueName()
- {
- String name = "clientid123.mysub";
-
- MessageQueueNameHelper helper = MessageQueueNameHelper.createHelper(name);
-
- assertEquals("clientid123", helper.getClientId());
- assertEquals("mysub", helper.getSubName());
- }
-
- public void testCreate()
- {
- String name = MessageQueueNameHelper.createSubscriptionName("clientid456", "mysub2");
-
- assertEquals("clientid456.mysub2", name);
- }
-
- public void testEscaping()
- {
- String clientID = ".client.id.";
- String subscriptionName = ".subscription.name.";
-
- String queueName = MessageQueueNameHelper.createSubscriptionName(clientID, subscriptionName);
- assertEquals("\\.client\\.id\\..\\.subscription\\.name\\.", queueName);
-
- MessageQueueNameHelper helper = MessageQueueNameHelper.createHelper(queueName);
-
- assertEquals(clientID, helper.getClientId());
- assertEquals(subscriptionName, helper.getSubName());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
-
-
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -731,18 +731,6 @@
//servers.get(0).configureSecurityForDestination(destName, config);
}
- public static void setDefaultSecurityConfig(String config) throws Exception
- {
-
- servers.get(0).setDefaultSecurityConfig(config);
- }
-
- public static String getDefaultSecurityConfig() throws Exception
- {
-
- return servers.get(0).getDefaultSecurityConfig();
- }
-
public static Hashtable getJNDIEnvironment()
{
return getJNDIEnvironment(0);
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -43,7 +43,6 @@
import org.jboss.messaging.microcontainer.NonSerializableFactory;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.NotYetImplementedException;
/**
@@ -85,7 +84,7 @@
public Object lookup(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object lookup(String name) throws NamingException
@@ -119,7 +118,7 @@
public void bind(Name name, Object obj) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void bind(String name, Object obj) throws NamingException
@@ -129,7 +128,7 @@
public void rebind(Name name, Object obj) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void rebind(String name, Object obj) throws NamingException
@@ -165,27 +164,27 @@
public void rename(Name oldName, Name newName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void rename(String oldName, String newName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration list(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration list(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration listBindings(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration listBindings(String contextName) throws NamingException
@@ -225,7 +224,7 @@
public Context createSubcontext(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Context createSubcontext(String name) throws NamingException
@@ -242,12 +241,12 @@
public Object lookupLink(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object lookupLink(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NameParser getNameParser(Name name) throws NamingException
@@ -262,22 +261,22 @@
public Name composeName(Name name, Name prefix) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public String composeName(String name, String prefix) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object addToEnvironment(String propName, Object propVal) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object removeFromEnvironment(String propName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Hashtable getEnvironment() throws NamingException
@@ -362,7 +361,7 @@
public void close() throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public boolean hasMore() throws NamingException
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -662,8 +662,10 @@
public void configureSecurityForDestination(String destName, boolean isQueue, HashSet<Role> roles) throws Exception
{
+ getMessagingServer().getSecurityStore().invalidateCache();
+
String prefix = isQueue ? "queuejms." : "topicjms.";
- if(roles != null)
+ if (roles != null)
{
getMessagingServer().getSecurityRepository().addMatch(prefix + destName, roles);
}
@@ -672,18 +674,12 @@
getMessagingServer().getSecurityRepository().removeMatch(prefix + destName);
}
}
-
- public void setDefaultSecurityConfig(String config) throws Exception
+
+ public void invalidateSecurity() throws Exception
{
- //todo
+ getMessagingServer().getSecurityStore().invalidateCache();
}
- public String getDefaultSecurityConfig() throws Exception
- {
- //todo
- return "";
- }
-
public Object executeCommand(Command command) throws Exception
{
return command.execute(this);
@@ -821,14 +817,16 @@
public void setSecurityConfig(HashSet<Role> defConfig) throws Exception
{
+ getMessagingServer().getSecurityStore().invalidateCache();
getMessagingServer().getSecurityRepository().removeMatch("*");
- getMessagingServer().getSecurityRepository().addMatch("*", defConfig);
+ getMessagingServer().getSecurityRepository().addMatch("*", defConfig);
}
public void setSecurityConfigOnManager(boolean b, String s, HashSet<Role> conf) throws Exception
{
String prefix = b ? "queuejms." : "topicjms.";
+ getMessagingServer().getSecurityStore().invalidateCache();
getMessagingServer().getSecurityRepository().addMatch(prefix + s, conf);
}
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -467,17 +467,7 @@
{
server.configureSecurityForDestination(destName, isQueue, roles);
}
-
- public void setDefaultSecurityConfig(String config) throws Exception
- {
- server.setDefaultSecurityConfig(config);
- }
-
- public String getDefaultSecurityConfig() throws Exception
- {
- return server.getDefaultSecurityConfig();
- }
-
+
public Object executeCommand(Command command) throws Exception
{
return server.executeCommand(command);
@@ -488,26 +478,6 @@
return server.getUserTransaction();
}
-// public Set getNodeIDView() throws Exception
-// {
-// return server.getNodeIDView();
-// }
-//
-// public Map getFailoverMap() throws Exception
-// {
-// return server.getFailoverMap();
-// }
-//
-// public Map getRecoveryArea(String queueName) throws Exception
-// {
-// return server.getRecoveryArea(queueName);
-// }
-//
-// public int getRecoveryMapSize(String queueName) throws Exception
-// {
-// return server.getRecoveryMapSize(queueName);
-// }
-
public List pollNotificationListener(long listenerID) throws Exception
{
ProxyNotificationListener pl = null;
@@ -615,6 +585,11 @@
return new InitialContext(env);
}
+
+ public void invalidateSecurity() throws Exception
+ {
+ server.invalidateSecurity();
+ }
// Inner classes -------------------------------------------------
}
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteContext.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteContext.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteContext.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -31,7 +31,6 @@
import javax.naming.NamingException;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.NotYetImplementedException;
/**
@@ -69,7 +68,7 @@
public Object lookup(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object lookup(String name) throws NamingException
@@ -87,7 +86,7 @@
public void bind(Name name, Object obj) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void bind(String name, Object obj) throws NamingException
@@ -105,82 +104,82 @@
public void rebind(Name name, Object obj) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void rebind(String name, Object obj) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void unbind(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void unbind(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void rename(Name oldName, Name newName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void rename(String oldName, String newName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration list(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration list(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration listBindings(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NamingEnumeration listBindings(String contextName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void destroySubcontext(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void destroySubcontext(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Context createSubcontext(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Context createSubcontext(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object lookupLink(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object lookupLink(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public NameParser getNameParser(Name name) throws NamingException
@@ -190,32 +189,32 @@
public NameParser getNameParser(String name) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Name composeName(Name name, Name prefix) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public String composeName(String name, String prefix) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object addToEnvironment(String propName, Object propVal) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Object removeFromEnvironment(String propName) throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public Hashtable getEnvironment() throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
public void close() throws NamingException
@@ -224,7 +223,7 @@
public String getNameInNamespace() throws NamingException
{
- throw new NotYetImplementedException();
+ throw new UnsupportedOperationException();
}
// Public --------------------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -233,18 +233,6 @@
void configureSecurityForDestination(String destName, boolean isQueue, HashSet<Role> roles) throws Exception;
/**
- * @param config - sending 'config' as a String and not as an org.w3c.dom.Element to avoid
- * NotSerializableExceptions that show up when running tests on JDK 1.4.
- */
- void setDefaultSecurityConfig(String config) throws Exception;
-
- /**
- * @return a String that can be converted to an org.w3c.dom.Element using
- * ServerManagement.toElement().
- */
- String getDefaultSecurityConfig() throws Exception;
-
- /**
* Executes a command on the server
*
* @param command
@@ -256,20 +244,6 @@
UserTransaction getUserTransaction() throws Exception;
/**
- * Returns a Set containing the nodeID (as Integers) of all cluster members at the time of the
- * call.
- *
- * USE IT ONLY FOR CLUSTERING TESTS!
- */
-// Set getNodeIDView() throws Exception;
-//
-// Map getFailoverMap() throws Exception;
-//
-// Map getRecoveryArea(String queueName) throws Exception;
-//
-// int getRecoveryMapSize(String queueName) throws Exception;
-
- /**
* @return List<Notification>
*/
List pollNotificationListener(long listenerID) throws Exception;
@@ -300,4 +274,6 @@
//void setDefaultRedeliveryDelay(long delay) throws Exception;
JMSServerManager getJMSServerManager() throws Exception;
+
+ void invalidateSecurity() throws Exception;
}
Deleted: trunk/tests/src/org/jboss/test/messaging/util/UtilTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/util/UtilTest.java 2008-02-25 21:14:36 UTC (rev 3797)
+++ trunk/tests/src/org/jboss/test/messaging/util/UtilTest.java 2008-02-26 08:33:27 UTC (rev 3798)
@@ -1,64 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.messaging.util;
-
-import org.jboss.messaging.util.Util;
-import org.jboss.test.messaging.MessagingTestCase;
-
-
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- */
-public class UtilTest extends MessagingTestCase
-{
- // Constructors --------------------------------------------------
-
- public UtilTest(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void setUp() throws Exception
- {
- super.setUp();
- }
-
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- public void testGuidToString()
- {
- assertEquals("abcd", Util.guidToString("abcd"));
- assertEquals("abcd-", Util.guidToString("abcd-"));
- assertEquals("-d", Util.guidToString("-d"));
- assertEquals("abc-d", Util.guidToString("abc-d"));
- assertEquals("...-c-d", Util.guidToString("ab-c-d"));
-
- }
-
-}
More information about the jboss-cvs-commits
mailing list