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: ResourceAdapter.java 9118 2006-07-05 13:23:44Z sauthieg $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.resource;
027:
028: import java.io.File;
029: import java.net.URL;
030: import java.util.Properties;
031:
032: import org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject;
033:
034: /**
035: * MBean class for ResourceAdapter management
036: *
037: * @author Michel Bruno and Guillaume Riviere<br>
038: * @contributor Michel-Ange Anton (add 'filename', 'inEarCase', 'earURL' properties)<br>
039: * @contributor Adriana Danes JSR 77 (J2EE Management Standard)
040: */
041: public class ResourceAdapter extends J2EEManagedObject {
042:
043: // JSR 77
044: /**
045: * JCA Resource Object Name
046: */
047: private String jcaResourceObjectName = null;
048:
049: /**
050: * Properties associated with the RAR
051: */
052: private Properties prop = null;
053: /**
054: * Jndi name
055: */
056: private String jndiName = null;
057: /**
058: * Filename of the RAR
059: */
060: private String filename = null;
061: /**
062: * Boolean if the RAR is in an EAR file
063: */
064: private boolean inEarCase = false;
065: /**
066: * URL of the EAR if used
067: */
068: private URL earURL = null;
069: /**
070: * Spec version
071: */
072: private String specVersion = null;
073:
074: /**
075: * Constructor
076: * @param objectName String of J2EE Managed Object
077: * @param prop Properties of RAR
078: * @param jndiName String of RAR
079: * @param filename String of RAR filename
080: * @param inEarCase boolean if in an EAR file
081: * @param earURL URL of EAR file
082: * @param specVersion String of spec version
083: */
084: public ResourceAdapter(String objectName, Properties prop,
085: String jndiName, String filename, boolean inEarCase,
086: URL earURL, String specVersion) {
087: super (objectName);
088: this .prop = prop;
089: this .jndiName = jndiName;
090: // To avoid trouble between OS (Unix <-> Windows)
091: try {
092: this .filename = (new File(filename)).toURL().getPath();
093: } catch (Exception e) {
094: this .filename = filename;
095: }
096: this .inEarCase = inEarCase;
097: this .earURL = earURL;
098: this .specVersion = specVersion;
099: }
100:
101: /**
102: * return the Adaptor Properties
103: * @return Properties adaptor properties
104: */
105: public Properties getProperties() {
106: return prop;
107: }
108:
109: /**
110: * return the jndi name
111: * @return String jndi name
112: */
113: public String getJndiName() {
114: return jndiName;
115: }
116:
117: /**
118: * Accessor the filename of the resource adapter.
119: * @return The filename
120: */
121: public String getFileName() {
122: return filename;
123: }
124:
125: /**
126: * Accessor the flag indicating if the resource adapter is in Ear.
127: * @return Flag if this resource adapter is in Ear
128: */
129: public boolean getInEarCase() {
130: return inEarCase;
131: }
132:
133: /**
134: * Accessor the URL of the Ear if the resource adapter is in Ear.
135: * @return The URL of the Ear or null
136: */
137: public URL getEarURL() {
138: return earURL;
139: }
140:
141: /**
142: * return the jcaResourceObjectName
143: * @return String jcaResourceObjectName
144: */
145: public String getJcaResource() {
146: return jcaResourceObjectName;
147: }
148:
149: /**
150: * return the specVersion
151: * @return String specVersion
152: */
153: public String getSpecVersion() {
154: return specVersion;
155: }
156:
157: /**
158: * set the jcaResourceObjectName
159: * @param jcaResourceObjectName to set
160: */
161: public void setJcaResource(String jcaResourceObjectName) {
162: this.jcaResourceObjectName = jcaResourceObjectName;
163: }
164: }
|