You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Chris Burnley <ch...@gmail.com> on 2005/09/13 17:39:42 UTC

set-property with service

I'm trying to get my head around schemas / configuration / contributions 
etc. so I took took the panarama example and cut it down changed the names 
and am attempting to inject a service into a property as part of the 
conversion rules.

This is on hivemind-1.1-beta2 (using simple standard interfaces such as 
Comparator and Runnable): 

<?xml version="1.0"?>
<module id="hivetest" version="1.0.0" package="hivetest">

<service-point id="Comparator" interface="java.util.Comparator">
<create-instance class="impl.TestComparator"/> 
</service-point>

<schema id="Obj">
<element name="obj">
<attribute name="attr"/>
<conversion class="impl.Obj"/>
</element>
<element name="sobj">
<attribute name="attr"/>
<rules>
<create-object class="impl.Obj"/>
<invoke-parent method="addElement"/>
<read-content property="attr"/> 
<!-- this is the problem line below : --> 
<set-property property="comparator" value="service:hivetest.Comparator"/>
</rules>
</element>
</schema>

<configuration-point id="Objs" schema-id="Obj" /> 

<service-point id="TestService" interface="java.lang.Runnable">
<invoke-factory>
<construct class="impl.TestService">
<set-configuration configuration-id="Objs" property="objs"/>
</construct>
</invoke-factory>
</service-point>

<contribution configuration-id="hivetest.Objs">
<obj attr="test"/> 
<obj attr="test2"/> 
<sobj>test3</sobj>
</contribution>

</module>

Basically, the comparator property is not being set and there is no feedback 
why. If I change the type of the property to a string, the string value is 
set but it looks like the translator for service is not being invoked inside 
the rules element.

Is there something wrong with what I am doing ? 

regards, 

Chris

Re: set-property with service

Posted by Chris Burnley <ch...@gmail.com>.
You got me ... I should know better :-)



