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

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

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

State.getDisabledInfos介绍

[英]Returns an array of disabled info for the specified bundle. If no disabled info exist then an empty array is returned.
[中]返回指定绑定的禁用信息数组。如果不存在禁用的信息,则返回空数组。

代码示例

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

public DisabledInfo[] getDisabledInfos(BundleDescription bundle) {
  return target.getDisabledInfos(bundle);
}

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

public DisabledInfo[] getDisabledInfos(BundleDescription bundle) {
  return target.getDisabledInfos(bundle);
}

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

public DisabledInfo[] getDisabledInfos(BundleDescription bundle) {
  return platformAdmin.getSystemState().getDisabledInfos(bundle);
}

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

public DisabledInfo[] getDisabledInfos(BundleDescription bundle) {
  return platformAdmin.getSystemState().getDisabledInfos(bundle);
}

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

private boolean isDisabled(Bundle bundle) {
  boolean disabled = false;
  ServiceReference<?> platformAdminRef = null;
  try {
    platformAdminRef = context.getServiceReference(PlatformAdmin.class.getName());
    if (platformAdminRef != null) {
      PlatformAdmin platAdmin = (PlatformAdmin) context.getService(platformAdminRef);
      if (platAdmin != null) {
        State state = platAdmin.getState(false);
        BundleDescription bundleDesc = state.getBundle(bundle.getBundleId());
        DisabledInfo[] disabledInfos = state.getDisabledInfos(bundleDesc);
        if ((disabledInfos != null) && (disabledInfos.length != 0)) {
          disabled = true;
        }
      }
    }
  } finally {
    if (platformAdminRef != null)
      context.ungetService(platformAdminRef);
  }
  return disabled;
}

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

private boolean isDisabled(Bundle bundle) {
  boolean disabled = false;
  ServiceReference<?> platformAdminRef = null;
  try {
    platformAdminRef = context.getServiceReference(PlatformAdmin.class.getName());
    if (platformAdminRef != null) {
      PlatformAdmin platAdmin = (PlatformAdmin) context.getService(platformAdminRef);
      if (platAdmin != null) {
        State state = platAdmin.getState(false);
        BundleDescription bundleDesc = state.getBundle(bundle.getBundleId());
        DisabledInfo[] disabledInfos = state.getDisabledInfos(bundleDesc);
        if ((disabledInfos != null) && (disabledInfos.length != 0)) {
          disabled = true;
        }
      }
    }
  } finally {
    if (platformAdminRef != null)
      context.ungetService(platformAdminRef);
  }
  return disabled;
}

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

private boolean isDisabled(Bundle bundle) {
  boolean disabled = false;
  ServiceReference<?> platformAdminRef = null;
  try {
    platformAdminRef = context.getServiceReference(PlatformAdmin.class.getName());
    if (platformAdminRef != null) {
      PlatformAdmin platAdmin = (PlatformAdmin) context.getService(platformAdminRef);
      if (platAdmin != null) {
        State state = platAdmin.getState(false);
        BundleDescription bundleDesc = state.getBundle(bundle.getBundleId());
        DisabledInfo[] disabledInfos = state.getDisabledInfos(bundleDesc);
        if ((disabledInfos != null) && (disabledInfos.length != 0)) {
          disabled = true;
        }
      }
    }
  } finally {
    if (platformAdminRef != null)
      context.ungetService(platformAdminRef);
  }
  return disabled;
}

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

@Descriptor(ConsoleMsg.CONSOLE_HELP_LD_COMMAND_DESCRIPTION)
public void disabledBundles() throws Exception {
  
  PlatformAdmin platformAdmin = activator.getPlatformAdmin();
  if (platformAdmin == null) {
    System.out.println(ConsoleMsg.CONSOLE_CANNOT_LIST_DISABLED_NO_PLATFORM_ADMIN_MESSAGE);
    return;
  }
  State systemState = platformAdmin.getState(false);
  BundleDescription[] disabledBundles = systemState.getDisabledBundles();
  System.out.println(NLS.bind(ConsoleMsg.CONSOLE_DISABLED_COUNT_MESSAGE, String.valueOf(disabledBundles.length)));
  if (disabledBundles.length > 0) {
    System.out.println();
  }
  for (int i = 0; i < disabledBundles.length; i++) {
    DisabledInfo[] disabledInfos = systemState.getDisabledInfos(disabledBundles[i]);
    System.out.println(NLS.bind(ConsoleMsg.CONSOLE_DISABLED_BUNDLE_HEADER, formatBundleName(disabledBundles[i]), String.valueOf(disabledBundles[i].getBundleId())));
    System.out.print(NLS.bind(ConsoleMsg.CONSOLE_DISABLED_BUNDLE_REASON, disabledInfos[0].getMessage(), disabledInfos[0].getPolicyName()));
    for (int j = 1; j < disabledInfos.length; j++) {
      System.out.print(NLS.bind(ConsoleMsg.CONSOLE_DISABLED_BUNDLE_REASON, disabledInfos[j].getMessage(), String.valueOf(disabledInfos[j].getPolicyName())));
    }
    System.out.println();
  }
}

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

