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

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

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

Bundle.getLocation介绍

[英]Returns this bundle's location identifier.

The location identifier is the location passed to BundleContext.installBundle when a bundle is installed. The location identifier does not change while this bundle remains installed, even if this bundle is updated.

This method must continue to return this bundle's location identifier while this bundle is in the UNINSTALLED state.
[中]返回此捆绑包的位置标识符。
位置标识符是传递给BundleContext的位置。安装捆绑包时安装捆绑包。此捆绑包保持安装状态时,位置标识符不会更改,即使此捆绑包已更新。
此捆绑包处于卸载状态时,此方法必须继续返回此捆绑包的位置标识符。

代码示例

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

public String run() {
    return bundle.getLocation();
  }
});

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

public Void run() {
    props.put("id", new Long(bundle.getBundleId()));
    props.put("location", bundle.getLocation());
    String name = bundle.getSymbolicName();
    if (name != null) {
      props.put("name", name);
    }
    SignerProperty signer = new SignerProperty(bundle);
    if (signer.isBundleSigned()) {
      props.put("signer", signer);
    }
    return null;
  }
});

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

public Void run() {
    props.put("id", new Long(bundle.getBundleId()));
    props.put("location", bundle.getLocation());
    String name = bundle.getSymbolicName();
    if (name != null) {
      props.put("name", name);
    }
    SignerProperty signer = new SignerProperty(bundle);
    if (signer.isBundleSigned()) {
      props.put("signer", signer);
    }
    return null;
  }
});

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

public Void run() {
    map.put("id", new Long(bundle.getBundleId()));
    map.put("location", bundle.getLocation());
    String name = bundle.getSymbolicName();
    if (name != null) {
      map.put("name", name);
    }
    SignerProperty signer = new SignerProperty(bundle);
    if (signer.isBundleSigned()) {
      map.put("signer", signer);
    }
    return null;
  }
});

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

public Void run() {
    map.put("id", new Long(bundle.getBundleId()));
    map.put("location", bundle.getLocation());
    String name = bundle.getSymbolicName();
    if (name != null) {
      map.put("name", name);
    }
    SignerProperty signer = new SignerProperty(bundle);
    if (signer.isBundleSigned()) {
      map.put("signer", signer);
    }
    return null;
  }
});

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

public Void run() {
    map.put("id", new Long(bundle.getBundleId()));
    map.put("location", bundle.getLocation());
    String name = bundle.getSymbolicName();
    if (name != null) {
      map.put("name", name);
    }
    SignerProperty signer = new SignerProperty(bundle);
    if (signer.isBundleSigned()) {
      map.put("signer", signer);
    }
    return null;
  }
});

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

public Object run() {
    map.put("id", new Long(bundle.getBundleId()));
    map.put("location", bundle.getLocation());
    String name = bundle.getSymbolicName();
    if (name != null) {
      map.put("name", name);
    }
    SignerProperty signer = new SignerProperty(bundle);
    if (signer.isBundleSigned()) {
      map.put("signer", signer);
    }
    return null;
  }
});

代码示例来源:origin: spring-projects/spring-roo

for (int i = 0; i < bundles.length; i++)
  installedBundleMap.put(bundles[i].getLocation(), bundles[i]);

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

@Override
  public String run()
  {
    return bundle.getLocation();
  }
});

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

@Override
  public String run() {
    return bundle.getLocation();
  }
});

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

private static Bundle getBundleByLocation(String location, Bundle[] bundles) {
  for (int i = 0; i < bundles.length; i++) {
    Bundle bundle = bundles[i];
    if (location.equalsIgnoreCase(bundle.getLocation()))
      return bundle;
  }
  return null;
}

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

private static Bundle getBundleByLocation(String location, Bundle[] bundles) {
  for (int i = 0; i < bundles.length; i++) {
    Bundle bundle = bundles[i];
    if (location.equalsIgnoreCase(bundle.getLocation()))
      return bundle;
  }
  return null;
}

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

private static Bundle getBundleByLocation(String location, Bundle[] bundles) {
  for (int i = 0; i < bundles.length; i++) {
    Bundle bundle = bundles[i];
    if (location.equalsIgnoreCase(bundle.getLocation()))
      return bundle;
  }
  return null;
}

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

public String getLocation(final Bundle bundle) {
    if (System.getSecurityManager() == null) {
      return bundle.getLocation();
    }
    return AccessController.doPrivileged(new PrivilegedAction<String>() {
      public String run() {
        return bundle.getLocation();
      }
    }, controlContext);
  }
}

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

public Bundle getBundle(String location)
  {
    for (Bundle bundle : m_bundles.values())
    {
      if (location.equals(bundle.getLocation()))
      {
        return bundle;
      }
    }
    return null;
  }
}

代码示例来源:origin: jawi/ols

private Map<String, Bundle> getInstalledBundles( final BundleContext context )
{
 Map<String, Bundle> installed = new HashMap<String, Bundle>();
 for ( Bundle bundle : context.getBundles() )
 {
  installed.put( bundle.getLocation(), bundle );
 }
 return installed;
}

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

private List<Bundle> getBundlesByLocation(String url) {
  Bundle[] bundles = bundleContext.getBundles();
  ArrayList<Bundle> result = new ArrayList<>();
  Pattern locationPattern = Pattern.compile(url);
  for (Bundle bundle : bundles) {
    Matcher locationMatcher = locationPattern.matcher(bundle.getLocation());
    if (locationMatcher.matches()) {
      result.add(bundle);
    }
  }
  return result;
}

代码示例来源:origin: protegeproject/protege

private static Optional<File> getPluginFileName(PluginInfo info) {
    Bundle pluginDescriptor = info.getPluginDescriptor();
    if (pluginDescriptor == null) {
      return Optional.empty();
    }
    final String locationURL = pluginDescriptor.getLocation();
    File existingPluginLocation = new File(locationURL.substring(locationURL.indexOf(":") + 1, locationURL.length()));
    return Optional.of(existingPluginLocation);
  }
//

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

private static void startBundle(Bundle bundle, int options) {
  try {
    bundle.start(options);
  } catch (BundleException e) {
    if ((bundle.getState() & Bundle.RESOLVED) != 0) {
      // only log errors if the bundle is resolved
      FrameworkLogEntry entry = new FrameworkLogEntry(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, 0, NLS.bind(Msg.ECLIPSE_STARTUP_FAILED_START, bundle.getLocation()), 0, e, null);
      log.log(entry);
    }
  }
}

代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module

public Set<Class<?>> scan(String... basePackages) {
  final File bundleFile = getBundleFile(bundle);
  if (!bundleFile.isFile() || !bundleFile.exists()) {
    throw new RuntimeException("Could not identify Bundle at location <" + bundle.getLocation() + ">");
  }
  return indexJar(bundleFile, preparePackages(basePackages));
}

相关文章