Thanks both of you for this precision ;)
My second question is more about how to create/instantiate a "application
object" at the ApplicationServlet level and make this instance available for
all.
I think the hivemodule.xml create a new instance of my custom
ApplicationServlet and didn't use the one instanciate by Tapestry because
the hivemodule is not aware aboit the fact the object I target is an
ApplicationServlet.
But, If I create an instance of the ApplicationSettings (see my code below)
using the hivemodule, how can my ApplicationServlet
(DossierManagerApplication) can refer to this instance? Can I use inject in
the app.application (dm.application in my case) as I have to do for
Homepage.page ?
2006/7/20, Geoff Callender <[EMAIL PROTECTED]>:
Others might chime in because I'm no expert on this, but this what I
believe to be true...
- The module id and version can be arbitrary. However, to avoid name
clashes you can use the id as a qualifier, eg.
@InjectState("jumpstart: serviceLocator")
So the id forms a namespace. Why would you get name clashes?
Because you can have more than one hivemodule.xml file in your
classpath and HiveMind will pick up all of them - in addition to its
own hivemind.xml.
- The package name allows you to abbreviate your class names in the
rest of the module, which I didn't do, so I wasted that feature.
Can someone else confirm all of this?
Cheers,
Geoff
On 20/07/2006, at 9:33 PM, Blackwings wrote:
> Thanks a lot, but I have a question again: To what, the id in the
> module
> tag, refer? Is it the name of my context? is it app? is it the
> package where
> something (what?) is store? Same question for the version.
>
> Thanks anyway
>
> BW
>
> 2006/7/20, Geoff Callender <[EMAIL PROTECTED]>:
>>
>> BW,
>>
>> No need to touch hivemind.xml. Add a file called hivemodule.xml to
>> WEB-INF, with content similar to this:
>>
>> <?xml version="1.0"?>
>>
>> <module id="jumpstart" version="1.0.0" package="jumpstart.web">
>>
>> <!-- ServiceLocator and Visit -->
>>
>> <contribution configuration-
>> id="tapestry.state.ApplicationObjects
>> ">
>> <state-object name="serviceLocator"
>> scope="application">
>> <create-instance class="
>> jumpstart.web.base.ServiceLocator"/>
>> </state-object>
>> </contribution>
>>
>> <contribution configuration-
>> id="tapestry.state.ApplicationObjects
>> ">
>> <state-object name="visit" scope="session">
>> <create-instance
>> class="jumpstart.web.base.Visit
>> "/>
>> </state-object>
>> </contribution>
>>
>> </module>
>>
>> In that example, ServiceLocator performs a similar function to the
>> typical Global. Visit is just like the old Visit. Note that the
>> scope of ServiceLocator is "application" and the scope of Visit is
>> "session".
>>
>> Here's an example of them being referenced in a page:
>>
>> @InjectState("serviceLocator")
>> public abstract ServiceLocator getServiceLocator();
>>
>> @InjectState("visit")
>> // Can't call it getVisit() because it conflicts with a
>> deprecated
>> IPage method
>> public abstract Visit getMyVisit();
>>
>> Hope this helps.
>>
>> Geoff
>> http://tapestry.apache.org/tapestry4.1/QuickStart/contributed.html
>>
>>
>> On 20/07/2006, at 7:58 PM, Blackwings wrote:
>>
>> > Hi,
>> >
>> > I found in the document what is the line to add into hivemind.xml
>> > file to
>> > create an ASO since getGlobal is deprecated. But I didn't find a
>> > standard"
>> > hivemind.xml file and I have no idea what is mandatory to put in. I
>> > just
>> > want to declare my ASO object to be able to inject it in my page.
>> >
>> > So, where can I find a standard hivemind.xml or what do I have to
>> > put in to
>> > still have my application working normally?
>> >
>> > Thanks
>> >
>> > BW
>>
>>
>> ---------------------------------------------------------------------
>> 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]