On 9/14/05, James Carman <ja...@carmanconsulting.com> wrote:
> 
>  You know, unit tests are supposed to come first. :-) That way, you can 
> run them before fixing the problem and make sure that they actually fail 
> before your fix.
> 
>   ------------------------------
>  
> *From:* Chris Burnley [mailto:chris.burnley@gmail.com] 
> *Sent:* Wednesday, September 14, 2005 9:53 AM
> *To:* hivemind-user@jakarta.apache.org
> *Subject:* Re: set-property with service
>  
>  I've raised HIVEMIND-150 and attached a diff to address the problem in 
> the simplest way possible: add a translator attribute to set-property so 
> that the translator type can be specified, defaulting to "smart".
> 
> I've tested it locally and works fine. Will update with unit test soon 
> (gotta get back to work ! )
>  
> On 9/14/05, *Knut Wannheden* < knut.wannheden@gmail.com> wrote:
> 
> Now I see what the problem is. You cannot use the <set-property> rule 
> the way you'd like to use it. The <set-property> rule always uses the
> smart translator which doesn't understand the value
> "service:hivetest.Comparator". As a workaround you could use the
> <set-module> rule and then use the Module in the hivetest.impl.Obj
> class to lookup the Comparator service. That's of course not very
> nice...
> 
> It seems like it should be possible to support object providers in the
> <set-property> rule. Can you report that as an issue? What do others 
> think about that?
> 
> --knut
> 
> On 9/14/05, Chris Burnley <ch...@gmail.com> wrote:
> > Yeah, I've tried moving elements around a bit but to no avail. I am in 
> the 
> > process of debugging it now will raise an issue soon, hopefully with 
> some
> > more useful information.
> >
> > Thanks, Chris
> >
> >
> > On 9/14/05, Knut Wannheden < knut.wannheden@gmail.com> wrote:
> > > Chris,
> > >
> > > Try to move the <invoke-parent> rule after the <set-property> rule in
> > > your schema. I think that should work.
> > >
> > > Yet, if it just silently fails the way you have it, it looks like a
> > > bug. Care to open a bug report in JIRA?
> > >
> > > Regards,
> > >
> > > --knut
> > > 
> > > On 9/13/05, Chris Burnley <ch...@gmail.com> wrote:
> > > > I'm trying to get my head around schemas / configuration / 
> contributions
> > > > etc. so I took took the panarama example and cut it down changed the 
> 
> > names
> > > > and am attempting to inject a service into a property as part of the
> > > > conversion rules.
> > > >
> > > > This is on hivemind-1.1-beta2 (using simple standard interfaces such 
> as 
> > > > Comparator and Runnable):
> > > >
> > > > <?xml version="1.0"?>
> > > > <module id="hivetest" version="1.0.0" package="hivetest"> 
> > > >
> > > > <service-point id="Comparator" interface="java.util.Comparator">
> > > > <create-instance class="impl.TestComparator"/> 
> > > > </service-point>
> > > >
> > > > <schema id="Obj">
> > > > <element name="obj">
> > > > <attribute name="attr"/> 
> > > > <conversion class="impl.Obj "/>
> > > > </element>
> > > > <element name="sobj">
> > > > <attribute name="attr"/>
> > > > <rules> 
> > > > <create-object class="impl.Obj"/>
> > > > <invoke-parent method="addElement"/>
> > > > <read-content property="attr"/>
> > > > <!-- this is the problem line below : -->
> > > >
> > > > <set-property property="comparator"
> > > > value="service:hivetest.Comparator"/>
> > > > </rules>
> > > > </element>
> > > > </schema> 
> > > >
> > > > <configuration-point id="Objs" schema-id="Obj" />
> > > >
> > > > <service-point id="TestService" interface="java.lang.Runnable ">
> > > > <invoke-factory>
> > > > <construct class="impl.TestService">
> > > > <set-configuration
> > configuration-id="Objs"
> > > > property="objs"/>
> > > > </construct>
> > > > </invoke-factory> 
> > > > </service-point>
> > > >
> > > > <contribution configuration-id=" hivetest.Objs">
> > > > <obj attr="test"/>
> > > > <obj attr="test2"/> 
> > > > <sobj>test3</sobj>
> > > > </contribution>
> > > >
> > > > </module>
> > > >
> > > > Basically, the comparator property is not being set and there is no 
> > > > feedback why. If I change the type of the property to a string, the
> > string
> > > > value is set but it looks like the translator for service is not 
> being
> > > > invoked inside the rules element. 
> > > >
> > > > Is there something wrong with what I am doing ?
> > > >
> > > > regards,
> > > >
> > > > Chris
> > > >
> > >
> >
> > 
>  
>

RE: set-property with service

Posted by James Carman <ja...@carmanconsulting.com>.
You know, unit tests are supposed to come first. :-)  That way, you can run
them before fixing the problem and make sure that they actually fail before
your fix.

 

  _____  

From: Chris Burnley [mailto:chris.burnley@gmail.com] 
Sent: Wednesday, September 14, 2005 9:53 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: set-property with service

 

I've raised HIVEMIND-150 and attached a diff to address the problem in the
simplest way possible: add a translator attribute to set-property so that
the translator type can be specified, defaulting to "smart".

I've tested it locally and works fine. Will update with unit test soon
(gotta get back to work ! )

On 9/14/05, Knut Wannheden < <ma...@gmail.com>
knut.wannheden@gmail.com> wrote:

Now I see what the problem is. You cannot use the <set-property> rule 
the way you'd like to use it. The <set-property> rule always uses the
smart translator which doesn't understand the value
"service:hivetest.Comparator". As a workaround you could use the
<set-module> rule and then use the Module in the hivetest.impl.Obj
class to lookup the Comparator service. That's of course not very
nice...

It seems like it should be possible to support object providers in the
<set-property> rule. Can you report that as an issue? What do others 
think about that?

--knut

On 9/14/05, Chris Burnley <ch...@gmail.com> wrote:
> Yeah, I've tried moving elements around a bit but to no avail. I am in the

