-
Notifications
You must be signed in to change notification settings - Fork 12
Using a Custom LifecycleListener class
The first time you finish the Business Objects from REST Service Wizard, AMPA will change the application lifecycle event listener class configured in maf-application.xml to oracle.ateam.sample.mobile.lifecycle.InitDBLifeCycleListener. If you need to execute custom code in the lifecyle event listener class, then you can reset the application lifecycle event listener class configured in maf-application.xml to the default LifeCycleListenerImpl class that is included in your ApplicationController project.

When you do this, you need to change the LifeCycleListenerImpl class so that it extends from the AMPA InitDBLifeCycleListener class, and in every lifecycle listener method, you need to invoke the super method to ensure that AMPA lifecycle listener functionality will be executed as well:
public class LifeCycleListenerImpl extends InitDBLifeCycleListener {
public LifeCycleListenerImpl() {
}
public void start() {
super.start();
}
public void stop() {
super.stop();
}
public void activate() {
super.activate();
}
public void deactivate() {
super.deactivate();
}
}
When you run the AMPA Business Objects from REST Service Wizard for a second time, AMPA will preserve your settings.