[hornetq-commits] JBoss hornetq SVN: r8744 - in trunk/src/main/org/hornetq: core/filter/impl and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 6 08:37:55 EST 2010


Author: timfox
Date: 2010-01-06 08:37:55 -0500 (Wed, 06 Jan 2010)
New Revision: 8744

Added:
   trunk/src/main/org/hornetq/api/core/FilterConstants.java
Modified:
   trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
Log:
moved filter constants into their own class in the api

Added: trunk/src/main/org/hornetq/api/core/FilterConstants.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/FilterConstants.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/api/core/FilterConstants.java	2010-01-06 13:37:55 UTC (rev 8744)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.api.core;
+
+/**
+ * Constants representing pre-defined message attributes that can be referenced in HornetQ core
+ * filter expressions
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class FilterConstants
+{
+   public static final SimpleString HORNETQ_EXPIRATION = new SimpleString("HQExpiration");
+   
+   public static final SimpleString HORNETQ_DURABLE = new SimpleString("HQDurable");
+   
+   public static final SimpleString NON_DURABLE = new SimpleString("NON_DURABLE");
+   
+   public static final SimpleString DURABLE = new SimpleString("DURABLE");
+   
+   public static final SimpleString HORNETQ_TIMESTAMP = new SimpleString("HQTimestamp");
+   
+   public static final SimpleString HORNETQ_PRIORITY = new SimpleString("HQPriority");
+   
+   public static final SimpleString HORNETQ_SIZE = new SimpleString("HQSize");
+   
+   public static final SimpleString HORNETQ_PREFIX = new SimpleString("HQ");
+}

Modified: trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java	2010-01-06 13:37:34 UTC (rev 8743)
+++ trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java	2010-01-06 13:37:55 UTC (rev 8744)
@@ -16,6 +16,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.hornetq.api.core.FilterConstants;
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.core.filter.Filter;
@@ -59,24 +60,6 @@
 
    private static final Logger log = Logger.getLogger(FilterImpl.class);
 
-   private static final SimpleString HORNETQ_EXPIRATION = new SimpleString("HQExpiration");
-
-   private static final SimpleString HORNETQ_DURABLE = new SimpleString("HQDurable");
-
-   private static final SimpleString NON_DURABLE = new SimpleString("NON_DURABLE");
-
-   private static final SimpleString DURABLE = new SimpleString("DURABLE");
-
-   private static final SimpleString HORNETQ_TIMESTAMP = new SimpleString("HQTimestamp");
-
-   private static final SimpleString HORNETQ_PRIORITY = new SimpleString("HQPriority");
-
-   private static final SimpleString HORNETQ_SIZE = new SimpleString("HQSize");
-
-   private static final SimpleString HORNETQ_PREFIX = new SimpleString("HQ");
-
-   // Attributes -----------------------------------------------------
-
    private final SimpleString sfilterString;
 
    private final Map<SimpleString, Identifier> identifiers = new HashMap<SimpleString, Identifier>();
@@ -147,7 +130,7 @@
          {
             Object val = null;
 
-            if (id.getName().startsWith(FilterImpl.HORNETQ_PREFIX))
+            if (id.getName().startsWith(FilterConstants.HORNETQ_PREFIX))
             {
                // Look it up as header fields
                val = getHeaderFieldValue(message, id.getName());
@@ -189,23 +172,23 @@
 
    private Object getHeaderFieldValue(final ServerMessage msg, final SimpleString fieldName)
    {
-      if (FilterImpl.HORNETQ_PRIORITY.equals(fieldName))
+      if (FilterConstants.HORNETQ_PRIORITY.equals(fieldName))
       {
          return new Integer(msg.getPriority());
       }
-      else if (FilterImpl.HORNETQ_TIMESTAMP.equals(fieldName))
+      else if (FilterConstants.HORNETQ_TIMESTAMP.equals(fieldName))
       {
          return msg.getTimestamp();
       }
-      else if (FilterImpl.HORNETQ_DURABLE.equals(fieldName))
+      else if (FilterConstants.HORNETQ_DURABLE.equals(fieldName))
       {
-         return msg.isDurable() ? FilterImpl.DURABLE : FilterImpl.NON_DURABLE;
+         return msg.isDurable() ? FilterConstants.DURABLE : FilterConstants.NON_DURABLE;
       }
-      else if (FilterImpl.HORNETQ_EXPIRATION.equals(fieldName))
+      else if (FilterConstants.HORNETQ_EXPIRATION.equals(fieldName))
       {
          return msg.getExpiration();
       }
-      else if (FilterImpl.HORNETQ_SIZE.equals(fieldName))
+      else if (FilterConstants.HORNETQ_SIZE.equals(fieldName))
       {
          return msg.getEncodeSize();
       }



More information about the hornetq-commits mailing list