Search in sources :

Example 1 with InternalAppError

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;
}
Also used : InitializeResponse(iso.std.iso_iec._24727.tech.schema.InitializeResponse) InitializationException(org.openecard.mdlw.sal.exceptions.InitializationException) InternalAppError(org.openecard.common.sal.exception.InternalAppError)

Aggregations

InitializeResponse (iso.std.iso_iec._24727.tech.schema.InitializeResponse)1 InternalAppError (org.openecard.common.sal.exception.InternalAppError)1 InitializationException (org.openecard.mdlw.sal.exceptions.InitializationException)1