[Minor] Added AbstractionConfiguration.getAsProperties()
This commit is contained in:
parent
9602313410
commit
3f2c749659
|
@ -104,7 +104,7 @@ public abstract class InternalStrolchRealm implements StrolchRealm {
|
||||||
String propTryLockTimeUnit = StrolchConstants.makeRealmKey(this.realm, PROP_TRY_LOCK_TIME_UNIT);
|
String propTryLockTimeUnit = StrolchConstants.makeRealmKey(this.realm, PROP_TRY_LOCK_TIME_UNIT);
|
||||||
String propTryLockTime = StrolchConstants.makeRealmKey(this.realm, PROP_TRY_LOCK_TIME);
|
String propTryLockTime = StrolchConstants.makeRealmKey(this.realm, PROP_TRY_LOCK_TIME);
|
||||||
TimeUnit timeUnit = TimeUnit.valueOf(configuration.getString(propTryLockTimeUnit, TimeUnit.SECONDS.name()));
|
TimeUnit timeUnit = TimeUnit.valueOf(configuration.getString(propTryLockTimeUnit, TimeUnit.SECONDS.name()));
|
||||||
long time = configuration.getLong(propTryLockTime, 10);
|
long time = configuration.getLong(propTryLockTime, 10L);
|
||||||
this.lockHandler = new DefaultLockHandler(this.realm, timeUnit, time);
|
this.lockHandler = new DefaultLockHandler(this.realm, timeUnit, time);
|
||||||
|
|
||||||
// versioning
|
// versioning
|
||||||
|
|
|
@ -17,8 +17,10 @@ package li.strolch.runtime.configuration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -42,6 +44,18 @@ public abstract class AbstractionConfiguration {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Properties getAsProperties() {
|
||||||
|
Properties props = new Properties();
|
||||||
|
for (String key : configurationValues.keySet()) {
|
||||||
|
props.setProperty(key, configurationValues.get(key));
|
||||||
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getAsMap() {
|
||||||
|
return new HashMap<>(this.configurationValues);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasProperty(String key) {
|
public boolean hasProperty(String key) {
|
||||||
return this.configurationValues.containsKey(key);
|
return this.configurationValues.containsKey(key);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +96,7 @@ public abstract class AbstractionConfiguration {
|
||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInt(String key, int defValue) {
|
public int getInt(String key, Integer defValue) {
|
||||||
String value = this.configurationValues.get(key);
|
String value = this.configurationValues.get(key);
|
||||||
if (StringHelper.isNotEmpty(value)) {
|
if (StringHelper.isNotEmpty(value)) {
|
||||||
|
|
||||||
|
@ -100,7 +114,7 @@ public abstract class AbstractionConfiguration {
|
||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong(String key, long defValue) {
|
public long getLong(String key, Long defValue) {
|
||||||
String value = this.configurationValues.get(key);
|
String value = this.configurationValues.get(key);
|
||||||
if (StringHelper.isNotEmpty(value)) {
|
if (StringHelper.isNotEmpty(value)) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue