Mercurial > dive4elements > gnv-client
changeset 616:93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
The Product does not generate any output at this Time.
gnv-artifacts/trunk@686 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 12 Feb 2010 18:04:58 +0000 |
parents | 01054ddccb0f |
children | 3d13fa281a7e |
files | gnv-artifacts/ChangeLog gnv-artifacts/doc/conf/conf.xml gnv-artifacts/doc/conf/products/layer/conf.xml gnv-artifacts/doc/conf/queries.properties gnv-artifacts/src/main/java/de/intevation/gnv/layer/LayerArtifact.java gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java |
diffstat | 7 files changed, 335 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Fri Feb 12 15:36:05 2010 +0000 +++ b/gnv-artifacts/ChangeLog Fri Feb 12 18:04:58 2010 +0000 @@ -1,3 +1,26 @@ +2010-02-12 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Integrated Queries for the Product Layer. + + * doc/conf/conf.xml: + Integrated the new FIS Nauthis and Contis and the required Link to the + Configuration for the new Product Layer. + + * doc/conf/products/layer/conf.xml: + Added Configuration for the new Product Layer. + * src/main/java/de/intevation/gnv/state/OutputStateBase.java (getData): + Changed Methodsignature from private to protected ro make it available + for extended Classes. + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (LayerOutputState): + Added new State for generating the Output for the Product Layer. + This Class is not jet completly implemented and will not return any + result at this Moment. + + * src/main/java/de/intevation/gnv/layer/LayerArtifact.java: + Added new Artifactclass for the Product Layer. + 2010-02-12 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/state/InputData.java,
--- a/gnv-artifacts/doc/conf/conf.xml Fri Feb 12 15:36:05 2010 +0000 +++ b/gnv-artifacts/doc/conf/conf.xml Fri Feb 12 18:04:58 2010 +0000 @@ -34,6 +34,10 @@ ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory> <artifact-factory name="fis_currentmeter" description="Factory to create an artifact to be used with the FIS Modeldata" ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory> + <artifact-factory name="fis_nauthis" description="Factory to create an artifact to be used with the FIS Nauthis" + ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory> + <artifact-factory name="fis_contis" description="Factory to create an artifact to be used with the FIS Conthis" + ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory> </artifact-factories> <service-factories> <service-factory @@ -371,6 +375,32 @@ </products> </artifact> + <artifact name="fis_contis"> + <products> + <product name= "layer"> + <artifact-factory name="layer" description="Artiefactfactory for Instantiating the Artifact for the Product Layer" + ttl="300000" artifact="de.intevation.gnv.layer.LayerArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory> + <parameters> + <parameter name="sourceid" value="Contis%"/> + <parameter name="fisname" value="fis_contis"/> + </parameters> + </product> + </products> + </artifact> + + <artifact name="fis_nauthis"> + <products> + <product name= "layer"> + <artifact-factory name="layer" description="Artiefactfactory for Instantiating the Artifact for the Product Layer" + ttl="300000" artifact="de.intevation.gnv.layer.LayerArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory> + <parameters> + <parameter name="sourceid" value="S57%"/> + <parameter name="fisname" value="fis_nauthis"/> + </parameters> + </product> + </products> + </artifact> + <!-- Product specific Artifacts which are referenced by the Artifacts of the FIS above. The product-Artifacts can be configured here or can be referenced @@ -390,6 +420,8 @@ <artifact name="verticalCrossSectionMesh" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh.xml" /> <artifact name="horizontalCrossSectionMesh" xlink:href="${artifacts.config.dir}/products/horizontalcrosssection/conf_mesh.xml" /> + + <artifact name="layer" xlink:href="${artifacts.config.dir}/products/layer/conf.xml" /> </artifacts> <gnv> <!-- This section configures special parameters
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/doc/conf/products/layer/conf.xml Fri Feb 12 18:04:58 2010 +0000 @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<artifact name="layer"> + <states> + <state id="layer_area" description="layer_area_one" state="de.intevation.gnv.state.DefaultState"> + <queryID>area_filter</queryID> + <dataname>areaid</dataname> + <data-multiselect>false</data-multiselect> + <data-noselect>true</data-noselect> + <inputvalues> + <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="layer_area"/> + <to state="layer_subarea"/> + <condition inputvalue="areaid" value="n/n" operator="notequal"/> + </transition> + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="layer_area"/> + <to state="layer_without_geom"/> + <condition inputvalue="areaid" value="n/n" operator="equal"/> + </transition> + + <state id="layer_subarea" description="layer_subaera" state="de.intevation.gnv.state.DefaultState"> + <queryID>subarea_filter</queryID> + <dataname>subareaid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="layer_subarea"/> + <to state="layer"/> + </transition> + + <state id="layer_without_geom" description="layer_without_geom" state="de.intevation.gnv.state.DefaultState"> + <queryID>layer</queryID> + <dataname>layerid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="layer_without_geom"/> + <to state="layer_calculate_results"/> + </transition> + + <state id="layer" description="layer" state="de.intevation.gnv.state.DefaultState"> + <queryID>layer</queryID> + <dataname>layerid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="layer"/> + <to state="layer_calculate_results"/> + </transition> + + <state id="layer_calculate_results" description="layer_calculate_results" state="de.intevation.gnv.state.layer.LayerOutputState"> + <queryID>layer_request_data</queryID> + <queryID-layerdata>layer_data</queryID-layerdata> + <inputvalues> + <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + <outputsModes> + <outputsMode name="zip" description="Export als ZIP-Archiv" mime-type="application/zip"/> + <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url"/> + </outputsModes> + </state> + + </states> +</artifact>
--- a/gnv-artifacts/doc/conf/queries.properties Fri Feb 12 15:36:05 2010 +0000 +++ b/gnv-artifacts/doc/conf/queries.properties Fri Feb 12 18:04:58 2010 +0000 @@ -1212,4 +1212,27 @@ mapviewer_interface_mapservices_has_parameter_using_layer = SELECT DISTINCT ID_PARAMETER \ FROM MEDIAN.LAYER_HAS_PARAMETER \ WHERE ID_MAPSERVICE = ? AND \ - ID_LAYER IN (?) \ No newline at end of file + ID_LAYER IN (?) + +############################################# +############################################# +######### Layer Contis und Nauthis ########## +############################################# +############################################# + +layer = SELECT ID_LAYER KEY, \ + TITLE || '-' || LAYER_NAME VALUE \ + FROM MEDIAN.LAYER_HAS_SUBTYPES \ + WHERE ID_FEATURECLASS LIKE ? \ + ORDER BY LAYER_NAME + +layer_request_data = SELECT ID_FEATURECLASS, \ + QUERY_STRING, \ + TITLE, \ + LAYERNAME \ + FROM MEDIAN.LAYER_HAS_SUBTYPES \ + WHERE ID_LAYER = ? + +layer_data = SELECT ST_ASTEXT(SHAPE) \ + FROM ? \ + WHERE ? \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/layer/LayerArtifact.java Fri Feb 12 18:04:58 2010 +0000 @@ -0,0 +1,50 @@ +/** + * + */ +package de.intevation.gnv.layer; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.gnv.artifacts.GNVArtifactBase; + +/** + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class LayerArtifact extends GNVArtifactBase{ + + /** + * the logger, used to log exceptions and additionally information + */ + private static Logger log = Logger.getLogger(LayerArtifact.class); + + /** + * The UID of this Class + */ + private static final long serialVersionUID = 409054207294748753L; + + /** + * Constructor + */ + public LayerArtifact() { + super(); + log.debug("LayerArtifact.Constructor"); + this.name = "layer"; + } + + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String, + * de.intevation.artifacts.ArtifactFactory, java.lang.Object + * org.w3c.dom.Document) + */ + @Override + public void setup(String identifier, ArtifactFactory factory, + Object context, Document data) { + log.debug("LayerArtifact.setup"); + super.setup(identifier, factory, context, data); + } + +}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java Fri Feb 12 15:36:05 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java Fri Feb 12 18:04:58 2010 +0000 @@ -3,30 +3,7 @@ */ package de.intevation.gnv.state; -import de.intevation.artifactdatabase.Config; - -import de.intevation.artifacts.CallContext; -import de.intevation.artifacts.CallMeta; - -import de.intevation.gnv.artifacts.cache.CacheFactory; - -import de.intevation.gnv.artifacts.ressource.RessourceFactory; - -import de.intevation.gnv.geobackend.base.Result; - -import de.intevation.gnv.geobackend.base.query.QueryExecutor; -import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; - -import de.intevation.gnv.geobackend.base.query.exception.QueryException; - -import de.intevation.gnv.state.describedata.MinMaxDescribeData; - -import de.intevation.gnv.state.exception.StateException; - -import de.intevation.gnv.utils.InputValidator; - import java.io.OutputStream; - import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -34,12 +11,24 @@ import java.util.Locale; import org.apache.log4j.Logger; - import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.gnv.artifacts.cache.CacheFactory; +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.query.QueryExecutor; +import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; +import de.intevation.gnv.geobackend.base.query.exception.QueryException; +import de.intevation.gnv.state.describedata.MinMaxDescribeData; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.utils.InputValidator; + /** * @author Tim Englich <tim.englich@intevation.de> * @@ -222,7 +211,7 @@ * @param returnValue * @return */ - private Collection<Result> getData(String queryID) { + protected Collection<Result> getData(String queryID) { log.debug("OutputStateBase.getData"); Collection<Result> returnValue = null; try {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java Fri Feb 12 18:04:58 2010 +0000 @@ -0,0 +1,101 @@ +/** + * + */ +package de.intevation.gnv.state.layer; + +import java.io.OutputStream; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import de.intevation.artifactdatabase.Config; +import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.ArtifactNamespaceContext; +import de.intevation.artifacts.CallContext; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.state.InputData; +import de.intevation.gnv.state.OutputStateBase; +import de.intevation.gnv.state.exception.StateException; + +/** + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class LayerOutputState extends OutputStateBase { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = Logger.getLogger(LayerOutputState.class); + + /** + * The UID of this Class. + */ + private static final long serialVersionUID = 9180957321704424049L; + + /** + * The ID for the Query fetching the Layer from the DB + */ + private String dataQueryID = null; + /** + * Constructor + */ + public LayerOutputState() { + super(); + } + + /** + * @see de.intevation.gnv.state.OutputState#out(org.w3c.dom.Document, + * java.util.Collection, java.io.OutputStream, + * java.lang.String, de.intevation.artifacts.CallContext) + */ + public void out(Document format, Collection<InputData> inputData, + OutputStream outputStream, String uuid, + CallContext callContext) throws StateException { + + log.debug("LayerOutputState.out"); + String outputMode = XMLUtils.xpathString( + format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); + if (outputMode.equalsIgnoreCase("wms")) { + Collection<Result> data = this.fetchData(); + // TODO USE ME + }else if (outputMode.equalsIgnoreCase("zip")){ + Collection<Result> data = this.fetchData(); + // TODO USE ME + } + } + + + protected Collection<Result> fetchData(){ + log.debug("LayerOutputState.fetchData"); + // TODO PUT ALL in CACHE + Collection<Result> result = this.getData(this.queryID); + Collection<Result> data = null; + if (result != null){ + Iterator<Result> it = result.iterator(); + String table = null; + String where = null; + if (it.hasNext()){ + Result resultValue = it.next(); + table = resultValue.getString(0); + where = resultValue.getString(1); + // TODO ADD SpatialFilter if Geometry is available + } + + data = null; // TODO Fetch the Data for the Layer and Trim the Geometries + // using the Geometry if on is available. + } + return data; + } + + @Override + public void setup(Node configuration) { + log.debug("LayerOutputState.setup"); + super.setup(configuration); + this.dataQueryID = Config.getStringXPath(configuration,"queryID-layerdata"); + } + +}