Package org.apache.jackrabbit.vault.fs.io

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


    protected void extract(InstallContextImpl ctx,
                           List<String> subPackages)
            throws RepositoryException, PackageException {
        log.info("Extracting {}", getId());
        InstallHookProcessor hooks = ctx.getHooks();
        Importer importer = ctx.getImporter();
        try {
            if (!hooks.execute(ctx)) {
                throw new PackageException("Import aborted during prepare phase.");
            }
            try {
                importer.run(archive, ctx.getImportRoot());
            } catch (Exception e) {
                log.error("Error during install.", e);
                ctx.setPhase(InstallContext.Phase.INSTALL_FAILED);
                hooks.execute(ctx);
                throw new PackageException(e);
            }
            ctx.setPhase(InstallContext.Phase.INSTALLED);
            hooks.execute(ctx);
            if (importer.hasErrors() && ctx.getOptions().isStrict()) {
                ctx.setPhase(InstallContext.Phase.INSTALL_FAILED);
                hooks.execute(ctx);
                throw new PackageException("Errors during import.");
            }
        } finally {
            ctx.setPhase(InstallContext.Phase.END);
            hooks.execute(ctx);
        }
        if (subPackages != null) {
            subPackages.addAll(importer.getSubPackages());
        }
        log.info("Extracting {} completed.", getId());
    }
View Full Code Here


        try {
            Node rootNode = session.getNode(rootPath);
            String defPath = defNode.getPath().substring(1);

            Importer importer = new Importer();
            // disable saving
            importer.getOptions().setAutoSaveThreshold(Integer.MAX_VALUE);
            importer.getOptions().setFilter(filter);
            importer.run(archive, rootNode);

            // refresh defNode if it was replaced during unwrap
            defNode = session.getRootNode().getNode(defPath);

            // set props again
View Full Code Here

        if (localFile.isFile()) {
            archive = new ZipArchive(localFile);
        } else {
            archive = new FileArchive(localFile);
        }
        Importer importer = new Importer();
        if (verbose) {
            importer.getOptions().setListener(new DefaultProgressListener());
        }

        Session s = vaultFile.getFileSystem().getAggregateManager().getSession();
        Node importRoot = s.getNode(vaultFile.getPath());
        importer.run(archive, importRoot);
        VaultFsApp.log.info("Importing done.");
    }
View Full Code Here

            }
            archive = new FileArchive(localFile);
        }
        archive.open(false);
        try {
            Importer importer = new Importer();
            if (verbose) {
                importer.getOptions().setListener(new DefaultProgressListener());
            }
            Session s = vaultFile.getFileSystem().getAggregateManager().getSession();
            Node importRoot = s.getNode(vaultFile.getPath());
            importer.run(archive, importRoot);
        } finally {
            archive.close();
        }
        VaultFsApp.log.info("Importing done.");
    }
View Full Code Here

        try {
            Node rootNode = session.getNode(rootPath);
            String defPath = defNode.getPath().substring(1);

            Importer importer = new Importer();
            // disable saving
            importer.getOptions().setAutoSaveThreshold(Integer.MAX_VALUE);
            importer.getOptions().setFilter(filter);
            importer.run(archive, rootNode);

            // refresh defNode if it was replaced during unwrap
            defNode = session.getRootNode().getNode(defPath);

            // set props again
View Full Code Here

                log.error("Package extraction requires admin session.");
                throw new PackageException("Package extraction requires admin session (userid not allowed).");
            }
        }

        Importer importer = new Importer(opts);
        AccessControlHandling ac = getACHandling();
        if (opts.getAccessControlHandling() == null) {
            opts.setAccessControlHandling(ac);
        }
        String cndPattern = getProperty(NAME_CND_PATTERN);
View Full Code Here

    protected void extract(InstallContextImpl ctx,
                           List<String> subPackages)
            throws RepositoryException, PackageException {
        log.info("Extracting {}", getId());
        InstallHookProcessor hooks = ctx.getHooks();
        Importer importer = ctx.getImporter();
        try {
            if (!hooks.execute(ctx)) {
                throw new PackageException("Import aborted during prepare phase.");
            }
            try {
                importer.run(archive, ctx.getImportRoot());
            } catch (Exception e) {
                log.error("Error during install.", e);
                ctx.setPhase(InstallContext.Phase.INSTALL_FAILED);
                hooks.execute(ctx);
                throw new PackageException(e);
            }
            ctx.setPhase(InstallContext.Phase.INSTALLED);
            hooks.execute(ctx);
            if (importer.hasErrors() && ctx.getOptions().isStrict()) {
                ctx.setPhase(InstallContext.Phase.INSTALL_FAILED);
                hooks.execute(ctx);
                throw new PackageException("Errors during import.");
            }
        } finally {
            ctx.setPhase(InstallContext.Phase.END);
            hooks.execute(ctx);
        }
        if (subPackages != null) {
            subPackages.addAll(importer.getSubPackages());
        }
        log.info("Extracting {} completed.", getId());
    }
View Full Code Here

    public void testImport() throws IOException, RepositoryException, ConfigurationException {
        ZipArchive archive = new ZipArchive(getTempFile("testpackages/tmp.zip"));
        archive.open(true);
        Node rootNode = admin.getRootNode();
        ImportOptions opts = getDefaultOptions();
        Importer importer = new Importer(opts);
        importer.run(archive, rootNode);

        assertNodeExists("/tmp/foo/bar/tobi");
    }
View Full Code Here

        ZipArchive archive = new ZipArchive(getTempFile("testpackages/filtered_package.zip"));
        archive.open(true);
        Node rootNode = admin.getRootNode();
        ImportOptions opts = getDefaultOptions();

        Importer importer = new Importer(opts);
        importer.run(archive, rootNode);

        assertNodeExists("/tmp");
        assertNodeExists("/tmp/foo");
        assertNodeExists("/tmp/foo/bar");
        assertNodeExists("/tmp/foo/bar/tobi");
View Full Code Here

        ZipArchive archive = new ZipArchive(getTempFile("testpackages/unfiltered_package.zip"));
        archive.open(true);
        Node rootNode = admin.getRootNode();
        ImportOptions opts = getDefaultOptions();

        Importer importer = new Importer(opts);
        importer.run(archive, rootNode);

        assertNodeExists("/tmp");
        assertNodeExists("/tmp/foo");
        assertNodeExists("/tmp/foo/bar");
        assertNodeExists("/tmp/foo/bar/tobi");
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.fs.io.Importer

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.