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

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


    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        else if (obj instanceof Artifact) {
            Artifact a = (Artifact) obj;
            return getRelativePath().equals(a.getRelativePath()) && type == a.getType();
        }
        return false;
    }
View Full Code Here


                        }
                    }
                }, fs.getAggregateManager().getSession(), repoParentPath, input);
            // create artifact
            String parentExt = parentPath.endsWith(".dir") ? ".dir" : "";
            Artifact parent = new DirectoryArtifact(Text.getName(repoParentPath), parentExt);
            InputSourceArtifact isa = new InputSourceArtifact(
                    parent,
                    Constants.DOT_CONTENT_XML,
                    "",
                    ArtifactType.PRIMARY, input,
View Full Code Here

     *
     * @param a the artifact to put
     * @return the previous artifact or <code>null</code>
     */
    public Artifact put(Artifact a) {
        Artifact prev = null;
        int idx = artifacts.indexOf(a);
        if (idx >=0) {
            prev = artifacts.remove(idx);
        }
        single.put(a.getType(), a);
View Full Code Here

            } else {
                node = node.addNode(JcrConstants.JCR_CONTENT, JcrConstants.NT_RESOURCE);
            }
        }

        Artifact a = info.artifacts.get(0);
        // Keep track of whether this file got modified
        boolean modified = false;
        // Set the jcr:data property
        ValueFactory factory = node.getSession().getValueFactory();
        Value value = factory.createValue(a.getInputStream());
        if (node.hasProperty(JcrConstants.JCR_DATA)) {
            Property data = node.getProperty(JcrConstants.JCR_DATA);
            if (!value.equals(data.getValue())) {
                data.setValue(value);
                // mark jcr:data as modified.
                importInfo.onModified(data.getPath());
                modified = true;
            }
        } else {
            Property data = node.setProperty(JcrConstants.JCR_DATA, value);
            // mark jcr:data as created
            importInfo.onCreated(data.getPath());
            modified = true;
        }

        // always update last modified if binary was modified (bug #22969)
        if (!node.hasProperty(JcrConstants.JCR_LASTMODIFIED) || modified) {
            Calendar lastModified = Calendar.getInstance();
            node.setProperty(JcrConstants.JCR_LASTMODIFIED, lastModified);
            modified = true;
        }
        // do not overwrite mimetype
        if (!node.hasProperty(JcrConstants.JCR_MIMETYPE)) {
            String mimeType = a.getContentType();
            if (mimeType == null) {
                mimeType = Text.getName(a.getRelativePath(), '.');
                mimeType = MimeTypes.getMimeType(mimeType, MimeTypes.APPLICATION_OCTET_STREAM);
            }
            node.setProperty(JcrConstants.JCR_MIMETYPE, mimeType);
            modified = true;
        }
View Full Code Here

        public Value[] getValues(Session session)
                throws RepositoryException, IOException {
            Value[] values = new Value[artifacts.size()];
            for (int i=0; i<values.length; i++) {
                Artifact a = artifacts.get(i);
                values[i] = session.getValueFactory().createValue(a.getInputStream());
            }
            return values;
        }
View Full Code Here

            return values;
        }

        public Value getValue(Session session)
                throws RepositoryException, IOException {
            Artifact a = artifacts.get(0);
            return session.getValueFactory().createValue(a.getInputStream());
        }
View Full Code Here

                    repoName = repoName.substring(0, repoName.length() - 4);
                    repoPath = parentInfo.path + "/" + repoName;
                }
                TxInfo info = parentInfo.addChild(new TxInfo(parentInfo, repoPath));
                log.debug("Creating directory artifact for {}", repoName);
                Artifact parent = new DirectoryArtifact(repoName);
                info.artifacts.add(parent);

                Archive.Entry contentXml = file.getChild(Constants.DOT_CONTENT_XML);
                if (contentXml != null) {
                    if (contentXml.isDirectory()) {
View Full Code Here

        }

        // need at least a file or binary artifact
        if (artifacts.size(ArtifactType.FILE) > 0 || artifacts.size(ArtifactType.BINARY) > 0) {
            // check if the generic handler can import something
            Artifact primary = artifacts.getPrimaryData();
            if (primary != null) {
                if (info == null) {
                    info = new ImportInfoImpl();
                }
                // check import mode
                ImportMode mode = ImportMode.REPLACE;
                String path = PathUtil.getPath(parent, primary.getRelativePath());
                if (primary.getRelativePath().length() == 0 || parent.hasNode(primary.getRelativePath())) {
                    mode = wspFilter.getImportMode(path);
                }
                // only update if not MERGE (i.e. is REPLACE or UPDATE)
                if (mode != ImportMode.MERGE) {
                    InputSource source = primary.getInputSource();
                    if (source != null) {
                        info.merge(importDocView(parent, source, artifacts, wspFilter));
                    }
                } else {
                    info.onNop(path);
View Full Code Here

TOP

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

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.