SnmpProxyCommitter
, SnmpProxyReloader
, SnmpTransactionStrategy
public class SnmpProxyAdapter extends Object implements SnmpProxyCommitter, SnmpProxyReloader, SnmpTransactionStrategy
SnmpProxyAdapter
is the central implementation of the mapping between the
SnmpService
and a SnmpProxyObject
. The adapter is responsible to map changes
collection by the proxy objects to change sets queued on the SNMP service. In addition,
the adapter provides the mapping of the SNMP values and the corresponding model values.
For read operations, this mapping is actually handled by the proxy objects themselves using
the {}@link VariableBindingMapper} provided by this adapter.Modifier and Type | Class | Description |
---|---|---|
protected class |
SnmpProxyAdapter.CommitListenerProxy |
|
protected class |
SnmpProxyAdapter.CommitTask |
|
protected class |
SnmpProxyAdapter.ReloadTask |
Constructor | Description |
---|---|
SnmpProxyAdapter(SnmpService snmpService,
org.snmp4j.Target target,
VariableBindingMapper variableBindingMapper) |
Modifier and Type | Method | Description |
---|---|---|
void |
addChange(SnmpProxyObject proxyObject,
SnmpValuesChangeSet change) |
Adds a change on the specified proxy object to the queue.
|
TaskId |
commitChanges(SnmpCommitListener commitListener) |
Commit the changes in the current queue asynchronously in the background.
|
SnmpIsolationLevel |
getIsolationLevel() |
Gets the isolation level for this transaction.
|
int |
getNumberOfPendingChanges() |
Gets the total number of changes in the queue (independently of a particular proxy object).
|
protected List<TaskId> |
processReloadQueue(SnmpProxyReloadListener reloadListener) |
|
void |
queueReload(SnmpProxyObject proxyObject) |
Queue a proxy object for reload.
|
List<TaskId> |
reloadQueued(SnmpProxyReloadListener reloadListener) |
Actually reload all queued proxy objects asynchronously in background.
|
List<SnmpValuesChangeSet> |
removeAllChanges(SnmpProxyObject proxyObject) |
Remove all changes for a given proxy object.
|
SnmpValuesChangeSet |
removeLastChangeSet(SnmpProxyObject proxyObject) |
Remove the last change from the queue for the specified proxy object.
|
SnmpValuesChangeSet |
validateChange(SnmpValuesChangeSet change) |
Validate the change set provided.
|
public SnmpProxyAdapter(SnmpService snmpService, org.snmp4j.Target target, VariableBindingMapper variableBindingMapper)
snmpService
- the SNMP service to use for reloading and updating SNMP values.target
- the target (i.e., address of the SNMP agent) that act as SNMP command responder.variableBindingMapper
- the variable binding mapper that maps between model values and SNMP values and vice versa.public SnmpValuesChangeSet validateChange(SnmpValuesChangeSet change)
SnmpProxyCommitter
validateChange
in interface SnmpProxyCommitter
change
- a change set.true
if the change set is valid that is, if all model values in the change can be mapped
(converted) to SNMP values.public void addChange(SnmpProxyObject proxyObject, SnmpValuesChangeSet change)
SnmpProxyCommitter
addChange
in interface SnmpProxyCommitter
proxyObject
- the proxy object that changed.change
- the values change set that describes the changes that should be applied to the proxy and its
remote object.public SnmpValuesChangeSet removeLastChangeSet(SnmpProxyObject proxyObject)
SnmpProxyCommitter
removeLastChangeSet
in interface SnmpProxyCommitter
proxyObject
- the proxy object for which the change to remove was added with
SnmpProxyCommitter.addChange(SnmpProxyObject, SnmpValuesChangeSet)
.null
if there is no such change.public List<SnmpValuesChangeSet> removeAllChanges(SnmpProxyObject proxyObject)
SnmpProxyCommitter
removeAllChanges
in interface SnmpProxyCommitter
proxyObject
- the proxy object for which all changes should be removed from the queue.public TaskId commitChanges(SnmpCommitListener commitListener)
SnmpProxyCommitter
commitChanges
in interface SnmpProxyCommitter
commitListener
- a callback listener for commit status events.public int getNumberOfPendingChanges()
SnmpProxyCommitter
getNumberOfPendingChanges
in interface SnmpProxyCommitter
public void queueReload(SnmpProxyObject proxyObject)
SnmpProxyReloader
SnmpProxyReloader.reloadQueued(SnmpProxyReloadListener)
is called.queueReload
in interface SnmpProxyReloader
proxyObject
- the proxy object to reload.public List<TaskId> reloadQueued(SnmpProxyReloadListener reloadListener)
SnmpProxyReloader
reloadQueued
in interface SnmpProxyReloader
reloadListener
- the callback listener which receives updates on the reload process.TaskId
instances for the each affected proxy object. If a reload
for a proxy object failed to start (because of network issues or incorrect target definitions),
null
is returned for that element.protected List<TaskId> processReloadQueue(SnmpProxyReloadListener reloadListener)
public SnmpIsolationLevel getIsolationLevel()
SnmpTransactionStrategy
getIsolationLevel
in interface SnmpTransactionStrategy
Copyright © 2020 SNMP4J.org. All rights reserved.