CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Static Public Member Functions | Static Public Attributes | List of all members
ctkPluginFrameworkLauncher Class Reference

#include <Libs/PluginFramework/ctkPluginFrameworkLauncher.h>

Static Public Member Functions

static void addSearchPath (const QString &searchPath, bool addToPathEnv=true)
 
static void appendPathEnv (const QString &path)
 
static ctkPluginContextgetPluginContext ()
 
static QSharedPointer< ctkPluginFrameworkgetPluginFramework ()
 
static QString getPluginPath (const QString &symbolicName)
 
static QStringList getPluginSymbolicNames (const QString &searchPath)
 
static long install (const QString &symbolicName, ctkPluginContext *context=0)
 
static void resolve ()
 
static void resolve (const QSharedPointer< ctkPlugin > &plugin)
 
static QVariant run (const QVariant &argument)
 
static QVariant run (QRunnable *endSplashHandler=NULL, const QVariant &argument=QVariant())
 
static void setFrameworkProperties (const ctkProperties &props)
 
static void shutdown ()
 
static bool start (const QString &symbolicName=QString(), ctkPlugin::StartOptions options=ctkPlugin::START_ACTIVATION_POLICY, ctkPluginContext *context=0)
 
static ctkPluginContextstartup (QRunnable *endSplashHandler)
 
static bool stop (const QString &symbolicName=QString(), ctkPlugin::StopOptions options=0, ctkPluginContext *context=0)
 

Static Public Attributes

static const QString PROP_ALLOW_APPRELAUNCH
 
static const QString PROP_APPLICATION_LAUNCHDEFAULT
 
static const QString PROP_ARCH
 
static const QString PROP_CONFIG_AREA
 
static const QString PROP_CONFIG_AREA_DEFAULT
 
static const QString PROP_CONSOLE
 
static const QString PROP_CONSOLE_LOG
 
static const QString PROP_DEBUG
 
static const QString PROP_DEV
 
static const QString PROP_EXITCODE
 
static const QString PROP_EXITDATA
 
static const QString PROP_HOME_LOCATION_AREA
 
static const QString PROP_IGNOREAPP
 
static const QString PROP_INSTALL_AREA
 
static const QString PROP_INSTANCE_AREA
 
static const QString PROP_INSTANCE_AREA_DEFAULT
 
static const QString PROP_NOSHUTDOWN
 
static const QString PROP_OS
 
static const QString PROP_OSGI_RELAUNCH
 
static const QString PROP_PLUGINS
 
static const QString PROP_PLUGINS_START_OPTIONS
 
static const QString PROP_SHARED_CONFIG_AREA
 
static const QString PROP_USER_AREA
 
static const QString PROP_USER_AREA_DEFAULT
 
static const QString PROP_USER_DIR
 
static const QString PROP_USER_HOME
 

Detailed Description

Sets up and starts the CTK Plugin Framework.

This is a convenience class to start an instance of the CTK Plugin Framework and to install and start plugins.

Definition at line 45 of file ctkPluginFrameworkLauncher.h.

Member Function Documentation

◆ addSearchPath()

static void ctkPluginFrameworkLauncher::addSearchPath ( const QString &  searchPath,
bool  addToPathEnv = true 
)
static

Add a path to the list of search paths for plugins.

When calling install(const QString&, ctkPluginContext*), start, or getPluginPath(const QString&), the plugin is searched in the paths given as arguments to this method. The least recently added path is searched first.

Parameters
searchPathThe path to add.
addToPathEnvIf true, add the given path to the PATH environment variable, using appendPathEnv(const QString&).

◆ appendPathEnv()

static void ctkPluginFrameworkLauncher::appendPathEnv ( const QString &  path)
static

This is a utility method to append a path to the PATH environment variable on Windows platforms.

This method does nothing on non-Windows platforms.

Parameters
pathThe path to be appended to PATH

◆ getPluginContext()

static ctkPluginContext* ctkPluginFrameworkLauncher::getPluginContext ( )
static

Get the plugin context for the Plugin Framework.

