at.knowcenter.wag.egov.egiz.commandline
Class Main

java.lang.Object
  extended byat.knowcenter.wag.egov.egiz.commandline.Main

public abstract class Main
extends Object

The main program entry point of the commandline tool.

Author:
wprinz

Field Summary
protected static String PARAMETER_CONNECTOR
          Command line parameter setting the application to connect
protected static String PARAMETER_MODE
          Command line parameter setting the application mode sign|verify
protected static String PARAMETER_POS
          Command line parameter selecting the position of the signature.
protected static String PARAMETER_SIGNATURE_MODE
          Command line parameter setting the signature mode.
protected static String PARAMETER_SIGNATURE_TYPE
          Command line parameter setting the signature type.
protected static String PARAMETER_USER_NAME
          Command line parameter setting the username
protected static String PARAMETER_USER_PASSWORD
          Command line parameter setting the users password
protected static String PARAMETER_VERIFY_WHICH
          Command line parameter selecting the signature which is going to be verified.
static String VALUE_MODE_SIGN
          The application mode sign
static String VALUE_MODE_VERIFY
          The application mode verify
static String VALUE_SIGNATURE_MODE_BINARY
          The application mode sign
static String VALUE_SIGNATURE_MODE_DETACHED
          The application mode verify
static String VALUE_SIGNATURE_MODE_DETACHED_TEXT
          The application mode verify
static String VALUE_SIGNATURE_MODE_TEXTUAL
          The application mode verify
 
Constructor Summary
Main()
           
 
Method Summary
protected static void carryOutCommand(String mode, String signature_mode, String connector, String signature_type, String user_name, String user_password, int verify_which, String input, String output, String pos_string)
           
static void carryOutSign(String input, String connector, String signature_mode, String signature_type, String pos_string, String user_name, String user_password, String output, PrintWriter messageOutput)
           
static void carryOutVerify(String input, String connector, int verify_which, PrintWriter messageOutput)
           
protected static boolean checkConnector(String connector)
          Checks the value for correctness.
protected static boolean checkMode(String mode)
          Checks the value for correctness.
protected static boolean checkSignatureMode(String signature_mode)
          Checks the value for correctness.
protected static boolean checkSignatureType(String signature_type)
          Checks the value for correctness.
protected static int debugVerifyResults(List results)
          Formats the verification results for debugging.
static void formatSignatureResponse(SignatureResponse result, PrintWriter writer)
          Formats the SignatureResponse.
protected static void formatVerifyResults(List results, PrintWriter writer)
          Formats the verification results.
protected static String generateOutputFileNameFromInput(String input, String sig_mode)
           
static void main(String[] args)
          Deprecated. use Main instead
protected static void printMissing(String missing_term)
          Prints that something is missing.
protected static void printMissingParameter(String missing_term, String parameter)
          Prints that a certain parameter was missing.
protected static void printNoValue(String parameter)
          Prints that the provided value was unrecognized.
protected static void printPresentableException(PresentableException e)
          Prints out the ErrorCodeException in a descriptive form.
protected static void printUnrecognizedAdditionalCommandlineArgument(String argument)
          Prints that the provided additional commandline argument was unrecognized.
protected static void printUnrecognizedOption(String option)
          Prints that the provided option was unrecognized.
protected static void printUnrecognizedValue(String parameter, String value)
          Prints that the provided value was unrecognized.
static void printUsage(PrintStream writer)
          Prints the usage text.
static void processSign(PdfDataSource pdfDataSource, String connector, String signature_mode, String signature_type, String pos_string, DataSink dataSink)
           
static List processVerify(DataSource dataSource, String connector, int verify_which)
           
protected static PdfASID translateSignatureModeToPdfASID(String signature_mode)
          Translates the commandline argument to a PDF-AS-ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_MODE

protected static final String PARAMETER_MODE
Command line parameter setting the application mode sign|verify

See Also:
Constant Field Values

PARAMETER_CONNECTOR

