Friday, September 2, 2011

Run a scheduler automatically on WAS 7 0r 6

https://www-304.ibm.com/support/docview.wss?uid=swg21412991


Startup Beans

Among the WebSphere Application Server extensions, you can find Startup beans. Startup beans expose a start and a stop method, which are invoked by the server if the Startup beans service in enabled (see Related URL: "Startup Beans Service setup").

Startup beans are configured by creating one Stateless Session bean that uses a specific Home and Remote interface, provided by WebSphere Application Server.

There are two names for these interfaces, depending on whether the startup Bean must execute at Application Startup or Module Startup:

1. Application Startup
1. com.ibm.websphere.startupservice.AppStartUpHome (Home)
2. com.ibm.websphere.startupservice.AppStartUp (Remote)
2. Module Startup
1. com.ibm.websphere.startupservice.ModStartUpHome (Home)
2. com.ibm.websphere.startupservice.ModStartUp (Remote)

The bean class must implement the start and stop methods provided by the Remote Interface.

The nature of these Remote interfaces is such that they cannot be used in an EJB 3.0, since the Remote interface extends: javax.ejb.EJBObject.


--------------------------------------------------------------------
 enterprise-beans>

StartupCode
com.ibm.websphere.startupservice.AppStartUpHome
com.ibm.websphere.startupservice.AppStartUp
ejbs.StartupCodeBean
Stateless
Container


--------------------------------------------------------------


package ejbs;

/**
* Bean implementation class for Enterprise Bean: StartupCode
*/
public class StartupCodeBean implements javax.ejb.SessionBean {
public boolean start() throws java.rmi.RemoteException{
System.out.println("Application Start Code "+this);

return true;
};


public void stop() throws java.rmi.RemoteException{

System.out.println("Application Stop Code "+this);

};
static final long serialVersionUID = 3206093459760846163L;
private javax.ejb.SessionContext mySessionCtx;
/**
* getSessionContext
*/
public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
}
/**
* setSessionContext
*/
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
}
/**
* ejbCreate
*/
public void ejbCreate() throws javax.ejb.CreateException {
}
/**
* ejbActivate
*/
public void ejbActivate() {
}
/**
* ejbPassivate
*/
public void ejbPassivate() {
}
/**
* ejbRemove
*/
public void ejbRemove() {
}
}

Followers