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

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

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

State.getResolverErrors介绍

[英]Returns all ResolverErrors for the given bundle
[中]返回给定捆绑包的所有ResolverErrors

代码示例

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

public ResolverError[] getResolverErrors(BundleDescription bundle) {
  return target.getResolverErrors(bundle);
}

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

public ResolverError[] getResolverErrors(BundleDescription bundle) {
  return target.getResolverErrors(bundle);
}

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

public ResolverError[] getResolverErrors(BundleDescription bundle) {
  return platformAdmin.getSystemState().getResolverErrors(bundle);
}

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

public ResolverError[] getResolverErrors(BundleDescription bundle) {
  return platformAdmin.getSystemState().getResolverErrors(bundle);
}

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

public Map getResolverErrors() {
  Map map = new HashMap();
  BundleDescription[] bundles = fState.getBundles();
  for (int i = 0; i < bundles.length; i++) {
    if (!bundles[i].isResolved()) {
      map.put(bundles[i], fState.getResolverErrors(bundles[i]));
    }
  }
  return map;
}

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

public String toDebugString(State state) {
  StringBuilder sb = new StringBuilder("Resolved OSGi state\n");
  for (BundleDescription otherBundle : state.getBundles()) {
    if (!otherBundle.isResolved()) {
      sb.append("NOT ");
    }
    sb.append("RESOLVED ");
    sb.append(otherBundle.toString()).append(" : ").append(otherBundle.getLocation());
    sb.append('\n');
    for (ResolverError error : state.getResolverErrors(otherBundle)) {
      sb.append('\t').append(error.toString()).append('\n');
    }
  }
  return sb.toString();
}

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

private BundleException getResolverError(BundleDescription bundleDesc) {
  ResolverError[] errors = framework.adaptor.getState().getResolverErrors(bundleDesc);
  if (errors == null || errors.length == 0)
    return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_EXCEPTION, this.toString()), BundleException.RESOLVE_ERROR);
  StringBuffer message = new StringBuffer();
  int errorType = BundleException.RESOLVE_ERROR;
  for (int i = 0; i < errors.length; i++) {
    if ((errors[i].getType() & ResolverError.INVALID_NATIVECODE_PATHS) != 0)
      errorType = BundleException.NATIVECODE_ERROR;
    message.append(errors[i].toString());
    if (i < errors.length - 1)
      message.append(", "); //$NON-NLS-1$
  }
  return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_UNSATISFIED_CONSTRAINT_EXCEPTION, this.toString(), message.toString()), errorType);
}

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

private BundleException getResolverError(BundleDescription bundleDesc) {
  ResolverError[] errors = framework.adaptor.getState().getResolverErrors(bundleDesc);
  if (errors == null || errors.length == 0)
    return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_EXCEPTION, this.toString()), BundleException.RESOLVE_ERROR);
  StringBuffer message = new StringBuffer();
  int errorType = BundleException.RESOLVE_ERROR;
  for (int i = 0; i < errors.length; i++) {
    if ((errors[i].getType() & ResolverError.INVALID_NATIVECODE_PATHS) != 0)
      errorType = BundleException.NATIVECODE_ERROR;
    message.append(errors[i].toString());
    if (i < errors.length - 1)
      message.append(", "); //$NON-NLS-1$
  }
  return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_UNSATISFIED_CONSTRAINT_EXCEPTION, this.toString(), message.toString()), errorType);
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.surefire.osgibooter

private static void getRelevantErrors(State state, Set<ResolverError> errors, BundleDescription bundle) {
  ResolverError[] bundleErrors = state.getResolverErrors(bundle);
  for (int j = 0; j < bundleErrors.length; j++) {
    ResolverError error = bundleErrors[j];
    errors.add(error);
    VersionConstraint constraint = error.getUnsatisfiedConstraint();
    if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
      BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
      for (int i = 0; i < requiredBundles.length; i++) {
        getRelevantErrors(state, errors, requiredBundles[i]);
      }
    }
  }
}

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

private void getRelevantErrors(State state, Set<ResolverError> errors, BundleDescription bundle) {
  ResolverError[] bundleErrors = state.getResolverErrors(bundle);
  for (int j = 0; j < bundleErrors.length; j++) {
    ResolverError error = bundleErrors[j];
    errors.add(error);
    VersionConstraint constraint = error.getUnsatisfiedConstraint();
    if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
      BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
      for (int i = 0; i < requiredBundles.length; i++) {
        // if one of the constraints is the bundle itself (recursive dependency)
        // do not handle that bundle (again). See bug 442594.
        if (bundle.equals(requiredBundles[i])) {
          continue;
        }
        getRelevantErrors(state, errors, requiredBundles[i]);
      }
    }
  }
}

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

private void getRelevantErrors( Set<ResolverError> errors, BundleDescription bundle )
{
  ResolverError[] bundleErrors = state.getResolverErrors( bundle );
  for ( int j = 0; j < bundleErrors.length; j++ )
  {
    ResolverError error = bundleErrors[j];
    errors.add( error );
    VersionConstraint constraint = error.getUnsatisfiedConstraint();
    if ( constraint instanceof BundleSpecification || constraint instanceof HostSpecification )
    {
      BundleDescription[] requiredBundles = state.getBundles( constraint.getName() );
      for ( int i = 0; i < requiredBundles.length; i++ )
      {
        getRelevantErrors( errors, requiredBundles[i] );
      }
    }
  }
}

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

@Override
public synchronized ResolverError[] getErrors() throws CoreException {
  init();
  ApiBaseline baseline = (ApiBaseline) getBaseline();
  if (fBundleDescription == null) {
    baselineDisposed(baseline);
  }
  if (baseline != null) {
    ResolverError[] resolverErrors = baseline.getState().getResolverErrors(fBundleDescription);
    if (resolverErrors.length == 0) {
      return null;
    }
    return resolverErrors;
  }
  return null;
}

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

