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

Bug 253033

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

Description Konstantin Komissarchik CLA 2008-10-31 18:21:48 EDT
WTP should include a facility to make it easier for users to download necessary libraries (such as JSF and JPA implementations). The goal can be thought of as roughly equivalent to downloadable app server adapters. 

Requirements and rough design notes:

1. The download libraries wizard should be accessible via a link on the User Library provider install panel. No further work should be required from facets that already integrate with the library provider framework and register the User Library provider.

2. The link should bring up a two page wizard. The first page will have (a) list of available libraries, (b) where to put the libraries on the local machine, and (c) what to call the JDT User Library that will reference them. Reasonable defaults should be provided for (b) and (c). The second page will display a license. If library does not specify a license, the second page should not be displayed.

3. The wizard needs to make it explicit where the library is going to be downloaded from.

4. The list of known libraries should be populated by an extension point. It should be possible to either register a library directly or to provide a URL to a catalog file stored on an external server. The catalog method can be treated as a tier 2 feature to be added later.

5. The new extension point should have an enablement expression similar to the enablement expression that controls activation of library providers. This will allow those who register downloadable libraries to specify the applicability. 

6. For simplicity, the wizard should not attempt to determine whether a particular library has already been downloaded. 

7. The download mechanism should use the proxy if one is configured in Eclipse preferences.

8. Once this enhancement is implemented, a patch should be contributed to Dali that will register EclipseLink libraries to be downloaded from the main eclipse.org servers in Canada. Do we register all available versions or just the most-recent one?
Comment 1 Konstantin Komissarchik CLA 2009-01-29 01:03:27 EST
Released feature into 3.1 M5 code stream. The feature is documented in the org.eclipse.jst.common.project.facet.core.downloadableLibraries extension point, but I will summarize it here.

A library definitions file contains information about one or more libraries that are available for download. Here is an example:

<libraries>
  <library>
    <name>EclipseLink 1.0.0</name>
    <download-provider>Eclipse Foundation</download-provider>
    <download-url><![CDATA[http://www.eclipse.org/downloads/download.php?file=/rt/eclipselink/releases/1.0/eclipselink-1.0.zip&url=http://download.eclipse.org/rt/eclipselink/releases/1.0/eclipselink-1.0.zip&mirror_id=1]]></download-url>
    <license-url><![CDATA[http://www.eclipse.org/legal/epl-v10.html]]></license-url>>
    <attributes>
      <component>eclipselink/jlib/eclipselink.jar</component>
      <source>eclipselink/jlib/eclipselink-src.zip</source>
      <javadoc>eclipselink/eclipselink-javadocs.zip!eclipselink/javadocs</javadoc>
    </attributes>
  </library>
</libraries>

The definitions file can be placed inside a plugin or on a web server. It is then referenced from the extension point like so...

<extension point="org.eclipse.jst.common.project.facet.core.downloadableLibraries">
  <import-definitions url="http://www.eclipse.org/fproj/jpa-demo-libs.xml">
    <enablement>
      <with variable="requestingProjectFacet">
        <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa" forcePluginActivation="true"/>
      </with>
    </enablement>
  </import-definitions>
</extension>

For definitions held inside a plugin, use path attribute instead of the url attribute. The enablement element controls the context in which the referenced definitions apply. The expression context is identical to the context used for library provider enablement. In the above example, the referenced definitions apply only if the facet that's being configured is JPA.

To help with short-term demos I put a definitions file with EclipseLink 1.0, 1.0.1 and 1.0.2 at http://www.eclipse.org/fproj/jpa-demo-libs.xml and added the above extension to one of the framework plugins. This means that the next good i-build will be able to find and download these libraries.