Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Using a Custom LifecycleListener class

Steven Davelaar edited this page Mar 18, 2016 · 1 revision

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.

Clone this wiki locally