org.eclipse.osgi.service.resolver.State.removeBundle()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.eclipse.osgi.service.resolver.State.removeBundle()方法的一些代码示例,展示了State.removeBundle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。State.removeBundle()方法的具体详情如下:
包路径:org.eclipse.osgi.service.resolver.State
类名称:State
方法名:removeBundle

State.removeBundle介绍

[英]Removes a bundle description with the given bundle id.
[中]删除具有给定绑定id的绑定描述。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.pde.core

public void removeBundleDescription(BundleDescription description) {
  if (description != null)
    fState.removeBundle(description);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

public void removeBundleDescription(BundleDescription description) {
  if (description != null)
    fState.removeBundle(description);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin.equinox

private void removeBundleFromState(BundleDescription bundleDescription) {
    URI location = FileUtils.getRealLocation(manipulator, bundleDescription.getLocation());
    locationStateIndex.remove(location);
    nameVersionStateIndex.remove(getKey(bundleDescription));
    state.removeBundle(bundleDescription);
  }
}

代码示例来源:origin: org.eclipse.equinox.frameworkadmin/equinox

private void removeBundleFromState(BundleDescription bundleDescription) {
    URI location = FileUtils.getRealLocation(manipulator, bundleDescription.getLocation());
    locationStateIndex.remove(location);
    nameVersionStateIndex.remove(getKey(bundleDescription));
    state.removeBundle(bundleDescription);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.osgi

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()));
  }
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

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()));
  }
}

代码示例来源:origin: org.codehaus.tycho/tycho-osgi-components

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;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

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);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi.compatibility.state

systemState.removeBundle(event.getBundle().getBundleId());
systemState.setTimeStamp(database.getRevisionsTimestamp());
break;

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

systemState.removeBundle(event.getBundle().getBundleId());
systemState.setTimeStamp(database.getRevisionsTimestamp());
break;

代码示例来源:origin: org.eclipse/org.eclipse.pde.core

fState.removeBundle(conflicts[j]);

代码示例来源:origin: org.eclipse.tycho/tycho-core

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);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

/**
 * 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);
        }
      }
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.osgi

state.removeBundle(0);
state.addBundle(newSystemBundle);

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

state.removeBundle(0);
state.addBundle(newSystemBundle);

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

break;
case BundleEvent.UNINSTALLED :
  systemState.removeBundle(bundleData.getBundleID());
  break;

代码示例来源:origin: org.eclipse/org.eclipse.osgi

break;
case BundleEvent.UNINSTALLED :
  systemState.removeBundle(bundleData.getBundleID());
  break;

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

@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;
}

代码示例来源:origin: org.eclipse/org.eclipse.pde.core

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;
}

相关文章

微信公众号

最新文章

更多