You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Johan Maasing <jm...@gmail.com> on 2007/08/31 16:40:21 UTC

int translator default not working?

Hivemind 1.1.1
I am trying to get the int translator to provide a default value in my
schema rules.
The schema looks somehting like this (abbreviated):
<schema id="myid">
	<element name="Semaphore">
		<attribute name="name" required="true" />
		<attribute name="maxPermits" />

		<attribute name="maxWait" translator="int,default=1000" />

		<rules>
			<create-object class="my.config.Config" />
			<read-attribute attribute="name" property="name" />
			<read-attribute attribute="maxPermits"
				property="maxPermits"  translator="int,default=25"/>
			<read-attribute attribute="maxWait" property="maxWait" />
			<invoke-parent method="addElement" />
		</rules>
	</element>
</schema>

I use it to configure an interceptor ( the interceptor factory points
to a schema-id ) :

<interceptor service-id="my.Interceptor">
	<Semaphore name="myName" />
</interceptor>


The interceptor can retrieve the configuration class from its
parameters in the createInterceptor call
my.config.Config config = (my.config.Config) parameters.get(0);

However the maxPermits and maxWait both have 0 as the value. I would
assume that the attribute definition:
	<attribute name="maxWait" translator="int,default=1000" />
Would provide the default value.
I've tried to override the translator in the read-attribute rule (see
example above) but still no default value.

So, did I do something wrong?