SignOnNotifier.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.udapsoft.waf.system.session;
  2. import java.io.Serializable;
  3. import java.util.HashMap;
  4. import javax.servlet.ServletContext;
  5. import javax.servlet.http.HttpSession;
  6. import javax.servlet.http.HttpSessionAttributeListener;
  7. import javax.servlet.http.HttpSessionBindingEvent;
  8. import kr.co.hsnc.j2ee.waf.controller.web.EventMapping;
  9. import kr.co.hsnc.j2ee.waf.controller.web.util.WebKeys;
  10. import kr.co.hsnc.j2ee.waf.event.Event;
  11. public class SignOnNotifier implements Serializable, HttpSessionAttributeListener {
  12. private static final long serialVersionUID = -4296859568175624957L;
  13. public void attributeAdded(HttpSessionBindingEvent se) {
  14. processEvent(se);
  15. }
  16. public void attributeRemoved(HttpSessionBindingEvent se) {
  17. }
  18. public void attributeReplaced(HttpSessionBindingEvent se) {
  19. processEvent(se);
  20. }
  21. private void processEvent(HttpSessionBindingEvent se) {
  22. HttpSession session = se.getSession();
  23. String name = se.getName();
  24. }
  25. /**
  26. * The EventMapping object contains information that will match
  27. * a event class name to an EJBActionClass.
  28. * @param context
  29. * @param eventClass
  30. * @return
  31. */
  32. private EventMapping getEventMapping(ServletContext context, Event eventClass) {
  33. HashMap eventMappings = (HashMap)context.getAttribute(WebKeys.EVENT_MAPPINGS);
  34. String eventClassName = eventClass.getClass().getName();
  35. if( (eventMappings != null) && eventMappings.containsKey(eventClassName) ) {
  36. return (EventMapping)eventMappings.get(eventClassName);
  37. }
  38. else {
  39. return null;
  40. }
  41. }
  42. }