Hyperspace::AbstractWaveTarget Class Referenceabstract

The base class for Applications to act as Wave targets. More...

#include <HyperspaceCore/AbstractWaveTarget>

Inheritance diagram for Hyperspace::AbstractWaveTarget:

Public Member Functions

virtual void get (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave GET method. More...
 
virtual void head (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave HEAD method. More...
 
virtual void httpDelete (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave DELETE method. More...
 
virtual void post (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave POST method. More...
 
virtual void put (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave PUT method. More...
 

Protected Slots

void sendRebound (const Hyperspace::Rebound &rebound)
 Send a rebound for a received wave. More...
 

Detailed Description

The base class for Applications to act as Wave targets.

AbstractWaveTarget is the most basic method for applications to expose resources over Hyperspace. It is rarely used: most of the times you'll want one of the higher level alternatives contained in other Hyperspace modules instead.

Applications must reimplement AbstractWaveTarget to process any incoming Wave. For each Wave method, a pure virtual function is given, and it shall return at any time a Rebound via sendRebound.

A Wave Target, to be exported, must be registered into a Gate. Each Wave Target has its own path, which is always relative to the base target path of its Gate. The full URL to a Wave Target is /<capability>/<gate-target>/<wave-target>.

Asynchronicity
Wave targets are designed to be asynchronous, so the reply can be delayed while the application processes the request. For this reason, no return value is expected from any Wave method, but sendRebound should be called instead.
See also
Hyperspace::Rebound
Hyperspace::Gate

Member Function Documentation

virtual void Hyperspace::AbstractWaveTarget::get ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
pure virtual

Implement Wave GET method.

Reimplement this method to act when a GET Wave is sent.

waveId The internal waveId. Must be used to construct the Rebound. attributes The wave's attributes. payload The wave payload, if any.

Implemented in Hyperspace::REST::KeyValueCollection, and Hyperspace::REST::KeyValueResource.

virtual void Hyperspace::AbstractWaveTarget::head ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
pure virtual

Implement Wave HEAD method.

Reimplement this method to act when a HEAD Wave is sent.

waveId The internal waveId. Must be used to construct the Rebound. attributes The wave's attributes. payload The wave payload, if any.

Implemented in Hyperspace::REST::Collection, and Hyperspace::REST::Resource.

virtual void Hyperspace::AbstractWaveTarget::httpDelete ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
pure virtual

Implement Wave DELETE method.

Reimplement this method to act when a DELETE Wave is sent.

Note
This naming is due to delete being a reserved keyword.

waveId The internal waveId. Must be used to construct the Rebound. attributes The wave's attributes. payload The wave payload, if any.

Implemented in Hyperspace::REST::KeyValueCollection, and Hyperspace::REST::KeyValueResource.

virtual void Hyperspace::AbstractWaveTarget::post ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
pure virtual

Implement Wave POST method.

Reimplement this method to act when a POST Wave is sent.

waveId The internal waveId. Must be used to construct the Rebound. attributes The wave's attributes. payload The wave payload, if any.

Implemented in Hyperspace::REST::KeyValueCollection, and Hyperspace::REST::KeyValueResource.

virtual void Hyperspace::AbstractWaveTarget::put ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
pure virtual

Implement Wave PUT method.

Reimplement this method to act when a PUT Wave is sent.

waveId The internal waveId. Must be used to construct the Rebound. attributes The wave's attributes. payload The wave payload, if any.

Implemented in Hyperspace::REST::KeyValueCollection, and Hyperspace::REST::KeyValueResource.

void Hyperspace::AbstractWaveTarget::sendRebound ( const Hyperspace::Rebound rebound)
protectedslot

Send a rebound for a received wave.

Call this method upon processing a wave. The rebound must have the same ID of its corresponding Wave.