Package org.apache.aries.application.utils.management

Examples of org.apache.aries.application.utils.management.SimpleBundleInfo


        }
        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
            // We only do this if a DEPLOYMENT.MF does not exist.
            BundleConversion convertedBinary = null;
View Full Code Here


    // 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);
    _resolver.setNextResult(nextResolverResult);
View Full Code Here

              IOUtils.jarUp(new File("../src/test/resources/conversion/conversion.eba/helloWorld.war"), convertedFile, warManifest);           
                final String location = toBeConverted.toString();               
              return new BundleConversion() {

          public BundleInfo getBundleInfo() throws IOException {
            return new SimpleBundleInfo(BundleManifest.fromBundle(convertedFile), location);
          }

          public InputStream getInputStream() throws IOException {
            return new FileInputStream(convertedFile);
          }
View Full Code Here

            if (url.getPath().endsWith("/")) {
                continue;
            }
            BundleManifest bm = BundleManifest.fromBundle(url.openStream());
            if (bm != null && bm.isValid()) {
                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, url.toExternalForm()));
            }
        }
       
        URL deploymentMF = bundle.getEntry(AppConstants.DEPLOYMENT_MF);
        if (deploymentMF != null) {
View Full Code Here

        for (File file : baseDir.listFiles()) {
            if (file.isDirectory()) {
                if (file.getName().endsWith(".jar")) {
                    BundleManifest bm = fromBundle(file);
                    if (bm != null && bm.isValid()) {
                        bundleInfos.add(new SimpleBundleInfo(applicationMetadataFactory, bm, "reference:" + file.toURI().toString()));               
                    }
                } else {
                    collectBundleInfos(file, applicationMetadataFactory, bundleInfos);
                    continue;
                }
            } else {
                BundleManifest bm = fromBundle(file);
                if (bm != null && bm.isValid()) {
                    /*
                     * Pass file:// url instead of reference:file:// as bundle location to make sure
                     * Equinox has its own copy of the jar. That is, to prevent strange ZipErrors when
                     * application bundles are updated at runtime, specifically, when
                     * ApplicationGBean.hotSwapApplicationContent() is called.
                     */
                    bundleInfos.add(new SimpleBundleInfo(applicationMetadataFactory, bm, file.toURI().toString()));               
                }
            }
        }
    }
View Full Code Here

            if (url.getPath().endsWith("/")) {
                continue;
            }
            BundleManifest bm = fromBundle(url.openStream());
            if (bm != null && bm.isValid()) {
                bundleInfos.add(new SimpleBundleInfo(applicationMetadataFactory, bm, url.toExternalForm()));
            }
        }
        return bundleInfos;
    }
View Full Code Here

    // 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(_appMetaFactory, mf, persistenceLibraryLocation);
    Field v = SimpleBundleInfo.class.getDeclaredField("_version");
    v.setAccessible(true);
    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
    nextResolverResult.add(resolvedPersistenceLibrary);
    _resolver.setNextResult(nextResolverResult);
View Full Code Here

        }
       
        BundleManifest bm = getBundleManifest (f);
        if (bm != null) {
          if (bm.isValid()) {
            extraBundlesInfo.add(new SimpleBundleInfo(_applicationMetadataFactory, bm, f.toURL().toExternalForm()));
          } else if (deploymentMetadata != null) {
            throw new ManagementException (MessageUtil.getMessage("APPMANAGEMENT0003E", f.getName(), ebaFile.getName()));
          } else {
            // We have a jar that needs converting to a bundle, or a war to migrate to a WAB
            InputStream convertedBinary = null;
            Iterator<BundleConverter> converters = _bundleConverters.iterator();
            List<ConversionException> conversionExceptions = Collections.emptyList();
            while (converters.hasNext() && convertedBinary == null) {
              try {
                convertedBinary = converters.next().convert(ebaFile, f);
              } catch (ServiceException sx) {
                // We'll get this if our optional BundleConverter has not been injected.
              } catch (ConversionException cx) {
                conversionExceptions.add(cx);
              }
            }
            if (conversionExceptions.size() > 0) {
              for (ConversionException cx : conversionExceptions) {
                _logger.error("APPMANAGEMENT0004E", new Object[]{f.getName(), ebaFile.getName(), cx});
              }
              throw new ManagementException (MessageUtil.getMessage("APPMANAGEMENT0005E", ebaFile.getName()));
            }
            if (convertedBinary != null) {
              modifiedBundles.put (f.getName(), convertedBinary);
              bm = BundleManifest.fromBundle(f);
              extraBundlesInfo.add(new SimpleBundleInfo(_applicationMetadataFactory, bm, f.getName()));
            }
          }
        }
      }
View Full Code Here

            if (url.getPath().endsWith("/")) {
                continue;
            }
            BundleManifest bm = BundleManifest.fromBundle(url.openStream());
            if (bm != null && bm.isValid()) {
                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, url.toExternalForm()));
            }
        }
    }
View Full Code Here

                 * Pass file:// url instead of reference:file:// as bundle location to make sure
                 * Equinox has its own copy of the jar. That is, to prevent strange ZipErrors when
                 * application bundles are updated at runtime, specifically, when
                 * ApplicationGBean.hotSwapApplicationContent() is called.
                 */
                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, file.toURI().toString()));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.aries.application.utils.management.SimpleBundleInfo

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.