Package aQute.bnd.osgi

Examples of aQute.bnd.osgi.Resource


        Map<String, String> props = new HashMap<String, String>();
        props.put("include-embed-bundles", "true");
        String path = EmptyComponent.class.getName().replace('.', '/').concat(".class");

        Resource resource2 = new URLResource(getClass().getResource("/metadata-test-component.xml"));
        doReturn(dot).when(analyzer).getJar();
        doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml"));

        Collection<Clazz> classes = new ArrayList<Clazz>();
        Resource typeResource = new URLResource(getClass().getResource("EmptyComponent.class"));
        Clazz clazz = new Clazz(analyzer, path, typeResource);
        clazz.parseClassFile();
        classes.add(clazz);
        doReturn(classes).when(analyzer).getClasses(Matchers.<String[]>anyVararg());

        Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST-EMPTY.MF"));
        doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
        doReturn(typeResource).when(embed).getResource(path);
        doReturn("aaa").when(embed).getBsn();

        analyzer.setClasspath(new Jar[] {embed});
View Full Code Here


            FileMetadataProvider fmp = new FileMetadataProvider(file, reporter);
            fmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
            provider.addMetadataProvider(fmp);
        } else {
            // In archive resource
            Resource resource = analyzer.getJar().getResource(m_metadata);
            if (resource != null) {
                ResourceMetadataProvider rmp = new ResourceMetadataProvider(resource, reporter);
                rmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
                provider.addMetadataProvider(rmp);
            }
View Full Code Here

    public void testAnalysisWithComponentOnlyMetadataXml() throws Exception {
        PojoizationPlugin plugin = new PojoizationPlugin();

        Map<String, String> props = new HashMap<String, String>();

        Resource resource = new URLResource(getClass().getResource("/metadata-components-only.xml"));
        doReturn(jar).when(analyzer).getJar();
        doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));

        plugin.setReporter(reporter);
        plugin.setProperties(props);
View Full Code Here

    public void testAnalysisWithInstanceOnlyMetadataXml() throws Exception {
        PojoizationPlugin plugin = new PojoizationPlugin();

        Map<String, String> props = new HashMap<String, String>();

        Resource resource = new URLResource(getClass().getResource("/metadata-instances-only.xml"));
        doReturn(jar).when(analyzer).getJar();
        doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));

        plugin.setReporter(reporter);
        plugin.setProperties(props);
View Full Code Here

    public void testAnalysisWithComponentsAndInstancesMetadataXml() throws Exception {
        PojoizationPlugin plugin = new PojoizationPlugin();

        Map<String, String> props = new HashMap<String, String>();

        Resource resource = new URLResource(getClass().getResource("/metadata-components-and-instances.xml"));
        doReturn(jar).when(analyzer).getJar();
        doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));

        plugin.setReporter(reporter);
        plugin.setProperties(props);
View Full Code Here

    }

    public byte[] read(String path) throws IOException {

        // Find the resource either in the global jar or in one of the embed dependencies
        Resource resource = m_analyzer.getJar().getResource(path);
        if (resource == null) {
            Jar embed = findJar(path);
            if (embed == null) {
                throw new IOException(format("Cannot find resource %s in jar and classpath", path));
            }
            resource = embed.getResource(path);
        }
        InputStream is = null;
        try {
            is = resource.openInputStream();
        } catch (Exception e) {
            throw new IOException("Cannot read " + path);
        }
        return Streams.readBytes(is);
    }
View Full Code Here

        {
            Jar jar = analyzer.getJar();
            Map<String, Resource> dir = jar.getDirectories().get( root );
            if ( dir == null || dir.isEmpty() )
            {
                Resource resource = jar.getResource( root );
                if ( resource != null )
        {
                    process( analyzer, root, resource, headers );
          if (bpHeader.length() > 0) {
            bpHeader += ",";
          }
          bpHeader += root;
        }
                continue;
            }
            for ( Map.Entry<String, Resource> entry : dir.entrySet() )
            {
                String path = entry.getKey();
                Resource resource = entry.getValue();
                if ( PATHS.matcher( path ).matches() )
        {
                    process( analyzer, path, resource, headers );
          if (bpHeader.length() > 0) {
            bpHeader += ",";
View Full Code Here

        String bpHeader = analyzer.getProperty( "Service-Component" );

        Map<String, ? extends Map<String, String>> map = Processor.parseHeader( bpHeader, null );
        for ( String root : map.keySet() )
        {
            Resource resource = analyzer.getJar().getResource(root);
            if ( resource != null ) {
                process(analyzer, root, resource, headers);
            }
        }
View Full Code Here

  public OSGiFrameworkAnalyzer() {
  }

  public void analyzeResource(Jar resource, ResourceBuilder rb) throws Exception {
    Resource fwkFactorySvc = resource.getResource(SERVICE_FRAMEWORK_FACTORY);
    if (fwkFactorySvc != null) {
      CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_CONTRACT).addAttribute(Namespaces.NS_CONTRACT, Namespaces.CONTRACT_OSGI_FRAMEWORK);

      Version specVersion = null;
      StringBuilder uses = new StringBuilder();
View Full Code Here

  public OSGiFrameworkAnalyzer() {
  }

  public void analyzeResource(Jar resource, ResourceBuilder rb) throws Exception {
    Resource fwkFactorySvc = resource.getResource(SERVICE_FRAMEWORK_FACTORY);
    if (fwkFactorySvc != null) {
      CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_CONTRACT).addAttribute(Namespaces.NS_CONTRACT, Namespaces.CONTRACT_OSGI_FRAMEWORK);

      Version specVersion = null;
      StringBuilder uses = new StringBuilder();
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Resource

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.