public class ConnectionImpl extends ConnectionBaseImpl implements Connection
Modifier and Type | Class and Description |
---|---|
static class |
ConnectionImpl.AcknowledgeFuture |
static class |
ConnectionImpl.DisconnectedQuery
A dummy query which is only disconnected
|
connectCallbackHandler
connectionInformation, executor, statistics
Constructor and Description |
---|
ConnectionImpl(ConnectionInformation connectionInformation) |
ConnectionImpl(ConnectionInformation connectionInformation,
org.apache.mina.core.service.IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
Create a new connection
|
Modifier and Type | Method and Description |
---|---|
NotifyFuture<Void> |
acknowledge(String monitorId,
Date aknTimestamp,
OperationParameters operationParameters,
CallbackHandler callbackHandler)
Acknowledge the monitor if the akn state was reached at or before the
provided timestamp
|
void |
addBrowserListener(BrowserListener listener)
Add browser listener
|
Query |
createQuery(String queryType,
String queryData,
QueryListener listener) |
void |
dispose()
Dispose the connection
|
protected void |
handleMessage(Object message)
Handle a message that came in by the current session.
|
protected void |
onConnectionBound()
Called when the connection got bound
|
protected void |
onConnectionClosed()
Called when the connection got closed
|
void |
removeBrowserListener(BrowserListener listener) |
void |
sendCloseQuery(long queryId) |
void |
sendCreateQuery(long queryId,
String queryType,
String queryData) |
void |
sendLoadMore(long queryId,
int count) |
void |
sendStartBrowse() |
void |
sendStopBrowse() |
void |
sendSubscribeEventPool(String eventPoolId) |
void |
sendSubscribeMonitorPool(String monitorPoolId) |
void |
sendUnsubscribeEventPool(String eventPoolId) |
void |
sendUnsubscribeMonitorPool(String monitorPoolId) |
void |
setEventListener(String eventQueryId,
EventListener listener)
Set the listener that should receive event updates
|
void |
setMonitorListener(String monitorQueryId,
MonitorListener listener)
Set the listener that should receive monitor updates
|
makeProperties, nextRequest, onConnectionConnected, processCallbackFuture, registerCallbackHandler, sendRequestMessage, setCallbackFactory
addConnectionStateListener, addPrivilegeListener, connect, connect, disconnect, firePrivilegeChange, getPrivileges, getSession, getSslSession, getState, handleConnectComplete, isDisposed, messageReceived, performClosed, performDisconnected, performOpened, removeConnectionStateListener, removePrivilegeListener, sendMessage, sendMessageChecked, setState, switchState
getConnectionInformation, getSessionProperties, getStatistics, setSessionProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addConnectionStateListener, addPrivilegeListener, connect, connect, disconnect, getConnectionInformation, getPrivileges, getSessionProperties, getState, removeConnectionStateListener, removePrivilegeListener, setCallbackFactory
public ConnectionImpl(ConnectionInformation connectionInformation) throws Exception
Exception
public ConnectionImpl(ConnectionInformation connectionInformation, org.apache.mina.core.service.IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor) throws Exception
connectionInformation
- the information where to connect toprocessor
- the socket processor, may be null
to use the
defaultException
- if anything goes wrongpublic void dispose()
Connection
A dispose will also act as a disconnect.
Connections must be disposed in order to clean up all resources. In the
past the Connection.disconnect()
call was enough and, if possible, most
resources (sockets) should be closed when disconnecting. Still some
resources can be re-used and these need to be cleaned up in the
Connection.dispose()
call.
dispose
in interface Connection
dispose
in class ClientBaseConnection
protected void onConnectionClosed()
ClientBaseConnection
This method is called while the connection lock is held.
The default implementation does nothing.
onConnectionClosed
in class ConnectionBaseImpl
protected void onConnectionBound()
ClientBaseConnection
This method is called while the connection lock is held.
The default implementation does nothing.
onConnectionBound
in class ClientBaseConnection
public void addBrowserListener(BrowserListener listener)
Connection
listener
- the listener to addpublic void removeBrowserListener(BrowserListener listener)
public void setEventListener(String eventQueryId, EventListener listener)
Connection
public void setMonitorListener(String monitorQueryId, MonitorListener listener)
Connection
public Query createQuery(String queryType, String queryData, QueryListener listener)
public NotifyFuture<Void> acknowledge(String monitorId, Date aknTimestamp, OperationParameters operationParameters, CallbackHandler callbackHandler)
Connection
monitorId
- the id of the conditionaknTimestamp
- the timestamp up to which the state may be acknowledgedoperationParameters
- optionally provide some user information which performs the
aknowledgement. If the information is not provided the current
logged in user will be used. If the information is present but
the current logged in user is not allowed to change the user
performing acknowledgement the server may fall back to use the
actual information of the logged in user instead.protected void handleMessage(Object message)
ClientBaseConnection
Note that the method is called while holding the lock the connection itself.
handleMessage
in class ConnectionBaseImpl
message
- the received messagepublic void sendStartBrowse()
public void sendStopBrowse()
public void sendSubscribeMonitorPool(String monitorPoolId)
public void sendUnsubscribeMonitorPool(String monitorPoolId)
public void sendSubscribeEventPool(String eventPoolId)
public void sendUnsubscribeEventPool(String eventPoolId)
public void sendCloseQuery(long queryId)
public void sendLoadMore(long queryId, int count)
Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.