org.eclipse.equinox.internal.frameworkadmin.utils.Utils.getPathFromClause()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(85)

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

Utils.getPathFromClause介绍

暂无

代码示例

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.simpleconfigurator.manipulator

private static boolean isTargetConfiguratorBundle(URI location) {
  final String symbolic = Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME));
  return (SimpleConfiguratorManipulator.SERVICE_PROP_VALUE_CONFIGURATOR_SYMBOLICNAME.equals(symbolic));
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.simpleconfigurator.manipulator

private static boolean isTargetConfiguratorBundle(URI location) {
  final String symbolic = Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME));
  return (SimpleConfiguratorManipulator.SERVICE_PROP_VALUE_CONFIGURATOR_SYMBOLICNAME.equals(symbolic));
}

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

private static boolean isTargetConfiguratorBundle(URI location) {
  final String symbolic = Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME));
  return (SimpleConfiguratorManipulator.SERVICE_PROP_VALUE_CONFIGURATOR_SYMBOLICNAME.equals(symbolic));
}

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

public static File isSystemBundle(BundleInfo bundleInfo) {
  if (bundleInfo == null || bundleInfo.getLocation() == null)
    return null;
  URI bundleLocation = bundleInfo.getLocation();
  try {
    String[] clauses = Utils.getClausesManifestMainAttributes(bundleLocation, Constants.BUNDLE_SYMBOLICNAME);
    if (bundleLocation.getPath().indexOf(EquinoxConstants.FW_SYMBOLIC_NAME) > 0)
      if (EquinoxConstants.PERSISTENT_DIR_NAME.equals(Utils.getPathFromClause(clauses[0])))
        return new File(bundleLocation);
  } catch (RuntimeException e) {
    e.printStackTrace();
  }
  return null;
}

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

public static File isSystemBundle(BundleInfo bundleInfo) {
  if (bundleInfo == null || bundleInfo.getLocation() == null)
    return null;
  URI bundleLocation = bundleInfo.getLocation();
  try {
    String[] clauses = Utils.getClausesManifestMainAttributes(bundleLocation, Constants.BUNDLE_SYMBOLICNAME);
    if (bundleLocation.getPath().indexOf(EquinoxConstants.FW_SYMBOLIC_NAME) > 0)
      if (EquinoxConstants.PERSISTENT_DIR_NAME.equals(Utils.getPathFromClause(clauses[0])))
        return new File(bundleLocation);
  } catch (RuntimeException e) {
    e.printStackTrace();
  }
  return null;
}

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

@Override
public BundleInfo getSystemBundle() {
  if (this.systemBundleSymbolicName == null) {
    for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
      BundleInfo bInfo = ite.next();
      //			if (bInfo.getStartLevel() != 1)
      //				return null;;
      URI location = bInfo.getLocation();
      String bundleName = Utils.getManifestMainAttributes(location, Constants.BUNDLE_NAME);
      if (systemBundleName.equals(bundleName)) {
        String bundleVendor = Utils.getManifestMainAttributes(location, Constants.BUNDLE_VENDOR);
        if (systemBundleVendor.equals(bundleVendor))
          return bInfo;
      }
    }
    return null;
  }
  for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
    BundleInfo bInfo = ite.next();
    URI location = bInfo.getLocation();
    String symbolicName = Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME);
    symbolicName = Utils.getPathFromClause(symbolicName);
    if (this.systemBundleSymbolicName.equals(symbolicName))
      return bInfo;
  }
  return null;
}

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

