Hyperspace::REST::KeyValueResource Class Referenceabstract

Convenience RESTful-compliant Resource returning Key/Value payloads. More...

Inheritance diagram for Hyperspace::REST::KeyValueResource:

Public Member Functions

 KeyValueResource (const QByteArray &id)
 
- Public Member Functions inherited from Hyperspace::REST::Resource
 Resource (const QByteArray &id)
 
QByteArray id () const
 
virtual bool isValid ()=0
 
virtual void head (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload) Q_DECL_OVERRIDE
 Sends back a BadRequest Rebound by default. More...
 

Protected Member Functions

void sendKeyValueRebound (const KeyValueRebound &rebound)
 Sends a rebound with a Key/Value payload. More...
 
virtual void keyValueDelete (const QByteArray &waveId, const ByteArrayHash &attributes, const QVariantMap &data)=0
 Implement Wave DELETE method with a Key/Value pair. More...
 
virtual void keyValueGet (const QByteArray &waveId, const ByteArrayHash &attributes, const QVariantMap &data)=0
 Implement Wave GET method with a Key/Value pair. More...
 
virtual void keyValuePost (const QByteArray &waveId, const ByteArrayHash &attributes, const QVariantMap &data)=0
 Implement Wave POST method with a Key/Value pair. More...
 
virtual void keyValuePut (const QByteArray &waveId, const ByteArrayHash &attributes, const QVariantMap &data)=0
 Implement Wave PUT method with a Key/Value pair. More...
 
virtual void get (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload) Q_DECL_OVERRIDE Q_DECL_FINAL
 Implement Wave GET method. More...
 
virtual void httpDelete (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload) Q_DECL_OVERRIDE Q_DECL_FINAL
 Implement Wave DELETE method. More...
 
virtual void post (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload) Q_DECL_OVERRIDE Q_DECL_FINAL
 Implement Wave POST method. More...
 
virtual void put (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload) Q_DECL_OVERRIDE Q_DECL_FINAL
 Implement Wave PUT method. More...
 

Additional Inherited Members

- Protected Slots inherited from Hyperspace::AbstractWaveTarget
void sendRebound (const Hyperspace::Rebound &rebound)
 Send a rebound for a received wave. More...
 

Detailed Description

Convenience RESTful-compliant Resource returning Key/Value payloads.

KeyValueResource is a resource which implements RESTful resource semantics with Key/Value pair returns. Instead of standard AbstractWaveTarget methods, it exposes a higher level alternative which passes a VariantMap instead of a payload.

See also
Hyperspace::REST::Resource
Hyperspace::KeyValueSerializer

Constructor & Destructor Documentation

Hyperspace::REST::KeyValueResource::KeyValueResource ( const QByteArray &  id)
explicit

Constructs a new Resource

id An unique ID identifying the resource, and part of its path.

Member Function Documentation

void Hyperspace::REST::KeyValueResource::sendKeyValueRebound ( const KeyValueRebound rebound)
protected

Sends a rebound with a Key/Value payload.

This method is a convenience method which serves as an alternative to sendRebound. Instead of sending a Rebound it takes a KeyValueRebound, finalizes it, and sends it back to the caller. You should use this function instead of sendRebound when subclassing KeyValueResource.

rebound The Key/Value Rebound to return.

virtual void Hyperspace::REST::KeyValueResource::keyValueDelete ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QVariantMap &  data 
)
protectedpure virtual

Implement Wave DELETE method with a Key/Value pair.

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

waveId The internal waveId. Must be used to construct the Rebound. attributes The wave's attributes. data The payload as a Key/Value map.

virtual void Hyperspace::REST::KeyValueResource::keyValueGet ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QVariantMap &  data 
)
protectedpure virtual

Implement Wave GET method with a Key/Value pair.

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. data The payload as a Key/Value map.

Implemented in Hyperspace::REST::PropertyResource.

virtual void Hyperspace::REST::KeyValueResource::keyValuePost ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QVariantMap &  data 
)
protectedpure virtual

Implement Wave POST method with a Key/Value pair.

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. data The payload as a Key/Value map.

Implemented in Hyperspace::REST::PropertyResource.

virtual void Hyperspace::REST::KeyValueResource::keyValuePut ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QVariantMap &  data 
)
protectedpure virtual

Implement Wave PUT method with a Key/Value pair.

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. data The payload as a Key/Value map.

Implemented in Hyperspace::REST::PropertyResource.

void Hyperspace::REST::KeyValueResource::get ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
protectedvirtual

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.

Implements Hyperspace::AbstractWaveTarget.

void Hyperspace::REST::KeyValueResource::httpDelete ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
protectedvirtual

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.

Implements Hyperspace::AbstractWaveTarget.

void Hyperspace::REST::KeyValueResource::post ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
protectedvirtual

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.

Implements Hyperspace::AbstractWaveTarget.

void Hyperspace::REST::KeyValueResource::put ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
protectedvirtual

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.

Implements Hyperspace::AbstractWaveTarget.