View Javadoc
1 /*** 2 * Redistribution and use of this software and associated documentation 3 * ("Software"), with or without modification, are permitted provided 4 * that the following conditions are met: 5 * 6 * 1. Redistributions of source code must retain copyright 7 * statements and notices. Redistributions must also contain a 8 * copy of this document. 9 * 10 * 2. Redistributions in binary form must reproduce the 11 * above copyright notice, this list of conditions and the 12 * following disclaimer in the documentation and/or other 13 * materials provided with the distribution. 14 * 15 * 3. The name "Exolab" must not be used to endorse or promote 16 * products derived from this Software without prior written 17 * permission of Exoffice Technologies. For written permission, 18 * please contact info@exolab.org. 19 * 20 * 4. Products derived from this Software may not be called "Exolab" 21 * nor may "Exolab" appear in their names without prior written 22 * permission of Exoffice Technologies. Exolab is a registered 23 * trademark of Exoffice Technologies. 24 * 25 * 5. Due credit should be given to the Exolab Project 26 * (http://www.exolab.org/). 27 * 28 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS 29 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 30 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 31 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 32 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 33 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 37 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 39 * OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 * Copyright 2000-2001,2003 (C) Exoffice Technologies Inc. All Rights Reserved. 42 */ 43 44 package org.exolab.jms.selector; 45 46 47 /*** 48 * Utility methods for JMS message header identifiers 49 * 50 * @version $Revision: 1.6 $ $Date: 2003/08/10 07:33:39 $ 51 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a> 52 */ 53 public final class Identifiers { 54 55 /*** 56 * Prefix for identifiers available via message methods 57 */ 58 public static final String JMS_PREFIX = "JMS"; 59 60 /*** 61 * Prefix for identifiers specified by the JMS standard 62 */ 63 public static final String JMSX_PREFIX = "JMSX"; 64 65 /*** 66 * Prefix for provider specific identifiers 67 */ 68 public static final String JMS_PROVIDER_PREFIX = "JMS_"; 69 70 /*** 71 * The JMSDeliveryMode identifier 72 */ 73 public static final String JMS_DELIVERY_MODE = "JMSDeliveryMode"; 74 75 /*** 76 * The JMSPriority identifier 77 */ 78 public static final String JMS_PRIORITY = "JMSPriority"; 79 80 /*** 81 * The JMSMessageID identifier 82 */ 83 public static final String JMS_MESSAGE_ID = "JMSMessageID"; 84 85 /*** 86 * The JMSTimestamp identifier 87 */ 88 public static final String JMS_TIMESTAMP = "JMSTimestamp"; 89 90 /*** 91 * The JMSCorrelationID identifier 92 */ 93 public static final String JMS_CORRELATION_ID = "JMSCorrelationID"; 94 95 /*** 96 * The JMSType identifier 97 */ 98 public static final String JMS_TYPE = "JMSType"; 99 100 /*** 101 * The persistent delivery mode 102 */ 103 public static final String PERSISTENT = "PERSISTENT"; 104 105 /*** 106 * The non-persistent delivery mode 107 */ 108 public static final String NON_PERSISTENT = "NON_PERSISTENT"; 109 110 111 /*** 112 * Private constructor 113 */ 114 private Identifiers() { 115 } 116 117 /*** 118 * Determines if an identifier is a JMS identifier (not a JMSX or 119 * provider specific identifier) 120 * 121 * @param name the identifier name 122 * @return <code>true</code> if the identifier is a JMS identifier, 123 * otherwise <code>false</code> 124 */ 125 public static boolean isJMSIdentifier(final String name) { 126 boolean result = false; 127 if (name.startsWith(JMS_PREFIX) 128 && !(name.startsWith(JMSX_PREFIX) 129 || name.startsWith(JMS_PROVIDER_PREFIX))) { 130 result = true; 131 } 132 return result; 133 } 134 135 /*** 136 * Determines if a JMS identifier is valid in selectors 137 * 138 * @param name the identifier name 139 * @return <code>true</code> if the identifier may be selected upon, 140 * otherwise <code>false</code> 141 */ 142 public static boolean isQueryableJMSIdentifier(final String name) { 143 return (name.equals(JMS_DELIVERY_MODE) 144 || name.equals(JMS_PRIORITY) 145 || name.equals(JMS_TIMESTAMP) 146 || name.equals(JMS_MESSAGE_ID) 147 || name.equals(JMS_CORRELATION_ID) 148 || name.equals(JMS_TYPE)); 149 } 150 151 /*** 152 * Determines if a JMS identifier is a string 153 * 154 * @param name the identifier name 155 * @return <code>true</code> if the identifier is a string, otherwise 156 * <code>false</code> 157 */ 158 public static boolean isString(final String name) { 159 return (name.equals(JMS_MESSAGE_ID) 160 || name.equals(JMS_CORRELATION_ID) 161 || name.equals(JMS_TYPE) 162 || name.equals(JMS_DELIVERY_MODE)); 163 // delivery mode is an integer which must be mapped to a string 164 // (see '3.8.1.3 Special Notes' of the spec). 165 } 166 167 /*** 168 * Determines if a JMS identifier is numeric 169 * 170 * @param name the identifier name 171 * @return <code>true</code> if the identifier is numeric, otherwise 172 * <code>false</code> 173 */ 174 public static boolean isNumeric(final String name) { 175 return (name.equals(JMS_PRIORITY) 176 || name.equals(JMS_TIMESTAMP)); 177 } 178 179 } //-- Identifiers

This page was automatically generated by Maven