package at.gv.egovernment.moa.spss.api; import at.gv.egovernment.moa.spss.MOAException; import org.apache.commons.discovery.tools.DiscoverClass; import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; /** * Interface providing functions for signature creation. * * @author Patrick Peck * @version $Id$ */ public abstract class SignatureCreationService { /** The default implementation class. */ private static final String DEFAULT_IMPLEMENTATION = "at.gv.egovernment.moa.spss.server.invoke.SignatureCreationServiceImpl"; /** The single instance of this class. */ private static SignatureCreationService instance = null; /** * Get an instance of the SignatureCreationService. * * @return A concrete instance of the SignatureCreationService. */ public static synchronized SignatureCreationService getInstance() { if (instance == null) { try { DiscoverClass discover = new DiscoverClass(); instance = (SignatureCreationService) discover.newInstance( SignatureCreationService.class, DEFAULT_IMPLEMENTATION); } catch (Exception e) { // this can not happen since we provide a valid default // implementation } } return instance; } /** * Create an XML signature. * * @param request Information on how to create the signature. * @return A CreateXMLSignatureResponse containing the * signature. * @throws MOAException Error in server side MOA module. */ public abstract CreateXMLSignatureResponse createXMLSignature(CreateXMLSignatureRequest request) throws MOAException; }