Interface OsgiExecable

All Superinterfaces:
Runnable, Serializable
All Known Implementing Classes:
ConventionPde.TargetPlatformSetter, InstalledJreAdder, OsgiExecable.ReflectionHost, ProjectImporter, SetupAction

public interface OsgiExecable extends Serializable, Runnable
Runs code that lives outside an OSGi container inside of it. Works just like JavaExecable. Make sure the code you execute only uses classes which are available to the OSGi runtime you're using. If you'd like to call some code which is only available inside the OSGi container, use a OsgiExecable.ReflectionHost and OsgiExecable.ReflectionClient pair, as such: ```java class ProjectImporter extends OsgiExecable.ReflectionHost { private static final long serialVersionUID = 6542985814638851088L; ArrayList projects; public ProjectImporter(Collection projects) { super("com.diffplug.gradle.oomph.ProjectImporterInternal"); this.projects = new ArrayList(projects); } } class ProjectImporterInternal extends OsgiExecable.ReflectionClient { ProjectImporterInternal(ProjectImporter host) { super(host); } public void run() { // add all projects to the workspace IWorkspace workspace = ResourcesPlugin.getWorkspace(); for (File projectFile : host.projects) { try { Path path = new Path(projectFile.toString()); IProjectDescription description = workspace.loadProjectDescription(path); etc. ```
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Client code which gets called within the OSGi runtime.
    static class 
    Defines data which will be passed via reflection to code within the OSGi runtime - the reflection allows us to call code for which we don't have the necessary dependencies to resolve its imports unless it is only instantiated within the OSGi container.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static <T extends OsgiExecable>
    T
    exec(org.osgi.framework.BundleContext context, T input)
    Executes the given OsgiExecable within an embedded OSGi runtime.

    Methods inherited from interface java.lang.Runnable

    run
  • Method Details