[jboss-user] [JBoss Seam] - Context listener

tzman do-not-reply at jboss.com
Wed May 23 15:10:12 EDT 2007


As a learning/debug helper I am trying to catch events when  components are stored/removed from any context. org.jboss.seam.preSetVariable and the like do pretty much what I am looking for, but I would like to set this in a more coarse grained manner. As it is now, to use this I need to create a method for each event and for each variable I want to catch an event on. I would like to declare the components I want to catch events on and receive the events on the same listener.

I could programatically add the observer when I see a component I am interested in but when the method is called I will not know which component it is for as there is no parameter passed to these methods.

As an example if I have the following:

  | @Name( "personAction" )
  | @Scope( ScopeType=PAGE )
  | public class PersonAction implements Serializable
  | {
  |     @In( scope=ScopeType.SESSION )
  |     Person person;
  |     
  |     ...
  | }
  | 
And a listener something like:

  |     public presetVariable( Event someEvent )
  |     {
  |         log.debug( "Event variable:" + someEvent.getVariable() );
  |         log.debug( "Component:" + someEvent.getComponent() );
  |         log.debug( "Contect type:" + someEvent.getContextType() );
  |     }
  | 

If somehow, in a yet determined way, I configure this component as an Observer for my event. I would like notification of when "personAction" and "person" have been added to context and removed from context and which context that is.

I am not sure if there is already a means to do this, so any insight is appreciated.

Thanks.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048023#4048023

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048023



More information about the jboss-user mailing list