Package org.fcrepo.server.journal

Examples of org.fcrepo.server.journal.JournalException


     * Advance past the document header to the first JournalEntry.
     */
    private void advanceIntoFile() throws XMLStreamException, JournalException {
        XMLEvent event = reader.nextEvent();
        if (!event.isStartDocument()) {
            throw new JournalException("Expecting XML document header, but event was '"
                    + event + "'");
        }

        event = reader.nextTag();
        if (!isStartTagEvent(event, QNAME_TAG_JOURNAL)) {
            throw new JournalException("Expecting FedoraJournal start tag, but event was '"
                    + event + "'");
        }

        String hash =
                getOptionalAttributeValue(event.asStartElement(),
View Full Code Here


            if (open) {
                reader.close();
                open = false;
            }
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

            fileWriter = createTempFile(tempFile);
            xmlWriter = createXmlEventWriter(fileWriter);
            this.parent.getDocumentHeader(xmlWriter);
            timer = createTimer(ageLimit);
        } catch (IOException e) {
            throw new JournalException(e);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

                JournalHelper.createTimestampedFilename(filenamePrefix,
                                                        new Date());
        File theFile = new File(journalDirectory, filename);

        if (theFile.exists()) {
            throw new JournalException("File '" + theFile.getPath()
                    + "' already exists.");
        }

        return theFile;
    }
View Full Code Here

     */
    private FileWriter createTempFile(File tempfile) throws IOException,
            JournalException {
        boolean created = tempfile.createNewFile();
        if (!created) {
            throw new JournalException("Unable to create file '"
                    + tempfile.getPath() + "'.");
        }
        return new FileWriter(tempfile);
    }
View Full Code Here

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

                open = false;
            } catch (XMLStreamException e) {
                throw new JournalException(e);
            } catch (IOException e) {
                throw new JournalException(e);
            }
        }
    }
View Full Code Here

                                                            Object[] args,
                                                            Map<String, String> parameters)
            throws JournalException {
        String className = parameters.get(parameterName);
        if (className == null) {
            throw new JournalException("No parameter '" + parameterName + "'");
        }
        return createInstanceFromClassname(className, argClasses, args);
    }
View Full Code Here

        try {
            Class<?> clazz = Class.forName(className);
            Constructor<?> constructor = clazz.getConstructor(argClasses);
            return constructor.newInstance(args);
        } catch (Exception e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

    public static Date parseDate(String date) throws JournalException {
        try {
            SimpleDateFormat parser = new SimpleDateFormat(TIMESTAMP_FORMAT);
            return parser.parse(date);
        } catch (ParseException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

        String newestFilename = journalFiles[journalFiles.length - 1].getName();
        String potentialFilename =
                JournalHelper.createTimestampedFilename(filenamePrefix,
                                                        new Date());
        if (newestFilename.compareTo(potentialFilename) > 0) {
            throw new JournalException("The name of one or more existing files in the journal "
                    + "directory (e.g. '"
                    + newestFilename
                    + "') may conflict with new Journal "
                    + "files. Has the system clock changed?");
        }
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.