protected static final String PARAMETER_CONNECTOR
Command line parameter setting the application to connect

See Also:
Constant Field Values

PARAMETER_SIGNATURE_MODE

protected static final String PARAMETER_SIGNATURE_MODE
Command line parameter setting the signature mode.

See Also:
Constant Field Values

PARAMETER_SIGNATURE_TYPE

protected static final String PARAMETER_SIGNATURE_TYPE
Command line parameter setting the signature type.

See Also:
Constant Field Values

PARAMETER_USER_NAME

protected static final String PARAMETER_USER_NAME
Command line parameter setting the username

See Also:
Constant Field Values

PARAMETER_USER_PASSWORD

protected static final String PARAMETER_USER_PASSWORD
Command line parameter setting the users password

See Also:
Constant Field Values

PARAMETER_POS

protected static final String PARAMETER_POS
Command line parameter selecting the position of the signature.

See Also:
Constant Field Values

PARAMETER_VERIFY_WHICH

protected static final String PARAMETER_VERIFY_WHICH
Command line parameter selecting the signature which is going to be verified.

See Also:
Constant Field Values

VALUE_MODE_SIGN

public static final String VALUE_MODE_SIGN
The application mode sign

See Also:
Constant Field Values

VALUE_MODE_VERIFY

public static final String VALUE_MODE_VERIFY
The application mode verify

See Also:
Constant Field Values

VALUE_SIGNATURE_MODE_BINARY

public static final String VALUE_SIGNATURE_MODE_BINARY
The application mode sign

See Also:
Constant Field Values

VALUE_SIGNATURE_MODE_TEXTUAL

public static final String VALUE_SIGNATURE_MODE_TEXTUAL
The application mode verify

See Also:
Constant Field Values

VALUE_SIGNATURE_MODE_DETACHED

public static final String VALUE_SIGNATURE_MODE_DETACHED
The application mode verify

See Also:
Constant Field Values

VALUE_SIGNATURE_MODE_DETACHED_TEXT

public static final String VALUE_SIGNATURE_MODE_DETACHED_TEXT
The application mode verify

See Also:
Constant Field Values
Constructor Detail

Main

public Main()
Method Detail

main

public static void main(String[] args)
                 throws IOException
Deprecated. use Main instead

Main program entry point.

Parameters:
args - The commandline arguments.
Throws:
IOException

carryOutCommand

protected static void carryOutCommand(String mode,
                                      String signature_mode,
                                      String connector,
                                      String signature_type,
                                      String user_name,
                                      String user_password,
                                      int verify_which,
                                      String input,
                                      String output,
                                      String pos_string)
                               throws PresentableException
Throws:
PresentableException

carryOutSign

public static void carryOutSign(String input,
                                String connector,
                                String signature_mode,
                                String signature_type,
                                String pos_string,
                                String user_name,
                                String user_password,
                                String output,
                                PrintWriter messageOutput)
                         throws PresentableException
Throws:
PresentableException

carryOutVerify

public static void carryOutVerify(String input,
                                  String connector,
                                  int verify_which,
                                  PrintWriter messageOutput)
                           throws PresentableException
Throws:
PresentableException

processSign

public static void processSign(PdfDataSource pdfDataSource,
                               String connector,
                               String signature_mode,
                               String signature_type,
                               String pos_string,
                               DataSink dataSink)
                        throws PresentableException
Throws:
PresentableException

processVerify

public static List processVerify(DataSource dataSource,
                                 String connector,
                                 int verify_which)
                          throws PresentableException
Throws:
PresentableException

generateOutputFileNameFromInput

protected static String generateOutputFileNameFromInput(String input,
                                                        String sig_mode)

printUnrecognizedOption

protected static void printUnrecognizedOption(String option)
                                       throws PresentableException
Prints that the provided option was unrecognized.

Parameters:
option - The unrecognized option.
Throws:
PresentableException - Forwarded exception.

printNoValue

