aQute.bnd.build
Class ProjectLauncher

java.lang.Object
  extended by aQute.bnd.build.ProjectLauncher
Direct Known Subclasses:
JUnitLauncher

public abstract class ProjectLauncher
extends 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.


Nested Class Summary
static interface ProjectLauncher.NotificationListener
           
static class ProjectLauncher.NotificationType
           
 
Field Summary
static int ACTIVATOR_ERROR
           
static int CANCELED
           
static int CUSTOM_LAUNCHER
           
static int DUPLICATE_BUNDLE
           
static 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(String e)
           
protected  void addClasspath(Collection<Container> path)
           
 void addClasspath(Container container)
           
 void addDefault(String defaultSpec)
          Add the specification for a set of bundles the runpath if it does not already is included.
 void addRunBundle(String f)
           
 void addRunProgramArgs(String arg)
           
 void addRunVM(String arg)
           
 void cancel()
           
 void cleanup()
          Is called after the process exists.
 void clear()
           
protected  void error(String message, Object... args)
           
 Jar executable()
          Create a self executable.
 Collection<String> getActivators()
           
 Collection<String> getArguments()
          Deprecated. 
 Collection<String> getClasspath()
           
 File getCwd()
           
 List<String> getErrors()
           
abstract  String getMainTypeName()
           
 Set<ProjectLauncher.NotificationListener> getNotificationListeners()
           
 Project getProject()
           
 Collection<String> getRunBundles()
           
 Map<String,String> getRunEnv()
           
 int getRunFramework()
          Either NONE or SERVICES to indicate how the remote end launches.
 String getRunJdb()
           
 List<String> getRunpath()
           
 Collection<String> getRunProgramArgs()
           
 Map<String,String> getRunProperties()
           
 Collection<String> getRunVM()
           
 File getStorageDir()
           
 String getSystemCapabilities()
           
 Map<String,? extends Map<String,String>> getSystemPackages()
           
 long getTimeout()
           
 boolean getTrace()
           
 List<String> getWarnings()
           
protected  int invoke(Class<?> main, String[] args)
           
 boolean isKeep()
           
 int launch()
           
abstract  void prepare()
          Should be called when all the changes to the launchers are set.
 void registerForNotifications(ProjectLauncher.NotificationListener listener)
           
protected  void reportResult(int result)
           
 void setCwd(File cwd)
           
 void setKeep(boolean keep)
           
 void setRunFramework(int n)
           
 void setTimeout(long timeout, TimeUnit unit)
           
 void setTrace(boolean level)
           
 int start(ClassLoader parent)
           
abstract  void update()
           
protected  void updateFromProject()
          Collect all the aspect from the project and set the local fields from them.
protected  void warning(String message, 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 String EMBEDDED_ACTIVATOR
See Also:
Constant Field Values
Constructor Detail

ProjectLauncher

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

updateFromProject

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

Throws:
Exception

addClasspath

public void addClasspath(Container container)
                  throws Exception
Throws:
Exception

addClasspath

protected void addClasspath(Collection<Container> path)
                     throws Exception
Throws:
Exception

addRunBundle

public void addRunBundle(String f)

getRunBundles

public Collection<String> getRunBundles()

addRunVM

public void addRunVM(String arg)

addRunProgramArgs

public void addRunProgramArgs(String arg)

getRunpath

public List<String> getRunpath()

getClasspath

public Collection<String> getClasspath()

getRunVM

public Collection<String> getRunVM()

getArguments

@Deprecated
public Collection<String> getArguments()
Deprecated. 


getRunProgramArgs

public Collection<String> getRunProgramArgs()

getRunProperties

public Map<String,String> getRunProperties()

getStorageDir

public File getStorageDir()

getMainTypeName

public abstract String getMainTypeName()

update

public abstract void update()
                     throws Exception
Throws:
Exception

launch

public int launch()
           throws Exception
Throws:
Exception

start

public int start(ClassLoader parent)
          throws Exception
Throws:
Exception

invoke

protected int invoke(Class<?> main,
                     String[] args)
              throws Exception
Throws:
Exception

cleanup

public void cleanup()
Is called after the process exists. Can you be used to cleanup the properties file.


reportResult

protected void reportResult(int result)

setTimeout

public void setTimeout(long timeout,
                       TimeUnit unit)

getTimeout

public long getTimeout()

cancel

public void cancel()

getSystemPackages

public Map<String,? extends Map<String,String>> getSystemPackages()

getSystemCapabilities

public String getSystemCapabilities()

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 Exception
Should be called when all the changes to the launchers are set. Will calculate whatever is necessary for the launcher.

Throws:
Exception

getProject

public Project getProject()

addActivator

public boolean addActivator(String e)

getActivators

public Collection<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(String defaultSpec)
                throws 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:
Exception

executable

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

Throws:
Exception

clear

public void clear()

getErrors

public List<String> getErrors()

getWarnings

public List<String> getWarnings()

error

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

warning

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

getCwd

public File getCwd()

setCwd

public void setCwd(File cwd)

getRunJdb

public String getRunJdb()

getRunEnv

public Map<String,String> getRunEnv()

registerForNotifications

public void registerForNotifications(ProjectLauncher.NotificationListener listener)

getNotificationListeners

public Set<ProjectLauncher.NotificationListener> getNotificationListeners()


Copyright © 2014 aQute SARL. All rights reserved.