public class OsgiLauncher extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BOOT_DELEGATION_PACKAGES
Default boot delegation packages.
|
static String |
DEFAULT_SYSTEM_PACKAGES
Default system packages.
|
Constructor and Description |
---|
OsgiLauncher(File storageDirectory,
File bundleDirectory)
Constructs an
OsgiLauncher that loads bundles from a directory. |
OsgiLauncher(File storageDirectory,
List<URI> bundleURIs)
Constructs an
OsgiLauncher that loads the specified bundles. |
Modifier and Type | Method and Description |
---|---|
void |
addBootDelegationPackages(String additionalBootDelegationPackages)
Adds boot delegation packages.
|
void |
addSystemPackages(String additionalSystemPackages)
Adds system packages.
|
org.osgi.framework.BundleContext |
getContext()
Returns the context.
|
org.osgi.framework.Bundle |
installBundle(URI bundleURI)
Installs the bundle specified by the URI into the framework.
|
List<org.osgi.framework.Bundle> |
installBundles(List<URI> bundlesURIs)
Installs the bundles specified by the URIs into the framework.
|
void |
setBootDelegationPackages(String bootDelegationPackages)
Sets the boot delegation packages.
|
void |
setCleanStorageDirectory(boolean cleanStorageDirectory)
Set whether the storage directory should be cleaned on startup.
|
void |
setFrameworkConfiguration(Map<String,String> frameworkConfiguration)
Sets the configuration to use when creating the OSGi framework.
|
void |
setStorageDirectory(File storageDirectory)
Sets the persistent storage area used by the framework.
|
void |
setSystemPackages(String systemPackages)
Sets the system packages.
|
void |
start()
Starts the OSGi framework, installs and starts the bundles.
|
void |
startBundle(org.osgi.framework.Bundle bundle)
Starts the bundle.
|
void |
startBundles(List<org.osgi.framework.Bundle> bundles)
Starts the bundles.
|
void |
startServices(boolean waitForServices)
Starts SpringDM managed services.
|
void |
stop()
Stops the OSGI framework.
|
public static final String DEFAULT_BOOT_DELEGATION_PACKAGES
public static final String DEFAULT_SYSTEM_PACKAGES
public OsgiLauncher(File storageDirectory, File bundleDirectory)
OsgiLauncher
that loads bundles from a directory.
Any file in the specified directory with a .jar extension will be loaded when the framework
is started.storageDirectory
- persistent storage area used by the frameworkstorageDirectory
- the directory containing bundles to loadpublic void start() throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
- if the framework could not be startedpublic void startServices(boolean waitForServices) throws org.osgi.framework.BundleException
waitForServices
- if true waits for services to start before returningorg.osgi.framework.BundleException
- if the framework has not been started or a service could not be startedpublic void stop() throws org.osgi.framework.BundleException, InterruptedException
org.osgi.framework.BundleException
- if the framework has not been startedInterruptedException
- if the thread is interrupted while the framework is stoppingpublic List<org.osgi.framework.Bundle> installBundles(List<URI> bundlesURIs) throws org.osgi.framework.BundleException
bundlesURIs
- the URIs of the bundles to installorg.osgi.framework.BundleException
- if a bundle could not be installedpublic org.osgi.framework.Bundle installBundle(URI bundleURI) throws org.osgi.framework.BundleException
bundleURI
- the URI of the bundle to installorg.osgi.framework.BundleException
- if the bundle could not be installedpublic void startBundles(List<org.osgi.framework.Bundle> bundles) throws org.osgi.framework.BundleException
bundles
- the bundles to startorg.osgi.framework.BundleException
- if a bundle could not be startedpublic void startBundle(org.osgi.framework.Bundle bundle) throws org.osgi.framework.BundleException
bundle
- the bundle to startorg.osgi.framework.BundleException
- if the bundle could not be startedpublic org.osgi.framework.BundleContext getContext()
null
if the framework is not started.public void setFrameworkConfiguration(Map<String,String> frameworkConfiguration)
frameworkConfiguration
- the configuration to use when creating the OSGi frameworkpublic void addBootDelegationPackages(String additionalBootDelegationPackages)
additionalBootDelegationPackages
- boot delegation packages to addpublic void setBootDelegationPackages(String bootDelegationPackages)
bootDelegationPackages
- the boot delegation packagespublic void addSystemPackages(String additionalSystemPackages)
additionalSystemPackages
- system packages to addpublic void setSystemPackages(String systemPackages)
systemPackages
- the system packagespublic void setStorageDirectory(File storageDirectory)
storageDirectory
- the persistent storage area used by the frameworkpublic void setCleanStorageDirectory(boolean cleanStorageDirectory)
cleanStorageDirectory
- whether the storage directory should be cleaned on startupCopyright © 2015–2016 The Apache Software Foundation. All rights reserved.