at.knowcenter.wag.egov.egiz.sig
Class ConnectorFactory

java.lang.Object
  extended by at.knowcenter.wag.egov.egiz.sig.ConnectorFactory

public abstract class ConnectorFactory
extends Object

This is a factory for creating the appropriate connector according to the connector identifier.

Author:
wprinz
See Also:
ConnectorInformation

Field Summary
protected static Class[] AVAILABLE_CONNECTORS
          The list of available Connector implementations.
protected static String CONNECTOR_INFORMATION_FIELD_NAME
          The name of the field that holds the Connector implementation's unique identifier.
 
Constructor Summary
ConnectorFactory()
           
 
Method Summary
static Connector createConnector(String connector_identifier)
          Creates a new connector given by the connector_identifier.
protected static boolean getAvailabilityUsingDefault(String connector_identifier, String availability_key, boolean default_value)
          Retrieves the availability of the connector from the flags specified in the config file.
protected static Class getConnectorClass(String connector_identifier)
          Retrieves the connector Class belonging to the connector id.
static ConnectorInformation[] getConnectorInformationArray()
          Gathers the ConnectorInformation objects of all registered connectors.
protected static ConnectorInformation getConnectorInformationFromClass(Class connector_class)
          Retrieves the ConnectorInformation from the connector Class.
static boolean isAvailableForCommandline(String connector_identifier)
          Tells, if the connector is available for being used in the Commandline (synchron) environment.
static boolean isAvailableForWeb(String connector_identifier)
          Tells, if the Connector is available for being used in a Web (asynchron, local) environment.
static boolean isConnectorLocal(String connector_identifier)
          Tells, if the given connector is local.
static boolean isValidConnectorIdentifier(String connector_identifier)
          Tells, if the given connector identifier is valid.
static boolean needsSIG_ID(String connector)
          Tells, if the given connector needs or produces SIG_IDs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTOR_INFORMATION_FIELD_NAME

protected static final String CONNECTOR_INFORMATION_FIELD_NAME
The name of the field that holds the Connector implementation's unique identifier.

This must be a public static final String on the Connector implementation class.

See Also:
Constant Field Values

AVAILABLE_CONNECTORS

protected static Class[] AVAILABLE_CONNECTORS
The list of available Connector implementations.

Note that this could also be generated dynamically from a config file, preferably enveloped by a Singleton.

Constructor Detail

ConnectorFactory

public ConnectorFactory()
Method Detail

getConnectorInformationFromClass

protected static ConnectorInformation getConnectorInformationFromClass(Class connector_class)
                                                                throws IllegalArgumentException,
                                                                       IllegalAccessException,
                                                                       SecurityException,
                                                                       NoSuchFieldException
Retrieves the ConnectorInformation from the connector Class.

Parameters:
connector_class - The connector Class.
Returns:
Returns the ConnectorInformation.
Throws:
IllegalArgumentException - F.e.
IllegalAccessException - F.e.
SecurityException - F.e.
NoSuchFieldException - F.e.

getConnectorInformationArray

public static ConnectorInformation[] getConnectorInformationArray()
                                                           throws ConnectorFactoryException
Gathers the ConnectorInformation objects of all registered connectors.

This is used by the user interface to provide a list of all available connectors.

Returns:
Returns the ConnectorInformation objects.
Throws:
ConnectorFactoryException - F.e.

getConnectorClass

protected static Class getConnectorClass(String connector_identifier)
                                  throws ConnectorFactoryException
Retrieves the connector Class belonging to the connector id.

Parameters:
connector_identifier - The connector id.
Returns:
Returns the corresponding connector class.
Throws:
ConnectorFactoryException - Thrown, if the id is invalid.

createConnector

public static Connector createConnector(String connector_identifier)
                                 throws ConnectorFactoryException
Creates a new connector given by the connector_identifier.

Parameters:
connector_identifier - The connector identifier of the new connector.
Returns:
Returns the new connector.
Throws:
ConnectorFactoryException - F.e.

isValidConnectorIdentifier

public static boolean isValidConnectorIdentifier(String connector_identifier)
                                          throws ConnectorFactoryException
Tells, if the given connector identifier is valid.

Parameters:
connector_identifier - The connector identifier.
Returns:
Returns true, if the identifier is valid, false otherwise.
Throws:
ConnectorFactoryException - F.e.

getAvailabilityUsingDefault

protected static boolean getAvailabilityUsingDefault(String connector_identifier,
                                                     String availability_key,
                                                     boolean default_value)
                                              throws ConnectorFactoryException
Retrieves the availability of the connector from the flags specified in the config file.

Parameters:
connector_identifier - The connector.
availability_key - The key of the availability flag to be retrieved.
default_value - The default value to be used if the flag is not set in the config file.
Returns:
Returns true, if the flag was set to true, false, if the flag was set otherwise, or the default_value if the flag wasn't set at all.
Throws:
ConnectorFactoryException - Thrown, if the connector is invalid.

isAvailableForCommandline

public static boolean isAvailableForCommandline(String connector_identifier)
                                         throws ConnectorFactoryException
Tells, if the connector is available for being used in the Commandline (synchron) environment.

A connector is available for commandline processing if it requires no active user interaction for being executed or if it handles the user interaction itself.

A commandline connector is executed synchronously. The client waits until the Connector has finished.

Usually a synchron connector can also be used in a web environment.

Examples for commandline connectors are: MOA, BKU. A1 is not suitible for commandline because it requires HTTP/HTML interaction, log in, etc.

Returns:
Returns true, if the Connector is available for Commandline processing.
Throws:
ConnectorFactoryException

isAvailableForWeb

public static boolean isAvailableForWeb(String connector_identifier)
                                 throws ConnectorFactoryException
Tells, if the Connector is available for being used in a Web (asynchron, local) environment.

A connector is available for Web if it can be used in a web environment. Often a web connector is also a local connector.

Typical examples are the local BKU and A1. The later requires HTML log in and session handling.

Returns:
Returns true, if the Connector is available for the Web application.
Throws:
ConnectorFactoryException

isConnectorLocal

public static boolean isConnectorLocal(String connector_identifier)
                                throws ConnectorFactoryException
Tells, if the given connector is local.

Parameters:
connector_identifier - The connector.
Returns:
Returns true, if the given connector is local, false otherwise.
Throws:
ConnectorFactoryException - F.e.

needsSIG_ID

public static boolean needsSIG_ID(String connector)
Tells, if the given connector needs or produces SIG_IDs.

This method is used when pre formatted signature blocks have to be created that have to know if there will be a SIG_ID field or not.

Connectors like BKU produce SIG_IDs when signing that are needed when verifying.

Parameters:
connector - The connector.
Returns:
Returns true, if the given connector uses SIG_IDs, false otherwise.


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.