KickJava   Java API By Example, From Geeks To Geeks.

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


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-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: 45249 $</tt>
32  */

33 public class ResourceRef extends Ref
34 {
35    private static final Logger log = Logger.getLogger(ResourceRef.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    private String JavaDoc resUrl;
52    
53    public String JavaDoc getResUrl()
54    {
55       return resUrl;
56    }
57
58    public void setResUrl(String JavaDoc resUrl)
59    {
60       this.resUrl = resUrl;
61    }
62    
63    public String JavaDoc getResourceName()
64    {
65       return resourceName;
66    }
67
68    public void setResourceName(String JavaDoc resourceName)
69    {
70       this.resourceName = resourceName;
71    }
72    
73    public String JavaDoc getJndiName()
74    {
75       return jndiName;
76    }
77
78    public void setJndiName(String JavaDoc jndiName)
79    {
80       this.jndiName = jndiName;
81    }
82
83    public String JavaDoc getMappedName()
84    {
85       return mappedName;
86    }
87
88    public void setMappedName(String JavaDoc mappedName)
89    {
90       this.mappedName = mappedName;
91    }
92
93    public String JavaDoc getResRefName()
94    {
95       return resRefName;
96    }
97
98    public void setResRefName(String JavaDoc resRefName)
99    {
100       this.resRefName = resRefName;
101    }
102
103    public String JavaDoc getResType()
104    {
105       return resType;
106    }
107
108    public void setResType(String JavaDoc resType)
109    {
110       this.resType = resType;
111    }
112
113    public String JavaDoc getResAuth()
114    {
115       return resAuth;
116    }
117
118    public void setResAuth(String JavaDoc resAuth)
119    {
120       this.resAuth = resAuth;
121    }
122
123    public String JavaDoc getAuthorizationType()
124    {
125       return resAuth;
126  /* if (resAuth == null || resAuth.equals("Container"))
127          return AuthenticationType.CONTAINER;
128       else
129          return AuthenticationType.APPLICATION;*/

130    }
131
132    public String JavaDoc getResSharingScope()
133    {
134       return resSharingScope;
135    }
136
137    public void setResSharingScope(String JavaDoc resSharingScope)
138    {
139       this.resSharingScope = resSharingScope;
140    }
141
142    public boolean isShareable()
143    {
144       if (resSharingScope == null || resSharingScope.equals("Shareable"))
145          return true;
146       else
147          return false;
148    }
149    
150    public void merge(ResourceRef ref)
151    {
152       if (ref.getJndiName() != null)
153       {
154          this.setJndiName(ref.getJndiName());
155          
156          String JavaDoc mappedName = ref.getJndiName();
157          if (mappedName.startsWith("java:"))
158             this.setMappedName(ref.getJndiName());
159          else
160             this.setMappedName("java:" + ref.getJndiName());
161       }
162       
163       if (ref.getResourceName() != null)
164       {
165          this.setResourceName(ref.getResourceName());
166          
167          String JavaDoc mappedName = ref.getResourceName();
168          if (mappedName.startsWith("java:"))
169             this.setMappedName(ref.getResourceName());
170          else
171             this.setMappedName("java:" + ref.getResourceName());
172       }
173    }
174
175    public String JavaDoc toString()
176    {
177       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(100);
178       sb.append("[" + this.getClass().getName() + ": ");
179       sb.append("resRefName=").append(resRefName);
180       sb.append(", jndiName=").append(jndiName);
181       sb.append(", resourceName=").append(resourceName);
182       sb.append(", resType=").append(resType);
183       sb.append(", mappedName=").append(mappedName);
184       sb.append(", injectionTarget=").append(injectionTarget);
185       sb.append("]");
186       return sb.toString();
187    }
188 }
189
Popular Tags