|
XCC/J 3.2-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.marklogic.xcc.examples.ModuleRunner
This is a very simple class that will invoke a named XQuery module on the server and return the result.
Click here for the source code for this class
The main() method looks for two command-line args,
a URL for the server
(ContentSourceFactory.newContentSource(java.net.URI))
and theURI of a module to invoke. This URI should be relative
to the "Library" path set in the XDBC server configuration
for the content server you're connection to (arg #1).
This program invokes the named module and then prints the
result sequence to stdout, one item per line.
The class has methods the could be used to set request options
and to obtain the results as an array of Strings or as a real
ResultSequence.
If you want to set external variables for a request, you can
call getRequest() to obtain a reference to the internal
Request object and set the variable values on it before
calling invoke(String).
ToDo: Accept variable names and values on the command line.
| Constructor Summary | |
ModuleRunner(URI serverUri)
Construct an instance that will invoke modules on the server represented by the given URI. |
|
| Method Summary | |
Request |
getRequest()
Returns the Request object used internally to submit
requests. |
ResultSequence |
invoke(String moduleUri)
Invoke the module with the given URI and return the resulting ResultSequence. |
String |
invokeToSingleString(String moduleUri,
String separator)
|
String[] |
invokeToStringArray(String moduleUri)
|
static void |
main(String[] args)
|
void |
setRequestOptions(RequestOptions options)
Set (or clear) the RequestOptions instance to associate
with submitted queries. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ModuleRunner(URI serverUri)
throws XccConfigException
serverUri - A URI that specifies a server per
(ContentSourceFactory.newContentSource(java.net.URI)).
XccConfigException - If the URI is not a valid XCC server URL.| Method Detail |
public ResultSequence invoke(String moduleUri)
throws RequestException
ResultSequence.
moduleUri -
ResultSequence, possibly with size zero.
RequestException - If an unrecoverable error occurs when submitting
or evaluating the request.
public String[] invokeToStringArray(String moduleUri)
throws RequestException
RequestException
public String invokeToSingleString(String moduleUri,
String separator)
throws RequestException
RequestExceptionpublic Request getRequest()
Request object used internally to submit
requests. This object can be used to set external variables
that will be bound to the query when submitted. You should
not set your own RequestOptions object, use
setRequestOptions(com.marklogic.xcc.RequestOptions)
instead.
Request.public void setRequestOptions(RequestOptions options)
RequestOptions instance to associate
with submitted queries.
options - An instance of RequestOptions or null.
public static void main(String[] args)
throws Exception
Exception
|
XCC/J 3.2-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com