53 lines
1.1 KiB
Java
53 lines
1.1 KiB
Java
package org.gcube.application.perform.service;
|
|
|
|
import java.net.URL;
|
|
import java.util.Properties;
|
|
|
|
|
|
import lombok.Synchronized;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@Slf4j
|
|
public class LocalConfiguration {
|
|
|
|
public static final String POOL_MAX_IDLE="db.pools.max_idle";
|
|
public static final String POOL_MAX_TOTAL="db.pools.max_total";
|
|
public static final String POOL_MIN_IDLE="db.pools.min_total";
|
|
|
|
|
|
public static final String MAPPING_DB_ENDPOINT_NAME="mapping-db.ep.name";
|
|
public static final String MAPPING_DB_ENDPOINT_CATEGORY="mapping-db.ep.name";
|
|
|
|
|
|
static LocalConfiguration instance=null;
|
|
|
|
|
|
@Synchronized
|
|
public static LocalConfiguration init(URL propertiesURL){
|
|
if(instance==null)
|
|
instance=new LocalConfiguration(propertiesURL);
|
|
return instance;
|
|
}
|
|
|
|
private Properties props=new Properties();
|
|
|
|
private LocalConfiguration(URL propertiesURL) {
|
|
try{
|
|
log.debug("Loading {} ",propertiesURL);
|
|
props.load(propertiesURL.openStream());
|
|
}catch(Exception e){
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static final String getProperty(String propertyName) {
|
|
return instance.props.getProperty(propertyName);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|