Package org.apache.aries.util.manifest

Examples of org.apache.aries.util.manifest.BundleManifest


      Set<BundleInfo> extraBundlesInfo = new HashSet<BundleInfo>();
      for (IFile f : ebaFile) {
        if (f.isDirectory()) {
          continue;
        }
        BundleManifest bm = getBundleManifest (f);
        if (bm != null) {
          if (bm.isValid()) {
            _logger.debug("File {} is a valid bundle. Adding it to bundle list.", f.getName());
            extraBundlesInfo.add(new SimpleBundleInfo(bm, f.toURL().toExternalForm()));
          } else if (deploymentManifest == null) {
            _logger.debug("File {} is not a valid bundle. Attempting to convert it.", f.getName());
            // We have a jar that needs converting to a bundle, or a war to migrate to a WAB
View Full Code Here


   * Extract a bundle manifest from an IFile representing a bundle
   * @param file The bundle to extract the manifest from
   * @return bundle manifest
   */
  private BundleManifest getBundleManifest(IFile file) throws IOException {
    BundleManifest mf = null;
    InputStream in = null;
    try {
      in = file.open();
      mf = BundleManifest.fromBundle(in);
    } finally {
View Full Code Here

    // find we need a String-based BundleInfoImpl constructor for other reasons,
    // we could change to using it here.
    Set<BundleInfo> nextResolverResult = new HashSet<BundleInfo>();
    String persistenceLibraryLocation = "../src/test/resources/bundles/repository/a.handy.persistence.library.jar";
    File persistenceLibrary = new File (persistenceLibraryLocation);
    BundleManifest mf = BundleManifest.fromBundle(persistenceLibrary);
    BundleInfo resolvedPersistenceLibrary = new SimpleBundleInfo(mf, persistenceLibraryLocation);
    Field v = SimpleBundleInfo.class.getDeclaredField("_version");
    v.setAccessible(true);
    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
    nextResolverResult.add(resolvedPersistenceLibrary);
View Full Code Here

      }
      deploymentMap.put(AppConstants.DEPLOYMENT_CONTENT, deployedContents.toString());
      // fake the provision bundle now.
      String persistenceLibraryLocation = "../src/test/resources/bundles/repository/a.handy.persistence.library.jar";
      File persistenceLibrary = new File (persistenceLibraryLocation);
      BundleManifest mf = BundleManifest.fromBundle(persistenceLibrary);
     
      deploymentMap.put(AppConstants.DEPLOYMENT_PROVISION_BUNDLE, mf.getSymbolicName()+";" + AppConstants.DEPLOYMENT_BUNDLE_VERSION + "=" + mf.getVersion());
      deploymentMap.put(AppConstants.APPLICATION_SYMBOLIC_NAME, app.getApplicationMetadata().getApplicationSymbolicName());
    
      deploymentMap.put(AppConstants.APPLICATION_VERSION, app.getApplicationMetadata().getApplicationVersion().toString());
     
     
View Full Code Here

   * Check whether a file is a bundle.
   * @param file the file path
   * @return
   */
  public static boolean isBundle(File file) {
    BundleManifest bm = BundleManifest.fromBundle(file);
    return ((bm != null) && (bm.isValid()));
  }
View Full Code Here

  }
 
  @Test
  public void testExploded()
  {
    BundleManifest sut = BundleManifest.fromBundle(new File("../src/test/resources/bundles/exploded.jar"));
    assertEquals("com.ibm.test", sut.getSymbolicName());
    assertEquals("1.0.0", sut.getVersion().toString());
  }
View Full Code Here

    // make sure that the manifest is not the first file in the jar archive
    JarInputStream jarIs = new JarInputStream(new FileInputStream(_testfile));
    assertNull(jarIs.getManifest());
    jarIs.close();
   
    BundleManifest sut = BundleManifest.fromBundle(_testfile);
    assertEquals("com.ibm.test", sut.getSymbolicName());
    assertEquals("1.0.0", sut.getVersion().toString());
  }
View Full Code Here

   * @param builder the builder to append to.
   */
  private static void processPossibleBundle(IFile file, StringBuilder builder)
  {
    if (file.isDirectory() || (file.isFile() && (file.getName().endsWith(".jar") || file.getName().endsWith(".war")))) {
      BundleManifest bundleMf = BundleManifest.fromBundle(file);
      if (bundleMf != null) {
        String manifestVersion = bundleMf.getManifestVersion();
        String name = bundleMf.getSymbolicName();
        String version = bundleMf.getVersion().toString();

        // if the bundle manifest version is 2 AND a symbolic name is specified we have a valid bundle
        if ("2".equals(manifestVersion) && name != null) {

          builder.append(name);
View Full Code Here

 
  @Test
  public void testModelServicesNoExportEJB() throws ModellerException {
    Manifest man = new Manifest();
    setBasicHeaders(man);
    modeller.modelServices(new BundleManifest(man), bundleLocation);
    ejbLocator.assertSkeletonNotCalled();
  }
View Full Code Here

  @Test
  public void testModelServicesEmptyExportEJB() throws ModellerException {
    Manifest man = new Manifest();
    setBasicHeaders(man);
    man.getMainAttributes().putValue("Export-EJB", "");
    modeller.modelServices(new BundleManifest(man), bundleLocation);
    ejbLocator.assertCalled(new MethodCall(EJBLocator.class, "findEJBs", BundleManifest.class,
            bundleLocation, ParsedEJBServices.class));
  }
View Full Code Here

TOP

Related Classes of org.apache.aries.util.manifest.BundleManifest

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.