01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.jms;
23:
24: import javax.jms.DeliveryMode;
25: import javax.jms.JMSException;
26:
27: /**
28: * Standard validation
29: *
30: * @author <a href="mailto:adrian@jboss.org>Adrian Brock</a>
31: * @version $Revision: 57195 $
32: */
33: public class JMSValidator {
34: // Constants -----------------------------------------------------
35:
36: // Attributes ----------------------------------------------------
37:
38: // Static --------------------------------------------------------
39:
40: /**
41: * Validate the delivery mode
42: *
43: * @param the delivery mode to validate
44: * @throws JMSException for any error
45: */
46: public static void validateDeliveryMode(int deliveryMode)
47: throws JMSException {
48: if (deliveryMode != DeliveryMode.NON_PERSISTENT
49: && deliveryMode != DeliveryMode.PERSISTENT)
50: throw new JMSException("Invalid delivery mode "
51: + deliveryMode);
52: }
53:
54: /**
55: * Validate the priority
56: *
57: * @param the priority to validate
58: * @throws JMSException for any error
59: */
60: public static void validatePriority(int priority)
61: throws JMSException {
62: if (priority < 0 || priority > 9)
63: throw new JMSException("Invalid priority " + priority);
64: }
65:
66: /**
67: * Validate the time to live
68: *
69: * @param the ttl to validate
70: * @throws JMSException for any error
71: */
72: public static void validateTimeToLive(long timeToLive)
73: throws JMSException {
74: }
75:
76: // Constructors --------------------------------------------------
77:
78: // Public --------------------------------------------------------
79:
80: // Protected ------------------------------------------------------
81:
82: // Package Private ------------------------------------------------
83:
84: // Private --------------------------------------------------------
85:
86: // Inner Classes --------------------------------------------------
87: }
|