Package org.osgi.framework.wiring

Examples of org.osgi.framework.wiring.BundleRevision


        if (resource instanceof BundleConstituent) {
          BundleConstituent bc = (BundleConstituent)resource;
          wirings.put(bc.getBundle().adapt(BundleRevision.class), bc.getWiring());
        }
        else if (resource instanceof BundleRevision) {
          BundleRevision br = (BundleRevision)resource;
          wirings.put(br, br.getWiring());
        }
      }
     
      @Override
      public List<Capability> findProviders(Requirement requirement) {
View Full Code Here


  public BundleResourceInstaller(Coordination coordination, Resource resource, BasicSubsystem subsystem) {
    super(coordination, resource, subsystem);
  }
 
  public Resource install() {
    BundleRevision revision;
    if (resource instanceof BundleRevision)
      revision = (BundleRevision)resource;
    else {
      ThreadLocalSubsystem.set(provisionTo);
      revision = installBundle();
View Full Code Here

                List<FilterAttributeType> attributeTypes = packageType.getAttribute();
                buildFilter(packageName, version, namespace, attributeTypes, builder);
            }
            if (to == kernel) {
                //add framework exports
                BundleRevision rev = framework.adapt(BundleRevision.class);
                List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
                for (BundleCapability cap : caps) {
                    String filter = ManifestHeaderProcessor.generateFilter(filter(cap.getAttributes()));
                    builder.allow(BundleRevision.PACKAGE_NAMESPACE, filter);
                }
            }
View Full Code Here

  private SortedMap<String, PackageVersion> getDuplicatePackages(
      Bundle[] bundles) {
    SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<String, PackageVersion>();
        for (Bundle bundle : bundles) {
            BundleRevision rev = bundle.adapt(BundleRevision.class);
            if (rev!=null) {
                List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
                for (BundleCapability cap : caps) {
                    Map<String, Object> attr = cap.getAttributes();
                    String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
                    Version version = (Version)attr.get("version");
                    String key = packageName + ":" + version.toString();
View Full Code Here

    public SortedMap<String, PackageVersion> getExports() {
        Bundle[] bundles = bundleContext.getBundles();
        SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<String, PackageVersion>();
        for (Bundle bundle : bundles) {
            BundleRevision rev = bundle.adapt(BundleRevision.class);
            if (rev != null) {
                List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
                for (BundleCapability cap : caps) {
                    Map<String, Object> attr = cap.getAttributes();
                    String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
                    Version version = (Version)attr.get("version");
                    String key = packageName + ":" + version.toString();
View Full Code Here

    @Override
    public SortedMap<String, PackageRequirement> getImports() {
        Bundle[] bundles = bundleContext.getBundles();
        SortedMap<String, PackageRequirement> filterMap = new TreeMap<String, PackageRequirement>();
        for (Bundle bundle : bundles) {
            BundleRevision rev = bundle.adapt(BundleRevision.class);
            if (rev != null) {
                List<BundleRequirement> reqs = rev.getDeclaredRequirements(BundleRevision.PACKAGE_NAMESPACE);
                for (BundleRequirement req : reqs) {
                    Map<String, String> attr = req.getDirectives();
                    String filter = attr.get("filter");
                    String resolution = attr.get("resolution");
                    boolean optional = "optional".equals(resolution);
View Full Code Here

    }

    private boolean checkResolveAble(BundleRequirement req) {
        Bundle[] bundles = bundleContext.getBundles();
        for (Bundle bundle : bundles) {
            BundleRevision rev = bundle.adapt(BundleRevision.class);
            if (rev != null) {
                List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
                for (BundleCapability cap : caps) {
                    if (req.matches(cap)) {
                        return true;
                    }
                }
View Full Code Here

    }

  @Override
  public List<String> getExports(long bundleId) {
    Bundle bundle = bundleContext.getBundle(bundleId);
        BundleRevision rev = bundle.adapt(BundleRevision.class);
        List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
        List<String> exports = new ArrayList<String>();
        for (BundleCapability cap : caps) {
            Map<String, Object> attr = cap.getAttributes();
            String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
            exports.add(packageName);
View Full Code Here

  }

  @Override
  public List<String> getImports(long bundleId) {
    Bundle bundle = bundleContext.getBundle(bundleId);
        BundleRevision rev = bundle.adapt(BundleRevision.class);
        List<BundleRequirement> reqs = rev.getDeclaredRequirements(BundleRevision.PACKAGE_NAMESPACE);
        List<String> imports = new ArrayList<String>();
        for (BundleRequirement req : reqs) {
            Map<String, String> attr = req.getDirectives();
            String filter = attr.get("filter");
            String name = PackageRequirement.getPackageName(filter);
View Full Code Here

        bundles.removeAll(toRefresh);
        if (bundles.isEmpty()) {
            return;
        }
        for (Bundle bundle : new ArrayList<Bundle>(toRefresh)) {
            BundleRevision rev = bundle.adapt(BundleRevision.class);
            if (rev != null) {
                for (BundleRequirement req : rev.getDeclaredRequirements(null)) {
                    if (BundleRevision.HOST_NAMESPACE.equals(req.getNamespace())) {
                        for (Bundle hostBundle : bundles) {
                            if (!toRefresh.contains(hostBundle)) {
                                BundleRevision hostRev = hostBundle.adapt(BundleRevision.class);
                                if (hostRev != null) {
                                    for (BundleCapability cap : hostRev.getDeclaredCapabilities(null)) {
                                        if (req.matches(cap)) {
                                            toRefresh.add(hostBundle);
                                        }
                                    }
                                }
View Full Code Here

TOP

Related Classes of org.osgi.framework.wiring.BundleRevision

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.