Package org.fcrepo.server.journal

Examples of org.fcrepo.server.journal.JournalException


    /**
     * Complain when we were expecting a end tag, and didn't find it.
     */
    protected JournalException getNotEndTagException(QName tagName,
                                                     XMLEvent event) {
        return new JournalException("Expecting '" + tagName
                + "' end tag, but event was '" + event + "'");

    }
View Full Code Here


     * If we encounter an unexpected event when reading the journal file, create
     * an exception with all of the pertinent information.
     */
    protected JournalException getNotCharactersException(QName tagName,
                                                         XMLEvent event) {
        return new JournalException("Expecting characters or '" + tagName
                + "' end tag, but event was '" + event + "'");
    }
View Full Code Here

     * another member tag, or the end of the group.
     */
    protected JournalException getNotNextMemberOrEndOfGroupException(QName groupTagName,
                                                                     QName memberTagName,
                                                                     XMLEvent event) {
        return new JournalException("Expecting either '" + memberTagName
                + "' start tag, or '" + groupTagName
                + "' end tag, but event was '" + event + "'");
    }
View Full Code Here

    private final XMLEventReader xmlReader;

    public JournalInputFile(File file)
            throws JournalException {
        if (!file.isFile()) {
            throw new JournalException("Journal file '" + file.getPath()
                    + "' is not a file.");
        }
        if (!file.canRead()) {
            throw new JournalException("Journal file '" + file.getPath()
                    + "' is not readable.");
        }

        try {
            this.file = file;
            XMLInputFactory factory = XMLInputFactory.newInstance();
            fileReader = new FileReader(file);
            xmlReader = factory.createXMLEventReader(fileReader);
        } catch (FileNotFoundException e) {
            throw new JournalException(e);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

             * following line, and check for exception...
             */
            try {
                FileMovingUtil.move(file, archiveFile);
            } catch (IOException e) {
                throw new JournalException("Failed to rename file from '"
                        + file.getPath() + "' to '" + archiveFile.getPath()
                        + "'", e);
            }
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        } catch (IOException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

        } else if (string.equals(VALUE_FALSE)) {
            return false;
        } else if (string.equals(VALUE_TRUE)) {
            return true;
        } else {
            throw new JournalException("'" + parameterName
                    + "' parameter must be '" + VALUE_FALSE + "'(default) or '"
                    + VALUE_TRUE + "'");
        }

    }
View Full Code Here

    public static File parseParametersForWritableDirectory(Map<String, String> parameters,
                                                           String parameterName)
            throws JournalException {
        String directoryString = parameters.get(parameterName);
        if (directoryString == null) {
            throw new JournalException("'" + parameterName + "' is required.");
        }
        File directory = new File(directoryString);
        if (!directory.exists()) {
            throw new JournalException("Directory '" + directory
                    + "' does not exist.");
        }
        if (!directory.isDirectory()) {
            throw new JournalException("Directory '" + directory
                    + "' is not a directory.");
        }
        if (!directory.canWrite()) {
            throw new JournalException("Directory '" + directory
                    + "' is not writable.");
        }
        return directory;
    }
View Full Code Here

                                           PARAMETER_JOURNAL_FILE_SIZE_LIMIT,
                                           DEFAULT_SIZE_LIMIT);
        Pattern p = Pattern.compile("([0-9]+)([KMG]?)");
        Matcher m = p.matcher(sizeString);
        if (!m.matches()) {
            throw new JournalException("Parameter '"
                    + PARAMETER_JOURNAL_FILE_SIZE_LIMIT
                    + "' must be an integer number of bytes, "
                    + "optionally followed by 'K', 'M', or 'G', "
                    + "or a 0 to indicate no size limit");
        }
View Full Code Here

                                                    PARAMETER_JOURNAL_FILE_AGE_LIMIT,
                                                    DEFAULT_AGE_LIMIT);
        Pattern p = Pattern.compile("([0-9]+)([DHM]?)");
        Matcher m = p.matcher(ageString);
        if (!m.matches()) {
            throw new JournalException("Parameter '"
                    + PARAMETER_JOURNAL_FILE_AGE_LIMIT
                    + "' must be an integer number of seconds, optionally "
                    + "followed by 'D'(days), 'H'(hours), or 'M'(minutes), "
                    + "or a 0 to indicate no age limit");
        }
View Full Code Here

            try {
                if (!lockAcceptedFile.exists()) {
                    lockAcceptedFile.createNewFile();
                }
            } catch (IOException e) {
                throw new JournalException("Unable to create 'Lock Accepted' file at '"
                        + lockAcceptedFile.getPath() + "'");
            }
            locked = true;
        } else {
            if (lockAcceptedFile.exists()) {
View Full Code Here

TOP

Related Classes of org.fcrepo.server.journal.JournalException

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.