public class TestSubagent extends Object implements Runnable, TransportStateListener, RegistrationCallback
TestSubagent
is an example implementation of a simple
AgentX subagent with shared tables and multi context registration.Modifier and Type | Field and Description |
---|---|
static OID |
SUBAGENT_ID |
Constructor and Description |
---|
TestSubagent(Address masterAddress,
Address localAddress) |
Modifier and Type | Method and Description |
---|---|
void |
connectionStateChanged(TransportStateEvent change) |
static void |
main(String[] args) |
protected void |
register() |
protected void |
registerSessionDependent() |
void |
registrationEvent(OctetString context,
ManagedObject mo,
int status)
The registration attempt of a
ManagedObject succeeded or
failed. |
void |
run() |
boolean |
tableRegistrationEvent(OctetString context,
MOTable mo,
MOTableRow row,
boolean indexAllocation,
int status,
int retryCount)
The registration attempt of a
ManagedObject succeeded or
failed. |
void |
tableUnregistrationEvent(OctetString context,
MOTable mo,
MOTableRow row,
boolean indexAllocation,
int status)
The unregistration attempt of a
ManagedObject succeeded or
failed. |
protected void |
unregisterFailed(List failedRegistrations)
Remove objects from the server, which could not be registered with
the master agent.
|
protected void |
unregisterSessionDependent() |
void |
unregistrationEvent(OctetString context,
ManagedObject mo,
int status)
The unregistration attempt of a
ManagedObject succeeded or
failed. |
public static final OID SUBAGENT_ID
public static void main(String[] args)
protected void register() throws DuplicateRegistrationException
DuplicateRegistrationException
protected void unregisterSessionDependent()
protected void registerSessionDependent() throws DuplicateRegistrationException
DuplicateRegistrationException
protected void unregisterFailed(List failedRegistrations)
failedRegistrations
- a List of ManagedObjects and MOTableRows which failed to register.public void connectionStateChanged(TransportStateEvent change)
connectionStateChanged
in interface TransportStateListener
public void registrationEvent(OctetString context, ManagedObject mo, int status)
RegistrationCallback
ManagedObject
succeeded or
failed.registrationEvent
in interface RegistrationCallback
context
- the registration context.mo
- the ManagedObject
that was subject to the registration
process.status
- the AgentX status of the registration response.public boolean tableRegistrationEvent(OctetString context, MOTable mo, MOTableRow row, boolean indexAllocation, int status, int retryCount)
RegistrationCallback
ManagedObject
succeeded or
failed.tableRegistrationEvent
in interface RegistrationCallback
context
- the registration context.mo
- the MOTable
that was subject to the registration
process.row
- the row whose index or region was subject to the
allocation/registration.indexAllocation
- true
if this event relates to an index allocation
request and false
if it relates to a row region
registration.status
- the AgentX status of the registration response.retryCount
- the number of retries already processed. This value can be used to
avoid endless loops.true
if the caller should retry the registration operation,
false
otherwise.public void unregistrationEvent(OctetString context, ManagedObject mo, int status)
RegistrationCallback
ManagedObject
succeeded or
failed.unregistrationEvent
in interface RegistrationCallback
context
- the registration context.mo
- the ManagedObject
that was subject to the registration
process.status
- the AgentX status of the registration response.public void tableUnregistrationEvent(OctetString context, MOTable mo, MOTableRow row, boolean indexAllocation, int status)
RegistrationCallback
ManagedObject
succeeded or
failed.tableUnregistrationEvent
in interface RegistrationCallback
context
- the registration context.mo
- the MOTable
that was subject to the registration
process.row
- the row whose index or region was subject to the
allocation/registration.indexAllocation
- true
if this event relates to an index allocation
request and false
if it relates to a row region
registration.status
- the AgentX status of the registration response.Copyright © 2016 SNMP4J.org. All rights reserved.