MarkLogic Connect
MarkLogic Connect Client API Collection
|
Implements the Fake idiom. Provides a Fake connection to MarkLogic for testing. More...
#include <FakeConnection.hpp>
Public Member Functions | |
FakeConnection () | |
Creates a Connection instance. More... | |
~FakeConnection () | |
connection_configuration Connection configuration functions | |
void | configure (const std::string &hostname, const std::string &port, const std::string &username, const std::string &password, const bool usessl=false) override |
void | setDatabaseName (const std::string &db) override |
Sets the name of the database to query/update. Defaults to Documents. More... | |
std::string | getDatabaseName () override |
Returns the database name we're querying/updating. Defaults to Documents. More... | |
bool | connect () override |
Connects or tests the authentication in the connection. May not actually connect. More... | |
void | disconnect () override |
Frees up resources held by the connection, until the next call to connect. More... | |
http_raw RAW HTTP commands | |
Response * | doGet (const std::string &pathAndQuerystring) override |
Performs a HTTP GET Request against MarkLogic Server. More... | |
Response * | doPut (const std::string &pathAndQuerystring, const IDocumentContent &payload) override |
Performs a HTTP PUT Request against MarkLogic Server. More... | |
Response * | doPost (const std::string &pathAndQuerystring, const IDocumentContent &payload) override |
Performs a HTTP POST Request against MarkLogic Server. More... | |
Response * | doDelete (const std::string &pathAndQueryString) override |
Performs a HTTP DELETE Request against MarkLogic Server. More... | |
Public Member Functions inherited from mlclient::IConnection | |
MLCLIENT_API | IConnection ()=default |
Creates a Connection instance. More... | |
virtual | ~IConnection ()=default |
virtual MLCLIENT_API Response * | getDocument (Document &inout_document)=0 |
TODO add optional call parameters (E.g. fetch properties also) More... | |
virtual MLCLIENT_API Response * | getDocumentContent (Document &inout_document)=0 |
Populates the content of the specified document (MUST have a uri). More... | |
virtual MLCLIENT_API Response * | getDocumentProperties (Document &inout_document)=0 |
Populates the properties of the specified document (MUST have a uri). More... | |
virtual MLCLIENT_API Response * | getDocumentPermissions (Document &inout_document)=0 |
Populates the permissions of the specified document (MUST have a uri). More... | |
virtual MLCLIENT_API Response * | saveDocuments (const DocumentSet &documents, const long startPosInclusive, const long endPosInclusive)=0 |
Saves a set of documents as a single batch to MarkLogic Server. More... | |
virtual MLCLIENT_API Response * | saveDocument (const Document &doc)=0 |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID) More... | |
virtual MLCLIENT_API Response * | searchExtension (const std::string &extensionName, const SearchDescription &desc)=0 |
Performs a search against a REST extension that is compatible with POST /v1/search (i.e. Connection::search) More... | |
virtual MLCLIENT_API Response * | saveSearchOptions (const std::string &optionsName, const IDocumentContent *optionsDoc)=0 |
Saves search options to the server. More... | |
virtual MLCLIENT_API Response * | values (const std::string &valuesName, const std::string &optionsName)=0 |
Performs a values lookup in MarkLogic Server, returning the top values from the lexicon as per the search options configuration used. More... | |
virtual MLCLIENT_API Response * | valuesExtension (const std::string &extensionName, const std::string &valuesName, const std::string &optionsName, const SearchDescription &desc)=0 |
Performs a values against a REST extension that is compatible with POST /v1/search (i.e. Connection::search) More... | |
virtual MLCLIENT_API Response * | listRootCollections ()=0 |
Lists the top level collections. I.e. ones starting without a / or ones starting with a / but not containing a / character. More... | |
virtual MLCLIENT_API Response * | listCollections (const std::string &parentCollection)=0 |
Lists the immediate child collections of the specified parent Collections. More... | |
wrap_rest Convenience wrapper function calls for common MarkLogic REST API calls. | |
Response * | getDocument (const std::string &uri) override |
Retrieves a document from the server, at the given document URI (MarkLogic unique document ID) More... | |
Response * | saveDocumentContent (const std::string &uri, const IDocumentContent &payload) override |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID) More... | |
Response * | deleteDocument (const std::string &uri) override |
Deletes the specified document by URI. More... | |
Response * | search (const SearchDescription &desc) override |
Performs a search against the MarkLogic database given the provided search query, text and options. More... | |
Implements the Fake idiom. Provides a Fake connection to MarkLogic for testing.
This class operates on documents as if it were MarkLogic Server, storing them in memory. Search methods return the first n records as requested in the SearchDescription (default: first 10).
mlclient::internals::FakeConnection::FakeConnection | ( | ) |
Creates a Connection instance.
Defaults connection to admin/admin, localhost, nossl, port 8002, and the Documents database.
mlclient::internals::FakeConnection::~FakeConnection | ( | ) |
Destroys a Connection instance.
|
overridevirtual |
Configures this connection, providing connection override information - host, port, username, password and SSL usage
[in] | hostname | The hostname or IP address of the MarkLogic Server (or load balancer) to connect to |
[in] | port | A String representing the (numerical) port number of the MarkLogic Server (or load balancer) to connect to |
[in] | username | The username of the used to connect to MarkLogic Server as |
[in] | password | The plain text password used to authenticate the user to MarkLogic server with |
[in] | usessl | A bool representation whether to use SSL (i.e. a HTTPS url) or not |
Implements mlclient::IConnection.
|
overridevirtual |
Connects or tests the authentication in the connection. May not actually connect.
Implements mlclient::IConnection.
|
overridevirtual |
Deletes the specified document by URI.
[in] | uri | The document URI to delete |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Frees up resources held by the connection, until the next call to connect.
Implements mlclient::IConnection.
|
overridevirtual |
Performs a HTTP DELETE Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a HTTP DELETE REST request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire delete request. E.g. /v1/documents?uri=/my/doc.json |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Performs a HTTP GET Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a RESTful HTTP GET request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire get request. E.g. /v1/search?options=myoptions |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Performs a HTTP POST Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a RESTful HTTP POST request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire post request. E.g. /v1/search?options=myoptions |
[in] | payload | The DocumentContent to send to MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Performs a HTTP PUT Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a RESTful HTTP PUT request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire put request. E.g. /v1/search?options=myoptions |
[in] | payload | The DocumentContent to send to MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Returns the database name we're querying/updating. Defaults to Documents.
Implements mlclient::IConnection.
|
overridevirtual |
Retrieves a document from the server, at the given document URI (MarkLogic unique document ID)
Performs a GET /v1/documents?uri HTTP call
[in] | uri | The URI of the document to fetch from MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID)
Performs a call to PUT /v1/documents?ext in order to save a Document to MarkLogic Server
[in] | uri | The URI of the document to save to MarkLogic Server |
[in] | payload | The DocumentContent to send to MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Performs a search against the MarkLogic database given the provided search query, text and options.
Uses a SearchDescription value object to wrap complex search parameters for MarkLogic Server.
Performs a POST /v1/search HTTP POST to MarkLogic Server
[in] | desc | The SearchDescription defining the search, options, and query string |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implements mlclient::IConnection.
|
overridevirtual |
Sets the name of the database to query/update. Defaults to Documents.
[in] | The | string name (not internal MarkLogic numeric ID) of the database to query. |
Implements mlclient::IConnection.