public abstract class AbstractEndPoint extends Object implements IEndPoint, IServerWebSocketCommListener, IRootPropTransactionSender
IEndPoint.Type
Modifier and Type | Field and Description |
---|---|
protected boolean |
DEBUG
Debug mode, very verbose output.
|
protected PropMgr |
endPointPropertyManager
The property endPointPropertyManager.
|
protected IEndPoint.Type |
endPointType
The end-point type.
|
protected String |
name
The name of this end point.
|
protected RootPropTransactionSender |
propTransSender
Root property transaction sender.
|
protected PropCnr |
root
The root container property of the end point.
|
protected ServerShell |
server
The main server instance.
|
protected long |
serverSessionID
The server session ID.
|
protected SessionInfo |
sessionInfo
The SessionInfo.
|
protected ThreadGroup |
threadGroup
The thread group for the end point.
|
protected Worker |
worker
The worker of the Editor.
|
DEFAULT_HEARTBEAT_INTERVAL, STORAGE_NAME
CC_ABNORMAL_CLOSURE, CC_GOING_AWAY, CC_INTERNAL_ERROR, CC_INVALID_PAYLOAD_DATA, CC_MANDATORY_EXT, CC_MESSAGE_TOO_BIG, CC_NO_STATUS_RECEIVED, CC_NORMAL, CC_POLICY_VIOLATION, CC_PROTOCOL_ERROR, CC_SERVICE_RESTART, CC_TLS_HANDSHAKE, CC_TRY_AGAIN_LATER, CC_UNSUPPORTED_DATA
Constructor and Description |
---|
AbstractEndPoint(IEndPoint.Type endPointType,
String name,
long sessionID,
IWebSocketComm comm,
ServerShell server,
ThreadGroup serverThreadGroup,
HashMap<String,String> classNameMap,
ClassLoader contextClassLoader)
Creates a new EndPoint instance.
|
Modifier and Type | Method and Description |
---|---|
Transaction |
createTransaction()
Creates a Transaction using a Write Cache.
|
boolean |
dispose()
Disposes of the end point.
|
String |
getClientContextMenuReference(UIContextMenu contextMenu)
Gets the reference to use for a context menu.
|
IEndPoint |
getEndPoint()
Gets the end-point.
|
String |
getEndPointName()
Gets the end point name.
|
IEndPoint.Type |
getEndPointType()
Gets the end point type.
|
protected long |
getHeartBeatInterval()
Gets the heart-beat interval time in milliseconds, called during start-up in the constructor.
|
PropCnr |
getProperties()
Gets the end point properties, i.e.
|
PropMgr |
getPropertyManager()
Gets the property manager of the end point.
|
ServerShell |
getServer()
Gets the server.
|
long |
getServerSessionID()
Gets the Server Session ID.
|
SessionInfo |
getSessionInfo()
Gets the SessionInfo for this end point.
|
IServerWebSocketCommListener |
getWebSocketCommListener(IWebSocketComm comm)
Gets the WebSocketCommListener for the end point.
|
boolean |
isConnected()
Checks if the communication link is connected.
|
protected void |
onClientPropsCreated(PropCnr root)
Called when the root is created from a transaction from the client.
|
void |
onCommClosed(IWebSocketComm comm,
int code,
String reason)
Called when the communication link is closed.
|
void |
onCommClosing(IWebSocketComm comm)
Called when the communication link is closing.
|
void |
onCommConnected(IWebSocketComm comm)
Called when the communication link is connected.
|
void |
onCommData(IWebSocketComm comm,
byte[] _data,
int offset,
int len)
Called when the communication link has received binary data.
|
void |
onCommData(IWebSocketComm comm,
String data)
Called when the communication link has received String data.
|
void |
onCommError(IWebSocketComm comm,
Throwable e)
Called when the communication link is closed.
|
void |
onCommHeartBeat(IWebSocketComm comm,
long duration)
Called when a heart-beat frame is received.
|
void |
onCommOpen(IWebSocketComm comm)
Called when the communication link is opened.
|
void |
onCommTimeout(IWebSocketComm comm,
boolean isReadTimeout)
Called when the communication link has timed out on a read or write
operation.
|
protected void |
onSendHeartHeat()
Called to perform sending of a heart-beat.
|
protected void |
onSessionConnected()
Called upon connect to enable initialization of e.g.
|
protected String |
paramString()
Formats the value as a string to add to
paramString . |
protected abstract boolean |
processQueuedTransaction(int code,
Transaction trans)
This method must be implemented in all extending classes.
|
void |
sendTransaction(Transaction trans)
Sends a transaction to the end point.
|
String |
toString()
Returns a string representation of this component and its values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSessionInstance
protected boolean DEBUG
protected final long serverSessionID
protected final String name
protected final Worker worker
protected final ServerShell server
protected final SessionInfo sessionInfo
protected final ThreadGroup threadGroup
protected final IEndPoint.Type endPointType
protected final PropMgr endPointPropertyManager
protected PropCnr root
protected RootPropTransactionSender propTransSender
public AbstractEndPoint(IEndPoint.Type endPointType, String name, long sessionID, IWebSocketComm comm, ServerShell server, ThreadGroup serverThreadGroup, HashMap<String,String> classNameMap, ClassLoader contextClassLoader) throws IOException
endPointType
- End point type.name
- Name of end point.sessionID
- Session ID.comm
- Communications interface to web sockets.server
- The server instance.serverThreadGroup
- The thread group.classNameMap
- The class name map.contextClassLoader
- The context class loader.IOException
- For I/O errors.public final IEndPoint getEndPoint()
getEndPoint
in interface IServerWebSocketCommListener
public final long getServerSessionID()
getServerSessionID
in interface IEndPoint
public final ServerShell getServer()
public IServerWebSocketCommListener getWebSocketCommListener(IWebSocketComm comm)
getWebSocketCommListener
in interface IEndPoint
comm
- The WebSocket communication instance.public final IEndPoint.Type getEndPointType()
getEndPointType
in interface IEndPoint
public String getEndPointName()
getEndPointName
in interface IEndPoint
protected long getHeartBeatInterval()
protected void onSendHeartHeat()
getHeartBeatInterval()
return value.protected void onSessionConnected()
public final PropMgr getPropertyManager()
public final PropCnr getProperties()
public final SessionInfo getSessionInfo()
getSessionInfo
in interface IEndPoint
public boolean dispose()
public void onCommOpen(IWebSocketComm comm)
onCommOpen
in interface WebSocketCommListener
comm
- The WebSocket communication instance.public void onCommConnected(IWebSocketComm comm)
onCommConnected
in interface WebSocketCommListener
comm
- The WebSocket communication instance.public void onCommData(IWebSocketComm comm, byte[] _data, int offset, int len)
onCommData
in interface WebSocketCommListener
comm
- The WebSocket communication instance._data
- The data byte array.offset
- Offset in buffer.len
- Length of data.public void onCommData(IWebSocketComm comm, String data)
onCommData
in interface WebSocketCommListener
comm
- The WebSocket communication instance.data
- The String data.public void onCommHeartBeat(IWebSocketComm comm, long duration)
onCommHeartBeat
in interface WebSocketCommListener
duration
- Duration of the PING-PONG message exchange in milliseconds.comm
- The WebSocket communication instance.public void onCommTimeout(IWebSocketComm comm, boolean isReadTimeout)
onCommTimeout
in interface WebSocketCommListener
comm
- The WebSocket communication instance.isReadTimeout
- Flag indicating read timeout when true,
false indicates write timeout.public void onCommError(IWebSocketComm comm, Throwable e)
onCommError
in interface WebSocketCommListener
comm
- The WebSocket communication instance.e
- The exception.public void onCommClosing(IWebSocketComm comm)
onCommClosing
in interface WebSocketCommListener
comm
- The WebSocket communication instance.public void onCommClosed(IWebSocketComm comm, int code, String reason)
onCommClosed
in interface WebSocketCommListener
comm
- The WebSocket communication instance.code
- The reason code for closure.reason
- The reason string explanation for closure.protected void onClientPropsCreated(PropCnr root)
protected abstract boolean processQueuedTransaction(int code, Transaction trans)
code
- The transaction code.trans
- The transaction.public final boolean isConnected()
isConnected
in interface IRootPropTransactionSender
public final Transaction createTransaction()
createTransaction
in interface ITransactionCreator
public final void sendTransaction(Transaction trans)
sendTransaction
in interface IRootPropTransactionSender
trans
- The transaction to send.protected String paramString()
paramString
.public String toString()
public String getClientContextMenuReference(UIContextMenu contextMenu)
getClientContextMenuReference
in interface IRootPropTransactionSender
contextMenu
- The context menu.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.