Package org.apache.aries.application

Examples of org.apache.aries.application.DeploymentMetadata


    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);
   
    DeploymentMetadata depMeta = app.getDeploymentMetadata();
   
    List<DeploymentContent> provision = depMeta.getApplicationProvisionBundles();
   
    assertEquals(provision.toString(), 3, provision.size());
   
    List<String> bundleSymbolicNames = new ArrayList<String>();
   
View Full Code Here


    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));
   
    DeploymentMetadata dm = app.getDeploymentMetadata();
    List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();

    assertEquals (2, dcList.size());
    DeploymentContent dc1 = new DeploymentContentImpl ("foo.bar.widgets;deployed-version=1.1.0");
    DeploymentContent dc2 = new DeploymentContentImpl ("my.business.logic;deployed-version=1.1.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));

  }
View Full Code Here

    assertNotNull (ifile);
    ifile = storedEba.getFile ("my.business.logic.jar");
    assertNotNull (ifile);
   
    AriesApplication newApp = _appMgr.createApplication(storedEba);
    DeploymentMetadata dm = newApp.getDeploymentMetadata();
    assertEquals (2, dm.getApplicationDeploymentContents().size());
    assertEquals(1, dm.getApplicationProvisionBundles().size());
    assertEquals (dm.getApplicationSymbolicName(), app.getApplicationMetadata().getApplicationSymbolicName());
    assertEquals (dm.getApplicationVersion(), app.getApplicationMetadata().getApplicationVersion());
  }
View Full Code Here

   * Create an AriesApplication from a .eba file: a zip file with a '.eba' extension
   * as per http://incubator.apache.org/aries/applications.html
   */
  public AriesApplication createApplication(IDirectory ebaFile) throws ManagementException {
    ApplicationMetadata applicationMetadata = null;
    DeploymentMetadata deploymentMetadata = null;
    Map<String, InputStream> modifiedBundles = new HashMap<String, InputStream>();
    AriesApplicationImpl application = null;
   
    try {
      Manifest applicationManifest = parseApplicationManifest (ebaFile);
View Full Code Here

  }

  public AriesApplication resolve(AriesApplication originalApp, ResolveConstraint... constraints) throws ResolverException {
    AriesApplicationImpl application = new AriesApplicationImpl(originalApp.getApplicationMetadata(), originalApp.getBundleInfo(), _localPlatform);
    Set<BundleInfo> additionalBundlesRequired = _resolver.resolve(application, constraints);
    DeploymentMetadata deploymentMetadata = _deploymentMetadataFactory.createDeploymentMetadata(application, additionalBundlesRequired);
    application.setDeploymentMetadata(deploymentMetadata);
    // Store a reference to any modified bundles
    if (originalApp instanceof AriesApplicationImpl) {
        // TODO: are we really passing streams around ?
        application.setModifiedBundles(((AriesApplicationImpl) originalApp).getModifiedBundles());
View Full Code Here

    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);
   
    DeploymentMetadata depMeta = app.getDeploymentMetadata();
   
    List<DeploymentContent> provision = depMeta.getApplicationProvisionBundles();
   
    assertEquals(provision.toString(), 2, provision.size());
   
    List<String> bundleSymbolicNames = new ArrayList<String>();
   
View Full Code Here

        if (resolver == null) {
            throw new ManagementException("AriesApplicationResolver service not found");
        }

        DeploymentMetadata meta = application.getDeploymentMetadata();
       
        List<DeploymentContent> bundlesToInstall = new ArrayList<DeploymentContent>();
        bundlesToInstall.addAll(meta.getApplicationDeploymentContents());
        bundlesToInstall.addAll(meta.getApplicationProvisionBundles());
       
        applicationBundles = new HashSet<Bundle>();
        try {
            for (DeploymentContent content : bundlesToInstall) {
                String bundleSymbolicName = content.getContentName();
View Full Code Here

    writer.close();
    repositoryAdmin.addRepository(new File("twitterRepo.xml").toURI().toURL());
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(twitterEbaUrl);
    app = manager.resolve(app);
    DeploymentMetadata depMeta = app.getDeploymentMetadata();
    List<DeploymentContent> provision = depMeta.getApplicationProvisionBundles();
    Collection<DeploymentContent> useBundles = depMeta.getDeployedUseBundle();
    Collection<DeploymentContent> appContent = depMeta.getApplicationDeploymentContents();
    // We cannot be sure whether there are two or three provision bundles pulled in by Felix OBR as there is an outstanding defect
    // https://issues.apache.org/jira/browse/FELIX-2672
    // The workaround is to check we get the two bundles we are looking for, instead of insisting on just having two bundles.
   
    List<String> provisionBundleSymbolicNames = new ArrayList<String>();
View Full Code Here

  public BundleFrameworkConfiguration createBundleFrameworkConfig(String frameworkId,
      BundleContext parentCtx, AriesApplication app)
  {

    BundleFrameworkConfiguration config = null;
    DeploymentMetadata metadata = app.getDeploymentMetadata();
    /**
     * Set up framework config properties
     */
    Properties frameworkConfig = new Properties();

    String flowedSystemPackages = EquinoxFrameworkUtils.calculateSystemPackagesToFlow(
        EquinoxFrameworkUtils.getSystemExtraPkgs(parentCtx), metadata.getImportPackage());
    frameworkConfig.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, flowedSystemPackages);

    /**
     * Set up BundleManifest for the framework bundle
     */
    Properties frameworkBundleManifest = new Properties();
    frameworkBundleManifest.put(Constants.BUNDLE_SYMBOLICNAME, metadata
        .getApplicationSymbolicName());
    frameworkBundleManifest.put(Constants.BUNDLE_VERSION, metadata.getApplicationVersion()
        .toString());

    /**
     * Set up Import-Package header for framework manifest
     */
    // Extract the import packages and remove anything we already have available in the current framework
    Collection<Content> imports = EquinoxFrameworkUtils.calculateImports(metadata
        .getImportPackage(), EquinoxFrameworkUtils.getExportPackages(parentCtx));

    if (imports != null && !imports.isEmpty()) {
      StringBuffer buffer = new StringBuffer();
      for (Content i : imports)
        buffer.append(EquinoxFrameworkUtils.contentToString(i) + ",");
      frameworkBundleManifest.put(Constants.IMPORT_PACKAGE, buffer
          .substring(0, buffer.length() - 1));
    }

    /**
     * Set up CompositeServiceFilter-Import header for framework manifest
     */
    StringBuffer serviceImportFilter = new StringBuffer("(" + Constants.OBJECTCLASS + "="
        + EquinoxFrameworkConstants.TRANSACTION_REGISTRY_BUNDLE + ")");

    for (Filter importFilter : metadata.getDeployedServiceImport()) {
      if (serviceImportFilter.length() > 0) {
        serviceImportFilter.append(",");
      }
      serviceImportFilter.append(importFilter.toString());
    }
View Full Code Here

    protected String getApplicationName() {
        return application.getApplicationMetadata().getApplicationScope();
    }
   
    private DeploymentMetadata getDeploymentMetadata(AriesApplicationResolver resolver, DeploymentMetadataFactory deploymentFactory) throws ResolverException {
        DeploymentMetadata meta = application.getDeploymentMetadata();
        if (meta == null) {
            // try to resolve the application
            LOG.debug("Resolving {} application.", getApplicationName());
            Set<BundleInfo> requiredBundles = resolver.resolve(application);
            meta = deploymentFactory.createDeploymentMetadata(application, requiredBundles);
View Full Code Here

TOP

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

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.