3 Replies Latest reply on Jul 21, 2010 10:08 AM by mwohlf

    Passing arguments to own identity Component

    cmshizzl

      Hi,

       

      i plugged in my own identity component like it is described in the documentation.

       

      <transaction-context>
        <object class="your.package.YourIdentitySessionImpl" />
      </transaction-context>

      My SessionImpl class implements the Identity Session. This all works fine so far. But now i want to pass the
      id of the database to the sessionImpl because there are running severale databases on the server. I couldn't figure
      out how to pass the arguments in the object of the transaction-context, so that the constructor of the
      sessionImpl will be initialized with these arguments...

        • 1. Re: Passing arguments to own identity Component
          rebody

          Hi Narf,

           

          From your description,  I cannot find how to get the database id.  Maybe you send database id from HttpServletRequest,  Maybe you configured database id in a properties file.  Maybe something else.

           

          So I just can tell you how to get variable from environment.  Here is the way to configure a variable in transaction-context and get it from in IdentitySession.

           

           

          <transaction-context>
            <string name="databaseId" value="databaseId"/>
          </transaction-context>
          

           

           

          EnvironmentImpl.getFromCurrent("databaseId")
          
          • 2. Re: Passing arguments to own identity Component
            cmshizzl

            Hi HuiSheng,

             

            that worked fine for me! Thank you!

            • 3. Re: Passing arguments to own identity Component
              mwohlf

              you can also inject directly like this:

               

              <object class='your.package.YourIdentitySessionImpl'>
                     <field name='dbIdString'><string value='myDatabaseId' /></field>
              </object>