Source Code Cross Referenced for HCSchemaRestrictions.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » xml » xs » hardcoded » 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.webapp.jonasadmin.xml.xs.hardcoded 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2005 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:         * --------------------------------------------------------------------------
022:         * $Id: HCSchemaRestrictions.java 7568 2005-10-24 03:31:04Z glapouch $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.webapp.jonasadmin.xml.xs.hardcoded;
025:
026:        import java.util.ArrayList;
027:        import java.util.HashMap;
028:        import java.util.List;
029:        import java.util.Set;
030:
031:        import org.objectweb.jonas.webapp.jonasadmin.xml.xs.ElementRestrictions;
032:        import org.objectweb.jonas.webapp.jonasadmin.xml.xs.SchemaRestrictions;
033:
034:        /**
035:         * An implementation of SchemaRestrictions where the restrictions are not
036:         * retrieved from the schema but hard coded inside the class.
037:         *
038:         * @author Gregory Lapouchnian
039:         * @author Patrick Smith
040:         */
041:        public class HCSchemaRestrictions implements  SchemaRestrictions {
042:
043:            /** The elements of this schema restriction. */
044:            private HashMap elements;
045:
046:            /**
047:             * Create a new hard coded schema restriction.
048:             * @param documentType the document type.
049:             */
050:            public HCSchemaRestrictions(int documentType) {
051:                elements = new HashMap();
052:
053:                if (documentType == RAR_TYPE) {
054:                    populateJonasConnectorXSD();
055:                    populateConnectorXSD();
056:                }
057:            }
058:
059:            /**
060:             * Populate the connector XSD restrictions.
061:             */
062:            protected void populateConnectorXSD() {
063:                populateConfigProperty();
064:                populateResourceAdapter();
065:                populateConnector();
066:                populateOutboundResourceAdapter();
067:                populateInboundResourceAdapter();
068:                populateLicense();
069:                populateConnectionDefinition();
070:                populateAuthenticationMechanism();
071:                populateMessageAdapter();
072:                populateMessageListener();
073:                populateActivationSpec();
074:                populateRequiredConfigProperty();
075:            }
076:
077:            /**
078:             * populate the jonas connector xsd restrictions.
079:             */
080:            protected void populateJonasConnectorXSD() {
081:                populateJonasConnector();
082:                populatePoolParams();
083:                populateJdbcConnParams();
084:                populateTmParams();
085:                populateTmConfigProperty();
086:                populateJonasConfigProperty();
087:                populateJonasConnectionDefinition();
088:                populateJonasActivationSpec();
089:                populateJonasAdminObject();
090:                populateJonasSecurityMapping();
091:                populateSecurityEntry();
092:            }
093:
094:            /**
095:             * Populate the jonas connector restrictions
096:             *
097:             */
098:            protected void populateJonasConnector() {
099:                List children = new ArrayList();
100:                children.add("jndi-name");
101:                children.add("rarlink");
102:                children.add("native-lib");
103:                children.add("log-enabled");
104:                children.add("log-topic");
105:                children.add("pool-params");
106:                children.add("jdbc-conn-params");
107:                children.add("tm-params");
108:                children.add("jonas-config-property");
109:                children.add("jonas-connection-definition");
110:                children.add("jonas-activationspec");
111:                children.add("jonas-adminobject");
112:                children.add("jonas-security-mapping");
113:                ElementRestrictions el = new HCElementRestrictions(
114:                        "jonas-connector", true, children, null);
115:                el.setSequence(true);
116:                elements.put("jonas-connector", el);
117:            }
118:
119:            /**
120:             * Populate the poolparams restrictions
121:             *
122:             */
123:            protected void populatePoolParams() {
124:                List children = new ArrayList();
125:                children.add("pool-init");
126:                children.add("pool-min");
127:                children.add("pool-max");
128:                children.add("pool-max-age");
129:                children.add("pool-max-age-minutes");
130:                children.add("pstmt-max");
131:                children.add("pool-max-opentime");
132:                children.add("pool-max-waiters");
133:                children.add("pool-max-waittime");
134:                children.add("pool-sampling-period");
135:                ElementRestrictions el = new HCElementRestrictions(
136:                        "pool-params", true, children, null);
137:                el.setSequence(true);
138:                elements.put("pool-params", el);
139:            }
140:
141:            /**
142:             * Populate the jdbc-conn-params restrictions
143:             *
144:             */
145:            protected void populateJdbcConnParams() {
146:                List children = new ArrayList();
147:                children.add("jdbc-check-level");
148:                children.add("jdbc-test-statement");
149:                ElementRestrictions el = new HCElementRestrictions(
150:                        "jdbc-conn-params", true, children, null);
151:                el.setSequence(true);
152:                elements.put("jdbc-conn-params", el);
153:            }
154:
155:            /**
156:             * Populate the tm-params restrictions
157:             *
158:             */
159:            protected void populateTmParams() {
160:                List children = new ArrayList();
161:                children.add("tm-config-property");
162:                ElementRestrictions el = new HCElementRestrictions("tm-params",
163:                        true, children, null);
164:                el.setSequence(true);
165:                elements.put("tm-params", el);
166:            }
167:
168:            /**
169:             * Populate the tm-config-property restrictions
170:             *
171:             */
172:            protected void populateTmConfigProperty() {
173:                List children = new ArrayList();
174:                children.add("tm-config-property-name");
175:                children.add("tm-config-property-value");
176:                ElementRestrictions el = new HCElementRestrictions(
177:                        "tm-config-property", true, children, null);
178:                el.setSequence(true);
179:                elements.put("tm-config-property", el);
180:            }
181:
182:            /**
183:             * Populate the jonas-config-property restrictions
184:             *
185:             */
186:            protected void populateJonasConfigProperty() {
187:                List children = new ArrayList();
188:                children.add("jonas-config-property-name");
189:                children.add("jonas-config-property-value");
190:                ElementRestrictions el = new HCElementRestrictions(
191:                        "jonas-config-property", true, children, null);
192:                el.setSequence(true);
193:                elements.put("jonas-config-property", el);
194:            }
195:
196:            /**
197:             * Populate the jonas-connection-definition restrictions
198:             *
199:             */
200:            protected void populateJonasConnectionDefinition() {
201:                List children = new ArrayList();
202:                children.addAll(populateConfigurationGroup());
203:                children.add("log-enabled");
204:                children.add("log-topic");
205:                children.add("pool-params");
206:                children.add("jdbc-conn-params");
207:                ElementRestrictions el = new HCElementRestrictions(
208:                        "jonas-connection-definition", true, children, null);
209:                el.setSequence(true);
210:                elements.put("jonas-connection-definition", el);
211:            }
212:
213:            /**
214:             * Populate the jonas-activationspec restrictions
215:             *
216:             */
217:            protected void populateJonasActivationSpec() {
218:                List children = new ArrayList();
219:                children.addAll(populateIdGroup());
220:                children.add("defaultAS");
221:                ElementRestrictions el = new HCElementRestrictions(
222:                        "jonas-activationspec", true, children, null);
223:                el.setSequence(true);
224:                elements.put("jonas-activationspec", el);
225:            }
226:
227:            /**
228:             * Populate the configurationgroup restrictions
229:             * @return the configuration group list
230:             */
231:            protected List populateConfigurationGroup() {
232:                List children = new ArrayList();
233:                children.addAll(populateIdGroup());
234:                children.add("jonas-config-property");
235:                return children;
236:            }
237:
238:            /**
239:             * Populate the idgroup restrictions
240:             * @return the idgroup list
241:             */
242:            protected List populateIdGroup() {
243:                List children = new ArrayList();
244:                children.add("id");
245:                children.add("description");
246:                children.add("jndi-name");
247:                return children;
248:            }
249:
250:            /**
251:             * Populate the jonas-adminobject restrictions
252:             *
253:             */
254:            protected void populateJonasAdminObject() {
255:                List children = new ArrayList();
256:                children.addAll(populateConfigurationGroup());
257:                ElementRestrictions el = new HCElementRestrictions(
258:                        "jonas-adminobject", true, children, null);
259:                elements.put("jonas-adminobject", el);
260:            }
261:
262:            /**
263:             * Populate the jonas-security-mapping restrictions
264:             *
265:             */
266:            protected void populateJonasSecurityMapping() {
267:                List children = new ArrayList();
268:                children.add("security-entry");
269:                ElementRestrictions el = new HCElementRestrictions(
270:                        "jonas-security-mapping", true, children, null);
271:                el.setSequence(true);
272:                elements.put("jonas-security-mapping", el);
273:            }
274:
275:            /**
276:             * Populate the security-entry restrictions
277:             *
278:             */
279:            protected void populateSecurityEntry() {
280:                List children = new ArrayList();
281:                children.add("principalName");
282:                children.add("user");
283:                children.add("password");
284:                children.add("encrypted");
285:                ElementRestrictions el = new HCElementRestrictions(
286:                        "security-entry", true, children, null);
287:                el.setSequence(true);
288:                elements.put("security-entry", el);
289:            }
290:
291:            /**
292:             * Populate the config-property restrictions
293:             *
294:             */
295:            protected void populateConfigProperty() {
296:                List configPropertyChildren = new ArrayList();
297:
298:                // restrictions for the <config-property> element
299:                configPropertyChildren.add("description");
300:                configPropertyChildren.add("config-property-name");
301:                configPropertyChildren.add("config-property-type");
302:                configPropertyChildren.add("config-property-value");
303:                ElementRestrictions el = new HCElementRestrictions(
304:                        "config-property", true, configPropertyChildren, null);
305:                el.setSequence(true);
306:                elements.put("config-property", el);
307:            }
308:
309:            /**
310:             * Populate the resource-adapter restrictions
311:             *
312:             */
313:            protected void populateResourceAdapter() {
314:                // restrictions for the <resourceadapter> element
315:                List resourceadapterChildren = new ArrayList();
316:                resourceadapterChildren.add("resourceadapter-class");
317:                resourceadapterChildren.add("config-property");
318:                resourceadapterChildren.add("outbound-resourceadapter");
319:                resourceadapterChildren.add("inbound-resourceadapter");
320:                ElementRestrictions el = new HCElementRestrictions(
321:                        "resourceadapter", true, resourceadapterChildren, null);
322:                el.setSequence(true);
323:                elements.put("resourceadapter", el);
324:            }
325:
326:            /**
327:             * Populate the connector restrictions
328:             *
329:             */
330:            protected void populateConnector() {
331:                List connectorChildren = new ArrayList();
332:
333:                // restrictions for the <connector> element.
334:                connectorChildren.addAll(populateDescriptionGroup());
335:                connectorChildren.add("vendor-name");
336:                connectorChildren.add("eis-type");
337:                connectorChildren.add("resourceadapter-version");
338:                connectorChildren.add("license");
339:                connectorChildren.add("version");
340:                ElementRestrictions conEl = new HCElementRestrictions(
341:                        "connector", true, connectorChildren, null);
342:                conEl.setSequence(true);
343:                elements.put("connector", conEl);
344:            }
345:
346:            /**
347:             * Populate the descriptionGroup restrictions
348:             * @return the descriptionGroup list
349:             */
350:            protected List populateDescriptionGroup() {
351:                List children = new ArrayList();
352:                children.add("description");
353:                children.add("display-name");
354:                children.add("icon");
355:                return children;
356:            }
357:
358:            /**
359:             * Populate the outbound-resourceadapter restrictions
360:             *
361:             */
362:            protected void populateOutboundResourceAdapter() {
363:                // restrictions for <outbound-resourceadapter> element.
364:                List outboundChildren = new ArrayList();
365:                outboundChildren.add("connection-definition");
366:                outboundChildren.add("transaction-support");
367:                outboundChildren.add("authentication-mechanism");
368:                outboundChildren.add("reauthentication-support");
369:                ElementRestrictions outEl = new HCElementRestrictions(
370:                        "outbound-resourceadapter", true, outboundChildren,
371:                        null);
372:                outEl.setSequence(true);
373:                elements.put("outbound-resourceadapter", outEl);
374:            }
375:
376:            /**
377:             * Populate the inbound-resourceadapter restrictions
378:             *
379:             */
380:            protected void populateInboundResourceAdapter() {
381:                // restrictions for <inbound-resourceadapter> element.
382:                List inboundChildren = new ArrayList();
383:                inboundChildren.add("messageadapter");
384:                ElementRestrictions inEl = new HCElementRestrictions(
385:                        "inbound-resourceadapter", true, inboundChildren, null);
386:                inEl.setSequence(true);
387:                elements.put("inbound-resourceadapter", inEl);
388:            }
389:
390:            /**
391:             * Populate the license restrictions
392:             *
393:             */
394:            protected void populateLicense() {
395:                // restrictions for <inbound-resourceadapter> element.
396:                List licenseChildren = new ArrayList();
397:                licenseChildren.add("description");
398:                licenseChildren.add("license-required");
399:                ElementRestrictions licenseEl = new HCElementRestrictions(
400:                        "license", true, licenseChildren, null);
401:                licenseEl.setSequence(true);
402:                elements.put("license", licenseEl);
403:            }
404:
405:            /**
406:             * Populate the connection-definition restrictions
407:             *
408:             */
409:            protected void populateConnectionDefinition() {
410:
411:                List children = new ArrayList();
412:                children.add("managedconnectionfactory-class");
413:                children.add("config-property");
414:                children.add("connectionfactory-interface");
415:                children.add("connectionfactory-impl-class");
416:                children.add("connection-interface");
417:                children.add("connection-impl-class");
418:                ElementRestrictions el = new HCElementRestrictions(
419:                        "connection-definition", true, children, null);
420:                el.setSequence(true);
421:                elements.put("connection-definition", el);
422:            }
423:
424:            /**
425:             * Populate the authentication-mechanism restrictions
426:             *
427:             */
428:            protected void populateAuthenticationMechanism() {
429:
430:                List children = new ArrayList();
431:                children.add("description");
432:                children.add("authentication-mechanism-type");
433:                children.add("credential-interface");
434:                ElementRestrictions el = new HCElementRestrictions(
435:                        "authentication-mechanism", true, children, null);
436:                el.setSequence(true);
437:                elements.put("authentication-mechanism", el);
438:            }
439:
440:            /**
441:             * Populate the message-adapter restrictions
442:             *
443:             */
444:            protected void populateMessageAdapter() {
445:                List children = new ArrayList();
446:                children.add("messagelistener");
447:                ElementRestrictions el = new HCElementRestrictions(
448:                        "messageadapter", true, children, null);
449:                el.setSequence(true);
450:                elements.put("messageadapter", el);
451:            }
452:
453:            /**
454:             * Populate the message-listener restrictions
455:             *
456:             */
457:            protected void populateMessageListener() {
458:                List children = new ArrayList();
459:                children.add("messagelistener-type");
460:                children.add("activationspec");
461:                ElementRestrictions el = new HCElementRestrictions(
462:                        "messagelistener", true, children, null);
463:                el.setSequence(true);
464:                elements.put("messagelistener", el);
465:            }
466:
467:            /**
468:             * Populate the activationspec restrictions
469:             *
470:             */
471:            protected void populateActivationSpec() {
472:                List children = new ArrayList();
473:                children.add("activationspec-class");
474:                children.add("required-config-property");
475:                ElementRestrictions el = new HCElementRestrictions(
476:                        "activationspec", true, children, null);
477:                el.setSequence(true);
478:                elements.put("activationspec", el);
479:            }
480:
481:            /**
482:             * Populate the required-config-property restrictions
483:             *
484:             */
485:            protected void populateRequiredConfigProperty() {
486:                List children = new ArrayList();
487:                children.add("description");
488:                children.add("config-property-name");
489:                ElementRestrictions el = new HCElementRestrictions(
490:                        "required-config-property", true, children, null);
491:                el.setSequence(true);
492:                elements.put("required-config-property", el);
493:            }
494:
495:            /**
496:             * Returns if there is an element restriction for the given name.
497:             * @param name the name of the element to check
498:             * @return true if name has a restriction.
499:             */
500:            public boolean hasElementRestrictions(String name) {
501:                return elements.containsKey(name);
502:            }
503:
504:            /**
505:             * Returns the element restrictions for the given element name.
506:             * @param name the name of the element to return the restrictions
507:             * @return the element restrictions for the element.
508:             */
509:            public ElementRestrictions getElementRestrictions(String name) {
510:                return (ElementRestrictions) elements.get(name);
511:            }
512:
513:            /**
514:             * Returns a set of all complex elements for this schema.
515:             * @return a set of all complex elements for this schema.
516:             */
517:            public Set getComplexElements() {
518:                return elements.keySet();
519:            }
520:        }
w__ww___.__j_a___va___2s.__c__o___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.