Package org.fcrepo.server.journal

Examples of org.fcrepo.server.journal.JournalException


                                   ServerInterface server)
            throws JournalException {
        super(parameters, role, server);

        if (!parameters.containsKey(PARAMETER_JOURNAL_FILENAME)) {
            throw new JournalException("Parameter '"
                    + PARAMETER_JOURNAL_FILENAME + "' not set.");
        }

        try {
            out = new FileWriter(parameters.get(PARAMETER_JOURNAL_FILENAME));

            XMLOutputFactory factory = XMLOutputFactory.newInstance();
            writer =
                    new IndentingXMLEventWriter(factory
                            .createXMLEventWriter(out));
        } catch (IOException e) {
            throw new JournalException(e);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here


            throws JournalException {
        try {
            super.writeJournalEntry(journalEntry, writer);
            writer.flush();
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

                super.writeDocumentTrailer(writer);
            }
            writer.close();
            out.close();
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        } catch (IOException e) {
            throw new JournalException(e);
        }
    }
View Full Code Here

     * </p>
     */
    public void testStateChange(State desiredState) throws JournalException {
        if (currentState == State.FILE_CLOSED
                && desiredState == State.FILE_CLOSED) {
            throw new JournalException("Request to close Transport when not open.");
        }
        if (currentState == State.FILE_OPEN && desiredState == State.FILE_OPEN) {
            throw new JournalException("Request to open Transport when already open.");
        }
        if (currentState == State.FILE_OPEN && desiredState == State.SHUTDOWN) {
            throw new JournalException("Request to shutdown Transport with file open.");
        }
        if (currentState == State.SHUTDOWN && desiredState == State.FILE_OPEN) {
            throw new JournalException("Request to open Transport after shutdown.");
        }
        if (currentState == State.SHUTDOWN && desiredState == State.FILE_CLOSED) {
            throw new JournalException("Request to close Transport after shutdown.");
        }
    }
View Full Code Here

     * {@link #getWriter() getWriter} request. This insures that the Transport
     * is in the proper state.
     */
    protected void testWriterState() throws JournalException {
        if (currentState == State.FILE_CLOSED) {
            throw new JournalException("Trying to write to a Transport that is not open.");
        }
        if (currentState == State.SHUTDOWN) {
            throw new JournalException("Trying to write to a Transport after shutdown.");
        }
    }
View Full Code Here

    }

    private int findParameterNameSeparator(String key) throws JournalException {
        int dotHere = key.indexOf('.', TRANSPORT_PARAMETER_PREFIX.length());
        if (dotHere < 0) {
            throw new JournalException("Invalid name for transport parameter '"
                    + key + "' - requires '.' after transport name.");
        }
        return dotHere;
    }
View Full Code Here

        logger.info("Journal transport parameters validated.");
    }

    private void checkAtLeastOneTransport() throws JournalException {
        if (transportParameters.size() == 0) {
            throw new JournalException("MulticastJournalWriter must have "
                    + "at least one Transport.");
        }
    }
View Full Code Here

    private void checkAllTransportsHaveClassnames() throws JournalException {
        for (String transportName : transportParameters.keySet()) {
            Map<String, String> thisTransportMap =
                    transportParameters.get(transportName);
            if (!thisTransportMap.containsKey(CLASSNAME_PARAMETER_KEY)) {
                throw new JournalException("Transport '" + transportName
                        + "' does not have a '" + CLASSNAME_PARAMETER_KEY
                        + "' parameter");
            }
        }
    }
View Full Code Here

    private void checkAllTransportsHaveCrucialFlags() throws JournalException {
        for (String transportName : transportParameters.keySet()) {
            Map<String, String> thisTransportMap =
                    transportParameters.get(transportName);
            if (!thisTransportMap.containsKey(CRUCIAL_PARAMETER_KEY)) {
                throw new JournalException("Transport '" + transportName
                        + "' does not have a '" + CRUCIAL_PARAMETER_KEY
                        + "' parameter");
            }
        }
    }
View Full Code Here

            String crucialString = thisTransportMap.get(CRUCIAL_PARAMETER_KEY);
            if (Boolean.parseBoolean(crucialString)) {
                return;
            }
        }
        throw new JournalException("There must be at least one crucial transport.");
    }
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.