Ignore:
Timestamp:
2010-10-28T00:21:05+02:00 (15 years ago)
Author:
postfix
Message:

'some new internationalized messages'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed_fw/src/smed_fw/SmedFW.java

    r23882 r23895  
    11package smed_fw;
    22
     3import java.util.ArrayList;
     4import java.util.HashMap;
     5import java.util.List;
     6import java.util.Map;
     7
     8import org.apache.felix.framework.Felix;
     9import org.apache.felix.framework.util.FelixConstants;
    310import org.openstreetmap.josm.plugins.Plugin;
    411import org.openstreetmap.josm.plugins.PluginInformation;
     12import org.osgi.framework.Bundle;
     13import org.osgi.framework.BundleActivator;
     14import org.osgi.framework.BundleContext;
     15import org.osgi.framework.BundleException;
    516
    6 public class SmedFW extends Plugin {
     17public class SmedFW extends Plugin implements BundleActivator{
    718
     19        private BundleContext context;
     20        private Felix felix;
     21       
    822        public SmedFW(PluginInformation info) {
    923                super(info);
    1024               
     25                init();
    1126                System.out.println("SmedFW (OSGi-Implementation) noch nicht weiter programmiert");
    1227        }
    1328
     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
    1465}
Note: See TracChangeset for help on using the changeset viewer.