> process of debugging it now will raise an issue soon, hopefully with some
> more useful information.
>
>  Thanks, Chris
>
>
> On 9/14/05, Knut Wannheden < <ma...@gmail.com>
knut.wannheden@gmail.com> wrote:
> > Chris,
> >
> > Try to move the <invoke-parent> rule after the <set-property> rule in
> > your schema. I think that should work.
> >
> > Yet, if it just silently fails the way you have it, it looks like a
> > bug. Care to open a bug report in JIRA?
> >
> > Regards,
> >
> > --knut
> > 
> > On 9/13/05, Chris Burnley <ch...@gmail.com> wrote:
> > > I'm trying to get my head around schemas / configuration /
contributions
> > > etc. so I took took the panarama example and cut it down changed the 
> names
> > > and am attempting to inject a service into a property as part of the
> > > conversion rules.
> > >
> > >  This is on hivemind-1.1-beta2 (using simple standard interfaces such
as 
> > > Comparator and Runnable):
> > >
> > >  <?xml version="1.0"?>
> > >  <module id="hivetest" version="1.0.0" package="hivetest"> 
> > >
> > >      <service-point id="Comparator" interface="java.util.Comparator">
> > >          <create-instance class="impl.TestComparator"/> 
> > >      </service-point>
> > >
> > >      <schema id="Obj">
> > >          <element name="obj">
> > >              <attribute name="attr"/> 
> > >              <conversion class="impl.Obj "/>
> > >          </element>
> > >          <element name="sobj">
> > >              <attribute name="attr"/>
> > >              <rules> 
> > >                  <create-object class="impl.Obj"/>
> > >                  <invoke-parent method="addElement"/>
> > >                  <read-content property="attr"/>
> > >                 <!-- this is the problem line below : -->
> > >
> > >                  <set-property property="comparator"
> > > value="service:hivetest.Comparator"/>
> > >              </rules>
> > >          </element>
> > >      </schema> 
> > >
> > >      <configuration-point id="Objs" schema-id="Obj" />
> > >
> > >      <service-point id="TestService" interface="java.lang.Runnable ">
> > >          <invoke-factory>
> > >              <construct class="impl.TestService">
> > >                  <set-configuration
> configuration-id="Objs"
> > > property="objs"/>
> > >              </construct>
> > >          </invoke-factory> 
> > >      </service-point>
> > >
> > >      <contribution configuration-id=" hivetest.Objs">
> > >        <obj attr="test"/>
> > >          <obj attr="test2"/> 
> > >          <sobj>test3</sobj>
> > >        </contribution>
> > >
> > >  </module>
> > >
> > >  Basically, the comparator property is not being set and there is no 
> > > feedback why. If I change the type of the property to a string, the
> string
> > > value is set but it looks like the translator for service is not being
> > > invoked inside the rules element. 
> > >
> > >  Is there something wrong with what I am doing ?
> > >
> > >  regards,
> > >
> > >  Chris
> > >
> >
>
> 

 


Re: set-property with service

Posted by Chris Burnley <ch...@gmail.com>.
I've raised HIVEMIND-150 and attached a diff to address the problem in the 
simplest way possible: add a translator attribute to set-property so that 
the translator type can be specified, defaulting to "smart".

I've tested it locally and works fine. Will update with unit test soon 
(gotta get back to work ! )

