コード例 #1
0
 public static HashMap getBundleClasspaths(MDEState state) {
   HashMap properties = new HashMap();
   BundleDescription[] bundles = state.getState().getBundles();
   for (int i = 0; i < bundles.length; i++) {
     properties.put(new Long(bundles[i].getBundleId()), getValue(bundles[i], state));
   }
   return properties;
 }
コード例 #2
0
  @Override
  protected void setUp() throws Exception {
    tmp = IO.getFile("generated/tmp");
    tmp.mkdirs();
    IO.copy(IO.getFile("testdata/ws"), tmp);
    workspace = Workspace.getWorkspace(tmp);
    workspace.refresh();

    InfoRepository repo = workspace.getPlugin(InfoRepository.class);
    t1 = create("bsn-1", new Version(1, 0, 0));
    t2 = create("bsn-2", new Version(1, 0, 0));

    repo.put(new FileInputStream(t1), null);
    repo.put(new FileInputStream(t2), null);
    t1 = repo.get("bsn-1", new Version(1, 0, 0), null);
    t2 = repo.get("bsn-2", new Version(1, 0, 0), null);
    repo.put(new FileInputStream(IO.getFile("generated/biz.aQute.remote.launcher.jar")), null);

    workspace.getPlugins().add(repo);

    File storage = IO.getFile("generated/storage-1");
    storage.mkdirs();

    configuration = new HashMap<String, Object>();
    configuration.put(
        Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
    configuration.put(Constants.FRAMEWORK_STORAGE, storage.getAbsolutePath());

    configuration.put(
        Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.osgi.framework.launch;version=1.2");

    framework = new org.apache.felix.framework.FrameworkFactory().newFramework(configuration);
    framework.init();
    framework.start();
    context = framework.getBundleContext();
    location = "reference:" + IO.getFile("generated/biz.aQute.remote.agent.jar").toURI().toString();
    agent = context.installBundle(location);
    agent.start();

    thread =
        new Thread() {
          @Override
          public void run() {
            try {
              Main.main(
                  new String[] {
                    "-s", "generated/storage", "-c", "generated/cache", "-p", "1090", "-et"
                  });
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    thread.setDaemon(true);
    thread.start();

    super.setUp();
  }
コード例 #3
0
 public static Map getPatchMap(MDEState state) {
   HashMap properties = new HashMap();
   IMonitorModelBase[] models = MonitorRegistry.getActiveModels();
   for (int i = 0; i < models.length; i++) {
     BundleDescription desc = models[i].getBundleDescription();
     if (desc == null) continue;
     Long id = new Long(desc.getBundleId());
     if (ClasspathUtilCore.hasExtensibleAPI(models[i])) {
       properties.put(id, ICoreConstants.EXTENSIBLE_API + ": true"); // $NON-NLS-1$
     } else if (ClasspathUtilCore.isPatchFragment(models[i])) {
       properties.put(id, ICoreConstants.PATCH_FRAGMENT + ": true"); // $NON-NLS-1$
     }
   }
   return properties;
 }
コード例 #4
0
 @Override
 public Map<String, Object> getAttributes() {
   HashMap<String, Object> attributes = new HashMap<String, Object>();
   attributes.put(BundleRevision.BUNDLE_NAMESPACE, bundleSymbolicName);
   return attributes;
 }
コード例 #5
0
 @Override
 public Map<String, Object> getAttributes() {
   HashMap<String, Object> attributes = new HashMap<String, Object>();
   attributes.put(BundleRevision.PACKAGE_NAMESPACE, this.packageName);
   return attributes;
 }