public interface DatabaseClient
A Database Client instantiates document and query managers and other objects with shared access to a database.
| Modifier and Type | Method and Description |
|---|---|
Object |
getClientImplementation()
Returns the client object from the library that implements communication with the server.
|
String |
getDatabase() |
String |
getHost() |
int |
getPort() |
DatabaseClientFactory.SecurityContext |
getSecurityContext() |
<T extends ResourceManager> |
init(String resourceName,
T resourceManager)
Initializes a manager for a extension resource.
|
BinaryDocumentManager |
newBinaryDocumentManager()
Creates a document manager for documents with a binary format such as images.
|
DataMovementManager |
newDataMovementManager()
Creates a manager for long-running asynchronous write or query jobs.
|
GenericDocumentManager |
newDocumentManager()
Creates a document manager for documents with unknown or heterogeneous formats.
|
GraphManager |
newGraphManager()
Creates a manager for CRUD operations on semantic graphs.
|
JSONDocumentManager |
newJSONDocumentManager()
Creates a document manager for documents containing a JSON structure.
|
RequestLogger |
newLogger(OutputStream out)
Creates a logger for document and query requests.
|
<T,ID extends Serializable> |
newPojoRepository(Class<T> clazz,
Class<ID> idClass)
Creates a PojoRepository specific to the specified class and its id type.
|
QueryManager |
newQueryManager()
Creates a manager to query for database documents.
|
RowManager |
newRowManager()
Creates a manager to retrieve rows from the database.
|
RuleManager |
newRuleManager()
Creates a manager for building rules and rules-matching applications.
|
ServerConfigurationManager |
newServerConfigManager()
Creates a manager for configuring the REST server for the database.
|
ServerEvaluationCall |
newServerEval()
Creates a ServerEvaluationCall for eval and invoke of server-side xquery or javascript code.
|
SPARQLQueryManager |
newSPARQLQueryManager()
Creates a manager for executing SPARQL queries and retrieving results.
|
TextDocumentManager |
newTextDocumentManager()
Creates a document manager for documents containing unstructured text.
|
XMLDocumentManager |
newXMLDocumentManager()
Creates a document manager for documents containing XML.
|
Transaction |
openTransaction()
Starts a transaction.
|
Transaction |
openTransaction(String name)
Starts a transaction with the specified name, which makes the transaction easier to recognize when you get status reports.
|
Transaction |
openTransaction(String name,
int timeLimit)
Starts a transaction with the specified name and time limit.
|
void |
release()
Closes the database client and releases associated resources.
|
Transaction openTransaction() throws ForbiddenUserException, FailedRequestException
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.
ForbiddenUserExceptionFailedRequestExceptionTransaction openTransaction(String name) throws ForbiddenUserException, FailedRequestException
Starts a transaction with the specified name, which makes the transaction easier to recognize when you get status reports.
name - the transaction nameForbiddenUserExceptionFailedRequestExceptionTransaction openTransaction(String name, int timeLimit) throws ForbiddenUserException, FailedRequestException
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.
name - the transaction nametimeLimit - the number of the transaction in secondsForbiddenUserExceptionFailedRequestExceptionGenericDocumentManager newDocumentManager()
Creates a document manager for documents with unknown or heterogeneous formats.
BinaryDocumentManager newBinaryDocumentManager()
Creates a document manager for documents with a binary format such as images.
JSONDocumentManager newJSONDocumentManager()
Creates a document manager for documents containing a JSON structure.
TextDocumentManager newTextDocumentManager()
Creates a document manager for documents containing unstructured text.
XMLDocumentManager newXMLDocumentManager()
Creates a document manager for documents containing XML.
DataMovementManager newDataMovementManager()
Creates a manager for long-running asynchronous write or query jobs. Don’t forget to call dataMovementManager.release() when you’re done with it.
QueryManager newQueryManager()
Creates a manager to query for database documents.
RowManager newRowManager()
Creates a manager to retrieve rows from the database.
RuleManager newRuleManager()
Creates a manager for building rules and rules-matching applications.
ServerConfigurationManager 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.
GraphManager newGraphManager()
Creates a manager for CRUD operations on semantic graphs.
SPARQLQueryManager newSPARQLQueryManager()
Creates a manager for executing SPARQL queries and retrieving results.
<T,ID extends Serializable> PojoRepository<T,ID> newPojoRepository(Class<T> clazz, Class<ID> idClass)
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.
T - the pojo type this PojoRepository will manageID - the scalar type of the id for pojos of type <T>clazz - the class type for this PojoRepository to handleidClass - the class type of the id field for this clazz, must obviously be Serializable or we’ll struggle to marshall it<T extends ResourceManager> T init(String resourceName, T resourceManager)
Initializes a manager for a extension resource.
T - the type of ResourceManager to init for the extension resourceresourceName - the name of the extension resourceresourceManager - the manager for the extension resourceRequestLogger newLogger(OutputStream out)
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.
out - the output stream for the logging outputvoid release()
Closes the database client and releases associated resources. After the client is closed, document and query managers can no longer access the database.
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.
ServerEvaluationCall 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.
String getHost()
int getPort()
String getDatabase()
DatabaseClientFactory.SecurityContext getSecurityContext()
Copyright © 2013-2017 MarkLogic Corporation.