On 9/14/05, Knut Wannheden <kn...@gmail.com> wrote:
> 
> Now I see what the problem is. You cannot use the <set-property> rule
> the way you'd like to use it. The <set-property> rule always uses the
> smart translator which doesn't understand the value
> "service:hivetest.Comparator". As a workaround you could use the
> <set-module> rule and then use the Module in the hivetest.impl.Obj
> class to lookup the Comparator service. That's of course not very
> nice...
> 
> It seems like it should be possible to support object providers in the
> <set-property> rule. Can you report that as an issue? What do others
> think about that?
> 
> --knut
> 
> On 9/14/05, Chris Burnley <ch...@gmail.com> wrote:
> > Yeah, I've tried moving elements around a bit but to no avail. I am in 
> the
> > process of debugging it now will raise an issue soon, hopefully with 
> some
> > more useful information.
> >
> > Thanks, Chris
> >
> >
> > On 9/14/05, Knut Wannheden <kn...@gmail.com> wrote:
> > > Chris,
> > >
> > > Try to move the <invoke-parent> rule after the <set-property> rule in
> > > your schema. I think that should work.
> > >
> > > Yet, if it just silently fails the way you have it, it looks like a
> > > bug. Care to open a bug report in JIRA?
> > >
> > > Regards,
> > >
> > > --knut
> > >
> > > On 9/13/05, Chris Burnley <ch...@gmail.com> wrote:
> > > > I'm trying to get my head around schemas / configuration / 
> contributions
> > > > etc. so I took took the panarama example and cut it down changed the
> > names
> > > > and am attempting to inject a service into a property as part of the
> > > > conversion rules.
> > > >
> > > > This is on hivemind-1.1-beta2 (using simple standard interfaces such 
> as
> > > > Comparator and Runnable):
> > > >
> > > > <?xml version="1.0"?>
> > > > <module id="hivetest" version="1.0.0" package="hivetest">
> > > >
> > > > <service-point id="Comparator" interface="java.util.Comparator">
> > > > <create-instance class="impl.TestComparator"/>
> > > > </service-point>
> > > >
> > > > <schema id="Obj">
> > > > <element name="obj">
> > > > <attribute name="attr"/>
> > > > <conversion class="impl.Obj "/>
> > > > </element>
> > > > <element name="sobj">
> > > > <attribute name="attr"/>
> > > > <rules>
> > > > <create-object class="impl.Obj"/>
> > > > <invoke-parent method="addElement"/>
> > > > <read-content property="attr"/>
> > > > <!-- this is the problem line below : -->
> > > >
> > > > <set-property property="comparator"
> > > > value="service:hivetest.Comparator"/>
> > > > </rules>
> > > > </element>
> > > > </schema>
> > > >
> > > > <configuration-point id="Objs" schema-id="Obj" />
> > > >
> > > > <service-point id="TestService" interface="java.lang.Runnable">
> > > > <invoke-factory>
> > > > <construct class="impl.TestService">
> > > > <set-configuration
> > configuration-id="Objs"
> > > > property="objs"/>
> > > > </construct>
> > > > </invoke-factory>
> > > > </service-point>
> > > >
> > > > <contribution configuration-id=" hivetest.Objs">
> > > > <obj attr="test"/>
> > > > <obj attr="test2"/>
> > > > <sobj>test3</sobj>
> > > > </contribution>
> > > >
> > > > </module>
> > > >
> > > > Basically, the comparator property is not being set and there is no
> > > > feedback why. If I change the type of the property to a string, the
> > string
> > > > value is set but it looks like the translator for service is not 
> being
> > > > invoked inside the rules element.
> > > >
> > > > Is there something wrong with what I am doing ?
> > > >
> > > > regards,
> > > >
> > > > Chris
> > > >
> > >
> >
> >
>

Re: set-property with service

Posted by Knut Wannheden <kn...@gmail.com>.
Now I see what the problem is. You cannot use the <set-property> rule
the way you'd like to use it. The <set-property> rule always uses the
smart translator which doesn't understand the value
"service:hivetest.Comparator". As a workaround you could use the
<set-module> rule and then use the Module in the hivetest.impl.Obj
class to lookup the Comparator service. That's of course not very
nice...

It seems like it should be possible to support object providers in the
<set-property> rule. Can you report that as an issue? What do others
think about that?

--knut

