3 Replies Latest reply on Sep 16, 2009 8:56 AM by adamw

    RevisionListener customization

    patrick1

      My goal is to use a RevisionListener implementation to add specific logging information to the RevisionEntity I use. For instance I need to add a revision description, the name of the user who triggered the revision....

      I tried to get access to a SessionContext inside my RevisionListener (I annoted my RevisionListener with @Stateless) but the variable is always null so no injection seems to be performed.

      Next problem is how to pass to this RevisionListener a description string ? For instance when the user perform some business task like booking a ticket I would like to put in my RevisionEntity a description string stating something like "User placed an order"

      Any ideas?
      Thanks,
      Patrick

        • 1. Re: RevisionListener customization
          adamw

          Hello,

          a RevisionListener is not an EJB3 compoent so injection won't work there. You can obtain it most probably via JNDI or some other static way. Or, you can get access to the revision entity from the audit reader.

          Adam

          • 2. Re: RevisionListener customization
            patrick1

            Thanks Adam for your answer.

            What do you mean by "some other static way" ? I don't see how this would work in a multi user clients environment (for my case swing rich clients talking to EJBs)?

            - Patrick

            • 3. Re: RevisionListener customization
              adamw

              Well, in many components systems you can access components using some static methods. In Seam, for example, you can do this using Components.get(name). With EJB3, you can access components using JNDI (InitialContext)

              Adam