Java Reference
In-Depth Information
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.foo.paint
Bundle-Version: 2.0.0
Bundle-Name: Simple Paint Program
Import-Package: javax.swing, org.foo.shape; version="2.0.0"
Export-Package: org.foo.paint; version="2.0.0"
The main paint program bundle no longer has any dependencies on the various
shape implementations, but it now needs to export the package containing the paint
frame. You can take the existing static main() method body and put it inside a new
class called org.foo.fullpaint.FullPaint , with the following bundle metadata:
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.foo.fullpaint
Bundle-Version: 1.0.0
Bundle-Name: Full Paint Program Configuration
Import-Package: javax.swing, org.foo.shape; org.foo.paint;
org.foo.shape.circle; org.foo.shape.square; org.foo.shape.triangle;
version="2.0.0"
Main-Class: org.foo.fullpaint.FullPaint
To l a u n c h t h i s f u l l v e r s i o n o f t h e p a i n t p r o g r a m , u s e t h e b u n d l e l a u n c h e r t o d e p l o y a l l
the associated bundles, including this FullPaint bundle. Likewise, you can create a
different bundle containing the org.foo.smallpaint.SmallPaint class in this listing
to launch a small configuration of the paint program containing only the circle shape.
Listing 2.3 New launcher for smaller paint program configuration
package org.foo.smallpaint;
public class SmallPaint {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
PaintFrame frame = new PaintFrame();
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
});
frame.addShape(new Circle());
frame.setVisible(true);
}
});
}
Injects only circle shape
implementation
 
Search WWH ::




Custom Search