Package org.basex.api.client
Class LocalSession
java.lang.Object
org.basex.api.client.Session
org.basex.api.client.LocalSession
- All Implemented Interfaces:
Closeable,AutoCloseable
This class offers methods to locally execute database commands.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionLocalSession(Context context) Default constructor.LocalSession(Context context, OutputStream output) Constructor, specifying an output stream.LocalSession(Context context, String username, String password) Constructor, specifying login data.LocalSession(Context context, String username, String password, OutputStream output) Constructor, specifying login data and an output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String path, InputStream input) Adds a document to the opened database.voidclose()context()Returns the associated database context.voidcreate(String name, InputStream input) Creates a database.protected voidexecute(String command, OutputStream output) Executes a command and prints the result to the specified output stream.protected voidexecute(Command command, OutputStream output) Executes a command and prints the result to the specified output stream.Returns a query object for the specified query string.voidreplace(String path, InputStream input) Replaces a document in an open database.voidstore(String path, InputStream input) Stores raw data in an open database.Methods inherited from class org.basex.api.client.Session
execute, execute, getOutputStream, info, setOutputStream
-
Constructor Details
-
LocalSession
Default constructor.- Parameters:
context- context
-
LocalSession
Constructor, specifying an output stream.- Parameters:
context- contextoutput- client output; if set tonull, results will be returned as strings
-
LocalSession
Constructor, specifying login data.- Parameters:
context- contextusername- user namepassword- password (plain text)- Throws:
LoginException- login exception
-
LocalSession
public LocalSession(Context context, String username, String password, OutputStream output) throws LoginException Constructor, specifying login data and an output stream.- Parameters:
context- contextusername- user namepassword- password (plain text)output- client output; if set tonull, results will be returned as strings- Throws:
LoginException- login exception
-
-
Method Details
-
create
Description copied from class:SessionCreates a database.- Specified by:
createin classSession- Parameters:
name- name of databaseinput- xml input- Throws:
BaseXException
-
add
Description copied from class:SessionAdds a document to the opened database.- Specified by:
addin classSession- Parameters:
path- target pathinput- xml input- Throws:
BaseXException
-
replace
Description copied from class:SessionReplaces a document in an open database.- Specified by:
replacein classSession- Parameters:
path- document(s) to replaceinput- new content- Throws:
BaseXException
-
store
Description copied from class:SessionStores raw data in an open database.- Specified by:
storein classSession- Parameters:
path- target pathinput- binary input- Throws:
BaseXException
-
query
Description copied from class:SessionReturns a query object for the specified query string. -
close
public void close() -
execute
Description copied from class:SessionExecutes a command and prints the result to the specified output stream.- Specified by:
executein classSession- Parameters:
command- command to be parsedoutput- output stream- Throws:
BaseXException
-
execute
Description copied from class:SessionExecutes a command and prints the result to the specified output stream.- Specified by:
executein classSession- Parameters:
command- command to be executedoutput- output stream- Throws:
BaseXException
-
context
Returns the associated database context. Called from the XQJ driver.- Returns:
- database context
-