Examples of PackageId


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

     * @throws PackageException if an error occurrs.
     * @throws IOException if an error occurrs.
     */
    private JcrPackage snapshot(ExportOptions opts, boolean replace, AccessControlHandling acHandling)
            throws RepositoryException, PackageException, IOException {
        PackageId id = getSnapshotId();
        Node packNode = getPackageNode(id);
        if (packNode != null) {
            if (!replace) {
                log.warn("Refusing to recreate snapshot {}, already exists.", id);
                return null;
            } else {
                packNode.remove();
                node.getSession().save();
            }
        }
        log.info("Creating snapshot for {}.", id);
        JcrPackageManagerImpl packMgr = new JcrPackageManagerImpl(node.getSession());
        String path = id.getInstallationPath();
        String parentPath = Text.getRelativeParent(path, 1);
        Node folder = packMgr.mkdir(parentPath, true);
        JcrPackage snap = JcrPackageImpl.createNew(folder, id, null, true);
        JcrPackageDefinitionImpl snapDef = (JcrPackageDefinitionImpl) snap.getDefinition();
        JcrPackageDefinitionImpl myDef = (JcrPackageDefinitionImpl) getDefinition();
View Full Code Here

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

    /**
     * {@inheritDoc}
     */
    public JcrPackage getSnapshot() throws RepositoryException {
        PackageId id = getSnapshotId();
        Node packNode = getPackageNode(id);
        if (packNode != null) {
            JcrPackageImpl snap = new JcrPackageImpl(packNode);
            if (snap.isValid()) {
                return snap;
View Full Code Here

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

     * Returns the snapshot id of this package.
     * @return the snapshot package id
     * @throws RepositoryException if an error occurs
     */
    private PackageId getSnapshotId() throws RepositoryException {
        PackageId id = getDefinition().getId();
        String group = id.getGroup();
        if (group.length() == 0) {
            group = ".snapshot";
        } else {
            group += "/.snapshot";
        }
        return new PackageId(
                group,
                id.getName(),
                id.getVersion());
    }
View Full Code Here

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

        if (!getPackageRoot().hasNode(dependency.getGroup())) {
            return null;
        }
        Node groupNode = getPackageRoot().getNode(dependency.getGroup());
        NodeIterator iter = groupNode.getNodes();
        PackageId bestId = null;
        while (iter.hasNext()) {
            Node child = iter.nextNode();
            if (child.getName().equals(".snapshot")) {
                continue;
            }
            JcrPackageImpl pack = new JcrPackageImpl(child);
            if (pack.isValid()) {
                if (onlyInstalled && !pack.isInstalled()) {
                    continue;
                }
                PackageId id = pack.getDefinition().getId();
                if (dependency.matches(id)) {
                    if (bestId == null || id.getVersion().compareTo(bestId.getVersion()) > 0) {
                        bestId = id;
                    }
                }
            }
View Full Code Here

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

            pack.close();
            throw new IOException(msg);
        }

        // invalidate pid if path is unknown
        PackageId pid = pack.getId();
        if (pid != null && pid.getInstallationPath().equals(ZipVaultPackage.UNKNOWN_PATH)) {
            pid = null;
        }
        if (pid == null) {
            if (nameHint == null || nameHint.length() == 0) {
                throw new IOException("Package does not contain a path specification and not name hint is given.");
            }
            pid = new PackageId(nameHint);
        }
        // create parent node
        String path = pid.getInstallationPath() + ".zip";
        String parentPath = Text.getRelativeParent(path, 1);
        String name = Text.getName(path);
        Node parent = mkdir(parentPath, false);

        // remember installation state properties (GRANITE-2018)
View Full Code Here

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

    public JcrPackage create(Node folder, String name)
            throws RepositoryException, IOException {
        if (folder == null) {
            folder = getPackageRoot();
        }
        return JcrPackageImpl.createNew(folder, new PackageId(name), null, true);
    }
View Full Code Here

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

        // sanitize name
        String ext = Text.getName(name, '.');
        if (ext.equals("zip") || ext.equals("jar")) {
            name = name.substring(0, name.length() - 4);
        }
        PackageId pid = new PackageId(group, name, version);
        Node folder = mkdir(Text.getRelativeParent(pid.getInstallationPath(), 1), false);
        try {
            return JcrPackageImpl.createNew(folder, pid, null, false);
        } finally {
            session.save();
        }
View Full Code Here

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

        }
        if (pack.getSize() > 0 && !pack.getDefinition().isUnwrapped()) {
            throw new PackageException("Package definition not unwrapped.");
        }
        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);
View Full Code Here

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

     * {@inheritDoc}
     */
    private void validateSubPackages(JcrPackageDefinitionImpl def)
            throws RepositoryException, 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.");
            }
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.