Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Status: DRAFT
Created: 10. Januar January 2009
Author: fmeschbe
Updated: 13. January 2009, fmeschbe, Prototype implementation

Table of Contents
minLevel2

...

The main class or servlet provide the launcher with two Runnable instances: stopNotifier and updateNotifier. The stopNotifier a Notifiable instances. The Notifiable.stopped() is called if the framework has been stopped. The updateNotifier Notifiable.updated(File) is called if the framework has been stopped for it to be restarted, where the file argument may be the new launcher JAR to use.

The stopNotifier Runnable Notifiable.stopped method enables the main class or servlet to react to the situation that the framework has gone and take appropriate actions. The updateNotifier Runable Notifiable.updated(File) method enables the main class or servlet to drop the framework and classloader and restart the framework in a new class loader with a potentiall potentially new launcher JAR.

5 Prototype

I will be creating have prepared a prototype implementation in my whiteboard

...

of this concept in my white board at http://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/launchpadImage Added.

The launchpad/base module creates two artifacts: The primary artifact is included with the final application. The secondary artifact is the actual launcher JAR file.

...

The primary artifact contains three elements:

  • Notifier Notifiable interface with two methods stopped – called when the framework has been stopped – and updated – called when the framework has been updated and needs to be restarted. This interface is to be implemented by the main class or servlet.
  • Loader creates the URLClassLoader with the launcher JAR and instantiates the launcher class. This class is implemented as a utility class with a two methods loadLauncher and cleanupVM:

...

  • Launcher interface which is implemented by classes in the secondary artifact. This interface has a method to support the standaline Java Application case (setCommandLine). To support the Web Application, the launcher class is expected to implement the javax.servlet.Servlet interface. The Launcher interface is defined as follows:
Code Block

// set sling home for the framework
public void setSlingHome(String slingHome);

// set the Notifiable to be informed on stop/update
public void setNotifiable(Notifiable notifiable);

// sets command line arguments, mainly used by the main class
public void setCommandLine(String[] args);

// starts the framework
public void start();

// stops the framework
// this method only returns when the framework has actually been stopped.
// this method may be used by the main class or servlet to initiate a
// shutdown of the framework
public void stop();

...