Search in sources :

Example 1 with AbstractJournal

use of org.apache.jackrabbit.core.journal.AbstractJournal in project jackrabbit by apache.

the class RepositoryConfigurationParser method getJournalFactory.

/**
 * Parses journal configuration. Journal configuration uses the following format:
 * <pre>
 *   &lt;Journal class="..."&gt;
 *     &lt;param name="..." value="..."&gt;
 *     ...
 *   &lt;/Journal&gt;
 * </pre>
 * <p>
 * <code>Journal</code> is a {@link #parseBeanConfig(Element,String) bean configuration}
 * element.
 *
 * @param cluster parent cluster element
 * @param home repository home directory
 * @param id cluster node id
 * @return journal factory
 * @throws ConfigurationException if the configuration is broken
 */
protected JournalFactory getJournalFactory(final Element cluster, final File home, final String id) throws ConfigurationException {
    return new JournalFactory() {

        public Journal getJournal(NamespaceResolver resolver) throws RepositoryException {
            BeanConfig config = parseBeanConfig(cluster, JOURNAL_ELEMENT);
            Journal journal = config.newInstance(Journal.class);
            if (journal instanceof AbstractJournal) {
                ((AbstractJournal) journal).setRepositoryHome(home);
            }
            try {
                journal.init(id, resolver);
            } catch (JournalException e) {
                // TODO: Should JournalException extend RepositoryException?
                throw new RepositoryException("Journal initialization failed: " + journal, e);
            }
            return journal;
        }
    };
}
Also used : JournalFactory(org.apache.jackrabbit.core.journal.JournalFactory) AbstractJournal(org.apache.jackrabbit.core.journal.AbstractJournal) JournalException(org.apache.jackrabbit.core.journal.JournalException) NamespaceResolver(org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver) Journal(org.apache.jackrabbit.core.journal.Journal) AbstractJournal(org.apache.jackrabbit.core.journal.AbstractJournal) RepositoryException(javax.jcr.RepositoryException)

Aggregations

RepositoryException (javax.jcr.RepositoryException)1 AbstractJournal (org.apache.jackrabbit.core.journal.AbstractJournal)1 Journal (org.apache.jackrabbit.core.journal.Journal)1 JournalException (org.apache.jackrabbit.core.journal.JournalException)1 JournalFactory (org.apache.jackrabbit.core.journal.JournalFactory)1 NamespaceResolver (org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver)1