On Mar 3, 2006, at 6:41 AM, Greg Wilkins wrote:
Dain Sundstrom wrote:
Object value = session.getState("web:/context-" + name);
Ok I get it now.
Don't have a deep - hard to replicate - structure.
Have a flat structure, but with a scoped name space!
I think this approach solves a lot of issues and probably
reduces the need for extra API.
Cool. We are on the same page... now we just need to determine if it
is the correct page ;)
For example, perhaps we could communicate maxIdleTimes via
naming conventions rather than API:
session.putState("session:maxIdleTimeMs",new Integer(60000));
I think that if we are going to have common well understood data like
this, we should just add it directly to the Session interface. In
gernonimo used this kind of encoded string APIs, and it was a big
PITA, as it means we can use IDE tools to figure out who is setting
data.
I still don't know if this approach can help with event notification,
but I defer that until I have a quasi-working session manager against
the API.
My guess is we're going to need to add an event notification system
to the Session APIs. What do you think about just crib off of the
servlet ones. I think we could just smash the three session listener
interfaces into something like this:
public interface SessionListener extends Listener {
void valueBound(SessionEvent event);
void valueUnbound(SessionEvent event);
void attributeAdded(SessionEvent event);
void attributeRemoved(SessionEvent event);
void attributeRemoved(SessionEvent event);
void valueBound(SessionEvent event);
void valueUnbound(SessionEvent event);
void sessionCreated(SessionEvent event)
void sessionDestroyed(SessionEvent event)
}
public class SessionEvent extends Event {
Session getSession();
String getName();
String getValue();
}
We would bind a listener with a method on the Locator:
void addSessionListener(SessionListener listener);
void removeSessionListener(SessionListener listener);
What do you think?
-dain