KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > dd > ResourceRef


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.ejb3.dd;
8
9 import javax.annotation.AuthenticationType;
10 import javax.annotation.AuthenticationType;
11
12 /**
13  * Represents a <resource-ref> element of the ejb-jar.xml deployment descriptor for the
14  * 1.4 schema
15  *
16  * @version <tt>$Revision: 1.7.2.2 $</tt>
17  * @author <a HREF="mailto:bdecoste@jboss.com">William DeCoste</a>
18  */

19 public class ResourceRef
20 {
21
22    private String JavaDoc resRefName;
23
24    private String JavaDoc resType;
25
26    private String JavaDoc resAuth;
27
28    private String JavaDoc resSharingScope;
29    
30    private String JavaDoc injectionTarget;
31    
32    private String JavaDoc jndiName;
33    
34    private String JavaDoc resourceName;
35    
36    public String JavaDoc getJndiName()
37    {
38       return jndiName;
39    }
40
41    public void setJndiName(String JavaDoc jndiName)
42    {
43       this.jndiName = jndiName;
44    }
45    
46    public String JavaDoc getResourceName()
47    {
48       return resourceName;
49    }
50
51    public void setResourceName(String JavaDoc resourceName)
52    {
53       this.resourceName = resourceName;
54    }
55    
56    public String JavaDoc getInjectionTarget()
57    {
58       return injectionTarget;
59    }
60
61    public void setInjectionTarget(String JavaDoc injectionTarget)
62    {
63       this.injectionTarget = injectionTarget;
64    }
65
66    public String JavaDoc getResRefName()
67    {
68       return resRefName;
69    }
70
71    public void setResRefName(String JavaDoc resRefName)
72    {
73       this.resRefName = resRefName;
74    }
75
76    public String JavaDoc getResType()
77    {
78       return resType;
79    }
80
81    public void setResType(String JavaDoc resType)
82    {
83       this.resType = resType;
84    }
85
86    public String JavaDoc getResAuth()
87    {
88       return resAuth;
89    }
90
91    public void setResAuth(String JavaDoc resAuth)
92    {
93       this.resAuth = resAuth;
94    }
95    
96    public AuthenticationType getAuthorizationType()
97    {
98       if (resAuth == null || resAuth.equals("Container"))
99          return AuthenticationType.CONTAINER;
100       else
101          return AuthenticationType.APPLICATION;
102    }
103
104    public String JavaDoc getResSharingScope()
105    {
106       return resSharingScope;
107    }
108
109    public void setResSharingScope(String JavaDoc resSharingScope)
110    {
111       this.resSharingScope = resSharingScope;
112    }
113    
114    public boolean isShareable()
115    {
116       if (resSharingScope == null || resSharingScope.equals("Shareable"))
117          return true;
118       else
119          return false;
120    }
121
122    public String JavaDoc toString()
123    {
124       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(100);
125       sb.append("[");
126       sb.append("resRefName=").append(resRefName);
127       sb.append("]");
128       return sb.toString();
129    }
130
131    public boolean equals(Object JavaDoc o)
132    {
133       if (this == o)
134          return true;
135       if (!(o instanceof ResourceRef))
136          return false;
137
138       final ResourceRef ref = (ResourceRef) o;
139
140       if (resRefName != null ? !resRefName.equals(ref.resRefName)
141             : ref.resRefName != null)
142          return false;
143
144       return true;
145    }
146
147    public int hashCode()
148    {
149       int result;
150       result = (resRefName != null ? resRefName.hashCode() : 0);
151       // result = 29 * result + (version != null ? version.hashCode() : 0);
152
return result;
153    }
154 }
155
Popular Tags