use of org.openecard.common.sal.exception.InternalAppError in project open-ecard by ecsec.
the class MiddlewareSAL method initialize.
@Override
public InitializeResponse initialize(Initialize parameters) {
InitializeResponse resp = WSHelper.makeResponse(InitializeResponse.class, WSHelper.makeResultOK());
try {
mwModule.initialize();
eventMan.initialize();
if (gui == null) {
throw new InternalAppError("GUI is not initialized.");
}
} catch (UnsatisfiedLinkError | InitializationException ex) {
String mwSALName = mwSALConfig.getMiddlewareName();
String msg = String.format("Failed to initialize Middleware for '%s'-SAL.", mwSALName);
if (mwSALConfig.isSALRequired()) {
LOG.error(msg, ex);
resp.setResult(WSHelper.makeResultError(ECardConstants.Minor.Disp.COMM_ERROR, msg));
} else {
LOG.warn(msg, ex);
resp.setResult(WSHelper.makeResult(ECardConstants.Major.WARN, ECardConstants.Minor.App.NOT_INITIALIZED, msg));
}
} catch (InternalAppError ex) {
LOG.error(ex.getMessage());
resp.setResult(ex.getResult());
}
return resp;
}
Aggregations