1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.client.ui.dist.commands;
17
18 import java.io.File;
19 import java.io.IOException;
20 import java.util.jar.Manifest;
21
22 import org.eclipse.core.commands.AbstractHandler;
23 import org.eclipse.core.commands.ExecutionEvent;
24 import org.eclipse.core.commands.ExecutionException;
25
26 import aQute.bnd.osgi.Builder;
27 import aQute.bnd.osgi.Constants;
28 import aQute.bnd.osgi.Jar;
29
30 public class BndProcess extends AbstractHandler implements Constants {
31
32 public Object execute(ExecutionEvent event) throws ExecutionException {
33 try {
34 Builder b = new Builder();
35 b.setProperty(EXPORT_PACKAGE, "org.osgi.framework");
36 b.setProperty(PRIVATE_PACKAGE, "*");
37 b.addClasspath(new File(
38 "/home/mbaudier/.m2/repository/org/eclipse/osgi/org.eclipse.osgi/3.6.1/org.eclipse.osgi-3.6.1.jar"));
39
40 Jar jar = b.build();
41 Manifest m = jar.getManifest();
42 jar.write(new File(b.getBsn() + ".jar"));
43 } catch (IOException e) {
44
45 e.printStackTrace();
46 } catch (Exception e) {
47
48 e.printStackTrace();
49 }
50
51 return null;
52 }
53
54 public static void main(String[] args) {
55 try {
56 new BndProcess().execute(null);
57 } catch (ExecutionException e) {
58
59 e.printStackTrace();
60 }
61 }
62
63 }