|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.codegen.QueryCompiler
public class QueryCompiler
This class handles the compilation (to Java) of a query
Constructor Summary | |
---|---|
QueryCompiler(Configuration config)
Create a QueryCompiler |
Method Summary | |
---|---|
File |
compileQueryToJava(InputStream input,
String encoding)
Compile a query to Java source code |
String |
getBaseURI()
Get the static base URI of the query |
String |
getClassName()
Get the name of the Java class containing the compiled query |
File |
getErrorFile()
Get the file that is used to contain any output from the Java compiler, such as error or warning messages |
File |
getOutputDirectory()
Get the output directory used to contain the generated .class files |
String |
getSuperClassName()
Get the name of the Java class to be used as the superclass the compiled query. |
boolean |
isExplain()
Determine whether explanation of the optimized query has been requested |
boolean |
isInServletMode()
Determine whether explanation of the optimized query has been requested |
void |
runQuery(DynamicQueryContext dqc,
Result result,
Properties properties)
Load and run the compiled query. |
void |
setBaseURI(String baseURI)
Set the static base URI for the query |
void |
setClassName(String className)
Set the name of the Java class to be created to hold the compiled query. |
void |
setErrorFile(File errorFile)
Set the file that is used to contain any output from the Java compiler, such as error or warning messages |
void |
setExplain(boolean explain)
Set option to explain the optimized query by displaying the abstract syntax tree on System.err |
void |
setOutputDirectory(File outputDirectory)
Set the output directory to contain the generated .class files. |
void |
setServletMode(boolean servlet)
Set option to generate the compiled query as a servlet |
void |
setSuperClassName(String className)
Set the name of the Java class to be used as the superclass the compiled query. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryCompiler(Configuration config)
config
- the Saxon configurationMethod Detail |
---|
public void setBaseURI(String baseURI)
baseURI
- the static base URI of the querypublic String getBaseURI()
public void setErrorFile(File errorFile)
errorFile
- the file that is used to contain any output from the Java compiler, such
as error or warning messages. If no file is supplied, a file name is constructed by
appending ".errors.txt" to the Java file namepublic File getErrorFile()
public void setExplain(boolean explain)
public boolean isExplain()
public void setServletMode(boolean servlet)
public boolean isInServletMode()
public void setClassName(String className)
className
- the fully qualified class name, for example
"com.saxonica.compquery.AccountsQuery"public String getClassName()
public void setSuperClassName(String className)
CompiledUserQuery
or
CompiledQueryServlet
, or potentially any other class that contains
the methods called by the generated Java code. It is not necessary to supply a superclass;
if none is supplied, the superclass will be CompiledQueryServlet
if servlet mode is requested, or CompiledUserQuery
otherwise.
className
- the fully qualified name of the superclasspublic String getSuperClassName()
public void setOutputDirectory(File outputDirectory)
outputDirectory
- the output directory to contain the generated .class files.
If no file is supplied for the generated Java source code, then this directory will also
be used for the Java source.public File getOutputDirectory()
public File compileQueryToJava(InputStream input, String encoding) throws XPathException
input
- An InputStream giving access to the text of the XQuery query to be compiled, as a stream
of octetsencoding
- The encoding used to translate characters to octets in the query source. The parameter
may be null: in this case the query parser attempts to infer the encoding by inspecting the source,
and if that fails, it assumes UTF-8 encoding
XPathException
- if any failure occurs compiling the querypublic void runQuery(DynamicQueryContext dqc, Result result, Properties properties) throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException, SchemaException, XPathException
dqc
- The dynamic query context.result
- The destination for the query outputproperties
- Serialization properties
MalformedURLException
ClassNotFoundException
InstantiationException
IllegalAccessException
SchemaException
XPathException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |