T - Model TypeE - Listener typepublic abstract class SubscribableModel<T extends SubscribableModel<T,E>,E extends ModelListener<T>> extends Model<T,E>
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
logger
Logs actions performed by the class.
|
| Constructor and Description |
|---|
SubscribableModel(String path,
ModelType type,
PathfinderServices services)
Constructs a subcribable model.
|
| Modifier and Type | Method and Description |
|---|---|
JsonObject |
getMessageHeader(String type)
Returns the header of the message to send to the pathfinder server.
|
void |
routeSubscribe()
Subscribes to route updates from the server.
|
void |
routeUnsubscribe()
Unsubcribes from route updates from the server.
|
private void |
sendSubscribeMessage(String type)
Sends a subscribe like message to the Pathfinder server.
|
void |
subscribe()
Subscribes to the models updates from the server.
|
void |
unsubscribe()
Unsubcribes from updates from the server.
|
getChildPath, getModelType, getName, getParentCluster, getParentPath, getPath, getPathName, getServices, getThis, isConnected, isPathUnknown, notifyUpdate, route, sendMessage, setConnected, setPathName, toJson, updateFieldsaddListener, getListeners, removeListenerprivate static final org.slf4j.Logger logger
public SubscribableModel(String path, ModelType type, PathfinderServices services)
path - of the model to subscribe to.type - of the model.services - a pathfinder services object.public JsonObject getMessageHeader(String type)
type - of the messageprivate void sendSubscribeMessage(String type)
type - "Subscribe" or "Unsubscribe".public void subscribe()
public void unsubscribe()
public void routeSubscribe()
public void routeUnsubscribe()