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-env-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 ResourceEnvRef extends Ref {
034: private static final Logger log = Logger
035: .getLogger(ResourceEnvRef.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: public String getResourceName() {
052: return resourceName;
053: }
054:
055: public void setResourceName(String resourceName) {
056: this .resourceName = resourceName;
057: }
058:
059: public String getJndiName() {
060: return jndiName;
061: }
062:
063: public void setJndiName(String jndiName) {
064: this .jndiName = jndiName;
065: this .mappedName = jndiName;
066: }
067:
068: public String getMappedName() {
069: return mappedName;
070: }
071:
072: public void setMappedName(String mappedName) {
073: this .mappedName = mappedName;
074: }
075:
076: public String getResRefName() {
077: return resRefName;
078: }
079:
080: public void setResRefName(String resRefName) {
081: this .resRefName = resRefName;
082: }
083:
084: public String getResType() {
085: return resType;
086: }
087:
088: public void setResType(String resType) {
089: this .resType = resType;
090: }
091:
092: public String getResAuth() {
093: return resAuth;
094: }
095:
096: public void setResAuth(String resAuth) {
097: this .resAuth = resAuth;
098: }
099:
100: public String getAuthorizationType() {
101: return resAuth;
102: }
103:
104: public String getResSharingScope() {
105: return resSharingScope;
106: }
107:
108: public void setResSharingScope(String resSharingScope) {
109: this .resSharingScope = resSharingScope;
110: }
111:
112: public boolean isShareable() {
113: if (resSharingScope == null
114: || resSharingScope.equals("Shareable"))
115: return true;
116: else
117: return false;
118: }
119:
120: public void merge(ResourceEnvRef ref) {
121: if (ref.getJndiName() != null) {
122: this .setJndiName(ref.getJndiName());
123:
124: setMappedName(ref.getJndiName());
125: }
126:
127: if (ref.getResourceName() != null) {
128: this .setResourceName(ref.getResourceName());
129:
130: String mappedName = ref.getResourceName();
131: if (mappedName.startsWith("java:"))
132: this .setMappedName(ref.getResourceName());
133: else
134: this .setMappedName("java:" + ref.getResourceName());
135: }
136: }
137:
138: public String toString() {
139: StringBuffer sb = new StringBuffer(100);
140: sb.append("[ResourceEnvRef:");
141: sb.append("resRefName=").append(resRefName);
142: sb.append(",resType=").append(resType);
143: sb.append(",jndiName=").append(jndiName);
144: sb.append(",mappedName=").append(mappedName);
145: sb.append("]");
146: return sb.toString();
147: }
148: }
|