Package org.osmorc.run.ui

Examples of org.osmorc.run.ui.SelectedBundle


    for (File dir : flattenDirPatterns(basePath, bundleDirs)) {
      File[] files = ObjectUtils.notNull(dir.listFiles(), ArrayUtil.EMPTY_FILE_ARRAY);
      for (File file : files) {
        FrameworkBundleType bundleType = detectType(file, sysNamePattern, sysControlClass, shellNamePattern, shellControlClass);
        if (bundleType == type) {
          SelectedBundle bundle = makeBundle(file);
          bundles.add(bundle);
          if (expected > 0 && bundles.size() == expected) {
            break outer;
          }
        }
View Full Code Here


    }
    else {
      bundleName = file.getName();
    }

    return new SelectedBundle(SelectedBundle.BundleType.FrameworkBundle, bundleName, path);
  }
View Full Code Here

  @NotNull
  @Override
  public Collection<SelectedBundle> getFrameworkBundles(@NotNull FrameworkInstanceDefinition instance, @NotNull FrameworkBundleType type) {
    if (type == FrameworkBundleType.SHELL) {
      return Collections.singleton(new SelectedBundle(SelectedBundle.BundleType.FrameworkBundle, "Equinox built-in console", null));
    }
    else {
      return collectBundles(instance, type, BUNDLE_DIRS, SYSTEM_BUNDLE, EquinoxRunner.MAIN_CLASS, 1, SHELL_BUNDLES, null, 0);
    }
  }
View Full Code Here

*/
public class StartLevelComparatorTest {
  @Test
  public void testCompare() {
    Comparator<SelectedBundle> testObject = OsgiRunState.START_LEVEL_COMPARATOR;
    SelectedBundle bundle1 = new SelectedBundle(SelectedBundle.BundleType.Module, "org.osmorc.testBundle1", null);
    SelectedBundle bundle2 = new SelectedBundle(SelectedBundle.BundleType.Module, "org.osmorc.testBundle2", null);

    bundle1.setStartLevel(1);
    bundle2.setStartLevel(1);
    assertThat(testObject.compare(bundle1, bundle2), equalTo(0));

    bundle1.setStartLevel(1);
    bundle2.setStartLevel(2);
    assertThat(testObject.compare(bundle1, bundle2), lessThan(0));

    bundle1.setStartLevel(4);
    bundle2.setStartLevel(2);
    assertThat(testObject.compare(bundle1, bundle2), greaterThan(0));
  }
View Full Code Here

* @author Robert F. Beeger (robert@beeger.net)
*/
public class SelectedBundleTest {
  @Test
  public void testToString() {
    SelectedBundle testObject = new SelectedBundle(SelectedBundle.BundleType.Module, "testName", "/test/path");
    assertThat(testObject.toString(), equalTo("testName (path)"));
    testObject = new SelectedBundle(SelectedBundle.BundleType.Module, "testName", null);
    assertThat(testObject.toString(), equalTo("testName"));
  }
View Full Code Here

    assertThat(testObject.toString(), equalTo("testName"));
  }

  @Test
  public void testEquals() {
    SelectedBundle testObject = new SelectedBundle(SelectedBundle.BundleType.Module, "testName", "/test/path");
    assertThat(testObject, equalTo(testObject));
    testObject = new SelectedBundle(SelectedBundle.BundleType.Module, "testName", null);
    assertThat(testObject, equalTo(testObject));
    testObject = new SelectedBundle(SelectedBundle.BundleType.PlainLibrary, "testName", "/test/path");
    assertThat(testObject, equalTo(testObject));
    testObject = new SelectedBundle(SelectedBundle.BundleType.PlainLibrary, "testName", null);
    assertThat(testObject, equalTo(testObject));
  }
View Full Code Here

          ModuleManager moduleManager = ModuleManager.getInstance(myRunConfiguration.getProject());
          int bundleCount = myRunConfiguration.getBundlesToDeploy().size();
          for (int i = 0; i < bundleCount; i++) {
            progressIndicator.setFraction((double)i / bundleCount);

            SelectedBundle selectedBundle = myRunConfiguration.getBundlesToDeploy().get(i);
            if (selectedBundle.isModule()) {
              // use the output jar name if it is a module
              String name = selectedBundle.getName();
              Module module = moduleManager.findModuleByName(name);
              if (module == null) {
                throw new CantRunException("Module '" + name + "' no longer exists. Please check your run configuration.");
              }
              OsmorcFacet facet = OsmorcFacet.getInstance(module);
              if (facet == null) {
                throw new CantRunException("Module '" + name + "' has no OSGi facet. Please check your run configuration.");
              }
              selectedBundle.setBundlePath(facet.getConfiguration().getJarFileLocation());
              selectedBundles.add(selectedBundle);
              // add all the library dependencies of the bundle
              List<String> paths = new BundleCompiler().bundlifyLibraries(module, progressIndicator);
              for (String path : paths) {
                selectedBundles.add(new SelectedBundle(SelectedBundle.BundleType.PlainLibrary, "Dependency", path));
              }
            }
            else {
              if (selectedBundles.contains(selectedBundle)) {
                // if the user selected a dependency as runnable library, we need to replace the dependency with
                // the runnable library part
                selectedBundles.remove(selectedBundle);
              }
              selectedBundles.add(selectedBundle);
            }
          }

          // filter out bundles which have the same symbolic name
          Map<String, SelectedBundle> filteredBundles = new HashMap<String, SelectedBundle>();
          for (SelectedBundle selectedBundle : selectedBundles) {
            String path = selectedBundle.getBundlePath();
            if (path != null) {
              String name = CachingBundleInfoProvider.getBundleSymbolicName(path);
              String version = CachingBundleInfoProvider.getBundleVersion(path);
              String key = name + version;
              if (!filteredBundles.containsKey(key)) {
View Full Code Here

      catch (IllegalArgumentException e) {
        LOG.error("unexpected bundle type '" + typeName + "'");
        type = SelectedBundle.BundleType.Module;
      }

      SelectedBundle selectedBundle = new SelectedBundle(type, name, VfsUtilCore.urlToPath(url));

      if (startLevel != null) {
        try {
          selectedBundle.setStartLevel(Integer.parseInt(startLevel));
        }
        catch (NumberFormatException ignored) { }
      }

      String startAfterInstallationString = child.getAttributeValue(START_AFTER_INSTALLATION_ATTRIBUTE);
      if (startAfterInstallationString != null) {
        selectedBundle.setStartAfterInstallation(Boolean.parseBoolean(startAfterInstallationString));
      }

      bundlesToDeploy.add(selectedBundle);
    }
View Full Code Here

TOP

Related Classes of org.osmorc.run.ui.SelectedBundle

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.