Package org.apache.sling.launchpad.base.app

# Class MainDelegate

java.lang.Object
org.apache.sling.launchpad.base.app.MainDelegate

All Implemented Interfaces:
  `Launcher`

public class MainDelegate extends Object implements Launcher
The `Main` class is a simple Java Application which interprests the command line and creates the `Sling` launcher class and thus starts the OSGi framework. In addition a shutdown thread is registered to ensure proper shutdown on VM termination.

The supported command line options are:

-l loglevel
  Sets the initial loglevel as an integer in the range 0 to 4 or as one of the well known level strings FATAL, ERROR, WARN, INFO or DEBUG. This option overwrites the `org.apache.sling.osg.log.level` setting the `sling.properties` file.
-f logfile
  The log file, \"-\" for stdout (default logs/error.log). This option overwrites the `org.apache.sling.osg.log.file` setting the `sling.properties` file.
-c slinghome
  The directory in which Sling locates its initial configuration file `sling.properties` and where files of Sling itself such as the Apache Felix bundle archive or the JCR repository files are stored (default sling).
-a address
  The interfact to bind to (use 0.0.0.0 for any). This option is not implemented yet.
-p port
  The port to listen (default 8080) to handle HTTP requests. This option overwrites the `org.osgi.service.http.port` setting the `sling.properties` file.
-h
  Prints a simple usage message listing all available command line options.

## Constructor Summary

Constructors
Constructor
Description
`MainDelegate()`

## Method Summary

Modifier and Type
Method
Description
`void`
`setCommandLine(Map<String,String> args)`
The commandline provided from the standalone launch case.
`void`
`setNotifiable(Notifiable notifiable)`
The `Notifiable` to notify on framework stop or update
`void`
`setSlingHome(String slingHome)`
Sets the sling.home to be used for starting the framework.
`boolean`
`start()`
Starts the framework and returns `true` if successfull.
`void`
`stop()`
Stops the framework.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MainDelegate

public MainDelegate()

## Method Details

### setNotifiable

public void setNotifiable(Notifiable notifiable)
Description copied from interface: `Launcher`
The `Notifiable` to notify on framework stop or update

Specified by:
  `setNotifiable` in interface `Launcher`
Parameters:
  `notifiable` - The notifiable

### setCommandLine

public void setCommandLine(Map<String,String> args)
Description copied from interface: `Launcher`
The commandline provided from the standalone launch case.

Specified by:
  `setCommandLine` in interface `Launcher`
Parameters:
  `args` - The commandline

### setSlingHome

public void setSlingHome(String slingHome)
Description copied from interface: `Launcher`
Sets the sling.home to be used for starting the framework. This method must be called with a non-`null` argument before trying to start the framework.

Specified by:
  `setSlingHome` in interface `Launcher`
Parameters:
  `slingHome` - The sling.home directory

### start

public boolean start()
Description copied from interface: `Launcher`
Starts the framework and returns `true` if successfull.

Specified by:
  `start` in interface `Launcher`
Returns:
  `true` if the framework has been started successfully

### stop

public void stop()
Description copied from interface: `Launcher`
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.

Specified by:
  `stop` in interface `Launcher`