Package org.apache.aries.application.management

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


        _bundleContext.registerService(BundleRepository.class.getName(),
            new ApplicationRepository(app),
            dict);
    }
 
    AriesApplicationContext result = _applicationContextManager.getApplicationContext(app);
    return result;
  }
View Full Code Here


      throw new IllegalArgumentException("The deployment metadata does not match the application.");
    }
   
    DeploymentMetadata oldMetadata = app.getDeploymentMetadata();
   
    AriesApplicationContext foundCtx = null;
    for (AriesApplicationContext ctx : _applicationContextManager.getApplicationContexts()) {
      if (ctx.getApplication().equals(app)) {
        foundCtx = ctx;
        break;
      }
View Full Code Here

    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
   
    // application name should be equal to eba name since application.mf is not provided
    assertEquals("test.eba", app.getApplicationMetadata().getApplicationName());
    AriesApplicationContext ctx = manager.install(app);
    ctx.start();
   
    HelloWorld hw = getOsgiService(HelloWorld.class);
    String result = hw.getMessage();
    assertEquals (result, "hello world");
   
    ctx.stop();
    manager.uninstall(ctx);
  }
View Full Code Here

    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
   
    // application name should equal to whatever Application name provided in the application.mf
    assertEquals("test application 2", app.getApplicationMetadata().getApplicationName());
   
    AriesApplicationContext ctx = manager.install(app);
    ctx.start();
   
    HelloWorld hw = getOsgiService(HelloWorld.class);
    String result = hw.getMessage();
    assertEquals (result, "hello world");
   
    ctx.stop();
    manager.uninstall(ctx);
  }
View Full Code Here

   
    assertTrue("Bundle " + TRANSITIVE_BUNDLE_BY_REFERENCE + " not found.", bundleSymbolicNames.contains(TRANSITIVE_BUNDLE_BY_REFERENCE));
    assertTrue("Bundle " + TRANSITIVE_BUNDLE_BY_VALUE + " not found.", bundleSymbolicNames.contains(TRANSITIVE_BUNDLE_BY_VALUE));
    assertTrue("Bundle " + BUNDLE_IN_FRAMEWORK + " not found.", bundleSymbolicNames.contains(BUNDLE_IN_FRAMEWORK));
   
    AriesApplicationContext ctx = manager.install(app);
    ctx.start();

    Set<Bundle> bundles = ctx.getApplicationContent();
   
    assertEquals("Number of bundles provisioned in the app", 4, bundles.size());
   
    ctx.stop();
    manager.uninstall(ctx);
  }
View Full Code Here

  public AriesApplicationContext install(AriesApplication app) throws BundleException, ManagementException, ResolverException {
    if (!app.isResolved()) {
        app = resolve(app);
    }
    AriesApplicationContext result = _applicationContextManager.getApplicationContext(app);
    return result;
  }
View Full Code Here

    AppMgrClientBlueprintListener acbl = new AppMgrClientBlueprintListener();
    ServiceRegistration sr = bundleContext.registerService("org.osgi.service.blueprint.container.BlueprintListener", acbl, null);
   
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("appmgrclienttest.eba")));
    AriesApplicationContext ctx = manager.install(app);
    ctx.start();
   
    int sleepfor = 3000;
    while ((acbl.success == null || acbl.success == false) && sleepfor > 0) {
      Thread.sleep(100);
      sleepfor-=100;
    }
    assertNotNull("Timed out - didn't receive Blueprint CREATED or FAILURE event", acbl.success);
    assertTrue("Received Blueprint FAILURE event", acbl.success);
   
    ctx.stop();
    manager.uninstall(ctx);
    sr.unregister();
  }
View Full Code Here

    LOGGER.debug("created app from {} : {} {} with contents {}", new Object[] {
        applicationLocation.getName(), appSymName, appVersion,
        app.getApplicationMetadata().getApplicationContents() });

    AriesApplicationContext context = applicationManager.install(app);

    LOGGER.debug("installed app {} {} state: {}", new Object[] {
        appSymName, appVersion,
        context.getApplicationState() });
   
    context.start();

    LOGGER.debug("started app {} {} state: {}", new Object[] {
        appSymName, appVersion,
        context.getApplicationState() });
   
    // Store the application context away because it is the application context we need
    // to pass to the application manager if we're later asked to uninstall the application
    appContexts.put(applicationLocation, context);
  }
View Full Code Here

    appContexts.put(applicationLocation, context);
  }

  public void uninstall(File applicationLocation) throws Exception
  {
    AriesApplicationContext context = appContexts.get(applicationLocation);
   
    String appSymName = context.getApplication().getApplicationMetadata().getApplicationSymbolicName();
    Version appVersion = context.getApplication().getApplicationMetadata().getApplicationVersion();

    LOGGER.debug("uninstalling {} {} ", new Object[] {
        appSymName, appVersion });

    if (context != null) {
      context.stop();
      applicationManager.uninstall(context);
    }

    appContexts.remove(applicationLocation);
   
    LOGGER.debug("uninstalled {} {} state: {}", new Object[] {
        appSymName, appVersion,
        context.getApplicationState() });
  }
View Full Code Here

   
    assertTrue("Bundle " + TRANSITIVE_BUNDLE_BY_REFERENCE + " not found.", bundleSymbolicNames.contains(TRANSITIVE_BUNDLE_BY_REFERENCE));
    assertTrue("Bundle " + TRANSITIVE_BUNDLE_BY_VALUE + " not found.", bundleSymbolicNames.contains(TRANSITIVE_BUNDLE_BY_VALUE));
    assertTrue("Bundle " + BUNDLE_IN_FRAMEWORK + " not found.", bundleSymbolicNames.contains(BUNDLE_IN_FRAMEWORK));
   
    AriesApplicationContext ctx = manager.install(app);
    ctx.start();

    Set<Bundle> bundles = ctx.getApplicationContent();
   
    assertEquals("Number of bundles provisioned in the app", 4, bundles.size());
   
    ctx.stop();
    manager.uninstall(ctx);
  }
View Full Code Here

TOP

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

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.