use of org.openecard.common.sal.SpecializedSAL in project open-ecard by ecsec.
the class SelectorSAL method initialize.
@Override
public InitializeResponse initialize(Initialize init) {
InitializeResponse response = WSHelper.makeResponse(InitializeResponse.class, WSHelper.makeResultOK());
// only initialize one time
if (initializedSals.isEmpty()) {
LinkedList<SAL> sals = new LinkedList<>();
sals.add(main);
sals.addAll(special);
for (SAL next : sals) {
try {
InitializeResponse res = next.initialize(init);
WSHelper.checkResult(res);
if (!WSHelper.resultsInWarn(res)) {
if (next instanceof SpecializedSAL) {
initializedSpecializedSals.add((SpecializedSAL) next);
} else {
initializedSals.add(next);
}
}
} catch (WSHelper.WSException ex) {
String msg = "One of the SAL instances failed to initialize:\n" + ex.getMessage();
terminate(new Terminate());
response.setResult(WSHelper.makeResultError(ECardConstants.Minor.Disp.COMM_ERROR, msg));
return response;
}
}
}
return response;
}
Aggregations