public class MsbClientWebSocketHandler extends org.springframework.web.socket.handler.TextWebSocketHandler implements MsbClientHandler
| Modifier | Constructor and Description |
|---|---|
protected |
MsbClientWebSocketHandler()
Instantiates a new client web socket handler.
|
protected |
MsbClientWebSocketHandler(String url)
Instantiates a new client web socket handler.
|
protected |
MsbClientWebSocketHandler(String url,
int eventCacheSize)
Instantiates a new Msb client web socket handler.
|
protected |
MsbClientWebSocketHandler(String url,
int eventCacheSize,
int websocketTextMessageSize)
Instantiates a new Msb client web socket handler.
|
protected |
MsbClientWebSocketHandler(String url,
int eventCacheSize,
int websocketTextMessageSize,
int functionCallExecutorPoolSize)
Instantiates a new Msb client web socket handler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConfigParam(String configParamId,
Object value,
PrimitiveFormat format)
Add configuration parameter.
|
void |
addConfigParam(String configParamId,
Object value,
PrimitiveType type)
Add configuration parameter.
|
void |
addConfigurationListener(ConfigurationListener configurationListener)
Adds the configuration listener.
|
void |
addConnectionListener(ConnectionListener connectionListener)
Adds the connection listener.
|
void |
addEvent(Service selfDescription,
String eventId,
String name,
String description,
Class<?> dataType,
EventPriority priority)
Adds a event to the given self-description.
|
void |
addFunction(Service selfDescription,
String functionId,
String name,
String description,
String[] responseEventIds,
Object functionHandlerInstance,
Method method)
Adds a function to the given self-description.
|
void |
addFunctionCallsListener(FunctionCallsListener functionCallsListener)
Adds the function calls listener.
|
void |
addManagedService(Service subService)
Add managed service.
|
void |
afterConnectionClosed(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.CloseStatus status)
After connection closed.
|
void |
afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session)
After connection established.
|
void |
close()
Close.
|
protected void |
closeConnection(boolean interrupt)
Close connection.
|
protected boolean |
establishConnection()
Establish connection.
|
protected int |
getEventCacheSize()
Gets event cache size.
|
protected int |
getReconnectInterval()
Get reconnect interval int.
|
protected String |
getUrl()
Get url string.
|
protected int |
getWebsocketTextMessageSize()
Gets websocket text message size.
|
void |
handleTextMessage(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.TextMessage message)
Handle text message.
|
protected boolean |
isAutoReconnect()
Is auto reconnect boolean.
|
protected boolean |
isConnected()
Checks if is connected.
|
protected boolean |
isDataFormatValidation()
Is data format validation boolean.
|
protected boolean |
isEventCacheEnabled()
Is event cache enabled boolean.
|
protected boolean |
isInvokableFunctionCalls()
Is invokable function calls boolean.
|
protected boolean |
isRegistered()
Is registered boolean.
|
void |
publish(String eventId)
Publish a event of the registered service.
|
void |
publish(String eventId,
Object obj)
Publish a event of the registered service.
|
void |
publish(String eventId,
Object obj,
EventPriority priority)
Publish a event of the registered service.
|
void |
publish(String eventId,
Object obj,
EventPriority priority,
boolean cache)
Publish a event of the registered service.
|
void |
publish(String eventId,
Object obj,
EventPriority priority,
boolean cache,
Date postDate)
Publish a event of the registered service.
|
void |
publish(String eventId,
Object obj,
EventPriority priority,
boolean cache,
Date postDate,
String correlationId)
Publish.
|
void |
publishForService(String serviceUuid,
String eventId)
Publish a event for the given service uuid.
|
void |
publishForService(String serviceUuid,
String eventId,
Object obj)
Publish a event for the given service uuid.
|
void |
publishForService(String serviceUuid,
String eventId,
Object obj,
EventPriority priority)
Publish a event for the given service uuid.
|
void |
publishForService(String serviceUuid,
String eventId,
Object obj,
EventPriority priority,
boolean cache)
Publish a event for the given service uuid.
|
void |
publishForService(String serviceUuid,
String eventId,
Object obj,
EventPriority priority,
boolean cache,
Date postDate)
Publish a event for the given service uuid.
|
void |
publishForService(String serviceUuid,
String eventId,
Object obj,
EventPriority priority,
boolean cache,
Date postDate,
String correlationId)
Publish for service.
|
protected void |
reconnect()
Reconnect.
|
void |
register(Service selfDescription)
Register a service.
|
void |
register(Service selfDescription,
Object[] functionHandler)
Register a service and use the instantiated function handlers to invoke function calls.
|
void |
register(Service selfDescription,
Object[] functionHandler,
Class<?>[] eventDeclarations)
Register a service, use the instantiated function handlers to invoke function calls and scan event declaration classes for annotated events.
|
void |
register(Service selfDescription,
Object[] functionHandler,
String packagePath)
Register a service, use the instantiated function handlers to invoke function calls and scan the package path for annotated events and configuration parameters..
|
void |
register(Service selfDescription,
String packagePath)
Register a service and scan the package path for annotated events, functions and configuration parameters.
|
void |
register(String packagePath)
Register a service by scanning the package path for annotated events, functions, configuration parameters and self description.
|
void |
register(String packagePath,
Object[] functionHandler)
Register a service by scanning the package path for annotated events, functions, configuration parameters and self description.
|
void |
removeConfigurationListener(ConfigurationListener configurationListener)
Removes the configuration listener.
|
void |
removeConnectionListener(ConnectionListener connectionListener)
Removes the connection listener.
|
void |
removeFunctionCallsListener(FunctionCallsListener functionCallsListener)
Removes the function calls listener.
|
protected void |
setAutoReconnect(boolean autoReconnect)
Sets auto reconnect.
|
protected void |
setDataFormatValidation(boolean dataFormatValidationEnabled)
Set data format validation.
|
protected void |
setEventCacheEnabled(boolean eventCacheEnabled)
Sets event cache enabled.
|
protected void |
setInvokableFunctionCalls(boolean invokable)
Sets invokable function calls.
|
protected void |
setReconnectInterval(int millis)
Set reconnect interval.
|
protected void |
setTrustStore(String trustStorePath,
String trustStorePwd)
Sets trust store.
|
handleBinaryMessageprotected MsbClientWebSocketHandler()
protected MsbClientWebSocketHandler(String url)
url - the urlprotected MsbClientWebSocketHandler(String url, int eventCacheSize)
url - the urleventCacheSize - the event cache sizeprotected MsbClientWebSocketHandler(String url, int eventCacheSize, int websocketTextMessageSize)
url - the urleventCacheSize - the event cache sizewebsocketTextMessageSize - the websocket text message sizeprotected MsbClientWebSocketHandler(String url, int eventCacheSize, int websocketTextMessageSize, int functionCallExecutorPoolSize)
url - the urleventCacheSize - the event cache sizewebsocketTextMessageSize - the websocket text message sizefunctionCallExecutorPoolSize - the function call executor pool sizepublic void afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session)
throws Exception
afterConnectionEstablished in interface org.springframework.web.socket.WebSocketHandlerafterConnectionEstablished in class org.springframework.web.socket.handler.AbstractWebSocketHandlersession - the sessionExceptionpublic void handleTextMessage(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.TextMessage message)
throws Exception
handleTextMessage in class org.springframework.web.socket.handler.AbstractWebSocketHandlersession - the sessionmessage - the messageException - the exceptionpublic void afterConnectionClosed(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.CloseStatus status)
throws Exception
afterConnectionClosed in interface org.springframework.web.socket.WebSocketHandlerafterConnectionClosed in class org.springframework.web.socket.handler.AbstractWebSocketHandlersession - the sessionstatus - the statusException - the exceptionprotected String getUrl()
protected int getEventCacheSize()
protected int getWebsocketTextMessageSize()
protected void setTrustStore(String trustStorePath, String trustStorePwd)
trustStorePath - the trust store pathtrustStorePwd - the trust store pwdprotected boolean isRegistered()
protected boolean isEventCacheEnabled()
protected void setEventCacheEnabled(boolean eventCacheEnabled)
eventCacheEnabled - the event cache enabledprotected boolean isAutoReconnect()
protected void setAutoReconnect(boolean autoReconnect)
autoReconnect - the auto reconnectprotected void setReconnectInterval(int millis)
millis - the millisprotected int getReconnectInterval()
protected boolean isInvokableFunctionCalls()
protected void setInvokableFunctionCalls(boolean invokable)
invokable - the invokableprotected boolean isDataFormatValidation()
protected void setDataFormatValidation(boolean dataFormatValidationEnabled)
dataFormatValidationEnabled - the data format validation enabledprotected boolean establishConnection()
protected boolean isConnected()
protected void reconnect()
throws IOException
IOException - Signals that an I/O exception has occurred.protected void closeConnection(boolean interrupt)
interrupt - the interruptpublic void close()
throws Exception
close in interface AutoCloseableException - the exceptionAutoCloseable.close()public void addFunction(Service selfDescription, String functionId, String name, String description, String[] responseEventIds, Object functionHandlerInstance, Method method)
MsbClientHandleraddFunction in interface MsbClientHandlerselfDescription - the self descriptionfunctionId - the function idname - the namedescription - the descriptionresponseEventIds - the response event idsfunctionHandlerInstance - the function handler instancemethod - the methodpublic void addEvent(Service selfDescription, String eventId, String name, String description, Class<?> dataType, EventPriority priority)
MsbClientHandleraddEvent in interface MsbClientHandlerselfDescription - the self descriptioneventId - the event idname - the namedescription - the descriptiondataType - the data typepriority - the event prioritypublic void addConfigParam(String configParamId, Object value, PrimitiveFormat format)
MsbClientHandleraddConfigParam in interface MsbClientHandlerconfigParamId - the configuration parameter idvalue - the valueformat - the formatpublic void addConfigParam(String configParamId, Object value, PrimitiveType type)
MsbClientHandleraddConfigParam in interface MsbClientHandlerconfigParamId - the configuration parameter idvalue - the valuetype - the typepublic void addManagedService(Service subService)
MsbClientHandleraddManagedService in interface MsbClientHandlersubService - the sub servicepublic void register(String packagePath) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerpackagePath - the package pathIOException - the io exceptionpublic void register(String packagePath, Object[] functionHandler) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerpackagePath - the package pathfunctionHandler - the function handlerIOException - the io exceptionpublic void register(Service selfDescription, String packagePath) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerselfDescription - the self descriptionpackagePath - the package pathIOException - Signals that an I/O exception has occurred.public void register(Service selfDescription, Object[] functionHandler) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerselfDescription - the self descriptionfunctionHandler - the function handlerIOException - Signals that an I/O exception has occurred.public void register(Service selfDescription, Object[] functionHandler, String packagePath) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerselfDescription - the self descriptionfunctionHandler - the function handlerspackagePath - the package pathIOException - Signals that an I/O exception has occurred.public void register(Service selfDescription, Object[] functionHandler, Class<?>[] eventDeclarations) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerselfDescription - the self descriptionfunctionHandler - the function handlerseventDeclarations - the event declarationsIOException - Signals that an I/O exception has occurred.public void register(Service selfDescription) throws IOException
MsbClientHandlerregister in interface MsbClientHandlerselfDescription - the self descriptionIOException - Signals that an I/O exception has occurred.public void publish(String eventId) throws IOException
MsbClientHandlerpublish in interface MsbClientHandlereventId - the event idIOException - Signals that an I/O exception has occurred.public void publish(String eventId, Object obj) throws IOException
MsbClientHandlerpublish in interface MsbClientHandlereventId - the event idobj - the objIOException - Signals that an I/O exception has occurred.public void publish(String eventId, Object obj, EventPriority priority) throws IOException
MsbClientHandlerpublish in interface MsbClientHandlereventId - the event idobj - the objpriority - the priorityIOException - Signals that an I/O exception has occurred.public void publish(String eventId, Object obj, EventPriority priority, boolean cache) throws IOException
MsbClientHandlerpublish in interface MsbClientHandlereventId - the event idobj - the objpriority - the prioritycache - the cacheIOException - Signals that an I/O exception has occurred.public void publish(String eventId, Object obj, EventPriority priority, boolean cache, Date postDate) throws IOException
MsbClientHandlerpublish in interface MsbClientHandlereventId - the event idobj - the objpriority - the prioritycache - the cachepostDate - the post dateIOException - the io exceptionpublic void publish(String eventId, Object obj, EventPriority priority, boolean cache, Date postDate, String correlationId) throws IOException
MsbClientHandlerpublish in interface MsbClientHandlereventId - the event idobj - the objpriority - the prioritycache - the cachepostDate - the post datecorrelationId - the correlation idIOException - the io exceptionpublic void publishForService(String serviceUuid, String eventId) throws IOException
MsbClientHandlerpublishForService in interface MsbClientHandlerserviceUuid - the service uuideventId - the event idIOException - Signals that an I/O exception has occurred.public void publishForService(String serviceUuid, String eventId, Object obj) throws IOException
MsbClientHandlerpublishForService in interface MsbClientHandlerserviceUuid - the service uuideventId - the event idobj - the objIOException - Signals that an I/O exception has occurred.public void publishForService(String serviceUuid, String eventId, Object obj, EventPriority priority) throws IOException
MsbClientHandlerpublishForService in interface MsbClientHandlerserviceUuid - the service uuideventId - the event idobj - the objpriority - the priorityIOException - Signals that an I/O exception has occurred.public void publishForService(String serviceUuid, String eventId, Object obj, EventPriority priority, boolean cache) throws IOException
MsbClientHandlerpublishForService in interface MsbClientHandlerserviceUuid - the service uuideventId - the event idobj - the objpriority - the prioritycache - the cacheIOException - Signals that an I/O exception has occurred.public void publishForService(String serviceUuid, String eventId, Object obj, EventPriority priority, boolean cache, Date postDate) throws IOException
MsbClientHandlerpublishForService in interface MsbClientHandlerserviceUuid - the service uuideventId - the event idobj - the objpriority - the prioritycache - the cachepostDate - the post dateIOException - the io exceptionpublic void publishForService(String serviceUuid, String eventId, Object obj, EventPriority priority, boolean cache, Date postDate, String correlationId) throws IOException
MsbClientHandlerpublishForService in interface MsbClientHandlerserviceUuid - the service uuideventId - the event idobj - the objpriority - the prioritycache - the cachepostDate - the post datecorrelationId - the correlation idIOException - the io exceptionpublic void addFunctionCallsListener(FunctionCallsListener functionCallsListener)
MsbClientHandleraddFunctionCallsListener in interface MsbClientHandlerfunctionCallsListener - the function calls listenerpublic void removeFunctionCallsListener(FunctionCallsListener functionCallsListener)
MsbClientHandlerremoveFunctionCallsListener in interface MsbClientHandlerfunctionCallsListener - the function calls listenerpublic void addConnectionListener(ConnectionListener connectionListener)
addConnectionListener in interface MsbClientHandlerconnectionListener - the connection listenerMsbClientHandler.addConnectionListener(ConnectionListener)public void removeConnectionListener(ConnectionListener connectionListener)
removeConnectionListener in interface MsbClientHandlerconnectionListener - the connection listenerMsbClientHandler.removeConnectionListener(ConnectionListener)public void addConfigurationListener(ConfigurationListener configurationListener)
addConfigurationListener in interface MsbClientHandlerconfigurationListener - the configuration listenerMsbClientHandler.addConfigurationListener(ConfigurationListener)public void removeConfigurationListener(ConfigurationListener configurationListener)
removeConfigurationListener in interface MsbClientHandlerconfigurationListener - the configuration listenerMsbClientHandler.removeConfigurationListener(ConfigurationListener)Copyright © 2019 Fraunhofer IPA. All rights reserved.