Examples of AriesApplication


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

  }
 
  @Test
  public void testCreateAndConversion() throws Exception {
      AriesApplication app = createApplication (CONVERSION_EBA);     
      ApplicationMetadata appMeta = app.getApplicationMetadata();     
      assertEquals (appMeta.getApplicationName(), "conversion.eba");    
      assertEquals (appMeta.getApplicationSymbolicName(), "conversion.eba");     
      assertEquals (appMeta.getApplicationVersion(), new Version("0.0"));     
      List<Content> appContent = appMeta.getApplicationContents();
      assertEquals (2, appContent.size());
      Content fbw = new ContentImpl("hello.world.jar;version=\"[1.1.0, 1.1.0]\"");
      Content mbl = new ContentImpl("helloWorld.war;version=\"[0.0.0, 0.0.0]\"");
      assertTrue (appContent.contains(fbw));
      assertTrue (appContent.contains(mbl));
     
      DeploymentMetadata dm = app.getDeploymentMetadata();
      List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();

      assertEquals (2, dcList.size());
      DeploymentContent dc1 = new DeploymentContentImpl ("hello.world.jar;deployed-version=1.1.0");
      DeploymentContent dc2 = new DeploymentContentImpl ("helloWorld.war;deployed-version=0.0.0");
      DeploymentContent dc3 = new DeploymentContentImpl ("a.handy.persistence.library;deployed-version=1.1.0");
      assertTrue (dcList.contains(dc1));
      assertTrue (dcList.contains(dc2));
     
      dcList = dm.getApplicationProvisionBundles();
     
      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

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

    public void test() throws Exception {
 
  /* Install and start the blog eba */
  URL urlToEba = getUrlToEba("org.apache.aries.samples.blog", "org.apache.aries.samples.blog.jpa.eba");
  AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
  AriesApplication app = manager.createApplication(urlToEba);
  AriesApplicationContext ctx = manager.install(app);
  ctx.start();

    /* Find and check all the blog sample bundles */

 
View Full Code Here

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

    public void test() throws Exception {

        URL urlToEba = getUrlToEba("org.apache.aries.samples.blog", "org.apache.aries.samples.blog.jdbc.eba");

        AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
        AriesApplication app = manager.createApplication(urlToEba);
        AriesApplicationContext ctx = manager.install(app);
        ctx.start();

    /* Check that the Blog Sample bundles are present an started */
        Bundle bapi = getInstalledBundle("org.apache.aries.samples.blog.api");
View Full Code Here

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

        if (in == null) {
            System.err.println("File not found: " + applicationPath);
            return in;
        }
        AriesApplicationManager manager = getAriesApplicationManager();
        AriesApplication application = manager.createApplication(in);
       
        if (application.isResolved()) {
            System.out.println("Application " + application.getApplicationMetadata().getApplicationSymbolicName() + " is already resolved.");
        } else {
            System.out.println("Attempting to resolve " + application.getApplicationMetadata().getApplicationSymbolicName() + " application.");
           
            AriesApplication resolved = manager.resolve(application);
            File targetApplication = null;
            if (resovledApplicationPath == null) {
                String baseName = null;
                if (applicationPath.endsWith(".eba")) {
                    baseName = applicationPath.substring(0, applicationPath.length() - 4);
                } else {
                    baseName = applicationPath;
                }
                targetApplication = new File(baseName + ".resolved.eba");
            } else {
                targetApplication = new File(resovledApplicationPath);
            }

            System.out.println("Application " + application.getApplicationMetadata().getApplicationSymbolicName() + " was successfully resolved.");
            System.out.println("Writing the resolved application to " + targetApplication);

            FileOutputStream os = new FileOutputStream(targetApplication);
            try {
                resolved.store(os);
            } finally {           
                os.close();
            }

            System.out.println("Done.");
View Full Code Here

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

                                                ConfigurationStore targetConfigurationStore)
        throws IOException, DeploymentException {

        AriesApplicationManager appManager = getAriesApplicationManager();

        AriesApplication app = null;
        try {
            app = appManager.createApplication(FileSystem.getFSRoot(new File(jarFile.getName())));
        } catch (Exception e) {
            throw new DeploymentException("Error creating Aries Application", e);
        }

        if (!app.isResolved() && getResolveOnDeploy()) {
            try {
                app = appManager.resolve(app);
            } catch (Exception e) {
                throw new DeploymentException("Error resolving Aries Application", e);
            }
View Full Code Here

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

        GeronimoApplicationManager appManager = installer.getGeronimoApplicationManager();

        File ebaFile = new File(jarFile.getName());
       
        AriesApplication app = null;
        try {
            if (inPlaceDeployment) {
                app = appManager.createApplication(jarFile);
            } else {
                app = appManager.createApplication(FileSystem.getFSRoot(ebaFile));
            }
        } catch (Exception e) {
            throw new DeploymentException("Error creating Aries Application", e);
        }

        if (!app.isResolved() && getResolveOnDeploy()) {
            try {
                app = appManager.resolve(app);
            } catch (Exception e) {
                throw new DeploymentException("Error resolving Aries Application", e);
            }
View Full Code Here

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

    protected void registerApplication(Artifact id, AriesApplication app) {
        applicationMap.put(id, app);
    }
   
    protected AriesApplication unregisterApplication(Artifact id) {
        AriesApplication app = applicationMap.remove(id);
        return app;
    }
View Full Code Here

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

        AriesApplication app = applicationMap.remove(id);
        return app;
    }
   
    protected AriesApplication lookupApplication(Artifact id) {
        AriesApplication app = applicationMap.get(id);
        return app;
    }
View Full Code Here

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

    @Override
    public void install(File source, Artifact artifactId, FileWriteMonitor monitor, File target) throws IOException {
        // copy config.ser & other generated stuff during deployment
        FileUtils.recursiveCopy(source, target);
       
        AriesApplication app = installer.lookupApplication(artifactId);
        // app will be null for in-place deployment
        if (app != null) {
            // copy the contents on the application
            installer.storeApplication(app, target);
        }
View Full Code Here

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

    }
   
    repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());

    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("blog.eba")));
    //installing requires a valid url for the bundle in repository.xml.
   
    app = manager.resolve(app);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.