Source Code Cross Referenced for EJBPersistenceParser.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » generation » parser » ejb » 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 » Database ORM » Speedo_1.4.5 » org.objectweb.speedo.generation.parser.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.speedo.generation.parser.ejb;
002:
003:        import org.objectweb.speedo.api.SpeedoException;
004:        import org.objectweb.speedo.generation.api.SpeedoXMLError;
005:        import org.objectweb.speedo.generation.parser.AbstractParser;
006:        import org.objectweb.speedo.lib.Personality;
007:        import org.objectweb.speedo.locale.LocaleHelper;
008:        import org.objectweb.speedo.metadata.SpeedoClass;
009:        import org.objectweb.speedo.metadata.SpeedoPackage;
010:        import org.objectweb.speedo.metadata.SpeedoXMLDescriptor;
011:        import org.objectweb.util.monolog.api.BasicLevel;
012:        import org.w3c.dom.Node;
013:        import org.w3c.dom.NodeList;
014:
015:        public class EJBPersistenceParser extends AbstractParser {
016:
017:            public EJBPersistenceParser() {
018:                super (Personality.EJB);
019:            }
020:
021:            public String getTitle() {
022:                return LocaleHelper.getEJBParsingRB().getString("ejbperspar");
023:            }
024:
025:            protected String getLoggerName() {
026:                return "ejb";
027:            }
028:
029:            protected Object treatDocument(Node node, Object o)
030:                    throws SpeedoException {
031:                //o is the descriptor of the root node
032:                o = treatNode(node, o);
033:                //list of child node
034:                NodeList children = node.getChildNodes();
035:                //if the node has a child
036:                if (children != null) {
037:                    //for each child
038:                    for (int i = 0; i < children.getLength(); i++) {
039:                        //create a descriptor for the child
040:                        Object fils = treatDocument(children.item(i), o);
041:                    }
042:                }
043:                return o;
044:            }
045:
046:            // PRIVATE METHODS //
047:            //-----------------//
048:
049:            /**
050:             * This methods creates the object descriptor for describing a tag of the
051:             * XML file.
052:             * It returns the descriptor for the root tag.
053:             * It throws an exception if an attribute is missing.
054:             * @param node node which will be described.
055:             * @param o default descriptor to return.
056:             * @return node descriptor.
057:             * @exception SpeedoException if a compulsory attribute is missing for
058:             * the current tag.
059:             */
060:            private Object treatNode(Node node, Object o)
061:                    throws SpeedoException {
062:                // type of node
063:                int type = node.getNodeType();
064:                if (type != Node.ELEMENT_NODE)
065:                    return o;
066:                //tag name
067:                String tag = node.getNodeName();
068:                logger.log(BasicLevel.DEBUG, "Parse tag: " + tag);
069:                if (tag.equals("entity-manager")) { //tag entity-manager
070:                    //root: nothing to do
071:                } else if (tag.equals("name")) { //tag name
072:                } else if (tag.equals("provider")) { //tag provider
073:                } else if (tag.equals("jta-data-source")) { //tag jta-data-source
074:                } else if (tag.equals("non-jta-data-source")) { //tag non-jta-data-source
075:                } else if (tag.equals("mapping-file")) { //tag mapping-file
076:                } else if (tag.equals("jar-file")) { //tag jar-file
077:                } else if (tag.equals("class")) { //tag class
078:                    String fullcn = node.getFirstChild().getNodeValue();
079:                    String pac = fullcn.substring(0, fullcn.lastIndexOf('.'));
080:                    String cn = fullcn.substring(fullcn.lastIndexOf('.') + 1,
081:                            fullcn.length());
082:                    SpeedoPackage sp = (SpeedoPackage) ((SpeedoXMLDescriptor) o).packages
083:                            .get(pac);
084:                    if (sp == null) {
085:                        sp = new SpeedoPackage();
086:                        sp.name = pac;
087:                        sp.xmlDescriptor = (SpeedoXMLDescriptor) o;
088:                        ((SpeedoXMLDescriptor) o).packages.put(pac, sp);
089:                        logger.log(BasicLevel.DEBUG, "New package: name= "
090:                                + pac);
091:                    }
092:                    SpeedoClass sc = new SpeedoClass();
093:                    sc.name = sc.nameForQuery = cn;
094:                    sc.moPackage = sp;
095:                    sp.classes.put(cn, sc);
096:                    logger.log(BasicLevel.DEBUG, "New class: name= " + cn
097:                            + " in the package=" + pac);
098:                    treatClassNode(sc);
099:                } else if (tag.equals("properties")) { //tag properties
100:                } else if (tag.equals("property")) { //tag property
101:                    Node n, v;
102:                    n = node.getAttributes().getNamedItem("name");
103:                    v = node.getAttributes().getNamedItem("value");
104:                    if ((n == null) || (v == null)) {
105:                        throw new SpeedoXMLError(
106:                                "Attribute name or value for tag property requested.");
107:                    }
108:                    n.getNodeValue();
109:                    v.getNodeValue();
110:                }
111:                return o;
112:            }
113:
114:            private Object treatClassNode(SpeedoClass node)
115:                    throws SpeedoException {
116:                return node;
117:            }
118:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.