001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.metamodel.descriptor;
023:
024: import org.jboss.logging.Logger;
025:
026: /**
027: * Represents a <resource-ref> element of the ejb-jar.xml deployment descriptor for the
028: * 1.4 schema
029: *
030: * @author <a href="mailto:bdecoste@jboss.com">William DeCoste</a>
031: * @version <tt>$Revision: 60259 $</tt>
032: */
033: public class ResourceRef extends Ref {
034: private static final Logger log = Logger
035: .getLogger(ResourceRef.class);
036:
037: private String resRefName;
038:
039: private String resType;
040:
041: private String resAuth;
042:
043: private String resSharingScope;
044:
045: private String mappedName;
046:
047: private String jndiName;
048:
049: private String resourceName;
050:
051: private String resUrl;
052:
053: public String getResUrl() {
054: return resUrl;
055: }
056:
057: public void setResUrl(String resUrl) {
058: this .resUrl = resUrl;
059: }
060:
061: public String getResourceName() {
062: return resourceName;
063: }
064:
065: public void setResourceName(String resourceName) {
066: this .resourceName = resourceName;
067: }
068:
069: public String getJndiName() {
070: return jndiName;
071: }
072:
073: public void setJndiName(String jndiName) {
074: this .jndiName = jndiName;
075: }
076:
077: public String getMappedName() {
078: return mappedName;
079: }
080:
081: public void setMappedName(String mappedName) {
082: this .mappedName = mappedName;
083: }
084:
085: public String getResRefName() {
086: return resRefName;
087: }
088:
089: public void setResRefName(String resRefName) {
090: this .resRefName = resRefName;
091: }
092:
093: public String getResType() {
094: return resType;
095: }
096:
097: public void setResType(String resType) {
098: this .resType = resType;
099: }
100:
101: public String getResAuth() {
102: return resAuth;
103: }
104:
105: public void setResAuth(String resAuth) {
106: this .resAuth = resAuth;
107: }
108:
109: public String getAuthorizationType() {
110: return resAuth;
111: /* if (resAuth == null || resAuth.equals("Container"))
112: return AuthenticationType.CONTAINER;
113: else
114: return AuthenticationType.APPLICATION;*/
115: }
116:
117: public String getResSharingScope() {
118: return resSharingScope;
119: }
120:
121: public void setResSharingScope(String resSharingScope) {
122: this .resSharingScope = resSharingScope;
123: }
124:
125: public boolean isShareable() {
126: if (resSharingScope == null
127: || resSharingScope.equals("Shareable"))
128: return true;
129: else
130: return false;
131: }
132:
133: public void merge(ResourceRef ref) {
134: if (ref.getJndiName() != null) {
135: this .setJndiName(ref.getJndiName());
136:
137: String mappedName = ref.getJndiName();
138: if (mappedName.startsWith("java:"))
139: this .setMappedName(ref.getJndiName());
140: else
141: this .setMappedName("java:" + ref.getJndiName());
142: }
143:
144: if (ref.getResourceName() != null) {
145: this .setResourceName(ref.getResourceName());
146:
147: String mappedName = ref.getResourceName();
148: if (mappedName.startsWith("java:"))
149: this .setMappedName(ref.getResourceName());
150: else
151: this .setMappedName("java:" + ref.getResourceName());
152: }
153: }
154:
155: public String toString() {
156: StringBuffer sb = new StringBuffer(100);
157: sb.append("[" + this .getClass().getName() + ": ");
158: sb.append("resRefName=").append(resRefName);
159: sb.append(", jndiName=").append(jndiName);
160: sb.append(", resourceName=").append(resourceName);
161: sb.append(", resType=").append(resType);
162: sb.append(", mappedName=").append(mappedName);
163: sb.append(", injectionTarget=").append(injectionTarget);
164: sb.append("]");
165: return sb.toString();
166: }
167: }
|