diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealm.java b/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealm.java index 77b6dd609..d89c94a3e 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealm.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealm.java @@ -15,20 +15,15 @@ */ package li.strolch.agent.impl; -import java.text.MessageFormat; -import java.util.List; -import java.util.Set; - -import li.strolch.agent.api.*; -import li.strolch.model.Order; -import li.strolch.model.Resource; -import li.strolch.model.activity.Activity; -import li.strolch.persistence.api.*; +import li.strolch.agent.api.AuditTrail; +import li.strolch.agent.api.ComponentContainer; +import li.strolch.agent.api.StrolchAgent; +import li.strolch.persistence.api.PersistenceHandler; +import li.strolch.persistence.api.StrolchTransaction; import li.strolch.privilege.model.Certificate; import li.strolch.privilege.model.PrivilegeContext; import li.strolch.runtime.configuration.ComponentConfiguration; import li.strolch.utils.dbc.DBC; -import li.strolch.utils.helper.StringHelper; /** * @author Robert von Burg @@ -63,17 +58,17 @@ public class CachedRealm extends InternalStrolchRealm { } @Override - public ResourceMap getResourceMap() { + public CachedResourceMap getResourceMap() { return this.resourceMap; } @Override - public OrderMap getOrderMap() { + public CachedOrderMap getOrderMap() { return this.orderMap; } @Override - public ActivityMap getActivityMap() { + public CachedActivityMap getActivityMap() { return this.activityMap; } @@ -82,6 +77,10 @@ public class CachedRealm extends InternalStrolchRealm { return this.auditTrail; } + StrolchAgent getAgent() { + return this.container.getAgent(); + } + @Override public void initialize(ComponentContainer container, ComponentConfiguration configuration) { super.initialize(container, configuration); @@ -100,69 +99,7 @@ public class CachedRealm extends InternalStrolchRealm { @Override public void start(PrivilegeContext privilegeContext) { super.start(privilegeContext); - - long start = System.nanoTime(); - int nrOfOrders = 0; - int nrOfResources = 0; - int nrOfActivities = 0; - - logger.info(MessageFormat.format("Loading Model from Database for realm {0}...", getRealm())); //$NON-NLS-1$ - - try (StrolchTransaction tx = openTx(privilegeContext.getCertificate(), "strolch_boot", false)) { - ResourceDao resourceDao = tx.getPersistenceHandler().getResourceDao(tx); - logger.info("Reading " + resourceDao.querySize() + " Resources from DB..."); - Set resourceTypes = resourceDao.queryTypes(); - for (String type : resourceTypes) { - logger.info("Reading " + resourceDao.querySize(type) + " Resources of type " + type + " from DB..."); - List resources = resourceDao.queryAll(type); - for (Resource resource : resources) { - this.resourceMap.insert(resource); - nrOfResources++; - } - } - - tx.commitOnClose(); - } - - try (StrolchTransaction tx = openTx(privilegeContext.getCertificate(), "strolch_boot", false)) { - OrderDao orderDao = tx.getPersistenceHandler().getOrderDao(tx); - logger.info("Reading " + orderDao.querySize() + " Orders from DB..."); - Set orderTypes = orderDao.queryTypes(); - for (String type : orderTypes) { - logger.info("Reading " + orderDao.querySize(type) + " Orders of type " + type + " from DB..."); - List orders = orderDao.queryAll(type); - for (Order order : orders) { - this.orderMap.insert(order); - nrOfOrders++; - } - } - - tx.commitOnClose(); - } - - try (StrolchTransaction tx = openTx(privilegeContext.getCertificate(), "strolch_boot", false)) { - ActivityDao activityDao = tx.getPersistenceHandler().getActivityDao(tx); - logger.info("Reading " + activityDao.querySize() + " Activities from DB..."); - Set activityTypes = activityDao.queryTypes(); - for (String type : activityTypes) { - logger.info("Reading " + activityDao.querySize(type) + " Activities of type " + type + " from DB..."); - List activities = activityDao.queryAll(type); - for (Activity activity : activities) { - this.activityMap.insert(activity); - nrOfActivities++; - } - } - - tx.commitOnClose(); - } - - long duration = System.nanoTime() - start; - String durationS = StringHelper.formatNanoDuration(duration); - logger.info(MessageFormat - .format("Loading Model from Database for realm {0} took {1}.", getRealm(), durationS)); //$NON-NLS-1$ - logger.info(MessageFormat.format("Loaded {0} Orders", nrOfOrders)); //$NON-NLS-1$ - logger.info(MessageFormat.format("Loaded {0} Resources", nrOfResources)); //$NON-NLS-1$ - logger.info(MessageFormat.format("Loaded {0} Activities", nrOfActivities)); //$NON-NLS-1$ + new CachedRealmLoader(this, this.persistenceHandler, privilegeContext).load(getRealm()); } @Override diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealmLoader.java b/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealmLoader.java new file mode 100644 index 000000000..03c0779d4 --- /dev/null +++ b/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedRealmLoader.java @@ -0,0 +1,178 @@ +package li.strolch.agent.impl; + +import static java.lang.Integer.MAX_VALUE; +import static java.util.concurrent.CompletableFuture.allOf; +import static java.util.concurrent.CompletableFuture.supplyAsync; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.text.MessageFormat; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; +import java.util.function.Supplier; + +import li.strolch.model.StrolchRootElement; +import li.strolch.persistence.api.PersistenceHandler; +import li.strolch.persistence.api.StrolchDao; +import li.strolch.persistence.api.StrolchTransaction; +import li.strolch.privilege.model.Certificate; +import li.strolch.privilege.model.PrivilegeContext; +import li.strolch.utils.dbc.DBC; +import li.strolch.utils.helper.StringHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CachedRealmLoader { + + private static final Logger logger = LoggerFactory.getLogger(CachedRealmLoader.class); + public static final int MIN_PAGE_SIZE = 200; + + private final CachedRealm realm; + private final PersistenceHandler persistenceHandler; + private final PrivilegeContext privilegeContext; + + private final AtomicLong nrOfOrders; + private final AtomicLong nrOfResources; + private final AtomicLong nrOfActivities; + + public CachedRealmLoader(CachedRealm realm, PersistenceHandler persistenceHandler, + PrivilegeContext privilegeContext) { + this.realm = realm; + this.persistenceHandler = persistenceHandler; + this.privilegeContext = privilegeContext; + this.nrOfOrders = new AtomicLong(); + this.nrOfResources = new AtomicLong(); + this.nrOfActivities = new AtomicLong(); + } + + public void load(String realm) { + long start = System.nanoTime(); + logger.info(MessageFormat.format("Loading Model from Database for realm {0}...", realm)); + + if (this.persistenceHandler.supportsPaging()) { + loadElementsPagingAsync("Resources", this.persistenceHandler::getResourceDao, this.realm::getResourceMap, + this.nrOfResources); + loadElementsPagingAsync("Orders", this.persistenceHandler::getOrderDao, this.realm::getOrderMap, + this.nrOfOrders); + loadElementsPagingAsync("Activities", this.persistenceHandler::getActivityDao, this.realm::getActivityMap, + this.nrOfActivities); + } else { + loadElements("Resources", this.persistenceHandler::getResourceDao, this.realm::getResourceMap, + this.nrOfResources); + loadElements("Orders", this.persistenceHandler::getOrderDao, this.realm::getOrderMap, this.nrOfOrders); + loadElements("Activities", this.persistenceHandler::getActivityDao, this.realm::getActivityMap, + this.nrOfActivities); + } + + long duration = System.nanoTime() - start; + String durationS = StringHelper.formatNanoDuration(duration); + logger.info(MessageFormat.format("Loading Model from Database for realm {0} took {1}.", realm, durationS)); + logger.info(MessageFormat.format("Loaded {0} Orders", this.nrOfOrders)); + logger.info(MessageFormat.format("Loaded {0} Resources", this.nrOfResources)); + logger.info(MessageFormat.format("Loaded {0} Activities", this.nrOfActivities)); + } + + private void loadElements(String context, + Function> daoSupplier, Supplier> elementMapSupplier, + AtomicLong counter) { + + long start = System.nanoTime(); + long nrOfElements; + CachedElementMap elementMap = elementMapSupplier.get(); + + try (StrolchTransaction tx = this.realm.openTx(getCert(), "strolch_boot_" + context, false)) { + StrolchDao dao = daoSupplier.apply(tx); + nrOfElements = dao.querySize(); + logger.info("Loading " + nrOfElements + " " + context + " from DB..."); + + Set types = dao.queryTypes(); + for (String type : types) { + long sizeOfType = dao.querySize(type); + logger.info("Loading " + sizeOfType + " " + context + " of type " + type + " from DB..."); + + List elements = dao.queryAll(type); + elementMap.insertAll(elements); + counter.addAndGet(elements.size()); + } + + tx.commitOnClose(); + } + + String durationS = StringHelper.formatNanoDuration(System.nanoTime() - start); + logger.info(MessageFormat.format("Loading of {0} {1} took {2}.", nrOfElements, context, durationS)); + } + + private void loadElementsPagingAsync(String context, + Function> daoSupplier, Supplier> elementMapSupplier, + AtomicLong counter) { + + long start = System.nanoTime(); + + Map sizeByTypes = getSizesByType(daoSupplier); + CachedElementMap elementMap = elementMapSupplier.get(); + + long nrOfElements = sizeByTypes.values().stream().mapToLong(Long::longValue).sum(); + logger.info("Loading " + nrOfElements + " " + context + " from DB..."); + + List>> tasks = new ArrayList<>(); + sizeByTypes.keySet().stream().sorted(Comparator.comparing(sizeByTypes::get)).forEach(type -> { + long size = sizeByTypes.get(type); + if (size < MIN_PAGE_SIZE) { + logger.info("Loading " + size + " " + context + " of type " + type + " from DB async in parallel..."); + tasks.add(supplyAsync(() -> loadPage(daoSupplier, type, MAX_VALUE, 0))); + } else { + long pageSize = Math.max(MIN_PAGE_SIZE, size / Runtime.getRuntime().availableProcessors()); + logger.info("Loading " + size + " " + context + " of type " + type + " in pages of " + pageSize + + " from DB async in parallel..."); + long position = 0; + while (position < size) { + long offset = position; + tasks.add(supplyAsync(() -> loadPage(daoSupplier, type, pageSize, offset))); + position += pageSize; + } + } + }); + + // wait for all tasks to complete + Throwable failureEx = allOf(tasks.toArray(new CompletableFuture[0])).handle((u, t) -> t).join(); + if (failureEx != null) + throw new IllegalStateException("Failed to load " + context, failureEx); + + // now insert elements into element map + tasks.stream().map(CompletableFuture::join).forEach(elements -> { + elementMap.insertAll(elements); + counter.addAndGet(elements.size()); + }); + + DBC.POST.assertEquals("Expected size should be same as counter", nrOfElements, counter.get()); + String durationS = StringHelper.formatNanoDuration(System.nanoTime() - start); + logger.info(MessageFormat.format("Loading of {0} {1} took {2}.", counter, context, durationS)); + } + + private List loadPage(Function> daoSupplier, + String type, long pageSize, long offset) { + try (StrolchTransaction tx = this.realm.openTx(getCert(), "strolch_boot", true) + .silentThreshold(10, SECONDS) + .suppressUpdates()) { + return daoSupplier.apply(tx).queryAll(pageSize, offset, type); + } + } + + private Map getSizesByType( + Function> daoSupplier) { + Map sizeByTypes = new HashMap<>(); + try (StrolchTransaction tx = this.realm.openTx(getCert(), "strolch_boot", true).silentThreshold(10, SECONDS)) { + StrolchDao dao = daoSupplier.apply(tx); + Set types = dao.queryTypes(); + for (String type : types) { + sizeByTypes.put(type, dao.querySize(type)); + } + } + return sizeByTypes; + } + + private Certificate getCert() { + return this.privilegeContext.getCertificate(); + } +} diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/impl/InternalStrolchRealm.java b/li.strolch.agent/src/main/java/li/strolch/agent/impl/InternalStrolchRealm.java index 8eb756fe9..0fc2dcdde 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/impl/InternalStrolchRealm.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/impl/InternalStrolchRealm.java @@ -44,6 +44,7 @@ public abstract class InternalStrolchRealm implements StrolchRealm { private boolean versioningEnabled; private boolean updateObservers; private ObserverHandler observerHandler; + protected ComponentContainer container; public InternalStrolchRealm(String realm) { diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java b/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java index ea7a23bbe..1066e6387 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java @@ -244,11 +244,14 @@ public abstract class TransientElementMap implemen * Special method used when starting the container to cache the values. Not to be used anywhere else but from the * {@link CachedRealm} * - * @param element - * the element to insert + * @param elements + * the elements to insert */ - synchronized void insert(T element) { + synchronized void insertAll(List elements) { + elements.forEach(this::internalInsert); + } + private void internalInsert(T element) { Map byType = this.elementMap.computeIfAbsent(element.getType(), k -> new HashMap<>()); // assert no object already exists with this id @@ -274,19 +277,7 @@ public abstract class TransientElementMap implemen if (!element.hasVersion()) Version.setInitialVersionFor(element, tx.getCertificate().getUsername()); - Map byType = this.elementMap.computeIfAbsent(element.getType(), k -> new HashMap<>()); - - // assert no object already exists with this id - if (byType.containsKey(element.getId())) { - String msg = "An element already exists with the id \"{0}\". Elements of the same class must always have a unique id, regardless of their type!"; //$NON-NLS-1$ - msg = MessageFormat.format(msg, element.getId()); - throw new StrolchPersistenceException(msg); - } - - byType.put(element.getId(), element); - - // now make read only - element.setReadOnly(); + internalInsert(element); } @Override diff --git a/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java b/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java index e91d2cfcf..e7b594e7b 100644 --- a/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java +++ b/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java @@ -233,6 +233,12 @@ public abstract class AbstractTransaction implements StrolchTransaction { return TimeUnit.NANOSECONDS.toMillis(this.silentThreshold); } + @Override + public StrolchTransaction suppressUpdates() { + this.suppressUpdates = true; + return this; + } + @Override public void setSuppressUpdates(boolean suppressUpdates) { this.suppressUpdates = suppressUpdates; diff --git a/li.strolch.agent/src/main/java/li/strolch/persistence/api/PersistenceHandler.java b/li.strolch.agent/src/main/java/li/strolch/persistence/api/PersistenceHandler.java index 7ecc3d914..1ca8679b4 100644 --- a/li.strolch.agent/src/main/java/li/strolch/persistence/api/PersistenceHandler.java +++ b/li.strolch.agent/src/main/java/li/strolch/persistence/api/PersistenceHandler.java @@ -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. diff --git a/li.strolch.agent/src/main/java/li/strolch/persistence/api/StrolchTransaction.java b/li.strolch.agent/src/main/java/li/strolch/persistence/api/StrolchTransaction.java index 5490a212c..24b8d6a39 100644 --- a/li.strolch.agent/src/main/java/li/strolch/persistence/api/StrolchTransaction.java +++ b/li.strolch.agent/src/main/java/li/strolch/persistence/api/StrolchTransaction.java @@ -206,9 +206,9 @@ public interface StrolchTransaction extends AutoCloseable { long getActivityCount(String type); /** - * Returns the {@link PersistenceHandler}. If the {@link StrolchRealm} is not running in {@link - * DataStoreMode#TRANSIENT} mode, then the {@link PersistenceHandler} will be a {@link StrolchComponent}, otherwise - * it will be the internal in memory persistence handler + * Returns the {@link PersistenceHandler}. If the {@link StrolchRealm} is not running in + * {@link DataStoreMode#TRANSIENT} mode, then the {@link PersistenceHandler} will be a {@link StrolchComponent}, + * otherwise it will be the internal in memory persistence handler * * @return the {@link PersistenceHandler} */ @@ -332,8 +332,9 @@ public interface StrolchTransaction extends AutoCloseable { *

*

* - * StrolchAgent strolchAgent = getStrolchAgent(); StrolchRealm realm = strolchAgent.getContainer().getRealm("defaultRealm"); - * try(StrolchTransaction tx = realm.openTx(certificate, getClass())){ // do work tx.commitOnClose(); } + * StrolchAgent strolchAgent = getStrolchAgent(); StrolchRealm realm = + * strolchAgent.getContainer().getRealm("defaultRealm"); try(StrolchTransaction tx = realm.openTx(certificate, + * getClass())){ // do work tx.commitOnClose(); } * *

* After the block is closed, the transaction is automatically closed and all allocated resources are released @@ -362,8 +363,8 @@ public interface StrolchTransaction extends AutoCloseable { StrolchTransaction rollbackOnClose(); /** - * Sets the {@link TransactionCloseStrategy} to {@link TransactionCloseStrategy#ROLLBACK} and returns a {@link - * StrolchTransactionException} which can be thrown by the caller to stop the exception + * Sets the {@link TransactionCloseStrategy} to {@link TransactionCloseStrategy#ROLLBACK} and returns a + * {@link StrolchTransactionException} which can be thrown by the caller to stop the exception * * @param exceptionMessage * the message with which this TX has failed @@ -407,7 +408,8 @@ public interface StrolchTransaction extends AutoCloseable { boolean isOpen(); /** - * @return if the current state of the StrolchTransaction is {@link TransactionCloseStrategy#READ_ONLY} or {@link TransactionCloseStrategy#ROLLBACK} + * @return if the current state of the StrolchTransaction is {@link TransactionCloseStrategy#READ_ONLY} or + * {@link TransactionCloseStrategy#ROLLBACK} */ boolean isReadOnly(); @@ -458,6 +460,11 @@ public interface StrolchTransaction extends AutoCloseable { */ long getSilentThreshold(); + /** + * Suppresses the updates of observer + */ + StrolchTransaction suppressUpdates(); + /** * If the given argument is true, then no observer updates are performed * @@ -597,8 +604,8 @@ public interface StrolchTransaction extends AutoCloseable { void add(Command command); /** - * Helper method to create an {@link Audit} with the given arguments. The audit can then be saved by calling {@link - * AuditTrail#add(StrolchTransaction, Audit)} + * Helper method to create an {@link Audit} with the given arguments. The audit can then be saved by calling + * {@link AuditTrail#add(StrolchTransaction, Audit)} * * @param accessType * the type of access @@ -614,8 +621,8 @@ public interface StrolchTransaction extends AutoCloseable { Audit auditFrom(AccessType accessType, String elementType, String elementSubType, String id); /** - * Helper method to create an {@link Audit} with the given arguments. The audit can then be saved by calling {@link - * AuditTrail#add(StrolchTransaction, Audit)} + * Helper method to create an {@link Audit} with the given arguments. The audit can then be saved by calling + * {@link AuditTrail#add(StrolchTransaction, Audit)} * * @param accessType * the type of access @@ -649,8 +656,8 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * This method can also be used to find a deeper element, e.g. a specific {@link Parameter} on an {@link - * ParameterBag} on an {@link Order}. This would be done as follows: Order/MyType/Bag/@1/myParam + * This method can also be used to find a deeper element, e.g. a specific {@link Parameter} on an + * {@link ParameterBag} on an {@link Order}. This would be done as follows: Order/MyType/Bag/@1/myParam *

* * @param locator @@ -673,8 +680,8 @@ public interface StrolchTransaction extends AutoCloseable { /** *

Finds a parameter with the {@link StrolchConstants#BAG_PARAMETERS} and @paramKey on the given @element, but - * if it does not exists on the element, then it retrieves the elements parent by using the bag {@link - * StrolchModelConstants#BAG_RELATIONS} and the param @parentParamKey.

+ * if it does not exists on the element, then it retrieves the elements parent by using the bag + * {@link StrolchModelConstants#BAG_RELATIONS} and the param @parentParamKey.

* *

In Strolch relationships are usually defined on the parameter bag with the id {@link * StrolchModelConstants#BAG_RELATIONS}

@@ -693,8 +700,8 @@ public interface StrolchTransaction extends AutoCloseable { /** *

Finds a parameter with the given @bagKey and @paramKey on the given @element, but if it does not exists - * on the element, then it retrieves the elements parent by using the bag {@link - * StrolchModelConstants#BAG_RELATIONS} and the param @parentParamKey.

+ * on the element, then it retrieves the elements parent by using the bag + * {@link StrolchModelConstants#BAG_RELATIONS} and the param @parentParamKey.

* *

In Strolch relationships are usually defined on the parameter bag with the id {@link * StrolchModelConstants#BAG_RELATIONS}

@@ -750,10 +757,11 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * Templates are {@link StrolchRootElement StrolchRootElements} which have the type {@link - * StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For instance when - * creating a {@link Resource} of type {@code Person} then having a template with the id {@code Person} helps - * creating new Person resources; get the resource and then create a clone: {@link Resource#getClone()} + * Templates are {@link StrolchRootElement StrolchRootElements} which have the type + * {@link StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For + * instance when creating a {@link Resource} of type {@code Person} then having a template with the id + * {@code Person} helps creating new Person resources; get the resource and then create a clone: + * {@link Resource#getClone()} *

* * @param type @@ -770,10 +778,11 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * Templates are {@link StrolchRootElement StrolchRootElements} which have the type {@link - * StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For instance when - * creating a {@link Resource} of type {@code Person} then having a template with the id {@code Person} helps - * creating new Person resources; get the resource and then create a clone: {@link Resource#getClone()} + * Templates are {@link StrolchRootElement StrolchRootElements} which have the type + * {@link StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For + * instance when creating a {@link Resource} of type {@code Person} then having a template with the id + * {@code Person} helps creating new Person resources; get the resource and then create a clone: + * {@link Resource#getClone()} *

* * @param type @@ -820,10 +829,11 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * Templates are {@link StrolchRootElement StrolchRootElements} which have the type {@link - * StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For instance when - * creating an {@link Order} of type {@code PurchaseOrder} then having a template with the id {@code PurchaseOrder} - * helps creating new PurchaseOrder orders; get the order and then create a clone: {@link Order#getClone()} + * Templates are {@link StrolchRootElement StrolchRootElements} which have the type + * {@link StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For + * instance when creating an {@link Order} of type {@code PurchaseOrder} then having a template with the id + * {@code PurchaseOrder} helps creating new PurchaseOrder orders; get the order and then create a clone: + * {@link Order#getClone()} *

* * @param type @@ -840,10 +850,11 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * Templates are {@link StrolchRootElement StrolchRootElements} which have the type {@link - * StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For instance when - * creating an {@link Order} of type {@code PurchaseOrder} then having a template with the id {@code PurchaseOrder} - * helps creating new PurchaseOrder orders; get the order and then create a clone: {@link Order#getClone()} + * Templates are {@link StrolchRootElement StrolchRootElements} which have the type + * {@link StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For + * instance when creating an {@link Order} of type {@code PurchaseOrder} then having a template with the id + * {@code PurchaseOrder} helps creating new PurchaseOrder orders; get the order and then create a clone: + * {@link Order#getClone()} *

* * @param type @@ -864,10 +875,11 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * Templates are {@link StrolchRootElement StrolchRootElements} which have the type {@link - * StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For instance when - * creating a {@link Activity} of type {@code ToStock} then having a template with the id {@code ToStock} helps - * creating new ToStock activities; get the activity and then create a clone: {@link Activity#getClone()} + * Templates are {@link StrolchRootElement StrolchRootElements} which have the type + * {@link StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For + * instance when creating a {@link Activity} of type {@code ToStock} then having a template with the id + * {@code ToStock} helps creating new ToStock activities; get the activity and then create a clone: + * {@link Activity#getClone()} *

* * @param type @@ -884,10 +896,11 @@ public interface StrolchTransaction extends AutoCloseable { *

* *

- * Templates are {@link StrolchRootElement StrolchRootElements} which have the type {@link - * StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For instance when - * creating a {@link Activity} of type {@code ToStock} then having a template with the id {@code ToStock} helps - * creating new ToStock activities; get the activity and then create a clone: {@link Activity#getClone()} + * Templates are {@link StrolchRootElement StrolchRootElements} which have the type + * {@link StrolchModelConstants#TEMPLATE} and their id is the type of element for which it is a template. For + * instance when creating a {@link Activity} of type {@code ToStock} then having a template with the id + * {@code ToStock} helps creating new ToStock activities; get the activity and then create a clone: + * {@link Activity#getClone()} *

* * @param type @@ -931,9 +944,9 @@ public interface StrolchTransaction extends AutoCloseable { Resource getResourceBy(String type, String id, boolean assertExists) throws StrolchException; /** - * Returns the {@link Resource} which is referenced by the given {@link StringParameter}. A reference {@link - * Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the - * UOM must be set to the resource's type and the value is the id of the resource + * Returns the {@link Resource} which is referenced by the given {@link StringParameter}. A reference + * {@link Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} + * and the UOM must be set to the resource's type and the value is the id of the resource * * @param refP * the {@link StringParameter} which references a {@link Resource} @@ -946,9 +959,9 @@ public interface StrolchTransaction extends AutoCloseable { Resource getResourceBy(StringParameter refP) throws StrolchException; /** - * Returns the {@link Resource} which is referenced by the given {@link StringParameter}. A reference {@link - * Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the - * UOM must be set to the resource's type and the value is the id of the resource + * Returns the {@link Resource} which is referenced by the given {@link StringParameter}. A reference + * {@link Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} + * and the UOM must be set to the resource's type and the value is the id of the resource * * @param refP * the {@link StringParameter} which references a {@link Resource} @@ -1000,16 +1013,16 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns the {@link Resource} which is referenced by the given {@link StrolchRootElement}. The element must have a * {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link StringParameter} on it - * with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the value - * is the id of the resource to return + * with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the + * value is the id of the resource to return * * @param element * the {@link StrolchRootElement} which references a {@link Resource} through a {@link StringParameter} with the * given refId * @param refId - * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * * @return the resource referenced by the element, or null if the {@link ParameterBag}, {@link StringParameter} or * referenced element do not exist @@ -1022,16 +1035,16 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns the {@link Resource} which is referenced by the given {@link StrolchRootElement}. The element must have a * {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link StringParameter} on it - * with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the value - * is the id of the resource to return + * with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the + * value is the id of the resource to return * * @param element * the {@link StrolchRootElement} which references a {@link Resource} through a {@link StringParameter} with the * given refId * @param refId - * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * @param assertExists * if true, and referenced resource does not exist, then a {@link StrolchException} is thrown * @@ -1046,17 +1059,17 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Resource Resources} which are referenced by the given {@link StrolchRootElement}. The element - * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link - * StringListParameter} on it with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the value - * is the id of the resource to return + * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a + * {@link StringListParameter} on it with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the + * value is the id of the resource to return * * @param element * the {@link StrolchRootElement} which references a {@link Resource} through a {@link StringListParameter} with * the given refId * @param refId - * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * * @return the resources referenced by the element, or null if the {@link ParameterBag}, {@link StringListParameter} * or referenced element do not exist @@ -1068,17 +1081,17 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Resource Resources} which are referenced by the given {@link StrolchRootElement}. The element - * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link - * StringListParameter} on it with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the value - * is the id of the resource to return + * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a + * {@link StringListParameter} on it with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_RESOURCE_REF} and the UOM must be set to the resource's type and the + * value is the id of the resource to return * * @param element * the {@link StrolchRootElement} which references a {@link Resource} through a {@link StringListParameter} with * the given refId * @param refId - * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * @param assertExists * if true, and referenced resource does not exist, then a {@link StrolchException} is thrown * @@ -1155,9 +1168,9 @@ public interface StrolchTransaction extends AutoCloseable { Activity getActivityBy(String type, String id, boolean assertExists) throws StrolchException; /** - * Returns the {@link Activity} which is referenced by the given {@link StringParameter}. A reference {@link - * Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the - * UOM must be set to the activity's type and the value is the id of the activity + * Returns the {@link Activity} which is referenced by the given {@link StringParameter}. A reference + * {@link Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} + * and the UOM must be set to the activity's type and the value is the id of the activity * * @param refP * the {@link StringParameter} which references an {@link Activity} @@ -1170,9 +1183,9 @@ public interface StrolchTransaction extends AutoCloseable { Activity getActivityBy(StringParameter refP) throws StrolchException; /** - * Returns the {@link Activity} which is referenced by the given {@link StringParameter}. A reference {@link - * Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the - * UOM must be set to the activity's type and the value is the id of the activity + * Returns the {@link Activity} which is referenced by the given {@link StringParameter}. A reference + * {@link Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} + * and the UOM must be set to the activity's type and the value is the id of the activity * * @param refP * the {@link StringParameter} which references an {@link Activity} @@ -1189,8 +1202,9 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Activity Activities} which are referenced by the given {@link StringListParameter}. A - * reference {@link Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} - * and the UOM must be set to the activity's type and the value is the id of the activity + * reference {@link Parameter} must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the + * value is the id of the activity * * @param refP * the {@link StringListParameter} which references a list of {@link Activity Activities} @@ -1205,8 +1219,9 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Activity Activities} which are referenced by the given {@link StringListParameter}. A - * reference {@link Parameter} must have its interpretation set to {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} - * and the UOM must be set to the activity's type and the value is the id of the activity + * reference {@link Parameter} must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the + * value is the id of the activity * * @param refP * the {@link StringListParameter} which references a list of {@link Activity Activities} @@ -1224,16 +1239,16 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns the {@link Activity} which is referenced by the given {@link StrolchRootElement}. The element must have a * {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link StringParameter} on it - * with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the value - * is the id of the activity to return + * with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the + * value is the id of the activity to return * * @param element * the {@link StrolchRootElement} which references a {@link Activity} through a {@link StringParameter} with the * given refId * @param refId - * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * * @return the activity referenced by the element, or null if the {@link ParameterBag}, {@link StringParameter} or * referenced element do not exist @@ -1246,16 +1261,16 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns the {@link Activity} which is referenced by the given {@link StrolchRootElement}. The element must have a * {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link StringParameter} on it - * with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the value - * is the id of the activity to return + * with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the + * value is the id of the activity to return * * @param element * the {@link StrolchRootElement} which references a {@link Activity} through a {@link StringParameter} with the * given refId * @param refId - * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * @param assertExists * if true, and referenced order does not exist, then a {@link StrolchException} is thrown * @@ -1270,17 +1285,17 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Activity Activities} which are referenced by the given {@link StrolchRootElement}. The element - * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link - * StringListParameter} on it with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the values - * are the ids of the activities to return + * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a + * {@link StringListParameter} on it with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the + * values are the ids of the activities to return * * @param element * the {@link StrolchRootElement} which references a {@link Activity} through a {@link StringListParameter} with * the given refId * @param refId - * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * * @return the activity referenced by the element, or null if the {@link ParameterBag}, {@link StringListParameter} * or referenced element do not exist @@ -1292,22 +1307,22 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Activity Activities} which are referenced by the given {@link StrolchRootElement}. The element - * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link - * StringListParameter} on it with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the values - * are the ids of the activities to return + * must have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a + * {@link StringListParameter} on it with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ACTIVITY_REF} and the UOM must be set to the activity's type and the + * values are the ids of the activities to return * * @param element * the {@link StrolchRootElement} which references a {@link Activity} through a {@link StringListParameter} with * the given refId * @param refId - * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * @param assertExists * if true, and referenced order does not exist, then a {@link StrolchException} is thrown * - * @return the activities referenced by the element, or null if the {@link ParameterBag}, {@link - * StringListParameter} or referenced element do not exist + * @return the activities referenced by the element, or null if the {@link ParameterBag}, + * {@link StringListParameter} or referenced element do not exist * * @throws StrolchException * if the {@link StringListParameter} is not a properly configured as a reference parameter @@ -1414,16 +1429,16 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns the {@link Order} which is referenced by the given {@link StrolchRootElement}. The element must have a * {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link StringParameter} on it - * with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the value is the - * id of the order to return + * with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the value + * is the id of the order to return * * @param element * the {@link StrolchRootElement} which references a {@link Order} through a {@link StringParameter} with the * given refId * @param refId - * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * * @return the order referenced by the element, or null if the {@link ParameterBag}, {@link StringParameter} or * referenced element do not exist @@ -1436,16 +1451,16 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns the {@link Order} which is referenced by the given {@link StrolchRootElement}. The element must have a * {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link StringParameter} on it - * with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the value is the - * id of the order to return + * with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the value + * is the id of the order to return * * @param element * the {@link StrolchRootElement} which references a {@link Order} through a {@link StringParameter} with the * given refId * @param refId - * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * @param assertExists * if true, and referenced order does not exist, then a {@link StrolchException} is thrown * @@ -1459,17 +1474,17 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Order Orders} which are referenced by the given {@link StrolchRootElement}. The element must - * have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link - * StringListParameter} on it with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the values are - * the ids of the orders to return + * have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a + * {@link StringListParameter} on it with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the values + * are the ids of the orders to return * * @param element * the {@link StrolchRootElement} which references a {@link Order} through a {@link StringListParameter} with the * given refId * @param refId - * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * * @return the orders referenced by the element, or null if the {@link ParameterBag}, {@link StringListParameter} or * referenced element do not exist @@ -1481,17 +1496,17 @@ public interface StrolchTransaction extends AutoCloseable { /** * Returns all {@link Order Orders} which are referenced by the given {@link StrolchRootElement}. The element must - * have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a {@link - * StringListParameter} on it with the given refId. The parameter must have its interpretation set to {@link - * StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the values are - * the ids of the orders to return + * have a {@link ParameterBag} with the id {@link StrolchModelConstants#BAG_RELATIONS} and a + * {@link StringListParameter} on it with the given refId. The parameter must have its interpretation set to + * {@link StrolchModelConstants#INTERPRETATION_ORDER_REF} and the UOM must be set to the order's type and the values + * are the ids of the orders to return * * @param element * the {@link StrolchRootElement} which references a {@link Order} through a {@link StringListParameter} with the * given refId * @param refId - * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id {@link - * StrolchModelConstants#BAG_RELATIONS} + * the id of the {@link StringListParameter} which needs to be on the {@link ParameterBag} with the id + * {@link StrolchModelConstants#BAG_RELATIONS} * @param assertExists * if true, and referenced order does not exist, then a {@link StrolchException} is thrown * diff --git a/li.strolch.persistence.postgresql/src/main/java/li/strolch/persistence/postgresql/PostgreSqlPersistenceHandler.java b/li.strolch.persistence.postgresql/src/main/java/li/strolch/persistence/postgresql/PostgreSqlPersistenceHandler.java index 69008842b..b005db7cc 100644 --- a/li.strolch.persistence.postgresql/src/main/java/li/strolch/persistence/postgresql/PostgreSqlPersistenceHandler.java +++ b/li.strolch.persistence.postgresql/src/main/java/li/strolch/persistence/postgresql/PostgreSqlPersistenceHandler.java @@ -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); } diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java index 98001fe19..103520056 100644 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java +++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java @@ -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);