KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > resource > JmxResourceAdapter


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): ____________________________________.
22  * Contributor(s): Michel Bruno and Guillaume Riviere
23  *
24  * --------------------------------------------------------------------------
25  * $Id: JmxResourceAdapter.java,v 1.4 2004/10/29 23:33:37 ehardesty Exp $
26  * --------------------------------------------------------------------------
27  */

28
29 package org.objectweb.jonas.resource;
30
31 import java.util.Properties JavaDoc;
32 import java.io.File JavaDoc;
33 import java.net.URL JavaDoc;
34
35 /**
36  * MBean class for general Resource Management
37  * MBean type: Standard
38  * MBean model: delegate
39  *
40  * @author Michel Bruno and Guillaume Riviere<br>
41  * Contributor Michel-Ange Anton (add 'filename', 'inEarCase', 'earURL' properties)
42  *
43  */

44 public class JmxResourceAdapter implements JmxResourceAdapterMBean {
45
46     /**
47      * Properties associated with the RAR
48      */

49     private Properties JavaDoc prop = null;
50     /**
51      * Jndi name
52      */

53     private String JavaDoc jndiname = null;
54     /**
55      * Filename of the RAR
56      */

57     private String JavaDoc filename = null;
58     /**
59      * Boolean if the RAR is in an EAR file
60      */

61     private boolean inEarCase = false;
62     /**
63      * URL of the EAR if used
64      */

65     private URL JavaDoc earURL = null;
66
67     /**
68      * Constructor
69      * @param prop Properties of RAR
70      * @param jndiname String of RAR
71      * @param filename String of RAR filename
72      * @param inEarCase boolean if in an EAR file
73      * @param earURL URL of EAR file
74      */

75     public JmxResourceAdapter(Properties JavaDoc prop, String JavaDoc jndiname, String JavaDoc filename,
76         boolean inEarCase, URL JavaDoc earURL) {
77         this.prop = prop;
78         this.jndiname = jndiname;
79         // To avoid trouble between OS (Unix <-> Windows)
80
try {
81             this.filename = (new File JavaDoc(filename)).toURL().getPath();
82         } catch (Exception JavaDoc e) {
83             this.filename = filename;
84         }
85         this.inEarCase = inEarCase;
86         this.earURL = earURL;
87     }
88
89     /**
90      * return the Adaptor Properties
91      * @return Properties adaptor properties
92      */

93     public Properties JavaDoc getProperties() {
94         return prop;
95     }
96
97     /**
98      * return the jndi name
99      * @return String jndiname
100      */

101     public String JavaDoc getJndiName() {
102         return jndiname;
103     }
104
105     /**
106      * Accessor the filename of the resource adapter.
107      * @return String the filename
108      */

109     public String JavaDoc getFilename() {
110         return filename;
111     }
112
113     /**
114      * Accessor the flag indicating if the resource adapter is in Ear.
115      * @return boolean Flag if this resource adapter is in Ear
116      */

117     public boolean isInEarCase() {
118         return inEarCase;
119     }
120
121     /**
122      * Accessor the URL of the Ear if the resource adapter is in Ear.
123      * @return URL of the Ear or null
124      */

125     public URL JavaDoc getEarURL() {
126         return earURL;
127     }
128 }
129
Popular Tags