Package org.osgi.service.indexer

Examples of org.osgi.service.indexer.Capability


            }

            // Use an analyzer to add a marker capability to workspace resources
            indexer.addAnalyzer(new ResourceAnalyzer() {
                public void analyzeResource(Resource resource, List<Capability> capabilities, List<Requirement> requirements) throws Exception {
                    Capability cap = new Builder().setNamespace("bndtools.workspace").addAttribute("bndtools.workspace", workspaceRootUri.toString()).addAttribute("project.path", project.getFullPath().toString()).buildCapability();
                    capabilities.add(cap);
                }
            }, null);

            Map<String,String> config = new HashMap<String,String>();
View Full Code Here


            }

            // Use an analyzer to add a marker capability to workspace resources
            indexer.addAnalyzer(new ResourceAnalyzer() {
                public void analyzeResource(Resource resource, List<Capability> capabilities, List<Requirement> requirements) throws Exception {
                    Capability cap = new Builder().setNamespace("bndtools.workspace").addAttribute("bndtools.workspace", workspaceRootUri.toString()).addAttribute("project.path", project.getFullPath().toString()).buildCapability();
                    capabilities.add(cap);
                }
            }, null);

            Map<String,String> config = new HashMap<String,String>();
View Full Code Here

    a.analyzeResource(new JarResource(new File("testdata/01-bsn+version.jar")), caps, reqs);

    assertEquals(4, caps.size());

    Capability idcap = caps.get(0);
    assertEquals("osgi.identity", idcap.getNamespace());
    assertEquals("org.example.a", idcap.getAttributes().get("osgi.identity"));
    assertEquals("osgi.bundle", idcap.getAttributes().get("type"));
    assertEquals(new Version("0.0.0"), idcap.getAttributes().get("version"));

    Capability content = caps.get(1);
    assertEquals("osgi.content", content.getNamespace());
    assertEquals("64f661eea43334dc5d38d7f16dbcacd02c799e68332b40e72da8021828e3329c", content.getAttributes().get("osgi.content"));
    assertEquals("testdata/01-bsn+version.jar", content.getAttributes().get("url"));
    assertEquals("application/vnd.osgi.bundle", content.getAttributes().get("mime"));
    assertEquals(1104L, content.getAttributes().get("size"));
  }
View Full Code Here

    LinkedList<Capability> caps = new LinkedList<Capability>();
    LinkedList<Requirement> reqs = new LinkedList<Requirement>();

    a.analyzeResource(new JarResource(new File("testdata/03-export.jar")), caps, reqs);

    Capability export = findCaps("osgi.wiring.package", caps).get(0);
    assertEquals("org.example.a", export.getAttributes().get("osgi.wiring.package"));
    assertEquals(new Version(1, 0, 0), export.getAttributes().get("version"));
  }
View Full Code Here

    new OSGiFrameworkAnalyzer(new NullLogSvc()).analyzeResource(input, caps, reqs);

    List<Capability> fwkCaps = findCaps("osgi.contract", caps);
    assertNotNull(fwkCaps);
    assertEquals(1, fwkCaps.size());
    Capability fwkCap = fwkCaps.get(0);

    assertEquals("OSGiFramework", fwkCap.getAttributes().get("osgi.contract"));
    assertEquals(new Version("4.3.0"), fwkCap.getAttributes().get("version"));
    assertEquals(
        "org.osgi.framework.startlevel,org.osgi.framework.wiring,org.osgi.framework.hooks.bundle,org.osgi.framework.hooks.service,org.osgi.framework.hooks.resolver,org.osgi.framework.launch,org.osgi.framework,org.osgi.framework.hooks.weaving,org.osgi.service.packageadmin,org.osgi.service.url,org.osgi.service.startlevel,org.osgi.util.tracker",
        fwkCap.getDirectives().get("uses"));
  }
View Full Code Here

TOP

Related Classes of org.osgi.service.indexer.Capability

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.