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:[EMAIL PROTECTED]
Enviado el: Lunes, 04 de Julio de 2005 11:30 a.m.
Para: [email protected]
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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

- --
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to