001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/framework/concurrent/DoServiceTask.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003     This file is part of deegree.
004     Copyright (C) 2001-2006 by:
005     Department of Geography, University of Bonn
006     http://www.giub.uni-bonn.de/deegree/
007     lat/lon GmbH
008     http://www.lat-lon.de
009     This library is free software; you can redistribute it and/or
010     modify it under the terms of the GNU Lesser General Public
011     License as published by the Free Software Foundation; either
012     version 2.1 of the License, or (at your option) any later version.
013     This library is distributed in the hope that it will be useful,
014     but WITHOUT ANY WARRANTY; without even the implied warranty of
015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016     Lesser General Public License for more details.
017     You should have received a copy of the GNU Lesser General Public
018     License along with this library; if not, write to the Free Software
019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020     Contact:
021     Andreas Poth
022     lat/lon GmbH
023     Aennchenstrasse 19
024     53177 Bonn
025     Germany
026     E-Mail: poth@lat-lon.de
027     Jens Fitzke
028     lat/lon GmbH
029     Aennchenstrasse 19
030     53177 Bonn
031     Germany
032     E-Mail: jens.fitzke@uni-bonn.de
033     ---------------------------------------------------------------------------*/
034    package org.deegree.framework.concurrent;
035    
036    import java.util.concurrent.Callable;
037    
038    import org.deegree.ogcwebservices.OGCWebService;
039    import org.deegree.ogcwebservices.OGCWebServiceRequest;
040    
041    /**
042     * <code>DoServiceTask</code> is the Callable class that should be used by all services to invoke
043     * other services.
044     * 
045     * @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
046     * @author last edited by: $Author: mschneider $
047     * 
048     * @version $Revision: 6561 $, $Date: 2007-04-10 17:24:04 +0200 (Di, 10 Apr 2007) $
049     * @param <T> 
050     */
051    public class DoServiceTask<T> implements Callable<T> {
052    
053        OGCWebService webService;
054    
055        OGCWebServiceRequest request;
056    
057        /**
058         * @param webService
059         * @param request
060         */
061        public DoServiceTask( OGCWebService webService, OGCWebServiceRequest request ) {
062            this.webService = webService;
063            this.request = request;
064        }
065    
066        /**
067         * @return the result of the execution
068         */
069        @SuppressWarnings("unchecked")
070        public T call()
071                                throws Exception {
072            return (T)this.webService.doService( request );
073        }
074    }