org.osgi.framework.Bundle.getEntryPaths()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(118)

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

Bundle.getEntryPaths介绍

[英]Returns an Enumeration of all the paths ( String objects) to entries within this bundle whose longest sub-path matches the specified path. This bundle's class loader is not used to search for entries. Only the contents of this bundle are searched.

The specified path is always relative to the root of this bundle and may begin with a "/". A path value of "/" indicates the root of this bundle.

Returned paths indicating subdirectory paths end with a "/". The returned paths are all relative to the root of this bundle and must not begin with "/".

Note: Jar and zip files are not required to include directory entries. Paths to directory entries will not be returned if the bundle contents do not contain directory entries.
[中]返回指向此捆绑包中最长子路径与指定路径匹配的项的所有路径(字符串对象)的枚举。此捆绑包的类加载器不用于搜索条目。仅搜索此捆绑包的内容。
指定的路径始终相对于此束的根,并且可以以“/”开头。路径值“/”表示此捆绑包的根。
返回的路径指示子目录路径以“/”结尾。返回的路径都是相对于此捆绑包的根的,不能以“/”开头。
注意:Jar和zip文件不需要包含目录条目。如果捆绑包内容不包含目录项,则不会返回目录项的路径。

代码示例

代码示例来源:origin: org.eclipse.smarthome.automation/org.eclipse.smarthome.automation.providers

/**
 * This method is used to check if the specified {@code Bundle} contains resource files providing automation
 * resources.
 *
 * @param bundle is a {@link Bundle} object to check.
 * @return <tt>true</tt> if the specified {@link Bundle} contains resource files providing automation
 *         resources, <tt>false</tt> otherwise.
 */
private boolean isAnAutomationProvider(Bundle bundle) {
  return bundle.getEntryPaths(AbstractResourceBundleProvider.PATH) != null;
}

代码示例来源:origin: org.coosproject.extender/coos-extender

@Override
  protected Enumeration<URL> findResources(String name) throws IOException {
    return bundle.getEntryPaths(name);
  }
}

代码示例来源:origin: org.apache.xbean/xbean-bundleutils

public Enumeration getEntryPaths(String arg0) {
  return bundle.getEntryPaths(arg0);
}

代码示例来源:origin: org.jboss.osgi/jboss-osgi-spi

@SuppressWarnings("rawtypes")
public Enumeration getEntryPaths(String path)
{
 return bundle.getEntryPaths(path);
}

代码示例来源:origin: openhab/openhab-core

/**
 * This method is used to check if the specified {@code Bundle} contains resource files providing automation
 * resources.
 *
 * @param bundle is a {@link Bundle} object to check.
 * @return <tt>true</tt> if the specified {@link Bundle} contains resource files providing automation
 *         resources, <tt>false</tt> otherwise.
 */
private boolean isAnAutomationProvider(Bundle bundle) {
  return bundle.getEntryPaths(AbstractResourceBundleProvider.ROOT_DIRECTORY) != null;
}

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

public Enumeration<String> getEntryPaths(String path) {
  Bundle current = systemBundle;
  if (current == null)
    return null;
  return current.getEntryPaths(path);
}

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

public Enumeration<String> getEntryPaths(String path) {
  Bundle current = systemBundle;
  if (current == null)
    return null;
  return current.getEntryPaths(path);
}

代码示例来源:origin: apache/felix

public Enumeration<String> getEntryPaths(String path)
{
  return m_bundle.getEntryPaths(path);
}

代码示例来源:origin: org.osgi/osgi.enroute.web.simple.provider

public Bundle addingBundle(Bundle bundle, BundleEvent event) {
    if (bundle.getEntryPaths("static/") != null)
      return bundle;
    return null;
  }
};

代码示例来源:origin: org.apache.felix/org.apache.felix.connect

public Enumeration<String> getEntryPaths(String path)
{
  return m_bundle.getEntryPaths(path);
}

代码示例来源:origin: org.coosproject.extender/coos-extender

private boolean isBundle(Bundle bundle, String context) {
  if (bundle.getHeaders().get(context) != null) {
    return true;
  }
  return bundle.getEntryPaths(DEFAULT_COOS_CONTEXT) != null;
}

代码示例来源:origin: org.apache.clerezza/utils

