Examples of JarExporter


Examples of org.apache.jackrabbit.vault.fs.io.JarExporter

            }
            exporter = new PlatformExporter(localFile);
            ((PlatformExporter) exporter).setPruneMissing(cl.hasOption(optPrune));
            vCtx = app.createVaultContext(localFile);
        } else if (type.equals("jar")) {
            exporter = new JarExporter(localFile);
            vCtx = app.createVaultContext(localFile.getParentFile());
        } else {
            throw new Exception("Type " + type + " not supported");
        }
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.io.JarExporter

                localFile.mkdirs();
            }
            exporter = new PlatformExporter(localFile);
            ((PlatformExporter) exporter).setPruneMissing(cl.hasOption(optPrune));
        } else if (type.equals("jar")) {
            exporter = new JarExporter(localFile);
        } else {
            throw new Exception("Type " + type + " not supported");
        }
        if (jcrPath == null || !jcrPath.startsWith("/")) {
            exporter.setRelativePaths(true);
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.io.JarExporter

        MetaInf metaInf = opts.getMetaInf();
        if (metaInf == null) {
            metaInf = new DefaultMetaInf();
        }
        VaultFileSystem jcrfs = Mounter.mount(metaInf.getConfig(), metaInf.getFilter(), addr, opts.getRootPath(), s);
        JarExporter exporter = new JarExporter(out);
        exporter.setProperties(metaInf.getProperties());
        if (opts.getListener() != null) {
            exporter.setVerbose(opts.getListener());
        }
        if (opts.getPostProcessor() != null) {
            exporter.export(jcrfs.getRoot(), true);
            opts.getPostProcessor().process(exporter);
            exporter.close();
        } else {
            exporter.export(jcrfs.getRoot());
        }
        jcrfs.unmount();
    }
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.io.JarExporter

            throws IOException {
        MetaInf metaInf = opts.getMetaInf();
        if (metaInf == null) {
            metaInf = new DefaultMetaInf();
        }
        JarExporter exporter = new JarExporter(out);
        exporter.open();
        exporter.setProperties(metaInf.getProperties());
        ProgressTracker tracker = null;
        if (opts.getListener() != null) {
            tracker = new ProgressTracker();
            exporter.setVerbose(opts.getListener());
        }

        // merge
        MetaInf inf = opts.getMetaInf();
        ZipFile zip = new ZipFile(src.getFile(), ZipFile.OPEN_READ);
        if (opts.getPostProcessor() == null) {
            // no post processor, we keep all files except the properties
            Enumeration e = zip.entries();
            while (e.hasMoreElements()) {
                ZipEntry entry = (ZipEntry) e.nextElement();
                String path = entry.getName();
                if (!path.equals(Constants.META_DIR + "/" + Constants.PROPERTIES_XML)) {
                    exporter.write(zip, entry);
                }
            }
        } else {
            Set<String> keep = new HashSet<String>();
            keep.add(Constants.META_DIR + "/");
            keep.add(Constants.META_DIR + "/" + Constants.NODETYPES_CND);
            keep.add(Constants.META_DIR + "/" + Constants.CONFIG_XML);
            keep.add(Constants.META_DIR + "/" + Constants.FILTER_XML);
            Enumeration e = zip.entries();
            while (e.hasMoreElements()) {
                ZipEntry entry = (ZipEntry) e.nextElement();
                String path = entry.getName();
                if (!path.startsWith(Constants.META_DIR + "/") || keep.contains(path)) {
                    exporter.write(zip, entry);
                }
            }
        }
        zip.close();

        // write updated properties
        ByteArrayOutputStream tmpOut = new ByteArrayOutputStream();
        inf.getProperties().storeToXML(tmpOut, "FileVault Package Properties", "utf-8");
        exporter.writeFile(new ByteArrayInputStream(tmpOut.toByteArray()), Constants.META_DIR + "/" + Constants.PROPERTIES_XML);
        if (tracker != null) {
            tracker.track("A", Constants.META_DIR + "/" + Constants.PROPERTIES_XML);
        }

        if (opts.getPostProcessor() != null) {
            opts.getPostProcessor().process(exporter);
        }
        exporter.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.