Package org.apache.aries.application.management.spi.convert

Examples of org.apache.aries.application.management.spi.convert.BundleConversion


            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;
            Iterator<BundleConverter> converters = _bundleConverters.iterator();
            List<ConversionException> conversionExceptions = Collections.emptyList();
            while (converters.hasNext() && convertedBinary == null) {
              try {
              BundleConverter converter = converters.next();
              _logger.debug("Converting file using {} converter", converter);
                convertedBinary = converter.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(), appName, cx});
              }
              throw new ManagementException (MessageUtil.getMessage("APPMANAGEMENT0005E", appName));
            }
            if (convertedBinary != null) {
              _logger.debug("File {} was successfully converted. Adding it to bundle list.", f.getName());
              modifiedBundles.put (f.getName(), convertedBinary);            
              extraBundlesInfo.add(convertedBinary.getBundleInfo());
            } else {
              _logger.debug("File {} was not converted.", f.getName());
            }
          } else {
            _logger.debug("File {} was ignored. It is not a valid bundle and DEPLOYMENT.MF is present", f.getName());
View Full Code Here


              is = new FileInputStream(new File("../src/test/resources/conversion/MANIFEST.MF"));
              Manifest warManifest = new Manifest(is);          
              final File convertedFile = new File("./ariesApplicationManagerImplTest/conversion/helloWorld.war");
              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);
          }
View Full Code Here

                    public InputStream getInputStream() throws IOException {
                        return toBeConverted.open();
                    }
                }, toBeConverted.getName(), new Properties());
                           
                return new BundleConversion() {

          public BundleInfo getBundleInfo() throws IOException {
            return new SimpleBundleInfo(BundleManifest.fromBundle(conversion.getWAB()), toBeConverted.toString());
          }
View Full Code Here

                    public InputStream getInputStream() throws IOException {
                        return toBeConverted.open();
                    }
                }, toBeConverted.getName(), new Properties());
                           
                return new BundleConversion() {

          public BundleInfo getBundleInfo() throws IOException {
            return new SimpleBundleInfo(BundleManifest.fromBundle(conversion.getWAB()), toBeConverted.toString());
          }
View Full Code Here

              is = new FileInputStream(new File("../src/test/resources/conversion/MANIFEST.MF"));
              Manifest warManifest = new Manifest(is);          
              final File convertedFile = new File("./ariesApplicationManagerImplTest/conversion/helloWorld.war");
              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);
          }
View Full Code Here

          if (bm.isValid()) {
            extraBundlesInfo.add(new SimpleBundleInfo(bm, f.toURL().toExternalForm()));
          } else if (deploymentManifest == null) {
            // 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;
            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(), appName, cx});
              }
              throw new ManagementException (MessageUtil.getMessage("APPMANAGEMENT0005E", appName));
            }
            if (convertedBinary != null) {
              modifiedBundles.put (f.getName(), convertedBinary);            
              extraBundlesInfo.add(convertedBinary.getBundleInfo());
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.aries.application.management.spi.convert.BundleConversion

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.