![]() |
|
To create and use Server Startup Hooks, do the following:
com.pramati.services.j2ee.spi.StartupHook interface.deploy-config.xml located in the <install_dir>/server/nodes/<node_name>/config directory. For example:
<startup-hooks> <class-name>com.pramati.test.MyStartupHook<class-name> <startup-hooks>
<install_dir>/server/lib/ext directory. In case the class is not in a jar, it has to be placed in a classes directory under the <install_dir>/server/lib/ext directory. The classes directory can be created manually under the lib/ext directory, if not present.Creating the Server hook requires you to implement the com.pramati.services.j2ee.spi.StartupHook interface.
This interface should implement the following methods:
start(): This method is executed on successful start of the server. Tasks that need to be performed at the start of the server can be specified here.stop(): This method is executed on server shutdown. Tasks that need to be performed on server shutdown can be specified here.postAutoStartAppsStart(): This method is executed when all the applications deployed on the server and specified as auto-start are started.preAppsShutdown(): This method is executed before all applications running on the server are shutdown.Here is a sample of a class that implements StartupHook interface:
package com.server.hooks.ServerHook;
import com.pramati.services.j2ee.spi.StartupHook;
public class ServerHook implements StartupHook
{
public void start()
{System.out.println("Server Startup Hook Started");}
public void stop()
{System.out.println("Server Startup Hook Stopped");}
public void postAutoStartAppsStart()
{System.out.println("Server Startup Hook Post Startup of Apps");}
public void preAppsShutdown()
{System.out.println("Server Shutdown...");}
}
pramati_spi.jar in your classpath. This library is available in <install_dir>/server/lib/pramati.
deploy-config.xml. This class is picked up by the Deploy Service. The tag looks as below:
<startup-hooks> <class-name>com.server.hooks.ServerHook<class-name> </startup-hooks>
| © Pramati Technologies 2007 | Runs on Pramati Server | Feedback | Legal |