Source Code Cross Referenced for TraceExpression.java in  » XML » XPath-Saxon » net » sf » saxon » instruct » 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 » XML » XPath Saxon » net.sf.saxon.instruct 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sf.saxon.instruct;
002:
003:        import net.sf.saxon.expr.Expression;
004:        import net.sf.saxon.om.NamespaceResolver;
005:        import net.sf.saxon.trace.InstructionInfo;
006:
007:        import java.util.HashMap;
008:        import java.util.Iterator;
009:
010:        /**
011:         * A subclass of TraceWrapper used to trace expressions in XPath and XQuery. Unlike
012:         * the TraceInstruction class, this class contains all information needed for tracing,
013:         * rather than referencing a separate InstructionDetails object.
014:         */
015:
016:        // This class is used for tracing
017:        // within XPath/XQuery expressions. The TraceExpression itself holds all the information
018:        // about the source needing to be traced (the InstructionInfo).
019:        public class TraceExpression extends TraceWrapper implements 
020:                InstructionInfo {
021:
022:            private int lineNumber = -1;
023:            private int columnNumber = -1;
024:            private String systemId = null;
025:            private int objectNameCode = -1;
026:            private int constructType;
027:            private NamespaceResolver namespaceResolver = null;
028:            private HashMap properties = new HashMap(10);
029:
030:            /**
031:             * Create a trace expression that traces execution of a given child expression
032:             * @param child the expression to be traced. This will be available to the TraceListener
033:             * as the value of the "expression" property of the InstructionInfo.
034:             */
035:            public TraceExpression(Expression child) {
036:                this .child = child;
037:                setProperty("expression", child);
038:            }
039:
040:            /**
041:             * Set the line number of the expression being traced
042:             * @param line
043:             */
044:            public void setLineNumber(int line) {
045:                lineNumber = line;
046:            }
047:
048:            /**
049:             * Set the column number of the expression being traced
050:             * @param column
051:             */
052:            public void setColumnNumber(int column) {
053:                columnNumber = column;
054:            }
055:
056:            /**
057:             * Set the type of construct. This will generally be a constant
058:             * in class {@link net.sf.saxon.trace.Location}
059:             */
060:
061:            public void setConstructType(int type) {
062:                constructType = type;
063:            }
064:
065:            /**
066:             * Get the construct type. This will generally be a constant
067:             * in class {@link net.sf.saxon.trace.Location}
068:             */
069:            public int getConstructType() {
070:                return constructType;
071:            }
072:
073:            /**
074:             * Set the namespace context for the instruction being traced. This is needed if the
075:             * tracelistener wants to evaluate XPath expressions in the context of the current instruction
076:             */
077:
078:            public void setNamespaceResolver(NamespaceResolver resolver) {
079:                namespaceResolver = resolver;
080:            }
081:
082:            /**
083:             * Get the namespace resolver to supply the namespace context of the instruction
084:             * that is being traced
085:             */
086:
087:            public NamespaceResolver getNamespaceResolver() {
088:                return namespaceResolver;
089:            }
090:
091:            /**
092:             * Set the URI of the module containing the instruction
093:             * @param systemId the module's URI
094:             */
095:
096:            public void setSystemId(String systemId) {
097:                this .systemId = systemId;
098:            }
099:
100:            /**
101:             * Get the URI of the module containing the instruction
102:             * @return the module's URI
103:             */
104:
105:            public String getSystemId() {
106:                return systemId;
107:            }
108:
109:            /**
110:             * Get the line number of the instruction within its module
111:             * @return the line number
112:             */
113:
114:            public int getLineNumber() {
115:                return lineNumber;
116:            }
117:
118:            /**
119:             * Set a name identifying the object of the expression, for example a function name, template name,
120:             * variable name, key name, element name, etc. This is used only where the name is known statically.
121:             */
122:
123:            public void setObjectNameCode(int nameCode) {
124:                objectNameCode = nameCode;
125:            }
126:
127:            /**
128:             * Get a name identifying the object of the expression, for example a function name, template name,
129:             * variable name, key name, element name, etc. This is used only where the name is known statically.
130:             */
131:
132:            public int getObjectNameCode() {
133:                return objectNameCode;
134:            }
135:
136:            /**
137:             * Set a named property of the instruction/expression
138:             */
139:
140:            public void setProperty(String name, Object value) {
141:                properties.put(name, value);
142:            }
143:
144:            /**
145:             * Get a named property of the instruction/expression
146:             */
147:
148:            public Object getProperty(String name) {
149:                return properties.get(name);
150:            }
151:
152:            /**
153:             * Get an iterator over all the properties available. The values returned by the iterator
154:             * will be of type String, and each string can be supplied as input to the getProperty()
155:             * method to retrieve the value of the property.
156:             */
157:
158:            public Iterator getProperties() {
159:                return properties.keySet().iterator();
160:            }
161:
162:            /**
163:             * Get the column number identifying the position of the instruction. This method
164:             * is provided to satisfy the SourceLocator interface. However, the column number is
165:             * not maintained by Saxon, and the method always returns -1
166:             * @return -1
167:             */
168:
169:            public int getColumnNumber() {
170:                return columnNumber;
171:            }
172:
173:            /**
174:             * Get the InstructionInfo details about the construct. This is to satisfy the InstructionInfoProvider
175:             * interface.
176:             */
177:
178:            public InstructionInfo getInstructionInfo() {
179:                return this ;
180:            }
181:
182:            /**
183:             * Get the system identifier (that is the base URI) of the static context of the expression being
184:             * traced. This returns the same result as getSystemId(), it is provided to satisfy the
185:             * {@link net.sf.saxon.event.LocationProvider} interface.
186:             * @param locationId not used
187:             * @return the URI of the module containing the expression
188:             */
189:            public String getSystemId(int locationId) {
190:                return getSystemId();
191:            }
192:
193:            /**
194:             * Get the line number of the expression being
195:             * traced. This returns the same result as getLineNumber(), it is provided to satisfy the
196:             * {@link net.sf.saxon.event.LocationProvider} interface.
197:             * @param locationId not used
198:             * @return the line number of the expression within its module
199:             */
200:
201:            public int getLineNumber(int locationId) {
202:                return getLineNumber();
203:            }
204:        }
205:
206:        //
207:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
208:        // you may not use this file except in compliance with the License. You may obtain a copy of the
209:        // License at http://www.mozilla.org/MPL/
210:        //
211:        // Software distributed under the License is distributed on an "AS IS" basis,
212:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
213:        // See the License for the specific language governing rights and limitations under the License.
214:        //
215:        // The Original Code is: all this file.
216:        //
217:        // The Initial Developer of the Original Code is Michael H. Kay
218:        //
219:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
220:        //
221:        // Contributor(s): none.
222:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.