use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class CoolGenWrapperPipe method createProxy.
public CoolGenXMLProxy createProxy(String proxyName) throws ConfigurationException {
CoolGenXMLProxy proxy;
try {
Class<?> klass = Class.forName(proxyName);
proxy = (CoolGenXMLProxy) klass.newInstance();
proxy.setClientId(getClientId());
proxy.setClientPassword(getClientPassword());
if (log.isDebugEnabled())
proxy.setTracing(1);
else
proxy.setTracing(0);
} catch (Exception e) {
throw new ConfigurationException(getLogPrefix(null) + "could not create proxy [" + proxyName + "]", e);
}
return proxy;
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class RecordTransformer method addOutputField.
/**
* translates a functiondeclaration to an function instance
*/
public void addOutputField(String fieldDef) throws ConfigurationException {
StringTokenizer st = new StringTokenizer(fieldDef, "(),");
String def = nextToken(st, "Function in outputFields must be parameterized [" + fieldDef + "]").trim().toUpperCase();
if ("STRING".equals(def)) {
addFixedOutput(nextToken(st, "Fixed function expects a value"));
} else if ("NOW".equals(def)) {
addDateOutput(nextToken(st, "Now function expects an outformat"));
} else if ("INCOPY".equals(def)) {
addOutputInput(Integer.parseInt(nextToken(st, "In function expects a numeric value")));
} else if ("INDATE".equals(def)) {
int field = Integer.parseInt(nextToken(st, "Indate function expects a fieldnummer"));
addDateOutput(field, nextToken(st, "Indate function expects an in and outformat, seperated with ~"), nextToken(st, "Indate function expects an in and outformat, seperated with ~"));
} else if ("FILL".equals(def)) {
int length = Integer.parseInt(nextToken(st, "Fill function expects a fieldlength"));
char fillChar = nextToken(st, "Fill function expects a fillcharacter").charAt(0);
addFillOutput(length, fillChar);
} else if ("LOOKUP".equals(def)) {
int field = Integer.parseInt(nextToken(st, "Lookup function expects a fieldnummer"));
Map<String, String> keyValues = convertToKeyValueMap(st, '=');
addLookup(field, keyValues);
} else if ("SUBSTR".equals(def)) {
int field = Integer.parseInt(nextToken(st, "Substr function expects a fieldnummer"));
int startIndex = Integer.parseInt(nextToken(st, "Substr function expects a startindex"));
int endIndex = Integer.parseInt(nextToken(st, "Substr function expects an endindex"));
addSubstring(field, startIndex, endIndex);
} else if ("ALIGN".equals(def)) {
String fixedValue = nextToken(st, "Align function expects a fixed value");
int length = Integer.parseInt(nextToken(st, "Align function expects a fieldlength"));
boolean leftAlign = "LEFT".equals(nextToken(st, "Align function expects alignment left").toUpperCase());
char fillChar = nextToken(st, "Align function expects a fillcharacter").charAt(0);
addAlignedOutput(fixedValue, length, leftAlign, fillChar);
} else if ("INALIGN".equals(def)) {
int field = Integer.parseInt(nextToken(st, "Inalign function expects a fieldnumber"));
int length = Integer.parseInt(nextToken(st, "Inalign function expects a fieldlength"));
boolean leftAlign = "LEFT".equals(nextToken(st, "Inalign function expects alignment left").toUpperCase());
char fillChar = nextToken(st, "Inalign function expects a fillcharacter").charAt(0);
addAlignedInput(field, length, leftAlign, fillChar);
} else if ("EXTERNAL".equals(def)) {
int field = Integer.parseInt(nextToken(st, "External function expects a fieldnumber"));
String delegateName = nextToken(st, "External function expects a type name for the delegate");
String params = nextToken(st, "External function expects a parameter string");
addExternal(field, delegateName, params);
} else if ("IF".equals(def)) {
int field = Integer.parseInt(nextToken(st, "If function expects a fieldnummer"));
String comparator = nextToken(st, "If function expects a comparator (EQ | NE | SW | NS)");
String compareValue = nextToken(st, "If function expects a compareValue");
addIf(field, comparator, compareValue);
} else if ("ELSEIF".equals(def)) {
int field = Integer.parseInt(nextToken(st, "If function expects a fieldnummer"));
String comparator = nextToken(st, "If function expects a comparator (EQ | NE | SW | NS)");
String compareValue = nextToken(st, "If function expects a compareValue");
addElseIf(field, comparator, compareValue);
} else if ("ENDIF".equals(def)) {
addEndIf();
} else {
throw new ConfigurationException("Unexpected function [" + def + "] defined in outputFields");
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class StatisticsKeeperStore method configure.
@Override
public void configure() throws ConfigurationException {
super.configure();
createQueries();
String instance = AppConstants.getInstance().getString("instance.name", "");
try (Connection connection = getConnection()) {
instanceKey = instances.findOrInsert(connection, instance);
} catch (JdbcException | SQLException e) {
throw new ConfigurationException("could not find instancekey for instance [" + instance + "]", e);
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class StatisticsParser method digestStatistics.
public void digestStatistics(Reader reader, String sysid) throws ConfigurationException {
Reader fileReader = new EncapsulatingReader(reader, "<" + ROOT_ELEM_NAME + ">", "</" + ROOT_ELEM_NAME + ">", false);
Digester digester = new Digester();
digester.setUseContextClassLoader(true);
// push config on the stack
digester.push(this);
try {
// String prefix="/"+ROOT_ELEM_NAME+"/";
String prefix = "*/";
// timestamp info
digester.addSetProperties(prefix + "statisticsCollection");
// instance info
digester.addSetProperties(prefix + "statisticsCollection/statgroup");
// adapterinfo
digester.addObjectCreate(prefix + "statisticsCollection/statgroup/statgroup", SummaryRecord.class);
digester.addSetProperties(prefix + "statisticsCollection/statgroup/statgroup");
digester.addSetNext(prefix + "statisticsCollection/statgroup/statgroup", "registerRecord");
// adapterinfo
digester.addObjectCreate(prefix + "statisticsCollection/statgroup/statgroup/stat/interval/item", Item.class);
digester.addSetProperties(prefix + "statisticsCollection/statgroup/statgroup/stat/interval/item");
digester.addSetNext(prefix + "statisticsCollection/statgroup/statgroup/stat/interval/item", "registerItem");
InputSource is = new InputSource(fileReader);
digester.parse(is);
} catch (Exception e) {
// wrap exception to be sure it gets rendered via the IbisException-renderer
throw new ConfigurationException("error during parsing of file [" + sysid + "]", e);
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class ShadowSender method configure.
@Override
public void configure() throws ConfigurationException {
boolean hasShadowSender = false;
boolean hasResultSender = false;
boolean hasOriginalSender = false;
if (originalSender == null)
throw new ConfigurationException("no originalSender defined");
if (resultSender == null)
throw new ConfigurationException("no resultSender defined");
for (ISender sender : getSenders()) {
if (sender.getName() != null && sender.getName().equalsIgnoreCase(getOriginalSender())) {
if (hasOriginalSender)
throw new ConfigurationException("originalSender can only be defined once");
hasOriginalSender = true;
} else if (sender.getName() != null && sender.getName().equalsIgnoreCase(getResultSender())) {
if (hasResultSender)
throw new ConfigurationException("resultSender can only be defined once");
hasResultSender = true;
resultISender = sender;
} else
hasShadowSender = true;
}
if (!hasOriginalSender)
throw new ConfigurationException("no originalSender found");
if (!hasResultSender)
throw new ConfigurationException("no resultSender found");
if (!hasShadowSender)
throw new ConfigurationException("no shadowSender found");
if (getSenderList().size() == 0)
throw new ConfigurationException("this is not supposed to happen, like ever");
super.configure();
}
Aggregations