Hyperspace::REST::KeyValueCollection Class Referenceabstract

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

Inheritance diagram for Hyperspace::REST::KeyValueCollection:

Public Member Functions

 KeyValueCollection (const QByteArray &path, ResourceFactory *factory)
 
- Public Member Functions inherited from Hyperspace::REST::Collection
 Collection (const QByteArray &path, ResourceFactory *factory)
 
QByteArray path () const
 
void deleteResource (const QByteArray &waveId, const QByteArray &resourceId, const ByteArrayHash &attributes, const QByteArray &payload)
 
void getResource (const QByteArray &waveId, const QByteArray &resourceId, const ByteArrayHash &attributes, const QByteArray &payload)
 
void postResource (const QByteArray &waveId, const QByteArray &resourceId, const ByteArrayHash &attributes, const QByteArray &payload)
 
void putResource (const QByteArray &waveId, const QByteArray &resourceId, const ByteArrayHash &attributes, const QByteArray &payload)
 
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...
 
- Protected Member Functions inherited from Hyperspace::REST::Collection
ResourceFactoryfactory () const
 
virtual ResourceloadResource (const QByteArray &id)=0
 

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 Collection returning Key/Value payloads.

KeyValueCollection is a collection which implements RESTful collection 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::Collection
Hyperspace::KeyValueSerializer

Constructor & Destructor Documentation

Hyperspace::REST::KeyValueCollection::KeyValueCollection ( const QByteArray &  path,
ResourceFactory factory 
)
explicit

Constructs a KeyValueCollection.

path The path to this collection, relative to the Gate's base target path. factory The ResourceFactory for this collection.

Member Function Documentation

void Hyperspace::REST::KeyValueCollection::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::KeyValueCollection::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.

Implemented in Hyperspace::REST::FixedCachedCollection.

virtual void Hyperspace::REST::KeyValueCollection::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::PropertyCollection.

virtual void Hyperspace::REST::KeyValueCollection::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::FixedCachedCollection, and Hyperspace::REST::PropertyCollection.

virtual void Hyperspace::REST::KeyValueCollection::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::FixedCachedCollection, and Hyperspace::REST::PropertyCollection.

void Hyperspace::REST::KeyValueCollection::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::KeyValueCollection::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::KeyValueCollection::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::KeyValueCollection::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.