[New] Added PersistenceHandler.supportsPaging()
This commit is contained in:
parent
836cbe067f
commit
538402e12a
|
@ -27,6 +27,11 @@ import li.strolch.privilege.model.Certificate;
|
|||
*/
|
||||
public interface PersistenceHandler {
|
||||
|
||||
/**
|
||||
* Returns true if this persistence layer supports paging, i.e. the DAO methods with a limit and offset may be used
|
||||
*/
|
||||
boolean supportsPaging();
|
||||
|
||||
/**
|
||||
* Opens a {@link StrolchTransaction} on the given {@link StrolchRealm}. The transaction is the main object to be
|
||||
* used when accessing and modifying the elements of a realm.
|
||||
|
|
|
@ -55,6 +55,11 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements Pe
|
|||
super(container, componentName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPaging() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public DataType getDataType() {
|
||||
return this.dataType;
|
||||
}
|
||||
|
@ -93,8 +98,8 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements Pe
|
|||
boolean allowSchemaCreation = configuration.getBoolean(PROP_ALLOW_SCHEMA_CREATION, Boolean.FALSE);
|
||||
boolean allowSchemaMigration = configuration.getBoolean(PROP_ALLOW_SCHEMA_MIGRATION, Boolean.FALSE);
|
||||
boolean allowSchemaDrop = configuration.getBoolean(PROP_ALLOW_SCHEMA_DROP, Boolean.FALSE);
|
||||
boolean allowDataInitOnSchemaCreate = configuration
|
||||
.getBoolean(PROP_ALLOW_DATA_INIT_ON_SCHEMA_CREATE, Boolean.FALSE);
|
||||
boolean allowDataInitOnSchemaCreate = configuration.getBoolean(PROP_ALLOW_DATA_INIT_ON_SCHEMA_CREATE,
|
||||
Boolean.FALSE);
|
||||
|
||||
DbSchemaVersionCheck schemaVersionCheck = new DbSchemaVersionCheck(SCRIPT_PREFIX_STROLCH, this.getClass(),
|
||||
allowSchemaCreation, allowSchemaMigration, allowSchemaDrop);
|
||||
|
@ -140,8 +145,8 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements Pe
|
|||
public Connection getConnection(String realm) {
|
||||
DataSource ds = this.dsMap.get(realm);
|
||||
if (ds == null) {
|
||||
String msg = MessageFormat
|
||||
.format("There is no DataSource registered for the realm {0}", realm); //$NON-NLS-1$
|
||||
String msg = MessageFormat.format("There is no DataSource registered for the realm {0}",
|
||||
realm); //$NON-NLS-1$
|
||||
throw new StrolchPersistenceException(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ import li.strolch.agent.api.RealmHandler;
|
|||
import li.strolch.agent.api.StrolchComponent;
|
||||
import li.strolch.agent.api.StrolchRealm;
|
||||
import li.strolch.agent.impl.StoreToDaoElementListener;
|
||||
import li.strolch.model.log.LogMessage;
|
||||
import li.strolch.model.ModelStatistics;
|
||||
import li.strolch.model.Order;
|
||||
import li.strolch.model.Resource;
|
||||
import li.strolch.model.Tags;
|
||||
import li.strolch.model.activity.Activity;
|
||||
import li.strolch.model.audit.Audit;
|
||||
import li.strolch.model.log.LogMessage;
|
||||
import li.strolch.model.xml.XmlModelSaxFileReader;
|
||||
import li.strolch.persistence.api.*;
|
||||
import li.strolch.persistence.xml.model.*;
|
||||
|
@ -60,6 +60,11 @@ public class XmlPersistenceHandler extends StrolchComponent implements Persisten
|
|||
super(container, componentName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPaging() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(ComponentConfiguration configuration) throws Exception {
|
||||
|
||||
|
@ -140,8 +145,8 @@ public class XmlPersistenceHandler extends StrolchComponent implements Persisten
|
|||
logger.info("Initializing realm " + realmName + " as DB is empty.");
|
||||
|
||||
StrolchConfiguration strolchConfiguration = getContainer().getAgent().getStrolchConfiguration();
|
||||
ComponentConfiguration realmConfiguration = strolchConfiguration
|
||||
.getComponentConfiguration(RealmHandler.class.getSimpleName());
|
||||
ComponentConfiguration realmConfiguration = strolchConfiguration.getComponentConfiguration(
|
||||
RealmHandler.class.getSimpleName());
|
||||
String dataStoreKey = makeRealmKey(realmName, PREFIX_DATA_STORE_FILE);
|
||||
RuntimeConfiguration runtimeConfiguration = strolchConfiguration.getRuntimeConfiguration();
|
||||
File dataStoreF = realmConfiguration.getDataFile(dataStoreKey, null, runtimeConfiguration, true);
|
||||
|
|
Loading…
Reference in New Issue