[New] Added StrolchTransaction.lockAndGetConfiguration()

This commit is contained in:
Robert von Burg 2021-05-25 08:12:11 +02:00
parent 6787214cfe
commit 668181e46b
2 changed files with 20 additions and 0 deletions

View File

@ -739,6 +739,12 @@ public abstract class AbstractTransaction implements StrolchTransaction {
return configuration;
}
@Override
public Resource lockAndGetConfiguration() {
lock(Resource.locatorFor(TYPE_CONFIGURATION, RES_CONFIGURATION));
return getConfiguration();
}
@Override
public Order getOrderTemplate(String type) {
return getOrderTemplate(type, false);

View File

@ -800,6 +800,20 @@ public interface StrolchTransaction extends AutoCloseable {
*/
Resource getConfiguration();
/**
* <p>Returns the {@link Resource} with the type {@link StrolchConstants#TYPE_CONFIGURATION} and id {@link
* StrolchConstants#RES_CONFIGURATION}.</p>
*
* <p>Should the configuration resource not exist, then it will be created without any parameters, as {@link
* Resource#getBoolean(String)} methods et. al. will then just return empty values for their corresponding
* types.</p>
*
* <p>This method first locks the resource's locator, so that we can perform a read lock</p>
*
* @return the configuration resource
*/
Resource lockAndGetConfiguration();
/**
* <p>
* Returns a copy of the {@link Order} of Type {@link StrolchModelConstants#TEMPLATE} with the given type as id, or