public class ConnectionImpl extends ConnectionBaseImpl implements Connection
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 |
---|---|
void |
addListListener(ItemListListener listener)
Add a new listener to the connection in order to receive item list
updates.
|
protected void |
closeQuery(Long queryId) |
Query |
createQuery(String itemId,
QueryParameters parameters,
QueryListener listener,
boolean updateData)
Create a new query on the server
|
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 |
removeListListener(ItemListListener listener)
Remove a listener from the connection
|
protected void |
sendBrowseRequestState(boolean state) |
protected void |
sendCloseQuery(long queryId) |
protected void |
sendQueryUpdateParameters(long id,
QueryParameters parameters) |
protected void |
updateQueryParameters(QueryImpl query,
QueryParameters parameters) |
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 onConnectionBound()
ClientBaseConnection
This method is called while the connection lock is held.
The default implementation does nothing.
onConnectionBound
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
public Query createQuery(String itemId, QueryParameters parameters, QueryListener listener, boolean updateData)
Connection
itemId
- the historical item to queryparameters
- the initial query parameterslistener
- the listener that will receive dataupdateData
- true
if the query should provide continuous
updates, false
if the query should only be
executed once an not data
updates should be delivered after the query state changed to
QueryState.COMPLETE
.null
is never returnedpublic void addListListener(ItemListListener listener)
Connection
A new listener will also receive any already known items.
listener
- the listener to addpublic void removeListListener(ItemListListener listener)
Connection
listener
- the listener to removeprotected void closeQuery(Long queryId)
protected void updateQueryParameters(QueryImpl query, QueryParameters parameters)
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 messageprotected void sendCloseQuery(long queryId)
protected void sendQueryUpdateParameters(long id, QueryParameters parameters)
protected void sendBrowseRequestState(boolean state)
Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.