public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) {
  URI location = bInfo.getLocation();
  final String requiredBundles = Utils.getManifestMainAttributes(location, Constants.REQUIRE_BUNDLE);
  if (requiredBundles == null)
    return new BundleInfo[] {this.getSystemBundle()};
  String[] clauses = Utils.getClauses(requiredBundles);
  List list = new LinkedList();
  for (int i = 0; i < clauses.length; i++)
    list.add(Utils.getPathFromClause(clauses[i]));
  List ret = new LinkedList();
  ret.add(this.getSystemBundle());
  for (Iterator ite = this.bundleInfosList.iterator(); ite.hasNext();) {
    BundleInfo currentBInfo = (BundleInfo) ite.next();
    URI currentLocation = currentBInfo.getLocation();
    String currentSymbolicName = Utils.getManifestMainAttributes(currentLocation, Constants.BUNDLE_SYMBOLICNAME);
    if (currentSymbolicName == null)
      continue;
    currentSymbolicName = Utils.getPathFromClause(currentSymbolicName);
    for (Iterator ite2 = list.iterator(); ite2.hasNext();) {
      String symbolicName = (String) ite2.next();
      if (symbolicName.equals(currentSymbolicName)) {
        ret.add(currentBInfo);
        break;
      }
    }
  }
  return Utils.getBundleInfosFromList(ret);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.frameworkadmin

public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) {
  URI location = bInfo.getLocation();
  final String requiredBundles = Utils.getManifestMainAttributes(location, Constants.REQUIRE_BUNDLE);
  if (requiredBundles == null)
    return new BundleInfo[] {this.getSystemBundle()};
  String[] clauses = Utils.getClauses(requiredBundles);
  List<String> list = new LinkedList<String>();
  for (int i = 0; i < clauses.length; i++)
    list.add(Utils.getPathFromClause(clauses[i]));
  List<BundleInfo> ret = new LinkedList<BundleInfo>();
  ret.add(this.getSystemBundle());
  for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
    BundleInfo currentBInfo = ite.next();
    URI currentLocation = currentBInfo.getLocation();
    String currentSymbolicName = Utils.getManifestMainAttributes(currentLocation, Constants.BUNDLE_SYMBOLICNAME);
    if (currentSymbolicName == null)
      continue;
    currentSymbolicName = Utils.getPathFromClause(currentSymbolicName);
    for (Iterator<String> ite2 = list.iterator(); ite2.hasNext();) {
      String symbolicName = ite2.next();
      if (symbolicName.equals(currentSymbolicName)) {
        ret.add(currentBInfo);
        break;
      }
    }
  }
  return Utils.getBundleInfosFromList(ret);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.frameworkadmin

public BundleInfo getSystemBundle() {
  if (this.systemBundleSymbolicName == null) {
    for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
      BundleInfo bInfo = ite.next();
      //			if (bInfo.getStartLevel() != 1)
      //				return null;;
      URI location = bInfo.getLocation();
      String bundleName = Utils.getManifestMainAttributes(location, Constants.BUNDLE_NAME);
      if (systemBundleName.equals(bundleName)) {
        String bundleVendor = Utils.getManifestMainAttributes(location, Constants.BUNDLE_VENDOR);
        if (systemBundleVendor.equals(bundleVendor))
          return bInfo;
      }
    }
    return null;
  }
  for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
    BundleInfo bInfo = ite.next();
    URI location = bInfo.getLocation();
    String symbolicName = Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME);
    symbolicName = Utils.getPathFromClause(symbolicName);
    if (this.systemBundleSymbolicName.equals(symbolicName))
      return bInfo;
  }
  return null;
}

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

public BundleInfo getSystemBundle() {
  if (this.systemBundleSymbolicName == null) {
    for (Iterator ite = this.bundleInfosList.iterator(); ite.hasNext();) {
      BundleInfo bInfo = (BundleInfo) ite.next();
      //			if (bInfo.getStartLevel() != 1)
      //				return null;;
      URI location = bInfo.getLocation();
      String bundleName = Utils.getManifestMainAttributes(location, Constants.BUNDLE_NAME);
      if (systemBundleName.equals(bundleName)) {
        String bundleVendor = Utils.getManifestMainAttributes(location, Constants.BUNDLE_VENDOR);
        if (systemBundleVendor.equals(bundleVendor))
          return bInfo;
      }
    }
    return null;
  }
  for (Iterator ite = this.bundleInfosList.iterator(); ite.hasNext();) {
    BundleInfo bInfo = (BundleInfo) ite.next();
    URI location = bInfo.getLocation();
    String symbolicName = Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME);
    symbolicName = Utils.getPathFromClause(symbolicName);
    if (this.systemBundleSymbolicName.equals(symbolicName))
      return bInfo;
  }
  return null;
}

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

