Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 263412

Summary: Need OSGi bundles library provider
Product: [WebTools] WTP Common Tools Reporter: Konstantin Komissarchik <konstantin>
Component: Faceted Project FrameworkAssignee: Konstantin Komissarchik <konstantin>
Status: RESOLVED FIXED QA Contact: Konstantin Komissarchik <konstantin>
Severity: enhancement    
Priority: P3 CC: neil.hauge, paul.fullbright, shaun.smith, tranle1
Version: 3.1Keywords: plan
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Konstantin Komissarchik CLA 2009-02-02 21:11:01 EST
There are scenarios where it is desirable to add OSGi bundles from Eclipse environment to user project's classpath. Some technology's tooling plugins might ship with runtime bundles included. We need an easy for to make those bundles accessible to user projects.

An OSGi bundles library provider should be created that can be configured with particular bundles and version of those bundles to include.
Comment 1 Konstantin Komissarchik CLA 2009-02-02 21:43:25 EST
Per the specified requirements, added two new base library providers to the framework:

  osgi-bundles-library-provider and wtp-osgi-bundles-library-provider

They are identical in their use from extenders perspective. The wtp variant just adds the "include libraries with app" checkbox to the library provider configuration screen and does the corresponding wtp classpath attributes magic.

Here is a usage example:

<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
  <provider id="osgi-bundles-library-provider-demo" extends="wtp-osgi-bundles-library-provider">
    <label>Random OSGi Bundles</label>
    <param name="bundle.0" value="org.eclipse.core.runtime:[3.2,8.0)"/>
    <param name="bundle.1" value="org.eclipse.core.resources:[3.2,6.7)"/>
    <enablement>
      <with variable="requestingProjectFacet">
        <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa" forcePluginActivation="true"/>
      </with>
    </enablement>
  </provider>
</extension>

That's it. 

Specify as many bundles as you want with or without version constraints. The provider will only be visible to users if all of the specified bundles are resolvable (taking version ranges into account). This means you can easily throw these declarations into tooling plugins and they will be available as an option for the user if the bundles are present in the Eclipse install. You can also specify multiple number of these declarations for different bundle versions. It resolves against all of the installed bundles, not just the activated ones.

The provider is implemented with a custom classpath container so user project metadata remains portable.
Comment 2 Konstantin Komissarchik CLA 2009-02-02 21:47:26 EST
A little gift to the Dali team from the OEPE team...