Changeset 23895 in osm for applications/editors/josm/plugins/smed_fw/src
- Timestamp:
- 2010-10-28T00:21:05+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed_fw/src/smed_fw/SmedFW.java
r23882 r23895 1 1 package smed_fw; 2 2 3 import java.util.ArrayList; 4 import java.util.HashMap; 5 import java.util.List; 6 import java.util.Map; 7 8 import org.apache.felix.framework.Felix; 9 import org.apache.felix.framework.util.FelixConstants; 3 10 import org.openstreetmap.josm.plugins.Plugin; 4 11 import org.openstreetmap.josm.plugins.PluginInformation; 12 import org.osgi.framework.Bundle; 13 import org.osgi.framework.BundleActivator; 14 import org.osgi.framework.BundleContext; 15 import org.osgi.framework.BundleException; 5 16 6 public class SmedFW extends Plugin { 17 public class SmedFW extends Plugin implements BundleActivator{ 7 18 19 private BundleContext context; 20 private Felix felix; 21 8 22 public SmedFW(PluginInformation info) { 9 23 super(info); 10 24 25 init(); 11 26 System.out.println("SmedFW (OSGi-Implementation) noch nicht weiter programmiert"); 12 27 } 13 28 29 private void init() { 30 Map config = new HashMap(); 31 List list = new ArrayList(); 32 33 list.add(this); 34 config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); 35 36 // Now create an instance of the framework with 37 // our configurations properties 38 felix = new Felix(config); 39 40 // now start Felix instance 41 try { 42 felix.start(); 43 } catch (BundleException e) { 44 System.err.println("Could not generate framework: " + e); 45 e.printStackTrace(); 46 } 47 } 48 49 @Override 50 public void start(BundleContext context) throws Exception { 51 this.context = context; 52 } 53 54 @Override 55 public void stop(BundleContext context) throws Exception { 56 context = null; 57 } 58 59 public Bundle[] getBundles() { 60 if(context != null) return context.getBundles(); 61 62 return null; 63 } 64 14 65 }
Note:
See TracChangeset
for help on using the changeset viewer.
