Package org.osgi.service.indexer.impl

Examples of org.osgi.service.indexer.impl.KnownBundleAnalyzer


    deleteWithException(tempDir);
  }

  public void testKnownBundleRecognition() throws Exception {
    RepoIndex indexer = new RepoIndex();
    indexer.addAnalyzer(new KnownBundleAnalyzer(), FrameworkUtil.createFilter("(name=*)"));

    StringWriter writer = new StringWriter();
    File tempDir = createTempDir();
    File tempFile = copyToTempFile(tempDir, "testdata/org.eclipse.equinox.ds-1.4.0.jar");

View Full Code Here


  public void testKnownBundlesExtra() throws Exception {
    Properties extras = new Properties();
    extras.setProperty("org.eclipse.equinox.ds;[1.4,1.5)", "cap=extra;extra=wibble");

    KnownBundleAnalyzer knownBundlesAnalyzer = new KnownBundleAnalyzer();
    knownBundlesAnalyzer.setKnownBundlesExtra(extras);

    RepoIndex indexer = new RepoIndex();
    indexer.addAnalyzer(knownBundlesAnalyzer, FrameworkUtil.createFilter("(name=*)"));

    StringWriter writer = new StringWriter();
View Full Code Here

  }
 
  private static File processArgs(String[] args, Map<String, String> config, Collection<? super File> fileList, BundleContext context) throws Exception {
    File output = new File(DEFAULT_FILENAME_COMPRESSED);
   
    KnownBundleAnalyzer knownBundleAnalyzer = null;
    File knownBundlesExtraFile = null;
   
    for (int i = 0; i < args.length; i++) {
      try {
        if (args[i].startsWith("-n")) {
          String repoName = args[++i];
          config.put(ResourceIndexer.REPOSITORY_NAME, repoName);
        } else if (args[i].equals("-stylesheet")) {
          String styleSheet = args[++i];
          config.put(ResourceIndexer.STYLESHEET, styleSheet);
        } else if (args[i].startsWith("-r")) {
          output = new File(args[++i]);
        } else if (args[i].startsWith("-v")) {
          config.put(ResourceIndexer.VERBOSE, Boolean.TRUE.toString());
        } else if (args[i].startsWith("-d")) {
          config.put(ResourceIndexer.ROOT_URL, args[++i]);
        } else if (args[i].startsWith("-t")) {
          String urlTemplate = args[++i];
          config.put(ResourceIndexer.URL_TEMPLATE, urlTemplate);
        } else if (args[i].startsWith("-l")) {
          String licenceUrl = args[++i];
          config.put(ResourceIndexer.LICENSE_URL, licenceUrl);
        } else if (args[i].equalsIgnoreCase("--pretty")) {
          output = new File(DEFAULT_FILENAME_UNCOMPRESSED);
          config.put(ResourceIndexer.PRETTY, Boolean.toString(true));
        } else if (args[i].equals("-K")) {
          knownBundleAnalyzer = new KnownBundleAnalyzer(new Properties());
        } else if (args[i].equals("-k")) {
          knownBundlesExtraFile = new File(args[++i]);
        } else if(args[i].equalsIgnoreCase("--noincrement")) {
          config.put("-repository.increment.override", "");
        } else if (args[i].startsWith("-h")) {
          printUsage();
        } else if (args[i].startsWith("-")) {
          throw new Exception("Unknown argument");
        } else {
          fileList.add(new File(args[i]));
        }
      } catch (Exception e) {
        System.err.println("Error in " + args[i] + " : " + e.getMessage());
        System.exit(1);
      }
    }
   
    if (knownBundleAnalyzer == null)
      knownBundleAnalyzer = new KnownBundleAnalyzer();
   
    if (knownBundlesExtraFile != null) {
      Properties props = loadPropertiesFile(knownBundlesExtraFile);
      knownBundleAnalyzer.setKnownBundlesExtra(props);
    }
   
    context.registerService(ResourceAnalyzer.class.getName(), knownBundleAnalyzer, null);
   
    return output;
View Full Code Here

      CommandLineOptions.usage(err, PROGRAM_NAME, parser);
      return null;
    }

    KnownBundleAnalyzer knownBundleAnalyzer = null;

    config.put(ResourceIndexer.REPOSITORY_NAME, commandLineOptions.repositoryName);

    if (commandLineOptions.stylesheetURL != null) {
      config.put(ResourceIndexer.STYLESHEET, commandLineOptions.stylesheetURL.toString());
    }

    File output = commandLineOptions.outputFile;

    if (commandLineOptions.verbose) {
      config.put(ResourceIndexer.VERBOSE, Boolean.TRUE.toString());
    }

    if (commandLineOptions.rootURL != null) {
      config.put(ResourceIndexer.ROOT_URL, commandLineOptions.rootURL.toString());
    }

    config.put(ResourceIndexer.URL_TEMPLATE, commandLineOptions.resourceUrlTemplate);

    if (commandLineOptions.licenseURL != null) {
      config.put(ResourceIndexer.LICENSE_URL, commandLineOptions.licenseURL.toString());
    }

    if (commandLineOptions.pretty) {
      config.put(ResourceIndexer.PRETTY, Boolean.TRUE.toString());
    }

    if (commandLineOptions.overrideBuiltinKnownBundles) {
      knownBundleAnalyzer = new KnownBundleAnalyzer(new Properties());
    }

    File knownBundlesExtraFile = commandLineOptions.knownBundlePropertiesFile;

    if (commandLineOptions.incrementOverride) {
      config.put(RepoIndex.REPOSITORY_INCREMENT_OVERRIDE, "");
    }

    if (commandLineOptions.fileList.isEmpty()) {
      fileList.clear();
    } else {
      for (File file : commandLineOptions.fileList) {
        fileList.add(new File(file.toURI().normalize().getPath()));
      }
    }

    if (knownBundleAnalyzer == null)
      knownBundleAnalyzer = new KnownBundleAnalyzer();

    if (knownBundlesExtraFile != null) {
      Properties props = loadPropertiesFile(knownBundlesExtraFile);
      knownBundleAnalyzer.setKnownBundlesExtra(props);
    }

    context.registerService(ResourceAnalyzer.class.getName(), knownBundleAnalyzer, null);

    return output;
View Full Code Here

TOP

Related Classes of org.osgi.service.indexer.impl.KnownBundleAnalyzer

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.