@Override
public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) {
  URI location = bInfo.getLocation();
  final String requiredBundles = Utils.getManifestMainAttributes(location, Constants.REQUIRE_BUNDLE);
  if (requiredBundles == null)
    return new BundleInfo[] {this.getSystemBundle()};
  String[] clauses = Utils.getClauses(requiredBundles);
  List<String> list = new LinkedList<>();
  for (int i = 0; i < clauses.length; i++)
    list.add(Utils.getPathFromClause(clauses[i]));
  List<BundleInfo> ret = new LinkedList<>();
  ret.add(this.getSystemBundle());
  for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
    BundleInfo currentBInfo = ite.next();
    URI currentLocation = currentBInfo.getLocation();
    String currentSymbolicName = Utils.getManifestMainAttributes(currentLocation, Constants.BUNDLE_SYMBOLICNAME);
    if (currentSymbolicName == null)
      continue;
    currentSymbolicName = Utils.getPathFromClause(currentSymbolicName);
    for (Iterator<String> ite2 = list.iterator(); ite2.hasNext();) {
      String symbolicName = ite2.next();
      if (symbolicName.equals(currentSymbolicName)) {
        ret.add(currentBInfo);
        break;
      }
    }
  }
  return Utils.getBundleInfosFromList(ret);
}

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

private BundleInfo convertSystemBundle(BundleDescription toConvert) {
  // Converting the System Bundle
  boolean markedAsStarted = false;
  int sl = BundleInfo.NO_LEVEL;
  URI location = null;
  String symbolicNameTarget = toConvert.getSymbolicName();
  Version versionTarget = toConvert.getVersion();
  try {
    File fwJar = manipulator.getLauncherData().getFwJar();
    if (fwJar != null) {
      URI fwJarLocation = fwJar.toURI();
      String[] clauses = Utils.getClausesManifestMainAttributes(fwJarLocation, Constants.BUNDLE_SYMBOLICNAME);
      String fwJarSymbolicName = Utils.getPathFromClause(clauses[0]);
      String fwJarVersionSt = Utils.getManifestMainAttributes(fwJarLocation, Constants.BUNDLE_VERSION);
      if (fwJarSymbolicName.equals(symbolicNameTarget) && fwJarVersionSt.equals(versionTarget.toString())) {
        location = fwJarLocation;
        markedAsStarted = true;
      }
    }
  } catch (FrameworkAdminRuntimeException e1) {
    Log.log(LogService.LOG_ERROR, "", e1); //$NON-NLS-1$
  }
  return createBundleInfo(toConvert, markedAsStarted, sl, location, null);
}

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

private BundleInfo convertSystemBundle(BundleDescription toConvert) {
  // Converting the System Bundle
  boolean markedAsStarted = false;
  int sl = BundleInfo.NO_LEVEL;
  URI location = null;
  String symbolicNameTarget = toConvert.getSymbolicName();
  Version versionTarget = toConvert.getVersion();
  try {
    File fwJar = manipulator.getLauncherData().getFwJar();
    if (fwJar != null) {
      URI fwJarLocation = fwJar.toURI();
      String[] clauses = Utils.getClausesManifestMainAttributes(fwJarLocation, Constants.BUNDLE_SYMBOLICNAME);
      String fwJarSymbolicName = Utils.getPathFromClause(clauses[0]);
      String fwJarVersionSt = Utils.getManifestMainAttributes(fwJarLocation, Constants.BUNDLE_VERSION);
      if (fwJarSymbolicName.equals(symbolicNameTarget) && fwJarVersionSt.equals(versionTarget.toString())) {
        location = fwJarLocation;
        markedAsStarted = true;
      }
    }
  } catch (FrameworkAdminRuntimeException e1) {
    Log.log(LogService.LOG_ERROR, "", e1); //$NON-NLS-1$
  }
  return createBundleInfo(toConvert, markedAsStarted, sl, location, null);
}

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

continue;
for (int j = 0; j < references.length; j++)
  if (references[j].getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME).equals(Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME)))) {
    configuratorManipulator = (ConfiguratorManipulator) cmTracker.getService(references[j]);
    break;

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

continue;
for (int j = 0; j < references.length; j++)
  if (references[j].getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME).equals(Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME)))) {
    configuratorManipulator = (ConfiguratorManipulator) cmTracker.getService(references[j]);
    break;

相关文章