Package org.apache.aries.application

Examples of org.apache.aries.application.ApplicationMetadata


  @Override
  public Manifest generateDeploymentManifest(AriesApplication app,  ResolveConstraint... constraints ) throws ResolverException
  {

    _logger.debug(LOG_ENTRY, "generateDeploymentManifest", new Object[]{app, constraints});
    ApplicationMetadata appMetadata = app.getApplicationMetadata();
    Collection<ModelledResource> byValueBundles = null;
    try {
      // find out blueprint information
      byValueBundles = getByValueBundles(app);
      // find out by value bundles and then by reference bundles
    } catch (Exception e) {
      throw new ResolverException (e);
    }

    Collection<Content> bundlesToResolve = new ArrayList<Content>();
    bundlesToResolve.addAll(appMetadata.getApplicationContents());   
    bundlesToResolve.addAll(app.getApplicationMetadata().getUseBundles());

    //If we pass in provision bundles (e.g. import deployment manifest sanity check), we add them into our bundlesToResolve set.
    // This is because we want to make sure all bundles we passed into resolver the same as what we are going to get from resolver.
    List<Content> restrictedReqs = new ArrayList<Content>();
    for (ResolveConstraint constraint : constraints ) {
      Content content = ContentFactory.parseContent(constraint.getBundleName(), constraint.getVersionRange().toString());
      restrictedReqs.add(content);
    }
   
    DeployedBundles deployedBundles = generateDeployedBundles (appMetadata,
        byValueBundles, restrictedReqs);
   
    Manifest man = generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
        appMetadata.getApplicationVersion().toString(), deployedBundles);
    _logger.debug(LOG_EXIT, "generateDeploymentManifest", new Object[] {man});
    return man;
  }
View Full Code Here


            }
        } else {
            applicationManifest = new Manifest();
        }
        ManifestDefaultsInjector.updateManifest(applicationManifest, ebaFile.getName(), ebaFile);
        ApplicationMetadata metadata = factory.createApplicationMetadata(applicationManifest);
        return ApplicationInstaller.getConfigId(metadata);
    }
