Search in sources :

Example 1 with JournalEngineImpl

use of com.ramussoft.common.journal.JournalEngineImpl in project ramus by Vitaliy-Yakovchuk.

the class MemoryDatabase method createEngines.

protected void createEngines() {
    try {
        this.template = createTemplate();
        List<PluginProvider> suits = new ArrayList<PluginProvider>();
        loadSuits(suits);
        PluginFactory factory = createPluginFactory(suits);
        impl = createFileIEngine(factory);
        accessor = impl.getAccessor();
        PersistentFactory persistentFactory = new PersistentFactory("ramus_", factory.getAttributePlugins(), template);
        persistentFactory.rebuild();
        File file = getFile();
        if (file != null)
            impl.open(file, isIrnoreUnregisteredPlugins());
        String jName = getJournalDirectoryName(impl.getTmpPath());
        File directory = null;
        if (jName != null) {
            directory = new File(jName);
        }
        journalFactory = createJournalFactory(directory);
        journaledEngine = createJournaledEngine(factory, persistentFactory);
        this.engine = (Engine) SuperEngineFactory.createTransactionalEngine(engine, new JournalEngineImpl(journaledEngine));
        this.engine.setPluginProperty("Core", "PluginList", factory.getPlugins());
        this.engine.setPluginProperty("Core", "PluginFactory", factory);
    } catch (Exception e) {
        if (e instanceof RuntimeException)
            throw (RuntimeException) e;
        throw new RuntimeException(e);
    }
}
Also used : PersistentFactory(com.ramussoft.core.persistent.PersistentFactory) JournalEngineImpl(com.ramussoft.common.journal.JournalEngineImpl) ArrayList(java.util.ArrayList) PluginProvider(com.ramussoft.common.PluginProvider) PluginFactory(com.ramussoft.common.PluginFactory) File(java.io.File) ZipException(java.util.zip.ZipException) IOException(java.io.IOException) SQLException(java.sql.SQLException)

Aggregations

PluginFactory (com.ramussoft.common.PluginFactory)1 PluginProvider (com.ramussoft.common.PluginProvider)1 JournalEngineImpl (com.ramussoft.common.journal.JournalEngineImpl)1 PersistentFactory (com.ramussoft.core.persistent.PersistentFactory)1 File (java.io.File)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 ZipException (java.util.zip.ZipException)1