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

Bug 319306

Summary: Remove the Require-Bundle in org.eclipse.jetty.osgi.boot
Product: [RT] Jetty Reporter: Hugues Malphettes <hmalphettes>
Component: osgiAssignee: Hugues Malphettes <hmalphettes>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dmytro.pishchukhin, gregw, jetty-inbox, mgorovoy
Version: 7.1.5Flags: gregw: iplog+
Target Milestone: 7.1.x   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
jetty-osgi-boot pom w/o require-bundles
none
jetty-osgi-boot-jsp updated pom none

Description Hugues Malphettes CLA 2010-07-08 14:51:32 EDT
The goal is to accomodate the jetty aggregate that can be now consumed in an OSGi environment. See bug 317222
Comment 1 Dmytro Pishchukhin CLA 2010-07-21 08:22:13 EDT
Created attachment 174838 [details]
jetty-osgi-boot pom w/o require-bundles

./META-INF/MANIFEST.MF could be removed
Comment 2 Dmytro Pishchukhin CLA 2010-07-21 08:23:14 EDT
Created attachment 174839 [details]
jetty-osgi-boot-jsp updated pom

./META-INF/MANIFEST.MF could be removed
Comment 3 Hugues Malphettes CLA 2010-07-21 14:05:18 EDT
Many thanks Dmytro.
Comment 4 Hugues Malphettes CLA 2010-07-26 15:19:34 EDT
Dmytro,

The patched pom for jetty-osgi-boot-jsp works for me but it really does produce the same than the current build. I am inclined to keep the current code as it is; it fits the eclipse PDE style for the development of an OSGi bundle.

The patched jetty-osgi-boot pom.xml is not clear to me:
In my testing, I must remove the existing MANIFEST.MF to eliminate the Require-Bundle instructions: BND will merge the pom's configuration and the existing MANIFEST.MF otherwise.
Once I remove the existing MANIFEST.MF the list of import packages is surprisingly small. For sure we need to specify a couple starting with the servlet packages otherwise the imported servlet API will not be consistent with what the rest of jetty-7 imports: 2.5.

Also BND will only detect the org.eclipse.jetty packages that are explicitly used in java classes of this bundle.
However this bundle need to be able to access any of the org.eclipse.jetty objects that could be declared in a jetty.xml configuration file.

The easiest solution I believe if we don't want to use Require-Bundle is to use a DynamicImport-Package

Here are the set of instructions that I think will do what we want. 
                    <instructions>
                        <Bundle-SymbolicName>org.eclipse.jetty.osgi.boot;singleton:=true</Bundle-SymbolicName>
                        <Export-Package>org.eclipse.jetty.osgi.boot,org.eclipse.jetty.osgi.boot.utils</Export-Package> 
                        <Bundle-Activator>org.eclipse.jetty.osgi.boot.JettyBootstrapActivator</Bundle-Activator>
                        <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy> 
                        <!-- disable the uses directive: jetty will accomodate pretty much any versions
                        of the packages it uses; no need to reflect some tight dependency determined at
                        compilation time. --> 
                        <_nouses>true</_nouses>
                        <Import-Package>javax.mail;version="1.4.0";resolution:=optional,
 javax.mail.event;version="1.4.0";resolution:=optional,
 javax.mail.internet;version="1.4.0";resolution:=optional,
 javax.mail.search;version="1.4.0";resolution:=optional,
 javax.mail.util;version="1.4.0";resolution:=optional,
 javax.servlet;version="2.5.0",
 javax.servlet.http;version="2.5.0",
 javax.transaction;version="1.1.0";resolution:=optional,
 javax.transaction.xa;version="1.1.0";resolution:=optional,
 org.osgi.framework,
 org.osgi.service.cm;version="1.2.0",
 org.osgi.service.packageadmin,
 org.osgi.service.startlevel;version="1.0",
 org.osgi.service.url;version="1.0.0",
 org.osgi.util.tracker;version="1.3.0",
 org.slf4j;resolution:=optional,
 org.slf4j.spi;resolution:=optional, 
 org.slf4j.helpers;resolution:=optional,
 org.xml.sax,
 org.xml.sax.helpers,
 *
                        </Import-Package>
                        <DynamicImport-Package>org.eclipse.jetty.*;version=[7.2,8)</DynamicImport-Package>
                        <!--Require-Bundle/-->
                        <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment> 
                    </instructions>

Comments and review welcome.
Comment 5 Hugues Malphettes CLA 2010-07-26 22:27:24 EDT
I have added an ant task to the pom.xml to delete the MANIFEST.MF copied from the sources. This way we can continue to use the PDE to develop this plugin.
Fixed as described above.