View Full Code Here

    public Set<BundleInfo> resolve(AriesApplication app, ResolveConstraint... constraints) throws ResolverException {
        log.trace("resolving {}", app);
        DataModelHelper helper = repositoryAdmin.getHelper();

        ApplicationMetadata appMeta = app.getApplicationMetadata();

        String appName = appMeta.getApplicationSymbolicName();
        Version appVersion = appMeta.getApplicationVersion();
        List<Content> appContent = appMeta.getApplicationContents();

        Repository appRepo;

        try {
            Document doc = RepositoryDescriptorGenerator.generateRepositoryDescriptor(appName + "_" + appVersion, app
View Full Code Here

  @Override
  public Manifest generateDeploymentManifest(AriesApplication app,  ResolveConstraint... constraints ) throws ResolverException
  {

    _logger.debug(LOG_ENTRY, "generateDeploymentManifest", new Object[]{app, constraints});
    ApplicationMetadata appMetadata = app.getApplicationMetadata();
    Collection<ModelledResource> byValueBundles = null;
    try {
      // find out blueprint information
      byValueBundles = getByValueBundles(app);
      // find out by value bundles and then by reference bundles
    } catch (Exception e) {
      throw new ResolverException (e);
    }

    Collection<Content> bundlesToResolve = new ArrayList<Content>();
    bundlesToResolve.addAll(appMetadata.getApplicationContents());   
    bundlesToResolve.addAll(app.getApplicationMetadata().getUseBundles());

    //If we pass in provision bundles (e.g. import deployment manifest sanity check), we add them into our bundlesToResolve set.
    // This is because we want to make sure all bundles we passed into resolver the same as what we are going to get from resolver.
    List<Content> restrictedReqs = new ArrayList<Content>();
    for (ResolveConstraint constraint : constraints ) {
      Content content = ManifestHeaderProcessor.parseContent(constraint.getBundleName(), constraint.getVersionRange().toString());
      restrictedReqs.add(content);
    }
   
    DeployedBundles deployedBundles = generateDeployedBundles (appMetadata,
        byValueBundles, restrictedReqs);
   
    Manifest man = generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
        appMetadata.getApplicationVersion().toString(), deployedBundles);
    _logger.debug(LOG_EXIT, "generateDeploymentManifest", new Object[] {man});
    return man;
  }
View Full Code Here

  @Test
  public void testManifestMetadata() throws Exception
  {
    ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
    InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION.MF");   
    ApplicationMetadata am = manager.parseApplicationMetadata(in);
    assertNotNull(am);

    assertEquals(am.getApplicationName(),appName);

    //"com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business",
    List<Content> contents = am.getApplicationContents();
    for (Content content : contents){
      if ("com.travel.reservation.web".equals(content.getContentName())){
        VersionRange vr = content.getVersion();
        assertEquals(vr.getMinimumVersion(),new Version("1.1.0"));
        assertEquals(vr.getMaximumVersion(),new Version("1.2.0"));
View Full Code Here

  {
    ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
   
    InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION2.MF");
   
    ApplicationMetadata am = manager.parseApplicationMetadata(in);
    assertNotNull(am);

    assertEquals(am.getApplicationName(),appName);

    //"com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business",
    List<Content> contents = am.getApplicationContents();
    for (Content content : contents){
      if ("com.travel.reservation.web".equals(content.getContentName())){
        VersionRange vr = content.getVersion();
        assertEquals(vr.getMinimumVersion(),new Version("1.1.0"));
        assertEquals(vr.getMaximumVersion(),new Version("1.2.0"));
View Full Code Here

  {
    ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
   
    InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION3.MF");
   
    ApplicationMetadata am = manager.parseApplicationMetadata(in);
    assertNotNull(am);

    assertEquals("Wrong number of bundles are in the application", 1, am.getApplicationContents().size());
    assertEquals("Wrong bundle name", "org.apache.aries.applications.test.bundle", am.getApplicationContents().get(0).getContentName());
  }
View Full Code Here

{
  @Test
  public void testBasicMetadataCreation() throws IOException
  {
    ApplicationMetadataFactory manager = new ApplicationMetadataFactoryImpl();
    ApplicationMetadata app = manager.parseApplicationMetadata(getClass().getResourceAsStream("/META-INF/APPLICATION.MF"));
   
    Assert.assertEquals("Travel Reservation", app.getApplicationName());
  }
View Full Code Here

  }
  @Test
  public void testMetadataCreation() throws Exception
  {
    ApplicationMetadataFactory manager = new ApplicationMetadataFactoryImpl();
    ApplicationMetadata app = manager.parseApplicationMetadata(getClass().getResourceAsStream("/META-INF/APPLICATION4.MF"));
    assertEquals("Travel Reservation", app.getApplicationName());
    assertEquals("com.travel.reservation", app.getApplicationSymbolicName());
    assertEquals(Version.parseVersion("1.2.0"), app.getApplicationVersion());
    List<Content> appContents = app.getApplicationContents();
    assertEquals(2, appContents.size());
    Content appContent1 = new ContentImpl("com.travel.reservation.business");
    NameValueMap<String, String> attrs = new NameValueMap<String, String>();
    attrs.addToCollection("version", "\"[1.1.0,1.2.0)\"");
    Content appContent2 = new ContentImpl("com.travel.reservation.web", attrs);
    assertTrue(appContents.contains(appContent2));
    assertTrue(appContents.contains(appContent1));
    List<ServiceDeclaration> importedService = app.getApplicationImportServices();
    assertEquals(2, importedService.size());
    assertTrue(importedService.contains(new ServiceDeclarationImpl("com.travel.flight.api")));
    assertTrue(importedService.contains(new ServiceDeclarationImpl("com.travel.rail.api")));
    List<ServiceDeclaration> exportedService = app.getApplicationExportServices();
    assertTrue(exportedService.contains(new ServiceDeclarationImpl("com.travel.reservation")));
   
   
  }
View Full Code Here

 
  @Test
  public void testCreate() throws Exception {
    AriesApplication app = createApplication (TEST_EBA);
   
    ApplicationMetadata appMeta = app.getApplicationMetadata();
    assertEquals (appMeta.getApplicationName(), "Test application");
    assertEquals (appMeta.getApplicationSymbolicName(), "org.apache.aries.application.management.test");
    assertEquals (appMeta.getApplicationVersion(), new Version("1.0"));
    List<Content> appContent = appMeta.getApplicationContents();
    assertEquals (appContent.size(), 2);
    Content fbw = new ContentImpl("foo.bar.widgets;version=1.0.0");
    Content mbl = new ContentImpl("my.business.logic;version=1.0.0");
    assertTrue (appContent.contains(fbw));
    assertTrue (appContent.contains(mbl));
View Full Code Here

TOP

Related Classes of org.apache.aries.application.ApplicationMetadata

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.