Returns
The context associated to the Plugin Framework, or null if the framework has not been initialized yet.

◆ getPluginFramework()

static QSharedPointer<ctkPluginFramework> ctkPluginFrameworkLauncher::getPluginFramework ( )
static

Get the Plugin Framework:

Returns
The initialized Plugin Framework, or null if the framework has not been initialized yet.

◆ getPluginPath()

static QString ctkPluginFrameworkLauncher::getPluginPath ( const QString &  symbolicName)
static

Get the full path (including the file name) to the plugin with the given symbolic name.

The paths given by calls to addSearchPath(const QString&, bool) are searched for a shared library with a base name equaling symbolicName.

Parameters
symbolicNameThe symbolic name of the plugin to find.
Returns
The full path (including the file name) to the plugin (shared library) or a null QString if the plugin was not found.

◆ getPluginSymbolicNames()

static QStringList ctkPluginFrameworkLauncher::getPluginSymbolicNames ( const QString &  searchPath)
static

Get a list of symbolic names for the plugins in searchPath.

The symbolic names are deduced from the shared libraries found in searchPath, which may not represent loadable CTK plugins.

Parameters
searchPathThe path to look for plugins.
Returns
A list of potential plugin symbolic names.

◆ install()

static long ctkPluginFrameworkLauncher::install ( const QString &  symbolicName,
ctkPluginContext context = 0 
)
static

Install the plugin with the given symbolic name using the provided ctkPluginContext.

This method instantiates and initializes an instance of a ctkPluginFramework object, if no plugin context is provided and if there is no framework already initialized.

The plugin is searched in the paths previously given by calls to addSearchPath(const QString&, bool) and in the default CTK plugin installation path.

Parameters
symbolicNameThe symbolic name of the plugin to install.
contextThe plugin context used for installing the plugin.
Returns
The plugin id if the plugin was found and successfully installed, -1 otherwise.

◆ resolve() [1/2]

static void ctkPluginFrameworkLauncher::resolve ( )
static

Resolve all currently installed plug-ins.

In case of an error, a framework event of type ctkPluginFrameworkEvent::PLUGIN_ERROR is send.

◆ resolve() [2/2]

static void ctkPluginFrameworkLauncher::resolve ( const QSharedPointer< ctkPlugin > &  plugin)
static

Resolve the given plug-in.

This method tries to resolv the given plug-in. In case of an error, a framework event of type ctkPluginFrameworkEvent::PLUGIN_ERROR is send.

Parameters
pluginThe plug-in to be resolved.

◆ run() [1/2]

static QVariant ctkPluginFrameworkLauncher::run ( const QVariant &  argument)
static

Runs the application for which the platform was started. The platform must be running.

The given argument is passed to the application being run. If it is null then the command line arguments used in starting the platform, and not consumed by the platform code, are passed to the application as a String[].

Parameters
argumentthe argument passed to the application. May be null
Returns
the result of running the application
Exceptions
std::exceptionif anything goes wrong

◆ run() [2/2]

static QVariant ctkPluginFrameworkLauncher::run ( QRunnable *  endSplashHandler = NULL,
const QVariant &  argument = QVariant() 
)
static

Launches the platform and runs a single application. The application is either identified in the given arguments (e.g., -application <app id>) or in the eclipse.application System property. This convenience method starts up the platform, runs the indicated application, and then shuts down the platform. The platform must not be running already.

Parameters
endSplashHandlerthe block of code to run to tear down the splash screen or null if no tear down is required
argumentthe argument passed to the application. Default is QVariant().
Returns
the result of running the application
Exceptions
Exceptionif anything goes wrong

◆ setFrameworkProperties()

static void ctkPluginFrameworkLauncher::setFrameworkProperties ( const ctkProperties props)
static

Specify the set of framework properties to be used when initializing the Plugin Framework.

If the framework has already been initialized by a call to install or start, the new properties do not have any effect until the framework is restarted.

Parameters
propsThe initial Plugin Framework properties.

◆ shutdown()

static void ctkPluginFrameworkLauncher::shutdown ( )
static

