public class PepperOSGiConnector extends Object implements org.corpus_tools.pepper.common.Pepper, PepperConnector
Pepper. It acts as a bridge
between the pure java environment and the Pepper universe inside the OSGi
environment. This class should help not dealing with OSGi issues when using
Pepper and therefore enables it to use Pepper as an embedded library.| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_OSGI_BUNDLES
name of system property to determine the locations of OSGi bundles
|
| Constructor and Description |
|---|
PepperOSGiConnector() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSharedPackage(String packageName,
String packageVersion)
Adds a package to the list of shared packages.
|
Collection<org.corpus_tools.pepper.common.ModuleFitness> |
checkFitness() |
String |
createJob() |
Set<String> |
findAppropriateImporters(org.eclipse.emf.common.util.URI corpusPath) |
String |
getBlacklist() |
org.osgi.framework.Bundle |
getBundle(String groupId,
String artifactId,
String version)
This method returns the bundle matching the specified maven project.
|
org.osgi.framework.BundleContext |
getBundleContext()
Returns the
BundleContext object used for this
PepperConnector |
Long |
getBundleId(URI location)
Returns the bundle id to an already installed bundle from the passed
location.
|
org.corpus_tools.pepper.common.PepperConfiguration |
getConfiguration() |
String |
getFrameworkVersion()
returns the version of pepper-framework read from the pepper-framework
OSGi
Bundle. |
org.corpus_tools.pepper.common.PepperJob |
getJob(String id) |
protected org.corpus_tools.pepper.common.Pepper |
getPepper()
Returns an instance of
Pepper, which is running inside OSGi. |
PepperStarterConfiguration |
getPepperStarterConfiguration() |
Collection<org.corpus_tools.pepper.common.PepperModuleDesc> |
getRegisteredImporters() |
Collection<org.corpus_tools.pepper.common.PepperModuleDesc> |
getRegisteredModules() |
String |
getRegisteredModulesAsString() |
protected String |
getSharedPackages()
Returns a String, containing a formatted list of packages to be shared
between current classloader and OSGi classloaders.
|
void |
init()
Starts the OSGi environment and installs and starts all bundles located
in the plugin directory.
|
org.osgi.framework.Bundle |
install(URI bundleURI)
Installs the given bundle, but does not start it.
|
org.osgi.framework.Bundle |
installAndCopy(URI bundleURI)
Installs the given bundle and copies it to the plugin path, but does not
start it.
|
protected Collection<org.osgi.framework.Bundle> |
installBundles(URI pluginPath,
List<URI> dropinPaths)
Tries to install all jar-files, of the given pluginPath.
|
boolean |
isInitialized()
Returns whether this object has been initialized.
|
boolean |
isSingleton(org.osgi.framework.Bundle bundle)
Returns whether the given bundle is a singleton.
|
String |
printDependencies(String bundleId)
prints all transitive dependencies of the specified bundle, if the bundle
can be related to a maven project
|
String |
printDependencies(String groupId,
String artifactId,
String version,
String repositoryUrl)
prints all transitive dependencies of the specified maven project
|
boolean |
remove(String bundleName)
Removes the passed bundle from the OSGi content and removes its jar file
and folder if exist.
|
boolean |
removeJob(String id) |
Collection<String> |
selfTest() |
void |
setBundleContext(org.osgi.framework.BundleContext bundleContext)
Sets the
BundleContext object used for this connector |
void |
setConfiguration(org.corpus_tools.pepper.common.PepperConfiguration configuration) |
void |
start(Long bundleId)
Starts the passed bundle
|
protected void |
startBundles(Collection<org.osgi.framework.Bundle> bundles)
Starts all bundle being contained in the given list of bundles.
|
protected org.osgi.framework.BundleContext |
startEquinox()
Starts the OSGi Equinox environment.
|
void |
stopOSGi()
Stops the OSGi environment.
|
void |
uninstall(Long bundleId)
Uninstalls a bundle from OSGi context.
|
void |
uninstall(URI location)
Uninstalls a bundle from OSGi context.
|
boolean |
update(String groupId,
String artifactId,
String repositoryUrl,
boolean isSnapshot,
boolean ignoreFrameworkVersion)
This method checks the pepperModules in the modules.xml for updates and
triggers the installation process if a newer version is available
|
public static final String PROP_OSGI_BUNDLES
public boolean isInitialized()
PepperConnectorisInitialized in interface PepperConnectorpublic void init()
PepperOSGiRunner.PROP_TEST_DISABLED to true.init in interface PepperConnectorprotected org.osgi.framework.BundleContext startEquinox()
throws Exception
Exceptionpublic org.corpus_tools.pepper.common.PepperConfiguration getConfiguration()
getConfiguration in interface org.corpus_tools.pepper.common.Pepperpublic PepperStarterConfiguration getPepperStarterConfiguration()
PepperStarterConfigurationpublic void setConfiguration(org.corpus_tools.pepper.common.PepperConfiguration configuration)
setConfiguration in interface org.corpus_tools.pepper.common.Pepperprotected org.corpus_tools.pepper.common.Pepper getPepper()
Pepper, which is running inside OSGi. This
class will be resolved via the BundleContext. If it was resolved
once, a singleton instance of this object is returned.Pepper from inside the OSGi environment.public org.osgi.framework.BundleContext getBundleContext()
BundleContext object used for this
PepperConnectorpublic void setBundleContext(org.osgi.framework.BundleContext bundleContext)
BundleContext object used for this connectorbundleContext - the object to be setpublic void addSharedPackage(String packageName, String packageVersion)
packageName - name of the packagepackageVersion - version of the package (normally the bundle's version)protected String getSharedPackages()
Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA.protected Collection<org.osgi.framework.Bundle> installBundles(URI pluginPath, List<URI> dropinPaths) throws org.osgi.framework.BundleException, URISyntaxException, IOException
pluginPath - path where the bundles arebundleAction - a flag, which shows if bundle has to be started or just
installeddropinPaths - A list of additionally paths to load bundles fromorg.osgi.framework.BundleExceptionURISyntaxExceptionIOExceptionpublic Long getBundleId(URI location)
public org.osgi.framework.Bundle installAndCopy(URI bundleURI) throws org.osgi.framework.BundleException, IOException
bundleURI - org.osgi.framework.BundleExceptionIOExceptionpublic org.osgi.framework.Bundle install(URI bundleURI) throws org.osgi.framework.BundleException
bundleURI - org.osgi.framework.BundleExceptionpublic void uninstall(Long bundleId) throws org.osgi.framework.BundleException
org.osgi.framework.BundleExceptionpublic void uninstall(URI location) throws org.osgi.framework.BundleException
org.osgi.framework.BundleExceptionpublic boolean remove(String bundleName) throws org.osgi.framework.BundleException, IOException
org.osgi.framework.BundleExceptionIOExceptionpublic void start(Long bundleId)
bundle - protected void startBundles(Collection<org.osgi.framework.Bundle> bundles) throws org.osgi.framework.BundleException
bundles - a list of bundles to startorg.osgi.framework.BundleExceptionpublic String createJob()
createJob in interface org.corpus_tools.pepper.common.Pepperpublic org.corpus_tools.pepper.common.PepperJob getJob(String id) throws org.corpus_tools.pepper.exceptions.JobNotFoundException
getJob in interface org.corpus_tools.pepper.common.Pepperorg.corpus_tools.pepper.exceptions.JobNotFoundExceptionpublic boolean removeJob(String id) throws org.corpus_tools.pepper.exceptions.JobNotFoundException
removeJob in interface org.corpus_tools.pepper.common.Pepperorg.corpus_tools.pepper.exceptions.JobNotFoundExceptionpublic Collection<org.corpus_tools.pepper.common.PepperModuleDesc> getRegisteredModules()
getRegisteredModules in interface org.corpus_tools.pepper.common.Pepperpublic String getRegisteredModulesAsString()
getRegisteredModulesAsString in interface org.corpus_tools.pepper.common.Pepperpublic Collection<String> selfTest()
selfTest in interface org.corpus_tools.pepper.common.Pepperpublic boolean update(String groupId, String artifactId, String repositoryUrl, boolean isSnapshot, boolean ignoreFrameworkVersion)
public String getFrameworkVersion()
Bundle.public String getBlacklist()
public org.osgi.framework.Bundle getBundle(String groupId, String artifactId, String version)
groupId - -- the project's group idartifactId - -- the project's artifact idversion - -- the project's versionpublic boolean isSingleton(org.osgi.framework.Bundle bundle)
public String printDependencies(String bundleId)
bundleId - -- the bundle's idpublic String printDependencies(String groupId, String artifactId, String version, String repositoryUrl)
groupId - -- the project's group idartifactId - -- the project's artifact idversion - -- the project's versionpublic Set<String> findAppropriateImporters(org.eclipse.emf.common.util.URI corpusPath) throws FileNotFoundException
findAppropriateImporters in interface org.corpus_tools.pepper.common.PepperFileNotFoundExceptionpublic Collection<org.corpus_tools.pepper.common.PepperModuleDesc> getRegisteredImporters()
getRegisteredImporters in interface org.corpus_tools.pepper.common.Pepperpublic Collection<org.corpus_tools.pepper.common.ModuleFitness> checkFitness()
checkFitness in interface org.corpus_tools.pepper.common.PepperCopyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.