public abstract class LazyConnectionWrapper extends Object implements Connection, StatisticsProvider
Constructor and Description |
---|
LazyConnectionWrapper(Connection connection,
Integer lingeringTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionStateListener(ConnectionStateListener connectionStateListener) |
void |
addPrivilegeListener(PrivilegeListener listener)
Add a listener to the privileges of the session
|
void |
browse(Location location,
BrowseOperationCallback callback)
Browse a server folder for items.
|
void |
connect()
Start the connection
|
void |
connect(CallbackHandler callbackHandler)
Start the connection with a callback handler
|
void |
disconnect()
Stop the connection
|
void |
dispose()
Dispose the connection
|
ConnectionInformation |
getConnectionInformation() |
ScheduledExecutorService |
getExecutor()
Retrieve the executor that is currently set
|
Set<String> |
getPrivileges()
Return the list of currently granted privileges.
|
Map<String,String> |
getSessionProperties()
Return the session properties as provided by the server.
|
ConnectionState |
getState()
Get the current connection state
|
Collection<StatisticEntry> |
getStatistics() |
protected abstract void |
performConnect() |
protected abstract void |
performDisconnect() |
void |
removeConnectionStateListener(ConnectionStateListener connectionStateListener) |
void |
removePrivilegeListener(PrivilegeListener listener) |
void |
setCallbackFactory(CallbackFactory callbackFactory) |
FolderListener |
setFolderListener(Location location,
FolderListener listener)
Set the listener for this location.
|
ItemUpdateListener |
setItemUpdateListener(String itemId,
ItemUpdateListener listener)
Set the listener for this item.
|
NotifyFuture<WriteResult> |
startWrite(String itemId,
Variant value,
OperationParameters operationParameters,
CallbackHandler callbackHandler) |
NotifyFuture<WriteAttributeResults> |
startWriteAttributes(String itemId,
Map<String,Variant> attributes,
OperationParameters operationParameters,
CallbackHandler callbackHandler) |
void |
subscribeFolder(Location location) |
void |
subscribeItem(String itemId) |
void |
unsubscribeFolder(Location location) |
void |
unsubscribeItem(String itemId) |
void |
write(String itemId,
Variant value,
OperationParameters operationParameters,
WriteOperationCallback callback) |
void |
writeAttributes(String itemId,
Map<String,Variant> attributes,
OperationParameters operationParameters,
WriteAttributeOperationCallback callback) |
public LazyConnectionWrapper(Connection connection, Integer lingeringTimeout)
public void setCallbackFactory(CallbackFactory callbackFactory)
setCallbackFactory
in interface Connection
public void connect()
Connection
connect
in interface Connection
public void connect(CallbackHandler callbackHandler)
Connection
connect
in interface Connection
public void disconnect()
Connection
disconnect
in interface Connection
public 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
public void addConnectionStateListener(ConnectionStateListener connectionStateListener)
addConnectionStateListener
in interface Connection
public void removeConnectionStateListener(ConnectionStateListener connectionStateListener)
removeConnectionStateListener
in interface Connection
public ConnectionState getState()
Connection
getState
in interface Connection
public ConnectionInformation getConnectionInformation()
getConnectionInformation
in interface Connection
public Map<String,String> getSessionProperties()
Connection
ConnectionState.BOUND
getSessionProperties
in interface Connection
public void addPrivilegeListener(PrivilegeListener listener)
Connection
When adding a new listener it will receive an initial call with the current privileges.
addPrivilegeListener
in interface Connection
public void removePrivilegeListener(PrivilegeListener listener)
removePrivilegeListener
in interface Connection
public Set<String> getPrivileges()
Connection
getPrivileges
in interface Connection
null
.public void browse(Location location, BrowseOperationCallback callback)
Connection
location
- The path to browsecallback
- The callback that shall receive notifications of the operationpublic void write(String itemId, Variant value, OperationParameters operationParameters, WriteOperationCallback callback)
public void writeAttributes(String itemId, Map<String,Variant> attributes, OperationParameters operationParameters, WriteAttributeOperationCallback callback)
public NotifyFuture<WriteResult> startWrite(String itemId, Variant value, OperationParameters operationParameters, CallbackHandler callbackHandler)
public NotifyFuture<WriteAttributeResults> startWriteAttributes(String itemId, Map<String,Variant> attributes, OperationParameters operationParameters, CallbackHandler callbackHandler)
public void subscribeFolder(Location location) throws NoConnectionException, OperationException
public void unsubscribeFolder(Location location) throws NoConnectionException, OperationException
public FolderListener setFolderListener(Location location, FolderListener listener)
Connection
location
- The location for which to set the listenerlistener
- The listener to setnull
if there was no
previous listenerpublic void subscribeItem(String itemId) throws NoConnectionException, OperationException
public void unsubscribeItem(String itemId) throws NoConnectionException, OperationException
protected abstract void performConnect()
protected abstract void performDisconnect()
public ItemUpdateListener setItemUpdateListener(String itemId, ItemUpdateListener listener)
Connection
itemId
- The item for which to set the listenerlistener
- The listener to setnull
if there was no
previous listenerpublic ScheduledExecutorService getExecutor()
Connection
null
public Collection<StatisticEntry> getStatistics()
getStatistics
in interface StatisticsProvider
Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.