private static boolean getIsEnabled(org.osgi.framework.Bundle bundle) {
  PlatformAdmin plaformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
  State state = plaformAdmin.getState(false);
  BundleDescription description = state.getBundle(bundle.getBundleId());
  return (state.getDisabledInfos(description)).length == 0;
}

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

@Descriptor(ConsoleMsg.CONSOLE_HELP_ENABLE_COMMAND_DESCRIPTION)
public void enableBundle(@Descriptor(ConsoleMsg.CONSOLE_HELP_ENABLE_COMMAND_ARGUMENT_DESCRIPTION) long[] bundleIds) throws Exception {
  if (bundleIds.length == 0) {
    System.out.println(ConsoleMsg.CONSOLE_NO_BUNDLE_SPECIFIED_ERROR);
    return;
  }
  
  PlatformAdmin platformAdmin = activator.getPlatformAdmin();
  if (platformAdmin == null) {
    System.out.println(ConsoleMsg.CONSOLE_CANNOT_ENABLE_NO_PLATFORM_ADMIN_MESSAGE);
    return;
  }
  State systemState = platformAdmin.getState(false);
  for (long bundleId : bundleIds) {
    BundleDescription bundle = systemState.getBundle(bundleId);
    if (bundle == null) {
      System.out.println(NLS.bind(ConsoleMsg.CONSOLE_CANNOT_FIND_BUNDLE_ERROR, bundleId));
      continue;
    }
    DisabledInfo[] infos = systemState.getDisabledInfos(bundle);
    for (int i = 0; i < infos.length; i++) {
      platformAdmin.removeDisabledInfo(infos[i]);
    }
  }
}

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

public void _disabledBundles(CommandInterpreter ci) throws Exception {
  try {
    State systemState = getPlatformAdmin(ci).getState(false);
    BundleDescription[] disabledBundles = systemState.getDisabledBundles();
    ci.println(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_COUNT_MESSAGE, String.valueOf(disabledBundles.length)));
    if (disabledBundles.length > 0) {
      ci.println();
    }
    for (int i = 0; i < disabledBundles.length; i++) {
      DisabledInfo[] disabledInfos = systemState.getDisabledInfos(disabledBundles[i]);
      ci.println(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_BUNDLE_HEADER, formatBundleName(disabledBundles[i]), String.valueOf(disabledBundles[i].getBundleId())));
      ci.print(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_BUNDLE_REASON1, disabledInfos[0].getMessage(), disabledInfos[0].getPolicyName()));
      for (int j = 1; j < disabledInfos.length; j++) {
        ci.print(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_BUNDLE_REASON1, disabledInfos[j].getMessage(), String.valueOf(disabledInfos[j].getPolicyName())));
      }
      ci.println();
    }
  } finally {
    ungetPlatformAdmin();
  }
}

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

public void _disabledBundles(CommandInterpreter ci) throws Exception {
  try {
    State systemState = getPlatformAdmin(ci).getState(false);
    BundleDescription[] disabledBundles = systemState.getDisabledBundles();
    ci.println(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_COUNT_MESSAGE, String.valueOf(disabledBundles.length)));
    if (disabledBundles.length > 0) {
      ci.println();
    }
    for (int i = 0; i < disabledBundles.length; i++) {
      DisabledInfo[] disabledInfos = systemState.getDisabledInfos(disabledBundles[i]);
      ci.println(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_BUNDLE_HEADER, formatBundleName(disabledBundles[i]), String.valueOf(disabledBundles[i].getBundleId())));
      ci.print(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_BUNDLE_REASON1, disabledInfos[0].getMessage(), disabledInfos[0].getPolicyName()));
      for (int j = 1; j < disabledInfos.length; j++) {
        ci.print(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_DISABLED_BUNDLE_REASON1, disabledInfos[j].getMessage(), String.valueOf(disabledInfos[j].getPolicyName())));
      }
      ci.println();
    }
  } finally {
    ungetPlatformAdmin();
  }
}

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

DisabledInfo[] disabledInfos = state.getDisabledInfos(bundleDesc);
if (disabledInfos.length > 0) {
  StringBuffer message = new StringBuffer();

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

public void _enableBundle(CommandInterpreter ci) throws Exception {
  String nextArg = ci.nextArgument();
  if (nextArg == null) {
    ci.println(EclipseAdaptorMsg.ECLIPSE_CONSOLE_NO_BUNDLE_SPECIFIED_ERROR);
    return;
  }
  try {
    State systemState = getPlatformAdmin(ci).getState(false);
    while (nextArg != null) {
      BundleDescription bundleDesc = getBundleDescriptionFromToken(systemState, nextArg);
      if (bundleDesc == null) {
        ci.println(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_CANNOT_FIND_BUNDLE_ERROR, nextArg));
        nextArg = ci.nextArgument();
        continue;
      }
      DisabledInfo[] infos = systemState.getDisabledInfos(bundleDesc);
      for (int i = 0; i < infos.length; i++) {
        getPlatformAdmin(ci).removeDisabledInfo(infos[i]);
      }
      nextArg = ci.nextArgument();
    }
  } finally {
    ungetPlatformAdmin();
  }
}

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

