Search in sources :

Example 6 with DirectoryJournalFactory

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

the class H2Database method createEngines.

private void createEngines() {
    try {
        JDBCTemplate template = createTemplate();
        List<PluginProvider> suits = new ArrayList<PluginProvider>();
        suits.add(new SimpleAttributePluginSuit());
        PluginFactory factory = createPluginFactory(suits);
        IEngineImpl impl = new IEngineImpl(0, template, PREFIX, factory) {

            @Override
            protected boolean deleteStreamBytes(String path) {
                return false;
            }

            @Override
            public byte[] getStream(String path) {
                return null;
            }

            @Override
            protected void writeStream(String path, byte[] bytes) {
            }
        };
        accessor = impl.getAccessor();
        PersistentFactory persistentFactory = new PersistentFactory(PREFIX, factory.getAttributePlugins(), template);
        persistentFactory.rebuild();
        String tmp = System.getProperty("java.io.tmpdir");
        engine = new JournaledEngine(factory, impl, persistentFactory.getRows(), new DirectoryJournalFactory(new File(tmp)), accessor);
    } catch (Exception e) {
        if (e instanceof RuntimeException)
            throw (RuntimeException) e;
        throw new RuntimeException();
    }
}
Also used : DirectoryJournalFactory(com.ramussoft.common.journal.DirectoryJournalFactory) PersistentFactory(com.ramussoft.core.persistent.PersistentFactory) ArrayList(java.util.ArrayList) PluginProvider(com.ramussoft.common.PluginProvider) IOException(java.io.IOException) SQLException(java.sql.SQLException) JDBCTemplate(com.ramussoft.jdbc.JDBCTemplate) SimpleAttributePluginSuit(com.ramussoft.core.attribute.simple.SimpleAttributePluginSuit) IEngineImpl(com.ramussoft.core.impl.IEngineImpl) JournaledEngine(com.ramussoft.common.journal.JournaledEngine) PluginFactory(com.ramussoft.common.PluginFactory) File(java.io.File)

Aggregations

DirectoryJournalFactory (com.ramussoft.common.journal.DirectoryJournalFactory)6 Engine (com.ramussoft.common.Engine)3 JournaledEngine (com.ramussoft.common.journal.JournaledEngine)3 File (java.io.File)3 PluginFactory (com.ramussoft.common.PluginFactory)2 PluginProvider (com.ramussoft.common.PluginProvider)2 Journal (com.ramussoft.common.journal.Journal)2 JDBCTemplate (com.ramussoft.jdbc.JDBCTemplate)2 IOException (java.io.IOException)2 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 AccessRules (com.ramussoft.common.AccessRules)1 IEngine (com.ramussoft.common.IEngine)1 CachedEngine (com.ramussoft.common.cached.CachedEngine)1 Journaled (com.ramussoft.common.journal.Journaled)1 StopUndoPointCommand (com.ramussoft.common.journal.StopUndoPointCommand)1 SuperEngineFactory (com.ramussoft.common.journal.SuperEngineFactory)1 Command (com.ramussoft.common.journal.command.Command)1 EndUserTransactionCommand (com.ramussoft.common.journal.command.EndUserTransactionCommand)1 StartUserTransactionCommand (com.ramussoft.common.journal.command.StartUserTransactionCommand)1