@Override public void resolve(boolean increment) { state.resolve(increment); }
public void resolve(boolean increment) { state.resolve(increment); }
private synchronized StateDelta internalResolveState(boolean incremental) { boolean fullBuildRequired = initializePlatformProperties(); return fState.resolve(incremental && !fullBuildRequired); }
private synchronized StateDelta internalResolveState(boolean incremental) { boolean fullBuildRequired = initializePlatformProperties(); return fState.resolve(incremental && !fullBuildRequired); }
/** * Resolves the state incrementally based on the given bundle names. * * @param symbolicNames * @return state delta */ public StateDelta resolveState(String[] symbolicNames) { if (initializePlatformProperties()) { return fState.resolve(false); } List<BundleDescription> bundles = new ArrayList<>(); for (int i = 0; i < symbolicNames.length; i++) { BundleDescription[] descriptions = fState.getBundles(symbolicNames[i]); for (int j = 0; j < descriptions.length; j++) { bundles.add(descriptions[j]); } } return fState.resolve(bundles.toArray(new BundleDescription[bundles.size()])); }
protected State getState(String os, String ws, String arch) { // the way plug-in export works, the os, ws and arch should ALWAYS equal the target settings. if (os.equals(TargetPlatform.getOS()) && ws.equals(TargetPlatform.getWS()) && arch.equals(TargetPlatform.getOSArch()) && fStateCopy != null) { fStateCopy.resolve(true); return fStateCopy; } return super.getState(os, ws, arch); }
@Override protected State getState(String os, String ws, String arch) { // the way plug-in export works, the os, ws and arch should ALWAYS equal the target settings. if (os.equals(TargetPlatform.getOS()) && ws.equals(TargetPlatform.getWS()) && arch.equals(TargetPlatform.getOSArch()) && fStateCopy != null) { fStateCopy.resolve(true); return fStateCopy; } return super.getState(os, ws, arch); }
protected State getState(String os, String ws, String arch) { State main = TargetPlatformHelper.getState(); if (os.equals(TargetPlatform.getOS()) && ws.equals(TargetPlatform.getWS()) && arch.equals(TargetPlatform.getOSArch())) { return main; } if (fStateCopy == null) { copyState(main); } Dictionary<String, String>[] dictionaries = fStateCopy.getPlatformProperties(); for (int i = 0; i < dictionaries.length; i++) { Dictionary<String, String> properties = dictionaries[i]; properties.put("osgi.os", os); //$NON-NLS-1$ properties.put("osgi.ws", ws); //$NON-NLS-1$ properties.put("osgi.arch", arch); //$NON-NLS-1$ } fStateCopy.resolve(false); return fStateCopy; }
protected State getState(String os, String ws, String arch) { State main = TargetPlatformHelper.getState(); if (os.equals(TargetPlatform.getOS()) && ws.equals(TargetPlatform.getWS()) && arch.equals(TargetPlatform.getOSArch())) { return main; } if (fStateCopy == null) { copyState(main); } Dictionary[] dictionaries = fStateCopy.getPlatformProperties(); for (int i = 0; i < dictionaries.length; i++) { Dictionary properties = dictionaries[i]; properties.put("osgi.os", os); //$NON-NLS-1$ properties.put("osgi.ws", ws); //$NON-NLS-1$ properties.put("osgi.arch", arch); //$NON-NLS-1$ } fStateCopy.resolve(false); return fStateCopy; }
private void resolve(boolean uninstalled) { database.readLock(); try { if (lastResolveStamp != database.getRevisionsTimestamp()) { Collection<ModuleRevision> containerRemovalPending = container.getRemovalPending(); BundleDescription[] stateRemovalPendingDescs = systemState.getRemovalPending(); Collection<BundleDescription> stateRemovalPending = new ArrayList<>(stateRemovalPendingDescs.length); for (BundleDescription description : stateRemovalPendingDescs) { if (!containerRemovalPending.contains(description.getUserObject())) { stateRemovalPending.add(description); } } if (!stateRemovalPending.isEmpty()) { systemState.resolve(stateRemovalPending.toArray(new BundleDescription[stateRemovalPending.size()]), true); } else { systemState.resolve(!uninstalled); } lastResolveStamp = database.getRevisionsTimestamp(); systemState.setTimeStamp(database.getRevisionsTimestamp()); } } finally { database.readUnlock(); } }
private void resolve(boolean uninstalled) { database.readLock(); try { if (lastResolveStamp != database.getRevisionsTimestamp()) { Collection<ModuleRevision> containerRemovalPending = container.getRemovalPending(); BundleDescription[] stateRemovalPendingDescs = systemState.getRemovalPending(); Collection<BundleDescription> stateRemovalPending = new ArrayList<BundleDescription>(stateRemovalPendingDescs.length); for (BundleDescription description : stateRemovalPendingDescs) { if (!containerRemovalPending.contains(description.getUserObject())) { stateRemovalPending.add(description); } } if (!stateRemovalPending.isEmpty()) { systemState.resolve(stateRemovalPending.toArray(new BundleDescription[stateRemovalPending.size()]), true); } else { systemState.resolve(!uninstalled); } lastResolveStamp = database.getRevisionsTimestamp(); systemState.setTimeStamp(database.getRevisionsTimestamp()); } } finally { database.readUnlock(); } }
@Override public void run(IProgressMonitor monitor) throws CoreException { if (FACTORY == null) FACTORY = Platform.getPlatformAdmin().getFactory(); monitor.beginTask("", fModels.length + 1); //$NON-NLS-1$ fState = FACTORY.createState(true); for (int i = 0; i < fModels.length; i++) { BundleDescription bundle = fModels[i].getBundleDescription(); if (bundle != null) fState.addBundle(FACTORY.createBundleDescription(bundle)); monitor.worked(1); } fState.setPlatformProperties(fProperties); fState.resolve(false); monitor.done(); }
public void run(IProgressMonitor monitor) throws CoreException { if (FACTORY == null) FACTORY = Platform.getPlatformAdmin().getFactory(); monitor.beginTask("", fModels.length + 1); //$NON-NLS-1$ fState = FACTORY.createState(true); for (int i = 0; i < fModels.length; i++) { BundleDescription bundle = fModels[i].getBundleDescription(); if (bundle != null) fState.addBundle(FACTORY.createBundleDescription(bundle)); monitor.worked(1); } fState.setPlatformProperties(fProperties); fState.resolve(false); monitor.done(); }
protected void resolveState(State state) { state.resolve(false); // warn about missing/ambiguous/inconsistent system.bundle BundleDescription[] bundles = state.getBundles("system.bundle"); if (bundles == null || bundles.length == 0) { logger.warn("No system.bundle"); } else if (bundles.length > 1) { logger.warn("Multiple system.bundles " + Arrays.toString(bundles)); } else if (bundles[0].getBundleId() != SYSTEM_BUNDLE_ID) { logger.warn("system.bundle bundleId == " + bundles[0].getBundleId()); } }
@Override public void addApiComponents(IApiComponent[] components) throws CoreException { HashSet<String> ees = new HashSet<>(); for (IApiComponent apiComponent : components) { BundleComponent component = (BundleComponent) apiComponent; if (component.isSourceComponent()) { continue; } BundleDescription description = component.getBundleDescription(); getState().addBundle(description); addComponent(component); ees.addAll(Arrays.asList(component.getExecutionEnvironments())); } resolveSystemLibrary(ees); getState().resolve(); }
protected State getState(String os, String ws, String arch) { State main = TargetPlatformHelper.getState(); if (os.equals(TargetPlatform.getOS()) && ws.equals(TargetPlatform.getWS()) && arch.equals(TargetPlatform.getOSArch())) { return main; } if (fStateCopy == null) { fStateCopy = main.getFactory().createState(main); fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver()); fStateCopy.setPlatformProperties(main.getPlatformProperties()); } Dictionary[] dictionaries = fStateCopy.getPlatformProperties(); for (int i = 0; i < dictionaries.length; i++) { Dictionary properties = dictionaries[i]; properties.put("osgi.os", os); //$NON-NLS-1$ properties.put("osgi.ws", ws); //$NON-NLS-1$ properties.put("osgi.arch", arch); //$NON-NLS-1$ } fStateCopy.resolve(false); return fStateCopy; }
private void cleanRemovalPendings(State systemState, BundleDescription[] removalPendings) { if (removalPendings.length == 0) return; systemState.resolve(removalPendings); for (int i = 0; i < removalPendings.length; i++) { Object userObject = removalPendings[i].getUserObject(); if (userObject instanceof BundleLoaderProxy) { BundleLoader.closeBundleLoader((BundleLoaderProxy) userObject); try { ((BundleLoaderProxy) userObject).getBundleData().close(); } catch (IOException e) { // ignore } } else if (userObject instanceof BundleData) { try { ((BundleData) userObject).close(); } catch (IOException e) { // ignore } } } }
private void cleanRemovalPendings(State systemState, BundleDescription[] removalPendings) { if (removalPendings.length == 0) return; systemState.resolve(removalPendings); for (int i = 0; i < removalPendings.length; i++) { Object userObject = removalPendings[i].getUserObject(); if (userObject instanceof BundleLoaderProxy) { BundleLoader.closeBundleLoader((BundleLoaderProxy) userObject); try { ((BundleLoaderProxy) userObject).getBundleData().close(); } catch (IOException e) { // ignore } } else if (userObject instanceof BundleData) { try { ((BundleData) userObject).close(); } catch (IOException e) { // ignore } } } }
private void readTargetState(URL[] urls, IProgressMonitor monitor) { fTargetTimestamp = computeTimestamp(urls); File dir = new File(DIR, Long.toString(fTargetTimestamp) + ".target"); //$NON-NLS-1$ if ((fState = readStateCache(dir)) == null || !fAuxiliaryState.readPluginInfoCache(dir)) { createNewTargetState(true, urls, monitor); if (!dir.exists()) dir.mkdirs(); fAuxiliaryState.savePluginInfo(dir); resolveState(false); saveState(dir); } else { boolean propertiesChanged = initializePlatformProperties(); fState.setResolver(Platform.getPlatformAdmin().getResolver()); if (propertiesChanged) fState.resolve(false); fId = fState.getBundles().length; } if (!fExtensionRegistry.readExtensionsCache(dir)) fExtensionRegistry.saveExtensions(fState, dir); }
protected void setActive(boolean active) { if (active) { State state = PDECore.getDefault().getModelManager().getState().getState(); state.resolve(true); fTreeViewer.setInput(state); PDECore.getDefault().getModelManager().addPluginModelListener(this); } else { PDECore.getDefault().getModelManager().removePluginModelListener(this); } }