public void removeBundleDescription(BundleDescription description) { if (description != null) fState.removeBundle(description); }
public void removeBundleDescription(BundleDescription description) { if (description != null) fState.removeBundle(description); }
private void removeBundleFromState(BundleDescription bundleDescription) { URI location = FileUtils.getRealLocation(manipulator, bundleDescription.getLocation()); locationStateIndex.remove(location); nameVersionStateIndex.remove(getKey(bundleDescription)); state.removeBundle(bundleDescription); } }
private void removeBundleFromState(BundleDescription bundleDescription) { URI location = FileUtils.getRealLocation(manipulator, bundleDescription.getLocation()); locationStateIndex.remove(location); nameVersionStateIndex.remove(getKey(bundleDescription)); state.removeBundle(bundleDescription); } }
private void checkSystemState(State state) { BundleDescription[] bundles = state.getBundles(); if (bundles == null) return; boolean removedBundle = false; for (int i = 0; i < bundles.length; i++) { if (adaptor.getBundle(bundles[i].getBundleId()) == null) { state.removeBundle(bundles[i]); removedBundle = true; } } if (removedBundle) state.resolve(false); // do a full resolve BundleDescription systemBundle = state.getBundle(0); if (systemBundle == null || !systemBundle.isResolved()) { ResolverError[] errors = systemBundle == null ? new ResolverError[0] : state.getResolverErrors(systemBundle); StringBuffer sb = new StringBuffer(); for (int i = 0; i < errors.length; i++) { sb.append(errors[i].toString()); if (i < errors.length - 1) sb.append(", "); //$NON-NLS-1$ } // this would be a bug in the framework throw new IllegalStateException(NLS.bind(AdaptorMsg.SYSTEMBUNDLE_NOTRESOLVED, sb.toString())); } }
private void checkSystemState(State state) { BundleDescription[] bundles = state.getBundles(); if (bundles == null) return; boolean removedBundle = false; for (int i = 0; i < bundles.length; i++) { if (adaptor.getBundle(bundles[i].getBundleId()) == null) { state.removeBundle(bundles[i]); removedBundle = true; } } if (removedBundle) state.resolve(false); // do a full resolve BundleDescription systemBundle = state.getBundle(0); if (systemBundle == null || !systemBundle.isResolved()) { ResolverError[] errors = systemBundle == null ? new ResolverError[0] : state.getResolverErrors(systemBundle); StringBuffer sb = new StringBuffer(); for (int i = 0; i < errors.length; i++) { sb.append(errors[i].toString()); if (i < errors.length - 1) sb.append(", "); //$NON-NLS-1$ } // this would be a bug in the framework throw new IllegalStateException(NLS.bind(AdaptorMsg.SYSTEMBUNDLE_NOTRESOLVED, sb.toString())); } }
private BundleDescription addBundle( Dictionary enhancedManifest, File bundleLocation, boolean override ) throws BundleException { BundleDescription descriptor; descriptor = factory.createBundleDescription( state, enhancedManifest, bundleLocation.getAbsolutePath(), getNextBundleId() ); setUserProperty( descriptor, PROP_MANIFEST, enhancedManifest ); if ( override ) { BundleDescription[] conflicts = state.getBundles( descriptor.getSymbolicName() ); if ( conflicts != null ) { for ( BundleDescription conflict : conflicts ) { state.removeBundle( conflict ); getLogger().warn( conflict.toString() + " has been replaced by another bundle with the same symbolic name " + descriptor.toString() ); } } } state.addBundle( descriptor ); return descriptor; }
public void addBundle(IPluginModelBase model, boolean update) { if (model == null) return; BundleDescription desc = model.getBundleDescription(); long bundleId = desc == null || !update ? -1 : desc.getBundleId(); try { BundleDescription newDesc = addBundle(new File(model.getInstallLocation()), bundleId); model.setBundleDescription(newDesc); if (newDesc == null && update) fState.removeBundle(desc); } catch (CoreException e) { PDECore.log(e); model.setBundleDescription(null); } }
systemState.removeBundle(event.getBundle().getBundleId()); systemState.setTimeStamp(database.getRevisionsTimestamp()); break;
systemState.removeBundle(event.getBundle().getBundleId()); systemState.setTimeStamp(database.getRevisionsTimestamp()); break;
fState.removeBundle(conflicts[j]);
public void addBundle(State state, long id, File bundleLocation, Dictionary<String, String> mf, boolean override) throws BundleException { BundleDescription descriptor = factory.createBundleDescription(state, mf, getNormalizedPath(bundleLocation), id); if (override) { BundleDescription[] conflicts = state.getBundles(descriptor.getSymbolicName()); if (conflicts != null) { for (BundleDescription conflict : conflicts) { state.removeBundle(conflict); logger.warn( conflict.toString() + " has been replaced by another bundle with the same symbolic name " + descriptor.toString()); } } } state.addBundle(descriptor); }
/** * When creating a target state, having duplicates of certain bundles including core runtime cause problems when launching. The * {@link LoadTargetDefinitionJob} removes duplicates for us, but on restart the state is created from preferences. This method * search the state for bundles with the same ID/Version. Where multiple bundles are found, all but one are removed from the state. * * @param state state to search for duplicates in */ private void removeDuplicatesFromState(State state) { // TODO This shouldn't be required if the target is removing duplicates, but test workspace shows some duplicates still BundleDescription[] bundles = state.getBundles(); for (int i = 0; i < bundles.length; i++) { BundleDescription desc = bundles[i]; String id = desc.getSymbolicName(); BundleDescription[] conflicts = state.getBundles(id); if (conflicts.length > 1) { for (int j = 0; j < conflicts.length; j++) { if (desc.getVersion().equals(conflicts[j].getVersion()) && desc.getBundleId() != conflicts[j].getBundleId()) { fState.removeBundle(desc); } } } } }
state.removeBundle(0); state.addBundle(newSystemBundle);
state.removeBundle(0); state.addBundle(newSystemBundle);
break; case BundleEvent.UNINSTALLED : systemState.removeBundle(bundleData.getBundleID()); break;
break; case BundleEvent.UNINSTALLED : systemState.removeBundle(bundleData.getBundleID()); break;
@Override protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary<String, String> environment) { // if there is an environment conflict boolean conflict = !super.shouldAddPlugin(bundle, environment); if (conflict) { // make a copy of the state if we haven't already if (fStateCopy == null) copyState(TargetPlatformHelper.getState()); // replace the current BundleDescription with a copy who does not have the platform filter. This will allow the plug-in to be resolved BundleDescription desc = fStateCopy.removeBundle(bundle.getBundleId()); BundleDescription newDesc = fStateCopy.getFactory().createBundleDescription(desc.getBundleId(), desc.getSymbolicName(), desc.getVersion(), desc.getLocation(), desc.getRequiredBundles(), desc.getHost(), desc.getImportPackages(), desc.getExportPackages(), desc.isSingleton(), desc.attachFragments(), desc.dynamicFragments(), null, desc.getExecutionEnvironments(), desc.getGenericRequires(), desc.getGenericCapabilities()); fStateCopy.addBundle(newDesc); } // always include plug-ins, even ones with environment conflicts return true; }
protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary environment) { // if there is an environment conflict boolean conflict = !super.shouldAddPlugin(bundle, environment); if (conflict) { // make a copy of the state if we haven't already if (fStateCopy == null) copyState(TargetPlatformHelper.getState()); // replace the current BundleDescription with a copy who does not have the platform filter. This will allow the plug-in to be resolved BundleDescription desc = fStateCopy.removeBundle(bundle.getBundleId()); BundleDescription newDesc = fStateCopy.getFactory().createBundleDescription(desc.getBundleId(), desc.getSymbolicName(), desc.getVersion(), desc.getLocation(), desc.getRequiredBundles(), desc.getHost(), desc.getImportPackages(), desc.getExportPackages(), desc.isSingleton(), desc.attachFragments(), desc.dynamicFragments(), null, desc.getExecutionEnvironments(), desc.getGenericRequires(), desc.getGenericCapabilities()); fStateCopy.addBundle(newDesc); } // always include plug-ins, even ones with environment conflicts return true; }