KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mr > api > jms > MantaConnectionMetaData


1 /*
2  * Copyright 2002 by
3  * <a HREF="http://www.coridan.com">Coridan</a>
4  * <a HREF="mailto: support@coridan.com ">support@coridan.com</a>
5  *
6  * The contents of this file are subject to the Mozilla Public License Version
7  * 1.1 (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  * http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is "MantaRay" (TM).
17  *
18  * The Initial Developer of the Original Code is Nimo 23-MAR-2004.
19  * Portions created by the Initial Developer are Copyright (C) 2006
20  * Coridan Inc. All Rights Reserved.
21  *
22  * Contributor(s): all the names of the contributors are added in the source
23  * code where applicable.
24  *
25  * Alternatively, the contents of this file may be used under the terms of the
26  * LGPL license (the "GNU LESSER GENERAL PUBLIC LICENSE"), in which case the
27  * provisions of LGPL are applicable instead of those above. If you wish to
28  * allow use of your version of this file only under the terms of the LGPL
29  * License and not to allow others to use your version of this file under
30  * the MPL, indicate your decision by deleting the provisions above and
31  * replace them with the notice and other provisions required by the LGPL.
32  * If you do not delete the provisions above, a recipient may use your version
33  * of this file under either the MPL or the GNU LESSER GENERAL PUBLIC LICENSE.
34  
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Lesser General Public License as published by the Free Software Foundation;
39  * either version 2.1 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
44  * License for more details.
45  */

46  package org.mr.api.jms;
47 /**
48  * @author Nimo 23-MAR-2004
49  *
50  * This class is used to retrieve a connection's metadata.
51  */

52 import java.io.Serializable JavaDoc;
53 import java.util.Enumeration JavaDoc;
54 import java.util.Vector JavaDoc;
55
56 import javax.jms.ConnectionMetaData JavaDoc;
57 import javax.jms.JMSException JavaDoc;
58
59 import org.mr.Version;
60
61 public class MantaConnectionMetaData implements Serializable JavaDoc, ConnectionMetaData JavaDoc{
62
63     
64     /**
65      * generated <code>serialVersionUID</code>
66      */

67     private static final long serialVersionUID = 9213953066729918790L;
68     /**
69      * Constructor - creates an object of type ConnectionMetaData.
70      * The MetaData supplied by the MantaRay is curently non.
71      *
72      */

73     public MantaConnectionMetaData() {
74         jmsxProperties = new Vector JavaDoc();
75         
76         String JavaDoc version = Version.version ;
77         version = version.substring(version.indexOf(" "));
78         String JavaDoc[] ver = version.split("\\.");
79         if(ver.length ==3){
80             REVISION = Integer.parseInt(ver[0].trim());
81             MAJOR_VERSION = Integer.parseInt(ver[1].trim());
82             MINOR_VERSION = Integer.parseInt(ver[2].trim());
83         }else if(ver.length ==2){
84             REVISION = Integer.parseInt(ver[0].trim());
85             MAJOR_VERSION = Integer.parseInt(ver[1].trim());
86             MINOR_VERSION = 0;
87         }else{
88             REVISION = Integer.parseInt(ver[0].trim());
89             MAJOR_VERSION = 0;
90             MINOR_VERSION = 0;
91         }
92         
93     }
94     
95     /**
96      * Gets the JMS major version number.
97      *
98      * @return the JMS API major version number
99      *
100      * @exception JMSException if the JMS provider fails to retrieve the
101      * metadata due to some internal error.
102      */

103     public int getJMSMajorVersion() throws JMSException JavaDoc {
104         
105         //NimoChange : I assume this was an error.
106
return JMS_MAJOR_VERSION;
107         
108         //old code
109
//return JMS_MINOR_VERSION;
110
}//getJMSMajorVersion
111

112     
113     /**
114      * Gets the JMS minor version number.
115      *
116      * @return the JMS API minor version number
117      *
118      * @exception JMSException if the JMS provider fails to retrieve the
119      * metadata due to some internal error.
120      */

121     public int getJMSMinorVersion() throws JMSException JavaDoc {
122         return JMS_MINOR_VERSION;
123     }//getJMSMinorVersion
124

125     
126     /**
127      * Gets the JMS provider name.
128      *
129      * @return the JMS provider name
130      *
131      * @exception JMSException if the JMS provider fails to retrieve the
132      * metadata due to some internal error.
133      */

134     public String JavaDoc getJMSProviderName() throws JMSException JavaDoc {
135         return PROVIDER_NAME;
136     }//getJMSProviderName
137

138     
139     /**
140      * Gets the JMS API version.
141      *
142      * @return the JMS API version
143      *
144      * @exception JMSException if the JMS provider fails to retrieve the
145      * metadata due to some internal error.
146      */

147     public String JavaDoc getJMSVersion() throws JMSException JavaDoc {
148         return JMS_VERSION;
149     }//getJMSVersion
150

151     /**
152      * Gets an enumeration of the JMSX property names.
153      *
154      * @return an Enumeration of JMSX property names
155      *
156      * @exception JMSException if the JMS provider fails to retrieve the
157      * metadata due to some internal error.
158      */

159     public Enumeration JavaDoc getJMSXPropertyNames() throws JMSException JavaDoc {
160         
161         return jmsxProperties.elements();
162     }
163     
164
165     /**
166      * Gets the JMS provider major version number.
167      *
168      * @return the JMS provider major version number
169      *
170      * @exception JMSException if the JMS provider fails to retrieve the
171      * metadata due to some internal error.
172      */

173     public int getProviderMajorVersion() throws JMSException JavaDoc {
174         return MAJOR_VERSION;
175     }//getProviderMajorVersion
176

177     /**
178      * Gets the JMS provider minor version number.
179      *
180      * @return the JMS provider minor version number
181      *
182      * @exception JMSException if the JMS provider fails to retrieve the
183      * metadata due to some internal error.
184      */

185     public int getProviderMinorVersion() throws JMSException JavaDoc {
186         return MINOR_VERSION;
187     }//getProviderMinorVersion
188

189
190     /**
191      * Gets the JMS provider version.
192      *
193      * @return the JMS provider version
194      *
195      * @exception JMSException if the JMS provider fails to retrieve the
196      * metadata due to some internal error.
197      */

198     public String JavaDoc getProviderVersion() throws JMSException JavaDoc {
199         return Version.version;
200     }//getProviderVersion
201

202     
203     // version information
204
public static int MINOR_VERSION = 1;
205     public static int MAJOR_VERSION = 4;
206     public static int REVISION = 1;
207
208     public static final String JavaDoc PROVIDER_NAME = "MantaRay";
209     public static final int JMS_MAJOR_VERSION = 1;
210     public static final int JMS_MINOR_VERSION = 1;
211     public static final String JavaDoc JMS_VERSION = "1.1";
212     Vector JavaDoc jmsxProperties;
213 }
214
Popular Tags