Package org.apache.aries.application.management

Examples of org.apache.aries.application.management.BundleInfo


        if (findBundleInFramework(packageAdmin, bundleSymbolicName, bundleVersion) != null) {
            continue;
        }
       
        // Step 2: See if the bundle is included in the application
        BundleInfo bundleInfo = findBundleInfoInApplication(bundleSymbolicName, bundleVersion);
        if (bundleInfo == null) {
            // Step 3: Lookup bundle location using the resolver
            bundleInfo = findBundleInfoUsingResolver(resolver, bundleSymbolicName, bundleVersion);
        }
       
        if (bundleInfo == null) {
            throw new ManagementException("Cound not find bundles: " + bundleSymbolicName + "_" + bundleVersion);
        }
           
        Bundle bundle = _bundleContext.installBundle(bundleInfo.getLocation());
           
        _bundles.put(bundleInfo, bundle);       
      }
    } catch (BundleException be) {
      for (Bundle bundle : _bundles.values()) {
View Full Code Here


     
      for (DeploymentContent content : bundlesToInstall) {
        String bundleSymbolicName = content.getContentName();
        Version bundleVersion = content.getExactVersion();
       
        BundleInfo bundleInfo = null;
       
        for (BundleInfo info : _application.getBundleInfo()) {
          if (info.getSymbolicName().equals(bundleSymbolicName) &&
              info.getVersion().equals(bundleVersion)) {
            bundleInfo = info;
            break;
          }
        }
       
        if (bundleInfo == null) {
          // call out to the bundle repository.
          bundleInfo = resolver.getBundleInfo(bundleSymbolicName, bundleVersion);
        }
       
        if (bundleInfo == null) {
          throw new ManagementException("Cound not find bundles: " + bundleSymbolicName + "_" + bundleVersion);
        }
       
        Bundle bundle = _bundleContext.installBundle(bundleInfo.getLocation());
       
        _bundles.put(bundleInfo, bundle);
      }
    } catch (BundleException be) {
      for (Bundle bundle : _bundles.values()) {
View Full Code Here

     
      assertEquals(1, dcList.size());
      assertTrue (dcList.contains(dc3));
     
      assertEquals(2, app.getBundleInfo().size());
      BundleInfo info;
      info = findBundleInfo(app.getBundleInfo(), "hello.world.jar");
      assertNotNull(info);
      assertEquals("HelloWorldJar", info.getHeaders().get(Constants.BUNDLE_NAME));
     
      info = findBundleInfo(app.getBundleInfo(), "helloWorld.war");
        assertNotNull(info);
        assertEquals("helloWorld.war", info.getHeaders().get(Constants.BUNDLE_NAME));
        assertEquals("/test", info.getHeaders().get("Bundle-ContextPath"));
  }
View Full Code Here

    // we could change to using it here.
    Set<BundleInfo> nextResolverResult = new HashSet<BundleInfo>();
    String persistenceLibraryLocation = "../src/test/resources/bundles/repository/a.handy.persistence.library.jar";
    File persistenceLibrary = new File (persistenceLibraryLocation);
    BundleManifest mf = BundleManifest.fromBundle(persistenceLibrary);
    BundleInfo resolvedPersistenceLibrary = new SimpleBundleInfo(mf, persistenceLibraryLocation);
    Field v = SimpleBundleInfo.class.getDeclaredField("_version");
    v.setAccessible(true);
    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
    nextResolverResult.add(resolvedPersistenceLibrary);
    _resolver.setNextResult(nextResolverResult);
View Full Code Here

public class ApplicationRepositoryTest {
  @Test
  public void testBundleNotInApp() {
    AriesApplication app = Skeleton.newMock(AriesApplication.class);
   
    BundleInfo bi = Skeleton.newMock(BundleInfo.class);
    Skeleton.getSkeleton(bi).setReturnValue(new MethodCall(BundleInfo.class, "getSymbolicName"), "test.bundle");
    Skeleton.getSkeleton(bi).setReturnValue(new MethodCall(BundleInfo.class, "getVersion"), new Version("1.0.0"));
   
    Skeleton.getSkeleton(app).setReturnValue(
        new MethodCall(AriesApplication.class, "getBundleInfo"),
View Full Code Here

  private String buildAppContent(Set<BundleInfo> bundleInfos) {
      StringBuilder builder = new StringBuilder();
      Iterator<BundleInfo> iterator = bundleInfos.iterator();
      while (iterator.hasNext()) {
          BundleInfo info = iterator.next();
          builder.append(info.getSymbolicName());

          // bundle version is not a required manifest header
          if (info.getVersion() != null) {
              String version = info.getVersion().toString();
              builder.append(";version=\"[");
              builder.append(version);
              builder.append(',');
              builder.append(version);
              builder.append("]\"");
View Full Code Here

       return app.getBundleInfo();
     }
  
     public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion)
     {
       BundleInfo result = null;
       for (BundleInfo info : resolvedBundles)
       {
         if (info.getSymbolicName().equals(bundleSymbolicName) &&
             info.getVersion().equals(bundleVersion))
         {
View Full Code Here

     
      assertEquals(1, dcList.size());
      assertTrue (dcList.contains(dc3));
     
      assertEquals(2, app.getBundleInfo().size());
      BundleInfo info;
      info = findBundleInfo(app.getBundleInfo(), "hello.world.jar");
      assertNotNull(info);
      assertEquals("HelloWorldJar", info.getHeaders().get(Constants.BUNDLE_NAME));
     
      info = findBundleInfo(app.getBundleInfo(), "helloWorld.war");
        assertNotNull(info);
        assertEquals("helloWorld.war", info.getHeaders().get(Constants.BUNDLE_NAME));
        assertEquals("/test", info.getHeaders().get("Bundle-ContextPath"));
  }
View Full Code Here

    // we could change to using it here.
    Set<BundleInfo> nextResolverResult = new HashSet<BundleInfo>();
    String persistenceLibraryLocation = "../src/test/resources/bundles/repository/a.handy.persistence.library.jar";
    File persistenceLibrary = new File (persistenceLibraryLocation);
    BundleManifest mf = BundleManifest.fromBundle(persistenceLibrary);
    BundleInfo resolvedPersistenceLibrary = new SimpleBundleInfo(_appMetaFactory, mf, persistenceLibraryLocation);
    Field v = SimpleBundleInfo.class.getDeclaredField("_version");
    v.setAccessible(true);
    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
    nextResolverResult.add(resolvedPersistenceLibrary);
    _resolver.setNextResult(nextResolverResult);
View Full Code Here

  private String buildAppContent(Set<BundleInfo> bundleInfos) {
      StringBuilder builder = new StringBuilder();
      Iterator<BundleInfo> iterator = bundleInfos.iterator();
      while (iterator.hasNext()) {
          BundleInfo info = iterator.next();
          builder.append(info.getSymbolicName());

          // bundle version is not a required manifest header
          if (info.getVersion() != null) {
              String version = info.getVersion().toString();
              builder.append(";version=\"[");
              builder.append(version);
              builder.append(',');
              builder.append(version);
              builder.append("]\"");
View Full Code Here

TOP

Related Classes of org.apache.aries.application.management.BundleInfo

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.