KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > metamodel > descriptor > ResourceEnvRef


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.metamodel.descriptor;
23
24 import org.jboss.logging.Logger;
25
26 /**
27  * Represents a <resource-env-ref> element of the ejb-jar.xml deployment descriptor for the
28  * 1.4 schema
29  *
30  * @author <a HREF="mailto:bdecoste@jboss.com">William DeCoste</a>
31  * @version <tt>$Revision: 45240 $</tt>
32  */

33 public class ResourceEnvRef extends Ref
34 {
35    private static final Logger log = Logger.getLogger(ResourceEnvRef.class);
36    
37    private String JavaDoc resRefName;
38
39    private String JavaDoc resType;
40
41    private String JavaDoc resAuth;
42
43    private String JavaDoc resSharingScope;
44
45    private String JavaDoc mappedName;
46    
47    private String JavaDoc jndiName;
48    
49    private String JavaDoc resourceName;
50    
51    public String JavaDoc getResourceName()
52    {
53       return resourceName;
54    }
55
56    public void setResourceName(String JavaDoc resourceName)
57    {
58       this.resourceName = resourceName;
59    }
60    
61    public String JavaDoc getJndiName()
62    {
63       return jndiName;
64    }
65
66    public void setJndiName(String JavaDoc jndiName)
67    {
68       this.jndiName = jndiName;
69       this.mappedName = jndiName;
70    }
71
72    public String JavaDoc getMappedName()
73    {
74       return mappedName;
75    }
76
77    public void setMappedName(String JavaDoc mappedName)
78    {
79       this.mappedName = mappedName;
80    }
81
82    public String JavaDoc getResRefName()
83    {
84       return resRefName;
85    }
86
87    public void setResRefName(String JavaDoc resRefName)
88    {
89       this.resRefName = resRefName;
90    }
91
92    public String JavaDoc getResType()
93    {
94       return resType;
95    }
96
97    public void setResType(String JavaDoc resType)
98    {
99       this.resType = resType;
100    }
101
102    public String JavaDoc getResAuth()
103    {
104       return resAuth;
105    }
106
107    public void setResAuth(String JavaDoc resAuth)
108    {
109       this.resAuth = resAuth;
110    }
111
112    public String JavaDoc getAuthorizationType()
113    {
114       return resAuth;
115    }
116
117    public String JavaDoc getResSharingScope()
118    {
119       return resSharingScope;
120    }
121
122    public void setResSharingScope(String JavaDoc resSharingScope)
123    {
124       this.resSharingScope = resSharingScope;
125    }
126
127    public boolean isShareable()
128    {
129       if (resSharingScope == null || resSharingScope.equals("Shareable"))
130          return true;
131       else
132          return false;
133    }
134    
135    public void merge(ResourceEnvRef ref)
136    {
137       if (ref.getJndiName() != null)
138       {
139          this.setJndiName(ref.getJndiName());
140          
141          setMappedName(ref.getJndiName());
142       }
143       
144       if (ref.getResourceName() != null)
145       {
146          this.setResourceName(ref.getResourceName());
147          
148          String JavaDoc mappedName = ref.getResourceName();
149          if (mappedName.startsWith("java:"))
150             this.setMappedName(ref.getResourceName());
151          else
152             this.setMappedName("java:" + ref.getResourceName());
153       }
154    }
155
156    public String JavaDoc toString()
157    {
158       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(100);
159       sb.append("[ResourceEnvRef:");
160       sb.append("resRefName=").append(resRefName);
161       sb.append(",resType=").append(resType);
162       sb.append(",jndiName=").append(jndiName);
163       sb.append(",mappedName=").append(mappedName);
164       sb.append("]");
165       return sb.toString();
166    }
167 }
168
Popular Tags