Package org.apache.jackrabbit.vault.fs.api

Examples of org.apache.jackrabbit.vault.fs.api.Aggregate


            if (chain == null) {
              return null;
            }

            Aggregate aggregate = chain.get(chain.size() - 1);

            String fileOrFolderPathHint = calculateFileOrFolderPathHint(chain);

            String nameHint = PlatformNameFormat.getPlatformName(aggregate.getName());

            SerializationKind serializationKind = getSerializationKind(aggregate);

            if (resource.getPath().equals("/") || serializationKind == SerializationKind.METADATA_PARTIAL
                    || serializationKind == SerializationKind.FILE || serializationKind == SerializationKind.FOLDER) {
View Full Code Here


    private String calculateFileOrFolderPathHint(List<Aggregate> chain) throws RepositoryException {

        ListIterator<Aggregate> aggs = chain.listIterator();
        StringBuilder out = new StringBuilder();
        while (aggs.hasNext()) {
            Aggregate cur = aggs.next();
            if (aggs.previousIndex() == 0) {
                out.append(PlatformNameFormat.getPlatformPath(cur.getPath()));
            } else {
                out.append("/");
                out.append(PlatformNameFormat.getPlatformPath(cur.getRelPath()));
            }

            if (needsDir(cur)) {
                SerializationKind serializationKind = getSerializationKind(cur);
View Full Code Here

            String parentPath = Text.getRelativeParent(resource.getPath(), 1);
            while (!parentPath.equals("/")) {
                VaultFile parentFile = fs.getFile(PlatformNameFormat.getPlatformPath(parentPath));

                if (parentFile != null) {
                    Aggregate parentAggregate = parentFile.getAggregate();
                    ArrayList<Aggregate> parents = new ArrayList<Aggregate>();
                    parents.add(parentAggregate);
                    List<Aggregate> chain = lookForAggregateInLeaves(resource, parentAggregate, parents);
                    if (chain != null) {
                        return chain;
View Full Code Here

    }

    public ConsoleFile getFile(String path, boolean mustExist)
            throws IOException {
        try {
            Aggregate node = aggregate.getManager().getRoot();
            if (!path.equals("/")) {
                node = this.aggregate.getAggregate(path);
                if (node == null) {
                    throw new FileNotFoundException(path);
                }
View Full Code Here


    protected void formatFile(ConsoleFile file, Table.Row row, int flags) {
        try {
            boolean isDir = false;
            Aggregate f = (Aggregate) file.unwrap();
            if (f.allowsChildren()) {
                isDir = true;
            }
            if ((flags & F_FLAG_TYPE) > 0) {
                if (f.getArtifacts().isEmpty()) {
                    row.addCol("???");
                } else {
                    Artifact primary = f.getArtifacts().getPrimaryData();
                    if (primary == null) {
                        row.addCol("");
                    } else {
                        row.addCol(primary.getSerializationType().toString());
                    }
                }
            }
            row.addCol(f.getRelPath() + (isDir ? "/" : ""));
        } catch (RepositoryException e) {
            throw new ExecutionException(e);
        }
    }
View Full Code Here

                if (verbose) {
                    log.info("...scheduling MKD {}/{}", parent.getPath(), repoName);
                }
            } break;
            case DELETED: {
                Aggregate an = change.file.getAggregate();
                if (an == null) {
                    // intermediate directory
                    // can't handle here
                    assertInFilter(change.repoPath);
                    TxInfo txInfo = new TxInfo(change.repoPath, null);
                    txInfo.original.put(change.file.getPath(), change.file);
                    modified.put(txInfo.artifactsPath, txInfo);
                } else {
                    assertInFilter(an.getPath());
                    TxInfo txInfo = modified.get(an.getPath());
                    if (txInfo == null) {
                        txInfo = new TxInfo(an);
                        VaultFile dir = null;
                        for (VaultFile rel : change.file.getRelated()) {
                            txInfo.original.put(rel.getPath(), rel);
                            if (rel.isDirectory()) {
                                dir = rel;
                            }
                        }
                        modified.put(txInfo.artifactsPath, txInfo);
                        // set parent file
                        if (dir == null) {
                            txInfo.parentFile = change.file.getParent();
                        } else {
                            txInfo.parentFile = dir.getParent();
                        }
                    }
                    txInfo.out.getArtifacts().remove(change.file.getArtifact());
                    if (verbose) {
                        log.info("...scheduling DEL {}", an.getPath());
                    }
                }
            } break;
            case MODIFIED: {
                Aggregate an = change.file.getAggregate();
                TxInfo txInfo = modified.get(an.getPath());
                if (txInfo == null) {
                    txInfo = new TxInfo(an);
                    VaultFile dir = null;
                    for (VaultFile rel: change.file.getRelated()) {
                        txInfo.original.put(rel.getPath(), rel);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.fs.api.Aggregate

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.