protected static void printNoValue(String parameter)
                            throws PresentableException
Prints that the provided value was unrecognized.

Parameters:
parameter - The parameter, which is missing a value.
Throws:
PresentableException - Forwarded exception.

printUnrecognizedValue

protected static void printUnrecognizedValue(String parameter,
                                             String value)
                                      throws PresentableException
Prints that the provided value was unrecognized.

Parameters:
value - The unrecognized value.
Throws:
PresentableException - Forwarded exception.

printUnrecognizedAdditionalCommandlineArgument

protected static void printUnrecognizedAdditionalCommandlineArgument(String argument)
                                                              throws PresentableException
Prints that the provided additional commandline argument was unrecognized.

Parameters:
argument - The unrecognized argument.
Throws:
PresentableException - Forwarded exception.

printMissingParameter

protected static void printMissingParameter(String missing_term,
                                            String parameter)
                                     throws PresentableException
Prints that a certain parameter was missing.

Parameters:
missing_term - A description of the missing parameter ("e.g. a mode").
parameter - The missing parameter itself (e.g. "-mode").
Throws:
PresentableException - Forwarded exception.

printMissing

protected static void printMissing(String missing_term)
                            throws PresentableException
Prints that something is missing.

Parameters:
missing_term - A descriptive message of the missing thing.
Throws:
PresentableException - Forwarded exception.

printPresentableException

protected static void printPresentableException(PresentableException e)
Prints out the ErrorCodeException in a descriptive form.


printUsage

public static void printUsage(PrintStream writer)
                       throws PresentableException
Prints the usage text.

Parameters:
writer - The writer to print the text to.
Throws:
PresentableException - Forwarded exception.

checkMode

protected static boolean checkMode(String mode)
Checks the value for correctness.

Parameters:
mode - The parameter's value.
Returns:
Returns true, if the value is correct, false otherwise.

checkSignatureMode

protected static boolean checkSignatureMode(String signature_mode)
Checks the value for correctness.

Parameters:
signature_mode - The parameter's value.
Returns:
Returns true, if the value is correct, false otherwise.

checkConnector

protected static boolean checkConnector(String connector)
                                 throws ConnectorFactoryException
Checks the value for correctness.

Parameters:
connector - The parameter's value.
Returns:
Returns true, if the value is correct, false otherwise.
Throws:
ConnectorFactoryException - F.e.

checkSignatureType

protected static boolean checkSignatureType(String signature_type)
                                     throws SignatureTypesException
Checks the value for correctness.

Parameters:
signature_type - The parameter's value.
Returns:
Returns true, if the value is correct, false otherwise.
Throws:
SignatureTypesException

translateSignatureModeToPdfASID

protected static PdfASID translateSignatureModeToPdfASID(String signature_mode)
Translates the commandline argument to a PDF-AS-ID.

Parameters:
signature_mode - The signator mode commandline argument.
Returns:
Returns the corresponding PDFASID.

formatVerifyResults

protected static void formatVerifyResults(List results,
                                          PrintWriter writer)
                                   throws SettingNotFoundException
Formats the verification results.

Parameters:
results - The List of SignatureResponse verification results.
writer - The output sink to write the formatted text to.
Throws:
SettingNotFoundException - Forwarded exception.

debugVerifyResults

protected static int debugVerifyResults(List results)
                                 throws SettingNotFoundException
Formats the verification results for debugging. Returns 0 if no error occurs or the sum of all error-codes.

Parameters:
results -
Throws:
SettingNotFoundException - Forwarded exception.

formatSignatureResponse

public static void formatSignatureResponse(SignatureResponse result,
                                           PrintWriter writer)
                                    throws SettingNotFoundException
Formats the SignatureResponse.

Parameters:
result - The SignatureResponse to be printed.
writer - The output sink to write the formatted text to.
Throws:
SettingNotFoundException - Forwarded exception.


Copyright © 2006-2010. All Rights Reserved.