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


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 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(s): Florent BENOIT & Ludovic BERT
022:         * --------------------------------------------------------------------------
023:         * $Id: EarDeploymentDesc.java 5124 2004-07-13 15:20:41Z benoitf $
024:         * --------------------------------------------------------------------------
025:         */package org.objectweb.jonas_ear.deployment.api;
026:
027:        import java.util.ArrayList;
028:        import java.util.Enumeration;
029:        import java.util.HashMap;
030:        import java.util.Iterator;
031:        import java.util.List;
032:        import java.util.Map;
033:        import java.util.Vector;
034:
035:        import org.objectweb.jonas_ear.deployment.xml.Application;
036:        import org.objectweb.jonas_ear.deployment.xml.JonasApplication;
037:        import org.objectweb.jonas_ear.deployment.xml.JonasSecurity;
038:        import org.objectweb.jonas_ear.deployment.xml.Module;
039:        import org.objectweb.jonas_ear.deployment.xml.SecurityRole;
040:        import org.objectweb.jonas_ear.deployment.xml.SecurityRoleMapping;
041:        import org.objectweb.jonas_ear.deployment.xml.Web;
042:
043:        import org.objectweb.jonas_lib.deployment.api.AbsDeploymentDesc;
044:
045:        /**
046:         * This class extends the AbsDeploymentDescriptor class of JOnAS It provides a
047:         * description of the specific EAR desployment descriptor
048:         * @author Florent Benoit
049:         * @author Ludovic Bert
050:         * @author Helene Joanin
051:         */
052:
053:        public class EarDeploymentDesc extends AbsDeploymentDesc {
054:
055:            /**
056:             * Vector of connectorTags (Connector objects).
057:             */
058:            private Vector connectorTags = null;
059:
060:            /**
061:             * Vector of altDD for connectors
062:             */
063:            private Vector altDDConnectors = null;
064:
065:            /**
066:             * Vector of ejbTags (Ejb objects).
067:             */
068:            private Vector ejbTags = null;
069:
070:            /**
071:             * Vector of altDD for EJBs
072:             */
073:            private Vector altDDEjbs = null;
074:
075:            /**
076:             * Vector of webTags (Web objects).
077:             */
078:            private Vector webTags = null;
079:
080:            /**
081:             * Vector of clientTags (Java objects).
082:             */
083:            private Vector clientTags = null;
084:
085:            /**
086:             * Vector of altDD for wars
087:             */
088:            private Vector altDDWebs = null;
089:
090:            /**
091:             * Vector of altDD for clients
092:             */
093:            private Vector altDDClients = null;
094:
095:            /**
096:             * Vector of security roles
097:             */
098:            private Vector securityRolesNames = null;
099:
100:            /**
101:             * Xml content of application.xml file
102:             */
103:            private String xmlContent = null;
104:
105:            /**
106:             * Xml content of jonas-application.xml file
107:             */
108:            private String jonasXmlContent = null;
109:
110:            /**
111:             * User to role mapping
112:             */
113:            private Map userToRoleMapping = null;
114:
115:            /**
116:             * Construct an instance of a EarDeploymentDesc. Called by the getInstance()
117:             * method.
118:             * @param classLoaderForCls ClassLoader of the classes .
119:             * @param application application.xml parsed file.
120:             * @param jonasApplication jonas-application.xml parsed file.
121:             * @throws EarDeploymentDescException if we can't build an instance.
122:             */
123:            public EarDeploymentDesc(ClassLoader classLoaderForCls,
124:                    Application application, JonasApplication jonasApplication)
125:                    throws EarDeploymentDescException {
126:
127:                // test classloader
128:                if (classLoaderForCls == null) {
129:                    throw new EarDeploymentDescException(
130:                            "DeploymentDesc: Classloader is null");
131:                }
132:
133:                ejbTags = new Vector();
134:                connectorTags = new Vector();
135:                webTags = new Vector();
136:                clientTags = new Vector();
137:                altDDEjbs = new Vector();
138:                altDDClients = new Vector();
139:                altDDConnectors = new Vector();
140:                altDDWebs = new Vector();
141:                securityRolesNames = new Vector();
142:
143:                // display name
144:                displayName = application.getDisplayName();
145:
146:                // Tags
147:                for (Iterator i = application.getModuleList().iterator(); i
148:                        .hasNext();) {
149:                    Module module = (Module) i.next();
150:                    String ejb = module.getEjb();
151:                    String connector = module.getConnector();
152:                    String java = module.getJava();
153:                    Web web = module.getWeb();
154:                    String altDD = module.getAltDd();
155:                    if (ejb != null) {
156:                        ejbTags.add(ejb);
157:                        altDDEjbs.add(altDD);
158:                    } else if (connector != null) {
159:                        connectorTags.add(connector);
160:                        altDDConnectors.add(altDD);
161:                    } else if (java != null) {
162:                        clientTags.add(java);
163:                        altDDClients.add(altDD);
164:                    } else if (web != null) {
165:                        webTags.add(web);
166:                        altDDWebs.add(altDD);
167:                    }
168:                }
169:
170:                // application security role
171:                for (Iterator i = application.getSecurityRoleList().iterator(); i
172:                        .hasNext();) {
173:                    SecurityRole securityRole = (SecurityRole) i.next();
174:                    if (securityRole != null) {
175:                        if (securityRole.getRoleName() != null) {
176:                            securityRolesNames.add(securityRole.getRoleName());
177:                        }
178:                    }
179:                }
180:
181:                // user to role mapping
182:                JonasSecurity jonasSecurity = jonasApplication
183:                        .getJonasSecurity();
184:                if (jonasSecurity != null) {
185:                    userToRoleMapping = new HashMap();
186:                    for (Iterator it = jonasSecurity
187:                            .getSecurityRoleMappingList().iterator(); it
188:                            .hasNext();) {
189:                        SecurityRoleMapping securityRoleMapping = (SecurityRoleMapping) it
190:                                .next();
191:                        if (securityRoleMapping != null) {
192:                            // get role name
193:                            String roleName = securityRoleMapping.getRoleName();
194:                            // get principals
195:                            List principals = securityRoleMapping
196:                                    .getPrincipalNamesList();
197:
198:                            // Iterator on principals
199:                            for (Iterator itPrincipals = principals.iterator(); itPrincipals
200:                                    .hasNext();) {
201:                                // get principal name
202:                                String principalName = (String) itPrincipals
203:                                        .next();
204:                                // Existing mapping ?
205:                                List currentMapping = (List) userToRoleMapping
206:                                        .get(principalName);
207:                                if (currentMapping == null) {
208:                                    currentMapping = new ArrayList();
209:                                    userToRoleMapping.put(principalName,
210:                                            currentMapping);
211:                                }
212:                                // add mapping
213:                                currentMapping.add(roleName);
214:                            }
215:                        }
216:                    }
217:                }
218:
219:            }
220:
221:            /**
222:             * Get the ejb tags of the application.xml file.
223:             * @return the ejb tags of the application.xml file.
224:             */
225:            public String[] getEjbTags() {
226:                String[] tmp = new String[ejbTags.size()];
227:                ejbTags.copyInto(tmp);
228:                return tmp;
229:            }
230:
231:            /**
232:             * Get the alt-dd of the ejbs of the application.xml file.
233:             * @return the alt-dd of the ejbs of the application.xml file.
234:             */
235:            public String[] getAltDDEjbs() {
236:                String[] tmp = new String[altDDEjbs.size()];
237:                altDDEjbs.copyInto(tmp);
238:                return tmp;
239:            }
240:
241:            /**
242:             * Get the client tags of the application.xml file.
243:             * @return the client tags of the application.xml file.
244:             */
245:            public String[] getClientTags() {
246:                String[] tmp = new String[clientTags.size()];
247:                clientTags.copyInto(tmp);
248:                return tmp;
249:            }
250:
251:            /**
252:             * Get the alt-dd of the clients of the application.xml file.
253:             * @return the alt-dd of the clients of the application.xml file.
254:             */
255:            public String[] getAltDDClients() {
256:                String[] tmp = new String[altDDClients.size()];
257:                altDDClients.copyInto(tmp);
258:                return tmp;
259:            }
260:
261:            /**
262:             * Get the web tags of the application.xml file.
263:             * @return the web tags of the application.xml file.
264:             */
265:            public Web[] getWebTags() {
266:                Web[] tmp = new Web[webTags.size()];
267:                webTags.copyInto(tmp);
268:                return tmp;
269:            }
270:
271:            /**
272:             * Get the alt-dd of the wars of the application.xml file.
273:             * @return the alt-dd of the wars of the application.xml file.
274:             */
275:            public String[] getAltDDWebs() {
276:                String[] tmp = new String[altDDWebs.size()];
277:                altDDWebs.copyInto(tmp);
278:                return tmp;
279:            }
280:
281:            /**
282:             * Get the connector tags of the application.xml file.
283:             * @return the connector tags of the application.xml file.
284:             */
285:            public String[] getConnectorTags() {
286:                String[] tmp = new String[connectorTags.size()];
287:                connectorTags.copyInto(tmp);
288:                return tmp;
289:            }
290:
291:            /**
292:             * Get the alt-dd of the connectors of the application.xml file.
293:             * @return the alt-dd of the connectors of the application.xml file.
294:             */
295:            public String[] getAltDDConnectors() {
296:                String[] tmp = new String[altDDConnectors.size()];
297:                altDDConnectors.copyInto(tmp);
298:                return tmp;
299:            }
300:
301:            /**
302:             * Get the security-role names tags
303:             * @return the security roles names.
304:             */
305:            public String[] getSecurityRolesNames() {
306:                String[] tmp = new String[securityRolesNames.size()];
307:                securityRolesNames.copyInto(tmp);
308:                return tmp;
309:            }
310:
311:            /**
312:             * Get the content of the xml file
313:             * @return the content of the application xml file
314:             */
315:            public String getXmlContent() {
316:                return xmlContent;
317:            }
318:
319:            /**
320:             * Get the content of the jonas-application xml file
321:             * @return the content of the jonas-application xml file
322:             */
323:            public String getJonasXmlContent() {
324:                return jonasXmlContent;
325:            }
326:
327:            /**
328:             * Set the content of the xml file
329:             * @param xml the content of the application xml file
330:             */
331:            public void setXmlContent(String xml) {
332:                xmlContent = xml;
333:            }
334:
335:            /**
336:             * Set the content of the xml file
337:             * @param xml the content of the jonas-application xml file
338:             */
339:            public void setJonasXmlContent(String xml) {
340:                jonasXmlContent = xml;
341:            }
342:
343:            /**
344:             * Return a String representation of the EarDeploymentDesc.
345:             * @return a String representation of the EarDeploymentDesc.
346:             */
347:            public String toString() {
348:
349:                StringBuffer ret = new StringBuffer();
350:                ret.append("\ndisplay-name=" + displayName);
351:                ret.append("\nconnectors=");
352:                for (Enumeration e = connectorTags.elements(); e
353:                        .hasMoreElements();) {
354:                    ret.append(e.nextElement() + ",");
355:                }
356:                ret.append("\nejbs=");
357:                for (Enumeration e = ejbTags.elements(); e.hasMoreElements();) {
358:                    ret.append(e.nextElement() + ",");
359:                }
360:                ret.append("\nwebs=");
361:                for (Enumeration e = webTags.elements(); e.hasMoreElements();) {
362:                    ret.append(((Web) e.nextElement()).getWebUri() + ",");
363:                }
364:                ret.append("\njavas=");
365:                for (Enumeration e = clientTags.elements(); e.hasMoreElements();) {
366:                    ret.append(e.nextElement() + ",");
367:                }
368:                ret.append("\nsecurity-roles-names=");
369:                for (Enumeration e = securityRolesNames.elements(); e
370:                        .hasMoreElements();) {
371:                    ret.append(e.nextElement() + ",");
372:                }
373:
374:                return ret.toString();
375:            }
376:
377:            /**
378:             * @return the userToRoleMapping.
379:             */
380:            public Map getUserToRoleMapping() {
381:                return userToRoleMapping;
382:            }
383:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.