Package uk.co.brunella.osgi.bdt.bundle

Examples of uk.co.brunella.osgi.bdt.bundle.BundleRepository


  private void runTests(RunNotifier notifier, List<FrameworkMethod> testMethods) {
    int index = 0;
    for (int i = 0; i < frameworkStarters.length; i++) {
      OSGiFrameworkStarter frameworkStarter = frameworkStarters[i];
      BundleRepository repository = repositories[i];
      if (frameworkStarters.length > 1) {
        index++;
      }
      if (testClassAnnotation.frameworkStartPolicy() == StartPolicy.ONCE_PER_TEST_CLASS) {
        startFramework(frameworkStarter, repository);
View Full Code Here


    if (!checkRepository(repositoryDirectory)) {
      return false;
    }
    VersionRange versionRange = VersionRange.parseVersionRange(range);
    BundleRepositoryPersister persister = new BundleRepositoryPersister(repositoryDirectory);
    BundleRepository repository = persister.load();
   
    ExportPackage[] exportPackages = repository.resolve(packageName, versionRange, true);
    if (exportPackages.length == 0) {
      System.out.println("No match found");
    } else {
      for (ExportPackage exportPackage : exportPackages) {
        BundleDescriptor descriptor = exportPackage.getBundleDescriptor();
View Full Code Here

  }
 
  public BundleRepository load() throws IOException {
    FileInputStream fis = null;
    ObjectInputStream ois = null;
    BundleRepository repository = null;
    try {
      fis = new FileInputStream(repositoryFile);
      ois = new ObjectInputStream(fis);
      try {
        repository = (BundleRepository) ois.readObject();
      } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
    } finally {
      if (ois != null) {
        ois.close();
      }
      if (fis != null) {
        fis.close();
      }
    }
    repository.setLocation(repositoryDirectory);
    return repository;
  }
View Full Code Here

      log("Undeploying bundle " + bundleSymbolicName + " " + bundleVersionRange);
    }
    // try to lock the repository
    if (persister.lock(MAX_WAIT_TIME_IN_MILLIS)) {
      try {
        BundleRepository repository = persister.load();
        BundleDescriptor descriptor = repository.removeBundleDescriptor(bundleSymbolicName, bundleVersionRange);
        if (descriptor != null) {
          persister.save(repository);
          File bundleJar = new File(bundleDirectory, descriptor.getBundleJarFileName());
          bundleJar.delete();
          File packageDir = new File(packageDirectory, descriptor.getBundleSymbolicName() + File.separator
View Full Code Here

        FileUtils.deleteDir(repositoryDirectory);
      }
      logInfo("Creating new repository in " + repositoryDirectory);
      repositoryDirectory.mkdirs();
      logInfo("Creating new repository file");
      persister.save(new BundleRepository(profile));
      logInfo("Creating subdirectories");
      bundleDirectory.mkdirs();
      packageDirectory.mkdirs();
      tempDirectory.mkdirs();
      bundleExtractedDirectory.mkdirs();
View Full Code Here

  }

  public List<BundleDescriptor> list() throws IOException {
    logClear();
    log("Listing bundle directory");
    BundleRepository repository = persister.load();
    return repository.getBundleDescriptors();
  }
View Full Code Here

      return false;
    }
  }
 
  private void updateRepository(BundleDescriptor descriptor) throws IOException {
    BundleRepository repository = persister.load();
    VersionRange versionRange = VersionRange.parseVersionRange("[" + descriptor.getBundleVersion() + "," + descriptor.getBundleVersion() + "]");
    repository.removeBundleDescriptor(descriptor.getBundleSymbolicName(), versionRange);
    repository.addBundleDescriptor(descriptor);
    persister.save(repository);
  }
View Full Code Here

      } catch (Exception e) {
        throw new BuildException(e.getMessage(), e);
      }
    }
    if (deployRepository != null) {
      buildRepository = new BundleRepository(deployRepository.getProfileName());
    } else {
      buildRepository = new BundleRepository("J2SE-1.5");
    }
    for (DirSet fileSet : projectDirectories) {
      DirectoryScanner ds = fileSet.getDirectoryScanner(getProject());
      String[] projectDirectories = ds.getIncludedDirectories();
      for (String projectDirectoryName : projectDirectories) {
View Full Code Here

 
  private void resolveBundle() {
    log("Resolve classpath", Project.MSG_VERBOSE);
    isResolved = true;
    BundleRepositoryPersister persister = new BundleRepositoryPersister(repositoryDirectory);
    BundleRepository repository = null;
    try {
      repository = persister.load();
    } catch (IOException e) {
      // cannot load repository - create an empty one
      log("Repository " + repositoryDirectory + " cannot be loaded", Project.MSG_WARN);
      repository = new BundleRepository("J2SE-1.5");
    }

    unresolved = new HashSet<ImportPackage>();
    resolved = new HashSet<ExportPackage>();
    resolvedBundles = new HashSet<BundleDescriptor>();

    boolean resolveToBundle = "bundle".equals(resolve);

    Set<BundleDescriptor> importedBundles = new HashSet<BundleDescriptor>();
   
    // add fragment host bundle
    if (descriptor.getFragmentHost() != null) {
      BundleDescriptor[] hosts = repository.resolveBundle(descriptor.getFragmentHost(), descriptor.getFragmentHostVersionRange(), true);
      if (hosts.length > 0) {
        BundleDescriptor fragmentHost = hosts[0];
        importedBundles.add(fragmentHost);
        // resolve the fragment host
        resolveBundle(0, fragmentHost, repository);
View Full Code Here

    private void initialize() {
      invisibleRoot = new TreeParent("", TreeObjectType.ROOT, null);
      String[] repositoryPaths = getRepositoryPaths();
      for (int i = 0; i < repositoryPaths.length; i++) {
        BundleRepositoryPersister persister = new BundleRepositoryPersister(new File(repositoryPaths[i]));
        BundleRepository repository = null;
        try {
          repository = persister.load();
        } catch (IOException e) {
          repository = null;
        }
View Full Code Here

TOP

Related Classes of uk.co.brunella.osgi.bdt.bundle.BundleRepository

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.