[SNMP4J] Maintaining asynchronous functionality in the application

Peter Mellquist peter_nature at yahoo.com
Mon Sep 4 21:47:28 CEST 2006


Kurian, I will try to answer what I think your question is.....

Responselistener is an 'interface' used within the Session class. So, when you say you would like to provide a 'wrapper' class, I think this can be done in a few different ways depending on your goal. For example you can create your own Snmp class by extending  it

public class mySnmp extends Snmp
{
      MyResponseListener listener;
.
// implements ResponseListener interface
void onRespsonse( ResponseEvent event)
{
         // call your own listener
         listener.asynchCallBack( event);

}
.
.
// example of wrapping asynch get, note useage of your own listener MyResponselistener
public void get( PDU pdu, Target target, object userHandle, MyResponseListener listener)
{
       this.listener = listener;
       // calls base class get method, asych responses will come to 'this'
       get( pdu, target, userHandle, this);

}
.
}

The interface might look like
public interface MyResponseListener
{
      public void asynchCallBack( ResponseEvent event);
}

This class can implement ResponseListener such that all asynch responses come to it. When they do, you will callback your own listener MyRespsonse listener ( you will need to create this interface ).

This class can provide its own interfaces which in turn call the Snmp base class. You can thereby provide all your own 'wrapped' interfaces including your own Responselistener like interface. You only need to inplement the members you want, the remainder will be inherited.

Using an approach like this you can bridge one API set into another. For example, you can replace an older or more expensive JAVA SNMP API with SNMP4J under the hood ( get rid of AdventNet and use SNMP4J) 


Best Regards,
Peter Mellquist



----- Original Message ----
From: kurian.pulickal at wipro.com
To: snmp4j at agentpp.org
Cc: fock at snmp4j.org
Sent: Monday, September 4, 2006 11:29:22 AM
Subject: [SNMP4J] Maintaining asynchronous functionality in the application


Hi,


We want to use a custom listener in our application to maintain
asynchronous functionality. The listener (ResponseListener) provided by
SNMP4J  will only be used in our wrapper class for SNMP4J. Once we get
the response in the wrapper class, without any blocking, we want to
invoke our custom listener. How can we achieve this by decoupling the
processing within the callback method?


Any help would be appreciated.


Regards,
Kurian





The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.


WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.


www.wipro.com
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j







More information about the SNMP4J mailing list