
br.com.esec.icpm.libs.signature.SimpleSignatureRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of certillion-client-library Show documentation
Show all versions of certillion-client-library Show documentation
This library is used to make integration with Certillion server, so our Clients can easily ask for signatures or generate certificates.
package br.com.esec.icpm.libs.signature;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import br.com.esec.icpm.libs.signature.helper.RequestSimpleSignatureHelper;
import br.com.esec.icpm.libs.signature.response.handler.simple.BaseSimpleSignatureHandler;
import br.com.esec.icpm.libs.signature.response.handler.simple.SignatureSimpleAsynchHandler;
import br.com.esec.icpm.libs.signature.response.handler.simple.SignatureSimpleAsynchWithNotifyHandler;
import br.com.esec.icpm.libs.signature.response.handler.simple.SignatureSimpleSynchHandler;
import br.com.esec.icpm.mss.ws.SignatureRespType;
import br.com.esec.icpm.server.ws.ICPMException;
public class SimpleSignatureRequest {
private static Logger log = LoggerFactory.getLogger(SimpleSignatureRequest.class);
private SignatureRequest request;
private String message;
public SimpleSignatureRequest(SignatureRequest request) {
this.request = request;
}
public SimpleSignatureRequest message(String message) {
this.message = message;
return this;
}
public BaseSimpleSignatureHandler sign() throws ICPMException, IOException {
log.info("Requesting asynch batch signature to '" + request.identifier + "'.");
SignatureRespType response = RequestSimpleSignatureHelper.requestSynchSimpleSignature(request.server, request.identifier, message, request.policyType, request.testMode, request.options.certificateFilters, request.apId);
return new SignatureSimpleSynchHandler(request.server, response);
}
public SignatureSimpleAsynchHandler asynchSign() throws ICPMException, IOException {
log.info("Requesting asynch batch signature to '" + request.identifier + "'.");
SignatureRespType response = RequestSimpleSignatureHelper.requestAsynchSimpleSignature(request.server, request.identifier, message, request.policyType, request.testMode, request.options.certificateFilters, request.apId);
return new SignatureSimpleAsynchHandler(request.server, response);
}
public SignatureSimpleAsynchWithNotifyHandler asynchSignWithNotify() throws ICPMException, IOException {
log.info("Requesting asynch batch signature to '" + request.identifier + "'.");
SignatureRespType response = RequestSimpleSignatureHelper.requestAsynchWithNotifySimpleSignature(request.server, request.identifier, message, request.policyType, request.testMode, request.options.certificateFilters, request.apId);
return new SignatureSimpleAsynchWithNotifyHandler(request.server, response);
}
public SignatureSimpleAsynchHandler waitFor(long transactionId) throws ICPMException, InterruptedException, TimeoutException {
return new SignatureSimpleAsynchHandler(request.server, transactionId).waitTo();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy