001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer(s): ____________________________________.
022: * Contributor(s): Michel Bruno and Guillaume Riviere
023: *
024: * --------------------------------------------------------------------------
025: * $Id: JmxResourceAdapter.java 5699 2004-10-29 23:33:37Z ehardesty $
026: * --------------------------------------------------------------------------
027: */
028:
029: package org.objectweb.jonas.resource;
030:
031: import java.util.Properties;
032: import java.io.File;
033: import java.net.URL;
034:
035: /**
036: * MBean class for general Resource Management
037: * MBean type: Standard
038: * MBean model: delegate
039: *
040: * @author Michel Bruno and Guillaume Riviere<br>
041: * Contributor Michel-Ange Anton (add 'filename', 'inEarCase', 'earURL' properties)
042: *
043: */
044: public class JmxResourceAdapter implements JmxResourceAdapterMBean {
045:
046: /**
047: * Properties associated with the RAR
048: */
049: private Properties prop = null;
050: /**
051: * Jndi name
052: */
053: private String jndiname = null;
054: /**
055: * Filename of the RAR
056: */
057: private String filename = null;
058: /**
059: * Boolean if the RAR is in an EAR file
060: */
061: private boolean inEarCase = false;
062: /**
063: * URL of the EAR if used
064: */
065: private URL earURL = null;
066:
067: /**
068: * Constructor
069: * @param prop Properties of RAR
070: * @param jndiname String of RAR
071: * @param filename String of RAR filename
072: * @param inEarCase boolean if in an EAR file
073: * @param earURL URL of EAR file
074: */
075: public JmxResourceAdapter(Properties prop, String jndiname,
076: String filename, boolean inEarCase, URL earURL) {
077: this .prop = prop;
078: this .jndiname = jndiname;
079: // To avoid trouble between OS (Unix <-> Windows)
080: try {
081: this .filename = (new File(filename)).toURL().getPath();
082: } catch (Exception e) {
083: this .filename = filename;
084: }
085: this .inEarCase = inEarCase;
086: this .earURL = earURL;
087: }
088:
089: /**
090: * return the Adaptor Properties
091: * @return Properties adaptor properties
092: */
093: public Properties getProperties() {
094: return prop;
095: }
096:
097: /**
098: * return the jndi name
099: * @return String jndiname
100: */
101: public String getJndiName() {
102: return jndiname;
103: }
104:
105: /**
106: * Accessor the filename of the resource adapter.
107: * @return String the filename
108: */
109: public String 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 getEarURL() {
126: return earURL;
127: }
128: }
|