Source Code Cross Referenced for DDObjectFactory.java in  » EJB-Server-JBoss-4.2.1 » ejb3 » org » jboss » metamodel » descriptor » 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 » ejb3 » org.jboss.metamodel.descriptor 
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.metamodel.descriptor;
023:
024:        import javax.persistence.PersistenceContextType;
025:
026:        import org.jboss.metadata.serviceref.ServiceRefDelegate;
027:        import org.jboss.metadata.serviceref.ServiceRefObjectFactory;
028:        import org.jboss.xb.binding.ObjectModelFactory;
029:        import org.jboss.xb.binding.UnmarshallingContext;
030:        import org.xml.sax.Attributes;
031:
032:        /**
033:         * @author <a href="mailto:bdecoste@jboss.com">William DeCoste</a>
034:         * @author Thomas.Diesler@jboss.com
035:         * @version <tt>$Revision: 62798 $</tt>
036:         */
037:        public abstract class DDObjectFactory extends ServiceRefObjectFactory
038:                implements  ObjectModelFactory {
039:            public Object newChild(PersistenceUnitRef ref,
040:                    UnmarshallingContext navigator, String namespaceURI,
041:                    String localName, Attributes attrs) {
042:                return newRefChild(ref, localName);
043:            }
044:
045:            public Object newChild(PersistenceContextRef ref,
046:                    UnmarshallingContext navigator, String namespaceURI,
047:                    String localName, Attributes attrs) {
048:                return newRefChild(ref, localName);
049:            }
050:
051:            public Object newChild(EnvEntry ref,
052:                    UnmarshallingContext navigator, String namespaceURI,
053:                    String localName, Attributes attrs) {
054:                return newRefChild(ref, localName);
055:            }
056:
057:            public Object newChild(EjbRef ref, UnmarshallingContext navigator,
058:                    String namespaceURI, String localName, Attributes attrs) {
059:                return newRefChild(ref, localName);
060:            }
061:
062:            public Object newChild(EjbLocalRef ref,
063:                    UnmarshallingContext navigator, String namespaceURI,
064:                    String localName, Attributes attrs) {
065:                return newRefChild(ref, localName);
066:            }
067:
068:            public Object newChild(ResourceRef ref,
069:                    UnmarshallingContext navigator, String namespaceURI,
070:                    String localName, Attributes attrs) {
071:                return newRefChild(ref, localName);
072:            }
073:
074:            public Object newChild(ResourceEnvRef ref,
075:                    UnmarshallingContext navigator, String namespaceURI,
076:                    String localName, Attributes attrs) {
077:                return newRefChild(ref, localName);
078:            }
079:
080:            public Object newChild(MessageDestinationRef ref,
081:                    UnmarshallingContext navigator, String namespaceURI,
082:                    String localName, Attributes attrs) {
083:                return newRefChild(ref, localName);
084:            }
085:
086:            public Object newChild(JndiRef ref, UnmarshallingContext navigator,
087:                    String namespaceURI, String localName, Attributes attrs) {
088:                return newRefChild(ref, localName);
089:            }
090:
091:            public void addChild(PersistenceUnitRef parent,
092:                    InjectionTarget target, UnmarshallingContext navigator,
093:                    String namespaceURI, String localName) {
094:                parent.setInjectionTarget(target);
095:            }
096:
097:            public void addChild(PersistenceContextRef parent,
098:                    InjectionTarget target, UnmarshallingContext navigator,
099:                    String namespaceURI, String localName) {
100:                parent.setInjectionTarget(target);
101:            }
102:
103:            public void addChild(EnvEntry parent, InjectionTarget target,
104:                    UnmarshallingContext navigator, String namespaceURI,
105:                    String localName) {
106:                parent.setInjectionTarget(target);
107:            }
108:
109:            public void addChild(EjbRef parent, InjectionTarget target,
110:                    UnmarshallingContext navigator, String namespaceURI,
111:                    String localName) {
112:                parent.setInjectionTarget(target);
113:            }
114:
115:            public void addChild(EjbLocalRef parent, InjectionTarget target,
116:                    UnmarshallingContext navigator, String namespaceURI,
117:                    String localName) {
118:                parent.setInjectionTarget(target);
119:            }
120:
121:            public void addChild(ResourceRef parent, InjectionTarget target,
122:                    UnmarshallingContext navigator, String namespaceURI,
123:                    String localName) {
124:                parent.setInjectionTarget(target);
125:            }
126:
127:            public void addChild(ResourceEnvRef parent, InjectionTarget target,
128:                    UnmarshallingContext navigator, String namespaceURI,
129:                    String localName) {
130:                parent.setInjectionTarget(target);
131:            }
132:
133:            public void addChild(MessageDestinationRef parent,
134:                    InjectionTarget target, UnmarshallingContext navigator,
135:                    String namespaceURI, String localName) {
136:                parent.setInjectionTarget(target);
137:            }
138:
139:            public void addChild(JndiRef parent, InjectionTarget target,
140:                    UnmarshallingContext navigator, String namespaceURI,
141:                    String localName) {
142:                parent.setInjectionTarget(target);
143:            }
144:
145:            public void setValue(EjbLocalRef ref,
146:                    UnmarshallingContext navigator, String namespaceURI,
147:                    String localName, String value) {
148:                if (localName.equals("ejb-ref-name")) {
149:                    ref.setEjbRefName(getValue(localName, value));
150:                } else if (localName.equals("ejb-ref-type")) {
151:                    ref.setEjbRefType(getValue(localName, value));
152:                } else if (localName.equals("local-home")) {
153:                    ref.setLocalHome(getValue(localName, value));
154:                } else if (localName.equals("local")) {
155:                    ref.setLocal(getValue(localName, value));
156:                } else if (localName.equals("ejb-link")) {
157:                    ref.setEjbLink(getValue(localName, value));
158:                } else if (localName.equals("mapped-name")
159:                        || localName.equals("local-jndi-name")
160:                        || localName.equals("jndi-name")) {
161:                    ref.setMappedName(getValue(localName, value));
162:                } else if (localName.equals("ignore-dependency")) {
163:                    ref.setIgnoreDependency(true);
164:                }
165:            }
166:
167:            public void setValue(EjbRef ref, UnmarshallingContext navigator,
168:                    String namespaceURI, String localName, String value) {
169:                if (localName.equals("ejb-ref-name")) {
170:                    ref.setEjbRefName(getValue(localName, value));
171:                } else if (localName.equals("ejb-ref-type")) {
172:                    ref.setEjbRefType(getValue(localName, value));
173:                } else if (localName.equals("home")) {
174:                    ref.setHome(getValue(localName, value));
175:                } else if (localName.equals("remote")) {
176:                    ref.setRemote(getValue(localName, value));
177:                } else if (localName.equals("ejb-link")) {
178:                    ref.setEjbLink(getValue(localName, value));
179:                } else if (localName.equals("mapped-name")
180:                        || localName.equals("jndi-name")) {
181:                    ref.setMappedName(getValue(localName, value));
182:                } else if (localName.equals("ignore-dependency")) {
183:                    ref.setIgnoreDependency(true);
184:                }
185:            }
186:
187:            /**
188:             * Called when a child element with simple content is read for DD.
189:             */
190:            public void setValue(InjectionTarget target,
191:                    UnmarshallingContext navigator, String namespaceURI,
192:                    String localName, String value) {
193:                if (localName.equals("injection-target-class")) {
194:                    target.setTargetClass(getValue(localName, value));
195:                } else if (localName.equals("injection-target-name")) {
196:                    target.setTargetName(getValue(localName, value));
197:                }
198:            }
199:
200:            /**
201:             * Called when a child element with simple content is read for DD.
202:             */
203:            public void setValue(MessageDestinationRef ref,
204:                    UnmarshallingContext navigator, String namespaceURI,
205:                    String localName, String value) {
206:                if (localName.equals("description")) {
207:                    ref.setDescription(getValue(localName, value));
208:                } else if (localName.equals("message-destination-ref-name")) {
209:                    ref
210:                            .setMessageDestinationRefName(getValue(localName,
211:                                    value));
212:                } else if (localName.equals("message-destination-type")) {
213:                    ref.setMessageDestinationType(getValue(localName, value));
214:                } else if (localName.equals("message-destination-usage")) {
215:                    ref.setMessageDestinationUsage(getValue(localName, value));
216:                } else if (localName.equals("message-destination-link")) {
217:                    ref.setMessageDestinationLink(getValue(localName, value));
218:                } else if (localName.equals("mapped-name")
219:                        || localName.equals("jndi-name")) {
220:                    ref.setMappedName(getValue(localName, value));
221:                }
222:            }
223:
224:            public void setValue(EnvEntry entry,
225:                    UnmarshallingContext navigator, String namespaceURI,
226:                    String localName, String value) {
227:                if (localName.equals("description")) {
228:                    entry.setDescription(getValue(localName, value));
229:                } else if (localName.equals("env-entry-name")) {
230:                    entry.setEnvEntryName(getValue(localName, value));
231:                } else if (localName.equals("env-entry-type")) {
232:                    entry.setEnvEntryType(getValue(localName, value));
233:                } else if (localName.equals("env-entry-value")) {
234:                    entry.setEnvEntryValue(getValue(localName, value));
235:                }
236:            }
237:
238:            public void setValue(ResourceEnvRef envRef,
239:                    UnmarshallingContext navigator, String namespaceURI,
240:                    String localName, String value) {
241:                if (localName.equals("res-ref-name")
242:                        || localName.equals("resource-env-ref-name")) {
243:                    envRef.setResRefName(getValue(localName, value));
244:                } else if (localName.equals("res-type")
245:                        || localName.equals("resource-env-ref-type")) {
246:                    envRef.setResType(getValue(localName, value));
247:                } else if (localName.equals("res-auth")) {
248:                    envRef.setResAuth(getValue(localName, value));
249:                } else if (localName.equals("res-sharing-scope")) {
250:                    envRef.setResSharingScope(getValue(localName, value));
251:                } else if (localName.equals("mapped-name")
252:                        || localName.equals("jndi-name")) {
253:                    envRef.setMappedName(getValue(localName, value));
254:                }
255:            }
256:
257:            public void setValue(ResourceRef ref,
258:                    UnmarshallingContext navigator, String namespaceURI,
259:                    String localName, String value) {
260:                if (localName.equals("res-ref-name")
261:                        || localName.equals("resource-env-ref-name")) {
262:                    ref.setResRefName(getValue(localName, value));
263:                } else if (localName.equals("res-type")
264:                        || localName.equals("resource-env-ref-type")) {
265:                    ref.setResType(getValue(localName, value));
266:                } else if (localName.equals("res-auth")) {
267:                    ref.setResAuth(getValue(localName, value));
268:                } else if (localName.equals("res-sharing-scope")) {
269:                    ref.setResSharingScope(getValue(localName, value));
270:                } else if (localName.equals("mapped-name")
271:                        || localName.equals("jndi-name")) {
272:                    ref.setMappedName(getValue(localName, value));
273:                    ref.setJndiName(getValue(localName, value));
274:                } else if (localName.equals("res-url")) {
275:                    ref.setResUrl(getValue(localName, value));
276:                } else if (localName.equals("resource-name")) {
277:                    ref.setResourceName(getValue(localName, value));
278:                    ref.setMappedName(getValue(localName, value));
279:                }
280:            }
281:
282:            public void setValue(NameValuePair nvPair,
283:                    UnmarshallingContext navigator, String namespaceURI,
284:                    String localName, String value) {
285:                if (localName.equals("name")) {
286:                    nvPair.setName(value);
287:                } else if (localName.equals("value")) {
288:                    nvPair.setValue(value);
289:                }
290:            }
291:
292:            public void setValue(SecurityRole role,
293:                    UnmarshallingContext navigator, String namespaceURI,
294:                    String localName, String value) {
295:                if (localName.equals("role-name")) {
296:                    role.setRoleName(getValue(localName, value));
297:                }
298:            }
299:
300:            public void setValue(JndiRef ref, UnmarshallingContext navigator,
301:                    String namespaceURI, String localName, String value) {
302:                if (localName.equals("mapped-name")) {
303:                    ref.setMappedName(getValue(localName, value));
304:                } else if (localName.equals("jndi-ref-name")) {
305:                    ref.setJndiRefName(getValue(localName, value));
306:                }
307:            }
308:
309:            public void setValue(RunAs runAs, UnmarshallingContext navigator,
310:                    String namespaceURI, String localName, String value) {
311:                if (localName.equals("role-name")) {
312:                    runAs.setRoleName(getValue(localName, value));
313:                }
314:            }
315:
316:            public void setValue(SecurityRoleRef ref,
317:                    UnmarshallingContext navigator, String namespaceURI,
318:                    String localName, String value) {
319:                if (localName.equals("role-name")) {
320:                    ref.setRoleName(getValue(localName, value));
321:                } else if (localName.equals("role-link")) {
322:                    ref.setRoleLink(getValue(localName, value));
323:                }
324:            }
325:
326:            public void setValue(Listener listener,
327:                    UnmarshallingContext navigator, String namespaceURI,
328:                    String localName, String value) {
329:                if (localName.equals("listener-class")) {
330:                    listener.setListenerClass(getValue(localName, value));
331:                }
332:            }
333:
334:            public void setValue(MessageDestination destination,
335:                    UnmarshallingContext navigator, String namespaceURI,
336:                    String localName, String value) {
337:                if (localName.equals("message-destination-name")) {
338:                    destination.setMessageDestinationName(getValue(localName,
339:                            value));
340:                } else if (localName.equals("mapped-name")
341:                        || localName.equals("jndi-name")) {
342:                    destination.setMappedName(getValue(localName, value));
343:                }
344:            }
345:
346:            public void setValue(PersistenceUnitRef ref,
347:                    UnmarshallingContext navigator, String namespaceURI,
348:                    String localName, String value) {
349:                if (localName.equals("persistence-unit-ref-name")) {
350:                    ref.setRefName(getValue(localName, value));
351:                } else if (localName.equals("persistence-unit-name")) {
352:                    ref.setUnitName(getValue(localName, value));
353:                }
354:            }
355:
356:            protected Object newEnvRefGroupChild(String localName) {
357:                Object child = null;
358:
359:                if (localName.equals("ejb-local-ref")) {
360:                    child = new EjbLocalRef();
361:                } else if (localName.equals("ejb-ref")) {
362:                    child = new EjbRef();
363:                } else if (localName.equals("resource-ref")) {
364:                    child = new ResourceRef();
365:                } else if (localName.equals("resource-env-ref")) {
366:                    child = new ResourceEnvRef();
367:                } else if (localName.equals("env-entry")) {
368:                    child = new EnvEntry();
369:                } else if (localName.equals("message-destination-ref")) {
370:                    child = new MessageDestinationRef();
371:                } else if (localName.equals("service-ref")) {
372:                    child = new ServiceRefDelegate().newServiceRefMetaData();
373:                } else if (localName.equals("jndi-ref")) {
374:                    child = new JndiRef();
375:                } else if (localName.equals("persistence-unit-ref")) {
376:                    child = new PersistenceUnitRef();
377:                } else if (localName.equals("persistence-context-ref")) {
378:                    child = new PersistenceContextRef();
379:                }
380:
381:                return child;
382:            }
383:
384:            protected Object newRefChild(Ref ref, String localName) {
385:                Object child = null;
386:
387:                if (localName.equals("ignore-dependency")) {
388:                    ref.setIgnoreDependency(true);
389:                } else if (localName.equals("injection-target")) {
390:                    InjectionTarget target = new InjectionTarget();
391:                    child = target;
392:                }
393:
394:                return child;
395:            }
396:
397:            public void setValue(PersistenceContextRef ref,
398:                    UnmarshallingContext navigator, String namespaceURI,
399:                    String localName, String value) {
400:                if (localName.equals("persistence-context-ref-name")) {
401:                    ref.setRefName(getValue(localName, value));
402:                } else if (localName.equals("persistence-unit-name")) {
403:                    ref.setUnitName(getValue(localName, value));
404:                } else if (localName.equals("persistence-context-type")) {
405:                    if (value.toLowerCase().equals("transaction")) {
406:                        ref
407:                                .setPersistenceContextType(PersistenceContextType.TRANSACTION);
408:                    } else {
409:                        ref
410:                                .setPersistenceContextType(PersistenceContextType.EXTENDED);
411:                    }
412:                }
413:            }
414:
415:            protected String getValue(String name, String value) {
416:                return value;
417:            }
418:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.