Package org.apache.jackrabbit.vault.packaging

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


        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

            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

    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

        // 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

        }
        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

     * {@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

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

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.