Shuts down the Platform. The state of the Platform is not automatically saved before shutting down.

On return, the Platform will no longer be running (but could be re-launched with another call to startup). If relaunching, care must be taken to reinitialize any System properties which the platform uses (e.g., osgi.instance.area) as some policies in the platform do not allow resetting of such properties on subsequent runs.

Any objects handed out by running Platform, including Platform runnables obtained via getRunnable, will be permanently invalid. The effects of attempting to invoke methods on invalid objects is undefined.

Exceptions
std::exceptionif anything goes wrong

◆ start()

static bool ctkPluginFrameworkLauncher::start ( const QString &  symbolicName = QString(),
ctkPlugin::StartOptions  options = ctkPlugin::START_ACTIVATION_POLICY,
ctkPluginContext context = 0 
)
static

This method instantiates, initializes, and starts an instance of a ctkPluginFramework object, if no plugin context is provided and if there is no framework already running. It then installs and starts the plugin with the given symbolic name (if not empty).

If a symbolic name is given, the plugin is searched in the paths previously given by calls to addSearchPath(const QString&, bool) and in the default CTK plugin installation path and is started using the given options.

If a plugin context is provided, this context is used to install the plugin, otherwise the Plugin Framework context is used.

Parameters
symbolicNameThe symbolic name of the plugin to install.
optionsThe options used to start the plugin.
contextThe plugin context to use for installing the plugin.
Returns
true if the plugin was found and successfully installed, false otherwise.
See also
ctkPlugin::StartOptions

◆ startup()

static ctkPluginContext* ctkPluginFrameworkLauncher::startup ( QRunnable *  endSplashHandler)
static

Starts the platform and sets it up to run a single application. The application is either identified in the given arguments (e.g., -application <app id>) or in the eclipse.application System property. The platform must not be running already.

The given runnable (if not null) is used to tear down the splash screen if required.

Parameters
argsthe arguments passed to the application
Returns
BundleContext the context of the system bundle
Exceptions
Exceptionif anything goes wrong

◆ stop()

static bool ctkPluginFrameworkLauncher::stop ( const QString &  symbolicName = QString(),
ctkPlugin::StopOptions  options = 0,
ctkPluginContext context = 0 
)
static

This method either stops the plug-in with the given symbolicName using the supplied stop options options or the complete framework (if symbolicName is empty).

If a plugin context is provided, this context is used to find the plug-in, otherwise the Plugin Framework context is used.

Parameters
symbolicNameThe symbolic name of the plugin to stop.
optionsThe options used to stop the plugin.
contextThe plugin context to use for finding the plugin.
Returns
true if the plugin was found and successfully stopped or the complete framework was successfully stopped, false otherwise.
See also
ctkPlugin::StopOptions

Member Data Documentation

◆ PROP_ALLOW_APPRELAUNCH

const QString ctkPluginFrameworkLauncher::PROP_ALLOW_APPRELAUNCH
static

Definition at line 81 of file ctkPluginFrameworkLauncher.h.

◆ PROP_APPLICATION_LAUNCHDEFAULT

const QString ctkPluginFrameworkLauncher::PROP_APPLICATION_LAUNCHDEFAULT
static

Definition at line 82 of file ctkPluginFrameworkLauncher.h.

◆ PROP_ARCH

const QString ctkPluginFrameworkLauncher::PROP_ARCH
static

Definition at line 60 of file ctkPluginFrameworkLauncher.h.

◆ PROP_CONFIG_AREA

const QString ctkPluginFrameworkLauncher::PROP_CONFIG_AREA
static

Definition at line 66 of file ctkPluginFrameworkLauncher.h.

◆ PROP_CONFIG_AREA_DEFAULT

const QString ctkPluginFrameworkLauncher::PROP_CONFIG_AREA_DEFAULT
static

Definition at line 73 of file ctkPluginFrameworkLauncher.h.

◆ PROP_CONSOLE

const QString ctkPluginFrameworkLauncher::PROP_CONSOLE
static

Definition at line 58 of file ctkPluginFrameworkLauncher.h.

◆ PROP_CONSOLE_LOG

