SourceForge.net Logo
DynamicContext.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001, 2008,
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef _DYNAMICCONTEXT_HPP
21 #define _DYNAMICCONTEXT_HPP
22 
25 
26 class Sequence;
27 class Result;
28 class Item;
29 class URIResolver;
30 class VariableStore;
31 class SequenceBuilder;
32 class UpdateFactory;
33 class RegexGroupStore;
34 class DebugListener;
35 class StackFrame;
36 
38 class XQILLA_API DynamicContext : public StaticContext
39 {
40 public:
41  virtual ~DynamicContext() {};
42 
43  virtual DynamicContext *createModuleDynamicContext(const DynamicContext* moduleCtx, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
44  XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
45 
47  virtual void clearDynamicContext() = 0;
48 
50  virtual Item::Ptr getContextItem() const = 0;
52  virtual void setContextItem(const Item::Ptr &item) = 0;
53 
55  virtual size_t getContextPosition() const = 0;
57  virtual void setContextPosition(size_t pos) = 0;
58 
60  virtual size_t getContextSize() const = 0;
62  virtual void setContextSize(size_t size) = 0;
63 
65  virtual const VariableStore* getVariableStore() const = 0;
67  virtual void setVariableStore(const VariableStore *store) = 0;
69  virtual const VariableStore* getGlobalVariableStore() const = 0;
71  virtual void setGlobalVariableStore(const VariableStore *store) = 0;
73  virtual void setExternalVariable(const XMLCh *namespaceURI, const XMLCh *name, const Result &value) = 0;
75  virtual void setExternalVariable(const XMLCh *qname, const Result &value) = 0;
76 
78  virtual const RegexGroupStore* getRegexGroupStore() const = 0;
80  virtual void setRegexGroupStore(const RegexGroupStore *store) = 0;
81 
83  virtual time_t getCurrentTime() const = 0;
85  virtual void setCurrentTime(time_t newTime) = 0;
86 
90  virtual void setImplicitTimezone(const ATDurationOrDerived::Ptr &timezoneAsDuration) = 0;
91 
93  // XQilla context specific accessors //
95 
108  virtual void registerURIResolver(URIResolver *resolver, bool adopt) = 0;
110  virtual URIResolver *getDefaultURIResolver() const = 0;
112  virtual void setDefaultURIResolver(URIResolver *resolver, bool adopt) = 0;
113 
115  virtual void setDebugListener(DebugListener *listener) = 0;
117  virtual DebugListener *getDebugListener() const = 0;
118 
120  virtual void setStackFrame(const StackFrame *frame) = 0;
122  virtual const StackFrame *getStackFrame() const = 0;
123 
125  virtual Node::Ptr parseDocument(XERCES_CPP_NAMESPACE_QUALIFIER InputSource &srcToUse,
126  const LocationInfo *location = 0, const QueryPathNode *projection = 0) = 0;
129  virtual Sequence resolveDocument(const XMLCh* uri, const LocationInfo *location = 0,
130  const QueryPathNode *projection = 0) = 0;
133  virtual Sequence resolveCollection(const XMLCh* uri, const LocationInfo *location = 0,
134  const QueryPathNode *projection = 0) = 0;
136  virtual Sequence resolveDefaultCollection(const QueryPathNode *projection = 0) = 0;
137 
140  virtual bool putDocument(const Node::Ptr &document, const XMLCh *uri) = 0;
141 
145 
148  virtual UpdateFactory *createUpdateFactory() const = 0;
149 
151  virtual void testInterrupt() const = 0;
152 };
153 
154 #endif
DynamicContext::createSequenceBuilder
virtual SequenceBuilder * createSequenceBuilder() const =0
Create a new SequenceBuilder, which is used to turn a stream of events into a Sequence.
DynamicContext::setContextItem
virtual void setContextItem(const Item::Ptr &item)=0
Set the context item to item.
Item
Definition: Item.hpp:37
StackFrame
A class that represents an item in a query call stack.
Definition: StackFrame.hpp:46
DynamicContext::registerURIResolver
virtual void registerURIResolver(URIResolver *resolver, bool adopt)=0
Register a callback object for resolving URIs.
DynamicContext::setVariableStore
virtual void setVariableStore(const VariableStore *store)=0
set the variable store
DynamicContext::getDebugListener
virtual DebugListener * getDebugListener() const =0
Gets the listener for debug messages.
RefCountPointer< const Item >
DynamicContext::resolveCollection
virtual Sequence resolveCollection(const XMLCh *uri, const LocationInfo *location=0, const QueryPathNode *projection=0)=0
Resolve the given uri (and baseUri) to a sequence of Node objects.
DynamicContext
The execution time dynamic context interface.
Definition: DynamicContext.hpp:39
DynamicContext::getImplicitTimezone
virtual ATDurationOrDerived::Ptr getImplicitTimezone() const =0
Return the implicit timezone for this system.
DynamicContext::setDefaultURIResolver
virtual void setDefaultURIResolver(URIResolver *resolver, bool adopt)=0
Sets the default URIResolver.
DynamicContext::getGlobalVariableStore
virtual const VariableStore * getGlobalVariableStore() const =0
get the variable store for globally scoped variables
DynamicContext::resolveDefaultCollection
virtual Sequence resolveDefaultCollection(const QueryPathNode *projection=0)=0
Resolve the default collection to a sequence of Node objects.
SequenceBuilder
Definition: SequenceBuilder.hpp:32
StaticContext
The parse time static context interface.
Definition: StaticContext.hpp:58
DynamicContext::getContextPosition
virtual size_t getContextPosition() const =0
Get the context position.
DynamicContext::setContextSize
virtual void setContextSize(size_t size)=0
Set the context size.
DynamicContext::getContextSize
virtual size_t getContextSize() const =0
Get the context size.
DynamicContext::clearDynamicContext
virtual void clearDynamicContext()=0
Resets the dynamic context, as if it had never been used.
DynamicContext::setRegexGroupStore
virtual void setRegexGroupStore(const RegexGroupStore *store)=0
set the regex group store
ATDurationOrDerived.hpp
DynamicContext::setCurrentTime
virtual void setCurrentTime(time_t newTime)=0
Set the current time.
DynamicContext::getCurrentTime
virtual time_t getCurrentTime() const =0
Return the current time.
DynamicContext::setImplicitTimezone
virtual void setImplicitTimezone(const ATDurationOrDerived::Ptr &timezoneAsDuration)=0
Set the implicit timezone.
DynamicContext::putDocument
virtual bool putDocument(const Node::Ptr &document, const XMLCh *uri)=0
Attempts to put the document specified to the given URI by calling the registered URIResolver objects...
Sequence
An eagerly evaluated result of a query execution.
Definition: Sequence.hpp:40
DynamicContext::setStackFrame
virtual void setStackFrame(const StackFrame *frame)=0
Sets the current stack frame whilst debugging.
DynamicContext::setContextPosition
virtual void setContextPosition(size_t pos)=0
Set the context position.
DynamicContext::getRegexGroupStore
virtual const RegexGroupStore * getRegexGroupStore() const =0
get the regex group store
DynamicContext::setExternalVariable
virtual void setExternalVariable(const XMLCh *qname, const Result &value)=0
set the value of an external global variable with the given QName
Result
A scoped pointer wrapper for the lazily evaluated query result.
Definition: Result.hpp:38
StaticContext.hpp
DynamicContext::getContextItem
virtual Item::Ptr getContextItem() const =0
Get the context Item.
DynamicContext::testInterrupt
virtual void testInterrupt() const =0
Test if the query should be interrupted, and throw if so.
DebugListener
A class used to listen for debugging information.
Definition: DebugListener.hpp:34
LocationInfo
A class that gives records a location in the query.
Definition: LocationInfo.hpp:30
DynamicContext::parseDocument
virtual Node::Ptr parseDocument(xercesc::InputSource &srcToUse, const LocationInfo *location=0, const QueryPathNode *projection=0)=0
Parse an XML document from the provided InputSource.
DynamicContext::resolveDocument
virtual Sequence resolveDocument(const XMLCh *uri, const LocationInfo *location=0, const QueryPathNode *projection=0)=0
Resolve the given uri (and baseUri) to an XML document.
RegexGroupStore
The pure virtual base class for accessing regular expression group values at runtime.
Definition: RegexGroupStore.hpp:31
UpdateFactory
Definition: UpdateFactory.hpp:33
DynamicContext::setDebugListener
virtual void setDebugListener(DebugListener *listener)=0
Set the listener for debug messages.
DynamicContext::getDefaultURIResolver
virtual URIResolver * getDefaultURIResolver() const =0
Returns the default URIResolver.
DynamicContext::getStackFrame
virtual const StackFrame * getStackFrame() const =0
Gets the listener for debug messages.
VariableStore
The pure virtual base class for accessing variables at runtime.
Definition: VariableStore.hpp:32
DynamicContext::~DynamicContext
virtual ~DynamicContext()
Definition: DynamicContext.hpp:41
DynamicContext::setGlobalVariableStore
virtual void setGlobalVariableStore(const VariableStore *store)=0
set the variable store for globally scoped variables
DynamicContext::createModuleDynamicContext
virtual DynamicContext * createModuleDynamicContext(const DynamicContext *moduleCtx, xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager) const =0
URIResolver
This is an abstract class used to resolve URIs in different ways.
Definition: URIResolver.hpp:38
DynamicContext::createUpdateFactory
virtual UpdateFactory * createUpdateFactory() const =0
Creates a new UpdateFactory, used for performing updates.
DynamicContext::getVariableStore
virtual const VariableStore * getVariableStore() const =0
get the variable store
DynamicContext::setExternalVariable
virtual void setExternalVariable(const XMLCh *namespaceURI, const XMLCh *name, const Result &value)=0
set the value of an external global variable with the given uri/localname pair