Package org.modeshape.jcr.cache

Examples of org.modeshape.jcr.cache.DocumentStoreException


            Document document = read(new FileInputStream(sidecarFile));
            Map<Name, Property> results = new HashMap<Name, Property>();
            translator.getProperties(document, results);
            return results;
        } catch (IOException e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here


                    translator.setProperty(document, property, null, null);
                }
            }
            write(document, new FileOutputStream(sidecarFile));
        } catch (IOException e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here

                if (property == null) continue;
                translator.setProperty(document, property, null, null);
            }
            write(document, new FileOutputStream(sidecarFile));
        } catch (IOException e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here

                    result.put(property.getName(), property);
                }
            }
            return result;
        } catch (Throwable e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here

                    // Nothing was written, so remove the sidecar file ...
                    propertiesFile.delete();
                }
            }
        } catch (Throwable e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here

        if (count == 1) {
            msg = JcrI18n.couldNotStoreProperty.text(sourceName, id, names);
        } else {
            msg = JcrI18n.couldNotStoreProperties.text(sourceName, id, names);
        }
        throw new DocumentStoreException(id, msg);
    }
View Full Code Here

            if (directory.getAbsolutePath().equals(path)) {
                // This is the root
                return DELIMITER;
            }
            String msg = JcrI18n.fileConnectorNodeIdentifierIsNotWithinScopeOfConnector.text(getSourceName(), directoryPath, path);
            throw new DocumentStoreException(path, msg);
        }
        String id = path.substring(directoryAbsolutePathLength);
        id = id.replaceAll(Pattern.quote(FILE_SEPARATOR), DELIMITER);
        assert id.startsWith(DELIMITER);
        return id;
View Full Code Here

     */
    protected void checkFileNotExcluded( String id,
                                         File file ) {
        if (isExcluded(file)) {
            String msg = JcrI18n.fileConnectorCannotStoreFileThatIsExcluded.text(getSourceName(), id, file.getAbsolutePath());
            throw new DocumentStoreException(id, msg);
        }
    }
View Full Code Here

    public ExternalBinaryValue getBinaryValue( String id ) {
        try {
            File f = createFileForUrl(new URL(id));
            return binaryFor(f);
        } catch (IOException | URISyntaxException e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here

            parent.mkdirs();
        }
        if (!parent.canWrite()) {
            String parentPath = parent.getAbsolutePath();
            String msg = JcrI18n.fileConnectorCannotWriteToDirectory.text(getSourceName(), getClass(), parentPath);
            throw new DocumentStoreException(id, msg);
        }
        String primaryType = reader.getPrimaryTypeName();
        Map<Name, Property> properties = reader.getProperties();
        ExtraProperties extraProperties = extraPropertiesFor(id, false);
        extraProperties.addAll(properties).except(JCR_PRIMARY_TYPE, JCR_CREATED, JCR_LAST_MODIFIED, JCR_DATA);
        try {
            if (NT_FILE.equals(primaryType)) {
                file.createNewFile();
            } else if (NT_FOLDER.equals(primaryType)) {
                file.mkdirs();
            } else if (isContentNode(id)) {
                Property content = properties.get(JcrLexicon.DATA);
                BinaryValue binary = factories().getBinaryFactory().create(content.getFirstValue());
                OutputStream ostream = new BufferedOutputStream(new FileOutputStream(file));
                IoUtil.write(binary.getStream(), ostream);
                if (!NT_RESOURCE.equals(primaryType)) {
                    // This is the "jcr:content" child, but the primary type is non-standard so record it as an extra property
                    extraProperties.add(properties.get(JcrLexicon.PRIMARY_TYPE));
                }
            }
            extraProperties.save();
        } catch (RepositoryException | IOException e) {
            throw new DocumentStoreException(id, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.cache.DocumentStoreException

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.