const QString ctkPluginFrameworkLauncher::PROP_CONSOLE_LOG
static

Definition at line 79 of file ctkPluginFrameworkLauncher.h.

◆ PROP_DEBUG

const QString ctkPluginFrameworkLauncher::PROP_DEBUG
static

Definition at line 56 of file ctkPluginFrameworkLauncher.h.

◆ PROP_DEV

const QString ctkPluginFrameworkLauncher::PROP_DEV
static

Definition at line 57 of file ctkPluginFrameworkLauncher.h.

◆ PROP_EXITCODE

const QString ctkPluginFrameworkLauncher::PROP_EXITCODE
static

Definition at line 77 of file ctkPluginFrameworkLauncher.h.

◆ PROP_EXITDATA

const QString ctkPluginFrameworkLauncher::PROP_EXITDATA
static

Definition at line 78 of file ctkPluginFrameworkLauncher.h.

◆ PROP_HOME_LOCATION_AREA

const QString ctkPluginFrameworkLauncher::PROP_HOME_LOCATION_AREA
static

Definition at line 70 of file ctkPluginFrameworkLauncher.h.

◆ PROP_IGNOREAPP

const QString ctkPluginFrameworkLauncher::PROP_IGNOREAPP
static

Definition at line 63 of file ctkPluginFrameworkLauncher.h.

◆ PROP_INSTALL_AREA

const QString ctkPluginFrameworkLauncher::PROP_INSTALL_AREA
static

Definition at line 65 of file ctkPluginFrameworkLauncher.h.

◆ PROP_INSTANCE_AREA

const QString ctkPluginFrameworkLauncher::PROP_INSTANCE_AREA
static

Definition at line 68 of file ctkPluginFrameworkLauncher.h.

◆ PROP_INSTANCE_AREA_DEFAULT

const QString ctkPluginFrameworkLauncher::PROP_INSTANCE_AREA_DEFAULT
static

Definition at line 74 of file ctkPluginFrameworkLauncher.h.

◆ PROP_NOSHUTDOWN

const QString ctkPluginFrameworkLauncher::PROP_NOSHUTDOWN
static

Definition at line 62 of file ctkPluginFrameworkLauncher.h.

◆ PROP_OS

const QString ctkPluginFrameworkLauncher::PROP_OS
static

Definition at line 59 of file ctkPluginFrameworkLauncher.h.

◆ PROP_OSGI_RELAUNCH

const QString ctkPluginFrameworkLauncher::PROP_OSGI_RELAUNCH
static

Definition at line 84 of file ctkPluginFrameworkLauncher.h.

◆ PROP_PLUGINS

const QString ctkPluginFrameworkLauncher::PROP_PLUGINS
static

Definition at line 54 of file ctkPluginFrameworkLauncher.h.

◆ PROP_PLUGINS_START_OPTIONS

const QString ctkPluginFrameworkLauncher::PROP_PLUGINS_START_OPTIONS
static

Definition at line 55 of file ctkPluginFrameworkLauncher.h.

◆ PROP_SHARED_CONFIG_AREA

const QString ctkPluginFrameworkLauncher::PROP_SHARED_CONFIG_AREA
static

Definition at line 67 of file ctkPluginFrameworkLauncher.h.

◆ PROP_USER_AREA

const QString ctkPluginFrameworkLauncher::PROP_USER_AREA
static

Definition at line 69 of file ctkPluginFrameworkLauncher.h.

◆ PROP_USER_AREA_DEFAULT

const QString ctkPluginFrameworkLauncher::PROP_USER_AREA_DEFAULT
static

Definition at line 75 of file ctkPluginFrameworkLauncher.h.

◆ PROP_USER_DIR

const QString ctkPluginFrameworkLauncher::PROP_USER_DIR
static

Definition at line 51 of file ctkPluginFrameworkLauncher.h.

◆ PROP_USER_HOME

const QString ctkPluginFrameworkLauncher::PROP_USER_HOME
static

Definition at line 50 of file ctkPluginFrameworkLauncher.h.


The documentation for this class was generated from the following file: