Source Code Cross Referenced for PathNode.java in  » Testing » PolePosition-0.20 » com » versant » core » ejb » query » 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.ejb.query 
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.ejb.query;
012:
013:        import com.versant.core.metadata.FieldMetaData;
014:        import com.versant.core.metadata.ClassMetaData;
015:
016:        /**
017:         * Dot separated list of identifiers.
018:         */
019:        public class PathNode extends Node {
020:
021:            public static final int WHERE = 1;
022:            public static final int SELECT = 2;
023:            public static final int GROUP_BY = 3;
024:            public static final int ORDER_BY = 4;
025:            public static final int AGGREGATE = 5;
026:            public static final int CONSTRUCTOR = 6;
027:            public static final int JOIN = 7;
028:            public static final int COLLECTION_MEMBER = 8;
029:
030:            private String[] list = new String[4];
031:            private int size;
032:            private int parentType;
033:
034:            private NavBase navBase;
035:            private FieldMetaData fmd;
036:
037:            /**
038:             * Create with given parent type (SELECT, GROUP_BY etc).
039:             */
040:            public PathNode(int parentType) {
041:                this .parentType = parentType;
042:            }
043:
044:            /**
045:             * Is this node under a SELECT, GROUP_BY etc.
046:             */
047:            public int getParentType() {
048:                return parentType;
049:            }
050:
051:            public void add(String identifier) {
052:                if (size == list.length) {
053:                    String[] a = new String[list.length + 4];
054:                    System.arraycopy(list, 0, a, 0, list.length);
055:                    list = a;
056:                }
057:                list[size++] = identifier;
058:            }
059:
060:            public String get(int i) {
061:                if (i >= size) {
062:                    throw new ArrayIndexOutOfBoundsException(i + " >= " + size);
063:                }
064:                return list[i];
065:            }
066:
067:            public int size() {
068:                return size;
069:            }
070:
071:            public Object arrive(NodeVisitor v, Object msg) {
072:                return v.arrivePathNode(this , msg);
073:            }
074:
075:            public String getParentTypeString() {
076:                switch (parentType) {
077:                case WHERE:
078:                    return "WHERE";
079:                case SELECT:
080:                    return "SELECT";
081:                case GROUP_BY:
082:                    return "GROUP_BY";
083:                case ORDER_BY:
084:                    return "ORDER_BY";
085:                case AGGREGATE:
086:                    return "AGGREGATE";
087:                case CONSTRUCTOR:
088:                    return "CONSTRUCTOR";
089:                case JOIN:
090:                    return "JOIN";
091:                case COLLECTION_MEMBER:
092:                    return "COLLECTION_MEMBER";
093:                }
094:                return "<? parentType " + parentType + " ?>";
095:            }
096:
097:            public String toStringImp() {
098:                if (size == 0) {
099:                    return "<? no identifiers in PathExpression?>";
100:                }
101:                StringBuffer s = new StringBuffer();
102:                s.append(list[0]);
103:                for (int i = 1; i < size; i++) {
104:                    s.append('.');
105:                    s.append(list[i]);
106:                }
107:                if (fmd != null) {
108:                    s.append('%');
109:                    s.append(fmd.getQName());
110:                } else if (navBase != null) {
111:                    s.append('%');
112:                    s.append(navBase.getNavClassMetaData().qname);
113:                }
114:                return s.toString();
115:            }
116:
117:            /**
118:             * Get the identification variable or last field navigated to get to our
119:             * field. If getFmd() is null then we have no simple field and this path is
120:             * returning the identification variable or object field on its own.
121:             */
122:            public NavBase getNavBase() {
123:                return navBase;
124:            }
125:
126:            /**
127:             * If this path ends in a field then this is it. It will be a field
128:             * of getNavBase().getNavClassMetaData().
129:             */
130:            public FieldMetaData getFmd() {
131:                return fmd;
132:            }
133:
134:            public void resolve(ResolveContext rc) {
135:                if (size == 1) { // identification var on its own
136:                    String name = get(0);
137:                    navBase = rc.checkIdVarExists(name, this );
138:                } else { // field value
139:                    navBase = rc.resolveJoinPath(this , false, false, size - 1);
140:                    ClassMetaData cmd = navBase.getNavClassMetaData();
141:                    String name = get(size - 1);
142:                    fmd = cmd.getFieldMetaData(name);
143:                    if (fmd == null) {
144:                        throw rc.createUserException("No such field '" + name
145:                                + "' on " + cmd.qname, this);
146:                    }
147:                }
148:            }
149:
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.