3 Replies Latest reply on Nov 3, 2006 3:18 PM by Bradley Smith

    jBPM and @Unwrap question

    Bradley Smith Master

      Hello,

      I am trying to come up with a pattern for initializing the Seam Actor for jBPM in my system. There is no login action in my system - we're authenticating using a custom Tomcat Valve (integration with an enterprise SSO system). So I tried to use the @Unwrap approach here:

      @Name("initjBPMActor")
      public class InitjBPMActor {
      
       @Logger Log log;
      
       @In
       private Principal userPrincipal;
      
       @Unwrap
       public Actor getActor() {
       // get an instance of Actor, set it's id using the userPrincipal.name value
       Actor actor = Actor.instance();
       actor.setId(userPrincipal.getName());
       log.info("getActor() : Actor -> "+actor);
       // todo - remove logging...
       return actor;
       }
      }
      


      I have a SFSB in which the Actor is @In'jected. When I invoke a method that uses the actor, it doesn't seem that getActor() is ever called (I don't see the log.info() message in my logging output). Furthermore, I think that this attempt to @Unwrap the Actor is causing problems with Seam, because once I attempt to invoke a method in my SFSB which does nothing but log.info()'s, I do not see output of the log.info()'s and the test case appears to fail (SeamTest).

      If it's not possible to use Actor with @Unwrap (because it gets special handling by Seam), then is it possible to specify that the Actor ALWAYS gets its id from userPrincipal.name? (i.e. - some kind of default strategy - maybe it's a good idea to provide a few different strategies in the framework to pick from, including a custom strategy).

      Thanks,
      Brad Smith