@Override
public boolean isDirectory() {
  //empty directories are not recognized
  String normalizedPath;
  if (path.charAt(path.length() - 1) != '/') {
    normalizedPath = path + "/";
  } else {
    normalizedPath = path;
  }
  return bundle.getEntryPaths(normalizedPath) != null;
}

代码示例来源:origin: OpenNMS/opennms

private boolean isThemeBundle(Bundle bundle) {
  if ("com.vaadin".equals(bundle.getSymbolicName()))
    return false;
  Enumeration<?> vaadinPaths = bundle.getEntryPaths(org.opennms.vaadin.extender.Constants.VAADIN_PATH);
  if (vaadinPaths == null || !vaadinPaths.hasMoreElements())
    return false;
  return true;
}

代码示例来源:origin: org.opennms.features.vaadin-components/extender-service

private boolean isThemeBundle(Bundle bundle) {
  if ("com.vaadin".equals(bundle.getSymbolicName()))
    return false;
  Enumeration<?> vaadinPaths = bundle.getEntryPaths(org.opennms.vaadin.extender.Constants.VAADIN_PATH);
  if (vaadinPaths == null || !vaadinPaths.hasMoreElements())
    return false;
  return true;
}

代码示例来源:origin: org.apache.clerezza/utils

@Override
public String[] list() {
  List<String> resultList = new ArrayList<String>();
  Enumeration<String> absPathEnum = bundle.getEntryPaths(path);
  if (absPathEnum != null) {
    final int pathLength = path.length();
    while (absPathEnum.hasMoreElements()) {
      String absPath = absPathEnum.nextElement();
      resultList.add(absPath.substring(pathLength));
    }
  }
  return resultList.toArray(new String[resultList.size()]);
}

代码示例来源:origin: com.github.ddth/ddth-commons-core

private void extractContentDir(String pathPrefix, String path, File rootDir) throws IOException {
  File dir = new File(rootDir, path.substring(pathPrefix.length()));
  FileUtils.forceMkdir(dir);
  Enumeration<String> entryPaths = bundle.getEntryPaths(path);
  if (entryPaths != null) {
    while (entryPaths.hasMoreElements()) {
      extractContent(pathPrefix, entryPaths.nextElement(), bundleExtractDir);
    }
  }
}

代码示例来源:origin: org.opennms.container/org.opennms.container.bridge

@Override
public Set<String> getResourcePaths(String path)
{
  Enumeration<?> paths = this.bundle.getEntryPaths(normalizePath(path));
  if ((paths == null) || !paths.hasMoreElements()) {
    return null;
  }
  Set<String> set = new HashSet<>();
  while (paths.hasMoreElements()) {
    set.add((String) paths.nextElement());
  }
  return set;
}

代码示例来源:origin: OpenNMS/opennms

@Override
public Set<String> getResourcePaths(String path)
{
  Enumeration<?> paths = this.bundle.getEntryPaths(normalizePath(path));
  if ((paths == null) || !paths.hasMoreElements()) {
    return null;
  }
  Set<String> set = new HashSet<>();
  while (paths.hasMoreElements()) {
    set.add((String) paths.nextElement());
  }
  return set;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-test-ddbean

protected AbstractDeployable(ModuleType type, Bundle bundle, String rootDD) throws DDBeanCreateException {
  this.type = type;
  this.bundle = bundle;
  URL dd = bundle.getResource(rootDD);
  root = new DDBeanRootImpl(this, dd);
  entries = new ArrayList<String>();
  Enumeration<String> paths = bundle.getEntryPaths("/");
  //TODO WTF?? if statement seems to be required????
  while (paths.hasMoreElements()) {
    String entry = paths.nextElement();
    entries.add(entry);
  }
}

代码示例来源:origin: org.daisy.pipeline.modules.braille/common-java

public Collection<String> apply(String path) {
    Pair<Collection<String>,Collection<String>> entries = partition(
      Iterators.<String>forEnumeration(bundle.getEntryPaths(path)),
      new Predicate<String>() { public boolean apply(String s) { return s.endsWith("/"); }});
    Collection<String> files = new ArrayList<String>();
    files.addAll(entries._2);
    for (String folder : entries._1) files.addAll(apply(folder));
    return files; }};
resources = new ImmutableList.Builder<URI>()

相关文章