Source Code Cross Referenced for HandlerDesc.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_lib » deployment » api » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_lib.deployment.api 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * Initial Developer : Delplanque Xavier & Sauthier Guillaume
022:         * --------------------------------------------------------------------------
023:         * $Id: HandlerDesc.java 6906 2005-06-09 09:55:23Z sauthieg $
024:         * --------------------------------------------------------------------------
025:         */package org.objectweb.jonas_lib.deployment.api;
026:
027:        import java.util.List;
028:        import java.util.Map;
029:        import java.util.Properties;
030:        import java.util.Vector;
031:
032:        import javax.xml.namespace.QName;
033:
034:        import org.objectweb.jonas_lib.deployment.xml.Handler;
035:        import org.objectweb.jonas_lib.deployment.xml.InitParam;
036:
037:        /**
038:         * The Handler class describe both
039:         * - a Handler reference to use on the client side of a Web Service,
040:         * - and a Handler description.
041:         * The difference is that the port-names attribute is present for a handler reference,
042:         * and the port-names attribute does not exist for a handler description.
043:         *
044:         * @author Guillaume Sauthier
045:         * @author Xavier Delplanque
046:         * @author Helene Joanin
047:         */
048:        public class HandlerDesc {
049:
050:            /** The name of the handler (must be unique) */
051:            private String name;
052:
053:            /** The classname of the Handler */
054:            private String className;
055:
056:            /** The handler class */
057:            private Class clazz;
058:
059:            /** Params needed to initialize the handler */
060:            private Properties params = new Properties();
061:
062:            /** The list of SOAP Headers the handler will access */
063:            private List headers = new Vector();
064:
065:            /** The list of SOAP actor the handler will play as a role */
066:            private List roles = new Vector();
067:
068:            /** List of port names the handler is associated with */
069:            private List portNames = new Vector();
070:
071:            /**
072:             * Creates a new HandlerRef object.
073:             *
074:             * @param classLoader ejbjar classLoader
075:             * @param handler contains informations defined in web deployment
076:             *        descriptor (service-ref)
077:             *
078:             * @throws DeploymentDescException When Construction fails.
079:             */
080:            public HandlerDesc(ClassLoader classLoader, Handler handler)
081:                    throws DeploymentDescException {
082:
083:                name = handler.getHandlerName();
084:
085:                className = handler.getHandlerClass();
086:
087:                try {
088:                    clazz = classLoader.loadClass(className);
089:                } catch (ClassNotFoundException e) {
090:                    throw new DeploymentDescException(
091:                            "handler class not found", e);
092:                }
093:
094:                // fill init params table
095:                List iparams = handler.getInitParamList();
096:                try {
097:                    for (int i = 0; i < iparams.size(); i++) {
098:                        // add in params table each init parameter name and associated value
099:                        InitParam p = (InitParam) iparams.get(i);
100:
101:                        if (p != null) {
102:                            params.put(p.getParamName(), p.getParamValue());
103:                        }
104:                    }
105:                } catch (NullPointerException e) {
106:                    throw new DeploymentDescException("parameter name missing",
107:                            e);
108:                }
109:
110:                // fill headers a list containing soap header QNames
111:                List shl = handler.getSoapHeaderList();
112:                for (int i = 0; i < shl.size(); i++) {
113:                    // build qnames and add it in the table
114:                    org.objectweb.jonas_lib.deployment.xml.Qname sh = (org.objectweb.jonas_lib.deployment.xml.Qname) shl
115:                            .get(i);
116:
117:                    if (sh != null) {
118:                        QName qn = sh.getQName();
119:                        headers.add(qn);
120:                    }
121:                }
122:
123:                // fill roles a list containing soap role names
124:                List srl = handler.getSoapRoleList();
125:                for (int i = 0; i < srl.size(); i++) {
126:                    String role = (String) srl.get(i);
127:                    if (role != null) {
128:                        roles.add(role);
129:                    }
130:                }
131:
132:                // fill portNames a list containing ports names
133:                List pnl = handler.getPortNameList();
134:                for (int i = 0; i < pnl.size(); i++) {
135:                    String pn = (String) pnl.get(i);
136:                    if (pn != null) {
137:                        portNames.add(pn);
138:                    }
139:                }
140:            }
141:
142:            /**
143:             * Return the name of the Handler.
144:             *
145:             * @return the name of the Handler.
146:             */
147:            public String getName() {
148:                return name;
149:            }
150:
151:            /**
152:             * Return the name of class of the Handler.
153:             *
154:             * @return the name of class of the Handler.
155:             */
156:            public String getHandlerClassName() {
157:                return className;
158:            }
159:
160:            /**
161:             * Return the Handler implementation class.
162:             *
163:             * @return the Handler class
164:             */
165:            public Class getHandlerClass() {
166:                return clazz;
167:            }
168:
169:            /**
170:             * Return all the init-params of the Handler.
171:             *
172:             * @return the init-params of the Handler
173:             */
174:            public Properties getInitParams() {
175:                return params;
176:            }
177:
178:            /**
179:             * Return the value of an init-param.
180:             *
181:             * @param pname The key of init-param map.
182:             *
183:             * @return the value of an init-param
184:             */
185:            public String getInitParam(String pname) {
186:                return params.getProperty(pname);
187:            }
188:
189:            /**
190:             * Return the list of Headers the Handlers will access.
191:             *
192:             * @return the list of Headers the Handlers will access.
193:             */
194:            public List getSOAPHeaders() {
195:                return headers;
196:            }
197:
198:            /**
199:             * Return the list of SOAP Actor Definitions the Handler will play as a
200:             * role.
201:             *
202:             * @return the list of Role the Handler will play
203:             */
204:            public List getSOAPRoles() {
205:                return roles;
206:            }
207:
208:            /**
209:             * Return the list of port name the Handler is associated with. The names
210:             * match the localPart of the Port QName.
211:             *
212:             * @return the list of port name the Handler is associated with.
213:             */
214:            public List getPortNames() {
215:                return portNames;
216:            }
217:
218:            /**
219:             * Test Equality between 2 Objects.
220:             *
221:             * @param other The object to compare.
222:             *
223:             * @return true if the objects are equals in value, else false.
224:             */
225:            public boolean equals(Object other) {
226:                if (other == null) {
227:                    return false;
228:                }
229:                if (!(other instanceof  HandlerDesc)) {
230:                    return false;
231:                }
232:                HandlerDesc ref = (HandlerDesc) other;
233:                if (!name.equals(ref.getName())) {
234:                    return false;
235:                }
236:                if (!clazz.getName().equals(ref.getHandlerClass().getName())) {
237:                    return false;
238:                }
239:                if (!params.equals(ref.getInitParams())) {
240:                    return false;
241:                }
242:                if (!headers.equals(ref.getSOAPHeaders())) {
243:                    return false;
244:                }
245:                if (!roles.equals(ref.getSOAPRoles())) {
246:                    return false;
247:                }
248:                if (!portNames.equals(ref.getPortNames())) {
249:                    return false;
250:                }
251:                // After all theses tests, the 2 objects are equals in value
252:                return true;
253:            }
254:
255:            /**
256:             * @return Returns a String representation of a HandlerDesc
257:             */
258:            public String toString() {
259:                StringBuffer sb = new StringBuffer();
260:                sb.append("\n" + getClass().getName());
261:                sb.append("\ngetName()=" + getName());
262:                sb.append("\ngetClassname()=" + getHandlerClassName());
263:                sb.append("\ngetSOAPRoles()=" + getSOAPRoles());
264:                sb.append("\ngetSOAPHeaders()=" + getSOAPHeaders());
265:                sb.append("\ngetInitParams()=" + getInitParams());
266:                sb.append("\ngetPortNames()=" + getPortNames());
267:                return sb.toString();
268:            }
269:
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.