Search in sources :

Example 6 with JournaledEngine

use of com.ramussoft.common.journal.JournaledEngine 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

JournaledEngine (com.ramussoft.common.journal.JournaledEngine)6 Engine (com.ramussoft.common.Engine)4 CachedEngine (com.ramussoft.common.cached.CachedEngine)4 PluginFactory (com.ramussoft.common.PluginFactory)3 DirectoryJournalFactory (com.ramussoft.common.journal.DirectoryJournalFactory)3 AccessRules (com.ramussoft.common.AccessRules)2 IEngine (com.ramussoft.common.IEngine)2 Plugin (com.ramussoft.common.Plugin)2 PluginProvider (com.ramussoft.common.PluginProvider)2 Journal (com.ramussoft.common.journal.Journal)2 Journaled (com.ramussoft.common.journal.Journaled)2 SimpleAttributePluginSuit (com.ramussoft.core.attribute.simple.SimpleAttributePluginSuit)2 PersistentFactory (com.ramussoft.core.persistent.PersistentFactory)2 JDBCTemplate (com.ramussoft.jdbc.JDBCTemplate)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 SQLException (java.sql.SQLException)2 Properties (java.util.Properties)2 AbstractPlugin (com.ramussoft.common.AbstractPlugin)1 SuperEngineFactory (com.ramussoft.common.journal.SuperEngineFactory)1