[Beepcore-java-users] Re: SessionEventListener question
Status: Beta
Brought to you by:
huston
|
From: Harsh D. <hda...@io...> - 2002-10-03 21:24:53
|
Mike:
Looks like you're still using the old version. I'm not sure
if event driven callback was working in it. Only time 'fireEvent'
seems to be called in 'Session' is when it is being terminated.
I'd suggest you to use new version which has recently been released.
Speaking of new version. I downloaded it recently but I don't see
java doc for '...core.event' package.
If you insist on using old version you may want to register your
main class with profile rather than with 'Session'. If your think
multiple classes may register with profile for receiving start channel
event, you can introduce and interface/abstract class which are
implemented/derived by classes which are interested in such an event.
Or just have a 'Collection' of registered callbacks.
Hope that helps,
HD
----------------------------------------------------------------------
Harsh Daharwal
IOS Networks, Inc.
----------------------------------------------------------------------
---Original Message----------
Hi,
I have a class that listens for connections using a Profile from
another class. After a client connects to start the session I would like
to
be notified when the Profile receives a startChannel event. I do not want
to do any hard coding in my profile that would require the name of my main
class, for obvious reasons. So, I've done the following...
In my main class that listens for connections:
After I establish a BEEP session, I make a call to registerForEvent like so
(also, my main class implements SessionEventListener):
session.registerForEvent(this, SessionEvent.CHANNEL_OPENED_EVENT_CODE);
This compiles fine. Now in my profile class I added the following code to
startChannel:
channel.getSession().fireEvent(SessionEvent.CHANNEL_OPENED_EVENT_CODE,
null);
My hope was that when my profile receives a startChannel event it can then
notify my main class that a channel has started. Unfortunatly, I get a
compile error because fireEvent is protected:
fireEvent(int,java.lang.Object) has protected access in
org.beepcore.beep.core.Session
channel.getSession().fireEvent(SessionEvent.CHANNEL_OPENED_EVENT_CODE,
null);
Perhaps I'm going at this the wrong way? Any suggestions/work-arounds?
Thanks for your time,
-Mike
|