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: * --------------------------------------------------------------------------
022: * $Id: ResourceAdapterModule.java 8149 2006-03-21 08:25:30Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.resource;
025:
026: import java.net.URL;
027: import java.util.ArrayList;
028:
029: import javax.management.ObjectName;
030:
031: import org.objectweb.jonas.management.j2eemanagement.J2EEModule;
032: import org.objectweb.jonas.jmx.J2eeObjectName;
033:
034: /**
035: * MBean class for ResourceAdapterModule management
036: *
037: * @author Adriana Danes JSR 77 (J2EE Management Standard)
038: */
039: public class ResourceAdapterModule extends J2EEModule /*J2EEManagedObject*/{
040:
041: // JSR 77
042: private ArrayList resourceAdapters = new ArrayList();
043:
044: private boolean inEarCase = false;
045: private URL earURL = null;
046: private String fileName = null;
047:
048: /**
049: * J2EEApplication MBean OBJECT_NAME in ear case
050: */
051: private String earON = null;
052:
053: public ResourceAdapterModule(ObjectName objectName,
054: boolean inEarCase, URL earURL) {
055: super (objectName.toString());
056: this .inEarCase = inEarCase;
057: this .earURL = earURL;
058: ObjectName earOn = null;
059: if (inEarCase) {
060: String domainName = objectName.getDomain();
061: String serverName = objectName.getKeyProperty("J2EEServer");
062: String appName = objectName
063: .getKeyProperty("J2EEApplication");
064: earOn = J2eeObjectName.J2EEApplication(domainName,
065: serverName, appName);
066: }
067: if (earOn != null) {
068: earON = earOn.toString();
069: }
070: }
071:
072: /**
073: * Accessor the flag indicating if the resource adapter is in Ear.
074: * @return Flag if this resource adapter is in Ear
075: */
076: public boolean getInEarCase() {
077: return inEarCase;
078: }
079:
080: /**
081: * Accessor the URL of the Ear if the resource adapter is in Ear.
082: * @return The URL of the Ear or null
083: */
084: public URL getEarURL() {
085: return earURL;
086: }
087:
088: public String[] getResourceAdapters() {
089: return ((String[]) resourceAdapters
090: .toArray(new String[resourceAdapters.size()]));
091: }
092:
093: public void setResourceAdapter(String resourceAdapterObjectName) {
094: resourceAdapters.add(resourceAdapterObjectName);
095: }
096:
097: /**
098: * @return Returns the fileName.
099: */
100: public String getFileName() {
101: return fileName;
102: }
103:
104: /**
105: * @param fileName The fileName to set.
106: */
107: public void setFileName(String fileName) {
108: this .fileName = fileName;
109: }
110:
111: /**
112: *
113: * @return The J2EEApplication MBean OBJECT_NAME in ear case
114: */
115: public String getEarON() {
116: return earON;
117: }
118: }
|