/** * */ package at.gv.egiz.pdfas.framework; import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; import at.knowcenter.wag.egov.egiz.exceptions.ConnectorFactoryException; import at.knowcenter.wag.egov.egiz.sig.connectors.Connector; import at.knowcenter.wag.egov.egiz.sig.connectors.bku.EnvelopedBase64BKUConnector; import at.knowcenter.wag.egov.egiz.sig.connectors.bku.MultipartDetachedBKUConnector; import at.knowcenter.wag.egov.egiz.sig.connectors.bku.OldEnvelopingBase64BKUConnector; import at.knowcenter.wag.egov.egiz.sig.connectors.moa.DetachedLocRefMOAConnector; import at.knowcenter.wag.egov.egiz.sig.connectors.moa.EnvelopingBase64MOAConnector; /** * @author wprinz */ public class ConnectorFactory { // TODO the functionality of the connector should be split into template // handling and the actualy hardware access public static String DETACHED_MULTIPART_BKU_CONNECTOR = "DetachedMultipartBKUConnector"; public static String ENVELOPING_BASE64_BKU_CONNECTOR = "EnvelopingBase64BKUConnector"; public static String OLD_ENVELOPING_BASE64_BKU_CONNECTOR = "OldEnvelopingBase64BKUConnector"; public static String DETACHED_LOCREF_MOA_CONNECTOR = "DetachedLocRefMOAConnector"; public static String ENVELOPING_BASE64_MOA_CONNECTOR = "EnvelopingBase64MOAConnector"; public static Connector createConnector (String connectorId, String profile, String locRef) throws ConnectorFactoryException, ConnectorException { if (connectorId.equals(DETACHED_MULTIPART_BKU_CONNECTOR)) { return new MultipartDetachedBKUConnector(profile); } if (connectorId.equals(ENVELOPING_BASE64_BKU_CONNECTOR)) { return new EnvelopedBase64BKUConnector(profile); } if (connectorId.equals(OLD_ENVELOPING_BASE64_BKU_CONNECTOR)) { return new OldEnvelopingBase64BKUConnector(profile); } if (connectorId.equals(DETACHED_LOCREF_MOA_CONNECTOR)) { return new DetachedLocRefMOAConnector(profile, locRef); } if (connectorId.equals(ENVELOPING_BASE64_MOA_CONNECTOR)) { return new EnvelopingBase64MOAConnector(profile); } throw new ConnectorFactoryException("The connector Id " + connectorId + " couldn't be found by the ConnectorFactory."); } public static boolean isMOA (String connectorId) { if (connectorId.equals(DETACHED_LOCREF_MOA_CONNECTOR) || connectorId.equals(ENVELOPING_BASE64_MOA_CONNECTOR)) { return true; } return false; } // public static Connector createConnectorForCommandline (String connectorId) throws ConnectorFactoryException // { // } // // public static Connector createConnectorForCommandline (String connectorId) throws ConnectorFactoryException // { // } }