/* * Copyright 2003 Federal Chancellery Austria * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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; }