Package org.apache.aries.application

Examples of org.apache.aries.application.ApplicationMetadataFactory


    public Artifact getConfigurationID(Object plan,
                                       JarFile jarFile,
                                       ModuleIDBuilder idBuilder)
        throws IOException, DeploymentException {
        ApplicationMetadataFactory factory = getApplicationMetadataFactory();
        IDirectory ebaFile = FileSystem.getFSRoot(new File(jarFile.getName()));
        IFile applicationManifestFile = ebaFile.getFile(AppConstants.APPLICATION_MF);
        Manifest applicationManifest;
        if (applicationManifestFile != null) {
            InputStream in = applicationManifestFile.open();
            try {
                applicationManifest = ManifestProcessor.parseManifest(in);
            } finally {
                try { in.close(); } catch (IOException ignore) {}
            }
        } else {
            applicationManifest = new Manifest();
        }
        ManifestDefaultsInjector.updateManifest(applicationManifest, ebaFile.getName(), ebaFile);
        ApplicationMetadata metadata = factory.createApplicationMetadata(applicationManifest);
        return ApplicationInstaller.getConfigId(metadata);
    }
View Full Code Here


        this.configId = configId;
               
        BundleContext bundleContext = bundle.getBundleContext();

        DeploymentMetadataFactory deploymentFactory = null;
        ApplicationMetadataFactory applicationFactory  = null;
       
        ServiceReference deploymentFactoryReference =
            bundleContext.getServiceReference(DeploymentMetadataFactory.class.getName());
        ServiceReference applicationFactoryReference =
            bundleContext.getServiceReference(ApplicationMetadataFactory.class.getName());
View Full Code Here

public class ApplicationMetadataImplTest
{
  @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

    Assert.assertEquals("Travel Reservation", app.getApplicationName());
  }
  @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());
View Full Code Here

        }
        return service;
    }
   
    public ApplicationMetadataFactory getApplicationMetadataFactory() throws ManagementException {
        ApplicationMetadataFactory service = (ApplicationMetadataFactory) applicationFactoryTracker.getService();
        if (service == null) {
            throw new ManagementException(new ServiceException(ApplicationMetadataFactory.class.getName(), ServiceException.UNREGISTERED));          
        }
        return service;
    }
View Full Code Here

            JarUtils.close(jarFile);
        }
    }
   
    private Set<BundleInfo> getBundleInfos(File baseDir) throws IOException, ManagementException {
        ApplicationMetadataFactory applicationMetadataFactory = getApplicationMetadataFactory();
        Set<BundleInfo> bundleInfos = new HashSet<BundleInfo>();
        collectBundleInfos(baseDir, applicationMetadataFactory, bundleInfos);
        return bundleInfos;
    }
View Full Code Here

            IOUtils.close(jarInputStream);
        }
    }
   
    private Set<BundleInfo> getBundleInfos(Bundle bundle) throws IOException, ManagementException {
        ApplicationMetadataFactory applicationMetadataFactory = getApplicationMetadataFactory();
        Set<BundleInfo> bundleInfos = new HashSet<BundleInfo>();
        Enumeration<URL> e = bundle.findEntries("/", "*", true);
        while (e.hasMoreElements()) {
            URL url = e.nextElement();
            if (url.getPath().endsWith("/")) {
View Full Code Here

    TransformerFactory.newInstance().newTransformer().transform(new DOMSource(doc), new StreamResult(System.out));
  }

  private BundleInfo createBundleInfo(String urlToBundle) throws Exception
  {
    ApplicationMetadataFactory factory = getOsgiService(ApplicationMetadataFactory.class);
   
    Bundle b = getBundle("org.apache.aries.application.management");
    @SuppressWarnings("unchecked")
    Class<BundleInfo> clazz = b.loadClass("org.apache.aries.application.utils.management.SimpleBundleInfo");
    Constructor<BundleInfo> c = clazz.getConstructor(ApplicationMetadataFactory.class, BundleManifest.class, String.class);
View Full Code Here

   
    public Artifact getConfigurationID(Object plan,
                                       JarFile jarFile,
                                       ModuleIDBuilder idBuilder)
        throws IOException, DeploymentException {       
        ApplicationMetadataFactory factory = getApplicationMetadataFactory();       
        IDirectory ebaFile = FileSystem.getFSRoot(new File(jarFile.getName()));       
        IFile applicationManifestFile = ebaFile.getFile(AppConstants.APPLICATION_MF);
        Manifest applicationManifest;
        if (applicationManifestFile != null) {
            InputStream in = applicationManifestFile.open();
            try {
                applicationManifest = ManifestProcessor.parseManifest(in);
            } finally {
                try { in.close(); } catch (IOException ignore) {}
            }
        } else {
            applicationManifest = new Manifest();
        }
        ManifestDefaultsInjector.updateManifest(applicationManifest, ebaFile.getName(), ebaFile);
        ApplicationMetadata metadata = factory.createApplicationMetadata(applicationManifest);
        return ApplicationInstaller.getConfigId(metadata);       
    }
View Full Code Here

        this.configId = configId;
               
        // XXX: fix me
        BundleContext bundleContext = bundle.getBundleContext();
        DeploymentMetadataFactory deploymentFactory = getDeploymentMetadataFactory(bundleContext);
        ApplicationMetadataFactory applicationFactory = getApplicationMetadataFactory(bundleContext);
       
        this.application = new GeronimoApplication(bundle, applicationFactory, deploymentFactory);
       
        install();
       
View Full Code Here

TOP

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

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.