A Swiss Army Knife for OSGi

aQute.bnd.build
Class ProjectLauncher

java.lang.Object
  extended by aQute.bnd.build.ProjectLauncher

public abstract class ProjectLauncher
extends java.lang.Object

A Project Launcher is a base class to be extended by launchers. Launchers are JARs that launch a framework and install a number of bundles and then run the framework. A launcher jar must specify a Launcher-Class manifest header. This class is instantiated and cast to a LauncherPlugin. This plug in is then asked to provide a ProjectLauncher. This project launcher is then used by the project to run the code. Launchers must extend this class.


Field Summary
static int ACTIVATOR_ERROR
           
static int CANCELED
           
static int CUSTOM_LAUNCHER
           
static int DUPLICATE_BUNDLE
           
static java.lang.String EMBEDDED_ACTIVATOR
           
static int ERROR
           
static int NONE
           
static int OK
           
static int RESOLVE_ERROR
           
static int SERVICES
           
static int TIMEDOUT
           
static int UPDATE_NEEDED
           
static int WARNING
           
 
Constructor Summary
ProjectLauncher(Project project)
           
 
Method Summary
 boolean addActivator(java.lang.String e)
           
 void addClasspath(Container container)
           
 void addDefault(java.lang.String defaultSpec)
          Add the specification for a set of bundles the runpath if it does not already is included.
 void addRunBundle(java.lang.String f)
           
 void addRunVM(java.lang.String arg)
           
 void cancel()
           
 void clear()
           
protected  void error(java.lang.String message, java.lang.Object... args)
           
 Jar executable()
          Create a self executable.
 java.util.Collection<java.lang.String> getActivators()
           
 java.util.Collection<java.lang.String> getArguments()
           
 java.util.Collection<java.lang.String> getClasspath()
           
 java.util.List<java.lang.String> getErrors()
           
abstract  java.lang.String getMainTypeName()
           
 Project getProject()
           
 java.util.Collection<java.lang.String> getRunBundles()
           
 int getRunFramework()
          Either NONE or SERVICES to indicate how the remote end launches.
 java.util.Collection<java.lang.String> getRunpath()
           
 java.util.Map<java.lang.String,java.lang.String> getRunProperties()
           
 java.util.Collection<java.lang.String> getRunVM()
           
 java.io.File getStorageDir()
           
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getSystemPackages()
           
 long getTimeout()
           
 boolean getTrace()
           
 java.util.List<java.lang.String> getWarnings()
           
 boolean isKeep()
           
 int launch()
           
abstract  void prepare()
          Should be called when all the changes to the launchers are set.
protected  void reportResult(int result)
           
 void setKeep(boolean keep)
           
 void setRunFramework(int n)
           
 void setTimeout(long timeout, java.util.concurrent.TimeUnit unit)
           
 void setTrace(boolean level)
           
abstract  void update()
           
protected  void updateFromProject()
          Collect all the aspect from the project and set the local fields from them.
protected  void warning(java.lang.String message, java.lang.Object... args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICES

public static final int SERVICES
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

OK

public static final int OK
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

TIMEDOUT

public static final int TIMEDOUT
See Also:
Constant Field Values

UPDATE_NEEDED

public static final int UPDATE_NEEDED
See Also:
Constant Field Values

CANCELED

public static final int CANCELED
See Also:
Constant Field Values

DUPLICATE_BUNDLE

public static final int DUPLICATE_BUNDLE
See Also:
Constant Field Values

RESOLVE_ERROR

public static final int RESOLVE_ERROR
See Also:
Constant Field Values

ACTIVATOR_ERROR

public static final int ACTIVATOR_ERROR
See Also:
Constant Field Values

CUSTOM_LAUNCHER

public static final int CUSTOM_LAUNCHER
See Also:
Constant Field Values

EMBEDDED_ACTIVATOR

public static final java.lang.String EMBEDDED_ACTIVATOR
See Also:
Constant Field Values
Constructor Detail

ProjectLauncher

public ProjectLauncher(Project project)
                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

updateFromProject

protected void updateFromProject()
                          throws java.lang.Exception
Collect all the aspect from the project and set the local fields from them. Should be called

Throws:
java.lang.Exception

addClasspath

public void addClasspath(Container container)
                  throws java.lang.Exception
Throws:
java.lang.Exception

addRunBundle

public void addRunBundle(java.lang.String f)

getRunBundles

public java.util.Collection<java.lang.String> getRunBundles()

addRunVM

public void addRunVM(java.lang.String arg)

getRunpath

public java.util.Collection<java.lang.String> getRunpath()

getClasspath

public java.util.Collection<java.lang.String> getClasspath()

getRunVM

public java.util.Collection<java.lang.String> getRunVM()

getArguments

public java.util.Collection<java.lang.String> getArguments()

getRunProperties

public java.util.Map<java.lang.String,java.lang.String> getRunProperties()

getStorageDir

public java.io.File getStorageDir()

getMainTypeName

public abstract java.lang.String getMainTypeName()

update

public abstract void update()
                     throws java.lang.Exception
Throws:
java.lang.Exception

launch

public int launch()
           throws java.lang.Exception
Throws:
java.lang.Exception

reportResult

protected void reportResult(int result)

setTimeout

public void setTimeout(long timeout,
                       java.util.concurrent.TimeUnit unit)

getTimeout

public long getTimeout()

cancel

public void cancel()

getSystemPackages

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getSystemPackages()

setKeep

public void setKeep(boolean keep)

isKeep

public boolean isKeep()

setTrace

public void setTrace(boolean level)

getTrace

public boolean getTrace()

prepare

public abstract void prepare()
                      throws java.lang.Exception
Should be called when all the changes to the launchers are set. Will calculate whatever is necessary for the launcher.

Throws:
java.lang.Exception

getProject

public Project getProject()

addActivator

public boolean addActivator(java.lang.String e)

getActivators

public java.util.Collection<java.lang.String> getActivators()

getRunFramework

public int getRunFramework()
Either NONE or SERVICES to indicate how the remote end launches. NONE means it should not use the classpath to run a framework. This likely requires some dummy framework support. SERVICES means it should load the framework from the claspath.

Returns:

setRunFramework

public void setRunFramework(int n)

addDefault

public void addDefault(java.lang.String defaultSpec)
                throws java.lang.Exception
Add the specification for a set of bundles the runpath if it does not already is included. This can be used by subclasses to ensure the proper jars are on the classpath.

Parameters:
defaultSpec - The default spec for default jars
Throws:
java.lang.Exception

executable

public Jar executable()
               throws java.lang.Exception
Create a self executable.

Throws:
java.lang.Exception

clear

public void clear()

getErrors

public java.util.List<java.lang.String> getErrors()

getWarnings

public java.util.List<java.lang.String> getWarnings()

error

protected void error(java.lang.String message,
                     java.lang.Object... args)

warning

protected void warning(java.lang.String message,
                       java.lang.Object... args)

Licensed under Apache Software License 2.0

Copyright å© aQute SARL (2000, 2011). All Rights Reserved.