-
openTransaction
Starts a transaction. You can pass the
transaction to the read(), write(), or delete() methods of a
document manager or the search() method of a query manager to
perform operations within a multistatement transaction. To call
openTransaction(), an application must authenticate as rest-writer
or rest-admin.
- Returns:
- a Transaction object identifying and supporting operations on
the transaction
- Throws:
ForbiddenUserException
FailedRequestException
-
openTransaction
Starts a transaction with the specified name,
which makes the transaction easier to recognize when you get status
reports.
- Parameters:
name - the transaction name
- Returns:
- a Transaction object identifying and supporting operations on
the transaction
- Throws:
ForbiddenUserException
FailedRequestException
-
openTransaction
Starts a transaction with the specified name and
time limit. If the transaction is not committed or rolled back
within the specified time, the transaction rolls back
automatically.
- Parameters:
name - the transaction name
timeLimit - the number of the transaction in
seconds
- Returns:
- a Transaction object identifying and supporting operations on
the transaction
- Throws:
ForbiddenUserException
FailedRequestException
-
newDocumentManager
Creates a document manager for documents with
unknown or heterogeneous formats.
- Returns:
- a manager supporting generic operations on documents
-
newBinaryDocumentManager
Creates a document manager for documents with a
binary format such as images.
- Returns:
- a manager supporting operations on binary documents
-
newJSONDocumentManager
Creates a document manager for documents
containing a JSON structure.
- Returns:
- a manager supporting operations on JSON documents
-
newTextDocumentManager
Creates a document manager for documents
containing unstructured text.
- Returns:
- a manager supporting operations on text documents
-
newXMLDocumentManager
Creates a document manager for documents
containing XML.
- Returns:
- a manager supporting operations on XMLdocuments
-
newDataMovementManager
Creates a manager for long-running asynchronous
write or query jobs. When the primary database client has the
default ConnectionType.DIRECT connection type, the
DataMovementManager creates a new connection for each host that has
forests for the database. When the primary database client has the
ConnectionType.GATEWAY connection type (for instance, when
connecting to a load balancer), the DataMovementManager uses the
primary database client for all communication. Don't forget to call
dataMovementManager.release() when you're done with it.
- Returns:
- a manager supporting long-running asynchronous write or query
jobs
-
newQueryManager
Creates a manager to query for database
documents.
- Returns:
- a manager supporting search operations and lookup of values and
tuples in indexes (also known as lexicons)
-
newRowManager
Creates a manager to retrieve rows from the
database.
- Returns:
- a manager supporting plans for processing database rows
-
newRuleManager
Creates a manager for building rules and
rules-matching applications.
- Returns:
- a manager for supporting rules and rule-match operations.
-
newServerConfigManager
Creates a manager for configuring the REST
server for the database. The ServerConfigurationManager can persist
query options and transforms or set properties of the server. The
application must have rest-admin privileges to use the
ServerConfigurationManager.
- Returns:
- a manager for the server properties or administrative
resources
-
newGraphManager
Creates a manager for CRUD operations on
semantic graphs.
- Returns:
- the new GraphManager instance
-
newSPARQLQueryManager
Creates a manager for executing SPARQL queries
and retrieving results.
- Returns:
- the new SPARQLQueryManager instance
-
newPojoRepository
Creates a PojoRepository specific to the
specified class and its id type. The PojoRepository provides a
facade for persisting, retrieving, and querying data contained in
Java objects. Annotations are required to identify the id field and
any fields for which you wish to create indexes.
- Type Parameters:
T - the pojo type this PojoRepository will
manage
ID - the scalar type of the id for pojos of type
<T>
- Parameters:
clazz - the class type for this PojoRepository to
handle
idClass - the class type of the id field for this
clazz, must obviously be Serializable or we'll struggle to marshall
it
- Returns:
- the initialized PojoRepository
-
init
Initializes a manager for a extension
resource.
- Type Parameters:
T - the type of ResourceManager to init for the
extension resource
- Parameters:
resourceName - the name of the extension
resource
resourceManager - the manager for the extension
resource
- Returns:
- the initialized resource manager
-
newLogger
Creates a logger for document and query
requests. To merge the logging output with the output from other
loggers, pass the output stream used by the other loggers.
- Parameters:
out - the output stream for the logging
output
- Returns:
- the logger for client requests
-
release
void release()
Closes the database client and releases
associated resources. After the client is closed, document and
query managers can no longer access the database.
-
getClientImplementation
Object getClientImplementation()
Returns the client object from the library that
implements communication with the server. You should call this
method only when you need short-term workarounds such as
configuring communication with the server. The client
implementation object and library may change without notice or be
removed without replacement in a future release. In addition, your
changes to the configuration of the client implementation object
could impair the operation of the MarkLogic Java Client API. In
short, the client implementation object should be used only on an
interim basis by experts who test thoroughly to avoid unwanted side
effects. You can call the getClass().getName() and
getClass().getPackage().getName() to discover the class of the
current implementation object.
- Returns:
- the object implementing communication with the server
-
newServerEval
Creates a ServerEvaluationCall for eval and
invoke of server-side xquery or javascript code. Eval requires the
xdbc:eval privilege and invoke requires the xdbc:invoke privilege.
If this DatabaseClient is pointed at a database different than the
default for this REST server, you will need the xdbc:eval-in or
xdbc:invoke-in privilege.
- Returns:
- the new ServerEvaluationCall instance
-
getConnectionType
How the client connects to MarkLogic.
- Returns:
- the connection type
-
checkConnection
Checks if the connection is valid.
- Returns:
DatabaseClient.ConnectionResult
with a connected property of true or false. In the false case it
contains the errorMessage property identifying the failure.
-
getHost
-
getPort
int getPort()
-
getBasePath
- Returns:
- optional base path associated with this client instance
- Since:
- 6.1.0
-
getDatabase
-
getSecurityContext
-
close
default void close()
Overridden from the Closeable
interface so that a user doesn't have to deal with a checked
IOException.
- Specified by:
close in
interface AutoCloseable
- Specified by:
close in
interface Closeable
- Since:
- 7.1.0