view gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java @ 402:b88e881e8e94

Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV gnv/trunk@573 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 19 Jan 2010 14:47:36 +0000
parents
children 8032da9e8b70
line wrap: on
line source
package de.intevation.gnv.action.mapviewer;

import java.io.InputStream;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import de.intevation.gnv.action.ArtifactDatabaseActionBase;
import de.intevation.gnv.action.mapviewer.parser.ExternalCallParser;
import de.intevation.gnv.action.mapviewer.parser.XMLExternalCallParser;
import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
import de.intevation.gnv.artifactdatabase.objects.map.MapService;

/**
 * 
 * @author Tim Englich <tim.englich@intevation.de>
 *
 */
public class MapViewerCallAction extends ArtifactDatabaseActionBase {

    /**
     * the logger, used to log exceptions and additonaly information
     */
    private static Logger log = Logger.getLogger(MapViewerCallAction.class);

    /**
     * Constructor
     */
    public MapViewerCallAction() {
        super();
    }

    /**
     * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception {
        log.debug("MapViewerCallAction.execute");
        InputStream inputStream = request.getInputStream();
        if (inputStream != null){
            try {
                ExternalCallParser ecp = new XMLExternalCallParser(inputStream);
                ecp.parse();
                String geometry = ecp.getGeometry();
                String srs = ecp.getSRS();
                Collection<MapService> mapServices = ecp.getMapServices();
                 
                ArtifactDatabaseClientFactory
                          .getInstance()
                          .getArtifactDatabaseClient(getLocale(request))
                          .getArtifactFactoryMetaInformation(mapServices,
                                                             geometry,
                                                             srs);
                
                // 2. Call Artifactfactories.
                // 3. Sort out which ArtifactFactories should not be used.
                // 4. Store the retrieved Parameter to each ArtifactFactory
            } catch (Exception e) {
                log.error(e,e);
            }
        }else{
            log.error("Kein Anfragedokument übergeben.");
        }
        return super.execute(mapping, form, request, response);
    }

}

http://dive4elements.wald.intevation.org