EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.codegen.simucontroller]

COVERAGE SUMMARY FOR SOURCE FILE [SimuControllerPlugin.java]

nameclass, %method, %block, %line, %
SimuControllerPlugin.java0%   (0/2)0%   (0/10)0%   (0/129)0%   (0/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimuControllerPlugin0%   (0/1)0%   (0/8)0%   (0/119)0%   (0/36)
<static initializer> 0%   (0/1)0%   (0/6)0%   (0/3)
SimuControllerPlugin (): void 0%   (0/1)0%   (0/5)0%   (0/3)
ensurePluginLoaded (BundleContext, String): void 0%   (0/1)0%   (0/48)0%   (0/11)
getDefault (): SimuControllerPlugin 0%   (0/1)0%   (0/2)0%   (0/1)
getDockModel (): DocksModel 0%   (0/1)0%   (0/2)0%   (0/1)
log (int, String): void 0%   (0/1)0%   (0/10)0%   (0/2)
start (BundleContext): void 0%   (0/1)0%   (0/40)0%   (0/12)
stop (BundleContext): void 0%   (0/1)0%   (0/6)0%   (0/3)
     
class SimuControllerPlugin$10%   (0/1)0%   (0/2)0%   (0/10)0%   (0/4)
SimuControllerPlugin$1 (SimuControllerPlugin): void 0%   (0/1)0%   (0/6)0%   (0/2)
bundleChanged (BundleEvent): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package de.uka.ipd.sdq.codegen.simucontroller;
2 
3import org.apache.log4j.Logger;
4import org.eclipse.core.runtime.Status;
5import org.eclipse.ui.PlatformUI;
6import org.eclipse.ui.plugin.AbstractUIPlugin;
7import org.osgi.framework.Bundle;
8import org.osgi.framework.BundleContext;
9import org.osgi.framework.BundleEvent;
10import org.osgi.framework.BundleException;
11import org.osgi.framework.BundleListener;
12 
13import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.DocksModel;
14import de.uka.ipd.sdq.codegen.simucontroller.gui.DockStatusViewPart;
15import de.uka.ipd.sdq.codegen.simucontroller.gui.DockStatusViewer;
16 
17/**
18 * The activator class controls the plug-in life cycle
19 */
20public class SimuControllerPlugin extends AbstractUIPlugin {
21        /** Logger for this class. */
22        private static final Logger logger = Logger.getLogger(SimuControllerPlugin.class);
23 
24        // The plug-in ID
25        public static final String PLUGIN_ID = "de.uka.ipd.sdq.codegen.simucontroller";
26 
27        // The shared instance
28        private static SimuControllerPlugin plugin;
29 
30        private static DocksModel dockModel = null;
31 
32        /**
33         * The constructor
34         */
35        public SimuControllerPlugin() {
36                plugin = this;
37        }
38 
39        /* (non-Javadoc)
40         * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
41         */
42        @Override
43        public void start(BundleContext context) throws Exception {
44 
45                context.addBundleListener(new BundleListener(){
46 
47                        public void bundleChanged(BundleEvent event) {
48                                if (event.getType() == BundleEvent.INSTALLED){
49 
50                                }
51                        }
52                });
53                super.start(context);
54 
55                ensurePluginLoaded(context,"org.eclipse.equinox.event");
56                ensurePluginLoaded(context,"org.eclipse.equinox.log");
57                ensurePluginLoaded(context, "ch.ethz.iks.slp");
58                ensurePluginLoaded(context,"ch.ethz.iks.r_osgi.remote");
59                ensurePluginLoaded(context,"ch.ethz.iks.r_osgi.service_discovery.slp");
60 
61                dockModel = new DocksModel(context);
62                
63                // FB 2011-06-29: added exception handling. If the SimuControllerPlugin is
64                // loaded right at the start of the platform (e.g., the SLA@SOI prediction
65                // server does this in order to publish a simulation service), then it may
66                // be loaded before the workbench itself, and the SimuDock cannot be
67                // displayed.
68                try {
69                        DockStatusViewer.showSimuDockView();
70                } catch (Exception e) {
71                        e.printStackTrace();
72                }
73        }
74 
75        private void ensurePluginLoaded(BundleContext context, String bundleName) {
76                for (Bundle b : context.getBundles()) {
77                        if (b.getSymbolicName().equals(bundleName)) {
78                                if (b.getState() != Bundle.ACTIVE){
79                                        try {
80                                                b.start();
81                                                while (b.getState() != Bundle.ACTIVE){
82                                                        try {
83                                                                Thread.sleep(50);
84                                                        } catch (InterruptedException e) {
85                                                                logger.warn("Waiting for initalization was aborted unexpectedly.", e);
86                                                        }
87                                                }
88                                        } catch (BundleException e) {
89                                                logger.error("Error while starting the OSGI bundle occured.", e);
90                                        }
91                                }
92                        }
93                }
94        }
95 
96        /* (non-Javadoc)
97         * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
98         */
99        public void stop(BundleContext context) throws Exception {
100                //extCache.shutdown();
101                plugin = null;
102                super.stop(context);
103        }
104 
105        /**
106         * Returns the shared instance
107         */
108        public static SimuControllerPlugin getDefault() {
109                return plugin;
110        }
111 
112        public static void log(int severity, String message){
113                plugin.getLog().log(new Status(severity,PLUGIN_ID,message));
114        }
115 
116        public static DocksModel getDockModel() {
117                return dockModel;
118        }
119 
120}

[all classes][de.uka.ipd.sdq.codegen.simucontroller]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov