Source Code Cross Referenced for ResourceRefMetaData.java in  » EJB-Server-JBoss-4.2.1 » server » org » jboss » metadata » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » server » org.jboss.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.metadata;
023:
024:        import org.w3c.dom.Element;
025:
026:        import org.jboss.deployment.DeploymentException;
027:
028:        /** The meta data information for a resource-ref element.
029:         The resource-ref element contains a declaration of enterprise bean�s
030:         reference to an external resource. It consists of an optional description,
031:         the resource manager connection factory reference name, the
032:         indication of the resource manager connection factory type expected
033:         by the enterprise bean code, the type of authentication (Application
034:         or Container), and an optional specification of the shareability of
035:         connections obtained from the resource (Shareable or Unshareable).
036:         Used in: entity, message-driven, and session
037:
038:         *   @author <a href="mailto:sebastien.alborini@m4x.org">Sebastien Alborini</a>
039:         *   @author <a href="mailto:Scott.Stark@jboss.org">Scott Stark</a>.
040:         *   @version $Revision: 57209 $
041:         */
042:        public class ResourceRefMetaData extends MetaData {
043:            // Constants -----------------------------------------------------
044:
045:            // Attributes ----------------------------------------------------
046:            /** The ejb-jar/../resource-ref/res-ref-name element used by the bean code.
047:             The res-ref-name element specifies the name of a resource manager con-nection
048:             factory reference. The name is a JNDI name relative to the
049:             java:comp/env context. The name must be unique within an enterprise
050:             bean.
051:             */
052:            private String refName;
053:            /** The jboss/../resource-ref/resource-name value that maps to a resource-manager */
054:            private String name;
055:            /** The jndi name of the deployed resource, or the URL in the case of
056:             a java.net.URL resource type. This comes from either the:
057:             jboss/../resource-ref/jndi-name element value or the
058:             jboss/../resource-ref/res-url element value or the
059:             jboss/../resource-manager/res-jndi-name element value
060:             jboss/../resource-manager/res-url element value
061:             */
062:            private String jndiName;
063:            private String resURL;
064:            /** The ejb-jar/../resource-ref/res-type element.
065:             The res-type element specifies the Java class or interface of the data source
066:             */
067:            private String type;
068:            /** The ejb-jar/../resource-ref/res-auth value.
069:             The res-auth element specifies whether the enterprise bean code signs
070:             on programmatically to the resource manager, or whether the Container
071:             will sign on to the resource manager on behalf of the enterprise bean.
072:             In the latter case, the Container uses information that is supplied by
073:             the Deployer.
074:             The value of this element must be one of the following for EJB2.0,
075:             Servlet 2.3:
076:             <res-auth>Application</res-auth>
077:             <res-auth>Container</res-auth>
078:             or for Servlet 2.2:
079:             <res-auth>CONTAINER</res-auth>
080:             <res-auth>SERVLET</res-auth>
081:             */
082:            private boolean containerAuth;
083:            /** The ejb-jar/../resource-ref/res-sharing-scope value
084:             The res-sharing-scope element specifies whether connections obtained
085:             through the given resource manager connection factory reference can
086:             be shared. The value of this element, if specified, must be one of the
087:             two following:
088:             <res-sharing-scope>Shareable</res-sharing-scope>
089:             <res-sharing-scope>Unshareable</res-sharing-scope>
090:             The default value is Shareable.
091:             */
092:            private boolean isShareable;
093:
094:            // Static --------------------------------------------------------
095:
096:            // Constructors --------------------------------------------------
097:            public ResourceRefMetaData() {
098:            }
099:
100:            // Public --------------------------------------------------------
101:
102:            public String getRefName() {
103:                return refName;
104:            }
105:
106:            public String getResourceName() {
107:                if (name == null) {
108:                    // default is refName
109:                    name = refName;
110:                }
111:                return name;
112:            }
113:
114:            public void setResourceName(String resName) {
115:                name = resName;
116:            }
117:
118:            public String getJndiName() {
119:                return jndiName;
120:            }
121:
122:            public String getResURL() {
123:                return resURL;
124:            }
125:
126:            public String getType() {
127:                return type;
128:            }
129:
130:            public boolean isContainerAuth() {
131:                return containerAuth;
132:            }
133:
134:            public boolean isShareable() {
135:                return isShareable;
136:            }
137:
138:            public void importEjbJarXml(Element element)
139:                    throws DeploymentException {
140:                refName = getElementContent(getUniqueChild(element,
141:                        "res-ref-name"));
142:
143:                type = getElementContent(getUniqueChild(element, "res-type"));
144:
145:                String auth = getElementContent(getUniqueChild(element,
146:                        "res-auth"));
147:                if (auth.equalsIgnoreCase("Container")) {
148:                    containerAuth = true;
149:                } else if (auth.equals("Application") || auth.equals("SERVLET")) {
150:                    containerAuth = false;
151:                } else {
152:                    throw new DeploymentException(
153:                            "res-auth tag should be 'Container' or "
154:                                    + "'Application' or 'SERVLET'");
155:                }
156:                // The res-sharing-scope element
157:                String sharing = getElementContent(getOptionalChild(element,
158:                        "res-sharing-scope"), "Shareable");
159:                isShareable = sharing.equals("Shareable");
160:            }
161:
162:            public void importJbossXml(Element element)
163:                    throws DeploymentException {
164:                // Look for the resource-ref/resource-name element
165:                Element child = getOptionalChild(element, "resource-name");
166:                if (child == null) {
167:                    if (type.equals("java.net.URL")) {
168:                        // First look for an explict res-url
169:                        Element resUrl = getOptionalChild(element, "res-url");
170:                        if (resUrl != null) {
171:                            resURL = getElementContent(resUrl);
172:                        } else {
173:                            Element name = getUniqueChild(element, "jndi-name");
174:                            jndiName = getElementContent(name);
175:                        }
176:                    }
177:                    // There must be a resource-ref/jndi-name value otherwise
178:                    else
179:                        jndiName = getElementContent(getUniqueChild(element,
180:                                "jndi-name"));
181:                } else {
182:                    name = getElementContent(child);
183:                }
184:            }
185:
186:            // Package protected ---------------------------------------------
187:
188:            // Protected -----------------------------------------------------
189:
190:            // Private -------------------------------------------------------
191:
192:            // Inner classes -------------------------------------------------
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.