FETPAPI 0.3.0.0
This project provides C++ classes which facilitate the developement of ETP1.2 clients and servers.
|
Public Member Functions | |
const boost::uuids::uuid & | getIdentifier () |
void | setTimeOut (double timeOut) |
double | getTimeOut () const |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setCoreProtocolHandlers (std::shared_ptr< CoreHandlers > coreHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setDiscoveryProtocolHandlers (std::shared_ptr< DiscoveryHandlers > discoveryHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setStoreProtocolHandlers (std::shared_ptr< StoreHandlers > storeHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setStoreNotificationProtocolHandlers (std::shared_ptr< ETP_NS::StoreNotificationHandlers > storeNotificationHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setDataArrayProtocolHandlers (std::shared_ptr< DataArrayHandlers > dataArrayHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setTransactionProtocolHandlers (std::shared_ptr< TransactionHandlers > transactionHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setDataspaceProtocolHandlers (std::shared_ptr< DataspaceHandlers > dataspaceHandlers) |
FETPAPI_DLL_IMPORT_OR_EXPORT void | setDataspaceOSDUProtocolHandlers (std::shared_ptr< DataspaceOSDUHandlers > dataspaceOsduHandlers) |
template<typename T > | |
int64_t | send (const T &mb, int64_t correlationId=0, int32_t messageFlags=0) |
template<typename T > | |
void | sendAndBlock (const T &mb, int64_t correlationId=0, int32_t messageFlags=0) |
template<typename T > | |
int64_t | sendWithSpecificHandler (const T &mb, std::shared_ptr< ETP_NS::ProtocolHandlers > specificHandler, int64_t correlationId=0, int32_t messageFlags=0) |
virtual void | do_close ()=0 |
virtual void | do_read ()=0 |
FETPAPI_DLL_IMPORT_OR_EXPORT void | on_read (boost::system::error_code ec, std::size_t bytes_transferred) |
void | on_write (boost::system::error_code ec, std::size_t) |
void | on_close (boost::system::error_code ec) |
FETPAPI_DLL_IMPORT_OR_EXPORT bool | isWebSocketSessionClosed () const |
FETPAPI_DLL_IMPORT_OR_EXPORT bool | isMessageStillProcessing (int64_t msgId) |
virtual void | setMaxWebSocketMessagePayloadSize (int64_t value)=0 |
int64_t | getMaxWebSocketMessagePayloadSize () const |
FETPAPI_DLL_IMPORT_OR_EXPORT void | close () |
FETPAPI_DLL_IMPORT_OR_EXPORT void | closeAndBlock () |
FETPAPI_DLL_IMPORT_OR_EXPORT bool | isEtpSessionClosed () const |
void | setEtpSessionClosed (bool etpSessionClosed_) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::Dataspace > | getDataspaces (int64_t storeLastWriteFilter=-1) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | putDataspaces (const std::map< std::string, Energistics::Etp::v12::Datatypes::Object::Dataspace > &dataspaces) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | deleteDataspaces (const std::map< std::string, std::string > &dataspaceUris) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::Dataspace > | getDataspaceInfo (const std::map< std::string, std::string > &dataspaceUris) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | copyDataspacesContent (const std::map< std::string, std::string > &sourceDataspaceUris, const std::string &targetDataspaceUri) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | lockDataspaces (const std::map< std::string, std::string > &dataspaceUris, bool lock) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | copyToDataspace (const std::map< std::string, std::string > &sourceUris, const std::string &targetDataspaceUri) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::Resource > | getResources (const Energistics::Etp::v12::Datatypes::Object::ContextInfo &context, const Energistics::Etp::v12::Datatypes::Object::ContextScopeKind &scope, int64_t storeLastWriteFilter=-1, bool countObjects=false) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::DeletedResource > | getDeletedResources (const std::string &dataspaceUri, int64_t deleteTimeFilter=-1, const std::vector< std::string > &dataObjectTypes={}) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::map< std::string, Energistics::Etp::v12::Datatypes::Object::DataObject > | getDataObjects (const std::map< std::string, std::string > &uris) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | putDataObjects (const std::map< std::string, Energistics::Etp::v12::Datatypes::Object::DataObject > &dataObjects) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > | deleteDataObjects (const std::map< std::string, std::string > &uris) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::string | startTransaction (std::vector< std::string > dataspaceUris={}, bool readOnly=false) |
FETPAPI_DLL_IMPORT_OR_EXPORT std::string | rollbackTransaction () |
FETPAPI_DLL_IMPORT_OR_EXPORT std::string | commitTransaction () |
void | setVerbose (bool verbose) |
void | fesapi_log () |
template<typename First , typename ... Rest> | |
void | fesapi_log (First &&first, Rest &&...rest) |
Public Attributes | |
std::unordered_map< int64_t, Energistics::Etp::v12::Datatypes::Object::SubscriptionInfo > | subscriptions |
|
inline |
Send a message for closing to the server after having sent all previous messages. The session would really close only after all messages have been sent and responded. This method does not block.
|
inline |
Send a message for closing to the server after having sent all previous messages. The session would really close only after all messages have been sent and responded. This method does block.
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::copyDataspacesContent | ( | const std::map< std::string, std::string > & | sourceDataspaceUris, |
const std::string & | targetDataspaceUri ) |
Copy by reference some dataspaces into another one. This function should be used with caution if Dataspace OSDU Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
sourceDataspaceUris | ETP general map : One each for each source dataspace to be copied. They are identified by their URI. |
targetDataspaceUri | The URI of the ETP dataspace where the sourceDataspaces have to be copied by reference. |
return | The map keys corresponding to the dataspaces which have been successfully copied into the target dataspace. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::copyToDataspace | ( | const std::map< std::string, std::string > & | sourceUris, |
const std::string & | targetDataspaceUri ) |
Copy by reference some dataobjects into another dataspace. This function should be used with caution if Dataspace OSDU Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
sourceUris | ETP general map : One each for each source dataobject to be copied. They are identified by their URI. |
targetDataspaceUri | The URI of the ETP dataspace where the source dataobjects have to be copied by reference. |
return | The map keys corresponding to the dataobjects which have been successfully copied into the target dataspace. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::deleteDataObjects | ( | const std::map< std::string, std::string > & | uris | ) |
A customer sends to a store to delete one or more data objects from the store.
This function should be used with caution if Store Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
uris | ETP general map where the values MUST be the URIs of a data object to be deleted. |
return | The map keys corresponding to the dataObjects which have been deleted successfully. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::deleteDataspaces | ( | const std::map< std::string, std::string > & | dataspaceUris | ) |
A customer sends to a store to delete one or more dataspaces. This function should be used with caution if Dataspace Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
dataspaceUris | ETP general map where the values must be the URIs for the dataspaces the customer wants to delete. |
return | The map keys corresponding to the dataspaces which have been deleted successfully. |
|
pure virtual |
Close the web socket session (without sending any ETP message)
Implemented in ETP_NS::AbstractClientSessionCRTP< Derived >, ETP_NS::AbstractClientSessionCRTP< PlainClientSession >, and ETP_NS::AbstractClientSessionCRTP< SslClientSession >.
|
pure virtual |
Read what is on the websocket
Implemented in ETP_NS::AbstractClientSessionCRTP< Derived >, ETP_NS::AbstractClientSessionCRTP< PlainClientSession >, and ETP_NS::AbstractClientSessionCRTP< SslClientSession >.
FETPAPI_DLL_IMPORT_OR_EXPORT std::map< std::string, Energistics::Etp::v12::Datatypes::Object::DataObject > ETP_NS::AbstractSession::getDataObjects | ( | const std::map< std::string, std::string > & | uris | ) |
A customer sends to a store to get one or more data objects, each identified by a URI. This function should be used with caution if Store Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
uris | ETP general map where the values MUST be the URIs of a data object to be retrieved. |
return | The received dataobjects in a map where the key makes the link between the asked uris and the received dataobjects. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::Dataspace > ETP_NS::AbstractSession::getDataspaceInfo | ( | const std::map< std::string, std::string > & | dataspaceUris | ) |
A customer sends to a store to discover information of particular dataspaces. This function should be used with caution if Dataspace OSDU Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
dataspaceUris | ETP general map : One each for each dataspace, identified by their URI, the customer wants to get info about. |
return | The dataspaces the store could return. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::Dataspace > ETP_NS::AbstractSession::getDataspaces | ( | int64_t | storeLastWriteFilter = -1 | ) |
A customer sends to a store to discover all dataspaces available on the store. This function should be used with caution if Dataspace Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
storeLastWriteFilter | An optional filter to limit the dataspaces returned by date/time last saved to the store. The store returns a list of dataspaces whose last changed date/time is greater than the specified date/time. It must be a UTC dateTime value, serialized as a positive int 64bits, using the Avro logical type timestamp-micros (microseconds from the Unix Epoch, 1 January 1970 00:00:00.000000 UTC). |
return | The available dataspaces the store could return. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::DeletedResource > ETP_NS::AbstractSession::getDeletedResources | ( | const std::string & | dataspaceUri, |
int64_t | deleteTimeFilter = -1, | ||
const std::vector< std::string > & | dataObjectTypes = {} ) |
A customer sends to a store to discover data objects that have been deleted (which are sometimes called "tombstones"). This function should be used with caution if Discovery Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
dataspaceUri | The URI of the dataspace where the objects were deleted. |
deleteTimeFilter | An optional filter to filter the discovery on a date when the data object was deleted in a particular store. The store returns resources for objects whose delete times are greater than this value. It must be a UTC dateTime value, serialized as a positive int 64bits, using the Avro logical type timestamp-micros (microseconds from the Unix Epoch, 1 January 1970 00:00:00.000000 UTC). |
dataObjectTypes | Filter for the types of data objects you want. EXAMPLES: "witsml20.Well", "resqml20.obj_TectonicBoundaryFeature", "resqml20.*" |
return | The deleted resources corresponding to this query. |
|
inline |
Return the identifier of the session which is an UUID. If the ETP session is not set up, it returns the nil UUID.
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< Energistics::Etp::v12::Datatypes::Object::Resource > ETP_NS::AbstractSession::getResources | ( | const Energistics::Etp::v12::Datatypes::Object::ContextInfo & | context, |
const Energistics::Etp::v12::Datatypes::Object::ContextScopeKind & | scope, | ||
int64_t | storeLastWriteFilter = -1, | ||
bool | countObjects = false ) |
A Customer sends this message to a store to discover data objects in the store. This function should be used with caution if Discovery Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
context | Includes the URI of the dataspace or data object to begin the discovery, what specific types of data objects are of interest, and how many "levels" of relationships in the model to discover, among others. |
scope | Scope is specified in reference to the URI (which is entered in the context field). It indicates which direction in the graph that the operation should proceed (targets or sources) and whether or not to include the starting point (self). |
storeLastWriteFilter | An optional filter to filter the discovery on a date when the data object was last written in a particular store. The store returns resources whose storeLastWrite date/time is GREATER than the date/time specified in this filter field. It must be a UTC dateTime value, serialized as a positive int 64bits, using the Avro logical type timestamp-micros (microseconds from the Unix Epoch, 1 January 1970 00:00:00.000000 UTC). |
countObjects | If true, the store provides counts of sources and targets for each resource identified by Discovery. |
return | The resources corresponding to this query. |
|
inline |
Get the time out in milliseconds used when blocking waiting for message
|
inline |
Check if the ETP session (starting after the Core.OpenSession or Core.RequestSession message) is not opened yet or has been closed.
|
inline |
Check wether a particular ETP message has been responded or not by the other agent.
|
inline |
Check if the websocket session (starting after the HTTP handshake/upgrade) is not opened yet or has been closed.
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::lockDataspaces | ( | const std::map< std::string, std::string > & | dataspaceUris, |
bool | lock ) |
A customer sends to a store to lock or unlock one or more dataspaces. This function should be used with caution if Dataspace OSDU Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
dataspaceUris | ETP general map where the values must be the URIs for the dataspaces the customer wants to lock or unlock. |
lock | true for locking the dataspaces, false to unlock the dataspaces |
return | The map keys corresponding to the dataspaces which have been successfully locked or unlocked. |
FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::on_read | ( | boost::system::error_code | ec, |
std::size_t | bytes_transferred ) |
This method is called each time a message is received on the web socket
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::putDataObjects | ( | const std::map< std::string, Energistics::Etp::v12::Datatypes::Object::DataObject > & | dataObjects | ) |
A customer sends to a store to add or update one or more data objects. This function should be used with caution if Store Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
uris | ETP general map where the values MUST be the data for each data object in the request, including each one's URI. |
return | The map keys corresponding to the dataObjects which have been put successfully. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::vector< std::string > ETP_NS::AbstractSession::putDataspaces | ( | const std::map< std::string, Energistics::Etp::v12::Datatypes::Object::Dataspace > & | dataspaces | ) |
A customer sends to a store to create one or more dataspaces. This function should be used with caution if Dataspace Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
dataspaces | ETP general map : One each for each dataspace the customer wants to add or update. |
return | The map keys corresponding to the dataspaces which have been put successfully into the store. |
FETPAPI_DLL_IMPORT_OR_EXPORT std::string ETP_NS::AbstractSession::rollbackTransaction | ( | ) |
A customer sends to a store to commit and end a transaction. This message implies that the customer has received from or sent to the store all the data required for some purpose. The customer asserts that the data sent in the scope of this transaction is a consistent unit of work. It actually sends a message and block the current thread untill a response has been received from the store.
|
inline |
Create a default ETP message header from the ETP message body. Encode this created default ETP message header + the ETP message body and put the result in the sending queue.
mb | The ETP message body to send |
correlationId | The ID of the message which this message is answering to. |
messageFlags | The message flags to be sent within the header |
|
inline |
Send a message to the server and block the thread until the answer of the server has been processed by the handlers Please look at setTimeOut if you want to set the default timeout value which is 10 000 ms.
mb | The ETP message body to send |
correlationId | The ID of the message which this message is answering to. |
messageFlags | The message flags to be sent within the header |
|
inline |
Send a message and register a specific handler for the response.
mb | The ETP message body to send |
specificHandler | The handlers which are going to be called for the response to this sent message |
correlationId | The ID of the message which this message is answering to. |
messageFlags | The message flags to be sent within the header |
|
inline |
Set the Core protocol handlers
|
inline |
Set the Data Array protocol handlers
|
inline |
Set the Dataspace protocol handlers
|
inline |
Set the Dataspace protocol handlers
|
inline |
Set the Discovery protocol handlers
|
inline |
Set the StoreNotification protocol handlers
|
inline |
Set the Store protocol handlers
|
inline |
Set the time out in milliseconds used when blocking waiting for message
|
inline |
Set the Transaction protocol handlers
|
inline |
Indicates if the session must be verbose or not
FETPAPI_DLL_IMPORT_OR_EXPORT std::string ETP_NS::AbstractSession::startTransaction | ( | std::vector< std::string > | dataspaceUris = {}, |
bool | readOnly = false ) |
A customer sends to a store to begin a transaction. This function should be used with caution if Transaction Handlers have been overidden. It actually sends a message and block the current thread untill a response has been received from the store.
dataspaceUris | Indicates the dataspaces involved in the transaction. An empty STRING means the default dataspace. An empty LIST means all dataspaces. |
readOnly | Indicates that the request in the transaction is read-only (i.e., "get" messages). |
std::unordered_map<int64_t, Energistics::Etp::v12::Datatypes::Object::SubscriptionInfo> ETP_NS::AbstractSession::subscriptions |
The list of subscriptions recorded by customers on this session.