FETPAPI 0.3.0.0
This project provides C++ classes which facilitate the developement of ETP1.2 clients and servers.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ETP_NS::AbstractSession Class Referenceabstract
Inheritance diagram for ETP_NS::AbstractSession:
ETP_NS::ClientSession ETP_NS::AbstractClientSessionCRTP< PlainClientSession > ETP_NS::AbstractClientSessionCRTP< SslClientSession > ETP_NS::AbstractClientSessionCRTP< Derived > ETP_NS::PlainClientSession ETP_NS::SslClientSession

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::DataspacegetDataspaces (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::DataspacegetDataspaceInfo (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::ResourcegetResources (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::DeletedResourcegetDeletedResources (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::DataObjectgetDataObjects (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::SubscriptionInfosubscriptions
 

Member Function Documentation

◆ close()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::close ( )
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.

◆ closeAndBlock()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::closeAndBlock ( )
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.

◆ copyDataspacesContent()

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.

Parameters
sourceDataspaceUrisETP general map : One each for each source dataspace to be copied. They are identified by their URI.
targetDataspaceUriThe URI of the ETP dataspace where the sourceDataspaces have to be copied by reference.
returnThe map keys corresponding to the dataspaces which have been successfully copied into the target dataspace.

◆ copyToDataspace()

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.

Parameters
sourceUrisETP general map : One each for each source dataobject to be copied. They are identified by their URI.
targetDataspaceUriThe URI of the ETP dataspace where the source dataobjects have to be copied by reference.
returnThe map keys corresponding to the dataobjects which have been successfully copied into the target dataspace.

◆ deleteDataObjects()

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.

Parameters
urisETP general map where the values MUST be the URIs of a data object to be deleted.
returnThe map keys corresponding to the dataObjects which have been deleted successfully.

◆ deleteDataspaces()

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.

Parameters
dataspaceUrisETP general map where the values must be the URIs for the dataspaces the customer wants to delete.
returnThe map keys corresponding to the dataspaces which have been deleted successfully.

◆ do_close()

virtual void ETP_NS::AbstractSession::do_close ( )
pure virtual

◆ do_read()

virtual void ETP_NS::AbstractSession::do_read ( )
pure virtual

◆ getDataObjects()

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.

Parameters
urisETP general map where the values MUST be the URIs of a data object to be retrieved.
returnThe received dataobjects in a map where the key makes the link between the asked uris and the received dataobjects.

◆ getDataspaceInfo()

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.

Parameters
dataspaceUrisETP general map : One each for each dataspace, identified by their URI, the customer wants to get info about.
returnThe dataspaces the store could return.

◆ getDataspaces()

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.

Parameters
storeLastWriteFilterAn 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).
returnThe available dataspaces the store could return.

◆ getDeletedResources()

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.

Parameters
dataspaceUriThe URI of the dataspace where the objects were deleted.
deleteTimeFilterAn 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).
dataObjectTypesFilter for the types of data objects you want. EXAMPLES: "witsml20.Well", "resqml20.obj_TectonicBoundaryFeature", "resqml20.*"
returnThe deleted resources corresponding to this query.

◆ getIdentifier()

const boost::uuids::uuid & ETP_NS::AbstractSession::getIdentifier ( )
inline

Return the identifier of the session which is an UUID. If the ETP session is not set up, it returns the nil UUID.

◆ getResources()

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.

Parameters
contextIncludes 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.
scopeScope 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).
storeLastWriteFilterAn 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).
countObjectsIf true, the store provides counts of sources and targets for each resource identified by Discovery.
returnThe resources corresponding to this query.

◆ getTimeOut()

double ETP_NS::AbstractSession::getTimeOut ( ) const
inline

Get the time out in milliseconds used when blocking waiting for message

◆ isEtpSessionClosed()

FETPAPI_DLL_IMPORT_OR_EXPORT bool ETP_NS::AbstractSession::isEtpSessionClosed ( ) const
inline

Check if the ETP session (starting after the Core.OpenSession or Core.RequestSession message) is not opened yet or has been closed.

◆ isMessageStillProcessing()

FETPAPI_DLL_IMPORT_OR_EXPORT bool ETP_NS::AbstractSession::isMessageStillProcessing ( int64_t msgId)
inline

Check wether a particular ETP message has been responded or not by the other agent.

◆ isWebSocketSessionClosed()

FETPAPI_DLL_IMPORT_OR_EXPORT bool ETP_NS::AbstractSession::isWebSocketSessionClosed ( ) const
inline

Check if the websocket session (starting after the HTTP handshake/upgrade) is not opened yet or has been closed.

◆ lockDataspaces()

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.

Parameters
dataspaceUrisETP general map where the values must be the URIs for the dataspaces the customer wants to lock or unlock.
locktrue for locking the dataspaces, false to unlock the dataspaces
returnThe map keys corresponding to the dataspaces which have been successfully locked or unlocked.

◆ on_read()

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

◆ putDataObjects()

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.

Parameters
urisETP general map where the values MUST be the data for each data object in the request, including each one's URI.
returnThe map keys corresponding to the dataObjects which have been put successfully.

◆ putDataspaces()

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.

Parameters
dataspacesETP general map : One each for each dataspace the customer wants to add or update.
returnThe map keys corresponding to the dataspaces which have been put successfully into the store.

◆ rollbackTransaction()

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.

◆ send()

template<typename T >
int64_t ETP_NS::AbstractSession::send ( const T & mb,
int64_t correlationId = 0,
int32_t messageFlags = 0 )
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.

Parameters
mbThe ETP message body to send
correlationIdThe ID of the message which this message is answering to.
messageFlagsThe message flags to be sent within the header
Returns
The ID of the message that has been put in the sending queue.

◆ sendAndBlock()

template<typename T >
void ETP_NS::AbstractSession::sendAndBlock ( const T & mb,
int64_t correlationId = 0,
int32_t messageFlags = 0 )
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.

Parameters
mbThe ETP message body to send
correlationIdThe ID of the message which this message is answering to.
messageFlagsThe message flags to be sent within the header
Returns
The ID of the message that has been put in the sending queue.

◆ sendWithSpecificHandler()

template<typename T >
int64_t ETP_NS::AbstractSession::sendWithSpecificHandler ( const T & mb,
std::shared_ptr< ETP_NS::ProtocolHandlers > specificHandler,
int64_t correlationId = 0,
int32_t messageFlags = 0 )
inline

Send a message and register a specific handler for the response.

Parameters
mbThe ETP message body to send
specificHandlerThe handlers which are going to be called for the response to this sent message
correlationIdThe ID of the message which this message is answering to.
messageFlagsThe message flags to be sent within the header
Returns
The ID of the message that has been put in the sending queue.

◆ setCoreProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setCoreProtocolHandlers ( std::shared_ptr< CoreHandlers > coreHandlers)
inline

Set the Core protocol handlers

◆ setDataArrayProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setDataArrayProtocolHandlers ( std::shared_ptr< DataArrayHandlers > dataArrayHandlers)
inline

Set the Data Array protocol handlers

◆ setDataspaceOSDUProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setDataspaceOSDUProtocolHandlers ( std::shared_ptr< DataspaceOSDUHandlers > dataspaceOsduHandlers)
inline

Set the Dataspace protocol handlers

◆ setDataspaceProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setDataspaceProtocolHandlers ( std::shared_ptr< DataspaceHandlers > dataspaceHandlers)
inline

Set the Dataspace protocol handlers

◆ setDiscoveryProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setDiscoveryProtocolHandlers ( std::shared_ptr< DiscoveryHandlers > discoveryHandlers)
inline

Set the Discovery protocol handlers

◆ setStoreNotificationProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setStoreNotificationProtocolHandlers ( std::shared_ptr< ETP_NS::StoreNotificationHandlers > storeNotificationHandlers)
inline

Set the StoreNotification protocol handlers

◆ setStoreProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setStoreProtocolHandlers ( std::shared_ptr< StoreHandlers > storeHandlers)
inline

Set the Store protocol handlers

◆ setTimeOut()

void ETP_NS::AbstractSession::setTimeOut ( double timeOut)
inline

Set the time out in milliseconds used when blocking waiting for message

◆ setTransactionProtocolHandlers()

FETPAPI_DLL_IMPORT_OR_EXPORT void ETP_NS::AbstractSession::setTransactionProtocolHandlers ( std::shared_ptr< TransactionHandlers > transactionHandlers)
inline

Set the Transaction protocol handlers

◆ setVerbose()

void ETP_NS::AbstractSession::setVerbose ( bool verbose)
inline

Indicates if the session must be verbose or not

◆ startTransaction()

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.

Parameters
dataspaceUrisIndicates the dataspaces involved in the transaction. An empty STRING means the default dataspace. An empty LIST means all dataspaces.
readOnlyIndicates that the request in the transaction is read-only (i.e., "get" messages).

Member Data Documentation

◆ subscriptions

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.


The documentation for this class was generated from the following file: