commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yanick Duchesne" <yduche...@newtrade.com>
Subject RE: Jelly and context scope
Date Mon, 22 Sep 2003 19:22:54 GMT
Thanks!!!!!!!

It worked!

-----Original Message-----
From: Scott Howlett [mailto:howlett@cadence.com]
Sent: September 22, 2003 1:37 PM
To: Jakarta Commons Users List
Subject: RE: Jelly and context scope


Jelly does inherit contexts like you desire. But it is up to you to
create the child contexts as necessary. In your <component> tag, you
should be making a child JellyContext which you use when invoking the
tag body:

    public void doTag(XMLOutput output) throws JellyTagException {

        // ... process attributes ...

        // invoke tag body
        getBody().run(context.newJellyContext(), output);

        // ... other processing ...
    }


The setInherit method indicates whether a JellyContext should look up a
requested variable name in its parent context if the name is not found
in itself. There is a bug that make contexts sometimes behave as if
inheritance was set to "true" even when you have set them to false,
basically because various bits of code are using context.findVariable()
instead of context.getVariable():

http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-74


Regards,
Scott Howlett

> -----Original Message-----
> From: Yanick Duchesne [mailto:yduchesne@newtrade.com] 
> Sent: Monday, September 22, 2003 12:35 PM
> To: commons-user@jakarta.apache.org
> Subject: Jelly and context scope
> 
> 
> I am using Jelly to instantiate the components of an 
> application; format looks as follows (a simplified version of 
> original):
> 
> <app>
>     <property name="port" value="1099"/>
> 
>     <component name="A" class="org.acme~CompA">
> 
>         <!-- overrides global port -->
>         <property name="port" value="1100"/>
> 
>         <config>
>            <port>${port}</port>
>         </config>
>     </component>
> 
>    <!-- 1099 should be used as value for port -->
>     <component name="B" class="org.acme~CompB">
>         <config>
>            <port>${port}</port>
>         </config>
>     </component>
> 
> </app>
> 
> I have implemented Jelly tags for my configuration format; 
> The format supports defining 'property' elements that 
> internally associate a name/value pair to the current 
> JellyContext. Properties can be overriden at the component 
> level (see 'component' element above) but these properties 
> should have component scope only. I thought Jelly supported 
> this, but it seems it
> doesn't: in my example, component B receives 1100 as a port 
> value when, if scoped context would be supported, it should 
> receive the "global" port defined under the root element.
> 
> In my code, I call the setInherit(true) method on the initial 
> JellyContext; does not have any effect. Is there a work-around?
> 
> 
> Yanick Duchesne
> Software Architect
> Architecte d'applications
> Newtrade/Expedia
> yduchesne@newtrade.com
> tel +1 514 286 8187 x 3009

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


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


Mime
View raw message