public class ChannelBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Middleware |
afterAction |
protected Middleware |
beforeAction |
protected Channel |
channel |
protected ConcurrentHashMap<String,ChannelAction> |
channelActionMap |
protected Middleware |
defaultAction |
protected Middleware |
onError |
protected org.json.JSONObject |
providerIdentity |
| Constructor and Description |
|---|
ChannelBase(Channel channel,
org.json.JSONObject providerIdentity) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispatch(org.json.JSONObject destinationIdentity,
String action,
org.json.JSONObject actionPayload,
AckListener ackListener)
Dispatch an action to a specified client.
|
String |
getChannelId() |
String |
getChannelName() |
String |
getName() |
String |
getUuid() |
boolean |
hasRegisteredAction(String action) |
protected boolean |
register(String action,
ChannelAction listener) |
boolean |
remove(String action)
remove the registered action
|
void |
setAfterAction(Middleware middleware)
Register an action that fires after the action.
|
void |
setBeforeAction(Middleware middleware)
Register an action that fires before the action.
|
void |
setDefaultAction(Middleware middleware)
Sets a default action.
|
void |
setOnError(Middleware middleware)
Register an error handler.
|
protected Middleware defaultAction
protected Middleware onError
protected Middleware beforeAction
protected Middleware afterAction
protected ConcurrentHashMap<String,ChannelAction> channelActionMap
protected Channel channel
protected org.json.JSONObject providerIdentity
public ChannelBase(Channel channel, org.json.JSONObject providerIdentity)
protected boolean register(String action, ChannelAction listener)
public boolean remove(String action)
action - Name of the action to be removed.public void setDefaultAction(Middleware middleware)
middleware - Action to be executed when a client invokes an action name that has not been registered.public void setOnError(Middleware middleware)
middleware - Action to be executed in case of an error.public void setBeforeAction(Middleware middleware)
middleware - Action to be executed before invoking the action.public void setAfterAction(Middleware middleware)
middleware - Action to be executed after invoking the action.public String getChannelName()
public String getUuid()
public String getChannelId()
public String getName()
public boolean hasRegisteredAction(String action)
public void dispatch(org.json.JSONObject destinationIdentity,
String action,
org.json.JSONObject actionPayload,
AckListener ackListener)
destinationIdentity - Identity of the target client.action - Name of the action to be invoked by the client.actionPayload - Payload to be sent along with the action.ackListener - AckListener for the requestCopyright © 2020. All rights reserved.