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


001:        package net.sf.saxon.expr;
002:
003:        import net.sf.saxon.Configuration;
004:        import net.sf.saxon.Controller;
005:        import net.sf.saxon.event.SequenceReceiver;
006:        import net.sf.saxon.trace.InstructionInfoProvider;
007:        import net.sf.saxon.instruct.RegexIterator;
008:        import net.sf.saxon.instruct.Template;
009:        import net.sf.saxon.instruct.ParameterSet;
010:        import net.sf.saxon.instruct.LocalParam;
011:        import net.sf.saxon.sort.GroupIterator;
012:        import net.sf.saxon.om.*;
013:        import net.sf.saxon.trans.XPathException;
014:        import net.sf.saxon.trans.DynamicError;
015:        import net.sf.saxon.trans.Mode;
016:        import net.sf.saxon.type.SchemaType;
017:
018:        import javax.xml.transform.Result;
019:        import java.util.Properties;
020:        import java.util.Comparator;
021:        import java.io.Serializable;
022:
023:        /**
024:         * This class is an implementation of XPathContext used when evaluating constant sub-expressions at
025:         * compile time.
026:         */
027:
028:        public class EarlyEvaluationContext implements  XPathContext,
029:                Serializable {
030:
031:            private StaticContext env;
032:            private Configuration config;
033:
034:            public EarlyEvaluationContext(StaticContext env) {
035:                this .env = env;
036:                this .config = env.getConfiguration();
037:            }
038:
039:            /**
040:             * Set a new output destination, supplying the output format details. <BR>
041:             * Note that it is the caller's responsibility to close the Writer after use.
042:             *
043:             * @param props   properties defining the output format
044:             * @param result  Details of the new output destination
045:             * @param isFinal true if the destination is a final result tree
046:             *                (either the principal output or a secondary result tree); false if
047:             *                it is a temporary tree, xsl:attribute, etc.
048:             * @throws net.sf.saxon.trans.XPathException
049:             *          if any dynamic error occurs; and
050:             *          specifically, if an attempt is made to switch to a final output
051:             *          destination while writing a temporary tree or sequence
052:             */
053:
054:            public void changeOutputDestination(Properties props,
055:                    Result result, boolean isFinal, int validation,
056:                    SchemaType schemaType) throws XPathException {
057:                notAllowed();
058:            }
059:
060:            /**
061:             * Get the value of a local variable, identified by its slot number
062:             */
063:
064:            public ValueRepresentation evaluateLocalVariable(int slotnumber) {
065:                notAllowed();
066:                return null;
067:            }
068:
069:            /**
070:             * Get the calling XPathContext (the next one down the stack). This will be null if unknown, or
071:             * if the bottom of the stack has been reached.
072:             */
073:
074:            public XPathContext getCaller() {
075:                return null;
076:            }
077:
078:            /**
079:             * Get a named collation
080:             */
081:
082:            public Comparator getCollation(String name) throws XPathException {
083:                return env.getCollation(name);
084:            }
085:
086:            /**
087:             * Get the Configuration
088:             */
089:
090:            public Configuration getConfiguration() {
091:                return config;
092:            }
093:
094:            /**
095:             * Get the context item
096:             *
097:             * @return the context item, or null if the context item is undefined
098:             */
099:
100:            public Item getContextItem() {
101:                return null;
102:            }
103:
104:            /**
105:             * Get the context position (the position of the context item)
106:             *
107:             * @return the context position (starting at one)
108:             * @throws net.sf.saxon.trans.DynamicError
109:             *          if the context position is undefined
110:             */
111:
112:            public int getContextPosition() throws DynamicError {
113:                DynamicError err = new DynamicError(
114:                        "The context item is undefined");
115:                err.setErrorCode("XPDY0002");
116:                throw err;
117:            }
118:
119:            /**
120:             * Get the Controller. May return null when running outside XSLT or XQuery
121:             */
122:
123:            public Controller getController() {
124:                return null;
125:            }
126:
127:            /**
128:             * Get the current group iterator. This supports the current-group() and
129:             * current-grouping-key() functions in XSLT 2.0
130:             *
131:             * @return the current grouped collection
132:             */
133:
134:            public GroupIterator getCurrentGroupIterator() {
135:                notAllowed();
136:                return null;
137:            }
138:
139:            /**
140:             * Get the current iterator.
141:             * This encapsulates the context item, context position, and context size.
142:             *
143:             * @return the current iterator, or null if there is no current iterator
144:             *         (which means the context item, position, and size are undefined).
145:             */
146:
147:            public SequenceIterator getCurrentIterator() {
148:                return null;
149:            }
150:
151:            /**
152:             * Get the current mode.
153:             *
154:             * @return the current mode
155:             */
156:
157:            public Mode getCurrentMode() {
158:                notAllowed();
159:                return null;
160:            }
161:
162:            /**
163:             * Get the current regex iterator. This supports the functionality of the regex-group()
164:             * function in XSLT 2.0.
165:             *
166:             * @return the current regular expressions iterator
167:             */
168:
169:            public RegexIterator getCurrentRegexIterator() {
170:                return null;
171:            }
172:
173:            /**
174:             * Get the current template. This is used to support xsl:apply-imports
175:             *
176:             * @return the current template
177:             */
178:
179:            public Template getCurrentTemplate() {
180:                return null;
181:            }
182:
183:            /**
184:             * Get the default collation
185:             */
186:
187:            public Comparator getDefaultCollation() {
188:                return env.getCollation(env.getDefaultCollationName());
189:            }
190:
191:            /**
192:             * Get the context size (the position of the last item in the current node list)
193:             *
194:             * @return the context size
195:             * @throws net.sf.saxon.trans.XPathException
196:             *          if the context position is undefined
197:             */
198:
199:            public int getLast() throws XPathException {
200:                DynamicError err = new DynamicError(
201:                        "The context item is undefined");
202:                err.setErrorCode("XPDY0002");
203:                throw err;
204:            }
205:
206:            /**
207:             * Get the local (non-tunnel) parameters that were passed to the current function or template
208:             *
209:             * @return a ParameterSet containing the local parameters
210:             */
211:
212:            public ParameterSet getLocalParameters() {
213:                notAllowed();
214:                return null;
215:            }
216:
217:            /**
218:             * Get the Name Pool
219:             */
220:
221:            public NamePool getNamePool() {
222:                return config.getNamePool();
223:            }
224:
225:            /**
226:             * Get information about the creating expression or other construct.
227:             */
228:
229:            public InstructionInfoProvider getOrigin() {
230:                return null;
231:            }
232:
233:            /**
234:             * Get the type of location from which this context was created.
235:             */
236:
237:            public int getOriginatingConstructType() {
238:                return -1;
239:            }
240:
241:            /**
242:             * Get the Receiver to which output is currently being written.
243:             *
244:             * @return the current Receiver
245:             */
246:            public SequenceReceiver getReceiver() {
247:                notAllowed();
248:                return null;
249:            }
250:
251:            /**
252:             * Get a reference to the local stack frame for variables. Note that it's
253:             * the caller's job to make a local copy of this. This is used for creating
254:             * a Closure containing a retained copy of the variables for delayed evaluation.
255:             *
256:             * @return array of variables.
257:             */
258:
259:            public StackFrame getStackFrame() {
260:                notAllowed();
261:                return null;
262:            }
263:
264:            /**
265:             * Get the tunnel parameters that were passed to the current function or template. This includes all
266:             * active tunnel parameters whether the current template uses them or not.
267:             *
268:             * @return a ParameterSet containing the tunnel parameters
269:             */
270:
271:            public ParameterSet getTunnelParameters() {
272:                notAllowed();
273:                return null;
274:            }
275:
276:            /**
277:             * Get the XSLT-specific part of the context
278:             */
279:
280:            public XPathContextMajor.XSLTContext getXSLTContext() {
281:                notAllowed();
282:                return null;
283:            }
284:
285:            /**
286:             * Determine whether the context position is the same as the context size
287:             * that is, whether position()=last()
288:             */
289:
290:            public boolean isAtLast() throws XPathException {
291:                DynamicError err = new DynamicError(
292:                        "The context item is undefined");
293:                err.setErrorCode("XPDY0002");
294:                throw err;
295:            }
296:
297:            /**
298:             * Construct a new context without copying (used for the context in a function call)
299:             */
300:
301:            public XPathContextMajor newCleanContext() {
302:                notAllowed();
303:                return null;
304:            }
305:
306:            /**
307:             * Construct a new context as a copy of another. The new context is effectively added
308:             * to the top of a stack, and contains a pointer to the previous context
309:             */
310:
311:            public XPathContextMajor newContext() {
312:                notAllowed();
313:                return null;
314:            }
315:
316:            /**
317:             * Construct a new minor context. A minor context can only hold new values of the focus
318:             * (currentIterator) and current output destination.
319:             */
320:
321:            public XPathContextMinor newMinorContext() {
322:                notAllowed();
323:                return null;
324:            }
325:
326:            /**
327:             * Set the calling XPathContext
328:             */
329:
330:            public void setCaller(XPathContext caller) {
331:                // no-op
332:            }
333:
334:            /**
335:             * Set a new sequence iterator.
336:             */
337:
338:            public void setCurrentIterator(SequenceIterator iter) {
339:                notAllowed();
340:            }
341:
342:            /**
343:             * Set the value of a local variable, identified by its slot number
344:             */
345:
346:            public void setLocalVariable(int slotnumber,
347:                    ValueRepresentation value) {
348:                notAllowed();
349:            }
350:
351:            /**
352:             * Set the creating expression (for use in diagnostics). The origin is generally set to "this" by the
353:             * object that creates the new context. It's up to the debugger to determine whether this information
354:             * is useful. Where possible, the object will be an {@link net.sf.saxon.trace.InstructionInfoProvider}, allowing information
355:             * about the calling instruction to be obtained.
356:             */
357:
358:            public void setOrigin(InstructionInfoProvider expr) {
359:                // no-op
360:            }
361:
362:            /**
363:             * Set the type of creating expression (for use in diagnostics). When a new context is created, either
364:             * this method or {@link #setOrigin} should be called.
365:             *
366:             * @param loc The originating location: the argument must be one of the integer constants in class
367:             *            {@link net.sf.saxon.trace.Location}
368:             */
369:
370:            public void setOriginatingConstructType(int loc) {
371:                // no-op
372:            }
373:
374:            /**
375:             * Change the Receiver to which output is written
376:             */
377:
378:            public void setReceiver(SequenceReceiver receiver) {
379:                notAllowed();
380:            }
381:
382:            /**
383:             * Set the receiver to which output is to be written, marking it as a temporary (non-final)
384:             * output destination.
385:             *
386:             * @param out The SequenceOutputter to be used
387:             */
388:
389:            public void setTemporaryReceiver(SequenceReceiver out) {
390:                notAllowed();
391:            }
392:
393:            /**
394:             * Use local parameter. This is called when a local xsl:param element is processed.
395:             * If a parameter of the relevant name was supplied, it is bound to the xsl:param element.
396:             * Otherwise the method returns false, so the xsl:param default will be evaluated
397:             *
398:             * @param fingerprint The fingerprint of the parameter name
399:             * @param binding     The XSLParam element to bind its value to
400:             * @param isTunnel    True if a tunnel parameter is required, else false
401:             * @return true if a parameter of this name was supplied, false if not
402:             */
403:
404:            public boolean useLocalParameter(int fingerprint,
405:                    LocalParam binding, boolean isTunnel) throws XPathException {
406:                return false;
407:            }
408:
409:            /**
410:             * Get the implicit timezone, as a positive or negative offset from UTC in minutes.
411:             * The range is -14hours to +14hours
412:             */
413:            public int getImplicitTimezone() {
414:                return config.getImplicitTimezone();
415:            }
416:
417:            /**
418:             * Get a NameChecker for checking names against the XML 1.0 or XML 1.1 specification as appropriate
419:             */
420:
421:            public NameChecker getNameChecker() {
422:                return config.getNameChecker();
423:            }
424:
425:            /**
426:             * Throw an error for operations that aren't supported when doing early evaluation of constant
427:             * subexpressions
428:             */
429:
430:            private void notAllowed() {
431:                throw new UnsupportedOperationException(
432:                        "Internal error: early evaluation of subexpression with no context");
433:            }
434:        }
435:
436:        //
437:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
438:        // you may not use this file except in compliance with the License. You may obtain a copy of the
439:        // License at http://www.mozilla.org/MPL/
440:        //
441:        // Software distributed under the License is distributed on an "AS IS" basis,
442:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
443:        // See the License for the specific language governing rights and limitations under the License.
444:        //
445:        // The Original Code is: all this file.
446:        //
447:        // The Initial Developer of the Original Code is Michael H. Kay.
448:        //
449:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
450:        //
451:        // Contributor(s):
452:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.