Package org.apache.jackrabbit.vault.packaging

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


    /**
     * {@inheritDoc}
     */
    public void rewrap(JcrPackage pack, ProgressTrackerListener listener)
            throws PackageException, RepositoryException, IOException {
        VaultPackage src = pack.getPackage();

        Calendar now = Calendar.getInstance();
        pack.verifyId(true, false);
        JcrPackageDefinitionImpl def = (JcrPackageDefinitionImpl) pack.getDefinition();
        def.sealForRewrap(now, true);

        ExportOptions opts = new ExportOptions();
        opts.setMetaInf(def.getMetaInf());
        opts.setListener(listener);
        opts.setPostProcessor(def.getInjectProcessor());

        VaultPackage dst = rewrap(opts, src, (File) null);

        // update this content
        Node packNode = pack.getNode();
        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);
        contentNode.setProperty(JcrConstants.JCR_MIMETYPE, JcrPackage.MIME_TYPE);
        packNode.save();
        dst.close();
    }
View Full Code Here


     */
    public void tryUnwrap() throws IOException, RepositoryException {
        if (isValid()) {
            return;
        }
        VaultPackage pack = getPackage();
        Node content = getContent();
        boolean ok = false;
        try {
            content.addMixin(NT_VLT_PACKAGE);
            Node defNode = content.addNode(NN_VLT_DEFINITION);
View Full Code Here

        ExportOptions opts = new ExportOptions();
        opts.setMetaInf(def.getMetaInf());
        opts.setListener(listener);
        opts.setPostProcessor(def.getInjectProcessor());

        VaultPackage pack = assemble(packNode.getSession(), opts, (File) null);

        // update this content
        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);
        contentNode.setProperty(JcrConstants.JCR_MIMETYPE, JcrPackage.MIME_TYPE);
        packNode.save();
        pack.close();
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void rewrap(JcrPackage pack, ProgressTrackerListener listener)
            throws PackageException, RepositoryException, IOException {
        VaultPackage src = pack.getPackage();

        Calendar now = Calendar.getInstance();
        pack.verifyId(true, false);
        JcrPackageDefinitionImpl def = (JcrPackageDefinitionImpl) pack.getDefinition();
        def.sealForRewrap(now, true);

        ExportOptions opts = new ExportOptions();
        opts.setMetaInf(def.getMetaInf());
        opts.setListener(listener);
        opts.setPostProcessor(def.getInjectProcessor());

        VaultPackage dst = rewrap(opts, src, (File) null);

        // update this content
        Node packNode = pack.getNode();
        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);
        contentNode.setProperty(JcrConstants.JCR_MIMETYPE, JcrPackage.MIME_TYPE);
        packNode.save();
        dst.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.packaging.VaultPackage

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.