Hi Devs, I was working on openoffice server auto-start feature and faced a few problems with it.
To start the openoffice server when XE is started, I need to send a notification to openoffice server manager when XE is started. The first attempt was to use our ObservationManager component to send startup / shutdown events and let OpenOfficeServerManager listen to them. But this approach requires that OpenOfficeServerManager component is loaded on XE startup so that it can recieve the startup notification. As a solution I tried to use <load-on-startup> components list in plexus.xml file but since OpenOfficeServerManager has a dependancy on ConfigurationSourceCollection component, it fails to load on startup. This is because ConfigurationSourceCollection requires a valid ApplicationContext to be present for it's operation but at the time plexus is loading <load-on-startup> components, no ApplicationContext is present. The core issue is, plexus is initialized before we initialize ApplicationContext; and we can't change this order either. Since the above approach is not going to work, I propose to introduce an ApplicationContextInitializer component pretty much alike RequestInitializer and ExecutionContextInitializer. The idea is to allow any component to do further initializations on ApplicationContext if they need to do so. When XE is started up and an ApplicationContext is created, ApplicationContextInitializerManager will lookup for all the components that implement ApplicationContextInitializer and let them a chance to execute their own initializations. But this doesn't solve the problem of shutdown notifications. For shutdown notifications we can either use the plain old ObservationManager component or we can do the following; rather than having ApplicationContextInitializer and ApplicationContextInitializerManager, we will have ApplicationContextListener and ApplicationContextListenerManager. ApplicationContextListener will have two methods like contextCreated() and contextDestroyed() that will allow any component to perform startup / shutdown tasks. But still, I don't see where we can invoke contextDestroyed() method from, I looked at both servlet container API and portlet container API and couldn't find a consistent way of invoking the contextDestroyed() method. Please let me know what you think about this idea. Thanks. - Asiri _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

