Examples of PackageException


Examples of org.apache.jackrabbit.vault.packaging.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);
        }
View Full Code Here

Examples of org.apache.jackrabbit.vault.packaging.PackageException

     * {@inheritDoc}
     */
    public void uninstall(ImportOptions opts) throws RepositoryException, PackageException, IOException {
        JcrPackage snap = getSnapshot();
        if (snap == null) {
            throw new PackageException("Unable to uninstall package. No snapshot present.");
        }
        if (opts.getListener() != null) {
            opts.getListener().onMessage(ProgressTrackerListener.Mode.TEXT, "Uninstalling package from snapshot " + snap.getDefinition().getId(), "");
        }
        Session s = getNode().getSession();
View Full Code Here

Examples of org.apache.jackrabbit.vault.packaging.PackageException

     * {@inheritDoc}
     */
    public JcrPackage rename(JcrPackage pack, String group, String name, String version)
            throws PackageException, RepositoryException {
        if (!pack.isValid()) {
            throw new PackageException("Package is not valid.");
        }
        if (pack.getSize() > 0 && !pack.getDefinition().isUnwrapped()) {
            throw new PackageException("Package definition not unwrapped.");
        }
        if (!PackageId.isValid(group, name, version)) {
            throw new RepositoryException("Unable to rename package. Illegal package name.");
        }

        JcrPackageDefinition def = pack.getDefinition();
        PackageId id = def.getId();
        PackageId newId = new PackageId(
                group == null ? id.getGroup() : group,
                name == null ? id.getName() : name,
                version == null ? id.getVersion() : Version.create(version)
        );
        String dstPath = newId.getInstallationPath() + ".zip";
        if (id.equals(newId) && pack.getNode().getPath().equals(dstPath)) {
            log.info("Package id not changed. won't rename.");
            return pack;
        }
        def.setId(newId, false);

        // only move if not already at correct location
        if (!pack.getNode().getPath().equals(dstPath)) {
            if (session.nodeExists(dstPath)) {
                throw new PackageException("Node at " + dstPath + " already exists.");
            }
            // ensure parent path exists
            mkdir(Text.getRelativeParent(dstPath, 1), false);
            session.move(pack.getNode().getPath(), dstPath);
        }
View Full Code Here

Examples of org.apache.jackrabbit.vault.packaging.PackageException

        Node contentNode = packNode.getNode(JcrConstants.JCR_CONTENT);
        InputStream in;
        try {
            in = FileUtils.openInputStream(pack.getFile());
        } catch (IOException e) {
            throw new PackageException(e);
        }
        // stay jcr 1.0 compatible
        //noinspection deprecation
        contentNode.setProperty(JcrConstants.JCR_DATA, in);
        contentNode.setProperty(JcrConstants.JCR_LASTMODIFIED, now);
View Full Code Here

Examples of org.apache.jackrabbit.vault.packaging.PackageException

        List<JcrPackage> subs = listPackages(def.getMetaInf().getFilter());
        PackageId id = def.getId();
        for (JcrPackage p: subs) {
            // check if not include itself
            if (p.getDefinition().getId().equals(id)) {
                throw new PackageException("A package cannot include itself. Check filter definition.");
            }
            if (!p.isSealed()) {
                throw new PackageException("Only sealed (built) sub packages allowed: " + p.getDefinition().getId());
            }
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.vault.packaging.PackageException

        Node contentNode = packNode.getNode(JcrConstants.JCR_CONTENT);
        InputStream in;
        try {
            in = FileUtils.openInputStream(dst.getFile());
        } catch (IOException e) {
            throw new PackageException(e);
        }
        // stay jcr 1.0 compatible
        //noinspection deprecation
        contentNode.setProperty(JcrConstants.JCR_DATA, in);
        contentNode.setProperty(JcrConstants.JCR_LASTMODIFIED, now);
View Full Code Here

Examples of org.expath.pkg.repo.PackageException

                    handleElement(parser, pkg, info);
                }
                else {
                    // ignore elements not in the eXist Pkg namespace
                    // TODO: FIXME: Actually ignore (pass it.)
                    throw new PackageException("TODO: Ignore elements in other namespace");
                }
                parser.next();
            }
            // position to </package>
            parser.next();
        }
        catch ( final XMLStreamException ex ) {
            throw new PackageException("Error reading the exist descriptor", ex);
        }
        pkg.addInfo(getName(), info);
        // if the package has never been installed, install it now
        // TODO: This is not an ideal solution, but this should work in most of
        // the cases, and does not need xrepo to depend on any processor-specific
View Full Code Here

Examples of org.expath.pkg.repo.PackageException

        }
        else if ( "xquery".equals(local) ) {
            handleXQuery(parser, pkg, info);
        }
        else {
            throw new PackageException("Unknown eXist component type: " + local);
        }
    }
View Full Code Here

Examples of org.expath.pkg.repo.PackageException

        parser.next();
        try {
            info.addJava(new URI(href), clazz);
        }
        catch ( final URISyntaxException ex ) {
            throw new PackageException("Invalid URI: " + href, ex);
        }
    }
View Full Code Here

Examples of org.expath.pkg.repo.PackageException

        parser.next();
        try {
            info.addXQuery(new URI(href), file);
        }
        catch ( final URISyntaxException ex ) {
            throw new PackageException("Invalid URI: " + href, ex);
        }
    }
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.