public abstract class Session
extends java.lang.Object
This class defines methods for evaluating commands, either locally or via the client/server architecture.
The results of database commands are returned as strings. If an output
stream is specified in the constructor or with
setOutputStream(OutputStream), results are instead serialized
to that stream.
The class is implemented by the ClientSession and
LocalSession classes.
| Modifier and Type | Field and Description |
|---|---|
protected java.io.OutputStream |
out
Client output stream.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
add(java.lang.String path,
java.io.InputStream input)
Adds a document to the opened database.
|
abstract void |
close()
Closes the session.
|
abstract void |
create(java.lang.String name,
java.io.InputStream input)
Creates a database.
|
java.lang.String |
execute(Command command)
Executes a
Command and returns the result as string or serializes
it to the specified output stream. |
protected abstract void |
execute(Command cmd,
java.io.OutputStream os)
Executes a command and prints the result to the specified output stream.
|
java.lang.String |
execute(java.lang.String command)
Executes a command and returns the result as string or serializes
it to the specified output stream.
|
protected abstract void |
execute(java.lang.String cmd,
java.io.OutputStream os)
Executes a command and prints the result to the specified output stream.
|
java.lang.String |
info()
Returns command info as a string, regardless of whether an output stream
was specified.
|
abstract Query |
query(java.lang.String query)
Returns a query object for the specified query string.
|
abstract void |
replace(java.lang.String path,
java.io.InputStream input)
Replaces a document in an open database.
|
void |
setOutputStream(java.io.OutputStream output)
Specifies an output stream.
|
abstract void |
store(java.lang.String path,
java.io.InputStream input)
Stores raw data in an open database.
|
public final java.lang.String execute(Command command) throws java.io.IOException
Command and returns the result as string or serializes
it to the specified output stream.command - command to be executednull referencejava.io.IOException - I/O exceptionpublic final java.lang.String execute(java.lang.String command)
throws java.io.IOException
command - command to be parsednull referencejava.io.IOException - I/O exceptionpublic abstract Query query(java.lang.String query) throws java.io.IOException
query - query stringjava.io.IOException - I/O exceptionpublic abstract void create(java.lang.String name,
java.io.InputStream input)
throws java.io.IOException
name - name of databaseinput - xml inputjava.io.IOException - I/O exceptionpublic abstract void add(java.lang.String path,
java.io.InputStream input)
throws java.io.IOException
path - target pathinput - xml inputjava.io.IOException - I/O exceptionpublic abstract void replace(java.lang.String path,
java.io.InputStream input)
throws java.io.IOException
path - document(s) to replaceinput - new contentjava.io.IOException - I/O exceptionpublic abstract void store(java.lang.String path,
java.io.InputStream input)
throws java.io.IOException
path - target pathinput - binary inputjava.io.IOException - I/O exceptionpublic final java.lang.String info()
public final void setOutputStream(java.io.OutputStream output)
null as argument.output - client output stream.public abstract void close()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected abstract void execute(java.lang.String cmd,
java.io.OutputStream os)
throws java.io.IOException
cmd - command to be parsedos - output streamjava.io.IOException - I/O exceptionprotected abstract void execute(Command cmd, java.io.OutputStream os) throws java.io.IOException
cmd - command to be executedos - output streamjava.io.IOException - I/O exception