Source Code Cross Referenced for JMSMap.java in  » EJB-Server-JBoss-4.2.1 » jms » org » jboss » jms » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » jms » org.jboss.jms.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jboss.jms.util;
023:
024:        import javax.jms.JMSException;
025:        import javax.jms.MapMessage;
026:        import javax.jms.MessageFormatException;
027:        import java.util.Collections;
028:        import java.util.Enumeration;
029:        import java.util.HashMap;
030:
031:        /**
032:         * JMS specific map backed by a {@link HashMap}.  Does not implement
033:         * <code>Map</code> but instead implements the body elements of the
034:         * {@link MapMessage}.  Serves as he basis for {@link MessageProperties}
035:         * and the body for the <code>MapMessage</code>.
036:         *
037:         * @author <a href="mailto:nathan@jboss.org">Nathan Phelps</a>
038:         * @version $Revision: 57195 $ $Date: 2006-09-26 08:08:17 -0400 (Tue, 26 Sep 2006) $
039:         */
040:        public class JMSMap implements  java.io.Serializable {
041:
042:            protected HashMap contents = new HashMap();
043:
044:            public static final JMSMap createInstance(Class type) {
045:                if (type.equals(MapMessage.class)) {
046:                    return new JMSMap();
047:                } else {
048:                    return new MessageProperties();
049:                }
050:            }
051:
052:            public final void clear() {
053:                this .contents.clear();
054:            }
055:
056:            public boolean getBoolean(String name) throws JMSException {
057:                Object value = this .contents.get(name);
058:                return JMSTypeConversions.getBoolean(value);
059:            }
060:
061:            public byte getByte(String name) throws JMSException {
062:                Object value = this .contents.get(name);
063:                return JMSTypeConversions.getByte(value);
064:            }
065:
066:            public byte[] getBytes(String name) throws JMSException {
067:                Object value = this .contents.get(name);
068:                return JMSTypeConversions.getBytes(value);
069:            }
070:
071:            public char getChar(String name) throws JMSException {
072:                Object value = this .contents.get(name);
073:                return JMSTypeConversions.getChar(value);
074:            }
075:
076:            public double getDouble(String name) throws JMSException {
077:                Object value = this .contents.get(name);
078:                return JMSTypeConversions.getDouble(value);
079:            }
080:
081:            public float getFloat(String name) throws JMSException {
082:                Object value = this .contents.get(name);
083:                return JMSTypeConversions.getFloat(value);
084:            }
085:
086:            public int getInt(String name) throws JMSException {
087:                Object value = this .contents.get(name);
088:                return JMSTypeConversions.getInt(value);
089:            }
090:
091:            public long getLong(String name) throws JMSException {
092:                Object value = this .contents.get(name);
093:                return JMSTypeConversions.getLong(value);
094:            }
095:
096:            public Enumeration getMapNames() throws JMSException {
097:                return Collections.enumeration(this .contents.keySet());
098:            }
099:
100:            public Object getObject(String name) throws JMSException {
101:                return this .contents.get(name);
102:            }
103:
104:            public short getShort(String name) throws JMSException {
105:                Object value = this .contents.get(name);
106:                return JMSTypeConversions.getShort(value);
107:            }
108:
109:            public String getString(String name) throws JMSException {
110:                Object value = this .contents.get(name);
111:                return JMSTypeConversions.getString(value);
112:            }
113:
114:            public boolean itemExists(String name) {
115:                return this .contents.containsKey(name);
116:            }
117:
118:            public void setBoolean(String name, boolean value)
119:                    throws JMSException {
120:                this .contents.put(name, new Boolean(value));
121:            }
122:
123:            public void setByte(String name, byte value) throws JMSException {
124:                this .contents.put(name, new Byte(value));
125:            }
126:
127:            public void setBytes(String name, byte[] value) throws JMSException {
128:                byte[] bytes = new byte[value.length];
129:                System.arraycopy(value, 0, bytes, 0, bytes.length);
130:                this .contents.put(name, bytes);
131:            }
132:
133:            public void setBytes(String name, byte[] value, int offset,
134:                    int length) throws JMSException {
135:                byte[] bytes = new byte[length];
136:                System.arraycopy(value, offset, bytes, 0, length);
137:                this .contents.put(name, bytes);
138:            }
139:
140:            public void setChar(String name, char value) throws JMSException {
141:                this .contents.put(name, new Character(value));
142:            }
143:
144:            public void setDouble(String name, double value)
145:                    throws JMSException {
146:                this .contents.put(name, new Double(value));
147:            }
148:
149:            public void setFloat(String name, float value) throws JMSException {
150:                this .contents.put(name, new Float(value));
151:            }
152:
153:            public void setInt(String name, int value) throws JMSException {
154:                this .contents.put(name, new Integer(value));
155:            }
156:
157:            public void setLong(String name, long value) throws JMSException {
158:                this .contents.put(name, new Long(value));
159:            }
160:
161:            public void setObject(String name, Object value)
162:                    throws JMSException {
163:                if (value instanceof  Boolean || value instanceof  Byte
164:                        || value instanceof  Character
165:                        || value instanceof  Double || value instanceof  Float
166:                        || value instanceof  Integer || value instanceof  Long
167:                        || value instanceof  Short || value instanceof  String) {
168:                    this .contents.put(name, value);
169:                } else {
170:                    throw new MessageFormatException(""); //TOD: Implement message
171:                }
172:            }
173:
174:            public void setShort(String name, short value) throws JMSException {
175:                this .contents.put(name, new Short(value));
176:            }
177:
178:            public void setString(String name, String value)
179:                    throws JMSException {
180:                this.contents.put(name, value);
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.