KickJava   Java API By Example, From Geeks To Geeks.

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


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  * --------------------------------------------------------------------------
22  * $Id: ResourceAdapter.java,v 1.3 2005/04/26 16:19:06 ehardesty Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.resource;
27
28 import java.util.Properties JavaDoc;
29 import java.io.File JavaDoc;
30 import java.net.URL JavaDoc;
31
32 import org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject;
33 import org.objectweb.jonas.resource.pool.api.Pool;
34
35 /**
36  * MBean class for ResourceAdapter management
37  *
38  * @author Michel Bruno and Guillaume Riviere<br>
39  * @contributor Michel-Ange Anton (add 'filename', 'inEarCase', 'earURL' properties)<br>
40  * @contributor Adriana Danes JSR 77 (J2EE Management Standard)
41  */

42 public class ResourceAdapter extends J2EEManagedObject {
43
44     // JSR 77
45
/**
46      * JCA Resource Object Name
47      */

48     private String JavaDoc jcaResourceObjectName = null;
49
50     /**
51      * Properties associated with the RAR
52      */

53     private Properties JavaDoc prop = null;
54     /**
55      * Jndi name
56      */

57     private String JavaDoc jndiName = null;
58     /**
59      * Filename of the RAR
60      */

61     private String JavaDoc filename = null;
62     /**
63      * Boolean if the RAR is in an EAR file
64      */

65     private boolean inEarCase = false;
66     /**
67      * URL of the EAR if used
68      */

69     private URL JavaDoc earURL = null;
70     /**
71      * Spec version
72      */

73     private String JavaDoc specVersion = null;
74
75
76     /**
77      * Constructor
78      * @param objectName String of J2EE Managed Object
79      * @param prop Properties of RAR
80      * @param jndiName String of RAR
81      * @param filename String of RAR filename
82      * @param inEarCase boolean if in an EAR file
83      * @param earURL URL of EAR file
84      * @param specVersion String of spec version
85      */

86     public ResourceAdapter(String JavaDoc objectName, Properties JavaDoc prop, String JavaDoc jndiName, String JavaDoc filename,
87                            boolean inEarCase, URL JavaDoc earURL, String JavaDoc specVersion) {
88         super(objectName);
89         this.prop = prop;
90         this.jndiName = jndiName;
91         // To avoid trouble between OS (Unix <-> Windows)
92
try {
93             this.filename = (new File JavaDoc(filename)).toURL().getPath();
94         } catch (Exception JavaDoc e) {
95             this.filename = filename;
96         }
97         this.inEarCase = inEarCase;
98         this.earURL = earURL;
99         this.specVersion = specVersion;
100     }
101
102     /**
103      * return the Adaptor Properties
104      * @return Properties adaptor properties
105      */

106     public Properties JavaDoc getProperties() {
107         return prop;
108     }
109
110     /**
111      * return the jndi name
112      * @return String jndi name
113      */

114     public String JavaDoc getJndiName() {
115         return jndiName;
116     }
117
118     /**
119      * Accessor the filename of the resource adapter.
120      * @return The filename
121      */

122     public String JavaDoc getFileName() {
123         return filename;
124     }
125
126     /**
127      * Accessor the flag indicating if the resource adapter is in Ear.
128      * @return Flag if this resource adapter is in Ear
129      */

130     public boolean getInEarCase() {
131         return inEarCase;
132     }
133
134     /**
135      * Accessor the URL of the Ear if the resource adapter is in Ear.
136      * @return The URL of the Ear or null
137      */

138     public URL JavaDoc getEarURL() {
139         return earURL;
140     }
141
142     /**
143      * return the jcaResourceObjectName
144      * @return String jcaResourceObjectName
145      */

146     public String JavaDoc getJcaResource() {
147         return jcaResourceObjectName;
148     }
149
150     /**
151      * return the specVersion
152      * @return String specVersion
153      */

154     public String JavaDoc getSpecVersion() {
155         return specVersion;
156     }
157
158     /**
159      * set the jcaResourceObjectName
160      * @param jcaResourceObjectName to set
161      */

162     public void setJcaResource(String JavaDoc jcaResourceObjectName) {
163         this.jcaResourceObjectName = jcaResourceObjectName;
164     }
165 }
166
Popular Tags