net.aocat.psis.client.base
Class AbstractSample

java.lang.Object
  extended by net.aocat.psis.client.base.AbstractSample
Direct Known Subclasses:
CAdESSignatureAttachedValidationSample, CAdESSignatureDetachedValidationSample, CertificateValidationSample, PdfValidationSample, RFC3161TimestampCreationSample, RFC3161TimestampValidationSample, XAdESSignatureDetachedHashValidationSample, XAdESSignatureDetachedValidationSample, XAdESSignatureEnvelopedValidationSample, XAdESSignatureEnvelopingValidationSample, XMLTimestampCreationSample, XMLTimestampValidationSample

public class AbstractSample
extends java.lang.Object

Abstract sample.

Author:
aalcaide

Field Summary
protected  PsisClientFactory factory
           
protected  org.apache.log4j.Logger log
           
 
Constructor Summary
AbstractSample()
          Init sample.
 
Method Summary
protected  boolean isResultWellFormed(x0CoreSchema.oasisNamesTcDss1.SignResponseDocument response)
          Validates if PSIS sign response has a Result field or not.
protected  boolean isResultWellFormed(x0CoreSchema.oasisNamesTcDss1.VerifyResponseDocument response)
          Validates if PSIS verify response has a Result field or not.
protected  void printSaveRequest(boolean PRINT_REQUEST, x0CoreSchema.oasisNamesTcDss1.SignRequestDocument request, boolean SAVE_REQUEST, java.lang.String OUT_DIR, java.lang.String SIGN_REQUEST)
          Logs and saves PSIS sign request to a file.
protected  void printSaveRequest(boolean PRINT_REQUEST, x0CoreSchema.oasisNamesTcDss1.VerifyRequestDocument request, boolean SAVE_REQUEST, java.lang.String OUT_DIR, java.lang.String VERIFY_REQUEST)
          Logs and saves PSIS verify request to a file.
protected  void printSaveResponse(boolean PRINT_RESPONSE, x0CoreSchema.oasisNamesTcDss1.SignResponseDocument response, boolean SAVE_RESPONSE, java.lang.String OUT_DIR, java.lang.String SIGN_RESPONSE)
          Logs and saves PSIS sign response to a file.
protected  void printSaveResponse(boolean PRINT_RESPONSE, x0CoreSchema.oasisNamesTcDss1.VerifyResponseDocument response, boolean SAVE_RESPONSE, java.lang.String OUT_DIR, java.lang.String VERIFY_RESPONSE)
          Logs and saves PSIS verify response to a file.
protected  void showResult(x0CoreSchema.oasisNamesTcDss1.ResultDocument.Result result)
          Prints PSIS response's Result field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.log4j.Logger log

factory

protected PsisClientFactory factory
Constructor Detail

AbstractSample

public AbstractSample()
Init sample. Loads configuration for log4java and PSIS client.

Method Detail

isResultWellFormed

protected boolean isResultWellFormed(x0CoreSchema.oasisNamesTcDss1.VerifyResponseDocument response)
Validates if PSIS verify response has a Result field or not.

Parameters:
response - verify response from PSIS
Returns:
true if PSIS verif yresponse has a Result field, false otherwise

isResultWellFormed

protected boolean isResultWellFormed(x0CoreSchema.oasisNamesTcDss1.SignResponseDocument response)
Validates if PSIS sign response has a Result field or not.

Parameters:
response - sign response from PSIS
Returns:
true if PSIS sign response has a Result field, false otherwise

showResult

protected void showResult(x0CoreSchema.oasisNamesTcDss1.ResultDocument.Result result)
Prints PSIS response's Result field.

Parameters:
result - PSIS response's result field

printSaveRequest

protected void printSaveRequest(boolean PRINT_REQUEST,
                                x0CoreSchema.oasisNamesTcDss1.VerifyRequestDocument request,
                                boolean SAVE_REQUEST,
                                java.lang.String OUT_DIR,
                                java.lang.String VERIFY_REQUEST)
                         throws java.io.IOException
Logs and saves PSIS verify request to a file.

Parameters:
PRINT_REQUEST - true if print request required
request - PSIS verify request
SAVE_REQUEST - true if save request required
OUT_DIR - directory where to save the request
VERIFY_REQUEST - name of the file where to save the request
Throws:
java.io.IOException

printSaveResponse

protected void printSaveResponse(boolean PRINT_RESPONSE,
                                 x0CoreSchema.oasisNamesTcDss1.VerifyResponseDocument response,
                                 boolean SAVE_RESPONSE,
                                 java.lang.String OUT_DIR,
                                 java.lang.String VERIFY_RESPONSE)
                          throws java.io.IOException
Logs and saves PSIS verify response to a file.

Parameters:
PRINT_RESPONSE - true if print response required
response - PSIS verify response
SAVE_RESPONSE - true if save response required
OUT_DIR - directory where to save the response
VERIFY_RESPONSE - name of the file where to save the response
Throws:
java.io.IOException

printSaveRequest

protected void printSaveRequest(boolean PRINT_REQUEST,
                                x0CoreSchema.oasisNamesTcDss1.SignRequestDocument request,
                                boolean SAVE_REQUEST,
                                java.lang.String OUT_DIR,
                                java.lang.String SIGN_REQUEST)
                         throws java.io.IOException
Logs and saves PSIS sign request to a file.

Parameters:
PRINT_REQUEST - true if print request required
request - PSIS sign request
SAVE_REQUEST - true if save request required
OUT_DIR - directory where to save the request
SIGN_REQUEST - name of the file where to save the request
Throws:
java.io.IOException

printSaveResponse

protected void printSaveResponse(boolean PRINT_RESPONSE,
                                 x0CoreSchema.oasisNamesTcDss1.SignResponseDocument response,
                                 boolean SAVE_RESPONSE,
                                 java.lang.String OUT_DIR,
                                 java.lang.String SIGN_RESPONSE)
                          throws java.io.IOException
Logs and saves PSIS sign response to a file.

Parameters:
PRINT_RESPONSE - true if print response required
response - PSIS sign response
SAVE_RESPONSE - true if save response required
OUT_DIR - directory where to save the response
SIGN_RESPONSE - name of the file where to save the response
Throws:
java.io.IOException