You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by German de la Cruz <gd...@afip.gov.ar> on 2005/07/04 16:12:33 UTC
putting a default value to a read-attribute rule in a configuration-point
Hi, folks!
Apologies if this has been asked and answered before, but I can't find an
answer to this problem.
Is there a way to put a default value to a read-attribute rule of a
configuration-point? I mean, something like skip-if-null, but where there is
a null, it put a defined default value. Something like
<read-attribute property="attribute1" attribute="attribute1"
value-if-null="${some.default.value}"/>
Well, I hope this is clear enough. Thanks in advance
German.-
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
RE: putting a default value to a read-attribute rule in a configuration-point
Posted by German de la Cruz <gd...@afip.gov.ar>.
Ok, this is the solution I found. I put a default value in FactoryDefaults
and then I write an attribute in the service that is contributed with my
contribution.
The problem is want to put the default value in the contribution itself in a
way to avoid putting this attribute in the service because I think it's not
a responsibility of the service but the contribution.
This is the solution I implement....
<service-point id="OperationService" interface="OperationService">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="OperationServiceDefault">
<set-configuration configuration-id="Operations" property="operations"/>
<set property="defaultLanguage" value="${defaults.default-el}"/>
</construct>
</invoke-factory>
</service-point>
<configuration-point id="Operations">
<schema>
<element name="operation">
<attribute name="target" required="true"/>
<attribute name="operation" required="true"/>
<attribute name="language" required="false"/>
<attribute name="message-key"/>
<rules>
<create-object class="OperationImpl"/>
<read-attribute property="target" attribute="target" translator="class"/>
<read-attribute property="operation" attribute="operation"/>
<read-attribute property="messageKey" attribute="message-key"/>
<read-attribute property="language" attribute="language"
skip-if-null="true"/>
<read-content property="content"/>
<invoke-parent method="addElement"/>
</rules>
</element>
</schema>
</configuration-point>
<contribution configuration-id="hivemind.FactoryDefaults">
<default symbol="defaults.default-el" value="groovy"/>
</contribution>
.
And this is an approach that I want to....
<service-point id="OperationService" interface="OperationService">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="OperationServiceDefault">
<set-configuration configuration-id="Operations" property="operations"/>
</construct>
</invoke-factory>
</service-point>
<configuration-point id="Operations">
<schema>
<element name="operation">
<attribute name="target" required="true"/>
<attribute name="operation" required="true"/>
<attribute name="language" required="false"/>
<attribute name="message-key"/>
<rules>
<create-object class="OperationImpl"/>
<read-attribute property="target" attribute="target" translator="class"/>
<read-attribute property="operation" attribute="operation"/>
<read-attribute property="messageKey" attribute="message-key"/>
<read-attribute property="language" attribute="language"
value-if-null="${defaults.default-el}"/>
<read-content property="content"/>
<invoke-parent method="addElement"/>
</rules>
</element>
</schema>
</configuration-point>
<contribution configuration-id="hivemind.FactoryDefaults">
<default symbol="defaults.default-el" value="groovy"/>
</contribution>
Thanks!
-----Mensaje original-----
De: Johan Lindquist [mailto:johan@kawoo.co.uk]
Enviado el: Lunes, 04 de Julio de 2005 11:30 a.m.
Para: hivemind-user@jakarta.apache.org
Asunto: Re: putting a default value to a read-attribute rule in a
configuration-point
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi German,
You can put the default value into the hivemind.FactoryDefaults
configuration point and HiveMind will use that if no other values are found.
<contribution configuration-id="hivemind.FactoryDefaults">
<default symbol="some.default.value" value="the-default-value"/>
</contribution>
Hope that helps,
Johan
German de la Cruz wrote:
> Hi, folks!
>
> Apologies if this has been asked and answered before, but I can't find an
> answer to this problem.
>
> Is there a way to put a default value to a read-attribute rule of a
> configuration-point? I mean, something like skip-if-null, but where there
is
> a null, it put a defined default value. Something like
>
> <read-attribute property="attribute1" attribute="attribute1"
> value-if-null="${some.default.value}"/>
>
> Well, I hope this is clear enough. Thanks in advance
>
> German.-
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
- --
you too?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCyUfrHS6c76+IdrwRAqzfAJ9YXyGQpvsyYixItSZYGmh2ZXOGGACg5puv
iT+lG+EleqaDkmoTqkZkEII=
=RW7A
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
Re: putting a default value to a read-attribute rule in a configuration-point
Posted by Johan Lindquist <jo...@kawoo.co.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi German,
You can put the default value into the hivemind.FactoryDefaults
configuration point and HiveMind will use that if no other values are found.
<contribution configuration-id="hivemind.FactoryDefaults">
<default symbol="some.default.value" value="the-default-value"/>
</contribution>
Hope that helps,
Johan
German de la Cruz wrote:
> Hi, folks!
>
> Apologies if this has been asked and answered before, but I can't find an
> answer to this problem.
>
> Is there a way to put a default value to a read-attribute rule of a
> configuration-point? I mean, something like skip-if-null, but where there is
> a null, it put a defined default value. Something like
>
> <read-attribute property="attribute1" attribute="attribute1"
> value-if-null="${some.default.value}"/>
>
> Well, I hope this is clear enough. Thanks in advance
>
> German.-
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
- --
you too?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCyUfrHS6c76+IdrwRAqzfAJ9YXyGQpvsyYixItSZYGmh2ZXOGGACg5puv
iT+lG+EleqaDkmoTqkZkEII=
=RW7A
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org