hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject RE: setting properties on an interceptor
Date Sun, 11 Dec 2005 02:19:38 GMT
Colin,

It looks like you should do:

<interceptor service-id="TransactionInterceptor"> 
  <timeout value=”1000 (or whatever you want it to be)” />
</interceptor>

But, I'm not convinced that you're schema is set up correctly.  You're not
adding the timeout value to the parameters.  You might try something like
this:

<parameters-schema> 
  <element name="timeout">
    <attribute name="value" translator="int"/>
  </element>
  <rules>
    <push-attribute attribute="value"/>
    <invoke-parent method="addElement"/>
  </rules>
</parameters-schema>

Now, this is off the top of my head, so it might not work as is.  I'm just
trying to nudge you in the right direction.  But, based on what I see, this
seems like it will work.  Good luck.  Let us know if we can be of any more
help.

James

________________________________________
From: Colin Taylor [mailto:colin.taylor@gmail.com] 
Sent: Saturday, December 10, 2005 8:48 PM
To: hivemind-user@jakarta.apache.org
Subject: Re: setting properties on an interceptor

Thanks for you answer, Knut.

Unforunately still havent reached nirvana on this issue or on Hivemind
service configuration in general.
Having looked at the well, complexity of schemas and contributions, I cant
help but wonder is that really necessary for this use case? I just want to
have a default timeout set up from my Transaction Interceptor and have the
ability to override on a per service basis. I started mapping this out with
schemas and contributions and was starting to clock up the lines of xml.
Futhermore I felt like I was programming in xml, which is never a good
feeling as its verbosity and magic mappings start to obscure intent. 

My [still incomplete] attempt follows. If anyone can shed further light I'd
appreciate it, I truly hope I must be missing something. 
  

  <service-point id="TransactionInterceptor" interface="
org.apache.hivemind.ServiceInterceptorFactory">
        <invoke-factory model="primitive">
            <construct class=TransactionInterceptorFactory">
                <set-service property="factory" service-id="
hivemind.ClassFactory"/>
                <set-configuration configuration-id="TransactionDefaults"
/>
            </construct>
        </invoke-factory>
        <parameters-schema> 

            <element name="timeout">
                <attribute name="value" translator="int"/>
            </element>
        </parameters-schema>
    </service-point>

    <configuration-point id="TransactionDefaults" occurs="1">
        Configuration that defines default behavior of the
TransactionService.
        It must be contributed exactly once in the whole application. 

        <schema>
            <element name="defaults">
                <element name="timeout">
                    <attribute name="value"/>
                </element> 
            </element>
        </schema>
    </configuration-point>


    <contribution configuration-id="TransactionDefaults">
        <defaults>
            <timeout value="300"/> 
        </defaults>
    </contribution>

    <service-point id="MyServices" interface="com.MyServices">
        <invoke-factory>
            <construct class=" com.MyServicesImpl">
            </construct>
        </invoke-factory>
        <interceptor service-id="hivemind.LoggingInterceptor"/>
        <interceptor service-id="TransactionInterceptor"> 
?? what goes here???
        </interceptor>
    </service-point>



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message