|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.deploy.CompiledUserQuery
public abstract class CompiledUserQuery
This abstract class acts as a superclass for every compiled query generated by the Saxon code generator, other than queries compiled in servlet mode.
Queries compiled to use this superclass are not thread-safe: a new instance of the class must be created each time a query is run in a new thread. The class is, however, serially reusable.
The class supports two mechanisms for running a compiled query. The query can be run directly from the command line, or it can be integrated into an application and invoked via a Java API.
The class contains two kinds of method: methods (many of them abstract) that form the API to the query, enabling a client application to invoke the query and process the results; and concrete methods that provide run-time services to the compiled query itself.
Field Summary | |
---|---|
protected Configuration |
config
|
protected DynamicQueryContext |
dqc
|
protected Executable |
exec
|
protected NamePool |
namePool
|
protected TypeHierarchy |
th
|
Constructor Summary | |
---|---|
CompiledUserQuery()
|
Method Summary | |
---|---|
protected void |
dynamicError(String message,
String code,
XPathContext context)
|
protected boolean |
generalCompare(SequenceIterator iter1,
SequenceIterator iter2,
SimpleAtomicComparer comparer,
XPathContext context)
Helper method to implement a general comparison |
Configuration |
getConfiguration()
Get the Configuration |
protected NodeInfo |
getContextNode(Item item)
Helper method to get the context node, throwing appropriate exceptions if there isn't one |
Executable |
getExecutable()
Get the Executable |
protected SlotManager |
getStackFrameMap()
Get a StackFrameMap for the first local stackframe (that is, for the main query body). |
abstract void |
importSchemata(Configuration config)
Load the schema documents that were imported into the query source code. |
abstract void |
initializeGlobals(XPathContext context)
Run the query-specific initialization code. |
void |
mainCommand(String[] args)
Run the query from the command line |
abstract void |
process(XPathContext context)
Run the query, sending the results to the current output destination |
void |
run(Result result,
Properties outputProperties)
Run the query, sending the results directly to a JAXP Result object. |
void |
setConfiguration(Configuration config)
Supply the configuration in which the query will be executed. |
void |
setDynamicContext(DynamicQueryContext context)
Supply the dynamic context for the query. |
abstract void |
setExternalVariable(String clarkName,
ValueRepresentation value)
Supply the value of an external variable |
protected void |
typeError(String message,
String code,
XPathContext context)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Configuration config
protected Executable exec
protected DynamicQueryContext dqc
protected NamePool namePool
protected TypeHierarchy th
Constructor Detail |
---|
public CompiledUserQuery()
Method Detail |
---|
public void setConfiguration(Configuration config)
config
- the Configuration to be used. If the query is schema-aware, this must be an instance
of EnterpriseConfiguration
public abstract void setExternalVariable(String clarkName, ValueRepresentation value)
clarkName
- The expanded name of the variable in Clark notation: that is, the local name
in the case of a name in no namespace, or "{uri}local" for a name with namespace URI "uri" and local name
"local"value
- The value to be assigned to the external variablepublic void setDynamicContext(DynamicQueryContext context)
setExternalVariable(java.lang.String, net.sf.saxon.om.ValueRepresentation)
).
If any parameter values are included in the context, they will immediately be extracted from the
supplied context object and passed to the query as if setExternalVariable(java.lang.String, net.sf.saxon.om.ValueRepresentation)
were called. Subsequent
changes to the context object have no effect. However, if the values supplied are mutable, it is undefined
whether any subsequent changes to the values have any effect.
context
- the dynamic context to be used.public void run(Result result, Properties outputProperties) throws XPathException
result
- the destination for the results of the query. The query is effectively wrapped
in a document{} constructor, so that the items in the result are concatenated to form a single
document; this is then written to the requested Result destination, which may be (for example)
a DOMResult, a SAXResult, or a StreamResultoutputProperties
- Supplies serialization properties, in JAXP format, if the result is to
be serialized. This parameter can be defaulted to null. Values supplied
here take precedence over any values supplied in the query source using the
saxon:output option declaration.
XPathException
- if the query fails.public Configuration getConfiguration()
public Executable getExecutable()
public abstract void initializeGlobals(XPathContext context) throws XPathException
context
- the XPath dynamic context
XPathException
public abstract void importSchemata(Configuration config) throws SchemaException
run(javax.xml.transform.Result, java.util.Properties)
method; it can be called directly if required. It is
called automatically when the query is run from the command line.
config
- the Saxon Configuration (which must be schema-aware)
SchemaException
protected SlotManager getStackFrameMap()
public abstract void process(XPathContext context) throws XPathException
context
- the XPath dynamic context
XPathException
protected void typeError(String message, String code, XPathContext context) throws XPathException
XPathException
protected void dynamicError(String message, String code, XPathContext context) throws XPathException
XPathException
protected NodeInfo getContextNode(Item item) throws XPathException
item
- the context item
XPathException
- if the context item does not exist or is not a nodeprotected boolean generalCompare(SequenceIterator iter1, SequenceIterator iter2, SimpleAtomicComparer comparer, XPathContext context) throws XPathException
iter1
- the first operanditer2
- the second operandcomparer
- the comparer to be usedcontext
- the XPath dynamic context
XPathException
public void mainCommand(String[] args) throws Exception
args
- command line options
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |