org.knopflerfish.util.framework
public class ExecutableBundleActivator extends java.lang.Object implements BundleActivator
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
baseDirName |
protected BundleContext |
bc |
protected boolean |
bProcessExitMeansStopBundle |
static java.lang.String |
BUNDLE_EXTRACT_FILES
Manifest header (named "Bundle-Extract-Files") identifying a
set of resources that should be copied to the OS file system before
executing the start or stop executable is run.
|
static java.lang.String |
BUNDLE_START_EXECUTABLE
Manifest header (named "Bundle-Start-Executable") identifying a
number of hardware environments and the native language code executables
that the bundle is carrying for each of these environments.
|
static java.lang.String |
BUNDLE_START_EXECUTABLE_ARGS
Manifest header (named "Bundle-Start-Executable-Args")
specifying the (space-separated) process arguments to the executable
specified by
BUNDLE_START_EXECUTABLE. |
static java.lang.String |
BUNDLE_START_EXECUTABLE_EXIT_MEANS_BUNDLESTOP
Manifest header (named
"Bundle-Start-Executable-Exit-Means-Bundle-Stop"")
specifying of the the process exit of the start executable should
stop the bundle too.
|
static java.lang.String |
BUNDLE_STOP_EXECUTABLE
Manifest header (named "Bundle-Stop-Executable") identifying a
number of hardware environments and the native language code executables
that the bundle is carrying for each of these environments.
|
static java.lang.String |
BUNDLE_STOP_EXECUTABLE_ARGS
Manifest header (named "Bundle-Start-Executable-Args")
specifying the (space-separated) process arguments to the executable
specified by
BUNDLE_START_EXECUTABLE. |
protected java.lang.Process |
runProcess |
protected java.io.File |
startFile |
protected java.lang.String |
startName |
protected java.io.File |
stopFile |
protected java.lang.String |
stopName |
| Constructor and Description |
|---|
ExecutableBundleActivator() |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(java.lang.String s)
Method used for debug logging.
|
void |
debug(java.lang.String s,
java.lang.Exception e)
Method used for debug logging.
|
java.io.File |
getBaseDir()
Get the base directory for extract files to be executed.
|
java.lang.String |
getBaseDirName() |
protected void |
initFiles(java.lang.String startChoices,
java.lang.String stopChoices,
java.lang.String extractNames) |
void |
initFiles2(java.lang.String startName,
java.lang.String stopName,
java.lang.String extractNames) |
boolean |
isDebug()
Flag which controls if logging should be done.
|
boolean |
isProcessExitMeansStopBundle()
Return true if exit of start process should stop bundle too.
|
protected java.lang.Process |
runFile(java.io.File f,
java.lang.String args,
boolean bWaitForExit,
boolean bStopBundle)
Start a new process from a file.
|
void |
setBaseDirName(java.lang.String s) |
void |
setProcessExitMeansStopBundle(boolean b)
Set if exit of start process should stop bundle too.
|
void |
start(BundleContext bc)
Called when this bundle is started so the Framework can perform the
bundle-specific activities necessary to start this bundle.
|
void |
stop(BundleContext bc)
Called when this bundle is stopped so the Framework can perform the
bundle-specific activities necessary to stop the bundle.
|
protected BundleContext bc
protected java.lang.String startName
protected java.lang.String stopName
protected java.io.File startFile
protected java.io.File stopFile
protected java.lang.Process runProcess
protected boolean bProcessExitMeansStopBundle
protected java.lang.String baseDirName
public static final java.lang.String BUNDLE_START_EXECUTABLE
If a matching executable is found, the executable file will be copied to the OS file system and started in the start() method
public static final java.lang.String BUNDLE_START_EXECUTABLE_ARGS
BUNDLE_START_EXECUTABLE.public static final java.lang.String BUNDLE_STOP_EXECUTABLE_ARGS
BUNDLE_START_EXECUTABLE.public static final java.lang.String BUNDLE_STOP_EXECUTABLE
If a matching executable is found, the executable file will be copied to the OS file system and started in the stop() method.
public static final java.lang.String BUNDLE_EXTRACT_FILES
public static final java.lang.String BUNDLE_START_EXECUTABLE_EXIT_MEANS_BUNDLESTOP
public void start(BundleContext bc) throws BundleException
BundleActivatorThis method must complete and return to its caller in a timely manner.
start in interface BundleActivatorbc - The execution context of the bundle being started.BundleExceptionpublic void stop(BundleContext bc) throws BundleException
BundleActivatorBundleActivator.start method
started. There should be no active threads that were started by this
bundle when this bundle returns. A stopped bundle must not call any
Framework objects.
This method must complete and return to its caller in a timely manner.
stop in interface BundleActivatorbc - The execution context of the bundle being stopped.BundleExceptionpublic java.lang.String getBaseDirName()
public void setBaseDirName(java.lang.String s)
public java.io.File getBaseDir()
Override to change. Default is BundleContext.getDataFile(getBaseDirName())
public boolean isProcessExitMeansStopBundle()
BUNDLE_START_EXECUTABLE_EXIT_MEANS_BUNDLESTOP manifest header.public void setProcessExitMeansStopBundle(boolean b)
public boolean isDebug()
public void debug(java.lang.String s)
public void debug(java.lang.String s,
java.lang.Exception e)
s - message string to loge - exception to logprotected java.lang.Process runFile(java.io.File f,
java.lang.String args,
boolean bWaitForExit,
boolean bStopBundle)
f - file to runargs - space-separated process argumentsbWaitForExit - if true, wait for exit before returningbStopBundle - if true, stop bundle after process has exited.protected void initFiles(java.lang.String startChoices,
java.lang.String stopChoices,
java.lang.String extractNames)
throws java.io.IOException
java.io.IOExceptionpublic void initFiles2(java.lang.String startName,
java.lang.String stopName,
java.lang.String extractNames)
throws java.io.IOException
java.io.IOException