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>
* <Journal class="...">
* <param name="..." value="...">
* ...
* </Journal>
* </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;
}
};
}
Aggregations