KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > deployment > api > ResourceEnvRefDesc


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 1any 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: Christophe Ney
22  * --------------------------------------------------------------------------
23  * $Id: ResourceEnvRefDesc.java,v 1.2 2004/05/11 08:07:50 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_lib.deployment.api;
28
29 import org.objectweb.jonas_lib.deployment.xml.ResourceEnvRef;
30 import org.objectweb.jonas_lib.deployment.xml.JonasResourceEnv;
31
32 /**
33  * This class represents the description of a ResourceEnvRef object
34  * @author Christophe Ney
35  * @author Florent Benoit
36  */

37 public class ResourceEnvRefDesc {
38
39     /**
40      * The resource env ref name.
41      */

42     private String JavaDoc name;
43
44     /**
45      * The resource env ref type.
46      */

47     private Class JavaDoc type;
48
49     /**
50      * The resource env ref jndi name.
51      */

52     private String JavaDoc jndiName;
53
54     /**
55      * Construct a descriptor for the resource-env-ref and jonas-resource-env
56      * tags.
57      * @param classLoader the classloader for the classes.
58      * @param res the resource-env-ref resulting of the web.xml parsing.
59      * @param jRes the jonas-resource-env resulting of the jonas-web.xml
60      * parsing.
61      * @throws DeploymentDescException when missing information for
62      * creating the ResourceEnvRefDesc.
63      */

64     public ResourceEnvRefDesc(ClassLoader JavaDoc classLoader, ResourceEnvRef res,
65                               JonasResourceEnv jRes) throws DeploymentDescException {
66
67         name = res.getResourceEnvRefName();
68         try {
69             type = classLoader.loadClass(res.getResourceEnvRefType());
70         } catch (ClassNotFoundException JavaDoc e) {
71             throw new DeploymentDescException("resource-env-ref-type class not found for resource-env-ref " + name, e);
72         }
73         jndiName = jRes.getJndiName();
74     }
75
76     /**
77      * Get resource environment ref. name.
78      * @return Name of the resource environment ref.
79      */

80     public String JavaDoc getName() {
81         return name;
82     }
83
84     /**
85      * Get resource environment ref. type.
86      * @return Class of the resource environment ref.
87      */

88     public Class JavaDoc getType() {
89         return type;
90     }
91
92     /**
93      * Get the jndi name of the resource environment ref.
94      * @return String representation of the JNDI name.
95      */

96     public String JavaDoc getJndiName() {
97         return jndiName;
98     }
99
100     /**
101      * String representation of the object for test purpose.
102      * @return String representation of this object.
103      */

104     public String JavaDoc toString() {
105         StringBuffer JavaDoc ret = new StringBuffer JavaDoc();
106         ret.append("\ngetName()=" + getName());
107         ret.append("\ngetType()=" + getType());
108         ret.append("\ngetJndiName()=" + getJndiName());
109         return ret.toString();
110     }
111
112 }
113
Popular Tags