[jboss-cvs] JBoss Messaging SVN: r2681 - in trunk: src/main/org/jboss/jms and 19 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 14 20:09:10 EDT 2007
Author: timfox
Date: 2007-05-14 20:09:10 -0400 (Mon, 14 May 2007)
New Revision: 2681
Added:
trunk/src/main/org/jboss/jms/server/selector/
trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java
trunk/src/main/org/jboss/jms/server/selector/Identifier.java
trunk/src/main/org/jboss/jms/server/selector/Operator.java
trunk/src/main/org/jboss/jms/server/selector/RegExp.java
trunk/src/main/org/jboss/jms/server/selector/Selector.java
trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java
trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj
Removed:
trunk/src/main/org/jboss/jms/client/ha/
trunk/src/main/org/jboss/jms/selector/
trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java
trunk/src/main/org/jboss/jms/server/selector/Identifier.java
trunk/src/main/org/jboss/jms/server/selector/Operator.java
trunk/src/main/org/jboss/jms/server/selector/RegExp.java
trunk/src/main/org/jboss/jms/server/selector/Selector.java
trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java
trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj
trunk/src/main/org/jboss/jms/shared/
Modified:
trunk/build-messaging.xml
trunk/src/main/org/jboss/jms/client/FailoverEvent.java
trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java
trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingFactory.java
trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingPolicy.java
trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
trunk/src/main/org/jboss/jms/client/state/SessionState.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java
trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java
trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java
trunk/src/main/org/jboss/jms/tx/ClientTransaction.java
trunk/src/main/org/jboss/jms/tx/LocalTx.java
trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
trunk/src/main/org/jboss/jms/tx/ResourceManager.java
trunk/src/main/org/jboss/jms/tx/ResourceManagerFactory.java
trunk/src/main/org/jboss/jms/tx/TransactionRequest.java
trunk/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java
trunk/src/main/org/jboss/jms/wireformat/PolledCallbacksDelivery.java
trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java
trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java
trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java
trunk/src/main/org/jboss/messaging/core/message/SimpleMessageReference.java
trunk/src/main/org/jboss/messaging/core/plugin/ClusteredPostOfficeService.java
trunk/src/main/org/jboss/messaging/core/plugin/DefaultPostOfficeService.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultFailoverMapper.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PullMessageResultRequest.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/TransactionRequest.java
trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorParserTest.java
trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorSyntaxTest.java
trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
Log:
server and client step7
Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/build-messaging.xml 2007-05-15 00:09:10 UTC (rev 2681)
@@ -245,10 +245,10 @@
<target name="compile-parsers">
- <mkdir dir="${build.parsers}/org/jboss/jms/selector"/>
+ <mkdir dir="${build.parsers}/org/jboss/jms/server/selector"/>
<echo message="${sun.javacc.lib}"/>
- <javacc target="${source.java}/org/jboss/jms/selector/SelectorParser.jj"
- outputdirectory="${build.parsers}/org/jboss/jms/selector"
+ <javacc target="${source.java}/org/jboss/jms/server/selector/SelectorParser.jj"
+ outputdirectory="${build.parsers}/org/jboss/jms/server/selector"
javacchome="${sun.javacc.lib}"
static="false"/>
@@ -266,15 +266,15 @@
failonerror="${javac.fail.onerror}">
<src path="${build.parsers}"/>
<src path="${source.java}"/>
- <include name="org/jboss/jms/selector/ASCII_CharStream.java"/>
- <include name="org/jboss/jms/selector/ParserException.java"/>
- <include name="org/jboss/jms/selector/SelectorParser.java"/>
- <include name="org/jboss/jms/selector/SelectorParserConstants.java"/>
- <include name="org/jboss/jms/selector/SelectorParserTokenManager.java"/>
- <include name="org/jboss/jms/selector/Token.java"/>
- <include name="org/jboss/jms/selector/TokenMgrError.java"/>
- <include name="org/jboss/jms/selector/Operator.java"/>
- <include name="org/jboss/jms/selector/Identifier.java"/>
+ <include name="org/jboss/jms/server/selector/ASCII_CharStream.java"/>
+ <include name="org/jboss/jms/server/selector/ParserException.java"/>
+ <include name="org/jboss/jms/server/selector/SelectorParser.java"/>
+ <include name="org/jboss/jms/server/selector/SelectorParserConstants.java"/>
+ <include name="org/jboss/jms/server/selector/SelectorParserTokenManager.java"/>
+ <include name="org/jboss/jms/server/selector/Token.java"/>
+ <include name="org/jboss/jms/server/selector/TokenMgrError.java"/>
+ <include name="org/jboss/jms/server/selector/Operator.java"/>
+ <include name="org/jboss/jms/server/selector/Identifier.java"/>
<classpath refid="compilation.classpath"/>
</javac>
</target>
@@ -455,7 +455,11 @@
value="jboss-aop.jar jboss-remoting.jar jboss-serialization.jar javassist.jar trove.jar jboss-common-core.jar jboss-common-client.jar jboss-j2ee.jar jboss-j2se.jar jnp-client.jar concurrent.jar log4j.jar commons-logging.jar"/>
</manifest>
<fileset dir="${build.classes}">
- <include name="org/jboss/jms/client/**/*.class"/>
+ <include name="org/jboss/jms/client/**/*.class"/>
+ <include name="org/jboss/jms/delegate/**/*.class"/>
+ <include name="org/jboss/jms/destination/**/*.class"/>
+ <include name="org/jboss/jms/message/**/*.class"/>
+ <include name="org/jboss/jms/tx/**/*.class"/>
</fileset>
<fileset dir="${build.etc}">
<include name="VERSION"/>
Modified: trunk/src/main/org/jboss/jms/client/FailoverEvent.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/FailoverEvent.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/FailoverEvent.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -17,7 +17,9 @@
{
// Constants ------------------------------------------------------------------------------------
- public static final int FAILURE_DETECTED = 10;
+ private static final long serialVersionUID = 8451706459791859231L;
+
+ public static final int FAILURE_DETECTED = 10;
public static final int FAILOVER_STARTED = 20;
public static final int FAILOVER_COMPLETED = 30;
public static final int FAILOVER_FAILED = 100;
Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -187,7 +187,7 @@
{
List mesList = new ArrayList();
- outer: while (true)
+ while (true)
{
if (closed)
{
@@ -198,7 +198,7 @@
if (mesList.isEmpty())
{
// Remove up to maxMessages messages from the consumer
- inner: for (int i = 0; i < maxMessages; i++)
+ for (int i = 0; i < maxMessages; i++)
{
// receiveNoWait
Modified: trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -26,14 +26,14 @@
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.jms.client.FailoverListener;
import org.jboss.jms.client.JBossConnectionMetaData;
-import org.jboss.jms.client.FailoverListener;
+import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
-import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.message.MessageIdGeneratorFactory;
-import org.jboss.jms.client.tx.ResourceManagerFactory;
+import org.jboss.jms.tx.ResourceManagerFactory;
/**
* Handles operations related to the connection
Modified: trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -59,8 +59,8 @@
import org.jboss.jms.message.TextMessageProxy;
import org.jboss.jms.server.endpoint.DefaultCancel;
import org.jboss.jms.server.endpoint.DeliveryInfo;
-import org.jboss.jms.client.tx.LocalTx;
-import org.jboss.jms.client.tx.ResourceManager;
+import org.jboss.jms.tx.LocalTx;
+import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
/**
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -52,13 +52,15 @@
{
// Constants ------------------------------------------------------------------------------------
+ private static final long serialVersionUID = 3048255931412144958L;
+
// Attributes -----------------------------------------------------------------------------------
// Static ---------------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
- public ClientBrowserDelegate(int objectID)
+ public ClientBrowserDelegate(int objectID)
{
super(objectID);
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -35,11 +35,11 @@
import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.state.HierarchicalState;
-import org.jboss.jms.client.tx.ResourceManagerFactory;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.server.Version;
+import org.jboss.jms.tx.ResourceManagerFactory;
+import org.jboss.jms.tx.TransactionRequest;
import org.jboss.jms.wireformat.CloseRequest;
import org.jboss.jms.wireformat.ClosingRequest;
import org.jboss.jms.wireformat.ConnectionCreateSessionDelegateRequest;
@@ -70,8 +70,10 @@
{
// Constants ------------------------------------------------------------------------------------
- private static final Logger log = Logger.getLogger(ClientConnectionDelegate.class);
+ private static final long serialVersionUID = -5485083713058725777L;
+ private static final Logger log = Logger.getLogger(ClientConnectionDelegate.class);
+
// Attributes -----------------------------------------------------------------------------------
private int serverID;
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -52,8 +52,10 @@
{
// Constants ------------------------------------------------------------------------------------
- private static final Logger log = Logger.getLogger(ClientConsumerDelegate.class);
+ private static final long serialVersionUID = 3253922610778321868L;
+ private static final Logger log = Logger.getLogger(ClientConsumerDelegate.class);
+
// Attributes -----------------------------------------------------------------------------------
private int bufferSize;
Modified: trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -62,10 +62,10 @@
{
// Constants ------------------------------------------------------------------------------------
- private static final Logger log = Logger.getLogger(DelegateSupport.class);
+ private static final long serialVersionUID = -1362079381836473747L;
+
+ private static final Logger log = Logger.getLogger(DelegateSupport.class);
- private static final long serialVersionUID = -8066842892620236541L;
-
private static boolean trace = log.isTraceEnabled();
// Attributes -----------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingFactory.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingFactory.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -31,9 +31,11 @@
*/
public class RandomLoadBalancingFactory extends LoadBalancingFactory
{
-
// Constants ------------------------------------------------------------------------------------
+ private static final long serialVersionUID = 1309306819552168488L;
+
+
// Attributes -----------------------------------------------------------------------------------
// Static ---------------------------------------------------------------------------------------
@@ -42,7 +44,7 @@
// Public ---------------------------------------------------------------------------------------
- // Implementation of LoadBalancingFactory -------------------------------------------------------
+ // Implementation of LoadBalancingFactory -------------------------------------------------------
public LoadBalancingPolicy createLoadBalancingPolicy(ConnectionFactoryDelegate[] view)
{
return new RandomLoadBalancingPolicy(view);
Modified: trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingPolicy.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingPolicy.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/plugin/RandomLoadBalancingPolicy.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -32,12 +32,13 @@
*/
public class RandomLoadBalancingPolicy implements LoadBalancingPolicy
{
-
// Constants ------------------------------------------------------------------------------------
+ private static final long serialVersionUID = -4377960504057811985L;
+
// Attributes -----------------------------------------------------------------------------------
- private ConnectionFactoryDelegate[] delegates;
+ private ConnectionFactoryDelegate[] delegates;
private transient Random random = null;
// Static ---------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,17 +24,17 @@
import java.util.HashSet;
import java.util.Iterator;
-import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.FailoverCommandCenter;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
+import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
-import org.jboss.jms.client.FailoverCommandCenter;
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.delegate.ConnectionFactoryDelegate;
import org.jboss.jms.message.MessageIdGenerator;
import org.jboss.jms.server.Version;
-import org.jboss.jms.client.tx.ResourceManager;
-import org.jboss.jms.client.tx.ResourceManagerFactory;
+import org.jboss.jms.tx.ResourceManager;
+import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
import EDU.oswego.cs.dl.util.concurrent.SyncSet;
Modified: trunk/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -44,8 +44,8 @@
import org.jboss.jms.server.Version;
import org.jboss.jms.server.endpoint.DeliveryInfo;
import org.jboss.jms.server.endpoint.DeliveryRecovery;
-import org.jboss.jms.client.tx.MessagingXAResource;
-import org.jboss.jms.client.tx.ResourceManager;
+import org.jboss.jms.tx.MessagingXAResource;
+import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
import org.jboss.messaging.util.ClearableQueuedExecutor;
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -33,7 +33,6 @@
import java.util.Set;
import java.util.StringTokenizer;
-import javax.jms.InvalidClientIDException;
import javax.management.Attribute;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServer;
@@ -45,7 +44,6 @@
import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
import org.jboss.jms.server.connectormanager.SimpleConnectorManager;
import org.jboss.jms.server.destination.ManagedQueue;
-import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.server.messagecounter.MessageCounterManager;
Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -25,8 +25,8 @@
import java.util.Iterator;
import java.util.List;
-import org.jboss.jms.selector.Selector;
import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.server.selector.Selector;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.message.Message;
Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -26,9 +26,9 @@
import java.util.Iterator;
import java.util.List;
-import org.jboss.jms.selector.Selector;
import org.jboss.jms.server.JMSCondition;
import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.server.selector.Selector;
import org.jboss.jms.util.MessageQueueNameHelper;
import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.message.Message;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,8 +24,8 @@
import javax.jms.JMSException;
import org.jboss.jms.client.Closeable;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.tx.TransactionRequest;
import org.jboss.messaging.core.plugin.IDBlock;
import org.jboss.messaging.core.tx.MessagingXid;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -29,7 +29,7 @@
import javax.jms.Message;
import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.selector.Selector;
+import org.jboss.jms.server.selector.Selector;
import org.jboss.jms.util.ExceptionUtil;
import org.jboss.jms.wireformat.Dispatcher;
import org.jboss.logging.Logger;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -35,9 +35,6 @@
import org.jboss.aop.AspectManager;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.remoting.CallbackManager;
-import org.jboss.jms.client.tx.ClientTransaction;
-import org.jboss.jms.client.tx.TransactionRequest;
-import org.jboss.jms.client.tx.ClientTransaction.SessionTxState;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.JBossMessage;
@@ -48,6 +45,9 @@
import org.jboss.jms.server.endpoint.advised.SessionAdvised;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.server.remoting.JMSWireFormat;
+import org.jboss.jms.tx.ClientTransaction;
+import org.jboss.jms.tx.TransactionRequest;
+import org.jboss.jms.tx.ClientTransaction.SessionTxState;
import org.jboss.jms.util.ExceptionUtil;
import org.jboss.jms.util.ToString;
import org.jboss.jms.wireformat.Dispatcher;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -27,9 +27,9 @@
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.selector.Selector;
import org.jboss.jms.server.destination.TopicService;
import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.server.selector.Selector;
import org.jboss.jms.util.ExceptionUtil;
import org.jboss.jms.wireformat.ClientDelivery;
import org.jboss.jms.wireformat.Dispatcher;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -46,7 +46,6 @@
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTopic;
import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.selector.Selector;
import org.jboss.jms.server.DestinationManager;
import org.jboss.jms.server.JMSCondition;
import org.jboss.jms.server.ServerPeer;
@@ -57,6 +56,7 @@
import org.jboss.jms.server.endpoint.advised.BrowserAdvised;
import org.jboss.jms.server.endpoint.advised.ConsumerAdvised;
import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.server.selector.Selector;
import org.jboss.jms.util.ExceptionUtil;
import org.jboss.jms.util.MessageQueueNameHelper;
import org.jboss.jms.wireformat.Dispatcher;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -23,9 +23,9 @@
import javax.jms.JMSException;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.server.endpoint.ConnectionEndpoint;
+import org.jboss.jms.tx.TransactionRequest;
import org.jboss.messaging.core.plugin.IDBlock;
import org.jboss.messaging.core.tx.MessagingXid;
Copied: trunk/src/main/org/jboss/jms/server/selector (from rev 2678, trunk/src/main/org/jboss/jms/selector)
Deleted: trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java
===================================================================
--- trunk/src/main/org/jboss/jms/selector/ISelectorParser.java 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,36 +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.jms.selector;
-
-import java.util.HashMap;
-
-/**
- * An interface describing a JMS selector expression parser.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface ISelectorParser
-{
- public Object parse(String selector, HashMap identifierMap) throws Exception;
- public Object parse(String selector, HashMap identifierMap, boolean trace) throws Exception;
-}
Copied: trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java (from rev 2680, trunk/src/main/org/jboss/jms/selector/ISelectorParser.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/ISelectorParser.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,36 @@
+/*
+ * 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.jms.server.selector;
+
+import java.util.HashMap;
+
+/**
+ * An interface describing a JMS selector expression parser.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ISelectorParser
+{
+ public Object parse(String selector, HashMap identifierMap) throws Exception;
+ public Object parse(String selector, HashMap identifierMap, boolean trace) throws Exception;
+}
Deleted: trunk/src/main/org/jboss/jms/server/selector/Identifier.java
===================================================================
--- trunk/src/main/org/jboss/jms/selector/Identifier.java 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/Identifier.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,79 +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.jms.selector;
-
-/**
- * This is a JMS identifier
- *
- * @author Norbert Lataille (Norbert.Lataille at m4x.org)
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class Identifier
-{
- String name;
- Object value;
- private int hash;
-
- public Identifier( String name )
- {
- this.name = name;
- hash = name.hashCode();
- value = null;
- }
-
- public String toString()
- {
- return "Identifier@" + name;
- }
-
- public boolean equals( Object obj )
- {
- if ( obj.getClass() != Identifier.class )
- {
- return false;
- }
- if ( obj.hashCode() != hash )
- {
- return false;
- }
- return ( ( Identifier )obj ).name.equals( name );
- }
-
- public int hashCode()
- {
- return hash;
- }
-
- public String getName()
- {
- return name;
- }
- public Object getValue()
- {
- return value;
- }
- public void setValue(Object value)
- {
- this.value = value;
- }
-}
Copied: trunk/src/main/org/jboss/jms/server/selector/Identifier.java (from rev 2680, trunk/src/main/org/jboss/jms/selector/Identifier.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/Identifier.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/Identifier.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,79 @@
+/*
+ * 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.jms.server.selector;
+
+/**
+ * This is a JMS identifier
+ *
+ * @author Norbert Lataille (Norbert.Lataille at m4x.org)
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Identifier
+{
+ String name;
+ Object value;
+ private int hash;
+
+ public Identifier( String name )
+ {
+ this.name = name;
+ hash = name.hashCode();
+ value = null;
+ }
+
+ public String toString()
+ {
+ return "Identifier@" + name;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if ( obj.getClass() != Identifier.class )
+ {
+ return false;
+ }
+ if ( obj.hashCode() != hash )
+ {
+ return false;
+ }
+ return ( ( Identifier )obj ).name.equals( name );
+ }
+
+ public int hashCode()
+ {
+ return hash;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ public Object getValue()
+ {
+ return value;
+ }
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+}
Deleted: trunk/src/main/org/jboss/jms/server/selector/Operator.java
===================================================================
--- trunk/src/main/org/jboss/jms/selector/Operator.java 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/Operator.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,1084 +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.jms.selector;
-
-import java.util.HashSet;
-
-import org.jboss.util.Primitives;
-
-/**
- * An operator for the selector system.
- *
- * @author Norbert Lataille (Norbert.Lataille at m4x.org)
- * @author droy at boostmyscore.com
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.com
- * @version $Revision$
- */
-public class Operator
-{
- int operation;
- Object oper1;
- Object oper2;
- Object oper3;
-
- Object arg1;
- Object arg2;
- Object arg3;
-
- int class1;
- int class2;
- int class3;
-
- // info about the regular expression
- // if this is a LIKE operator
- // (perhaps this should be a subclass)
- RegExp re = null;
-
- public final static int EQUAL = 0;
- public final static int NOT = 1;
- public final static int AND = 2;
- public final static int OR = 3;
- public final static int GT = 4;
- public final static int GE = 5;
- public final static int LT = 6;
- public final static int LE = 7;
- public final static int DIFFERENT = 8;
- public final static int ADD = 9;
- public final static int SUB = 10;
- public final static int NEG = 11;
- public final static int MUL = 12;
- public final static int DIV = 13;
- public final static int BETWEEN = 14;
- public final static int NOT_BETWEEN = 15;
- public final static int LIKE = 16;
- public final static int NOT_LIKE = 17;
- public final static int LIKE_ESCAPE = 18;
- public final static int NOT_LIKE_ESCAPE = 19;
- public final static int IS_NULL = 20;
- public final static int IS_NOT_NULL = 21;
- public final static int IN = 22;
- public final static int NOT_IN = 23;
-
- public final static int STRING = 0;
- public final static int DOUBLE = 1;
- //DOUBLE FLOAT
- public final static int LONG = 2;
- //LONG BYTE SHORT INTEGER
- public final static int BOOLEAN = 3;
-
- public Operator(int operation, Object oper1, Object oper2, Object oper3)
- {
- this.operation = operation;
- this.oper1 = oper1;
- this.oper2 = oper2;
- this.oper3 = oper3;
- }
-
- public Operator(int operation, Object oper1, Object oper2)
- {
- this.operation = operation;
- this.oper1 = oper1;
- this.oper2 = oper2;
- this.oper3 = null;
- }
-
- public Operator(int operation, Object oper1)
- {
- this.operation = operation;
- this.oper1 = oper1;
- this.oper2 = null;
- this.oper3 = null;
- }
-
- //--- Print functions ---
-
- public String toString()
- {
- return print("");
- }
-
- public String print(String level)
- {
- String st = level + operation + ":" + operationString(operation) + "(\n";
-
- String nextLevel = level + " ";
-
- if (oper1 == null)
- st += nextLevel + "null\n";
- else if (oper1 instanceof Operator)
- st += ((Operator) oper1).print( nextLevel );
- else
- st += nextLevel + oper1.toString() + "\n";
-
- if (oper2 != null)
- {
- if (oper2 instanceof Operator)
- st += ((Operator) oper2).print(nextLevel);
- else
- st += nextLevel + oper2.toString() + "\n";
- }
-
- if (oper3 != null)
- {
- if (oper3 instanceof Operator)
- st += ((Operator) oper3).print(nextLevel);
- else
- st += nextLevel + oper3.toString() + "\n";
- }
-
- st += level + ")\n";
-
- return st;
- }
-
-
- //Operator 20
- Object is_null() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-
- //Operator 21
- Object is_not_null() throws Exception
- {
- computeArgument1();
- if (arg1 != null)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-
- //Operation 0
- Object equal() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return Boolean.FALSE;
-
- switch (class1)
- {
- case LONG:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() == ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).longValue() == ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case DOUBLE:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).doubleValue() == ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).doubleValue() == ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case STRING:
- case BOOLEAN:
- computeArgument2();
- if (arg2 == null)
- return Boolean.FALSE;
- if (class2 != class1)
- throwBadObjectException(class1, class2);
- return Primitives.valueOf(arg1.equals(arg2));
- default:
- throwBadObjectException(class1);
- return null;
- }
-
- }
-
- //Operation 1
- Object not() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != BOOLEAN)
- throwBadObjectException(class1);
- if (((Boolean)arg1).booleanValue())
- return Boolean.FALSE;
- else
- return Boolean.TRUE;
- }
-
- //Operation 2
- Object and() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != BOOLEAN)
- throwBadObjectException(class2);
- if (((Boolean) arg2).booleanValue() == false )
- return Boolean.FALSE;
- return null;
- }
-
- if (class1 == BOOLEAN)
- {
- if (((Boolean) arg1).booleanValue() == false)
- return Boolean.FALSE;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != BOOLEAN)
- throwBadObjectException(class2);
- return arg2;
- }
-
- throwBadObjectException(class1);
- return null;
- }
-
- /**
- * Operation 3
- *
- * | OR | T | F | U
- * +------+-------+-------+--------
- * | T | T | T | T
- * | F | T | F | U
- * | U | T | U | U
- * +------+-------+-------+-------
- */
- Object or() throws Exception
- {
- short falseCounter=0;
-
- computeArgument1();
- if (arg1 != null)
- {
- if (class1 != BOOLEAN)
- throwBadObjectException(class1);
- if (((Boolean) arg1).booleanValue())
- return Boolean.TRUE;
- else
- falseCounter++;
- }
-
- computeArgument2();
- if (arg2 != null)
- {
- if (class2 != BOOLEAN)
- throwBadObjectException(class2);
- if (((Boolean)arg2).booleanValue())
- return Boolean.TRUE;
- else
- falseCounter++;
- }
-
- if (falseCounter == 2)
- return Boolean.FALSE;
-
- return null;
- }
-
- //Operation 4
- Object gt() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
-
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() > ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).longValue() > ((Number) arg2).doubleValue());
- }
- else if ( class1 == DOUBLE )
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).doubleValue() > ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).doubleValue() > ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- }
- return Boolean.FALSE;
- }
-
- //Operation 5
- Object ge() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
-
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() >= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).longValue() >= ((Number) arg2).doubleValue());
- }
- else if ( class1 == DOUBLE )
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() >= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).doubleValue() >= ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- }
- return Boolean.FALSE;
- }
-
- //Operation 6
- Object lt() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
-
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() < ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).longValue() < ((Number) arg2).doubleValue());
- }
- else if (class1 == DOUBLE)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).doubleValue() < ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).doubleValue() < ((Number) arg2).doubleValue());
- }
-
- return Boolean.FALSE;
- }
-
- //Operation 7
- Object le() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
-
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() <= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).longValue() <= ((Number) arg2).doubleValue());
- }
- else if (class1 == DOUBLE)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).doubleValue() <= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).doubleValue() <= ((Number) arg2).doubleValue());
- }
- return Boolean.FALSE;
- }
-
- //Operation 8
- Object different() throws Exception
- {
- computeArgument1();
- if ( arg1 == null )
- return Boolean.FALSE;
-
- switch (class1)
- {
- case LONG:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).longValue() != ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).longValue() != ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case DOUBLE:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Primitives.valueOf(((Number) arg1).doubleValue() != ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Primitives.valueOf(((Number) arg1).doubleValue() != ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case STRING:
- case BOOLEAN:
- computeArgument2();
- if (arg2 == null)
- return Boolean.FALSE;
- if (class2 != class1)
- throwBadObjectException(class1, class2);
- return Primitives.valueOf(arg1.equals(arg2) == false);
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
-
- //Operator 9
- Object add() throws Exception
- {
- computeArgument1();
- computeArgument2();
-
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() + ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
-
- //Operator 10
- Object sub() throws Exception
- {
- computeArgument1();
- computeArgument2();
-
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() - ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
-
- //Operator 11
- Object neg() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- return new Double(-((Number) arg1).doubleValue());
- case LONG:
- return new Long(-((Number)arg1).longValue());
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
-
- //Operator 12
- Object mul() throws Exception
- {
- computeArgument1();
- computeArgument2();
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() * ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
-
- //Operator 13
- Object div() throws Exception
- {
- //Can throw Divide by zero exception...
- computeArgument1();
- computeArgument2();
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() / ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
-
- //Operator 14
- Object between() throws Exception
- {
- Object res = ge();
- if (res == null)
- return null;
- if (((Boolean) res).booleanValue() == false)
- return res;
-
- Object oper4 = oper2;
- oper2 = oper3;
- res = le();
- oper2 = oper4;
- return res;
- }
-
- //Operator 15
- Object not_between() throws Exception
- {
- Object res = lt();
- if (res == null)
- return null;
- if (((Boolean) res).booleanValue())
- return res;
-
- Object oper4 = oper2;
- oper2 = oper3;
- res = gt();
- oper2 = oper4;
- return res;
- }
-
- //Operation 16,17,18,19
- /**
- * Handle LIKE, NOT LIKE, LIKE ESCAPE, and NOT LIKE ESCAPE operators.
- *
- * @param not true if this is a NOT LIKE construct, false if this
- * is a LIKE construct.
- * @param use_escape true if this is a LIKE ESCAPE construct, false if
- * there is no ESCAPE clause
- * @return Description of the Returned Value
- * @exception Exception Description of Exception
- */
- Object like(boolean not, boolean use_escape) throws Exception
- {
- Character escapeChar = null;
-
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != STRING)
- throwBadObjectException(class1);
-
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != STRING)
- throwBadObjectException(class2);
-
- if (use_escape)
- {
- computeArgument3();
- if (arg3 == null)
- return null;
-
- if (class3 != STRING)
- throwBadObjectException(class3);
-
- StringBuffer escapeBuf = new StringBuffer((String) arg3);
- if (escapeBuf.length() != 1)
- throw new Exception("LIKE ESCAPE: Bad escape character " + escapeBuf.toString());
-
- escapeChar = new Character(escapeBuf.charAt(0));
- }
-
- if (re == null)
- // the first time through we prepare the regular expression
- re = new RegExp ((String) arg2, escapeChar);
-
- boolean result = re.isMatch (arg1);
- if (not)
- result = !result;
-
- if (result == true)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-
- //Operator 22
- Object in() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- if (((HashSet) oper2).contains(arg1))
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-
- //Operator 23
- Object not_in() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != STRING)
- throwBadObjectException(class1);
- if (((HashSet) oper2).contains(arg1))
- return Boolean.FALSE;
- else
- return Boolean.TRUE;
- }
-
-
- void computeArgument1() throws Exception
- {
- Class className = oper1.getClass();
-
- if (className == Identifier.class)
- arg1 = ((Identifier) oper1).value;
- else if (className == Operator.class)
- arg1 = ((Operator) oper1).apply();
- else
- arg1 = oper1;
-
- if (arg1 == null)
- {
- class1 = 0;
- return;
- }
-
- className = arg1.getClass();
-
- if (className == String.class)
- class1 = STRING;
- else if (className == Double.class)
- class1 = DOUBLE;
- else if (className == Long.class)
- class1 = LONG;
- else if (className == Integer.class)
- {
- class1 = LONG;
- arg1 = new Long(((Integer) arg1).longValue());
- }
- else if (className == Short.class)
- {
- class1 = LONG;
- arg1 = new Long(((Short) arg1).longValue());
- }
- else if (className == Byte.class)
- {
- class1 = LONG;
- arg1 = new Long(((Byte) arg1).longValue());
- }
- else if (className == Float.class)
- {
- class1 = DOUBLE;
- arg1 = new Double(((Float) arg1).doubleValue());
- }
- else if (className == Boolean.class)
- class1 = BOOLEAN;
- else
- throwBadObjectException(className);
- }
-
- void computeArgument2() throws Exception
- {
- Class className = oper2.getClass();
-
- if (className == Identifier.class)
- arg2 = ((Identifier) oper2).value;
- else if (className == Operator.class)
- arg2 = ((Operator) oper2).apply();
- else
- arg2 = oper2;
-
- if (arg2 == null)
- {
- class2 = 0;
- return;
- }
-
- className = arg2.getClass();
-
- if (className == String.class)
- class2 = STRING;
- else if (className == Double.class)
- class2 = DOUBLE;
- else if (className == Long.class)
- class2 = LONG;
- else if (className == Integer.class)
- {
- class2 = LONG;
- arg2 = new Long(((Integer) arg2).longValue());
- }
- else if (className == Short.class)
- {
- class2 = LONG;
- arg2 = new Long(((Short) arg2).longValue());
- }
- else if (className == Byte.class)
- {
- class2 = LONG;
- arg2 = new Long(((Byte) arg2).longValue());
- }
- else if (className == Float.class)
- {
- class2 = DOUBLE;
- arg2 = new Double(((Float) arg2).doubleValue());
- }
- else if (className == Boolean.class)
- class2 = BOOLEAN;
- else
- throwBadObjectException(className);
- }
-
- void computeArgument3() throws Exception
- {
- Class className = oper3.getClass();
-
- if (className == Identifier.class)
- arg3 = ((Identifier) oper3).value;
- else if (className == Operator.class)
- arg3 = ((Operator ) oper3).apply();
- else
- arg3 = oper3;
-
- if (arg3 == null)
- {
- class3 = 0;
- return;
- }
-
- className = arg3.getClass();
-
- if (className == String.class)
- class3 = STRING;
- else if (className == Double.class)
- class3 = DOUBLE;
- else if (className == Long.class)
- class3 = LONG;
- else if (className == Integer.class)
- {
- class3 = LONG;
- arg3 = new Long(((Integer) arg3).longValue());
- }
- else if (className == Short.class)
- {
- class3 = LONG;
- arg3 = new Long(((Short) arg3).longValue());
- }
- else if (className == Byte.class)
- {
- class3 = LONG;
- arg3 = new Long(((Byte) arg3).longValue());
- }
- else if (className == Float.class)
- {
- class3 = DOUBLE;
- arg3 = new Double(((Float) arg3).doubleValue());
- }
- else if (className == Boolean.class)
- class3 = BOOLEAN;
- else
- throwBadObjectException(className);
- }
-
- public Object apply() throws Exception
- {
- switch (operation)
- {
- case EQUAL:
- return equal();
- case NOT:
- return not();
- case AND:
- return and();
- case OR:
- return or();
- case GT:
- return gt();
- case GE:
- return ge();
- case LT:
- return lt();
- case LE:
- return le();
- case DIFFERENT:
- return different();
- case ADD:
- return add();
- case SUB:
- return sub();
- case NEG:
- return neg();
- case MUL:
- return mul();
- case DIV:
- return div();
- case BETWEEN:
- return between();
- case NOT_BETWEEN:
- return not_between();
- case LIKE:
- return like(false, false);
- case NOT_LIKE:
- return like(true, false);
- case LIKE_ESCAPE:
- return like(false, true);
- case NOT_LIKE_ESCAPE:
- return like(true, true);
- case IS_NULL:
- return is_null();
- case IS_NOT_NULL:
- return is_not_null();
- case IN:
- return in();
- case NOT_IN:
- return not_in();
- }
-
- throw new Exception("Unknown operation: " + toString());
- }
-
- public void throwBadObjectException(Class class1) throws Exception
- {
- throw new Exception("Bad Object: '" + class1.getName() + "' for operation: " + toString());
- }
-
- public void throwBadObjectException(int class1) throws Exception
- {
- throw new Exception("Bad Object: '" + getClassName(class1) + "' for operation: " + toString());
- }
-
- public void throwBadObjectException(int class1, int class2) throws Exception
- {
- throw new Exception("Bad Object: expected '" + getClassName(class1) + "' got '" + getClassName(class2) + "' for operation: " + toString());
- }
-
- static String getClassName(int class1)
- {
- String str = "Unknown";
- switch (class1)
- {
- case STRING:
- str = "String";
- break;
- case LONG:
- str = "Long";
- break;
- case DOUBLE:
- str = "Double";
- break;
- case BOOLEAN:
- str = "Boolean";
- break;
- }
- return str;
- }
-
- static String operationString(int operation)
- {
- String str = "Unknown";
- switch( operation )
- {
- case EQUAL:
- str = "EQUAL";
- break;
- case NOT:
- str = "NOT";
- break;
- case AND:
- str = "AND";
- break;
- case OR:
- str = "OR";
- break;
- case GT:
- str = "GT";
- break;
- case GE:
- str = "GE";
- break;
- case LT:
- str = "LT";
- break;
- case LE:
- str = "LE";
- break;
- case DIFFERENT:
- str = "DIFFERENT";
- break;
- case ADD:
- str = "ADD";
- break;
- case SUB:
- str = "SUB";
- break;
- case NEG:
- str = "NEG";
- break;
- case MUL:
- str = "MUL";
- break;
- case DIV:
- str = "DIV";
- break;
- case BETWEEN:
- str = "BETWEEN";
- break;
- case NOT_BETWEEN:
- str = "NOT_BETWEEN";
- break;
- case LIKE:
- str = "LIKE";
- break;
- case NOT_LIKE:
- str = "NOT_LIKE";
- break;
- case LIKE_ESCAPE:
- str = "LIKE_ESCAPE";
- break;
- case NOT_LIKE_ESCAPE:
- str = "NOT_LIKE_ESCAPE";
- break;
- case IS_NULL:
- str = "IS_NULL";
- break;
- case IS_NOT_NULL:
- str = "IS_NOT_NULL";
- break;
- case IN:
- str = "IN";
- break;
- case NOT_IN:
- str = "NOT_IN";
- break;
- }
- return str;
- }
-}
Copied: trunk/src/main/org/jboss/jms/server/selector/Operator.java (from rev 2680, trunk/src/main/org/jboss/jms/selector/Operator.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/Operator.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/Operator.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,1084 @@
+/*
+ * 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.jms.server.selector;
+
+import java.util.HashSet;
+
+import org.jboss.util.Primitives;
+
+/**
+ * An operator for the selector system.
+ *
+ * @author Norbert Lataille (Norbert.Lataille at m4x.org)
+ * @author droy at boostmyscore.com
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.com
+ * @version $Revision$
+ */
+public class Operator
+{
+ int operation;
+ Object oper1;
+ Object oper2;
+ Object oper3;
+
+ Object arg1;
+ Object arg2;
+ Object arg3;
+
+ int class1;
+ int class2;
+ int class3;
+
+ // info about the regular expression
+ // if this is a LIKE operator
+ // (perhaps this should be a subclass)
+ RegExp re = null;
+
+ public final static int EQUAL = 0;
+ public final static int NOT = 1;
+ public final static int AND = 2;
+ public final static int OR = 3;
+ public final static int GT = 4;
+ public final static int GE = 5;
+ public final static int LT = 6;
+ public final static int LE = 7;
+ public final static int DIFFERENT = 8;
+ public final static int ADD = 9;
+ public final static int SUB = 10;
+ public final static int NEG = 11;
+ public final static int MUL = 12;
+ public final static int DIV = 13;
+ public final static int BETWEEN = 14;
+ public final static int NOT_BETWEEN = 15;
+ public final static int LIKE = 16;
+ public final static int NOT_LIKE = 17;
+ public final static int LIKE_ESCAPE = 18;
+ public final static int NOT_LIKE_ESCAPE = 19;
+ public final static int IS_NULL = 20;
+ public final static int IS_NOT_NULL = 21;
+ public final static int IN = 22;
+ public final static int NOT_IN = 23;
+
+ public final static int STRING = 0;
+ public final static int DOUBLE = 1;
+ //DOUBLE FLOAT
+ public final static int LONG = 2;
+ //LONG BYTE SHORT INTEGER
+ public final static int BOOLEAN = 3;
+
+ public Operator(int operation, Object oper1, Object oper2, Object oper3)
+ {
+ this.operation = operation;
+ this.oper1 = oper1;
+ this.oper2 = oper2;
+ this.oper3 = oper3;
+ }
+
+ public Operator(int operation, Object oper1, Object oper2)
+ {
+ this.operation = operation;
+ this.oper1 = oper1;
+ this.oper2 = oper2;
+ this.oper3 = null;
+ }
+
+ public Operator(int operation, Object oper1)
+ {
+ this.operation = operation;
+ this.oper1 = oper1;
+ this.oper2 = null;
+ this.oper3 = null;
+ }
+
+ //--- Print functions ---
+
+ public String toString()
+ {
+ return print("");
+ }
+
+ public String print(String level)
+ {
+ String st = level + operation + ":" + operationString(operation) + "(\n";
+
+ String nextLevel = level + " ";
+
+ if (oper1 == null)
+ st += nextLevel + "null\n";
+ else if (oper1 instanceof Operator)
+ st += ((Operator) oper1).print( nextLevel );
+ else
+ st += nextLevel + oper1.toString() + "\n";
+
+ if (oper2 != null)
+ {
+ if (oper2 instanceof Operator)
+ st += ((Operator) oper2).print(nextLevel);
+ else
+ st += nextLevel + oper2.toString() + "\n";
+ }
+
+ if (oper3 != null)
+ {
+ if (oper3 instanceof Operator)
+ st += ((Operator) oper3).print(nextLevel);
+ else
+ st += nextLevel + oper3.toString() + "\n";
+ }
+
+ st += level + ")\n";
+
+ return st;
+ }
+
+
+ //Operator 20
+ Object is_null() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+
+ //Operator 21
+ Object is_not_null() throws Exception
+ {
+ computeArgument1();
+ if (arg1 != null)
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+
+ //Operation 0
+ Object equal() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return Boolean.FALSE;
+
+ switch (class1)
+ {
+ case LONG:
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() == ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).longValue() == ((Number) arg2).doubleValue());
+ return Boolean.FALSE;
+ case DOUBLE:
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).doubleValue() == ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).doubleValue() == ((Number) arg2).doubleValue());
+ return Boolean.FALSE;
+ case STRING:
+ case BOOLEAN:
+ computeArgument2();
+ if (arg2 == null)
+ return Boolean.FALSE;
+ if (class2 != class1)
+ throwBadObjectException(class1, class2);
+ return Primitives.valueOf(arg1.equals(arg2));
+ default:
+ throwBadObjectException(class1);
+ return null;
+ }
+
+ }
+
+ //Operation 1
+ Object not() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ if (class1 != BOOLEAN)
+ throwBadObjectException(class1);
+ if (((Boolean)arg1).booleanValue())
+ return Boolean.FALSE;
+ else
+ return Boolean.TRUE;
+ }
+
+ //Operation 2
+ Object and() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 != BOOLEAN)
+ throwBadObjectException(class2);
+ if (((Boolean) arg2).booleanValue() == false )
+ return Boolean.FALSE;
+ return null;
+ }
+
+ if (class1 == BOOLEAN)
+ {
+ if (((Boolean) arg1).booleanValue() == false)
+ return Boolean.FALSE;
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 != BOOLEAN)
+ throwBadObjectException(class2);
+ return arg2;
+ }
+
+ throwBadObjectException(class1);
+ return null;
+ }
+
+ /**
+ * Operation 3
+ *
+ * | OR | T | F | U
+ * +------+-------+-------+--------
+ * | T | T | T | T
+ * | F | T | F | U
+ * | U | T | U | U
+ * +------+-------+-------+-------
+ */
+ Object or() throws Exception
+ {
+ short falseCounter=0;
+
+ computeArgument1();
+ if (arg1 != null)
+ {
+ if (class1 != BOOLEAN)
+ throwBadObjectException(class1);
+ if (((Boolean) arg1).booleanValue())
+ return Boolean.TRUE;
+ else
+ falseCounter++;
+ }
+
+ computeArgument2();
+ if (arg2 != null)
+ {
+ if (class2 != BOOLEAN)
+ throwBadObjectException(class2);
+ if (((Boolean)arg2).booleanValue())
+ return Boolean.TRUE;
+ else
+ falseCounter++;
+ }
+
+ if (falseCounter == 2)
+ return Boolean.FALSE;
+
+ return null;
+ }
+
+ //Operation 4
+ Object gt() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() > ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).longValue() > ((Number) arg2).doubleValue());
+ }
+ else if ( class1 == DOUBLE )
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).doubleValue() > ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).doubleValue() > ((Number) arg2).doubleValue());
+ return Boolean.FALSE;
+ }
+ return Boolean.FALSE;
+ }
+
+ //Operation 5
+ Object ge() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() >= ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).longValue() >= ((Number) arg2).doubleValue());
+ }
+ else if ( class1 == DOUBLE )
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() >= ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).doubleValue() >= ((Number) arg2).doubleValue());
+ return Boolean.FALSE;
+ }
+ return Boolean.FALSE;
+ }
+
+ //Operation 6
+ Object lt() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() < ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).longValue() < ((Number) arg2).doubleValue());
+ }
+ else if (class1 == DOUBLE)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).doubleValue() < ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).doubleValue() < ((Number) arg2).doubleValue());
+ }
+
+ return Boolean.FALSE;
+ }
+
+ //Operation 7
+ Object le() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() <= ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).longValue() <= ((Number) arg2).doubleValue());
+ }
+ else if (class1 == DOUBLE)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).doubleValue() <= ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).doubleValue() <= ((Number) arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ }
+
+ //Operation 8
+ Object different() throws Exception
+ {
+ computeArgument1();
+ if ( arg1 == null )
+ return Boolean.FALSE;
+
+ switch (class1)
+ {
+ case LONG:
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).longValue() != ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).longValue() != ((Number) arg2).doubleValue());
+ return Boolean.FALSE;
+ case DOUBLE:
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 == LONG)
+ return Primitives.valueOf(((Number) arg1).doubleValue() != ((Number) arg2).longValue());
+ if (class2 == DOUBLE)
+ return Primitives.valueOf(((Number) arg1).doubleValue() != ((Number) arg2).doubleValue());
+ return Boolean.FALSE;
+ case STRING:
+ case BOOLEAN:
+ computeArgument2();
+ if (arg2 == null)
+ return Boolean.FALSE;
+ if (class2 != class1)
+ throwBadObjectException(class1, class2);
+ return Primitives.valueOf(arg1.equals(arg2) == false);
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
+
+ //Operator 9
+ Object add() throws Exception
+ {
+ computeArgument1();
+ computeArgument2();
+
+ if (arg1 == null || arg2 == null)
+ return null;
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
+ case LONG:
+ return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
+ case LONG:
+ return new Long(((Number) arg1).longValue() + ((Number) arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
+
+ //Operator 10
+ Object sub() throws Exception
+ {
+ computeArgument1();
+ computeArgument2();
+
+ if (arg1 == null || arg2 == null)
+ return null;
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
+ case LONG:
+ return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
+ case LONG:
+ return new Long(((Number) arg1).longValue() - ((Number) arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
+
+ //Operator 11
+ Object neg() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ switch (class1)
+ {
+ case DOUBLE:
+ return new Double(-((Number) arg1).doubleValue());
+ case LONG:
+ return new Long(-((Number)arg1).longValue());
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
+
+ //Operator 12
+ Object mul() throws Exception
+ {
+ computeArgument1();
+ computeArgument2();
+ if (arg1 == null || arg2 == null)
+ return null;
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
+ case LONG:
+ return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
+ case LONG:
+ return new Long(((Number) arg1).longValue() * ((Number) arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
+
+ //Operator 13
+ Object div() throws Exception
+ {
+ //Can throw Divide by zero exception...
+ computeArgument1();
+ computeArgument2();
+ if (arg1 == null || arg2 == null)
+ return null;
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
+ case LONG:
+ return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
+ case LONG:
+ return new Long(((Number) arg1).longValue() / ((Number) arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
+
+ //Operator 14
+ Object between() throws Exception
+ {
+ Object res = ge();
+ if (res == null)
+ return null;
+ if (((Boolean) res).booleanValue() == false)
+ return res;
+
+ Object oper4 = oper2;
+ oper2 = oper3;
+ res = le();
+ oper2 = oper4;
+ return res;
+ }
+
+ //Operator 15
+ Object not_between() throws Exception
+ {
+ Object res = lt();
+ if (res == null)
+ return null;
+ if (((Boolean) res).booleanValue())
+ return res;
+
+ Object oper4 = oper2;
+ oper2 = oper3;
+ res = gt();
+ oper2 = oper4;
+ return res;
+ }
+
+ //Operation 16,17,18,19
+ /**
+ * Handle LIKE, NOT LIKE, LIKE ESCAPE, and NOT LIKE ESCAPE operators.
+ *
+ * @param not true if this is a NOT LIKE construct, false if this
+ * is a LIKE construct.
+ * @param use_escape true if this is a LIKE ESCAPE construct, false if
+ * there is no ESCAPE clause
+ * @return Description of the Returned Value
+ * @exception Exception Description of Exception
+ */
+ Object like(boolean not, boolean use_escape) throws Exception
+ {
+ Character escapeChar = null;
+
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ if (class1 != STRING)
+ throwBadObjectException(class1);
+
+ computeArgument2();
+ if (arg2 == null)
+ return null;
+ if (class2 != STRING)
+ throwBadObjectException(class2);
+
+ if (use_escape)
+ {
+ computeArgument3();
+ if (arg3 == null)
+ return null;
+
+ if (class3 != STRING)
+ throwBadObjectException(class3);
+
+ StringBuffer escapeBuf = new StringBuffer((String) arg3);
+ if (escapeBuf.length() != 1)
+ throw new Exception("LIKE ESCAPE: Bad escape character " + escapeBuf.toString());
+
+ escapeChar = new Character(escapeBuf.charAt(0));
+ }
+
+ if (re == null)
+ // the first time through we prepare the regular expression
+ re = new RegExp ((String) arg2, escapeChar);
+
+ boolean result = re.isMatch (arg1);
+ if (not)
+ result = !result;
+
+ if (result == true)
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+
+ //Operator 22
+ Object in() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ if (((HashSet) oper2).contains(arg1))
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+
+ //Operator 23
+ Object not_in() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ return null;
+ if (class1 != STRING)
+ throwBadObjectException(class1);
+ if (((HashSet) oper2).contains(arg1))
+ return Boolean.FALSE;
+ else
+ return Boolean.TRUE;
+ }
+
+
+ void computeArgument1() throws Exception
+ {
+ Class className = oper1.getClass();
+
+ if (className == Identifier.class)
+ arg1 = ((Identifier) oper1).value;
+ else if (className == Operator.class)
+ arg1 = ((Operator) oper1).apply();
+ else
+ arg1 = oper1;
+
+ if (arg1 == null)
+ {
+ class1 = 0;
+ return;
+ }
+
+ className = arg1.getClass();
+
+ if (className == String.class)
+ class1 = STRING;
+ else if (className == Double.class)
+ class1 = DOUBLE;
+ else if (className == Long.class)
+ class1 = LONG;
+ else if (className == Integer.class)
+ {
+ class1 = LONG;
+ arg1 = new Long(((Integer) arg1).longValue());
+ }
+ else if (className == Short.class)
+ {
+ class1 = LONG;
+ arg1 = new Long(((Short) arg1).longValue());
+ }
+ else if (className == Byte.class)
+ {
+ class1 = LONG;
+ arg1 = new Long(((Byte) arg1).longValue());
+ }
+ else if (className == Float.class)
+ {
+ class1 = DOUBLE;
+ arg1 = new Double(((Float) arg1).doubleValue());
+ }
+ else if (className == Boolean.class)
+ class1 = BOOLEAN;
+ else
+ throwBadObjectException(className);
+ }
+
+ void computeArgument2() throws Exception
+ {
+ Class className = oper2.getClass();
+
+ if (className == Identifier.class)
+ arg2 = ((Identifier) oper2).value;
+ else if (className == Operator.class)
+ arg2 = ((Operator) oper2).apply();
+ else
+ arg2 = oper2;
+
+ if (arg2 == null)
+ {
+ class2 = 0;
+ return;
+ }
+
+ className = arg2.getClass();
+
+ if (className == String.class)
+ class2 = STRING;
+ else if (className == Double.class)
+ class2 = DOUBLE;
+ else if (className == Long.class)
+ class2 = LONG;
+ else if (className == Integer.class)
+ {
+ class2 = LONG;
+ arg2 = new Long(((Integer) arg2).longValue());
+ }
+ else if (className == Short.class)
+ {
+ class2 = LONG;
+ arg2 = new Long(((Short) arg2).longValue());
+ }
+ else if (className == Byte.class)
+ {
+ class2 = LONG;
+ arg2 = new Long(((Byte) arg2).longValue());
+ }
+ else if (className == Float.class)
+ {
+ class2 = DOUBLE;
+ arg2 = new Double(((Float) arg2).doubleValue());
+ }
+ else if (className == Boolean.class)
+ class2 = BOOLEAN;
+ else
+ throwBadObjectException(className);
+ }
+
+ void computeArgument3() throws Exception
+ {
+ Class className = oper3.getClass();
+
+ if (className == Identifier.class)
+ arg3 = ((Identifier) oper3).value;
+ else if (className == Operator.class)
+ arg3 = ((Operator ) oper3).apply();
+ else
+ arg3 = oper3;
+
+ if (arg3 == null)
+ {
+ class3 = 0;
+ return;
+ }
+
+ className = arg3.getClass();
+
+ if (className == String.class)
+ class3 = STRING;
+ else if (className == Double.class)
+ class3 = DOUBLE;
+ else if (className == Long.class)
+ class3 = LONG;
+ else if (className == Integer.class)
+ {
+ class3 = LONG;
+ arg3 = new Long(((Integer) arg3).longValue());
+ }
+ else if (className == Short.class)
+ {
+ class3 = LONG;
+ arg3 = new Long(((Short) arg3).longValue());
+ }
+ else if (className == Byte.class)
+ {
+ class3 = LONG;
+ arg3 = new Long(((Byte) arg3).longValue());
+ }
+ else if (className == Float.class)
+ {
+ class3 = DOUBLE;
+ arg3 = new Double(((Float) arg3).doubleValue());
+ }
+ else if (className == Boolean.class)
+ class3 = BOOLEAN;
+ else
+ throwBadObjectException(className);
+ }
+
+ public Object apply() throws Exception
+ {
+ switch (operation)
+ {
+ case EQUAL:
+ return equal();
+ case NOT:
+ return not();
+ case AND:
+ return and();
+ case OR:
+ return or();
+ case GT:
+ return gt();
+ case GE:
+ return ge();
+ case LT:
+ return lt();
+ case LE:
+ return le();
+ case DIFFERENT:
+ return different();
+ case ADD:
+ return add();
+ case SUB:
+ return sub();
+ case NEG:
+ return neg();
+ case MUL:
+ return mul();
+ case DIV:
+ return div();
+ case BETWEEN:
+ return between();
+ case NOT_BETWEEN:
+ return not_between();
+ case LIKE:
+ return like(false, false);
+ case NOT_LIKE:
+ return like(true, false);
+ case LIKE_ESCAPE:
+ return like(false, true);
+ case NOT_LIKE_ESCAPE:
+ return like(true, true);
+ case IS_NULL:
+ return is_null();
+ case IS_NOT_NULL:
+ return is_not_null();
+ case IN:
+ return in();
+ case NOT_IN:
+ return not_in();
+ }
+
+ throw new Exception("Unknown operation: " + toString());
+ }
+
+ public void throwBadObjectException(Class class1) throws Exception
+ {
+ throw new Exception("Bad Object: '" + class1.getName() + "' for operation: " + toString());
+ }
+
+ public void throwBadObjectException(int class1) throws Exception
+ {
+ throw new Exception("Bad Object: '" + getClassName(class1) + "' for operation: " + toString());
+ }
+
+ public void throwBadObjectException(int class1, int class2) throws Exception
+ {
+ throw new Exception("Bad Object: expected '" + getClassName(class1) + "' got '" + getClassName(class2) + "' for operation: " + toString());
+ }
+
+ static String getClassName(int class1)
+ {
+ String str = "Unknown";
+ switch (class1)
+ {
+ case STRING:
+ str = "String";
+ break;
+ case LONG:
+ str = "Long";
+ break;
+ case DOUBLE:
+ str = "Double";
+ break;
+ case BOOLEAN:
+ str = "Boolean";
+ break;
+ }
+ return str;
+ }
+
+ static String operationString(int operation)
+ {
+ String str = "Unknown";
+ switch( operation )
+ {
+ case EQUAL:
+ str = "EQUAL";
+ break;
+ case NOT:
+ str = "NOT";
+ break;
+ case AND:
+ str = "AND";
+ break;
+ case OR:
+ str = "OR";
+ break;
+ case GT:
+ str = "GT";
+ break;
+ case GE:
+ str = "GE";
+ break;
+ case LT:
+ str = "LT";
+ break;
+ case LE:
+ str = "LE";
+ break;
+ case DIFFERENT:
+ str = "DIFFERENT";
+ break;
+ case ADD:
+ str = "ADD";
+ break;
+ case SUB:
+ str = "SUB";
+ break;
+ case NEG:
+ str = "NEG";
+ break;
+ case MUL:
+ str = "MUL";
+ break;
+ case DIV:
+ str = "DIV";
+ break;
+ case BETWEEN:
+ str = "BETWEEN";
+ break;
+ case NOT_BETWEEN:
+ str = "NOT_BETWEEN";
+ break;
+ case LIKE:
+ str = "LIKE";
+ break;
+ case NOT_LIKE:
+ str = "NOT_LIKE";
+ break;
+ case LIKE_ESCAPE:
+ str = "LIKE_ESCAPE";
+ break;
+ case NOT_LIKE_ESCAPE:
+ str = "NOT_LIKE_ESCAPE";
+ break;
+ case IS_NULL:
+ str = "IS_NULL";
+ break;
+ case IS_NOT_NULL:
+ str = "IS_NOT_NULL";
+ break;
+ case IN:
+ str = "IN";
+ break;
+ case NOT_IN:
+ str = "NOT_IN";
+ break;
+ }
+ return str;
+ }
+}
Deleted: trunk/src/main/org/jboss/jms/server/selector/RegExp.java
===================================================================
--- trunk/src/main/org/jboss/jms/selector/RegExp.java 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/RegExp.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,128 +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.jms.selector;
-
-import java.util.regex.Pattern;
-
-/**
- * Regular expressions to support the selector LIKE operator.
- *
- * @version <tt>$Revision$</tt>
- *
- * @author Norbert Lataille (Norbert.Lataille at m4x.org)
- * @author droy at boostmyscore.com
- * @author Scott.Stark at jboss.org
- * @author Loren Rosen
- *
- * $Id$
- */
-public class RegExp
-{
- protected Pattern re;
-
- public RegExp (String pattern, Character escapeChar)
- throws Exception
- {
- String pat = adjustPattern(pattern, escapeChar);
- re = Pattern.compile(pat);
- }
-
- public boolean isMatch (Object target)
- {
- String str = target != null ? target.toString() : "";
- return re.matcher(str).matches();
- }
-
- protected String adjustPattern (String pattern, Character escapeChar)
- throws Exception
- {
-
- // StringBuffer patternBuf = new StringBuffer( pattern );
- int patternLen = pattern.length();
- StringBuffer REpattern = new StringBuffer(patternLen + 10);
- boolean useEscape = (escapeChar != null);
- char escape = Character.UNASSIGNED;
- if (useEscape) {
- escape = escapeChar.charValue();
- }
-
- REpattern.append ('^');
-
- for ( int i = 0; i < patternLen; i++ ) {
- boolean escaped = false;
- char c = pattern.charAt( i );
-
- if ( useEscape && escape == c ) {
- i++;
- if ( i < patternLen ) {
- escaped = true;
- c = pattern.charAt( i );
- } else {
- throw new Exception( "LIKE ESCAPE: Bad use of escape character" );
- }
- }
-
- // Match characters, or escape ones special to the underlying
- // regex engine
- switch ( c ) {
- case '_':
- if ( escaped ) {
- REpattern.append( c );
- } else {
- REpattern.append( '.' );
- }
- break;
- case '%':
- if ( escaped ) {
- REpattern.append( c );
- } else {
- REpattern.append( ".*" );
- }
- break;
- case '*':
- case '.':
- case '\\':
- case '^':
- case '$':
- case '[':
- case ']':
- case '(':
- case ')':
- case '+':
- case '?':
- case '{':
- case '}':
- case '|':
- REpattern.append( "\\");
- REpattern.append ( c );
- break;
- default:
- REpattern.append( c );
- break;
- }
- }
-
- REpattern.append( '$' );
- return REpattern.toString();
- }
-}
-
Copied: trunk/src/main/org/jboss/jms/server/selector/RegExp.java (from rev 2680, trunk/src/main/org/jboss/jms/selector/RegExp.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/RegExp.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/RegExp.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,128 @@
+/*
+* 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.jms.server.selector;
+
+import java.util.regex.Pattern;
+
+/**
+ * Regular expressions to support the selector LIKE operator.
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ * @author Norbert Lataille (Norbert.Lataille at m4x.org)
+ * @author droy at boostmyscore.com
+ * @author Scott.Stark at jboss.org
+ * @author Loren Rosen
+ *
+ * $Id$
+ */
+public class RegExp
+{
+ protected Pattern re;
+
+ public RegExp (String pattern, Character escapeChar)
+ throws Exception
+ {
+ String pat = adjustPattern(pattern, escapeChar);
+ re = Pattern.compile(pat);
+ }
+
+ public boolean isMatch (Object target)
+ {
+ String str = target != null ? target.toString() : "";
+ return re.matcher(str).matches();
+ }
+
+ protected String adjustPattern (String pattern, Character escapeChar)
+ throws Exception
+ {
+
+ // StringBuffer patternBuf = new StringBuffer( pattern );
+ int patternLen = pattern.length();
+ StringBuffer REpattern = new StringBuffer(patternLen + 10);
+ boolean useEscape = (escapeChar != null);
+ char escape = Character.UNASSIGNED;
+ if (useEscape) {
+ escape = escapeChar.charValue();
+ }
+
+ REpattern.append ('^');
+
+ for ( int i = 0; i < patternLen; i++ ) {
+ boolean escaped = false;
+ char c = pattern.charAt( i );
+
+ if ( useEscape && escape == c ) {
+ i++;
+ if ( i < patternLen ) {
+ escaped = true;
+ c = pattern.charAt( i );
+ } else {
+ throw new Exception( "LIKE ESCAPE: Bad use of escape character" );
+ }
+ }
+
+ // Match characters, or escape ones special to the underlying
+ // regex engine
+ switch ( c ) {
+ case '_':
+ if ( escaped ) {
+ REpattern.append( c );
+ } else {
+ REpattern.append( '.' );
+ }
+ break;
+ case '%':
+ if ( escaped ) {
+ REpattern.append( c );
+ } else {
+ REpattern.append( ".*" );
+ }
+ break;
+ case '*':
+ case '.':
+ case '\\':
+ case '^':
+ case '$':
+ case '[':
+ case ']':
+ case '(':
+ case ')':
+ case '+':
+ case '?':
+ case '{':
+ case '}':
+ case '|':
+ REpattern.append( "\\");
+ REpattern.append ( c );
+ break;
+ default:
+ REpattern.append( c );
+ break;
+ }
+ }
+
+ REpattern.append( '$' );
+ return REpattern.toString();
+ }
+}
+
Deleted: trunk/src/main/org/jboss/jms/server/selector/Selector.java
===================================================================
--- trunk/src/main/org/jboss/jms/selector/Selector.java 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/Selector.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,212 +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.jms.selector;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.Filter;
-
-
-/**
- * This class implements a Message Selector.
- *
- * @author <a href="mailto:Norbert.Lataille at m4x.org">Norbert Lataille</a>
- * @author <a href="mailto:jplindfo at helsinki.fi">Juha Lindfors</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:Scott.Stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version $Revision$
- *
- * $Id$
- */
-public class Selector implements Filter
-{
- /** The logging interface */
- static Logger cat = Logger.getLogger(Selector.class);
-
- /** The ISelectorParser implementation class */
- private static Class parserClass = SelectorParser.class;
-
- private static final Logger log = Logger.getLogger(Selector.class);
-
- public String selector;
-
- public HashMap identifiers;
-
- public Object result;
-
- private Class resultType;
-
- /**
- * Return the string representation of the selector
- */
- public String getFilterString()
- {
- return selector;
- }
-
- /**
- * Get the class that implements the ISelectorParser interface to be used by
- * Selector instances.
- */
- public static Class getSelectorParserClass()
- {
- return Selector.parserClass;
- }
-
- /**
- * Set the class that implements the ISelectorParser interface to be used by
- * Selector instances.
- *
- * @param parserClass the ISelectorParser implementation. This must have a
- * public no-arg constructor.
- */
- public static void setSelectorParserClass(Class parserClass)
- {
- Selector.parserClass = parserClass;
- }
-
- public Selector(String sel) throws InvalidSelectorException
- {
- selector = sel;
- identifiers = new HashMap();
-
- try
- {
- ISelectorParser bob = (ISelectorParser) parserClass.newInstance();
- result = bob.parse(sel, identifiers);
- resultType = result.getClass();
- }
- catch (Exception e)
- {
- if (log.isTraceEnabled()) { log.trace("Invalid selector:" + sel); }
- throw new InvalidSelectorException("The selector is invalid: " + sel);
- }
- }
-
- public String getExpression()
- {
- return selector;
- }
-
- public synchronized boolean accept(org.jboss.messaging.core.message.Message message)
- {
- try
- {
- //Only accept JMS messages
- if (!(message instanceof Message))
- {
- return false;
- }
-
- Message mess = (Message)message;
-
- // Set the identifiers values
- Iterator i = identifiers.values().iterator();
-
- while (i.hasNext())
- {
- Identifier id = (Identifier) i.next();
-
- Object find = mess.getObjectProperty(id.name);
-
- if (find == null)
- find = getHeaderFieldReferences(mess, id.name);
-
- if (find == null)
- id.value = null;
- else
- {
- Class type = find.getClass();
- if (type.equals(Boolean.class) ||
- type.equals(String.class) ||
- type.equals(Double.class) ||
- type.equals(Float.class) ||
- type.equals(Integer.class) ||
- type.equals(Long.class) ||
- type.equals(Short.class) ||
- type.equals(Byte.class))
- id.value = find;
- else
- throw new Exception("Bad property '" + id.name + "' type: " + type);
- }
- }
-
- // Compute the result of this operator
- Object res;
-
- if (resultType.equals(Identifier.class))
- res = ((Identifier)result).value;
- else if (resultType.equals(Operator.class))
- {
- Operator op = (Operator) result;
- res = op.apply();
- }
- else
- res = result;
-
- if (res == null)
- return false;
-
- if (!(res.getClass().equals(Boolean.class)))
- throw new Exception("Bad object type: " + res);
-
- return ((Boolean) res).booleanValue();
- }
- catch (Exception e)
- {
- cat.warn("Invalid selector: " + selector, e);
- return false;
- }
- }
-
-
- // [JPL]
- private Object getHeaderFieldReferences(Message mess, String idName)
- throws JMSException
- {
- // JMS 3.8.1.1 -- Message header field references are restricted to:
- // JMSDeliveryMode, JMSPriority, JMSMessageID,
- // JMSTimeStamp, JMSCorrelationID and JMSType
- //
- if (idName.equals("JMSDeliveryMode"))
- return new Integer(mess.getJMSDeliveryMode());
- else if (idName.equals("JMSPriority"))
- return new Integer(mess.getJMSPriority());
- else if (idName.equals("JMSMessageID"))
- return mess.getJMSMessageID();
- else if (idName.equals("JMSTimestamp"))
- return new Long(mess.getJMSTimestamp());
- else if (idName.equals("JMSCorrelationID"))
- return mess.getJMSCorrelationID();
- else if (idName.equals("JMSType"))
- return mess.getJMSType();
- else
- return null;
- }
-}
Copied: trunk/src/main/org/jboss/jms/server/selector/Selector.java (from rev 2680, trunk/src/main/org/jboss/jms/selector/Selector.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/Selector.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/Selector.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,212 @@
+/*
+ * 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.jms.server.selector;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Filter;
+
+
+/**
+ * This class implements a Message Selector.
+ *
+ * @author <a href="mailto:Norbert.Lataille at m4x.org">Norbert Lataille</a>
+ * @author <a href="mailto:jplindfo at helsinki.fi">Juha Lindfors</a>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:Scott.Stark at jboss.org">Scott Stark</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision$
+ *
+ * $Id$
+ */
+public class Selector implements Filter
+{
+ /** The logging interface */
+ static Logger cat = Logger.getLogger(Selector.class);
+
+ /** The ISelectorParser implementation class */
+ private static Class parserClass = SelectorParser.class;
+
+ private static final Logger log = Logger.getLogger(Selector.class);
+
+ public String selector;
+
+ public HashMap identifiers;
+
+ public Object result;
+
+ private Class resultType;
+
+ /**
+ * Return the string representation of the selector
+ */
+ public String getFilterString()
+ {
+ return selector;
+ }
+
+ /**
+ * Get the class that implements the ISelectorParser interface to be used by
+ * Selector instances.
+ */
+ public static Class getSelectorParserClass()
+ {
+ return Selector.parserClass;
+ }
+
+ /**
+ * Set the class that implements the ISelectorParser interface to be used by
+ * Selector instances.
+ *
+ * @param parserClass the ISelectorParser implementation. This must have a
+ * public no-arg constructor.
+ */
+ public static void setSelectorParserClass(Class parserClass)
+ {
+ Selector.parserClass = parserClass;
+ }
+
+ public Selector(String sel) throws InvalidSelectorException
+ {
+ selector = sel;
+ identifiers = new HashMap();
+
+ try
+ {
+ ISelectorParser bob = (ISelectorParser) parserClass.newInstance();
+ result = bob.parse(sel, identifiers);
+ resultType = result.getClass();
+ }
+ catch (Exception e)
+ {
+ if (log.isTraceEnabled()) { log.trace("Invalid selector:" + sel); }
+ throw new InvalidSelectorException("The selector is invalid: " + sel);
+ }
+ }
+
+ public String getExpression()
+ {
+ return selector;
+ }
+
+ public synchronized boolean accept(org.jboss.messaging.core.message.Message message)
+ {
+ try
+ {
+ //Only accept JMS messages
+ if (!(message instanceof Message))
+ {
+ return false;
+ }
+
+ Message mess = (Message)message;
+
+ // Set the identifiers values
+ Iterator i = identifiers.values().iterator();
+
+ while (i.hasNext())
+ {
+ Identifier id = (Identifier) i.next();
+
+ Object find = mess.getObjectProperty(id.name);
+
+ if (find == null)
+ find = getHeaderFieldReferences(mess, id.name);
+
+ if (find == null)
+ id.value = null;
+ else
+ {
+ Class type = find.getClass();
+ if (type.equals(Boolean.class) ||
+ type.equals(String.class) ||
+ type.equals(Double.class) ||
+ type.equals(Float.class) ||
+ type.equals(Integer.class) ||
+ type.equals(Long.class) ||
+ type.equals(Short.class) ||
+ type.equals(Byte.class))
+ id.value = find;
+ else
+ throw new Exception("Bad property '" + id.name + "' type: " + type);
+ }
+ }
+
+ // Compute the result of this operator
+ Object res;
+
+ if (resultType.equals(Identifier.class))
+ res = ((Identifier)result).value;
+ else if (resultType.equals(Operator.class))
+ {
+ Operator op = (Operator) result;
+ res = op.apply();
+ }
+ else
+ res = result;
+
+ if (res == null)
+ return false;
+
+ if (!(res.getClass().equals(Boolean.class)))
+ throw new Exception("Bad object type: " + res);
+
+ return ((Boolean) res).booleanValue();
+ }
+ catch (Exception e)
+ {
+ cat.warn("Invalid selector: " + selector, e);
+ return false;
+ }
+ }
+
+
+ // [JPL]
+ private Object getHeaderFieldReferences(Message mess, String idName)
+ throws JMSException
+ {
+ // JMS 3.8.1.1 -- Message header field references are restricted to:
+ // JMSDeliveryMode, JMSPriority, JMSMessageID,
+ // JMSTimeStamp, JMSCorrelationID and JMSType
+ //
+ if (idName.equals("JMSDeliveryMode"))
+ return new Integer(mess.getJMSDeliveryMode());
+ else if (idName.equals("JMSPriority"))
+ return new Integer(mess.getJMSPriority());
+ else if (idName.equals("JMSMessageID"))
+ return mess.getJMSMessageID();
+ else if (idName.equals("JMSTimestamp"))
+ return new Long(mess.getJMSTimestamp());
+ else if (idName.equals("JMSCorrelationID"))
+ return mess.getJMSCorrelationID();
+ else if (idName.equals("JMSType"))
+ return mess.getJMSType();
+ else
+ return null;
+ }
+}
Deleted: trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/selector/SelectorFactory.java 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,42 +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.jms.selector;
-
-import org.jboss.messaging.core.Filter;
-import org.jboss.messaging.core.FilterFactory;
-
-/**
- * A SelectorFactory
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class SelectorFactory implements FilterFactory
-{
- public Filter createFilter(String filterString) throws Exception
- {
- return filterString == null ? null : new Selector(filterString);
- }
-}
Copied: trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java (from rev 2680, trunk/src/main/org/jboss/jms/selector/SelectorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/SelectorFactory.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,42 @@
+/*
+ * 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.jms.server.selector;
+
+import org.jboss.messaging.core.Filter;
+import org.jboss.messaging.core.FilterFactory;
+
+/**
+ * A SelectorFactory
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ *
+ */
+public class SelectorFactory implements FilterFactory
+{
+ public Filter createFilter(String filterString) throws Exception
+ {
+ return filterString == null ? null : new Selector(filterString);
+ }
+}
Deleted: trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj
===================================================================
--- trunk/src/main/org/jboss/jms/selector/SelectorParser.jj 2007-05-14 23:09:19 UTC (rev 2678)
+++ trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj 2007-05-15 00:09:10 UTC (rev 2681)
@@ -1,628 +0,0 @@
-/*
- * JBossMQ, the OpenSource JMS implementation
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-options {
- LOOKAHEAD=1;
-/*
- DEBUG_PARSER=true;
- DEBUG_LOOKAHEAD=true;
- DEBUG_TOKEN_MANAGER=true;
-*/
-}
-
-PARSER_BEGIN(SelectorParser)
-
-package org.jboss.jms.selector;
-
-import java.io.StringReader;
-
-import java.util.HashSet;
-import java.util.HashMap;
-
-/**
- * A JavaCC 2.0 grammar for the JMS 1.1.0 message selectors.
- *
- * @see http://www.webgain.com/products/metamata/java_doc.html
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class SelectorParser
- implements ISelectorParser
-{
- private static final String LOFFER_L = "l";
- private static final String UPPER_L = "L";
- private static final String OX = "0X";
- private static final String Ox = "0x";
- private static final String ZERRO = "0";
-
- private HashMap identifierMap;
-
- public SelectorParser()
- {
- // keep the parser from feaking out, init using one of
- // the JavaCC generated constructor
- this(new StringReader(""));
- }
-
- public Object parse(String selector, HashMap identifierMap)
- throws ParseException
- {
- return parse(selector, identifierMap, false);
- }
-
- public Object parse(String selector, HashMap identifierMap, boolean trace)
- throws ParseException
- {
- StringReader sr = new StringReader(selector);
- ReInit(sr);
-
- // This will have no effect unless the debugging options are true
- if (trace)
- {
- this.enable_tracing();
- }
- else
- {
- this.disable_tracing();
- }
-
- this.identifierMap = identifierMap;
- return this.expression();
- }
-
- /**
- * Strip off the leading and trailing (quote) chars from the given string
- * and return it.
- */
- private String stripQuotes(String image)
- {
- StringBuffer result = new StringBuffer(image.length()-2);
- int i = 1;
- boolean escaped = false;
- while (i < image.length() - 1)
- {
- if (escaped)
- {
- if (image.charAt(i) == '\'')
- result.append('\'');
- else
- throw new RuntimeException("Invalid uses of quotes: " + image);
- escaped = false;
- }
- else if (image.charAt(i) == '\'')
- escaped = true;
- else
- result.append(image.charAt(i));
- ++i;
- }
- return result.toString();
- }
-
- public static Object doParse(String selector, HashMap identifierMap)
- throws ParseException
- {
- return doParse(selector, identifierMap, false);
- }
-
- public static Object doParse(String selector, HashMap identifierMap, boolean trace)
- throws ParseException
- {
- SelectorParser parser = new SelectorParser();
- return parser.parse(selector, identifierMap, trace);
- }
-}
-
-PARSER_END(SelectorParser)
-
-/* IGNORE WHITESPACE */
-
-SKIP :
-{
- " "
- | "\r"
- | "\t"
- | "\f"
- | "\n"
-}
-
-
-/* RESERVED WORDS AND LITERALS */
-
-TOKEN [IGNORE_CASE]:
-{
- < TRUE: "TRUE" >
- | < FALSE: "FALSE" >
- | < NULL: "NULL" >
- | < AND: "AND" >
- | < NOT: "NOT" >
- | < OR: "OR" >
- | < BETWEEN: "BETWEEN" >
- | < LIKE: "LIKE" >
- | < IN: "IN" >
- | < IS: "IS" >
- | < ESCAPE: "ESCAPE" >
- | < LPAREN: "(" >
- | < RPAREN: ")" >
- | < SEMICOLON: ";" >
- | < COMMA: "," >
-
-}
-
-/* OPERATORS */
-
-TOKEN :
-{
- < MULT: "*" >
- | < DIV: "/" >
- | < MINUS: "-" >
- | < PLUS: "+" >
- | < GT: ">" >
- | < GE: ">=" >
- | < LT: "<" >
- | < LE: "<=" >
- | < NE: "<>" >
- | < EQ: "=" >
-
-}
-
-/* Literals */
-
-<DEFAULT> TOKEN : /* Numeric Literal */
-{
- < INTEGER_LITERAL:
- "-9223372036854775808"
- | "-9223372036854775808l"
- | "-9223372036854775808L"
- | <DECIMAL_LITERAL> (["l","L"])?
- | <HEX_LITERAL> (["l","L"])?
- | <OCTAL_LITERAL> (["l","L"])?
- >
-|
- < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
-|
- < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
-|
- < #OCTAL_LITERAL: "0" (["0"-"7"])* >
-|
- < FLOATING_POINT_LITERAL:
- (["+","-"])? (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
- | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
- | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
- | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
- >
-|
- < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
-}
-
-
-TOKEN :
-{
- < STRING:
- "'"
- ( (~["'","\n","\r"])
- | ("''")
- )*
- "'"
- >
-}
-
-/* Function names */
-
-TOKEN :
-{
- < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
- |
- < #LETTER: [ "_","$", "a"-"z", "A"-"Z" ] >
- |
- < #DIGIT: ["0" - "9"] >
-}
-
-/** Start of the grammar */
-
-Object expression() :
-{
- Object exp1 = null;
-}
-{
- exp1=selectorExpression()<EOF>
- {
- return exp1;
- }
-}
-
-Object selectorExpression() :
-{
- Object exp1 = null;
- Object exp2 = null;
-}
-{
- exp1=selectorTerm()
- (
- <OR> exp2=selectorTerm()
- {
- exp1 = new Operator(Operator.OR, exp1, exp2);
- }
- )*
- {
- return exp1;
- }
-}
-
-Object selectorTerm() :
-{
- Object exp1 = null;
- Object exp2 = null;
-}
-{
- exp1=selectorFactor()
- (
- <AND> exp2=selectorFactor()
- {
- exp1 = new Operator(Operator.AND, exp1, exp2);
- }
- )*
- {
- return exp1;
- }
-}
-
-Object selectorFactor() :
-{
- Object exp1 = null;
-}
-{
- exp1=conditionalExpression()
- {
- return exp1;
- }
- | <NOT> exp1=conditionalExpression()
- {
- exp1 = new Operator(Operator.NOT, exp1);
- }
- {
- return exp1;
- }
-}
-
-Object conditionalExpression() :
-{
- Object exp1 = null;
-}
-{
- LOOKAHEAD(3)
- <LPAREN> exp1=selectorExpression() <RPAREN>
- {
- return exp1;
- }
- |
- exp1 = comparisonExpression()
- {
- return exp1;
- }
-}
-
-Object comparisonExpression() :
-{
- int op = -1;
- HashSet set = null;
- Object exp1 = null;
- Object exp2 = null;
- Object exp3 = null;
- Object id = null;
- Token not = null;
-}
-{
- LOOKAHEAD(2147483647)
- exp1=identifier() <IS> [ not=<NOT> ] <NULL>
- {
- int opCode = not == null ? Operator.IS_NULL : Operator.IS_NOT_NULL;
- return new Operator(opCode, exp1);
- }
- |
- LOOKAHEAD(2147483647)
- id=identifier() [ not=<NOT> ] <IN> <LPAREN> { set = new HashSet(); } stringList(set) <RPAREN>
- {
- if (not == null)
- return new Operator(Operator.IN, id, set);
- else
- return new Operator(Operator.NOT_IN, id, set);
- return exp1;
- }
- |
- LOOKAHEAD(2147483647)
- id=identifier() [ not=<NOT> ] <LIKE> exp1=patternExpression(id)
- {
- if (not != null)
- exp1 = new Operator(Operator.NOT, exp1);
- return exp1;
- }
- |
- LOOKAHEAD(2147483647)
- exp1=stringExpression()
- (
- <EQ>{ op = Operator.EQUAL;}
- | <NE>{ op = Operator.DIFFERENT;}
- ) exp2=stringExpression()
- {
- return new Operator(op, exp1, exp2);
- }
- |
- LOOKAHEAD(2147483647)
- exp1=booleanExpression()
- (
- <EQ>{ op = Operator.EQUAL;}
- | <NE>{ op = Operator.DIFFERENT;}
- ) exp2=booleanExpression()
- {
- return new Operator(op, exp1, exp2);
- }
- |
- LOOKAHEAD(2147483647)
- exp1=arithExpression()
- (
- <EQ>{ op = Operator.EQUAL;}
- | <NE>{ op = Operator.DIFFERENT;}
- | <GT>{ op = Operator.GT;}
- | <GE>{ op = Operator.GE;}
- | <LT>{ op = Operator.LT;}
- | <LE>{ op = Operator.LE;}
- ) exp2=arithExpression()
- {
- return new Operator(op, exp1, exp2);
- }
- |
- LOOKAHEAD(2147483647)
- exp1=arithExpression() [ not=<NOT> ] <BETWEEN> exp2=arithExpression() <AND> exp3=arithExpression()
- {
- exp1 = new Operator(Operator.BETWEEN, exp1, exp2, exp3);
- if (not != null)
- exp1 = new Operator(Operator.NOT, exp1);
- return exp1;
- }
- | exp1=booleanExpression()
- {
- return exp1;
- }
-}
-
-void stringList(HashSet set) :
-{
-}
-{
- stringToken(set) ( <COMMA> stringToken(set))*
-}
-
-void stringToken(HashSet set) :
-{
- Token t = null;
-}
-{
- [ t=<STRING> ]
- {
- if (t != null)
- set.add(stripQuotes(t.image));
- }
-}
-
-Object patternExpression(Object exp1) :
-{
- Object exp2 = null;
- Token esc = null;
- Object escChar = null;
-}
-{
- exp2=stringLiteral() [ esc=<ESCAPE> escChar=stringLiteral() ]
- {
- Operator op = null;
- if (esc == null)
- op = new Operator(Operator.LIKE, exp1, exp2);
- else
- op = new Operator(Operator.LIKE_ESCAPE, exp1, exp2, escChar);
- return op;
- }
-}
-
-Object arithExpression() :
-{
- Object exp1 = null;
- Object exp2 = null;
-}
-{
- exp1=arithTerm()
- (
- <PLUS> exp2=arithTerm()
- {
- exp1 = new Operator(Operator.ADD, exp1, exp2);
- }
- | <MINUS> exp2=arithTerm()
- {
- exp1 = new Operator(Operator.SUB, exp1, exp2);
- }
- )*
- {
- return exp1;
- }
-}
-
-Object arithTerm() :
-{
- Object exp1 = null;
- Object exp2 = null;
-}
-{
- exp1=arithFactor()
- (
- <MULT> exp2=arithFactor()
- {
- exp1 = new Operator(Operator.MUL, exp1, exp2);
- }
- | <DIV> exp2=arithFactor()
- {
- exp1 = new Operator(Operator.DIV, exp1, exp2);
- }
- )*
- {
- return exp1;
- }
-}
-
-Object arithFactor() :
-{
- Object exp1 = null;
- boolean negate = false;
-}
-{
- [<PLUS>|<MINUS>{ negate = true; }] exp1=numericExpression()
- {
- if (negate)
- exp1 = new Operator(Operator.NEG, exp1);
- return exp1;
- }
-}
-
-Object booleanExpression() :
-{
- Object exp1 = null;
-}
-{
- (
- exp1=identifier()
- | exp1=booleanLiteral()
- )
- {
- return exp1;
- }
-}
-
-Object booleanLiteral() :
-{
- boolean isTrue = true;
-}
-{
- (<TRUE>|<FALSE>{ isTrue = false; })
- {
- if (isTrue)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-}
-
-Object stringExpression() :
-{
- Object exp1 = null;
-}
-{
- (
- exp1=identifier()
- | exp1=stringLiteral()
- )
- {
- return exp1;
- }
-}
-
-Object stringLiteral() :
-{
- Token string = null;
-}
-{
- string=<STRING>
- {
- return stripQuotes(string.image);
- }
-}
-
-Object numericExpression() :
-{
- Object exp1 = null;
-}
-{
- (
- exp1 = numericLiteral()
- | (<LPAREN> exp1=arithExpression() <RPAREN>)
- | exp1 = identifier()
- )
- {
- return exp1;
- }
-}
-Object numericLiteral() :
-{
- Token literal = null;
-}
-{
- literal=<FLOATING_POINT_LITERAL>
- {
- return new Double(literal.image);
- }
- |
- literal=<INTEGER_LITERAL>
- {
- String number = literal.image;
-
- // long suffix
- if (number.endsWith(LOFFER_L) || number.endsWith(UPPER_L))
- {
- // chop off the suffix
- return new Long(number.substring(0, number.length() - 1));
- }
-
- // hex
- if (number.startsWith(OX) || number.startsWith(Ox))
- {
- // handle literals from 0x8000000000000000L to 0xffffffffffffffffL:
- // remove sign bit, parse as positive, then calculate the negative
- // value with the sign bit
- if(number.length() == 18)
- {
- byte first = Byte.decode(number.substring(0, 3)).byteValue();
- if (first >= 8)
- {
- number = Ox + (first - 8) + number.substring(3);
- return new Long(Long.decode(number).longValue() - Long.MAX_VALUE - 1);
- }
- }
- }
- else if (number.startsWith(ZERRO))
- {
- // octal
- // handle literals
- // from 01000000000000000000000L to 01777777777777777777777L
- // remove sign bit, parse as positive, then calculate the
- // negative value with the sign bit
- if (number.length() == 23)
- {
- if (number.charAt(1) == '1')
- {
- number = ZERRO + number.substring(2);
- return new Long(Long.decode(number).longValue() - Long.MAX_VALUE - 1);
- }
- }
- }
- return Long.decode(number);
- }
-}
-
-Object identifier() :
-{
- Token id = null;
-}
-{
- id=<IDENTIFIER>
- {
- Identifier identifier = (Identifier) identifierMap.get(id.image);
- if (identifier == null)
- {
- identifier = new Identifier(id.image);
- identifierMap.put(id.image, identifier);
- }
- return identifier;
- }
-}
Copied: trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj (from rev 2680, trunk/src/main/org/jboss/jms/selector/SelectorParser.jj)
===================================================================
--- trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj (rev 0)
+++ trunk/src/main/org/jboss/jms/server/selector/SelectorParser.jj 2007-05-15 00:09:10 UTC (rev 2681)
@@ -0,0 +1,628 @@
+/*
+ * JBossMQ, the OpenSource JMS implementation
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+options {
+ LOOKAHEAD=1;
+/*
+ DEBUG_PARSER=true;
+ DEBUG_LOOKAHEAD=true;
+ DEBUG_TOKEN_MANAGER=true;
+*/
+}
+
+PARSER_BEGIN(SelectorParser)
+
+package org.jboss.jms.server.selector;
+
+import java.io.StringReader;
+
+import java.util.HashSet;
+import java.util.HashMap;
+
+/**
+ * A JavaCC 2.0 grammar for the JMS 1.1.0 message selectors.
+ *
+ * @see http://www.webgain.com/products/metamata/java_doc.html
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class SelectorParser
+ implements ISelectorParser
+{
+ private static final String LOFFER_L = "l";
+ private static final String UPPER_L = "L";
+ private static final String OX = "0X";
+ private static final String Ox = "0x";
+ private static final String ZERRO = "0";
+
+ private HashMap identifierMap;
+
+ public SelectorParser()
+ {
+ // keep the parser from feaking out, init using one of
+ // the JavaCC generated constructor
+ this(new StringReader(""));
+ }
+
+ public Object parse(String selector, HashMap identifierMap)
+ throws ParseException
+ {
+ return parse(selector, identifierMap, false);
+ }
+
+ public Object parse(String selector, HashMap identifierMap, boolean trace)
+ throws ParseException
+ {
+ StringReader sr = new StringReader(selector);
+ ReInit(sr);
+
+ // This will have no effect unless the debugging options are true
+ if (trace)
+ {
+ this.enable_tracing();
+ }
+ else
+ {
+ this.disable_tracing();
+ }
+
+ this.identifierMap = identifierMap;
+ return this.expression();
+ }
+
+ /**
+ * Strip off the leading and trailing (quote) chars from the given string
+ * and return it.
+ */
+ private String stripQuotes(String image)
+ {
+ StringBuffer result = new StringBuffer(image.length()-2);
+ int i = 1;
+ boolean escaped = false;
+ while (i < image.length() - 1)
+ {
+ if (escaped)
+ {
+ if (image.charAt(i) == '\'')
+ result.append('\'');
+ else
+ throw new RuntimeException("Invalid uses of quotes: " + image);
+ escaped = false;
+ }
+ else if (image.charAt(i) == '\'')
+ escaped = true;
+ else
+ result.append(image.charAt(i));
+ ++i;
+ }
+ return result.toString();
+ }
+
+ public static Object doParse(String selector, HashMap identifierMap)
+ throws ParseException
+ {
+ return doParse(selector, identifierMap, false);
+ }
+
+ public static Object doParse(String selector, HashMap identifierMap, boolean trace)
+ throws ParseException
+ {
+ SelectorParser parser = new SelectorParser();
+ return parser.parse(selector, identifierMap, trace);
+ }
+}
+
+PARSER_END(SelectorParser)
+
+/* IGNORE WHITESPACE */
+
+SKIP :
+{
+ " "
+ | "\r"
+ | "\t"
+ | "\f"
+ | "\n"
+}
+
+
+/* RESERVED WORDS AND LITERALS */
+
+TOKEN [IGNORE_CASE]:
+{
+ < TRUE: "TRUE" >
+ | < FALSE: "FALSE" >
+ | < NULL: "NULL" >
+ | < AND: "AND" >
+ | < NOT: "NOT" >
+ | < OR: "OR" >
+ | < BETWEEN: "BETWEEN" >
+ | < LIKE: "LIKE" >
+ | < IN: "IN" >
+ | < IS: "IS" >
+ | < ESCAPE: "ESCAPE" >
+ | < LPAREN: "(" >
+ | < RPAREN: ")" >
+ | < SEMICOLON: ";" >
+ | < COMMA: "," >
+
+}
+
+/* OPERATORS */
+
+TOKEN :
+{
+ < MULT: "*" >
+ | < DIV: "/" >
+ | < MINUS: "-" >
+ | < PLUS: "+" >
+ | < GT: ">" >
+ | < GE: ">=" >
+ | < LT: "<" >
+ | < LE: "<=" >
+ | < NE: "<>" >
+ | < EQ: "=" >
+
+}
+
+/* Literals */
+
+<DEFAULT> TOKEN : /* Numeric Literal */
+{
+ < INTEGER_LITERAL:
+ "-9223372036854775808"
+ | "-9223372036854775808l"
+ | "-9223372036854775808L"
+ | <DECIMAL_LITERAL> (["l","L"])?
+ | <HEX_LITERAL> (["l","L"])?
+ | <OCTAL_LITERAL> (["l","L"])?
+ >
+|
+ < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+ < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+ < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+ < FLOATING_POINT_LITERAL:
+ (["+","-"])? (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+ | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+ | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+ | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+ >
+|
+ < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+}
+
+
+TOKEN :
+{
+ < STRING:
+ "'"
+ ( (~["'","\n","\r"])
+ | ("''")
+ )*
+ "'"
+ >
+}
+
+/* Function names */
+
+TOKEN :
+{
+ < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+ |
+ < #LETTER: [ "_","$", "a"-"z", "A"-"Z" ] >
+ |
+ < #DIGIT: ["0" - "9"] >
+}
+
+/** Start of the grammar */
+
+Object expression() :
+{
+ Object exp1 = null;
+}
+{
+ exp1=selectorExpression()<EOF>
+ {
+ return exp1;
+ }
+}
+
+Object selectorExpression() :
+{
+ Object exp1 = null;
+ Object exp2 = null;
+}
+{
+ exp1=selectorTerm()
+ (
+ <OR> exp2=selectorTerm()
+ {
+ exp1 = new Operator(Operator.OR, exp1, exp2);
+ }
+ )*
+ {
+ return exp1;
+ }
+}
+
+Object selectorTerm() :
+{
+ Object exp1 = null;
+ Object exp2 = null;
+}
+{
+ exp1=selectorFactor()
+ (
+ <AND> exp2=selectorFactor()
+ {
+ exp1 = new Operator(Operator.AND, exp1, exp2);
+ }
+ )*
+ {
+ return exp1;
+ }
+}
+
+Object selectorFactor() :
+{
+ Object exp1 = null;
+}
+{
+ exp1=conditionalExpression()
+ {
+ return exp1;
+ }
+ | <NOT> exp1=conditionalExpression()
+ {
+ exp1 = new Operator(Operator.NOT, exp1);
+ }
+ {
+ return exp1;
+ }
+}
+
+Object conditionalExpression() :
+{
+ Object exp1 = null;
+}
+{
+ LOOKAHEAD(3)
+ <LPAREN> exp1=selectorExpression() <RPAREN>
+ {
+ return exp1;
+ }
+ |
+ exp1 = comparisonExpression()
+ {
+ return exp1;
+ }
+}
+
+Object comparisonExpression() :
+{
+ int op = -1;
+ HashSet set = null;
+ Object exp1 = null;
+ Object exp2 = null;
+ Object exp3 = null;
+ Object id = null;
+ Token not = null;
+}
+{
+ LOOKAHEAD(2147483647)
+ exp1=identifier() <IS> [ not=<NOT> ] <NULL>
+ {
+ int opCode = not == null ? Operator.IS_NULL : Operator.IS_NOT_NULL;
+ return new Operator(opCode, exp1);
+ }
+ |
+ LOOKAHEAD(2147483647)
+ id=identifier() [ not=<NOT> ] <IN> <LPAREN> { set = new HashSet(); } stringList(set) <RPAREN>
+ {
+ if (not == null)
+ return new Operator(Operator.IN, id, set);
+ else
+ return new Operator(Operator.NOT_IN, id, set);
+ return exp1;
+ }
+ |
+ LOOKAHEAD(2147483647)
+ id=identifier() [ not=<NOT> ] <LIKE> exp1=patternExpression(id)
+ {
+ if (not != null)
+ exp1 = new Operator(Operator.NOT, exp1);
+ return exp1;
+ }
+ |
+ LOOKAHEAD(2147483647)
+ exp1=stringExpression()
+ (
+ <EQ>{ op = Operator.EQUAL;}
+ | <NE>{ op = Operator.DIFFERENT;}
+ ) exp2=stringExpression()
+ {
+ return new Operator(op, exp1, exp2);
+ }
+ |
+ LOOKAHEAD(2147483647)
+ exp1=booleanExpression()
+ (
+ <EQ>{ op = Operator.EQUAL;}
+ | <NE>{ op = Operator.DIFFERENT;}
+ ) exp2=booleanExpression()
+ {
+ return new Operator(op, exp1, exp2);
+ }
+ |
+ LOOKAHEAD(2147483647)
+ exp1=arithExpression()
+ (
+ <EQ>{ op = Operator.EQUAL;}
+ | <NE>{ op = Operator.DIFFERENT;}
+ | <GT>{ op = Operator.GT;}
+ | <GE>{ op = Operator.GE;}
+ | <LT>{ op = Operator.LT;}
+ | <LE>{ op = Operator.LE;}
+ ) exp2=arithExpression()
+ {
+ return new Operator(op, exp1, exp2);
+ }
+ |
+ LOOKAHEAD(2147483647)
+ exp1=arithExpression() [ not=<NOT> ] <BETWEEN> exp2=arithExpression() <AND> exp3=arithExpression()
+ {
+ exp1 = new Operator(Operator.BETWEEN, exp1, exp2, exp3);
+ if (not != null)
+ exp1 = new Operator(Operator.NOT, exp1);
+ return exp1;
+ }
+ | exp1=booleanExpression()
+ {
+ return exp1;
+ }
+}
+
+void stringList(HashSet set) :
+{
+}
+{
+ stringToken(set) ( <COMMA> stringToken(set))*
+}
+
+void stringToken(HashSet set) :
+{
+ Token t = null;
+}
+{
+ [ t=<STRING> ]
+ {
+ if (t != null)
+ set.add(stripQuotes(t.image));
+ }
+}
+
+Object patternExpression(Object exp1) :
+{
+ Object exp2 = null;
+ Token esc = null;
+ Object escChar = null;
+}
+{
+ exp2=stringLiteral() [ esc=<ESCAPE> escChar=stringLiteral() ]
+ {
+ Operator op = null;
+ if (esc == null)
+ op = new Operator(Operator.LIKE, exp1, exp2);
+ else
+ op = new Operator(Operator.LIKE_ESCAPE, exp1, exp2, escChar);
+ return op;
+ }
+}
+
+Object arithExpression() :
+{
+ Object exp1 = null;
+ Object exp2 = null;
+}
+{
+ exp1=arithTerm()
+ (
+ <PLUS> exp2=arithTerm()
+ {
+ exp1 = new Operator(Operator.ADD, exp1, exp2);
+ }
+ | <MINUS> exp2=arithTerm()
+ {
+ exp1 = new Operator(Operator.SUB, exp1, exp2);
+ }
+ )*
+ {
+ return exp1;
+ }
+}
+
+Object arithTerm() :
+{
+ Object exp1 = null;
+ Object exp2 = null;
+}
+{
+ exp1=arithFactor()
+ (
+ <MULT> exp2=arithFactor()
+ {
+ exp1 = new Operator(Operator.MUL, exp1, exp2);
+ }
+ | <DIV> exp2=arithFactor()
+ {
+ exp1 = new Operator(Operator.DIV, exp1, exp2);
+ }
+ )*
+ {
+ return exp1;
+ }
+}
+
+Object arithFactor() :
+{
+ Object exp1 = null;
+ boolean negate = false;
+}
+{
+ [<PLUS>|<MINUS>{ negate = true; }] exp1=numericExpression()
+ {
+ if (negate)
+ exp1 = new Operator(Operator.NEG, exp1);
+ return exp1;
+ }
+}
+
+Object booleanExpression() :
+{
+ Object exp1 = null;
+}
+{
+ (
+ exp1=identifier()
+ | exp1=booleanLiteral()
+ )
+ {
+ return exp1;
+ }
+}
+
+Object booleanLiteral() :
+{
+ boolean isTrue = true;
+}
+{
+ (<TRUE>|<FALSE>{ isTrue = false; })
+ {
+ if (isTrue)
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+}
+
+Object stringExpression() :
+{
+ Object exp1 = null;
+}
+{
+ (
+ exp1=identifier()
+ | exp1=stringLiteral()
+ )
+ {
+ return exp1;
+ }
+}
+
+Object stringLiteral() :
+{
+ Token string = null;
+}
+{
+ string=<STRING>
+ {
+ return stripQuotes(string.image);
+ }
+}
+
+Object numericExpression() :
+{
+ Object exp1 = null;
+}
+{
+ (
+ exp1 = numericLiteral()
+ | (<LPAREN> exp1=arithExpression() <RPAREN>)
+ | exp1 = identifier()
+ )
+ {
+ return exp1;
+ }
+}
+Object numericLiteral() :
+{
+ Token literal = null;
+}
+{
+ literal=<FLOATING_POINT_LITERAL>
+ {
+ return new Double(literal.image);
+ }
+ |
+ literal=<INTEGER_LITERAL>
+ {
+ String number = literal.image;
+
+ // long suffix
+ if (number.endsWith(LOFFER_L) || number.endsWith(UPPER_L))
+ {
+ // chop off the suffix
+ return new Long(number.substring(0, number.length() - 1));
+ }
+
+ // hex
+ if (number.startsWith(OX) || number.startsWith(Ox))
+ {
+ // handle literals from 0x8000000000000000L to 0xffffffffffffffffL:
+ // remove sign bit, parse as positive, then calculate the negative
+ // value with the sign bit
+ if(number.length() == 18)
+ {
+ byte first = Byte.decode(number.substring(0, 3)).byteValue();
+ if (first >= 8)
+ {
+ number = Ox + (first - 8) + number.substring(3);
+ return new Long(Long.decode(number).longValue() - Long.MAX_VALUE - 1);
+ }
+ }
+ }
+ else if (number.startsWith(ZERRO))
+ {
+ // octal
+ // handle literals
+ // from 01000000000000000000000L to 01777777777777777777777L
+ // remove sign bit, parse as positive, then calculate the
+ // negative value with the sign bit
+ if (number.length() == 23)
+ {
+ if (number.charAt(1) == '1')
+ {
+ number = ZERRO + number.substring(2);
+ return new Long(Long.decode(number).longValue() - Long.MAX_VALUE - 1);
+ }
+ }
+ }
+ return Long.decode(number);
+ }
+}
+
+Object identifier() :
+{
+ Token id = null;
+}
+{
+ id=<IDENTIFIER>
+ {
+ Identifier identifier = (Identifier) identifierMap.get(id.image);
+ if (identifier == null)
+ {
+ identifier = new Identifier(id.image);
+ identifierMap.put(id.image, identifier);
+ }
+ return identifier;
+ }
+}
Modified: trunk/src/main/org/jboss/jms/tx/ClientTransaction.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ClientTransaction.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/tx/ClientTransaction.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -19,7 +19,7 @@
* 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.jms.client.tx;
+package org.jboss.jms.tx;
import java.io.DataInputStream;
import java.io.DataOutputStream;
Modified: trunk/src/main/org/jboss/jms/tx/LocalTx.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/LocalTx.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/tx/LocalTx.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -19,7 +19,7 @@
* 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.jms.client.tx;
+package org.jboss.jms.tx;
import org.jboss.util.id.GUID;
Modified: trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -19,7 +19,7 @@
* 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.jms.client.tx;
+package org.jboss.jms.tx;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
Modified: trunk/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ResourceManager.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/tx/ResourceManager.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -19,7 +19,7 @@
* 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.jms.client.tx;
+package org.jboss.jms.tx;
import java.util.ArrayList;
import java.util.Collections;
@@ -33,12 +33,12 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
-import org.jboss.jms.client.tx.ClientTransaction.SessionTxState;
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.message.JBossMessage;
import org.jboss.jms.message.MessageProxy;
import org.jboss.jms.server.endpoint.DeliveryInfo;
+import org.jboss.jms.tx.ClientTransaction.SessionTxState;
import org.jboss.jms.util.MessagingTransactionRolledBackException;
import org.jboss.jms.util.MessagingXAException;
import org.jboss.logging.Logger;
Modified: trunk/src/main/org/jboss/jms/tx/ResourceManagerFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ResourceManagerFactory.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/tx/ResourceManagerFactory.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -19,7 +19,7 @@
* 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.jms.client.tx;
+package org.jboss.jms.tx;
import java.util.HashMap;
import java.util.Map;
Modified: trunk/src/main/org/jboss/jms/tx/TransactionRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/TransactionRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/tx/TransactionRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -19,14 +19,13 @@
* 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.jms.client.tx;
+package org.jboss.jms.tx;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import javax.transaction.xa.Xid;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.util.Streamable;
@@ -51,8 +50,6 @@
{
// Constants -----------------------------------------------------
- private static final Logger log = Logger.getLogger(TransactionRequest.class);
-
public final static byte ONE_PHASE_COMMIT_REQUEST = 0;
public final static byte TWO_PHASE_PREPARE_REQUEST = 2;
public final static byte TWO_PHASE_COMMIT_REQUEST = 3;
Modified: trunk/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,9 +24,8 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.server.endpoint.ConnectionEndpoint;
-import org.jboss.logging.Logger;
+import org.jboss.jms.tx.TransactionRequest;
/**
*
@@ -40,9 +39,7 @@
*/
public class ConnectionSendTransactionRequest extends RequestSupport
{
- private static final Logger log = Logger.getLogger(ConnectionSendTransactionRequest.class);
-
-
+
private TransactionRequest req;
private boolean checkForDuplicates;
Modified: trunk/src/main/org/jboss/jms/wireformat/PolledCallbacksDelivery.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/PolledCallbacksDelivery.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/wireformat/PolledCallbacksDelivery.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -27,7 +27,6 @@
import java.util.Iterator;
import java.util.List;
-import org.jboss.logging.Logger;
import org.jboss.remoting.InvocationResponse;
import org.jboss.remoting.callback.Callback;
@@ -42,9 +41,7 @@
*/
public class PolledCallbacksDelivery extends PacketSupport
{
- private static final Logger log = Logger.getLogger(PolledCallbacksDelivery.class);
-
-
+
private List callbacks;
private String sessionID;
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -28,12 +28,9 @@
import java.util.Iterator;
import java.util.List;
-import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.Cancel;
import org.jboss.jms.server.endpoint.DefaultCancel;
import org.jboss.jms.server.endpoint.SessionEndpoint;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
/**
*
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -25,12 +25,9 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.Cancel;
import org.jboss.jms.server.endpoint.DefaultCancel;
import org.jboss.jms.server.endpoint.SessionEndpoint;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
/**
*
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -27,7 +27,6 @@
import org.jboss.jms.message.JBossMessage;
import org.jboss.jms.server.endpoint.SessionEndpoint;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.MessageFactory;
/**
@@ -42,9 +41,7 @@
*/
public class SessionSendRequest extends RequestSupport
{
- private static final Logger log = Logger.getLogger(SessionSendRequest.class);
-
private JBossMessage msg;
private boolean checkForDuplicates;
Modified: trunk/src/main/org/jboss/messaging/core/message/SimpleMessageReference.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/SimpleMessageReference.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/messaging/core/message/SimpleMessageReference.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -21,8 +21,6 @@
*/
package org.jboss.messaging.core.message;
-import java.util.Map;
-
import org.jboss.logging.Logger;
import org.jboss.messaging.core.plugin.contract.MessageStore;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/ClusteredPostOfficeService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/ClusteredPostOfficeService.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/messaging/core/plugin/ClusteredPostOfficeService.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -31,9 +31,9 @@
import javax.management.ObjectName;
import javax.transaction.TransactionManager;
-import org.jboss.jms.selector.SelectorFactory;
import org.jboss.jms.server.JMSConditionFactory;
import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.selector.SelectorFactory;
import org.jboss.jms.util.ExceptionUtil;
import org.jboss.messaging.core.FilterFactory;
import org.jboss.messaging.core.plugin.contract.ConditionFactory;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/DefaultPostOfficeService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/DefaultPostOfficeService.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/messaging/core/plugin/DefaultPostOfficeService.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,9 +24,9 @@
import javax.management.ObjectName;
import javax.transaction.TransactionManager;
-import org.jboss.jms.selector.SelectorFactory;
import org.jboss.jms.server.JMSConditionFactory;
import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.selector.SelectorFactory;
import org.jboss.jms.util.ExceptionUtil;
import org.jboss.messaging.core.FilterFactory;
import org.jboss.messaging.core.plugin.contract.ConditionFactory;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultFailoverMapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultFailoverMapper.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultFailoverMapper.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -26,7 +26,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.plugin.contract.FailoverMapper;
/**
@@ -43,8 +42,6 @@
*/
public class DefaultFailoverMapper implements FailoverMapper
{
- private static final Logger log = Logger.getLogger(DefaultFailoverMapper.class);
-
/**
* Generate a mapping given a set of nodes - nodes will be sorted by the method.
*
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PullMessageResultRequest.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PullMessageResultRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PullMessageResultRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,7 +24,6 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageFactory;
@@ -40,8 +39,6 @@
*/
public class PullMessageResultRequest extends ClusterRequest
{
- private static final Logger log = Logger.getLogger(PullMessageResultRequest.class);
-
public static final int TYPE = 2;
private long holdingTxId;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/TransactionRequest.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/TransactionRequest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/TransactionRequest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,10 +24,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import org.jboss.logging.Logger;
-
-
/**
* A TransactionRequest
*
@@ -39,8 +36,6 @@
*/
abstract class TransactionRequest extends ClusterRequest implements ClusterTransaction
{
- private static final Logger log = Logger.getLogger(TransactionRequest.class);
-
protected int nodeId;
protected long txId;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -37,10 +37,10 @@
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.client.tx.ResourceManager;
-import org.jboss.jms.client.tx.ResourceManagerFactory;
import org.jboss.jms.message.MessageIdGenerator;
import org.jboss.jms.message.MessageIdGeneratorFactory;
+import org.jboss.jms.tx.ResourceManager;
+import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -35,7 +35,7 @@
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.client.tx.ResourceManager;
+import org.jboss.jms.tx.ResourceManager;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -33,8 +33,6 @@
import org.jboss.jms.client.delegate.ClientBrowserDelegate;
import org.jboss.jms.client.delegate.ClientConsumerDelegate;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
-import org.jboss.jms.client.tx.ClientTransaction;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTemporaryQueue;
import org.jboss.jms.destination.JBossTopic;
@@ -46,6 +44,8 @@
import org.jboss.jms.server.endpoint.DefaultCancel;
import org.jboss.jms.server.endpoint.DeliveryRecovery;
import org.jboss.jms.server.remoting.JMSWireFormat;
+import org.jboss.jms.tx.ClientTransaction;
+import org.jboss.jms.tx.TransactionRequest;
import org.jboss.jms.wireformat.BrowserHasNextMessageRequest;
import org.jboss.jms.wireformat.BrowserHasNextMessageResponse;
import org.jboss.jms.wireformat.BrowserNextMessageBlockRequest;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -36,7 +36,7 @@
import javax.transaction.xa.Xid;
import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.jms.client.tx.ResourceManagerFactory;
+import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -55,9 +55,9 @@
import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.state.SessionState;
-import org.jboss.jms.client.tx.LocalTx;
-import org.jboss.jms.client.tx.MessagingXAResource;
-import org.jboss.jms.client.tx.ResourceManager;
+import org.jboss.jms.tx.LocalTx;
+import org.jboss.jms.tx.MessagingXAResource;
+import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorParserTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorParserTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorParserTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -24,11 +24,11 @@
import java.io.ByteArrayInputStream;
import java.util.HashMap;
+import org.jboss.jms.server.selector.SelectorParser;
+import org.jboss.jms.server.selector.ISelectorParser;
+import org.jboss.jms.server.selector.Identifier;
+import org.jboss.jms.server.selector.Operator;
import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.jms.selector.ISelectorParser;
-import org.jboss.jms.selector.SelectorParser;
-import org.jboss.jms.selector.Identifier;
-import org.jboss.jms.selector.Operator;
/** Tests of the JavaCC LL(1) parser.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorSyntaxTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorSyntaxTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorSyntaxTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -21,9 +21,9 @@
*/
package org.jboss.test.messaging.jms.selector;
-import org.jboss.jms.selector.Selector;
+import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.server.selector.Selector;
import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.jms.message.JBossMessage;
/**
* Tests the complinace with the JMS Selector syntax.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -31,12 +31,12 @@
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
import org.jboss.jms.server.endpoint.ConnectionEndpoint;
+import org.jboss.jms.tx.TransactionRequest;
import org.jboss.messaging.core.plugin.IDBlock;
import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
Modified: trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java 2007-05-14 23:15:36 UTC (rev 2680)
+++ trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java 2007-05-15 00:09:10 UTC (rev 2681)
@@ -12,7 +12,6 @@
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.jms.client.tx.TransactionRequest;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
import org.jboss.jms.server.endpoint.ServerConnectionFactoryEndpoint;
@@ -20,6 +19,7 @@
import org.jboss.jms.server.endpoint.advised.ConnectionAdvised;
import org.jboss.jms.server.endpoint.advised.ConnectionFactoryAdvised;
import org.jboss.jms.server.endpoint.advised.SessionAdvised;
+import org.jboss.jms.tx.TransactionRequest;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.jmx.rmi.RMITestServer;
More information about the jboss-cvs-commits
mailing list