001 // $HeadURL: 002 // /cvsroot/deegree/src/org/deegree/ogcwebservices/wms/protocol/WMSProtocolFactory.java,v 003 // 1.7 2004/07/12 06:12:11 ap Exp $ 004 /*---------------------------------------------------------------------------- 005 This file is part of deegree, http://deegree.org/ 006 Copyright (C) 2001-2009 by: 007 Department of Geography, University of Bonn 008 and 009 lat/lon GmbH 010 011 This library is free software; you can redistribute it and/or modify it under 012 the terms of the GNU Lesser General Public License as published by the Free 013 Software Foundation; either version 2.1 of the License, or (at your option) 014 any later version. 015 This library is distributed in the hope that it will be useful, but WITHOUT 016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 018 details. 019 You should have received a copy of the GNU Lesser General Public License 020 along with this library; if not, write to the Free Software Foundation, Inc., 021 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 022 023 Contact information: 024 025 lat/lon GmbH 026 Aennchenstr. 19, 53177 Bonn 027 Germany 028 http://lat-lon.de/ 029 030 Department of Geography, University of Bonn 031 Prof. Dr. Klaus Greve 032 Postfach 1147, 53001 Bonn 033 Germany 034 http://www.geographie.uni-bonn.de/deegree/ 035 036 e-mail: info@deegree.org 037 ----------------------------------------------------------------------------*/ 038 package org.deegree.ogcwebservices.wms.operation; 039 040 import org.deegree.ogcwebservices.AbstractOGCWebServiceRequest; 041 import org.deegree.ogcwebservices.OGCWebServiceException; 042 import org.deegree.ogcwebservices.OGCWebServiceRequest; 043 import org.deegree.ogcwebservices.wms.configuration.WMSConfigurationType; 044 import org.w3c.dom.Document; 045 046 /** 047 * Factory that builds the different types of WMS-Requests & Responses. 048 * 049 * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a> 050 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a> 051 * @author <a href="mailto:wanhoff@uni-bonn.de">Jeronimo Wanhoff </a> 052 * @version $Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $ 053 */ 054 public class WMSProtocolFactory { 055 056 /** 057 * creates an instance of a <tt>WMSGetCapabilitiesResult</tt> object 058 * 059 * @param request 060 * request that lead to the response 061 * @param exception 062 * exception if one occuered 063 * @param capabilities 064 * WMS capabilities 065 * 066 * @return <tt>WMSGetCapabilitiesResult</tt> 067 */ 068 public static WMSGetCapabilitiesResult createGetCapabilitiesResponse( OGCWebServiceRequest request, 069 OGCWebServiceException exception, 070 WMSConfigurationType capabilities ) { 071 072 WMSGetCapabilitiesResult res = null; 073 if ( exception != null ) { 074 res = new WMSGetCapabilitiesResult( request, exception ); 075 } else { 076 res = new WMSGetCapabilitiesResult( request, capabilities ); 077 } 078 079 return res; 080 } 081 082 /** 083 * creates a <tt>WFSGetMapResponse</tt> object 084 * 085 * @param request 086 * a copy of the request that leads to this response 087 * @param exception 088 * a describtion of an excetion (only if raised) 089 * @param response 090 * the response to the request 091 * @return the result 092 */ 093 public static GetMapResult createGetMapResponse( OGCWebServiceRequest request, OGCWebServiceException exception, 094 Object response ) { 095 096 GetMapResult res = null; 097 if ( exception != null ) { 098 res = new GetMapResult( request, exception ); 099 } else { 100 res = new GetMapResult( request, response ); 101 } 102 103 return res; 104 } 105 106 /** 107 * creates a <tt>WFSGetFeatureInfoResponse</tt> object 108 * 109 * @param request 110 * a copy of the request that leads to this response 111 * @param exception 112 * a describtion of an excetion (only if raised) 113 * @param featureInfo 114 * @return the result object 115 */ 116 public static GetFeatureInfoResult createGetFeatureInfoResponse( OGCWebServiceRequest request, 117 OGCWebServiceException exception, 118 String featureInfo ) { 119 120 GetFeatureInfoResult res = null; 121 if ( exception != null ) { 122 res = new GetFeatureInfoResult( request, exception ); 123 } else { 124 res = new GetFeatureInfoResult( request, featureInfo ); 125 } 126 127 return res; 128 } 129 130 /** 131 * @param request 132 * @param legendGraphic 133 * @return the result object 134 */ 135 public static GetLegendGraphicResult createGetLegendGraphicResponse( OGCWebServiceRequest request, 136 Object legendGraphic ) { 137 return new GetLegendGraphicResult( request, legendGraphic ); 138 } 139 140 /** 141 * @param request 142 * @param exception 143 * @return the result object 144 */ 145 public static GetLegendGraphicResult createGetLegendGraphicResponse( AbstractOGCWebServiceRequest request, 146 Document exception ) { 147 return new GetLegendGraphicResult( request, exception ); 148 } 149 150 }