Source Code Cross Referenced for JdoClass.java in  » Testing » PolePosition-0.20 » com » versant » core » metadata » parser » 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 » Testing » PolePosition 0.20 » com.versant.core.metadata.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998 - 2005 Versant Corporation
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         * Versant Corporation - initial API and implementation
010:         */
011:        package com.versant.core.metadata.parser;
012:
013:        import com.versant.core.metadata.MDStatics;
014:        import com.versant.core.metadata.MDStaticUtils;
015:        import com.versant.core.common.Debug;
016:
017:        import java.io.PrintStream;
018:        import java.util.ArrayList;
019:        import java.util.Iterator;
020:        import java.util.Map;
021:
022:        /**
023:         * Class element from a .jdo file.
024:         */
025:        public final class JdoClass extends JdoElement implements  MDStatics {
026:
027:            public String name;
028:            public int identityType;
029:            public String objectIdClass;
030:            public boolean requiresExtent;
031:            public String pcSuperclass;
032:            public JdoPackage parent;
033:
034:            /** The field and extension elements in order or null if none. */
035:            public JdoElement[] elements;
036:
037:            /** The query elements or null if none. */
038:            public ArrayList queries;
039:            /**
040:             * This can be used to override the need for a objectIdClass for appid instances
041:             */
042:            public boolean objectIdClasssRequired = true;
043:
044:            public JdoElement getParent() {
045:                return parent;
046:            }
047:
048:            /**
049:             * Get information for this element to be used in building up a
050:             * context string.
051:             * @see #getContext
052:             */
053:            public String getSubContext() {
054:                return "class[" + name + "]";
055:            }
056:
057:            public String toString() {
058:                StringBuffer s = new StringBuffer();
059:                s.append("class[");
060:                s.append(name);
061:                s.append("] identityType=");
062:                s.append(MDStaticUtils.toIdentityTypeString(identityType));
063:                s.append(" objectIdClass=");
064:                s.append(objectIdClass);
065:                s.append(" requiresExtent=");
066:                s.append(requiresExtent);
067:                s.append(" pcSuperclass=");
068:                s.append(pcSuperclass);
069:                return s.toString();
070:            }
071:
072:            public void dump() {
073:                dump(Debug.OUT, "");
074:            }
075:
076:            public void dump(PrintStream out, String indent) {
077:                out.println(indent + this );
078:                if (elements != null) {
079:                    for (int i = 0; i < elements.length; i++) {
080:                        Object o = elements[i];
081:                        if (o instanceof  JdoField) {
082:                            ((JdoField) o).dump(out, indent + "  ");
083:                        } else if (o instanceof  JdoExtension) {
084:                            ((JdoExtension) o).dump(out, indent + "  ");
085:                        } else if (o instanceof  JdoQuery) {
086:                            ((JdoQuery) o).dump(out, indent + "  ");
087:                        } else {
088:                            out.println("unknown " + o);
089:                        }
090:                    }
091:                }
092:                if (queries != null) {
093:                    for (Iterator i = queries.iterator(); i.hasNext();) {
094:                        ((JdoQuery) i.next()).dump(out, indent + "  ");
095:                    }
096:                }
097:            }
098:
099:            /**
100:             * Get the fully qualified name of this class.
101:             */
102:            public String getQName() {
103:                return getQName(name);
104:            }
105:
106:            private String getQName(String n) {
107:                if (n == null)
108:                    return null;
109:                int i = n.indexOf('.');
110:                if (i >= 0 || parent.name.length() == 0)
111:                    return n;
112:                return parent.name + '.' + n;
113:            }
114:
115:            /**
116:             * Get the fully qualified name of our PC super class or null if none.
117:             */
118:            public String getPCSuperClassQName() {
119:                return getQName(pcSuperclass);
120:            }
121:
122:            /**
123:             * Get the fully qualified name of our objectid-class or null if none.
124:             */
125:            public String getObjectIdClassQName() {
126:                return getQName(objectIdClass);
127:            }
128:
129:            /**
130:             * Does this class has a JDBC_KEY_GENERATOR set on it?
131:             */
132:            public boolean hasKeyGen() {
133:                if (elements != null) {
134:                    JdoExtension ext = null;
135:                    for (int i = 0; i < elements.length; i++) {
136:                        Object o = elements[i];
137:                        if (o instanceof  JdoExtension) {
138:                            ext = (JdoExtension) o;
139:                            if (ext.key == JdoExtension.JDBC_KEY_GENERATOR) {
140:                                return true;
141:                            } else if (ext
142:                                    .contains(JdoExtension.JDBC_KEY_GENERATOR)) {
143:                                return true;
144:                            }
145:
146:                        }
147:                    }
148:                }
149:                return false;
150:            }
151:
152:            /**
153:             * Add a JdoQuery to this class. This is called when queries declared
154:             * in a separate .jdoquery resource file are moved to the main JdoClass
155:             * definition and when queries are originally parsed. The q.parent field
156:             * must have already been set.
157:             */
158:            public void addJdoQuery(JdoQuery q) {
159:                // Note that this code must not change q.parent to reference this
160:                // class. The parent link is used to construct parsing error messages
161:                // and so must lead back to the original JdoRoot for the resource the
162:                // query was declared in.
163:                if (queries == null)
164:                    queries = new ArrayList();
165:                queries.add(q);
166:            }
167:
168:            public int getInheritance(Map enumMap) {
169:                if (elements != null) {
170:                    JdoExtension ext = null;
171:                    for (int i = 0; i < elements.length; i++) {
172:                        Object o = elements[i];
173:                        if (o instanceof  JdoExtension) {
174:                            ext = (JdoExtension) o;
175:                            if (ext.key == JdoExtension.JDBC_INHERITANCE) {
176:                                if (ext.value == null)
177:                                    return -1;
178:                                return ext.getEnum(enumMap);
179:                            }
180:                        }
181:                    }
182:                }
183:                return -1;
184:            }
185:
186:            public void addElement(JdoElement jdoElement) {
187:                if (elements == null) {
188:                    elements = new JdoElement[] { jdoElement, };
189:                } else {
190:                    JdoElement[] tmp = new JdoElement[elements.length + 1];
191:                    System.arraycopy(elements, 0, tmp, 0, elements.length);
192:                    tmp[elements.length] = jdoElement;
193:                    elements = tmp;
194:                }
195:
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.