Package com.openfin.desktop.channel
Class ChannelBase
java.lang.Object
com.openfin.desktop.channel.ChannelBase
- Direct Known Subclasses:
ChannelClient
,ChannelProvider
public class ChannelBase
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description protected Middleware
afterAction
protected Middleware
beforeAction
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,ChannelAction>
channelActionMap
protected Middleware
defaultAction
protected EndpointIdentity
endpointIdentity
protected org.slf4j.Logger
logger
protected Middleware
onError
-
Constructor Summary
Constructors Constructor Description ChannelBase(EndpointIdentity endpointIdentity)
-
Method Summary
Modifier and Type Method Description protected void
cleanup()
protected void
dispatch(AbstractProtocolHandler protocolHandler, org.json.JSONObject destinationIdentity, java.lang.String action, org.json.JSONObject actionPayload, AckListener ackListener)
Dispatch an action to a specified client.protected java.util.concurrent.CompletableFuture<Ack>
dispatchAsync(AbstractProtocolHandler protocolHandler, org.json.JSONObject destinationIdentity, java.lang.String action, java.lang.Object actionPayload)
java.lang.String
getChannelId()
java.lang.String
getChannelName()
java.lang.String
getEndpointId()
EndpointIdentity
getEndpointIdentity()
java.lang.String
getName()
java.lang.String
getUuid()
boolean
hasRegisteredAction(java.lang.String action)
protected boolean
register(java.lang.String action, ChannelAction listener)
boolean
remove(java.lang.String action)
remove the registered actionvoid
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.
-
Field Details
-
defaultAction
-
onError
-
beforeAction
-
afterAction
-
channelActionMap
-
endpointIdentity
-
logger
protected org.slf4j.Logger logger
-
-
Constructor Details
-
Method Details
-
register
-
remove
public boolean remove(java.lang.String action)remove the registered action- Parameters:
action
- Name of the action to be removed.- Returns:
- if the action was removed successfully
-
setDefaultAction
Sets a default action. This is used any time an action that has not been registered is invoked.- Parameters:
middleware
- Action to be executed when a client invokes an action name that has not been registered.
-
setOnError
Register an error handler. This is called before responding on any error.- Parameters:
middleware
- Action to be executed in case of an error.
-
setBeforeAction
Register an action that fires before the action.- Parameters:
middleware
- Action to be executed before invoking the action.
-
setAfterAction
Register an action that fires after the action.- Parameters:
middleware
- Action to be executed after invoking the action.
-
getEndpointIdentity
-
getChannelName
public java.lang.String getChannelName() -
getUuid
public java.lang.String getUuid() -
getChannelId
public java.lang.String getChannelId() -
getName
public java.lang.String getName() -
getEndpointId
public java.lang.String getEndpointId() -
hasRegisteredAction
public boolean hasRegisteredAction(java.lang.String action) -
dispatch
protected void dispatch(AbstractProtocolHandler protocolHandler, org.json.JSONObject destinationIdentity, java.lang.String action, org.json.JSONObject actionPayload, AckListener ackListener)Dispatch an action to a specified client.- Parameters:
protocolHandler
- protocol handlerdestinationIdentity
- 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 request
-
dispatchAsync
protected java.util.concurrent.CompletableFuture<Ack> dispatchAsync(AbstractProtocolHandler protocolHandler, org.json.JSONObject destinationIdentity, java.lang.String action, java.lang.Object actionPayload) -
cleanup
protected void cleanup()
-