Search in sources :

Example 1 with TerminateResponse

use of iso.std.iso_iec._24727.tech.schema.TerminateResponse in project open-ecard by ecsec.

the class SelectorSAL method terminate.

@Override
public TerminateResponse terminate(Terminate terminate) {
    TerminateResponse response = WSHelper.makeResponse(TerminateResponse.class, WSHelper.makeResultOK());
    // only terminate if initialized
    if (!initializedSals.isEmpty()) {
        boolean errorHit = false;
        for (SAL next : initializedSals) {
            try {
                TerminateResponse res = next.terminate(terminate);
                WSHelper.checkResult(res);
            } catch (WSHelper.WSException ex) {
                // in case of an error, take the error code from the first SAL
                if (!errorHit) {
                    response.setResult(ex.getResult());
                }
            }
        }
        initializedSals.clear();
    }
    return response;
}
Also used : WSHelper(org.openecard.common.WSHelper) TerminateResponse(iso.std.iso_iec._24727.tech.schema.TerminateResponse) SAL(org.openecard.ws.SAL) SpecializedSAL(org.openecard.common.sal.SpecializedSAL)

Example 2 with TerminateResponse

use of iso.std.iso_iec._24727.tech.schema.TerminateResponse in project open-ecard by ecsec.

the class TinySALTest method testTerminate.

/**
 * Test of terminate method, of class TinySAL.
 */
@Test(enabled = TESTS_ENABLED)
public void testTerminate() {
    System.out.println("terminate");
    Terminate parameters = new Terminate();
    TerminateResponse result = instance.terminate(parameters);
    assertEquals(ECardConstants.Major.ERROR, result.getResult().getResultMajor());
}
Also used : TerminateResponse(iso.std.iso_iec._24727.tech.schema.TerminateResponse) Terminate(iso.std.iso_iec._24727.tech.schema.Terminate) Test(org.testng.annotations.Test)

Example 3 with TerminateResponse

use of iso.std.iso_iec._24727.tech.schema.TerminateResponse in project open-ecard by ecsec.

the class MiddlewareSAL method terminate.

@Override
public TerminateResponse terminate(Terminate parameters) {
    TerminateResponse resp = WSHelper.makeResponse(TerminateResponse.class, WSHelper.makeResultOK());
    try {
        eventMan.terminate();
        mwModule.destroy();
    } catch (FinalizationException ex) {
        String msg = "Failed to terminate Middleware.";
        LOG.error(msg, ex);
        resp.setResult(WSHelper.makeResultError(ECardConstants.Minor.Disp.COMM_ERROR, msg));
    }
    return resp;
}
Also used : TerminateResponse(iso.std.iso_iec._24727.tech.schema.TerminateResponse) FinalizationException(org.openecard.mdlw.sal.exceptions.FinalizationException)

Aggregations

TerminateResponse (iso.std.iso_iec._24727.tech.schema.TerminateResponse)3 Terminate (iso.std.iso_iec._24727.tech.schema.Terminate)1 WSHelper (org.openecard.common.WSHelper)1 SpecializedSAL (org.openecard.common.sal.SpecializedSAL)1 FinalizationException (org.openecard.mdlw.sal.exceptions.FinalizationException)1 SAL (org.openecard.ws.SAL)1 Test (org.testng.annotations.Test)1