Package org.apache.chemistry.opencmis.commons.exceptions

Examples of org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException


            if (node.isCheckedOut()) {
                if (isPwc) {
                    cancelCheckout(node);
                }
                else {
                    throw new CmisStorageException("Cannot delete checked out document: " + getId());
                }
            }
            else if (allVersions) {
                checkout(node);
                node.remove();
View Full Code Here


    public JcrVersion checkin(Properties properties, ContentStream contentStream, String checkinComment) {
        Node node = getNode();

        try {
            if (!node.isCheckedOut()) {
                throw new CmisStorageException("Not checked out: " + getId());
            }

            if (properties != null && !properties.getPropertyList().isEmpty()) {
                updateProperties(properties);
            }
View Full Code Here

        // create the file
        try {
            newFile.createNewFile();
        } catch (IOException e) {
            throw new CmisStorageException("Could not create file: " + e.getMessage());
        }

        // write content, if available
        if ((contentStream != null) && (contentStream.getStream() != null)) {
            try {
                OutputStream out = new BufferedOutputStream(new FileOutputStream(newFile), BUFFER_SIZE);
                InputStream in = new BufferedInputStream(contentStream.getStream(), BUFFER_SIZE);

                byte[] buffer = new byte[BUFFER_SIZE];
                int b;
                while ((b = in.read(buffer)) > -1) {
                    out.write(buffer, 0, b);
                }

                out.flush();
                out.close();
                in.close();
            } catch (Exception e) {
                throw new CmisStorageException("Could not write content: " + e.getMessage(), e);
            }
        }

        // write properties
        writePropertiesFile(newFile, props);
View Full Code Here

        // create the file
        try {
            newFile.createNewFile();
        } catch (IOException e) {
            throw new CmisStorageException("Could not create file: " + e.getMessage(), e);
        }

        // copy content
        try {
            OutputStream out = new BufferedOutputStream(new FileOutputStream(newFile));
            InputStream in = new BufferedInputStream(new FileInputStream(source));

            byte[] buffer = new byte[BUFFER_SIZE];
            int b;
            while ((b = in.read(buffer)) > -1) {
                out.write(buffer, 0, b);
            }

            out.flush();
            out.close();
            in.close();
        } catch (Exception e) {
            throw new CmisStorageException("Could not roead or write content: " + e.getMessage(), e);
        }

        // write properties
        writePropertiesFile(newFile, newProperties);
View Full Code Here

        }

        // create the folder
        File newFolder = new File(parent, name);
        if (!newFolder.mkdir()) {
            throw new CmisStorageException("Could not create folder!");
        }

        // write properties
        writePropertiesFile(newFolder, props);
View Full Code Here

        File parent = getFile(targetFolderId);

        // build new path
        File newFile = new File(parent, file.getName());
        if (newFile.exists()) {
            throw new CmisStorageException("Object already exists!");
        }

        // move it
        if (!file.renameTo(newFile)) {
            throw new CmisStorageException("Move failed!");
        } else {
            // set new id
            objectId.setValue(getId(newFile));

            // if it is a file, move properties file too
View Full Code Here

                in.close();
            }

            out.close();
        } catch (Exception e) {
            throw new CmisStorageException("Could not write content: " + e.getMessage(), e);
        }
    }
View Full Code Here

        }

        // delete properties and actual file
        getPropertiesFile(file).delete();
        if (!file.delete()) {
            throw new CmisStorageException("Deletion failed!");
        }
    }
View Full Code Here

            Marshaller m = JaxBHelper.createMarshaller();
            m.setProperty("jaxb.formatted.output", true);
            m.marshal(objElement, propFile);
        } catch (Exception e) {
            throw new CmisStorageException("Couldn't store properties!", e);
        }
    }
View Full Code Here

        case PERMISSION_DENIED:
            return new CmisPermissionDeniedException(msg, code);
        case RUNTIME:
            return new CmisRuntimeException(msg, code);
        case STORAGE:
            return new CmisStorageException(msg, code);
        case STREAM_NOT_SUPPORTED:
            return new CmisStreamNotSupportedException(msg, code);
        case UPDATE_CONFLICT:
            return new CmisUpdateConflictException(msg, code);
        case VERSIONING:
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException

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.