Package org.apache.jackrabbit.vault.util

Examples of org.apache.jackrabbit.vault.util.FileInputSource


                    " Specify --force to overwrite remote files.");
        }
        try {
            switch (file.getStatus()) {
                case MODIFIED:
                    FileInputSource fis = new FileInputSource(file.getFile());
                    if (file.isBinary()) {
                        fis.setLineSeparator(LineOutputStream.LS_BINARY);
                    }
                    tx.modify(remoteFile, fis);
                    ctx.printMessage("sending....", file);
                    break;
                case DELETED:
                    tx.delete(remoteFile);
                    ctx.printMessage("deleting...", file);
                    break;
                case ADDED:
                    String path = this.getEntries().getPath();
                    if (path.endsWith("/")) {
                        path += file.getName();
                    } else {
                        path += "/" + file.getName();
                    }
                    if (file.canDescend()) {
                        tx.mkdir(path);
                    } else {
                        fis = new FileInputSource(file.getFile());
                        if (file.isBinary()) {
                            fis.setLineSeparator(LineOutputStream.LS_BINARY);
                        }
                        VaultFileOutput out = tx.add(path, fis);
                        // set the content type hint
                        out.setContentType(file.getContentType());
                    }
View Full Code Here


                return Type.DIRECTORY;
            }
        } else if (file.isFile()) {
            // check for vlt serialized XMLs and mark them as unsupported
            try {
                SerializationType type = XmlAnalyzer.analyze(new FileInputSource(file));
                if (type == SerializationType.XML_DOCVIEW) {
                    return Type.UNSUPPORTED;
                }
            } catch (IOException e) {
                log.warn("Unable to analyze {}: {}", file.getAbsolutePath(), e.toString());
View Full Code Here

    public VaultInputSource getInputSource(Entry entry) throws IOException {
        File file = entry == null ? null : ((OsEntry) entry).file;
        if (file == null || !file.isFile() || !file.canRead()) {
            return null;
        }
        return new FileInputSource(file);
    }
View Full Code Here

        }
    }

    private void doPut(File local, VaultFile remote) {
        try {
            FileInputSource is = new FileInputSource(local);
            VaultFsTransaction tx = remote.getFileSystem().startTransaction();
            tx.modify(remote, is);
            tx.commit();
            System.out.println(local.getName() + "  " + local.length() + " bytes.");
        } catch (IOException e) {
View Full Code Here

        }
    }

    private void doAdd(File local, VaultFile parent, String path) {
        try {
            FileInputSource is = new FileInputSource(local);
            VaultFsTransaction tx = parent.getFileSystem().startTransaction();
            tx.add(path, is);
            tx.commit();
            System.out.println(local.getName() + "  " + local.length() + " bytes.");
        } catch (IOException e) {
View Full Code Here

    }

    public VltEntries getEntries() throws VltException {
        if (entries == null) {
            if (entriesFile.exists()) {
                entries = XmlEntries.load(new FileInputSource(entriesFile));
            }
        }
        return entries;
    }
View Full Code Here

    }

    public void close() throws IOException, RepositoryException {
        if (out != null) {
            out.close();
            is = new FileInputSource(tmpFile);
            tx.setInputSource(is);
        }
    }
View Full Code Here

    public VaultInputSource getInputSource(Entry entry) throws IOException {
        File file = entry == null ? null : ((OsEntry) entry).file;
        if (file == null || !file.isFile() || !file.canRead()) {
            return null;
        }
        return new FileInputSource(file);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.util.FileInputSource

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.