public void _enableBundle(CommandInterpreter ci) throws Exception {
  String nextArg = ci.nextArgument();
  if (nextArg == null) {
    ci.println(EclipseAdaptorMsg.ECLIPSE_CONSOLE_NO_BUNDLE_SPECIFIED_ERROR);
    return;
  }
  try {
    State systemState = getPlatformAdmin(ci).getState(false);
    while (nextArg != null) {
      BundleDescription bundleDesc = getBundleDescriptionFromToken(systemState, nextArg);
      if (bundleDesc == null) {
        ci.println(NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONSOLE_CANNOT_FIND_BUNDLE_ERROR, nextArg));
        nextArg = ci.nextArgument();
        continue;
      }
      DisabledInfo[] infos = systemState.getDisabledInfos(bundleDesc);
      for (int i = 0; i < infos.length; i++) {
        getPlatformAdmin(ci).removeDisabledInfo(infos[i]);
      }
      nextArg = ci.nextArgument();
    }
  } finally {
    ungetPlatformAdmin();
  }
}

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

@Override
  public void setEnabled(long id, boolean enabled) {
    State state = PDERuntimePlugin.getDefault().getState();
    BundleDescription desc = state.getBundle(id);

    if (enabled) {
      DisabledInfo[] infos = state.getDisabledInfos(desc);
      for (DisabledInfo info : infos) {
        PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
        platformAdmin.removeDisabledInfo(info);
      }
    } else {
      DisabledInfo info = new DisabledInfo("org.eclipse.pde.ui", "Disabled via PDE", desc); //$NON-NLS-1$ //$NON-NLS-2$
      PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
      platformAdmin.addDisabledInfo(info);
    }

    org.osgi.framework.Bundle b = PDERuntimePlugin.getDefault().getBundleContext().getBundle(id);
    PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin();
    packageAdmin.refreshPackages(new org.osgi.framework.Bundle[] {b});
  }
}

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

public State createState(State original) {
  StateImpl newState = internalCreateState();
  newState.setTimeStamp(original.getTimeStamp());
  BundleDescription[] bundles = original.getBundles();
  for (int i = 0; i < bundles.length; i++) {
    BundleDescription newBundle = createBundleDescription(bundles[i]);
    newState.basicAddBundle(newBundle);
    DisabledInfo[] infos = original.getDisabledInfos(bundles[i]);
    for (int j = 0; j < infos.length; j++)
      newState.addDisabledInfo(new DisabledInfo(infos[j].getPolicyName(), infos[j].getMessage(), newBundle));
  }
  newState.setResolved(false);
  newState.setPlatformProperties(original.getPlatformProperties());
  return newState;
}

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

public State createState(State original) {
  StateImpl newState = internalCreateState();
  newState.setTimeStamp(original.getTimeStamp());
  BundleDescription[] bundles = original.getBundles();
  for (int i = 0; i < bundles.length; i++) {
    BundleDescription newBundle = createBundleDescription(bundles[i]);
    newState.basicAddBundle(newBundle);
    DisabledInfo[] infos = original.getDisabledInfos(bundles[i]);
    for (int j = 0; j < infos.length; j++)
      newState.addDisabledInfo(new DisabledInfo(infos[j].getPolicyName(), infos[j].getMessage(), newBundle));
  }
  newState.setResolved(false);
  newState.setPlatformProperties(original.getPlatformProperties());
  return newState;
}

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

public State createState(State original) {
  StateImpl newState = internalCreateState();
  newState.setTimeStamp(original.getTimeStamp());
  BundleDescription[] bundles = original.getBundles();
  for (int i = 0; i < bundles.length; i++) {
    BundleDescription newBundle = createBundleDescription(bundles[i]);
    newState.basicAddBundle(newBundle);
    DisabledInfo[] infos = original.getDisabledInfos(bundles[i]);
    for (int j = 0; j < infos.length; j++)
      newState.addDisabledInfo(new DisabledInfo(infos[j].getPolicyName(), infos[j].getMessage(), newBundle));
  }
  newState.setResolved(false);
  newState.setPlatformProperties(original.getPlatformProperties());
  return newState;
}

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

public State createState(State original) {
  StateImpl newState = internalCreateState();
  newState.setTimeStamp(original.getTimeStamp());
  BundleDescription[] bundles = original.getBundles();
  for (int i = 0; i < bundles.length; i++) {
    BundleDescription newBundle = createBundleDescription(bundles[i]);
    newState.basicAddBundle(newBundle);
    DisabledInfo[] infos = original.getDisabledInfos(bundles[i]);
    for (int j = 0; j < infos.length; j++)
      newState.addDisabledInfo(new DisabledInfo(infos[j].getPolicyName(), infos[j].getMessage(), newBundle));
  }
  newState.setResolved(false);
  newState.setPlatformProperties(original.getPlatformProperties());
  return newState;
}

相关文章

微信公众号

最新文章

更多