diff -r a94154dd1f2e core.netigso/src/org/netbeans/core/netigso/NetigsoActivator.java
|
a
|
b
|
|
| 48 | 48 | import java.util.concurrent.CopyOnWriteArraySet; |
| 49 | 49 | import java.util.logging.Level; |
| 50 | 50 | import java.util.logging.Logger; |
| 51 | | import org.apache.felix.moduleloader.IContent; |
| 52 | | import org.apache.felix.moduleloader.IContentLoader; |
| 53 | | import org.apache.felix.moduleloader.IModule; |
| 54 | | import org.apache.felix.moduleloader.ISearchPolicy; |
| 55 | | import org.apache.felix.moduleloader.IURLPolicy; |
| 56 | | import org.apache.felix.moduleloader.ResourceNotFoundException; |
| 57 | 51 | import org.netbeans.Module; |
| 58 | 52 | import org.netbeans.ProxyClassLoader; |
| 59 | 53 | import org.netbeans.core.startup.MainLookup; |
| … |
… |
|
| 130 | 124 | /** Injects classloader of mi to Felix's bundle. |
| 131 | 125 | */ |
| 132 | 126 | private void join(Bundle bundle, ModuleInfo mi) { |
| 133 | | try { |
| | 127 | // TODO |
| | 128 | /*try { |
| 134 | 129 | Method m = findMethod(bundle, "getInfo"); |
| 135 | 130 | Object info = m.invoke(bundle); |
| 136 | 131 | Method m2 = findMethod(info, "getCurrentModule"); |
| … |
… |
|
| 139 | 134 | m3.invoke(imodule, new ModuleContentLoader(mi)); |
| 140 | 135 | } catch (Exception ex) { |
| 141 | 136 | throw new IllegalStateException(ex); |
| 142 | | } |
| | 137 | }*/ |
| 143 | 138 | } |
| 144 | 139 | |
| 145 | 140 | private static Method findMethod(Object obj, String name, Class... args) throws Exception { |
| … |
… |
|
| 192 | 187 | return (String) obj.getProperty(Constants.SERVICE_DESCRIPTION); |
| 193 | 188 | } |
| 194 | 189 | |
| 195 | | private static final class ModuleContentLoader implements IContentLoader, |
| | 190 | /*private static final class ModuleContentLoader implements IContentLoader, |
| 196 | 191 | ISearchPolicy { |
| 197 | 192 | private final ModuleInfo mi; |
| 198 | 193 | |
| … |
… |
|
| 293 | 288 | return null; |
| 294 | 289 | } |
| 295 | 290 | |
| 296 | | } // end of ModuleContentLoader |
| | 291 | }*/ // end of ModuleContentLoader |
| 297 | 292 | |
| 298 | 293 | } |
diff -r a94154dd1f2e core.netigso/src/org/netbeans/core/netigso/NetigsoModuleFactory.java
|
a
|
b
|
|
| 58 | 58 | import java.util.jar.JarOutputStream; |
| 59 | 59 | import java.util.jar.Manifest; |
| 60 | 60 | import java.util.logging.Level; |
| 61 | | import org.apache.felix.framework.Felix; |
| | 61 | import org.eclipse.osgi.launch.EquinoxFactory; |
| 62 | 62 | import org.netbeans.Events; |
| 63 | 63 | import org.netbeans.InvalidException; |
| 64 | 64 | import org.netbeans.Module; |
| … |
… |
|
| 70 | 70 | import org.osgi.framework.BundleActivator; |
| 71 | 71 | import org.osgi.framework.BundleException; |
| 72 | 72 | import org.osgi.framework.Constants; |
| | 73 | import org.osgi.framework.launch.Framework; |
| 73 | 74 | |
| 74 | 75 | /** |
| 75 | 76 | * |
| … |
… |
|
| 77 | 78 | */ |
| 78 | 79 | @ServiceProvider(service=ModuleFactory.class) |
| 79 | 80 | public class NetigsoModuleFactory extends ModuleFactory |
| 80 | | implements Stamps.Updater { |
| | 81 | implements Stamps.Updater { |
| 81 | 82 | private static NetigsoActivator activator; |
| 82 | | private static Felix felix; |
| | 83 | private static Framework equinoxFramework; |
| 83 | 84 | private static Set<String> registered; |
| 84 | 85 | |
| 85 | 86 | static void clear() { |
| 86 | 87 | activator = null; |
| 87 | | felix = null; |
| | 88 | equinoxFramework = null; |
| 88 | 89 | readBundles(); |
| 89 | 90 | } |
| 90 | 91 | |
| … |
… |
|
| 125 | 126 | |
| 126 | 127 | @Override |
| 127 | 128 | public Module create( |
| 128 | | File jar, Object history, |
| 129 | | boolean reloadable, boolean autoload, boolean eager, |
| | 129 | File jar, Object history, |
| | 130 | boolean reloadable, boolean autoload, boolean eager, |
| 130 | 131 | ModuleManager mgr, Events ev |
| 131 | 132 | ) throws IOException { |
| 132 | 133 | try { |
| … |
… |
|
| 146 | 147 | } |
| 147 | 148 | } |
| 148 | 149 | |
| 149 | | synchronized static Felix getContainer() throws BundleException { |
| | 150 | synchronized static Framework getContainer() throws BundleException { |
| 150 | 151 | if (activator == null) { |
| 151 | 152 | Map<String,Object> configMap = new HashMap<String,Object>(); |
| 152 | 153 | // Configure the Felix instance to be embedded. |
| 153 | 154 | //configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true"); |
| 154 | 155 | // Add core OSGi packages to be exported from the class path |
| 155 | 156 | // via the system bundle. |
| 156 | | /* configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, |
| 157 | | "org.osgi.framework; version=1.4.0," + |
| 158 | | "org.osgi.service.packageadmin; version=1.2.0," + |
| 159 | | "org.osgi.service.startlevel; version=1.1.0," + |
| 160 | | "org.osgi.util.tracker; version=1.3.3,"+ |
| 161 | | "org.osgi.service.url; version=1.0.0"); |
| 162 | | */ |
| | 157 | configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, |
| | 158 | "org.osgi.framework; version=1.4.0," + |
| | 159 | "org.osgi.service.packageadmin; version=1.2.0," + |
| | 160 | "org.osgi.service.startlevel; version=1.1.0," + |
| | 161 | "org.osgi.util.tracker; version=1.3.3," + |
| | 162 | "org.osgi.service.url; version=1.0.0"); |
| | 163 | configMap.put(Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit"); |
| 163 | 164 | // Explicitly specify the directory to use for caching bundles. |
| 164 | | String ud = System.getProperty("netbeans.user"); |
| | 165 | /*String ud = System.getProperty("netbeans.user"); |
| 165 | 166 | if (ud == null) { |
| 166 | | throw new IllegalStateException(); |
| | 167 | throw new IllegalStateException(); |
| 167 | 168 | } |
| 168 | 169 | String cache = ud + File.separator + "var" + File.separator + "cache" + File.separator + "felix"; |
| 169 | 170 | configMap.put("felix.cache.profiledir", cache); |
| 170 | 171 | configMap.put("felix.cache.dir", cache); |
| 171 | | configMap.put(Constants.FRAMEWORK_STORAGE, cache); |
| | 172 | configMap.put(Constants.FRAMEWORK_STORAGE, cache);*/ |
| 172 | 173 | activator = new NetigsoActivator(); |
| 173 | 174 | List<BundleActivator> activators = new ArrayList<BundleActivator>(); |
| 174 | 175 | activators.add(activator); |
| 175 | 176 | configMap.put("felix.systembundle.activators", activators); |
| 176 | | felix = new Felix(configMap); |
| 177 | | felix.init(); |
| 178 | | NetigsoActivator.LOG.finer("Felix initialized"); // NOI18N |
| | 177 | EquinoxFactory ef = new EquinoxFactory(); |
| | 178 | equinoxFramework = ef.newFramework(configMap); |
| | 179 | equinoxFramework.init(); |
| | 180 | NetigsoActivator.LOG.finer("Equinox initialized"); // NOI18N |
| 179 | 181 | } |
| 180 | | return felix; |
| | 182 | return equinoxFramework; |
| 181 | 183 | } |
| 182 | 184 | |
| 183 | 185 | static void startContainer() throws BundleException { |