[New] Implemented CACHED mode for Strolch

This commit is contained in:
Robert von Burg 2013-12-24 00:18:00 +01:00
parent 99c911258d
commit bf8e41d70e
3 changed files with 11 additions and 10 deletions

View File

@ -27,8 +27,9 @@ import li.strolch.persistence.api.DbConnectionInfo;
import li.strolch.persistence.api.OrderDao;
import li.strolch.persistence.api.ResourceDao;
import li.strolch.persistence.api.StrolchPersistenceException;
import li.strolch.persistence.api.StrolchPersistenceHandler;
import li.strolch.persistence.api.PersistenceHandler;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.runtime.StrolchConstants;
import li.strolch.runtime.agent.ComponentContainerImpl;
import li.strolch.runtime.agent.StrolchComponent;
import li.strolch.runtime.configuration.ComponentConfiguration;
@ -38,7 +39,7 @@ import li.strolch.runtime.observer.ObserverHandler;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class PostgreSqlPersistenceHandler extends StrolchComponent implements StrolchPersistenceHandler {
public class PostgreSqlPersistenceHandler extends StrolchComponent implements PersistenceHandler {
private static final String PROP_DB_URL = "db.url"; //$NON-NLS-1$
private static final String PROP_DB_USERNAME = "db.username"; //$NON-NLS-1$
@ -70,10 +71,10 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements St
throw new StrolchConfigurationException(msg, e);
}
DbConnectionInfo connectionInfo = new DbConnectionInfo(StrolchTransaction.DEFAULT_REALM, dbUrl);
DbConnectionInfo connectionInfo = new DbConnectionInfo(StrolchConstants.DEFAULT_REALM, dbUrl);
connectionInfo.setUsername(username);
connectionInfo.setPassword(password);
this.connetionInfoMap.put(StrolchTransaction.DEFAULT_REALM, connectionInfo);
this.connetionInfoMap.put(StrolchConstants.DEFAULT_REALM, connectionInfo);
String compliant = driver.jdbcCompliant() ? "" : "non"; //$NON-NLS-1$ //$NON-NLS-2$
String msg = "Using {0} JDBC compliant Driver {1}.{2}"; //$NON-NLS-1$
@ -98,7 +99,7 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements St
}
public StrolchTransaction openTx() {
return openTx(StrolchTransaction.DEFAULT_REALM);
return openTx(StrolchConstants.DEFAULT_REALM);
}
public StrolchTransaction openTx(String realm) {

View File

@ -20,7 +20,7 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import li.strolch.persistence.api.StrolchPersistenceHandler;
import li.strolch.persistence.api.PersistenceHandler;
import li.strolch.persistence.postgresql.DbSchemaVersionCheck;
import li.strolch.testbase.runtime.RuntimeMock;
@ -39,7 +39,7 @@ public abstract class AbstractDaoImplTest extends RuntimeMock {
private static final String RUNTIME_PATH = "target/strolchRuntime/"; //$NON-NLS-1$
private static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
private static final String CONFIG_SRC = "src/test/resources/runtime/config"; //$NON-NLS-1$
protected static StrolchPersistenceHandler persistenceHandler;
protected static PersistenceHandler persistenceHandler;
@BeforeClass
public static void beforeClass() throws SQLException {
@ -53,7 +53,7 @@ public abstract class AbstractDaoImplTest extends RuntimeMock {
RuntimeMock.startContainer(rootPath);
// initialize the component configuration
persistenceHandler = getContainer().getComponent(StrolchPersistenceHandler.class);
persistenceHandler = getContainer().getComponent(PersistenceHandler.class);
}
private static void dropSchema() throws SQLException {

View File

@ -3,13 +3,13 @@
<Runtime>
<applicationName>StrolchPersistenceTest</applicationName>
<Properties>
<dataStoreMode>EMPTY</dataStoreMode>
<dataStoreMode>CACHED</dataStoreMode>
<verbose>true</verbose>
</Properties>
</Runtime>
<Component>
<name>PersistenceHandler</name>
<api>li.strolch.persistence.api.StrolchPersistenceHandler</api>
<api>li.strolch.persistence.api.PersistenceHandler</api>
<impl>li.strolch.persistence.postgresql.PostgreSqlPersistenceHandler</impl>
<Properties>
<allowSchemaCreation>true</allowSchemaCreation>