An implementation of Hyperspace::Gate for REST collections. More...

Inheritance diagram for Hyperspace::REST::Gate:

Public Member Functions

 Gate (const QList< QByteArray > &capabilities, const QByteArray &baseTarget="/", QObject *parent=Q_NULLPTR)
 
void addCollection (Collection *collection)
 Adds a new collection to this gate. More...
 

Protected Member Functions

virtual void initImpl () Q_DECL_OVERRIDE Q_DECL_FINAL
 
- Protected Member Functions inherited from Hyperspace::Gate
void assignWaveTarget (AbstractWaveTarget *target)
 Assigns an AbstractWaveTarget to this gate. More...
 
- Protected Member Functions inherited from Hemera::AsyncInitObject
void setParts (uint parts)
 

Additional Inherited Members

- Public Slots inherited from Hemera::AsyncInitObject
Hemera::Operationinit ()
 
- Signals inherited from Hemera::AsyncInitObject
void ready ()
 
- Protected Slots inherited from Hemera::AsyncInitObject
void setReady ()
 
void setInitError (const QString &errorName, const QString &message=QString())
 
void setOnePartIsReady ()
 

Detailed Description

An implementation of Hyperspace::Gate for REST collections.

This Gate is a convenience Gate for managing REST trees automatically. It can be instantiated standalone and is the preferred way to expose REST Collections from applications. An usage example is:

Hyperspace::REST::Collection *myColl = getCollectionFromSomewhere();
Hyperspace::REST::Gate *gate = new Hyperspace::REST::Gate(QList<QByteArray>() << "com.my.capability", "/my/target", this);
// Populate the gate
gate->addCollection(myColl);
// Initialize the gate
Hemera::Operation *op = gate->init();

This is all that's needed to register the Gate and its collection tree on Hyperspace.

See also
Hyperspace::REST::Collection

Constructor & Destructor Documentation

Hyperspace::REST::Gate::Gate ( const QList< QByteArray > &  capabilities,
const QByteArray &  baseTarget = "/",
QObject *  parent = Q_NULLPTR 
)

Constructs a new REST gate.

capabilities A list of capabilities this gate implements. baseTarget The base target path of this gate. parent QObject parent.

Member Function Documentation

void Hyperspace::REST::Gate::addCollection ( Collection collection)

Adds a new collection to this gate.

A Gate can hold any number of Collections, as long as they are registered under different paths. Collection registration MUST happen before Gate initialization. Adding a collection after a Gate has been initialized is not supported.

collection The collection to add.

void Hyperspace::REST::Gate::initImpl ( )
protectedvirtual

Implements the object intialization

When implementing an AsyncInitObject, this method should hold your initialization logic. It is called by AsyncInitObject when needed, and the developer should just reimplement it without invoking it.

Once the initialization procedure is completed, either setReady, setOnePartIsReady or setInitError must be called.

Implements Hemera::AsyncInitObject.