view gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/DummyMetaDataService.java @ 603:78499af390a2

Changed log4j version to 1.2.14 gnv-artifacts/trunk@664 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 05 Feb 2010 14:15:09 +0000
parents cf38b983d1f3
children
line wrap: on
line source
/**
 *
 */
package de.intevation.gnv.artifacts.services;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import org.apache.log4j.Logger;

import com.vividsolutions.jts.geom.Geometry;

import de.intevation.gnv.artifacts.services.requestobjects.DefaultFIS;
import de.intevation.gnv.artifacts.services.requestobjects.DefaultParameter;
import de.intevation.gnv.artifacts.services.requestobjects.FIS;
import de.intevation.gnv.artifacts.services.requestobjects.Layer;
import de.intevation.gnv.artifacts.services.requestobjects.MapService;
import de.intevation.gnv.artifacts.services.requestobjects.Parameter;

/**
 * Dummy of the MetaDataWebservice to simulate an answering Service
 * until the Databasebackend will serve the required Data.
 * bb
 * @author Tim Englich <tim.englich@intevation.de>
 *
 */
public class DummyMetaDataService extends MetaDataService{

    /**
     * the logger, used to log exceptions and additionally information
     */
    private static Logger log = Logger.getLogger(DummyMetaDataService.class);
    /**
     * The UID of this Class.
     */
    private static final long serialVersionUID = 4712607258043392650L;

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

    /**
     * @see de.intevation.gnv.artifacts.services.MetaDataService#getFIS(java.util.Collection)
     */
    @Override
    protected Collection<FIS> getFIS(Collection<MapService> mapServices)
                                                                        throws MetaDataServiceException {
        log.debug("DummyMetaDataService.getFIS ==> MapServices");
        Collection<FIS> returnValue = null;
        if (mapServices != null && !mapServices.isEmpty()){
            returnValue = new ArrayList<FIS>(mapServices.size());
            Iterator<MapService> mit = mapServices.iterator();
            while(mit.hasNext()){
                MapService mapService = mit.next();
                Collection<Layer> layer = mapService.getLayer();
                Collection<Parameter> parameter = 
                    new ArrayList<Parameter>(layer.size());
                if (layer != null){
                    Iterator<Layer> layerIt = layer.iterator();
                    while (layerIt.hasNext()){
                        Layer tmpLayer = layerIt.next();
                        if (!tmpLayer.isGroupLayer()){
                            parameter.add(new DefaultParameter(tmpLayer.getID(), 
                                                               tmpLayer.getName()));
                        }
                    }
                }
                returnValue.add(new DefaultFIS(mapService.getID(),parameter));
            }
        }
        return returnValue;
    }

    /**
     * @see de.intevation.gnv.artifacts.services.MetaDataService#getFIS(com.vividsolutions.jts.geom.Geometry)
     */
    @Override
    protected Collection<FIS> getFIS(Geometry g)
                                                throws MetaDataServiceException {
        log.debug("DummyMetaDataService.getFIS ==> Geometry");
        Collection<FIS> returnValue = null;
        if (g != null){
            returnValue = new ArrayList<FIS>(2);
            returnValue.add(new DefaultFIS("fis_modeldata"));
            returnValue.add(new DefaultFIS("fis_marnet"));
        }
        return returnValue;
    }
}

http://dive4elements.wald.intevation.org