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 1any 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: Christophe Ney
022: * --------------------------------------------------------------------------
023: * $Id: ResourceEnvRefDesc.java 4729 2004-05-11 08:07:50Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_lib.deployment.api;
026:
027: import org.objectweb.jonas_lib.deployment.xml.ResourceEnvRef;
028: import org.objectweb.jonas_lib.deployment.xml.JonasResourceEnv;
029:
030: /**
031: * This class represents the description of a ResourceEnvRef object
032: * @author Christophe Ney
033: * @author Florent Benoit
034: */
035: public class ResourceEnvRefDesc {
036:
037: /**
038: * The resource env ref name.
039: */
040: private String name;
041:
042: /**
043: * The resource env ref type.
044: */
045: private Class type;
046:
047: /**
048: * The resource env ref jndi name.
049: */
050: private String jndiName;
051:
052: /**
053: * Construct a descriptor for the resource-env-ref and jonas-resource-env
054: * tags.
055: * @param classLoader the classloader for the classes.
056: * @param res the resource-env-ref resulting of the web.xml parsing.
057: * @param jRes the jonas-resource-env resulting of the jonas-web.xml
058: * parsing.
059: * @throws DeploymentDescException when missing information for
060: * creating the ResourceEnvRefDesc.
061: */
062: public ResourceEnvRefDesc(ClassLoader classLoader,
063: ResourceEnvRef res, JonasResourceEnv jRes)
064: throws DeploymentDescException {
065:
066: name = res.getResourceEnvRefName();
067: try {
068: type = classLoader.loadClass(res.getResourceEnvRefType());
069: } catch (ClassNotFoundException e) {
070: throw new DeploymentDescException(
071: "resource-env-ref-type class not found for resource-env-ref "
072: + name, e);
073: }
074: jndiName = jRes.getJndiName();
075: }
076:
077: /**
078: * Get resource environment ref. name.
079: * @return Name of the resource environment ref.
080: */
081: public String getName() {
082: return name;
083: }
084:
085: /**
086: * Get resource environment ref. type.
087: * @return Class of the resource environment ref.
088: */
089: public Class getType() {
090: return type;
091: }
092:
093: /**
094: * Get the jndi name of the resource environment ref.
095: * @return String representation of the JNDI name.
096: */
097: public String getJndiName() {
098: return jndiName;
099: }
100:
101: /**
102: * String representation of the object for test purpose.
103: * @return String representation of this object.
104: */
105: public String toString() {
106: StringBuffer ret = new StringBuffer();
107: ret.append("\ngetName()=" + getName());
108: ret.append("\ngetType()=" + getType());
109: ret.append("\ngetJndiName()=" + getJndiName());
110: return ret.toString();
111: }
112:
113: }
|