Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » What is a SSCCE using EclipseStarter to launch Equinox with a osgi.java.profile?
What is a SSCCE using EclipseStarter to launch Equinox with a osgi.java.profile? [message #1725605] Fri, 04 March 2016 19:32 Go to next message
Charles Gould is currently offline Charles GouldFriend
Messages: 8
Registered: March 2016
Junior Member
Hi Equinox community,

Here are the contents of my POM. The project has one dependency: a recent build of Equinox.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>org.eclipse.osgi</artifactId>
        <version>3.10.101.v20150820-1432</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <!-- Compile under Java 8 -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>


I want to create a Java class with a main method that uses EclipseStarter to launch Equinox, something like this:

public class EquinoxTest {
    public static void main(String[] args) throws Exception {

        final Map<String, String> initProperties = new HashMap<>();
        initProperties.put(EclipseStarter.PROP_IGNOREAPP, "true");
        initProperties.put(EclipseStarter.PROP_NOSHUTDOWN, "true");
        EclipseStarter.setInitialProperties(initProperties);

        final String[] equinoxArgs = { "-console" };
        BundleContext bundleContext = EclipseStarter.startup(equinoxArgs, null);
        // use bundleContext
    }
}


My problem is that the default system bundles don't have version information. For example, javax.xml.stream is exported at version 0.0.0 (no version).

I might need to install a bundle that imports javax.xml.stream at version 1.0.0. It would be great if the framework could export that version correctly.

I noticed in the Equinox jar that there are profiles, such as JavaSE-1.8.profile. My hope is to be able to create a new profile based on the Java 8 profile with version information included.

Finally my questions are:


  1. Where should I put the modified profile?
  2. How do I tell Equinox to use it?


Thanks!

P.S. If you download the Maven artifact and view its contents, you can see the profiles. Excerpt from JavaSE-1.8.profile below:

org.osgi.framework.system.packages = \
 ...
 javax.xml.stream,\
 javax.xml.stream.events,\
 javax.xml.stream.util,\
 ...


I would want to created a modified profile thusly:

org.osgi.framework.system.packages = \
 ...
 javax.xml.stream;version=1.0,\
 javax.xml.stream.events;version=1.0,\
 javax.xml.stream.util;version=1.0,\
 ...
Re: What is a SSCCE using EclipseStarter to launch Equinox with a osgi.java.profile? [message #1725769 is a reply to message #1725605] Mon, 07 March 2016 14:08 Go to previous message
Charles Gould is currently offline Charles GouldFriend
Messages: 8
Registered: March 2016
Junior Member
I put the modified profile in src/main/resources and accessed it like this:

public class EquinoxTest {
    public static void main(String[] args) throws Exception {

        final Map<String, String> initProperties = new HashMap<>();
        initProperties.put(EclipseStarter.PROP_IGNOREAPP, "true");
        initProperties.put(EclipseStarter.PROP_NOSHUTDOWN, "true");

        final URL profile = EquinoxTest.class.getResource("/JavaSE-1.8-custom.profile");
        properties.put(EquinoxConfiguration.PROP_OSGI_JAVA_PROFILE, profile.toExternalForm());

        EclipseStarter.setInitialProperties(initProperties);

        final String[] equinoxArgs = { "-console" };
        BundleContext bundleContext = EclipseStarter.startup(equinoxArgs, null);
        // use bundleContext
    }
}
Previous Topic:Profile is not current and update problems
Next Topic:Use same Package/Class in System Classloader and Bundle Classloader
Goto Forum:
  


Current Time: Tue Oct 15 16:49:45 GMT 2024

Powered by FUDForum. Page generated in 0.07086 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top