Re: ASO and hivemind.xml
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]
Re: ASO and hivemind.xml
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]
RE: ASO and hivemind.xml
You can use whatever you want for the module id (usually your application name, though) and the version has to have the format 1.0.0 (three dot-separated version numbers) . -Original Message- From: Blackwings [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 7:34 AM To: Tapestry users Subject: Re: ASO and hivemind.xml 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]
Re: ASO and hivemind.xml
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]
Re: ASO and hivemind.xml
The situation is : I create class that extends ApplicationServlet and I specify it as the tapestry main servlet in web.xml. In this class I call a class that initialise some application objects such as list of element common to everybody from the database. My class also set a bean member and implement the get/set method. I also specified this class as an ASO as you told me to do Geoff and I put the inject tag in my Home.page. At the loading of the application, my application object is loaded normally and contains all the list. When I call the Home.page, the inject seems to work and the pageBeginRender is called normally. I call getMyASO() I declared abstract, but when I try to get the application object it is null!! I think Tapestry recreate an instance of MyASO instead of directly get the first loaded : web.xml ... servlet servlet-namedm/servlet-name display-nameDM Initialization servlet/display-name servlet-classdgt.dm.controller.DossierManagerApplication /servlet-class load-on-startup0/load-on-startup /servlet ... hivemodule.xml ?xml version=1.0 encoding=UTF-8? module id=dgt.dm.controller version=06.02.01 package=dgt.dm.controller contribution configuration-id=tapestry.state.ApplicationObjects state-object name=dossierManagerApplication scope=application create-instance class=dgt.dm.controller.DossierManagerApplication/ /state-object /contribution /module DossierManagerApplication.java public class DossierManagerApplication extends ApplicationServlet { private ApplicationSettings appSettings = null; public ApplicationSettings getAppSettings() { return appSettings; } public void setAppSettings(ApplicationSettings appSettings) { this.appSettings = appSettings; } private InitServlet is = null; public void init(ServletConfig arg0) throws ServletException { super.init(arg0); String webRootPath = getServletContext().getRealPath(/); is = new InitServlet(); is.init(webRootPath); appSettings = is.getAppSettings(); // NOT NULL WHEN I DEBUG } ... HomePage.page ... page-specification class=dgt.dm.pages.HomePage inject property=dossierManagerApplication type=state object=dossierManagerApplication/ /page-specification HomePage.java public abstract DossierManagerApplication getDossierManagerApplication(); public abstract void setDossierManagerApplication(DossierManagerApplication dossierManagerApplication); public void pageBeginRender(PageEvent event) { DossierManagerApplication dossierManagerApplication = getDossierManagerApplication(); ApplicationSettings appSettings = dossierManagerApplication.getAppSettings(); // IS NULL setRequesters(appSettings.getRequesters()); setLanguages(appSettings.getLanguages()); } Thanks for help... BW 2006/7/20, Blackwings [EMAIL PROTECTED]: 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?
RE: ASO and hivemind.xml
Have you tried using a StateObjectFactory? -Original Message- From: Blackwings [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 9:07 AM To: Tapestry users Subject: Re: ASO and hivemind.xml The situation is : I create class that extends ApplicationServlet and I specify it as the tapestry main servlet in web.xml. In this class I call a class that initialise some application objects such as list of element common to everybody from the database. My class also set a bean member and implement the get/set method. I also specified this class as an ASO as you told me to do Geoff and I put the inject tag in my Home.page. At the loading of the application, my application object is loaded normally and contains all the list. When I call the Home.page, the inject seems to work and the pageBeginRender is called normally. I call getMyASO() I declared abstract, but when I try to get the application object it is null!! I think Tapestry recreate an instance of MyASO instead of directly get the first loaded : web.xml ... servlet servlet-namedm/servlet-name display-nameDM Initialization servlet/display-name servlet-classdgt.dm.controller.DossierManagerApplication /servlet-class load-on-startup0/load-on-startup /servlet ... hivemodule.xml ?xml version=1.0 encoding=UTF-8? module id=dgt.dm.controller version=06.02.01 package=dgt.dm.controller contribution configuration-id=tapestry.state.ApplicationObjects state-object name=dossierManagerApplication scope=application create-instance class=dgt.dm.controller.DossierManagerApplication/ /state-object /contribution /module DossierManagerApplication.java public class DossierManagerApplication extends ApplicationServlet { private ApplicationSettings appSettings = null; public ApplicationSettings getAppSettings() { return appSettings; } public void setAppSettings(ApplicationSettings appSettings) { this.appSettings = appSettings; } private InitServlet is = null; public void init(ServletConfig arg0) throws ServletException { super.init(arg0); String webRootPath = getServletContext().getRealPath(/); is = new InitServlet(); is.init(webRootPath); appSettings = is.getAppSettings(); // NOT NULL WHEN I DEBUG } ... HomePage.page ... page-specification class=dgt.dm.pages.HomePage inject property=dossierManagerApplication type=state object=dossierManagerApplication/ /page-specification HomePage.java public abstract DossierManagerApplication getDossierManagerApplication(); public abstract void setDossierManagerApplication(DossierManagerApplication dossierManagerApplication); public void pageBeginRender(PageEvent event) { DossierManagerApplication dossierManagerApplication = getDossierManagerApplication(); ApplicationSettings appSettings = dossierManagerApplication.getAppSettings(); // IS NULL setRequesters(appSettings.getRequesters()); setLanguages(appSettings.getLanguages()); } Thanks for help... BW 2006/7/20, Blackwings [EMAIL PROTECTED]: 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
Re: ASO and hivemind.xml
On 7/20/06, Geoff Callender [EMAIL PROTECTED] wrote: 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) Sorry, this isn't true. As ASOs are typically defined by the application and rarely if every defined by a library, the extra effort for segmenting the ASO namespace did not appear to be worthwhile (in fact, would be a negative, since it would subject users to pain without reward). Thus the ASO namespace is flat, and you'll see errors if you configure more than one ASO with the same name, regardless of module. By contract, the namespace for libraries is rich and nested ... and confusing, and ambiguous, and overkill (just as The Other Geoff). Blackwings would always inject @InjectState(serviceLocator), regardless of what id he gives his module. -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Jakarta HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ASO and hivemind.xml
Howard, thanks for the advice. I have to use JDK1.4 so I cannot use annotations. My real problem is to understand how I can instanciate an object at the context load, in the ApplicationServlet via inheritance and to make this object available to my pages. As I already explained, getGlobal is Deprecated so I have to use the ASO and the inject tag. My question is to understand how ;o) I was able to instanciate my object (appSettings in the code I wrote in my previous post), I was able to setup hivemodule.xml to create an instance of an object but i was not able to inject the right instance of the object. Can you help me on this part please? Thanks anyway BW 2006/7/20, Howard Lewis Ship [EMAIL PROTECTED]: On 7/20/06, Geoff Callender [EMAIL PROTECTED] wrote: 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) Sorry, this isn't true. As ASOs are typically defined by the application and rarely if every defined by a library, the extra effort for segmenting the ASO namespace did not appear to be worthwhile (in fact, would be a negative, since it would subject users to pain without reward). Thus the ASO namespace is flat, and you'll see errors if you configure more than one ASO with the same name, regardless of module. By contract, the namespace for libraries is rich and nested ... and confusing, and ambiguous, and overkill (just as The Other Geoff). Blackwings would always inject @InjectState(serviceLocator), regardless of what id he gives his module. -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Jakarta HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]