On 9/14/05, Chris Burnley <ch...@gmail.com> wrote:
> Yeah, I've tried moving elements around a bit but to no avail. I am in the
> process of debugging it now will raise an issue soon, hopefully with some
> more useful information.
>  
>  Thanks, Chris
> 
> 
> On 9/14/05, Knut Wannheden <kn...@gmail.com> wrote:
> > Chris,
> > 
> > Try to move the <invoke-parent> rule after the <set-property> rule in
> > your schema. I think that should work.
> > 
> > Yet, if it just silently fails the way you have it, it looks like a
> > bug. Care to open a bug report in JIRA? 
> > 
> > Regards,
> > 
> > --knut
> > 
> > On 9/13/05, Chris Burnley <ch...@gmail.com> wrote:
> > > I'm trying to get my head around schemas / configuration / contributions
> > > etc. so I took took the panarama example and cut it down changed the
> names
> > > and am attempting to inject a service into a property as part of the
> > > conversion rules.
> > >
> > >  This is on hivemind-1.1-beta2 (using simple standard interfaces such as
> > > Comparator and Runnable):
> > >
> > >  <?xml version="1.0"?>
> > >  <module id="hivetest" version="1.0.0" package="hivetest"> 
> > >
> > >      <service-point id="Comparator" interface="java.util.Comparator">
> > >          <create-instance class="impl.TestComparator"/>
> > >      </service-point> 
> > >
> > >      <schema id="Obj">
> > >          <element name="obj">
> > >              <attribute name="attr"/>
> > >              <conversion class="impl.Obj "/>
> > >          </element>
> > >          <element name="sobj">
> > >              <attribute name="attr"/>
> > >              <rules>
> > >                  <create-object class="impl.Obj"/>
> > >                  <invoke-parent method="addElement"/>
> > >                  <read-content property="attr"/>
> > >                 <!-- this is the problem line below : -->
> > >
> > >                  <set-property property="comparator"
> > > value="service:hivetest.Comparator"/>
> > >              </rules>
> > >          </element>
> > >      </schema>
> > >
> > >      <configuration-point id="Objs" schema-id="Obj" /> 
> > >
> > >      <service-point id="TestService" interface="java.lang.Runnable">
> > >          <invoke-factory>
> > >              <construct class="impl.TestService">
> > >                  <set-configuration
> configuration-id="Objs"
> > > property="objs"/>
> > >              </construct>
> > >          </invoke-factory>
> > >      </service-point>
> > >
> > >      <contribution configuration-id=" hivetest.Objs">
> > >        <obj attr="test"/>
> > >          <obj attr="test2"/>
> > >          <sobj>test3</sobj>
> > >        </contribution>
> > >
> > >  </module>
> > >
> > >  Basically, the comparator property is not being set and there is no
> > > feedback why. If I change the type of the property to a string, the
> string
> > > value is set but it looks like the translator for service is not being 
> > > invoked inside the rules element.
> > >
> > >  Is there something wrong with what I am doing ?
> > >
> > >  regards,
> > >
> > >  Chris
> > >
> > 
> 
>

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


Re: set-property with service

Posted by Chris Burnley <ch...@gmail.com>.
Yeah, I've tried moving elements around a bit but to no avail. I am in the 
process of debugging it now will raise an issue soon, hopefully with some 
more useful information.

Thanks, Chris