@Override
public Object[] getChildren(Object parentElement) {
  if (parentElement instanceof BundleDescription) {
    BundleDescription desc = (BundleDescription) parentElement;
    if (desc.isResolved()) {
      Object[] required = getResolvedDependencies(desc.getRequiredBundles());
      Object[] imported = getResolvedDependencies(desc.getImportPackages());
      ArrayList<DependencyGroup> list = new ArrayList<>(2);
      if (required.length > 0)
        list.add(new DependencyGroup(required));
      if (imported.length > 0)
        list.add(new DependencyGroup(imported));
      return list.toArray();
    }
    return desc.getContainingState().getResolverErrors(desc);
  } else if (parentElement instanceof DependencyGroup) {
    return ((DependencyGroup) parentElement).getChildren();
  }
  return new Object[0];
}

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

private void resolveFragment(ResolverBundle fragment) {
  if (!fragment.isFragment())
    return;
  if (fragment.getHost().getNumPossibleSuppliers() > 0)
    if (!developmentMode || state.getResolverErrors(fragment.getBundleDescription()).length == 0)
      setBundleResolved(fragment);
}

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

private void resolveFragment(ResolverBundle fragment) {
  if (!fragment.isFragment())
    return;
  if (fragment.getHost().getNumPossibleSuppliers() > 0)
    if (!developmentMode || state.getResolverErrors(fragment.getBundleDescription()).length == 0)
      setBundleResolved(fragment);
}

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

private void resolveFragment(ResolverBundle fragment) {
  if (!fragment.isFragment())
    return;
  if (fragment.getHost().getNumPossibleSuppliers() > 0)
    if (!developmentMode || state.getResolverErrors(fragment.getBundleDescription()).length == 0)
      setBundleResolved(fragment);
}

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

private void resolveFragment(ResolverBundle fragment) {
  if (!fragment.isFragment())
    return;
  if (fragment.getHost().getNumPossibleSuppliers() > 0)
    if (!developmentMode || state.getResolverErrors(fragment.getBundleDescription()).length == 0)
      setBundleResolved(fragment);
}

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

@Override
public MultiStatus diagnose(long id) {
  PlatformAdmin plaformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
  State state = plaformAdmin.getState(false);
  BundleDescription desc = state.getBundle(id);
  PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
  VersionConstraint[] unsatisfied = platformAdmin.getStateHelper().getUnsatisfiedConstraints(desc);
  ResolverError[] resolverErrors = platformAdmin.getState(false).getResolverErrors(desc);
  MultiStatus problems = new MultiStatus(PDERuntimePlugin.ID, IStatus.INFO, PDERuntimeMessages.RegistryView_found_problems, null);
  for (ResolverError error : resolverErrors) {
    if ((error.getType() & (ResolverError.MISSING_FRAGMENT_HOST | ResolverError.MISSING_GENERIC_CAPABILITY | ResolverError.MISSING_IMPORT_PACKAGE | ResolverError.MISSING_REQUIRE_BUNDLE)) != 0){
      continue;
    }
    IStatus status = new Status(IStatus.WARNING, PDERuntimePlugin.ID, error.toString());
    problems.add(status);
  }
  for (VersionConstraint constraint : unsatisfied) {
    IStatus status = new Status(IStatus.WARNING, PDERuntimePlugin.ID, MessageHelper.getResolutionFailureMessage(constraint));
    problems.add(status);
  }
  return problems;
}

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

private void validateEclipsePlatformFilter() {
  IHeader header = getHeader(ICoreConstants.PLATFORM_FILTER);
  if (header == null)
    return;
  try {
    PDECore.getDefault().getBundleContext().createFilter(header.getValue());
    int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_INCOMPATIBLE_ENV);
    if (severity == CompilerFlags.IGNORE)
      return;
    BundleDescription desc = fModel.getBundleDescription();
    if (desc != null && !desc.isResolved()) {
      ResolverError[] errors = desc.getContainingState().getResolverErrors(desc);
      for (int i = 0; i < errors.length; i++) {
        if (errors[i].getType() == ResolverError.PLATFORM_FILTER) {
          report(PDECoreMessages.BundleErrorReporter_badFilter, header.getLineNumber() + 1, severity, PDEMarkerFactory.CAT_OTHER);
        }
      }
    }
  } catch (InvalidSyntaxException ise) {
    report(PDECoreMessages.BundleErrorReporter_invalidFilterSyntax, header.getLineNumber() + 1, CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL);
  }
}

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

private void validateEclipsePlatformFilter() {
  IHeader header = getHeader(ICoreConstants.PLATFORM_FILTER);
  if (header == null)
    return;
  try {
    PDECore.getDefault().getBundleContext().createFilter(header.getValue());
    int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_INCOMPATIBLE_ENV);
    if (severity == CompilerFlags.IGNORE)
      return;
    BundleDescription desc = fModel.getBundleDescription();        
    if (desc != null && !desc.isResolved()) {
      ResolverError[] errors = desc.getContainingState().getResolverErrors(desc);
      for (int i = 0; i < errors.length; i++) {
        if (errors[i].getType() == ResolverError.PLATFORM_FILTER) {
          report(PDECoreMessages.BundleErrorReporter_badFilter, 
              header.getLineNumber() + 1, severity,
              PDEMarkerFactory.CAT_OTHER);
        }
      }
    }
  } catch (InvalidSyntaxException ise) {
    report(PDECoreMessages.BundleErrorReporter_invalidFilterSyntax, 
        header.getLineNumber() + 1, CompilerFlags.ERROR,
        PDEMarkerFactory.CAT_FATAL);
  }    
}

相关文章