use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class SpaceProxy method setConfiguration.
public void setConfiguration(Configuration cfg) throws ConfigurationException {
this.cfg = cfg;
try {
InitialContext ctx = new InitialContext();
ctx.rebind(cfg.get("name"), stub);
} catch (NamingException e) {
throw new ConfigurationException(e);
}
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class TransactionManager method setConfiguration.
@Override
public void setConfiguration(Configuration cfg) throws ConfigurationException {
super.setConfiguration(cfg);
debug = cfg.getBoolean("debug", true);
debugContext = cfg.getBoolean("debug-context", debug);
profiler = cfg.getBoolean("profiler", debug);
if (profiler || debugContext)
// profiler and/or debugContext needs debug
debug = true;
doRecover = cfg.getBoolean("recover", true);
retryInterval = cfg.getLong("retry-interval", retryInterval);
retryTimeout = cfg.getLong("retry-timeout", retryTimeout);
pauseTimeout = cfg.getLong("pause-timeout", pauseTimeout);
abortOnPauseTimeout = cfg.getBoolean("abort-on-pause-timeout", true);
maxActiveSessions = cfg.getInt("max-active-sessions", 0);
sessions = cfg.getInt("sessions", 1);
threshold = cfg.getInt("threshold", sessions / 2);
maxSessions = cfg.getInt("max-sessions", sessions);
if (maxSessions < sessions)
throw new ConfigurationException("max-sessions < sessions");
if (maxActiveSessions > 0) {
if (maxActiveSessions < sessions)
throw new ConfigurationException("max-active-sessions < sessions");
if (maxActiveSessions < maxSessions)
throw new ConfigurationException("max-active-sessions < max-sessions");
}
callSelectorOnAbort = cfg.getBoolean("call-selector-on-abort", true);
if (profiler)
metrics = new Metrics(new AtomicHistogram(cfg.getLong("metrics-highest-trackable-value", 60000), 2));
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class TransactionManager method initParticipants.
protected void initParticipants(Element config) throws ConfigurationException {
groups.put(DEFAULT_GROUP, initGroup(config));
for (Element e : config.getChildren("group")) {
String name = e.getAttributeValue("name");
if (name == null)
throw new ConfigurationException("missing group name");
if (groups.containsKey(name)) {
throw new ConfigurationException("Group '" + name + "' already defined");
}
groups.put(name, initGroup(e));
}
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class SendResponse method setConfiguration.
@Override
public void setConfiguration(Configuration cfg) throws ConfigurationException {
source = cfg.get("source", SOURCE.toString());
request = cfg.get("request", REQUEST.toString());
response = cfg.get("response", RESPONSE.toString());
timeout = cfg.getLong("timeout", timeout);
try {
headerStrategy = HeaderStrategy.valueOf(cfg.get("header-strategy", "PRESERVE_RESPONSE").toUpperCase());
} catch (IllegalArgumentException e) {
throw new ConfigurationException(e.getMessage());
}
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class RotateLogListener method setConfiguration.
/**
* Configure this RotateLogListener<br>
* Properties:<br>
* <ul>
* <li>file base log filename
* <li>[window] in seconds (default 0 - never rotate)
* <li>[count] number of copies (default 0 == single copy)
* <li>[maxsize] max log size in bytes (aprox)
* </ul>
* @param cfg Configuration
* @throws ConfigurationException
*/
public void setConfiguration(Configuration cfg) throws ConfigurationException {
maxCopies = cfg.getInt("copies");
sleepTime = cfg.getInt("window") * 1000;
logName = cfg.get("file");
maxSize = cfg.getLong("maxsize");
maxSize = maxSize <= 0 ? DEFAULT_MAXSIZE : maxSize;
try {
openLogFile();
} catch (IOException e) {
throw new ConfigurationException(e);
}
Timer timer = DefaultTimer.getTimer();
if (sleepTime != 0)
timer.schedule(rotate = new Rotate(), sleepTime, sleepTime);
}
Aggregations