On 9/14/05, Knut Wannheden <kn...@gmail.com> wrote:
> 
> Chris,
> 
> Try to move the <invoke-parent> rule after the <set-property> rule in
> your schema. I think that should work.
> 
> Yet, if it just silently fails the way you have it, it looks like a
> bug. Care to open a bug report in JIRA?
> 
> Regards,
> 
> --knut
> 
> On 9/13/05, Chris Burnley <ch...@gmail.com> wrote:
> > I'm trying to get my head around schemas / configuration / contributions
> > etc. so I took took the panarama example and cut it down changed the 
> names
> > and am attempting to inject a service into a property as part of the
> > conversion rules.
> >
> > This is on hivemind-1.1-beta2 (using simple standard interfaces such as
> > Comparator and Runnable):
> >
> > <?xml version="1.0"?>
> > <module id="hivetest" version="1.0.0" package="hivetest">
> >
> > <service-point id="Comparator" interface="java.util.Comparator">
> > <create-instance class="impl.TestComparator"/>
> > </service-point>
> >
> > <schema id="Obj">
> > <element name="obj">
> > <attribute name="attr"/>
> > <conversion class="impl.Obj"/>
> > </element>
> > <element name="sobj">
> > <attribute name="attr"/>
> > <rules>
> > <create-object class="impl.Obj"/>
> > <invoke-parent method="addElement"/>
> > <read-content property="attr"/>
> > <!-- this is the problem line below : -->
> >
> > <set-property property="comparator"
> > value="service:hivetest.Comparator"/>
> > </rules>
> > </element>
> > </schema>
> >
> > <configuration-point id="Objs" schema-id="Obj" />
> >
> > <service-point id="TestService" interface="java.lang.Runnable">
> > <invoke-factory>
> > <construct class="impl.TestService">
> > <set-configuration configuration-id="Objs"
> > property="objs"/>
> > </construct>
> > </invoke-factory>
> > </service-point>
> >
> > <contribution configuration-id="hivetest.Objs">
> > <obj attr="test"/>
> > <obj attr="test2"/>
> > <sobj>test3</sobj>
> > </contribution>
> >
> > </module>
> >
> > Basically, the comparator property is not being set and there is no
> > feedback why. If I change the type of the property to a string, the 
> string
> > value is set but it looks like the translator for service is not being
> > invoked inside the rules element.
> >
> > Is there something wrong with what I am doing ?
> >
> > regards,
> >
> > Chris
> >
>

Re: set-property with service

Posted by Knut Wannheden <kn...@gmail.com>.
Chris,

Try to move the <invoke-parent> rule after the <set-property> rule in
your schema. I think that should work.

Yet, if it just silently fails the way you have it, it looks like a
bug. Care to open a bug report in JIRA?

Regards,

--knut

On 9/13/05, Chris Burnley <ch...@gmail.com> wrote:
> I'm trying to get my head around schemas / configuration / contributions
> etc. so I took took the panarama example and cut it down changed the names
> and am attempting to inject a service into a property as part of the
> conversion rules.
>  
>  This is on hivemind-1.1-beta2 (using simple standard interfaces such as
> Comparator and Runnable): 
>  
>  <?xml version="1.0"?>
>  <module id="hivetest" version="1.0.0" package="hivetest">
>      
>      <service-point id="Comparator" interface="java.util.Comparator">
>          <create-instance class="impl.TestComparator"/>    
>      </service-point>
>              
>      <schema id="Obj">
>          <element name="obj">
>              <attribute name="attr"/>
>              <conversion class="impl.Obj"/>
>          </element>
>          <element name="sobj">
>              <attribute name="attr"/>
>              <rules>
>                  <create-object class="impl.Obj"/>
>                  <invoke-parent method="addElement"/>
>                  <read-content property="attr"/>  
>                 <!-- this is the problem line below : -->                   
>          
>                  <set-property property="comparator"
> value="service:hivetest.Comparator"/>
>              </rules>
>          </element>
>      </schema>
>              
>      <configuration-point id="Objs" schema-id="Obj" /> 
>              
>      <service-point id="TestService" interface="java.lang.Runnable">
>          <invoke-factory>
>              <construct class="impl.TestService">
>                  <set-configuration configuration-id="Objs"
> property="objs"/>
>              </construct>
>          </invoke-factory>
>      </service-point>
>  
>      <contribution configuration-id="hivetest.Objs">
>        <obj attr="test"/> 
>          <obj attr="test2"/> 
>          <sobj>test3</sobj>
>        </contribution>
>  
>  </module>
>  
>  Basically, the comparator property is not being set and there is no
> feedback why. If I change the type of the property to a string, the string
> value is set but it looks like the translator for service is not being
> invoked inside the rules element.
>  
>  Is there something wrong with what I am doing ? 
>  
>  regards, 
>  
>  Chris
>

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