Mercurial > dive4elements > gnv-client
changeset 1143:597163195dc9
dummy merge for repo head
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:21 +0200 |
parents | 12abbf15f18a (diff) 755dd2fa4a0a (current diff) |
children | f444cfce0b3d |
files | geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java gnv/src/main/webapp/WEB-INF/config/log4j.properties gnv/src/main/webapp/images/bg_fieldset.gif gnv/src/main/webapp/images/bg_fieldset_ie6.gif gnv/src/main/webapp/images/img.gif gnv/src/main/webapp/images/list-item.gif gnv/src/main/webapp/images/stock_data-save.png gnv/src/main/webapp/scripts/calendar-de.js gnv/src/main/webapp/scripts/calendar-en.js gnv/src/main/webapp/scripts/calendar-setup.js gnv/src/main/webapp/scripts/calendar-setup_stripped.js gnv/src/main/webapp/scripts/calendar.js gnv/src/main/webapp/scripts/calendar_stripped.js gnv/src/main/webapp/styles/calendar-blue.css |
diffstat | 590 files changed, 51384 insertions(+), 11800 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/ChangeLog Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,546 @@ +2012-07-05 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * README: New file with minimal instructions how to build the + documentation. + +2010-08-13 Tim Englich <tim@intevation.de> + + * admin-manual/installation-artifact-server.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex: + Added corrections and wishes of the training on the installation + which was given to the BSH. + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * admin-manual/installation-base.tex: Some refactoring of the proxy + installation. + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * config-manual/general_settings.tex: Removed section 'Adding new + Languages'. This section should be placed in an own file. + + * config-manual/adding_new_languages.tex: New file for section 'Adding new + Languages'. + + * config-manual/config-manual.tex: Include section 'Adding new Languages'. + +2010-06-29 Tim Englich <tim@intevation.de> + + * admin-manual/installation-base.tex: + Added Section which explains how to install the proxy-script + which is required for the OpenLayers-Client which is integrated in the + GNV-Web-Client. + +2010-06-29 Tim Englich <tim@intevation.de> + + * config-manual/general_settings.tex: + Added section with the description how to add a new + language to the system into the config-manual. + +2010-06-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * licenses/overview.txt: Overview of external libs and its licenses. + +2010-05-12 Hans Plum <hans@intevation.de> + + Tagging as Version 1.0 + +2010-05-12 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex, + config-manual/title.tex, + config-manual/generating_maps.tex, + config-manual/general_settings.tex, + config-manual/miscellanea.tex, + config-manual/Makefile, + config-manual/administering_artifact-server.tex: + Adapted titlepage to admin manual. Replaced with public Makefile + according to admin manual. (XXX) Added some workaround linebreaks with + typewriter sections + +2010-05-12 Hans Plum <hans@intevation.de> + + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex, + config-manual/generating_maps.tex, + config-manual/overview.tex, + config-manual/generating_charts.tex, + config-manual/general_settings.tex, + config-manual/administering_artifact-server.tex: + Final QS of all chapters. Cleanup FIXMEs and typos mainly. + +2010-05-10 Hans Plum <hans@intevation.de> + + * config-manual/generating_maps.tex: + Added content about generating maps with extensive background + information about the interaction between artifact-server and + mapserver. + +2010-05-10 Hans Plum <hans@intevation.de> + + * config-manual/model_of_transitions.tex, + config-manual/generating_charts.tex, + config-manual/general_settings.tex: + Added content about generating charts. + +2010-05-10 Tim Englich <tim@intevation.de> + + * config-manual/general_settings.tex, + config-manual/config-manual.txt: + Added short documentation for the file timegap_definition.xml. The + usage and the definition of the values stored in the file are + explained in the file itself. + +2010-05-10 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Done some litte changes in the introduction of the + Section Model of Transitions. + +2010-05-10 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex, + config-manual/general_settings.tex: + Moved section Query-configuration to Section Model of Transitions. + +2010-05-10 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Do some Documentstyling. Added Typewriter-Style + to mark XML-Elements and other technical Items. + +2010-05-10 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Fixed some mistakes. + +2010-05-09 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.txt: + fragment missed in last commit + + * admin-manual/overview.tex: + fix some copy&paste mistakes + +2010-05-09 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.tex: + referenced new documents + + * config-manual/overview.tex (added): + introduction/overview of the GNV-server consisting of + artifact- and mapserver + + * config-manual/general_settings.tex: + overview of the entire configuration + + * config-manual/generating_maps.tex (added), + config-manual/generating_charts.tex (added), + config-manual/administering_artifact-server.tex (added): + split up in typical tasks: + - administration and installation + - generating charts (TODO: Fill me) + - generating maps (TODO: Fill me) + - configuring fis, products, etc. (TODO: Integrate me) + + * config-manual/config-manual.txt: + Added some hints + +2010-05-07 Tim Englich <tim@intevation.de> + + * general_settings.tex: + Document following Sections: + artifact-factories, artifacts, mapserver, velocity, ehcache, + geo-backend + Description of geo-backend/Backend-Configuration is missing. + +2010-05-07 Tim Englich <tim@intevation.de> + + * general_settings.tex: + Added first Structure and XML-Structure for the documentation + of the File conf.xml. + Added the Documentation for the System-Properties. + +2010-05-07 Tim Englich <tim@intevation.de> + + * general_settings.tex: + Added separat LaTex-File for the Documentation of the general + settings. + * config-manual.tex: + Include the File general_settings.tex into the main Document. + +2010-05-07 Tim Englich <tim@intevation.de> + + * model_of_transitions.tex: + Answerd Questions and increase some Sections of the Documentation. + +2010-05-07 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.txt: Added some more FIXMEs for internal + DB interface + +2010-05-07 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.txt, + config-manual/model_of_transitions.tex: + Commit before and now: Added some FIXMEs for getting a better + understanding + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/figures/bsh_logo.gif: + converted to .png because of compile error + +2010-05-06 Hans Plum <hans@intevation.de> + + * tex/*, src/*, README: + Deleted stubs of documentation. + + * test-guideline/README: Added a README to give user more orientation. + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/installation-artifact-server.tex, + admin-manual/installation-base.tex: + Renamed gnv-wrapper to gnv-wms to clearify function + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/installation-admin-manual.txt: + Clean up; all content moved tp *.tex + + * admin-manual/installation-admin-manual.tex: + Adapted a file name after renaming + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/installation-artifact-server.tex: renamed from + admin-manual/installation-artefact-server.tex in order to unify use of + naming + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/overview.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-artefact-server.tex: + Unified naming of artefact to artifact + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/title.tex, + admin-manual/installation-admin-manual.tex, + admin-manual/figures/bsh_logo.gif, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, + admin-manual/installation-artefact-server.tex: + Finalized documentation with references, unifying tools, adding logos. + TODO: Unify the use of artifact. Checking against implementation. + +2010-05-06 Hans Plum <hans@intevation.de> + + * admin-manual/Makefile: + Replaced selfmade Makefile through a specialized one from + http://www.bouncingchairs.net/oss (GPL) + +2010-05-05 Hans Plum <hans@intevation.de> + + * admin-manual/overview.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, + admin-manual/installation-artefact-server.tex: + Removed sections about deinstallation and monitoring because they were + not tested. + +2010-05-05 Hans Plum <hans@intevation.de> + + * admin-manual/installation-admin-manual.tex, + admin-manual/overview.tex, + admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, + admin-manual/installation-artefact-server.tex: + Improving artifact, webclient and operation section. Added hyperref + package. + +2010-05-04 Tim Englich <tim@intevation.de> + * config-manual/model_of_transitions.tex: + Fixed some typos. Do some document-styling. + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added Sample calls for creating an FIS and also getting + the Products which it contains. + * config-manual/sample-documents/create-artifact.xml: + Added XMl-Document which contains the XML-Request-Body for + the http-post call for creating an Artifact. + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added Example for adding a new Product to a FIS. + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added Example for adding a new Artifact for the FIS with no + Products to the REST-Server. + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added Example for adding a new FIS to the REST-Server. + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added listing of all supported OutputStates. + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added MarineFeatures as Subtype of ESRI ArcMarineBSH + +2010-05-04 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added description for Configuration of InputValue of states and short + examples of the usage in SQL-statements to the Documentation. + +2010-05-04 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex: + Fixed compilation error and revert temporary change for graphix + package + +2010-05-04 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.tex, + config-manual/model_of_transitions.tex: + Added an overview of the subject-specific part of the configuration + introducing the dependencies of the relevant files + +2010-05-03 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added Mapping between the Configuration an the shown Objects in the + System into the Documentation. + +2010-05-03 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added Description of Configuration for OutputStates and OutputModes. + +2010-05-03 Tim Englich <tim@intevation.de> + + * config-manual/model_of_transitions.tex: + Added description of Configuration of States and Transitions. + Also added description for the Configuration of an product. + Added enumerations. + +2010-04-30 Tim Englich <tim.englich@intevation.de> + + * config-manual/model_of_transitions.tex: + Added the first descriptions of the Configuration of + Artifact-Factories, Artifacts representing a FIS and the Products + which can be configured to the different FIS. + +2010-04-30 Tim Englich <tim.englich@intevation.de> + + * config-manual/config-manual.tex: + Added Include for File model_of_transitions.tex into the main + Document. + * config-manual/model_of_transitions.tex: + Added File for the Documentation of the FIS, Products and the + required Transitionmodels of a Product. + Added Howto for configuring a new FIS, configuring a new product and + adding a additional Product to a FIS. + +2010-04-30 Tim Englich <tim.englich@intevation.de> + + * config-manual/config-manual.tex: + Added the main LaTex-Document. + * config-manual/title.tex: + Added the LaTex-IncludeDocument which will include + the Title-Page of this document + * config-manual/figures: + Added folder for figures which should be integrated in this Document. + * config-manual/Makefile: + Adding Makefile for generating e.g. an PDF-Document + * config-manual/figures/intevation-logo.eps: + Added Intevation Logo. + +2010-04-30 Hans Plum <hans@intevation.de> + + * config-manual/config-manual.txt: + Added a first draft for a configuration manual for the + artifact server + +2010-04-28 Hans Plum <hans@intevation.de> + + * test-guideline/gnv-horizontalprofile.txt, + test-guideline/gnv-verticalprofile.txt, + test-guideline/gnv-timerseries.txt, test-guideline/gnv-layer.txt, + test-guideline/gnv-framework.txt, + test-guideline/gnv-horizontal-cross-section.txt, + test-guideline/gnv-vertical-cross-section.txt, + test-guideline/gnv-test-guideline.txt, + test-guideline/gnv-horizontales-schnittprofil.txt: + Added a test-guideline for the matrix of products to database + schemata. Look into test-guideline/gnv-test-guideline.txt for further + information. + +2010-04-28 Hans Plum <hans@intevation.de> + + * Renamed admin-manual/abbildungen in admin-manual/figures + + * admin-manual/title.tex: Adapted file path after renaming + + * admin-manual/installation-artefact-server.tex: + Added 2 FIXMEs + +2010-04-28 Hans Plum <hans@intevation.de> + + * admin-manual, admin-manual/installation-admin-manual.txt, + admin-manual/title.tex, admin-manual/installation-admin-manual.tex, + admin-manual/overview.tex, admin-manual/operating-the-system.tex, + admin-manual/installation-base.tex, + admin-manual/installation-webclient.tex, admin-manual/abbildungen, + admin-manual/installation-artefact-server.tex, admin-manual/Makefile: + Moved all admin-manual specific files in new directory admin-manual + +2010-04-28 Hans Plum <hans@intevation.de> + + * installation-admin-manual.txt, title.tex, + tex/*, installation-admin-manual.tex, overview.tex, ChangeLog, + operating-the-system.tex, src/*, installation-base.tex, abbildungen, + installation-webclient.tex, installation-artefact-server.tex, + Makefile, README: + Moved content to trunk. + +2010-04-28 Hans Plum <hans@intevation.de> + + * trunk/, tags/, branches/: + Added standard SVN structure for this module + +2010-04-28 Hans Plum <hans@intevation.de> + + * installation-admin-manual.txt: + Moved content into LaTeX documents + + * New: title.tex + installation-admin-manual.tex + overview.tex + operating-the-system.tex + installation-base.tex + installation-webclient.tex + installation-artefact-server.tex: + Formatting of content and updating content. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.tex: + First Documentstructure for LaTex-Document + * abbildungen: + Added Folder for images. + * MakeFile: + File to generate PDF. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.txt: + Added description which Version of Operatin System has + to be installed. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall the + GNV-Client into the Tomcat Application Server. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall the + UMN-Mapserver Version 5.6.3 using Gispatcher-Resources on + the Operation System. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall Apache + Webserver Version 2.2 including Mod-JK on the Operation System. + +2010-04-27 Hans Plum <hans@eulimene> + + * installation-admin-manual.txt: + Added overview of the system, installation of + artefact-server and operation of the GNV system. + +2010-04-26 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall Apache + Tomcat Applicationserver Version 5.5 on the Operation System. + Added all relevant commands which have to be executed + from the Systemadministrator. Also put Snippets of the Configuration + Files to the Content of this File. + + +2010-04-26 Tim Englich <tim.englich@intevation.de> + + * installation-admin-manual.txt: + Added description howto install, configure and uninstall Java 1.6 on + the Operation System. + Added all relevant commands which have to be executed from the + Systemadministrator. + +2010-04-20 Hans Plum <hans@intevation.de> + + * installation-admin-manual.txt: + Added relevant installation notices of an installation of a vanilla + Debian Lenny System with Tomcat 5.5 and UMN MapServer (Debian Package) + preinstalled + +2010-04-20 Hans Plum <hans@intevation.de> + + * installation-admin-manual.txt: + Added UMN Mapserver as component; added responsibility for chapters; + removed extensive numbering in order to avoid manual updating. A word + processor can do this later on. + +2010-04-20 Hans Plum <hans@intevation.de> + + * installation-admin-manual.txt: + Renamed handbook.txt to installation-admin-manual.txt to make the task + clearer. + +2010-04-20 Hans Plum <hans@intevation.de> + + * handbook.txt: + Restructered the draft a bit and added Integration of Apache WebServer + and Apache Tomcat explicitly. + +2010-04-19 Tim Englich <tim.englich@intevation.de> + + * handbook.txt: + Initial Checkin of installation and administration manual. + This document contains a first draft of an outline of the contents. + +2010-04-11 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * tex/Makefile, tex/tech-doku.tex: Initialer Checkin der + technischen Dokumentarion. + +2010-02-16 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src: Quellen der Dokumentation + * ChangeLog, README: Angelegt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/README Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,11 @@ +To build pdf documentation, call `make` with the documents name without the +".tex" extension, e.g. + + cd admin-manual + make installation-admin-manual + +will result in + + installation-admin-manual.pdf + +.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/Makefile Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,3492 @@ +# Copyright 2004 Chris Monson (shiblon@gmail.com) +# Latest version available at http://www.bouncingchairs.net/oss +# +# This file is part of ``Chris Monson's Free Software''. +# +# ``Chris Monson's Free Software'' is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, Version 2. +# +# ``Chris Monson's Free Software'' is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with ``Chris Monson's Free Software''; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# It is also available on the web at http://www.gnu.org/copyleft/gpl.html +# +# Note that using this makefile to build your documents does NOT place them +# under the GPL unless you, the author, specifically do so. In other words, +# I, Chris Monson, the copyright holder and author of this makefile, +# consider it impossible to ``link'' to this makefile in any way covered by +# the GPL. +# +# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN: +# make help +# +fileinfo := LaTeX Makefile +author := Chris Monson +version := 2.2.0-rc1 +# +# Note that the user-global version is imported *after* the source directory, +# so that you can use stuff like ?= to get proper override behavior. +.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini +-include Makefile.ini +-include $(HOME)/.latex-makefile/Makefile.ini +# +# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini: +# BUILD_STRATEGY := latex +BUILD_STRATEGY ?= pdflatex +# +# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be +# # immune to changes to the locale in the user environment. +export LC_ALL ?= C +# +# +# If you specify sources here, all other files with the same suffix +# will be treated as if they were _include_ files. +#onlysources.tex ?= main.tex +#onlysources.tex.sh ?= +#onlysources.tex.pl ?= +#onlysources.tex.py ?= +#onlysources.rst ?= +#onlysources.fig ?= +#onlysources.gpi ?= +#onlysources.dot ?= +#onlysources.xvg ?= +#onlysources.svg ?= +#onlysources.eps.gz ?= +#onlysources.eps ?= +# +# If you list files here, they will be treated as _include_ files +#includes.tex ?= file1.tex file2.tex +#includes.tex.sh ?= +#includes.tex.pl ?= +#includes.tex.py ?= +#includes.rst ?= +#includes.fig ?= +#includes.gpi ?= +#includes.dot ?= +#includes.xvg ?= +#includes.svg ?= +#includes.eps.gz ?= +#includes.eps ?= +# +# If you list files or wildcards here, they will *not* be cleaned - default is +# to allow everything to be cleaned. +#neverclean ?= *.pdf +# +# Alternatively (recommended), you can add those lines to a Makefile.ini file +# and it will get picked up automatically without your having to edit this +# Makefile. +# +# KNOWN ISSUES: +# * The following occurs: +# file with: \usepackage{named}\bibliographystyle{named} +# Compile +# change to: \usepackage{apalike}\bibliographystyle{apalike} +# Compile again -- BARF! +# +# The workaround: make clean-nographics; make +# +# Note that we may not be able to fix this. LaTeX itself barfs +# on this, not the makefile. The very first invocation of LaTeX +# (when something like this has happened) reads the existing .aux +# file and discovers invalid commands like \citeauthoryear that +# are only valid in the package that was just removed. It then +# tries to parse them and explodes. It's not at all clear to me +# how to fix this. I tried removing the .aux files on the first +# run of LaTeX, but that necessarily requires more subsequent +# rebuilds on common edits. There does not appear to be a +# graceful solution to this issue. +# +# CHANGES: +# Chris Monson (2010-04-08): +# * Bumped version to 2.2.0-rc1 +# * Added back in the rst_style_file stuff that got broken when switching +# rst -> tex to use the script mechanism +# Chris Monson (2010-03-23): +# * Bumped version to 2.2.0-beta8 +# * Work on issue 76: bad backtick escape for some sed versions, failure +# to clear out the hold buffer when outputting MISSING comment. +# - Backed out 2>&1 to &> (doesn't work in sh) +# - Backed out using . to source variables +# Chris Monson (2010-03-22): +# * Bumped version to 2.2.0-beta7 +# * Issue 72: Fix latex/bibtex invocation order for annotated bib styles +# * Fixed informational output to reflect which LaTeX run we're on +# * Fixed graphic detection to include graphics that are already there in +# .d files +# * Tightened up the .d file output to only make .d depend on graphic +# *source* files. This means that building foo.d no longer +# builds all of the graphics files on which foo.tex depends. +# Had to use .SECONDEXPANSION trickery to make it work. +# * Changed get-graphics to only accept a stem. +# * Fixed build-once logic for scripted .tex to work better +# * Made get-inputs sed script more maintainable. +# * Moved Makefile.ini import up higher. +# * Changed bare stems to not recursively invoke make +# * Updated diff output to be more silent everywhere +# * Added a MISSING comment to the .d file if stuff isn't found - forces +# removal of .1st.make file, which often forces it to try again. +# * Fixed broken graphics-target function +# * Added sleep to .d file generation when stuff is missing - if it +# builds too fast, make doesn't realize it needs to be reloaded, +# and thus never discovers some deeper dependencies (especially +# evident when graphics are included from scripted include +# files). +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta6 +# * Fixed bareword builds to actually work (requires static patterns) +# * Fixed colorization to work with new paragraph stuff +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta5 +# * Fixed graphic detection to be much more focused - splits log file +# into paragraphs before doing pattern matching. +# * Fixed make foo to work properly (recursively calls make foo.pdf) +# * Fixed gpi -> pdf generation to not waste time building .eps *after* +# the pdf already exists. +# * Changed log copies to include MAKE_RESTARTS as part of the name. +# * Fixed missing include file detection (also makes use of the paragraph +# stuff) to detect missing scripted include files. +# Chris Monson (2010-03-16): +# * Bumped version to 2.2.0-beta4 +# * issue 70: .pdf not moved out of the way properly on first +# compilation, resulting in early error detection failure. +# * issue 74: fixed broken error on missing .aux files: the +# implementation was masking real errors. +# Chris Monson (2010-03-15): +# * Bumped version to 2.2.0-beta3 +# * issue 71: Made the tput dependency optional +# * issue 73: Made .tex targets not pull in .d files (building them from +# scripts should not require a .d) +# * issue 74: Output a much saner error when a .aux file is not produced +# (e.g., when you are typing "make" without arguments in a +# directory with included .tex files that are not named with +# ._include_.) +# Chris Monson (2010-03-11): +# * Bumped version to 2.2.0-beta2 +# * Fixed clean-graphics to get rid of intermediate .eps files that may +# be hanging around +# * Added an automatic setting to use eps terminals in pdflatex mode for +# gnuplot if it doesn't understand pdf. +# * issue 66: Removed grayscale generation via magic suffix. Grayscale +# generation is now only available via GRAY=1 +# * issue 68: Added explicit handling of LC_ALL for locale-aware tools +# like "sort" +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-beta1 +# * Fixed success message to handle output message in different places +# * Added name of produced file to success message +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-alpha3 +# * Added meaningful error message for wrong hyperref options +# * Added meaningful error message for incorrect graphics extensions +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha2 +# * Updated graphics handling (gnuplot and fig generate pdf natively) +# * Changed xmgrace to output monochrome natively +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha1 - major change! +# * Support pdflatex natively and by default (issue 6 - a long time coming) +# * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for +# all invocations +# * Reworked graphic inclusion detection so that extensions need not be +# specified for either build strategy (e.g., +# \includegraphics{test1.eps} -> \includegrahpics{test1}) +# * Changed log format to include filenames and line numbers +# Chris Monson (2010-02-04): +# * Bumped version to 2.1.43 +# * All of the following are for issue 63 (thanks to mojoh81): +# * Added documentation about fixing Makefile.ini default target +# * Added perl and python script targets +# * Fixed run logic to allow included .tex files to be scripted (the +# run-again logic now detects missing .tex files, and the MV +# command has been switched out for a command that only invokes +# MV if the files exist) +# * Changed scripted generation to only run once per make invocation +# * Added dependency on expr +# Chris Monson (2010-01-19): +# * Bumped version to 2.1.42 +# * issue 62: Added .brf extension to cleanable files (backrefs) +# Chris Monson (2010-01-07): +# * Bumped version to 2.1.41 +# * issue 60: bad makeindex runs now error out on subsequent tries +# Chris Monson (2009-12-01): +# * Bumped version to 2.1.40 +# * issue 36: build all indices (for e.g., splitidx usage) +# * issue 59: clean up all generated files (including indices) +# Chris Monson (2009-11-23): +# * Bumped version to 2.1.39 +# * issue 57: change ps2pdf invocations to just use gs directly +# Chris Monson (2009-11-19): +# * Bumped version to 2.1.38 +# * issue 57: Added some limited support for Cygwin (spaces in filenames) +# Chris Monson (2009-11-15): +# * Bumped version to 2.1.37 +# * Removed svninfo, since this is now managed by mercurial +# * Fixed typo in changelist +# * Issue 52: added jpg->eps conversion (thanks to brubakee) +# * Issue 54: fix missing Overfull colorization due to lack of a blank +# line preceding the first error. +# * Issue 51: remove head.tmp and body.tmp in make clean invocation +# * Issue 56: maintain multiple versions of log files (for debugging) +# Chris Monson (2009-11-14): +# * Bumped version to 2.1.36 +# * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables +# Chris Monson (2009-11-05): +# * Bumped version to 2.1.35 +# * Added nomenclature support (see issue 48) +# Chris Monson (2009-10-29): +# * Bumped version to 2.1.34 +# * Fixed _out_ creation bug introduced in 2.1.33 (it was always created) +# * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR +# * Changed contact email address - bring on the spam! +# Chris Monson (2009-10-21): +# * Bumped version to 2.1.33 +# * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay) +# * Made all_files.* settable in Makefile.ini (using ?= instead of :=) +# * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy +# dvi, pdf, and ps if it exists +# Chris Monson (2009-09-25): +# * Bumped version to 2.1.32 +# * Fixed so that a changed lol file will cause a rebuild +# * Added .lol files to the cleanable list +# Chris Monson (2009-09-08): +# * Bumped version to 2.1.31 +# * Closed issue 43: evince doesn't notice pdf change w/out touch +# Chris Monson (2009-08-28): +# * Bumped version to 2.1.30 +# * Closed issue 39: Capture multi-line log warnings/errors to output +# Chris Monson (2009-08-26): +# * Bumped version to 2.1.29 +# * Closed issue 42: add svg support using inkscape +# Chris Monson (2009-08-17): +# * Bumped version to 2.1.28 +# * Patch from paul.biggar for issue 38: package warnings are overlooked +# Chris Monson (2009-08-07): +# * Bumped version to 2.1.27 +# * Included patch for issue 37 - removes pdf/ps files before copying, +# allowing some broken viewers to see changes properly. +# Chris Monson (2009-05-15): +# * Bumped version to 2.1.26 +# * Included patch for issue 9 from favonia - detects .fig changes for +# pstex files during regular compilation, so long as the pstex +# has been built at least once with make all-pstex. +# Chris Monson (2009-03-27): +# * Bumped version to 2.1.25 +# * Cleaned up a bunch of variable setting stuff - more stuff is now +# settable from Makefile.ini +# * Cleaned up documentation for various features, especially settable +# variables. +# * issue 28: support for png -> eps conversion (it even looks good!) +# * issue 29: support for "neverclean" files in Makefile.ini +# * issue 30: make ps2pdf14 the default - fall back when not there +# Chris Monson (2009-03-09): +# * Bumped version to 2.1.24 +# * issue 27: xmgrace support (thanks to rolandschulzhd) +# Chris Monson (2008-10-23): +# * Bumped version to 2.1.23 +# * issue 23: fixed _check_programs to not use bash string subs +# Chris Monson (2008-09-02): +# * Bumped version to 2.1.22 +# * Appled patch from Holger <yllohy@googlemail.com> to add include +# sources and some documentation updates. +# * Updated backup_patterns to be a bit more aggressive (also thanks to +# Holger) +# Chris Monson (2008-08-30): +# * Bumped version to 2.1.21 +# * Added ability to specify onlysources.* variables to indicate the only +# files that should *not* be considered includes. Thanks to Holger +# <yllohy@googlemail.com> for this patch. +# * Added an automatic include of Makefile.ini if it exists. Allows +# settings to be made outside of this makefile. +# Chris Monson (2008-05-21): +# * Bumped version to 2.1.20 +# * Added manual pstex compilation support (run make all-pstex first) +# * Removed all automatic pstex support. It was totally breaking +# everything and is very hard to incorporate into the makefile +# concept because it requires LaTeX to *fail* before it can +# determine that it needs the files. +# Chris Monson (2008-04-17): +# * Bumped version to 2.1.19 +# * Changed the pstex build hack to be on by default +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.18 +# * issue 16: fixed pstex build problems, seems nondeterministic. Added +# gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1. +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.17 +# * issue 20: fixed accumulation of <pid>*.make files - wildcard was +# refusing to work on files that are very recently created. +# Chris Monson (2008-04-02): +# * Bumped version to 2.1.16 +# * issue 19: Removed the use of "type" to fix broken "echo" settings +# Chris Monson (2008-03-27): +# * Bumped version to 2.1.15 +# * issue 18: Favors binary echo over builtin, as binary understands -n +# * issue 16: Fixed handling of missing pstex_t files in the log +# * issue 9: Added .SECONDARY target for .pstex files +# Chris Monson (2008-03-21): +# * Bumped version to 2.1.14 +# * Fixed broken aux file flattening, which caused included bibs to be +# missed. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.13 +# * Changed error output colorization to show errors for missing files +# that are not graphics files. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.12 +# * Fixed a regression introduced in r28 that makes bibtex fail when +# there is no index file present +# Chris Monson (2008-03-03): +# * Bumped version to 2.1.11 +# * Fixed issue 11 (handle index files, reported by abachn) +# * Cleaned up some comments and help text +# Chris Monson (2008-01-24): +# * Bumped version to 2.1.10 +# * Fixed to work when 'sh' is a POSIX shell like 'dash' +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.9 +# * Fixed documentation and dependency graph for pstex files +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.8 +# * Added basic pstex_t support for fig files (Issue 9 by favonia) +# I still suggest that psfrag be used instead. +# Chris Monson (2007-10-16): +# * Bumped version to 2.1.7 +# * Removed todo item: allow other comment directives for rst conversion +# * Added ability to use global rst style file _rststyle_._include_.tex +# * Added help text to that effect +# Chris Monson (2007-05-20): +# * Bumped version to 2.1.6 +# * Changed default paper size for rst files +# * Added todo item: fix paper size for rst files +# * Added todo item: allow other comment directives for rst conversion +# Chris Monson (2007-04-02): +# * Bumped version to 2.1.5 +# * Addressed Issue 7, incorrect .gpi.d generation in subdirectories +# Chris Monson (2007-03-28): +# * Bumped version to 2.1.4 +# * Fixed syntax error in dot output +# Chris Monson (2007-03-01): +# * Bumped version to 2.1.3 +# * Added reST to the included documentation +# * Fixed graphics and script generation to be settable in the +# environment. +# Chris Monson (2007-02-23): +# * Bumped version to 2.1.2 +# * Added the ability to generate .tex files from .rst files +# Chris Monson (2006-10-17): +# * Bumped version to 2.1.1 +# * Fixed includes from subdirectories (sed-to-sed slash escape problem) +# Chris Monson (2006-10-05): +# * Bumped version to 2.1.0 (pretty serious new feature added) +# * New feature: bib files can now be anywhere on the BIBINPUTS path +# * New programs: kpsewhich (with tetex) and xargs (BSD) +# Chris Monson (2006-09-28): +# * Bumped version to 2.0.9 +# * Added ability to parse more than one bibliography +# Chris Monson (2006-06-01): +# * Bumped version to 2.0.8 +# * Added .vrb to the list of cleaned files +# Chris Monson (2006-04-26): +# * Bumped version to 2.0.7 +# * Fixed so that clean-nographics does not remove .gpi.d files +# * Removed jpg -> eps hack (not working properly -- just pre-convert) +# * Fixed so that postscript grayscale can be done with BSD sed +# Chris Monson (2006-04-25): +# * Bumped version to 2.0.6 +# * Fixed so that changed toc, lot, lof, or out causes a rebuild +# Chris Monson (2006-04-17): +# * Bumped version to 2.0.5 +# * Added jpg -> eps conversion target +# Chris Monson (2006-04-12): +# * Bumped version to 2.0.4 +# * Fixed BSD sed invocation to not use \| as a branch delimiter +# * Added a comment section on what is and is not allowed in BSD sed +# * Made paper size handling more robust while I was at it +# * Fixed postscript RGB grayscale to use a weighted average +# * Fixed postscript HSB grayscale to convert to RGB first +# * Fixed a problem with rebuilding .bbl files +# Chris Monson (2006-04-11): +# * Bumped version to 2.0.3 +# * Fixed some BSD sed problems: can't use \n in substitutions +# Chris Monson (2006-04-10): +# * Bumped version to 2.0.2 +# * Once again removed ability to create .tex files from scripts +# * \includeonly works again +# Chris Monson (2006-04-09): +# * Bumped version to 2.0.1 +# * Fixed grayscale postscript handling to be more robust +# * Added ability to generate ._gray_. files from eps and eps.gz +# * Added ability to clean ._gray_.eps files created from .eps files +# Chris Monson (2006-04-07): +# * Bumped version to 2.0.0 +# * Removed clunky ability to create included .tex files from scripts +# * Added note in the help about included tex scripting not working +# * Fixed the .eps generation to delete %.gpihead.make when finished +# * Abandoned designs to use shell variables to create sed scripts +# * Abandoned __default__.tex.sh idea: it causes recursion with %: . +# * Removed web page to-do. All items are now complete. +# * Added better grayscale conversion for dot figures (direct ps fixup). +# * Include files can now be scripted (at the expense of \includeonly). +# * Updated dependency graph to contain better node names. +# Chris Monson (2006-04-06): +# * Bumped version to 2.0b3 +# * Top level includes now fail if there is no rule to build them +# * A helpful message is printed when they do fail +# * Grayscale has been changed to be ._gray_, other phonies use _ now, too +# * Grayscale handling has been completed +# * Changed _include_stems target to _includes target. +# * Fixed _includes target to be useful by itself. +# * Removed the ability to specify clean and build targets at once +# * Verified that epsfig works fine with current code +# * Fixed included scripts so that they are added to the dep files +# * Fixed so that graphics includes don't happen if they aren't for gpi +# * Fixed dot output to allow grayscale. +# Chris Monson (2006-04-05): +# * Bumped version to 2.0b2 +# * Removed automatic -gray output. It needs fixing in a bad way. +# * Revamped dependency creation completely. +# * Fixed conditional inclusion to actually work (test.nobuild.d, test.d). +# * Fixed clean target to remove log targets +# * Added the 'monochrome' word for gray gpi output +# * Added a _check_gpi_files target that checks for common problems +# * Changed the _version target into the version target (no _) +# * Added better handling of grayscale files. Use the .gray.pdf target. +# * Fixed testing for rebuilds +# Chris Monson (2006-04-04): +# * Bumped version to 2.0b1 +# * Changed colorization of output +# * Made .auxbbl and .auxtex .make files secondary targets +# * Shortened and simplified the final latex invocation loop +# * Added version-specific output ($$i vs. $$$$i) in latex loop +# * Added a build message for the first .dvi run (Building .dvi (0)) +# * Removed some build messages that most people don't care about. +# * Simplified procedure for user-set colors -- simple text specification +# * Fixed diff output to...not output. +# * Fixed rerun bug -- detect not only when preceded with LaTeX Warning +# * Sped up gpi plotting +# * Added error handling and colorized output for gpi failure +# * Documented color changing stuff. +# * Now sort the flattened aux file to avoid false recompilation needs +# * Added clean-nographics target +# * Don't remove self.dvi file if self.aux is missing in the log +# * Clarified some code. Did some very minor adjusting. +# Chris Monson (2006-04-03): +# * Bumped version to 2.0a7 +# * Added .dvi and .ps files as secondary files. +# * Fixed handling of multiple run detection when includeonly is in use. +# * Added code to flatten .aux files. +# * Added more files as .SECONDARY prerequisites to avoid recompilation. +# * Fixed the inputs generation to be much simpler and to use pipes. +# * Added the dependency graph directly into the makefile. +# * Changed flatten-aux to remove \@writefile \relax \newlabel, etc. +# * Undid pipe changes with sed usage (BSD sed doesn't know -f-). +# * Added a _check_programs target that tells you what your system has. +# * Fixed an error in colorization that made unnecessary errors appear +# * Added view targets. +# * Updated help text. +# * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds +# * Added more informative error handling for dvips and ps2pdf +# Chris Monson (2006-04-02): +# * Bumped version to 2.0a6 +# * Added indirection to .bbl dependencies to avoid rebuilding .bbl files +# * Streamlined the diff invocation to eliminate an existence test +# * Removed special shell quote escape variables +# * Moved includes to a more prominent location +# * Fixed .inputs.make to not contain .aux files +# * Fixed embedding to use a file instead of always grepping. +# * Added *.make.temp to the list of cleanable files +# * Fixed Ruby. It should now be supported properly. +# * Now differentiate between all, default, and buildable files. +# * Fixed to bail out on serious errors. +# * Revised the handling of includable files. Still working on it. +# Chris Monson (2006-03-31): +# * Bumped version to 2.0a5 +# * Fixed a bug with LaTeX error detection (there can be spaces) +# * Added .bbl support, simplifying everything and making it more correct +# * Refactored some tests that muddy the code +# * Did a little cleanup of some shell loops that can safely be make loops +# * Added support for graphviz .dot files +# * Made _all_programs output easier to read +# * Added the ruby support that has long been advertised +# * Font embedding was screwed up for PostScript -- now implicit +# * Changed the generation of -gray.gpi files to a single command +# * Changed any make-generated file that is not included from .d to .make +# Chris Monson (2006-03-30): +# * Bumped version to 2.0a4 +# * Fixed a bug with very long graphics file names +# * Added a todo entry for epsfig support +# * Fixed a bug paper size bug: sometimes more than one entry appears +# * Fixed DVI build echoing to display the number instead of process ID +# * DVI files are now removed on first invocation if ANY file is missing +# * Added a simple grayscale approach: if a file ends with -gray.gpi, it +# is created from the corresponding .gpi file with a special +# comment ##GRAY in its header, which causes coloring to be +# turned off. +# * Fixed a bug in the handling of .tex.sh files. For some reason I had +# neglected to define file stems for scripted output. +# * Removed a trailing ; from the %.graphics dependencies +# * Added dvips embedding (I think it works, anyway) +# Chris Monson (2006-03-29): +# * Bumped version to 2.0a3 +# * Fixed error in make 3.79 with MAKEFILE_LIST usage +# * Added the presumed filename to the _version output +# * Added a vim macro for converting sed scripts to make commands +# * Added gpi dependency support (plotting external files and loading gpi) +# * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi +# * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}. +# Chris Monson (2006-03-28): +# * Bumped version to 2.0a2 +# * Added SHELL_DEBUG and VERBOSE options +# * Changed the default shell back to /bin/sh (unset, in other words) +# * Moved .PHONY declarations closer to their targets +# * Moved help text into its own define block to obtain better formatting +# * Removed need for double-entry when adding a new program invocation +# * Moved .SECONDARY declaration closer to its relevant occurrence +# * Commented things more heavily +# * Added help text about setting terminal and output in gnuplot +# * Created more fine-grained clean targets +# * Added a %.graphics target that generates all of %'s graphics +# * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps) +# * For now, we're just GPL 2, not 3. Maybe it will change later +# * Made the version and svninfo into variables +# Chris Monson (2006-03-27): +# * Bumped version to 2.0a1 +# * Huge, sweeping changes -- automatic dependencies + +# IMPORTANT! +# +# When adding to the following list, do not introduce any blank lines. The +# list is extracted for documentation using sed and is terminated by a blank +# line. +# +# EXTERNAL PROGRAMS: +# = ESSENTIAL PROGRAMS = +# == Basic Shell Utilities == +CAT ?= cat +CP ?= cp -f +DIFF ?= diff +ECHO ?= echo +EGREP ?= egrep +ENV ?= env +EXPR ?= expr +MV ?= mv -f +SED ?= sed +SORT ?= sort +TOUCH ?= touch +UNIQ ?= uniq +WHICH ?= which +XARGS ?= xargs +SLEEP ?= sleep +# == LaTeX (tetex-provided) == +BIBTEX ?= bibtex +DVIPS ?= dvips +LATEX ?= latex +PDFLATEX ?= pdflatex +EPSTOPDF ?= epstopdf +MAKEINDEX ?= makeindex +KPSEWHICH ?= kpsewhich +GS ?= gs +# = OPTIONAL PROGRAMS = +# == Makefile Color Output == +TPUT ?= tput +# == TeX Generation == +PERL ?= perl +PYTHON ?= python +RST2LATEX ?= rst2latex.py +# == EPS Generation == +CONVERT ?= convert # ImageMagick +DOT ?= dot # GraphViz +DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed +FIG2DEV ?= fig2dev # XFig +GNUPLOT ?= gnuplot # GNUplot +INKSCAPE ?= inkscape # Inkscape (svg support) +XMGRACE ?= xmgrace # XMgrace +PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps +PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps +PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps +GUNZIP ?= gunzip # GZipped EPS +# == Beamer Enlarged Output == +PSNUP ?= psnup +# == Viewing Stuff == +VIEW_POSTSCRIPT ?= gv +VIEW_PDF ?= xpdf +VIEW_GRAPHICS ?= display + +# Command options for embedding fonts and postscript->pdf conversion +PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100 +PS_COMPATIBILITY ?= 1.4 + +# Defaults for GPI +DEFAULT_GPI_EPS_FONTSIZE ?= 22 +DEFAULT_GPI_PDF_FONTSIZE ?= 12 + +# Style file for ReST +RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex) + +# This ensures that even when echo is a shell builtin, we still use the binary +# (the builtin doesn't always understand -n) +FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO)) +ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO)) + +define determine-gnuplot-output-extension +$(if $(shell $(WHICH) $(GNUPLOT)), + $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)), + eps, pdf), + none) +endef + +GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension)) + +# Directory into which we place "binaries" if it exists. +# Note that this can be changed on the commandline or in Makefile.ini: +# +# Command line: +# make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf +# +# Also, you can specify a relative directory (relative to the Makefile): +# make BINARY_TARGET_DIR=pdfs myfile.pdf +# +# Or, you can use Makefile.ini: +# +# BINARY_TARGET_DIR := $(HOME)/bin_out +# +BINARY_TARGET_DIR ?= _out_ + +RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0) +# SH NOTES +# +# On some systems, /bin/sh, which is the default shell, is not linked to +# /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it +# just isn't. This section details some of the things you have to stay away +# from to remain sh-compatible. +# +# * File pattern expansion does not work for {} +# * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ] +# * &> for stderr redirection doesn't work, use 2>&1 instead +# +# BSD SED NOTES +# +# BSD SED is not very nice compared to GNU sed, but it is the most +# commonly-invoked sed on Macs (being based on BSD), so we have to cater to +# it or require people to install GNU sed. It seems like the GNU +# requirement isn't too bad since this makefile is really a GNU makefile, +# but apparently GNU sed is much less common than GNU make in general, so +# I'm supporting it here. +# +# Sad experience has taught me the following about BSD sed: +# +# * \+ is not understood to mean \{1,\} +# * \| is meaningless (does not branch) +# * \n cannot be used as a substitution character +# * ? does not mean \{0,1\}, but is literal +# * a\ works, but only reliably for a single line if subsequent lines +# have forward slashes in them (as is the case in postscript) +# +# For more info (on the Mac) you can consult +# +# man -M /usr/share/man re_format +# +# And look for the word "Obsolete" near the bottom. + +# +# EXTERNAL PROGRAM DOCUMENTATION SCRIPT +# + +# $(call output-all-programs,[<output file>]) +define output-all-programs + [ -f '$(this_file)' ] && \ + $(SED) \ + -e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \ + -e '/EXTERNAL PROGRAMS/d' \ + -e '/^$$/d' \ + -e '/^[[:space:]]*#/i\ '\ + -e 's/^[[:space:]]*#[[:space:]][^=]*//' \ + $(this_file) $(if $1,> '$1',) || \ + $(ECHO) "Cannot determine the name of this makefile." +endef + +# If they misspell gray, it should still work. +GRAY ?= $(call get-default,$(GREY),) + +# +# Utility Functions and Definitions +# + +# While not exactly a make function, this vim macro is useful. It takes a +# verbatim sed script and converts each line to something suitable in a command +# context. Just paste the script's contents into the editor, yank this into a +# register (starting at '0') and run the macro once for each line of the +# original script: +# +# 0i -e :s/\$/$$/eg :s/'/'"'"'/eg ^Ela'A' \:noh j + +# don't call this directly - it is here to avoid calling wildcard more than +# once in remove-files. +remove-files-helper = $(if $1,$(RM) $1,$(sh_true)) + +# $(call remove-files,file1 file2) +remove-files = $(call remove-files-helper,$(wildcard $1)) + +# Removes all cleanable files in the given list +# $(call clean-files,file1 file2 file3 ...) +# Works exactly like remove-files, but filters out files in $(neverclean) +clean-files = \ + $(call remove-files-helper,$(call cleanable-files,$(wildcard $1))) + +# Outputs all generated files to STDOUT, along with some others that are +# created by these (e.g., .idx files end up producing .ilg and .ind files). +# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind +# filenames as needed. +# +# $(call get-generated-names,<source recorder file (*.fls)>) +define get-generated-names +[ -f '$1' ] && \ +$(SED) \ + -e '/^OUTPUT /{' \ + -e ' s///' \ + -e ' p' \ + -e ' s/\.idx/\.ind/p' \ + -e ' s/\.ind/\.ilg/p' \ + -e '}' \ + -e 'd' \ + '$1' \ +| $(SORT) | $(UNIQ) +endef + +# This removes files without checking whether they are there or not. This +# sometimes has to be used when the file is created by a series of shell +# commands, but there ends up being a race condition: make doesn't know about +# the file generation as quickly as the system does, so $(wildcard ...) doesn't +# work right. Blech. +# $(call remove-temporary-files,filenames) +remove-temporary-files = $(if $1,$(RM) $1,:) + +# Create an identifier from a file name +# $(call cleanse-filename,filename) +cleanse-filename = $(subst .,_,$(subst /,__,$1)) + +# Escape dots +# $(call escape-dots,str) +escape-dots = $(subst .,\\.,$1) + +# Test that a file exists +# $(call test-exists,file) +test-exists = [ -e '$1' ] + +# $(call move-files,source,destination) +move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2' + +# Copy file1 to file2 only if file2 doesn't exist or they are different +# $(call copy-if-different,sfile,dfile) +copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2' +copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2' +move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2' +replace-if-different-and-remove = \ + $(call test-different,$1,$2) \ + && $(MV) '$1' '$2' \ + || $(call remove-files,'$1') + +# Note that $(DIFF) returns success when the files are the SAME.... +# $(call test-different,sfile,dfile) +test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1 +test-exists-and-different = \ + $(call test-exists,$2) && $(call test-different,$1,$2) + +# Return value 1, or value 2 if value 1 is empty +# $(call get-default,<possibly empty arg>,<default value if empty>) +get-default = $(if $1,$1,$2) + +# Copy a file and log what's going on +# $(call copy-with-logging,<source>,<target>) +define copy-with-logging +if [ -d '$2/' ]; then \ + if $(CP) '$1' '$2/'; then \ + $(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \ + else \ + $(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \ + fi; \ +fi +endef + +# Gives a reassuring message about the failure to find include files +# $(call include-message,<list of include files>) +define include-message +$(strip \ +$(if $(filter-out $(wildcard $1),$1),\ + $(shell $(ECHO) \ + "$(C_INFO)NOTE: You may ignore warnings about the"\ + "following files:" >&2;\ + $(ECHO) >&2; \ + $(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\ + $(ECHO) "$(C_RESET)" >&2) +)) +endef +# Characters that are hard to specify in certain places +space := $(empty) $(empty) +colon := \: +comma := , + +# Useful shell definitions +sh_true := : +sh_false := ! : + +# Clear out the standard interfering make suffixes +.SUFFIXES: + +# Turn off forceful rm (RM is usually mapped to rm -f) +ifdef SAFE_RM +RM := rm +endif + +# Turn command echoing back on with VERBOSE=1 +ifndef VERBOSE +QUIET := @ +endif + +# Turn on shell debugging with SHELL_DEBUG=1 +# (EVERYTHING is echoed, even $(shell ...) invocations) +ifdef SHELL_DEBUG +SHELL += -x +endif + +# Get the name of this makefile (always right in 3.80, often right in 3.79) +# This is only really used for documentation, so it isn't too serious. +ifdef MAKEFILE_LIST +this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +else +this_file := $(wildcard GNUmakefile makefile Makefile) +endif + +# Terminal color definitions + +REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT))) + +# $(call get-term-code,codeinfo) +# e.g., +# $(call get-term-code,setaf 0) +get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),) + +black := $(call get-term-code,setaf 0) +red := $(call get-term-code,setaf 1) +green := $(call get-term-code,setaf 2) +yellow := $(call get-term-code,setaf 3) +blue := $(call get-term-code,setaf 4) +magenta := $(call get-term-code,setaf 5) +cyan := $(call get-term-code,setaf 6) +white := $(call get-term-code,setaf 7) +bold := $(call get-term-code,bold) +uline := $(call get-term-code,smul) +reset := $(call get-term-code,sgr0) + +# +# User-settable definitions +# +LATEX_COLOR_WARNING ?= magenta +LATEX_COLOR_ERROR ?= red +LATEX_COLOR_INFO ?= green +LATEX_COLOR_UNDERFULL ?= magenta +LATEX_COLOR_OVERFULL ?= red bold +LATEX_COLOR_PAGES ?= bold +LATEX_COLOR_BUILD ?= cyan +LATEX_COLOR_GRAPHIC ?= yellow +LATEX_COLOR_DEP ?= green +LATEX_COLOR_SUCCESS ?= green bold +LATEX_COLOR_FAILURE ?= red bold + +# Gets the real color from a simple textual definition like those above +# $(call get-color,ALL_CAPS_COLOR_NAME) +# e.g., $(call get-color,WARNING) +get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c))) + +# +# STANDARD COLORS +# +C_WARNING := $(call get-color,WARNING) +C_ERROR := $(call get-color,ERROR) +C_INFO := $(call get-color,INFO) +C_UNDERFULL := $(call get-color,UNDERFULL) +C_OVERFULL := $(call get-color,OVERFULL) +C_PAGES := $(call get-color,PAGES) +C_BUILD := $(call get-color,BUILD) +C_GRAPHIC := $(call get-color,GRAPHIC) +C_DEP := $(call get-color,DEP) +C_SUCCESS := $(call get-color,SUCCESS) +C_FAILURE := $(call get-color,FAILURE) +C_RESET := $(reset) + +# +# PRE-BUILD TESTS +# + +# Check that clean targets are not combined with other targets (weird things +# happen, and it's not easy to fix them) +hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1) +hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1) +ifneq "$(hasbuildgoals)" "" +ifneq "$(hascleangoals)" "" +$(error $(C_ERROR)Clean and build targets specified together$(C_RESET))) +endif +endif + +# +# VARIABLE DECLARATIONS +# + +# Names of sed scripts that morph gnuplot files -- only the first found is used +GNUPLOT_SED := global-gpi.sed gnuplot.sed +GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_graphic_extension ?= eps +latex_build_program ?= $(LATEX) +build_target_extension ?= dvi +hyperref_driver_pattern ?= hdvips +hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options. +else +default_graphic_extension ?= pdf +latex_build_program ?= $(PDFLATEX) +build_target_extension ?= pdf +hyperref_driver_pattern ?= hpdf.* +hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank). +endif + +# Files of interest +all_files.tex ?= $(wildcard *.tex) +all_files.tex.sh ?= $(wildcard *.tex.sh) +all_files.tex.pl ?= $(wildcard *.tex.pl) +all_files.tex.py ?= $(wildcard *.tex.py) +all_files.rst ?= $(wildcard *.rst) +all_files.fig ?= $(wildcard *.fig) +all_files.gpi ?= $(wildcard *.gpi) +all_files.dot ?= $(wildcard *.dot) +all_files.xvg ?= $(wildcard *.xvg) +all_files.svg ?= $(wildcard *.svg) +all_files.png ?= $(wildcard *.png) +all_files.jpg ?= $(wildcard *.jpg) +all_files.eps.gz ?= $(wildcard *.eps.gz) +all_files.eps ?= $(wildcard *.eps) + +# Utility function for obtaining all files not specified in $(neverclean) +# $(call cleanable-files,file1 file2 file3 ...) +# Returns the list of files that is not in $(wildcard $(neverclean)) +cleanable-files = $(filter-out $(wildcard $(neverclean)), $1) + +# Utility function for getting all .$1 files that are to be ignored +# * files listed in $(includes.$1) +# * files not listed in $(onlysources.$1) if it is defined +ignore_files = \ + $(includes.$1) \ + $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1))) + +# Patterns to never be allowed as source targets +ignore_patterns := %._include_ + +# Patterns allowed as source targets but not included in 'all' builds +nodefault_patterns := %._nobuild_ $(ignore_patterns) + +# Utility function for getting targets suitable building +# $(call filter-buildable,suffix) +filter-buildable = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(ignore_patterns)),$(all_files.$1)) + +# Utility function for getting targets suitable for 'all' builds +# $(call filter-default,suffix) +filter-default = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1)) + +# Top level sources that can be built even when they are not by default +files.tex := $(call filter-buildable,tex) +files.tex.sh := $(call filter-buildable,tex.sh) +files.tex.pl := $(call filter-buildable,tex.pl) +files.tex.py := $(call filter-buildable,tex.py) +files.rst := $(call filter-buildable,rst) +files.gpi := $(call filter-buildable,gpi) +files.dot := $(call filter-buildable,dot) +files.fig := $(call filter-buildable,fig) +files.xvg := $(call filter-buildable,xvg) +files.svg := $(call filter-buildable,svg) +files.png := $(call filter-buildable,png) +files.jpg := $(call filter-buildable,jpg) +files.eps.gz := $(call filter-buildable,eps.gz) + +# Make all pstex targets secondary. The pstex_t target requires the pstex +# target, and nothing else really depends on it, so it often gets deleted. +# This avoids that by allowing *all* fig files to be pstex targets, which is +# perfectly valid and causes no problems even if they're going to become eps +# files in the end. +.SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig)) + +# Top level sources that are built by default targets +default_files.tex := $(call filter-default,tex) +default_files.tex.sh := $(call filter-default,tex.sh) +default_files.tex.pl := $(call filter-default,tex.pl) +default_files.tex.py := $(call filter-default,tex.py) +default_files.rst := $(call filter-default,rst) +default_files.gpi := $(call filter-default,gpi) +default_files.dot := $(call filter-default,dot) +default_files.fig := $(call filter-default,fig) +default_files.xvg := $(call filter-default,xvg) +default_files.svg := $(call filter-default,svg) +default_files.png := $(call filter-default,png) +default_files.jpg := $(call filter-default,jpg) +default_files.eps.gz := $(call filter-default,eps.gz) + +# Utility function for creating larger lists of files +# $(call concat-files,suffixes,[prefix]) +concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s)) + +# Useful file groupings +all_files_source := $(call concat-files,tex,all) +all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all) + +.PHONY: $(all_files_scripts) + +default_files_source := $(call concat-files,tex,default) +default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default) + +files_source := $(call concat-files,tex) +files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst) + +# Utility function for obtaining stems +# $(call get-stems,suffix,[prefix]) +get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%)) + +# List of all stems (including ._include_ and ._nobuild_ file stems) +all_stems.tex := $(call get-stems,tex,all) +all_stems.tex.sh := $(call get-stems,tex.sh,all) +all_stems.tex.pl := $(call get-stems,tex.pl,all) +all_stems.tex.py := $(call get-stems,tex.py,all) +all_stems.rst := $(call get-stems,rst,all) +all_stems.fig := $(call get-stems,fig,all) +all_stems.gpi := $(call get-stems,gpi,all) +all_stems.dot := $(call get-stems,dot,all) +all_stems.xvg := $(call get-stems,xvg,all) +all_stems.svg := $(call get-stems,svg,all) +all_stems.png := $(call get-stems,png,all) +all_stems.jpg := $(call get-stems,jpg,all) +all_stems.eps.gz := $(call get-stems,eps.gz,all) +all_stems.eps := $(call get-stems,eps,all) + +# List of all default stems (all default PDF targets): +default_stems.tex := $(call get-stems,tex,default) +default_stems.tex.sh := $(call get-stems,tex.sh,default) +default_stems.tex.pl := $(call get-stems,tex.pl,default) +default_stems.tex.py := $(call get-stems,tex.py,default) +default_stems.rst := $(call get-stems,rst,default) +default_stems.fig := $(call get-stems,fig,default) +default_stems.gpi := $(call get-stems,gpi,default) +default_stems.dot := $(call get-stems,dot,default) +default_stems.xvg := $(call get-stems,xvg,default) +default_stems.svg := $(call get-stems,svg,default) +default_stems.png := $(call get-stems,png,default) +default_stems.jpg := $(call get-stems,jpg,default) +default_stems.eps.gz := $(call get-stems,eps.gz,default) + +# List of all stems (all possible bare PDF targets created here): +stems.tex := $(call get-stems,tex) +stems.tex.sh := $(call get-stems,tex.sh) +stems.tex.pl := $(call get-stems,tex.pl) +stems.tex.py := $(call get-stems,tex.py) +stems.rst := $(call get-stems,rst) +stems.fig := $(call get-stems,fig) +stems.gpi := $(call get-stems,gpi) +stems.dot := $(call get-stems,dot) +stems.xvg := $(call get-stems,xvg) +stems.svg := $(call get-stems,svg) +stems.png := $(call get-stems,png) +stems.jpg := $(call get-stems,jpg) +stems.eps.gz := $(call get-stems,eps.gz) + +# Utility function for creating larger lists of stems +# $(call concat-stems,suffixes,[prefix]) +concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s))) + +# The most likely to be source but not finished product go first +graphic_source_extensions := fig \ + gpi \ + xvg \ + svg \ + dot \ + eps.gz + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +graphic_source_extensions += png jpg +graphic_target_extensions := eps ps +else +graphic_source_extensions += eps +graphic_target_extensions := pdf png jpg mps tif +endif + +all_stems_source := $(call concat-stems,tex,all) +all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all) +all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all) +all_stems_ss := $(sort $(all_stems_source) $(all_stems_script)) +all_stems_sg := $(sort $(all_stems_script)) +all_stems_ssg := $(sort $(all_stems_ss)) + +default_stems_source := $(call concat-stems,tex,default) +default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default) +default_stems_ss := $(sort $(default_stems_source) $(default_stems_script)) +default_stems_sg := $(sort $(default_stems_script)) +default_stems_ssg := $(sort $(default_stems_ss)) + +stems_source := $(call concat-stems,tex) +stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst) +stems_graphic := $(call concat-stems,$(graphic_source_extensions)) +stems_gg := $(sort $(stems_graphic)) +stems_ss := $(sort $(stems_source) $(stems_script)) +stems_sg := $(sort $(stems_script)) +stems_ssg := $(sort $(stems_ss)) + +# Calculate names that can generate the need for an include file. We can't +# really do this with patterns because it's too easy to screw up, so we create +# an exhaustive list. +allowed_source_suffixes := \ + pdf \ + ps \ + dvi \ + ind \ + nls \ + bbl \ + aux \ + aux.make \ + d \ + auxbbl.make \ + _graphics \ + _show +allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes)) + +allowed_graphic_suffixes := \ + pdf \ + eps \ + gpihead.make \ + gpi.d +allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes)) + +# All targets allowed to build documents +allowed_source_targets := \ + $(foreach suff,$(allowed_source_suffixes),\ + $(addsuffix .$(suff),$(stems_ssg))) + +# All targets allowed to build graphics +allowed_graphic_targets := \ + $(foreach suff,$(allowed_graphic_suffixes),\ + $(addsuffix .$(suff),$(stems_gg))) + +# All targets that build multiple documents (like 'all') +allowed_batch_source_targets := \ + all \ + all-pdf \ + all-ps \ + all-dvi \ + all-bbl \ + all-ind \ + all-gls \ + all-nls \ + show + +# All targets that build multiple graphics (independent of document) +allowed_batch_graphic_targets := \ + all-graphics \ + all-pstex \ + all-dot2tex \ + show-graphics + +# Now we figure out which stuff is available as a make target for THIS RUN. +real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\ + all) + +specified_source_targets := $(strip \ + $(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \ + ) + +specified_batch_source_targets := $(strip \ + $(filter $(allowed_batch_source_targets),$(real_goals)) \ + ) + +specified_graphic_targets := $(strip \ + $(filter $(allowed_graphic_targets),$(real_goals)) \ + ) + +specified_batch_graphic_targets := $(strip \ + $(filter $(allowed_batch_graphic_targets),$(real_goals)) \ + ) + +specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\ + $(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\ + $(all_files.gpi)) \ + ) + +# Determine which .d files need including from the information gained above. +# This is done by first checking whether a batch target exists. If it does, +# then all *default* stems are used to create possible includes (nobuild need +# not apply for batch status). If no batch targets exist, then the individual +# targets are considered and appropriate includes are taken from them. +source_stems_to_include := \ + $(sort\ + $(if $(specified_batch_source_targets),\ + $(default_stems_ss),\ + $(foreach t,$(specified_source_targets),\ + $(foreach p,$(allowed_source_patterns),\ + $(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \ + )) \ + )) + +# Determine which .gpi.d files are needed using the above information. We +# first check whether a batch target is specified, then check individual +# graphics that may have been specified. +graphic_stems_to_include := \ + $(sort\ + $(if $(specified_batch_graphic_targets),\ + $(default_stems.gpi),\ + $(foreach t,$(specified_gpi_targets),\ + $(foreach p,$(allowed_graphic_patterns),\ + $(patsubst $p,%,$(filter $p,$t)) \ + )) \ + )) + +# All dependencies for the 'all' targets +all_pdf_targets := $(addsuffix .pdf,$(stems_ssg)) +all_ps_targets := $(addsuffix .ps,$(stems_ssg)) +all_dvi_targets := $(addsuffix .dvi,$(stems_ssg)) +all_tex_targets := $(addsuffix .tex,$(stems_sg)) +all_d_targets := $(addsuffix .d,$(stems_ssg)) +all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg)) +intermediate_graphics_targets := $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),) +all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig)) +all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot)) + +all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension))) + +default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss)) +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_ps_targets := $(addsuffix .ps,$(default_stems_ss)) +default_dvi_targets := $(addsuffix .dvi,$(default_stems_ss)) +pre_pdf_extensions := dvi ps +endif + +# Extensions generated by LaTeX invocation that can be removed when complete +rm_ext := \ + log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \ + fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf +backup_patterns := *~ *.bak *.backup body.tmp head.tmp + +graph_stem := _graph + +# All LaTeX-generated files that can be safely removed + +rm_tex := \ + $(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \ + $(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \ + $(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \ + $(addsuffix .*.log,$(stems_graphic)) + +# These are the files that will affect .gpi transformation for all .gpi files. +# +# Use only the first one found. Backward compatible values are at the end. +# Note that we use foreach, even though wildcard also returns a list, to ensure +# that the order in the uppercase variables is preserved. Directory listings +# provide no such guarantee, so we avoid relying on them. +gpi_sed := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f)))) +gpi_global := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f)))) + +# +# Functions used in generating output +# + +# Outputs all source dependencies to stdout. The first argument is the file to +# be parsed, the second is a list of files that will show up as dependencies in +# the new .d file created here. +# +# NOTE: BSD sed does not understand \|, so we have to do something more +# clunky to extract suitable extensions. +# +# Also, we do a little bit of funny rewriting up front (TARGETS=) to make sure +# that we can properly backslash-escape spaces in file names (e.g, on Cygwin +# for tex distributions that have "Program Files" in their name). +# +# $(call get-inputs,<parsed file>,<target files>) +define get-inputs +$(SED) \ +-e '/^INPUT/!d' \ +-e 's!^INPUT \(\./\)\{0,1\}!!' \ +-e 's/[[:space:]]/\\ /g' \ +-e 's/\(.*\)\.aux$$/\1.tex/' \ +-e '/\.tex$$/b addtargets' \ +-e '/\.cls$$/b addtargets' \ +-e '/\.sty$$/b addtargets' \ +-e '/\.pstex_t$$/b addtargets' \ +-e '/\.dot_t$$/b addtargets' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# $(call get-missing-inputs,<log file>,<target files>) +define get-missing-inputs +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/Default extension: /!d' \ +-e 's/[[:space:]]\{1,\}/ /g' \ +-e 's/\n\{1,\}/ /g' \ +-e 's/^.*File `//' \ +-e 's/'"'"' not found\..*//' \ +-e '/\.tex/!s/$$/.tex/' \ +-e 's/[[:space:]]/\\ /g' \ +-e 'h' \ +-e 's/.*/# MISSING input "&" - (presence of comment affects build)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# Get source file for specified graphics stem. +# +# $(call graphics-source,<stem>) +define graphics-source +$(strip $(firstword \ + $(wildcard \ + $(addprefix $1.,\ + $(graphic_source_extensions))) \ + $1 \ +)) +endef + +# Get the target file for the specified graphics file/stem +# +# $(call graphics-target,<stem>) +define graphics-target +$(strip $(if $(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1, + $(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension)))) +endef + +# Outputs all of the graphical dependencies to stdout. The first argument is +# the stem of the source file being built, the second is a list of suffixes +# that will show up as dependencies in the generated .d file. +# +# Note that we try to escape spaces in filenames where possible. We have to do +# it with three backslashes so that as the name percolates through the makefile +# it eventually ends up with the proper escaping when the build rule is found. +# Ugly, but it appears to work. Note that graphicx doesn't allow filenames +# with spaces, so this could in many ways be moot unless you're using something +# like grffile. +# +# For pdflatex, we really need the missing file to be specified without an +# extension, otherwise compilation barfs on the first missing file. Truly +# annoying, but there you have it. +# +# It turns out that the graphics errors, although they have lines with empty +# space, are only made of two paragraphs. So, we just use some sed magic to +# get everything into paragraphs, detect when it's a paragraph that interests +# us, and double it up. Then we get the filename only if we're missing +# extensions (a sign that it's graphicx complaining). +# +# $(call get-graphics,<target file stem>) +#.log,$(addprefix $*.,d $(build_target_extension) _graphics) +define get-graphics +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File `/{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/{' \ +-e ' s/\n\{1,\}/ /g' \ +-e ' s/[[:space:]]\{1,\}/ /g' \ +-e ' s/^.*File `//' \ +-e ' s/'"'"' not found\..*//' \ +-e ' h' \ +-e ' s/.*/# MISSING stem "&" - (presence of comment affects build)/' \ +-e ' p' \ +-e ' g' \ +-e ' b addtargets' \ +-e '}' \ +-e '/.*File: \(.*\) Graphic file (type [^)]*).*/{' \ +-e ' s//\1/' \ +-e ' b addtargets' \ +-e '}' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/[[:space:]]/\\\\\\&/g' \ +-e 'h' \ +-e 's/.*/-include &.gpi.d/' \ +-e 'p' \ +-e 'g' \ +-e 's/.*/$(addprefix $1,.d): $$$$(call graphics-source,&)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/.*/$(addprefix $1.,$(build_target_extension) _graphics): $$$$(call graphics-target,&)/' \ +-e 'p' \ +-e 'd' \ +$*.log +endef + +# Checks for build failure due to pstex inclusion, and gives instructions. +# +# $(call die-on-pstexs,<parsed file>) +define die-on-pstexs +if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-pstex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for build failure due to dot2tex, and gives instructions. +# +# $(call die-on-dot2tex,<parsed file>) +define die-on-dot2tex +if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-dot2tex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for the existence of a .aux file, and dies with an error message if it +# isn't there. Note that we pass the file stem in, not the full filename, +# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo) +# +# $(call die-on-no-aux,<aux stem>) +define die-on-no-aux +if [ ! -e '$1.aux' ]; then \ + $(call colorize-latex-errors,$1.log); \ + exit 1; \ +fi +endef + +# Outputs all index files to stdout. Arg 1 is the source file stem, arg 2 is +# the list of targets for the discovered dependency. +# +# $(call get-log-index,<log file stem>,<target files>) +define get-log-index +$(SED) \ +-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \ +-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \ +-e 's/[[:space:]]/\\&/g' \ +-e '/^TARGETS=/{' \ +-e ' h' \ +-e ' s/^TARGETS=/$2: /p' \ +-e ' g' \ +-e ' s/^TARGETS=\(.*\)/\1: $1.tex/p' \ +-e '}' \ +-e 'd' \ +'$1.log' | $(SORT) | $(UNIQ) +endef + + +# Outputs all bibliography files to stdout. Arg 1 is the source stem, arg 2 is +# a list of targets for each dependency found. +# +# The script kills all lines that do not contain bibdata. Remaining lines have +# the \bibdata macro and delimiters removed to create a dependency list. A +# trailing comma is added, then all adjacent commas are collapsed into a single +# comma. Then commas are replaced with the string .bib[space], and the +# trailing space is killed off. Finally, all filename spaces are escaped. +# This produces a list of space-delimited .bib filenames, which is what the +# make dep file expects to see. +# +# Note that we give kpsewhich a bogus argument so that a failure of sed to +# produce output will not cause an error. +# +# $(call get-bibs,<aux file>,<targets>) +define get-bibs +$(SED) \ +-e '/^\\bibdata/!d' \ +-e 's/\\bibdata{\([^}]*\)}/\1,/' \ +-e 's/,\{2,\}/,/g' \ +-e 's/[[:space:]]/\\&/g' \ +-e 's/,/.bib /g' \ +-e 's/ \{1,\}$$//' \ +$1 | $(XARGS) $(KPSEWHICH) '#######' | \ +$(SED) \ +-e 's/^/$2: /' | \ +\$(SORT) | $(UNIQ) +endef + +# Makes a an aux file that only has stuff relevant to the target in it +# $(call make-auxtarget-file,<flattened-aux>,<new-aux>) +define make-auxtarget-file +$(SED) \ +-e '/^\\newlabel/!d' \ +$1 > $2 +endef + +# Makes an aux file that only has stuff relevant to the bbl in it +# $(call make-auxbbl-file,<flattened-aux>,<new-aux>) +define make-auxbbl-file +$(SED) \ +-e '/^\\newlabel/d' \ +$1 > $2 +endef + +# Makes a .gpi.d file from a .gpi file +# $(call make-gpi-d,<.gpi>,<.gpi.d>) +define make-gpi-d +$(ECHO) '# vim: ft=make' > $2; \ +$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \ +$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \ +$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GNUPLOT_OUTPUT_EXTENSION) gpi.d)) >> $2; \ +$(ECHO) 'endif' >> $2; +endef + +# Parse .gpi files for data and loaded dependencies, output to stdout +# +# The sed script here tries to be clever about obtaining valid +# filenames from the gpi file. It assumes that the plot command starts its own +# line, which is not too difficult a constraint to satisfy. +# +# This command script also generates 'include' directives for every 'load' +# command in the .gpi file. The load command must appear on a line by itself +# and the file it loads must have the suffix .gpi. If you don't want it to be +# compiled when running make graphics, then give it a suffix of ._include_.gpi. +# +# $(call get-gpi-deps,<gpi file>,<targets>) +define get-gpi-deps +$(SED) \ +-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \ +-e ' H' \ +-e ' /[^\\]$$/{' \ +-e ' s/.*//' \ +-e ' x' \ +-e ' s/\\\{0,1\}\n//g' \ +-e ' s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \ +-e ' s/[[:space:]]*\(['\''"][^'\''"]*['\''"]\)\{0,1\}[^,]*/\1/g' \ +-e ' s/,['\''"]-\{0,1\}['\''"]//g' \ +-e ' s/[,'\''"]\{1,\}/ /g' \ +-e ' s!.*!$2: &!' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e 's/^[[:space:]]*load[[:space:]]*['\''"]\([^'\''"]*\.gpi\)['\''"].*$$/-include \1.d/p' \ +-e 'd' \ +$1 +endef + +# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with +# recompilation. +# +# Note that we only ignore file not found errors for things that we know how to +# build, like graphics files. +# +# $(call colorize-latex-errors,<log file>) +define colorize-latex-errors +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/d' \ +-e '/Missing .begin.document/{' \ +-e ' h' \ +-e ' s/.*/Are you trying to build an include file?/' \ +-e ' x' \ +-e ' G' \ +-e '}' \ +-e '/ LaTeX Error: Cannot determine size/d' \ +-e 's/.* LaTeX Error .*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/Error: pdflatex (file .*/$(C_ERROR)& - try specifying it without an extension$(C_RESET)/p' \ +-e '/.*\*hyperref using.*driver \(.*\)\*.*/{' \ +-e ' s//\1/' \ +-e ' /^$(hyperref_driver_pattern)$$/!{' \ +-e ' s/.*//' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)--- Using incorrect driver for hyperref! ---$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)$(hyperref_driver_error)$(C_RESET)/' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e '/ LaTeX Error: Unknown graphics extension/{' \ +-e ' s/^/ /' \ +-e ' h' \ +-e ' s/.*/--- Graphics extension error:/' \ +-e ' G' \ +-e ' h' \ +-e ' s/.*/--- If you specified the extension explicitly in your .tex file, try removing it./' \ +-e ' H' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*//' \ +-e ' h' \ +-e ' b' \ +-e '}' \ +-e 's/.*\(\n\{0,\}! .*\)/$(C_ERROR)\1$(C_RESET)/p' \ +-e 'd' \ +$1 +endef + +# Colorize Makeindex errors +define colorize-makeindex-errors +$(SED) \ +-e '/^!! /{' \ +-e ' N' \ +-e ' s/^.*$$/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize epstopdf errors +# +# $(call colorize-epstopdf-errors,<log file>) +define colorize-epstopdf-errors +$(SED) \ +-e '/^Error:/,/^Execution stack:/{' \ +-e ' /^Execution stack:/d' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GNUplot errors +# +# $(call colorize-gnuplot-errors,<log file>) +define colorize-gnuplot-errors +$(SED) \ +-e '/, line [0-9]*:/!{' \ +-e ' H' \ +-e ' x' \ +-e ' s/.*\n\(.*\n.*\)$$/\1/' \ +-e ' x' \ +-e '}' \ +-e '/, line [0-9]*:/{' \ +-e ' H' \ +-e ' /unknown.*terminal type/{' \ +-e ' s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to 'eps'./' \ +-e ' H' \ +-e ' }' \ +-e ' /gpihead/{' \ +-e ' s/.*/--- This could be a Makefile bug - contact the maintainer./' \ +-e ' H' \ +-e ' }' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e '/^gnuplot>/,/^$$/{' \ +-e ' s/^gnuplot.*/$(C_ERROR)&/' \ +-e ' s/^$$/$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GraphViz errors +# +# $(call colorize-dot-errors,<log file>) +define colorize-dot-errors +$(SED) \ +-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \ +-e 'd' \ +'$1' +endef + +# Get all important .aux files from the top-level .aux file and merges them all +# into a single file, which it outputs to stdout. +# +# $(call flatten-aux,<toplevel aux>,<output file>) +define flatten-aux +$(SED) \ +-e '/\\@input{\(.*\)}/{' \ +-e 's//\1/' \ +-e 's![.:]!\\&!g' \ +-e 'h' \ +-e 's!.*!\\:\\\\@input{&}:{!' \ +-e 'p' \ +-e 'x' \ +-e 's/\\././g' \ +-e 's/.*/r &/p' \ +-e 's/.*/d/p' \ +-e 's/.*/}/p' \ +-e 'd' \ +-e '}' \ +-e 'd' \ +'$1' > "$1.$$$$.sed.make"; \ +$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \ +$(SED) \ +-e '/^\\relax/d' \ +-e '/^\\bibcite/d' \ +-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \ +"$1.$$$$.make" | $(SORT) > '$2'; \ +$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make) +endef + +# Generate pdf from postscript +# +# Note that we don't just call ps2pdf, since there are so many versions of that +# script on various systems. Instead, we call the postscript interpreter +# directly. +# +# $(call ps2pdf,infile,outfile,[embed fonts]) +define ps2pdf + $(GS) \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -q -dNOPAUSE -dBATCH \ + -sDEVICE=pdfwrite -sstdout=%stderr \ + '-sOutputFile=$2' \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -c .setpdfwrite \ + -f '$1' +endef + +# Colorize LaTeX output. +# This uses a neat trick from the Sed & Awk Book from O'Reilly: +# 1) If a line has a single ending paren, delete it to make a blank line (so +# that we catch the first error, which is not always preceded by a blank +# line). +# 2) Ensure that the last line of the file gets appended to the hold buffer, +# and blank it out to trigger end-of-paragraph logic below. +# 3) When encountering a blank line (LaTeX output helpfully breaks output on +# newlines) +# a) swap the hold buffer (containing the paragraph) into the pattern buffer (putting a blank line into the hold buffer), +# b) remove the newline at the beginning (don't ask), +# c) apply any colorizing substitutions necessary to ensure happiness. +# d) get the newline out of the hold buffer and append it +# e) profit! (print) +# 4) Anything not colorized is deleted, unless in verbose mode. +color_tex := \ + $(SED) \ + -e '$${' \ + -e ' /^$$/!{' \ + -e ' H' \ + -e ' s/.*//' \ + -e ' }' \ + -e '}' \ + -e '/^$$/!{' \ + -e ' H' \ + -e ' d' \ + -e '}' \ + -e '/^$$/{' \ + -e ' x' \ + -e ' s/^\n//' \ + -e ' /Output written on /{' \ + -e ' s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success! Wrote \2 to \1/' \ + -e ' s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \ + -e ' s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \ + -e ' s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' / *LaTeX Error:.*/{' \ + -e ' s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /.*Warning:.*/{' \ + -e ' s//$(C_WARNING)&$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Underfull.*/{' \ + -e ' s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Overfull.*/{' \ + -e ' s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + $(if $(VERBOSE),,-e ' d') \ + -e ' :end' \ + -e ' G' \ + -e '}' \ + +# Colorize BibTeX output. +color_bib := \ + $(SED) \ + -e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' -e 't' \ + -e '/---/,/^.[^:]/{' \ + -e ' H' \ + -e ' /^.[^:]/{' \ + -e ' x' \ + -e ' s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' p' \ + -e ' s/.*//' \ + -e ' h' \ + -e ' d' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \ + $(if $(VERBOSE),,-e 'd') + + +# Make beamer output big enough to print on a full page. Landscape doesn't +# seem to work correctly. +enlarge_beamer = $(PSNUP) -l -1 -W128mm -H96mm -pletter + +# $(call test-run-again,<source stem>) +test-run-again = $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log + +# This tests whether the build target commands should be run at all, from +# viewing the log file. +# $(call test-log-for-need-to-run,<source stem>) +define test-log-for-need-to-run +$(SED) \ +-e '/^No file $(call escape-dots,$1)\.aux\./d' \ +$1.log \ +| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$' +endef + +# LaTeX invocations +# +# $(call latex,<tex file>,[<extra LaTeX args>]) +run-latex = $(latex_build_program) --interaction=batchmode $(if $2,$2,) $1 > /dev/null + +# $(call latex-color-log,<LaTeX stem>) +latex-color-log = $(color_tex) $1.log + +# $(call run-makeindex,<input>,<output>,<log>,<extra flags>) +define run-makeindex +success=1; \ +if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $4 > /dev/null || $(EGREP) -q '^!!' $3; then \ + $(call colorize-makeindex-errors,$3); \ + $(RM) -f '$2'; \ + success=0; \ +fi; \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# This runs the given script to generate output, and it uses MAKE_RESTARTS to +# ensure that it never runs it more than once for a particular root make +# invocation. +# +# $(call run-script,<interpreter>,<input>,<output>) +define run-script +[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \ +restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \ +level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \ +if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \ + $(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \ + $1 '$2' '$3'; \ + $(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \ + $(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \ +fi +endef + +# BibTeX invocations +# +# $(call run-bibtex,<tex stem>) +run-bibtex = $(BIBTEX) $1 | $(color_bib) + + +# $(call convert-eps-to-pdf,<eps file>,<pdf file>,[gray]) +# Note that we don't use the --filter flag because it has trouble with bounding boxes that way. +define convert-eps-to-pdf +$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \ +$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \ +$(call colorize-epstopdf-errors,$1.log); +endef + +# $(call convert-gpi,<gpi file>,<output file>,[gray]) +# +define convert-gpi +$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps)' \ +$(if $(filter %.pdf,$2),fsize ,)$(call get-default,$(strip \ +$(firstword \ + $(shell \ + $(SED) \ + -e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' \ + -e 'd' \ + $1 $(strip $(gpi_global)) \ + ) \ +) \ +),$(if $(filter %.pdf,$2),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE))) \ +$(strip $(if $3,monochrome,$(if \ +$(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $< $(gpi_global)),\ +,color))) > $1head.make; \ +$(ECHO) 'set output "$2"' >> $1head.make; \ +$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \ +fnames='$1head.make $1';\ +$(if $(gpi_sed),\ + $(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \ + fnames=$1.temp.make;,\ +) \ +success=1; \ +if ! $(GNUPLOT) $$fnames 2>$1.log; then \ + $(call colorize-gnuplot-errors,$1.log); \ + success=0; \ +fi; \ +$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \ +$(call remove-temporary-files,$1head.make); \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# Creation of .eps files from .png files +# +# The intermediate step of PNM (using NetPBM) produces much nicer output than +# ImageMagick's "convert" binary. I couldn't get the right combination of +# flags to make it look nice, anyway. +# +# To handle gray scale conversion, we pipe things through ppmtopgm in the +# middle. +# +# $(call convert-png,<png file>,<eps file>) +define convert-png +$(PNGTOPNM) "$1" \ + $(if $3,| $(PPMTOPGM),) \ + | $(PNMTOPS) -noturn \ + > "$2" +endef + +# Creation of .eps files from .jpg files +# +# Thanks to brubakee for this solution. +# +# Uses Postscript level 2 to avoid file size bloat +# $(call convert-jpg,<jpg file>,<eps file>) +define convert-jpg +$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2' +endef + +# Creation of .eps files from .fig files +# $(call convert-fig,<fig file>,<output file>,[gray]) +convert-fig = $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2 + +# Creation of .pstex files from .fig files +# $(call convert-fig-pstex,<fig file>,<pstex file>) +convert-fig-pstex = $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1 + +# Creation of .pstex_t files from .fig files +# $(call convert-fig-pstex-t,<fig file>,<pstex file>,<pstex_t file>) +convert-fig-pstex-t = $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1 + +# Creation of .dot_t files from .dot files +# #(call convert-dot-tex,<dot file>,<dot_t file>) +convert-dot-tex = $(DOT2TEX) '$1' > '$2' + +# Converts svg files into .eps files +# +# $(call convert-svg,<svg file>,<eps file>,[gray]) +convert-svg = $(INKSCAPE) --export-eps='$2' '$1' + +# Converts xvg files into .eps files +# +# $(call convert-xvg,<xvg file>,<eps file>,[gray]) +convert-xvg = $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2' + +# Converts .eps.gz files into .eps files +# +# $(call convert-epsgz,<eps.gz file>,<eps file>,[gray]) +convert-epsgz = $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2' + +# Converts .eps files into .eps files (usually a no-op, but can make grayscale) +# +# $(call convert-eps,<in file>,<out file>,[gray]) +convert-eps = $(if $3,$(call kill-ps-color) $1 > $2) + +# The name of the file containing special postscript commands for grayscale +gray_eps_file := gray.eps.make + +# Changes sethsbcolor and setrgbcolor calls in postscript to always produce +# grayscale. In general, this is accomplished by writing new versions of those +# functions into the user dictionary space, which is looked up before the +# global or system dictionaries (userdict is one of the permanent dictionaries +# in postscript and is not read-only like systemdict). +# +# For setrgbcolor, the weighted average of the triple is computed and the +# triple is replaced with three copies of that average before the original +# procedure is called: .299R + .587G + .114B +# +# For sethsbcolor, the color is first converted to RGB, then to grayscale by +# the new setrgbcolor operator as described above. Why is this done? +# Because simply using the value component will tend to make pure colors +# white, a very undesirable thing. Pure blue should not translate to white, +# but to some level of gray. Conversion to RGB does the right thing. It's +# messy, but it works. +# +# From +# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB, +# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is +# as follows: +# +# Hi = int(floor(6 * H)) mod 6 +# f = 6 * H - Hi +# p = V(1-S) +# q = V(1-fS) +# t = V(1-(1-f)S) +# if Hi = 0: R G B <-- V t p +# if Hi = 1: R G B <-- q V p +# if Hi = 2: R G B <-- p V t +# if Hi = 3: R G B <-- p q V +# if Hi = 4: R G B <-- t p V +# if Hi = 5: R G B <-- V p q +# +# The messy stack-based implementation is below +# $(call create-gray-eps-file,filename) +define create-gray-eps-file +$(ECHO) -n -e '\ +/OLDRGB /setrgbcolor load def\n\ +/setrgbcolor {\n\ + .114 mul exch\n\ + .587 mul add exch\n\ + .299 mul add\n\ + dup dup\n\ + OLDRGB\n\ +} bind def\n\ +/OLDHSB /sethsbcolor load def\n\ +/sethsbcolor {\n\ + 2 index % H V S H\n\ + 6 mul floor cvi 6 mod % Hi V S H\n\ + 3 index % H Hi V S H\n\ + 6 mul % 6H Hi V S H\n\ + 1 index % Hi 6H Hi V S H\n\ + sub % f Hi V S H\n\ + 2 index 1 % 1 V f Hi V S H\n\ + 4 index % S 1 V f Hi V S H\n\ + sub mul % p f Hi V S H\n\ + 3 index 1 % 1 V p f Hi V S H\n\ + 6 index % S 1 V p f Hi V S H\n\ + 4 index % f S 1 V p f Hi V S H\n\ + mul sub mul % q p f Hi V S H\n\ + 4 index 1 1 % 1 1 V q p f Hi V S H\n\ + 5 index % f 1 1 V q p f Hi V S H\n\ + sub % (1-f) 1 V q p f Hi V S H\n\ + 8 index % S (1-f) 1 V q p f Hi V S H\n\ + mul sub mul % t q p f Hi V S H\n\ + 4 -1 roll pop % t q p Hi V S H\n\ + 7 -2 roll pop pop % t q p Hi V\n\ + 5 -2 roll % Hi V t q p\n\ + dup 0 eq\n\ + {1 index 3 index 6 index}\n\ + {\n\ + dup 1 eq\n\ + {3 index 2 index 6 index}\n\ + {\n\ + dup 2 eq\n\ + {4 index 2 index 4 index}\n\ + {\n\ + dup 3 eq\n\ + {4 index 4 index 3 index}\n\ + {\n\ + dup 4 eq\n\ + {2 index 5 index 3 index}\n\ + {\n\ + dup 5 eq\n\ + {1 index 5 index 5 index}\n\ + {0 0 0}\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse % B G R Hi V t q p\n\ + setrgbcolor\n\ + 5 {pop} repeat\n\ +} bind def\n'\ +> $1 +endef + +# This actually inserts the color-killing code into a postscript file +# $(call kill-ps-color) +define kill-ps-color +$(SED) -e '/%%EndComments/r $(gray_eps_file)' +endef + +# Converts graphviz .dot files into .eps files +# Grayscale is not directly supported by dot, so we pipe it through fig2dev in +# that case. +# $(call convert-dot,<dot file>,<eps file>,<log file>,[gray]) +define convert-dot +$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \ +$(call colorize-dot-errors,$3) +endef + +# Convert DVI to Postscript +# $(call make-ps,<dvi file>,<ps file>,<log file>,[<paper size>]) +make-ps = \ + $(DVIPS) -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \ + $(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1 + +# Convert Postscript to PDF +# $(call make-pdf,<ps file>,<pdf file>,<log file>,<embed file>) +make-pdf = \ + $(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1 + +# Display information about what is being done +# $(call echo-build,<input file>,<output file>,[<run number>]) +echo-build = $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)" +echo-graphic = $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)" +echo-dep = $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)" + +# Display a list of something +# $(call echo-list,<values>) +echo-list = for x in $1; do $(ECHO) "$$x"; done + +# +# DEFAULT TARGET +# + +.PHONY: all +all: $(default_pdf_targets) ; + +.PHONY: all-pdf +all-pdf: $(default_pdf_targets) ; + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-ps +all-ps: $(default_ps_targets) ; + +.PHONY: all-dvi +all-dvi: $(default_dvi_targets) ; +endif + +# +# VIEWING TARGET +# +.PHONY: show +show: all + $(QUIET)for x in $(default_pdf_targets); do \ + [ -e "$$x" ] && $(VIEW_PDF) $$x & \ + done + +# +# INCLUDES +# +source_includes := $(addsuffix .d,$(source_stems_to_include)) +graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include)) + +# Include only the dependencies used +ifneq "" "$(source_includes)" +include $(source_includes)$(call include-message,$(source_includes)) +endif +ifneq "" "$(graphic_includes)" +include $(graphic_includes)$(call include-message,$(graphic_includes)) +endif + +# +# MAIN TARGETS +# + +# Note that we don't just say %: %.pdf here - this can tend to mess up our +# includes, which detect what kind of file we are asking for. For example, +# asking to build foo.pdf is much different than asking to build foo when +# foo.gpi exists, because we look through all of the goals for *.pdf that +# matches *.gpi, then use that to determine which include files we need to +# build. +# +# Thus, we invoke make recursively with better arugments instead, restarting +# all of the appropriate machinery. +.PHONY: $(default_stems_ss) +$(default_stems_ss): %: %.pdf ; + +# This builds and displays the wanted file. +.PHONY: $(addsuffix ._show,$(stems_ssg)) +%._show: %.pdf + $(QUIET)$(VIEW_PDF) $< & + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_pdf_targets) +%.pdf: %.ps %.embed.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-pdf,$<,$@.temp,$@.log,$*.embed.make); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi + +.SECONDARY: $(all_ps_targets) +%.ps: %.dvi %.paper.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-ps,$<,$@.temp,$@.log,\ + $(firstword $(shell $(CAT) $*.paper.make))); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi +endif + +# Build the final target (dvi or pdf) file. This is a very tricky rule because +# of the way that latex runs multiple times, needs graphics after the first run +# (or maybe already has them), and relies on bibliographies or indices that may +# not exist. +# +# Check the log for fatal errors. If they exist, colorize and bail. +# +# Create the .auxtarget.cookie file. (Needed for next time if not present) +# +# If any of the following are true, we must rebuild at least one time: +# +# * the .bbl was recently rebuilt +# +# check a cookie, then delete it +# +# * any of several output files was created or changed: +# +# check $*.run.cookie, then delete it +# +# * the .aux file changed in a way that necessitates attention +# +# Note that if the .auxtarget.make file doesn't exist, this means +# that we are doing a clean build, so it doesn't figure into the +# test for running again. +# +# compare against .auxtarget.make +# +# move if different, remove if not +# +# * the .log file has errors or warnings requiring at least one more run +# +# We use a loop over a single item to simplify the process of breaking +# out when we find one of the conditions to be true. +# +# If we do NOT need to run latex here, then we move the $@.1st.make file +# over to $@ because the target file has already been built by the first +# dependency run and is valid. +# +# If we do, we delete that cookie file and do the normal multiple-runs +# routine. +# +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_dvi_targets) +endif +%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make + $(QUIET)\ + fatal=`$(call colorize-latex-errors,$*.log)`; \ + if [ x"$$fatal" != x"" ]; then \ + $(ECHO) "$$fatal"; \ + exit 1; \ + fi; \ + $(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \ + run=0; \ + for i in 1; do \ + if $(call test-exists,$*.bbl.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call test-exists,$*.run.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call \ + test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\ + then \ + run=1; \ + break; \ + fi; \ + if $(call test-log-for-need-to-run,$*); then \ + run=1; \ + break; \ + fi; \ + done; \ + $(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \ + $(MV) $*.auxtarget.cookie $*.auxtarget.make; \ + if [ x"$$run" = x"1" ]; then \ + $(call remove-files,$@.1st.make); \ + for i in 2 3 4 5; do \ + $(if $(findstring 3.79,$(MAKE_VERSION)),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\ + ); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \ + $(call test-run-again,$*) || break; \ + done; \ + else \ + $(MV) '$@.1st.make' '$@'; \ + fi; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + $(call latex-color-log,$*) + +# Build the .bbl file. When dependencies are included, this will (or will +# not!) depend on something.bib, which we detect, acting accordingly. The +# dependency creation also produces the %.auxbbl.make file. BibTeX is a bit +# finicky about what you call the actual files, but we can rest assured that if +# a .auxbbl.make file exists, then the .aux file does, as well. The +# .auxbbl.make file is a cookie indicating whether the .bbl needs to be +# rewritten. It only changes if the .aux file changes in ways relevant to .bbl +# creation. +# +# Note that we do NOT touch the .bbl file if there is no need to +# create/recreate it. We would like to leave existing files alone if they +# don't need to be changed, thus possibly avoiding a rebuild trigger. +%.bbl: %.auxbbl.make + $(QUIET)\ + $(if $(filter %.bib,$^),\ + $(call echo-build,$(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + if $(EGREP) -q 'bibstyle.(apacann|chcagoa|[^}]*annot)' '$*.aux'; then \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \ + $(if $(filter %.bib,$^),\ + $(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \ + $(call run-latex,$*); \ + fi + +# Create the index file - note that we do *not* depend on %.tex here, since +# that unnecessarily restricts the kinds of indices that we can build to those +# with exactly the same stem as the source file. Things like splitidx create +# idx files with other names. +# +# Therefore, we add the .tex dependency in the sourcestem.d file in the call to +# get index file dependencies from the logs. +%.ind: %.idx + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.ilg) + +# Create the glossary file +%.gls: %.glo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.glg,-s nomencl.ist) + +# Create the nomenclature file +%.nls: %.nlo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.nlg,-s nomencl.ist) + +# SCRIPTED LaTeX TARGETS +# +# Keep the generated .tex files around for debugging if needed. +.SECONDARY: $(all_tex_targets) + +%.tex:: %.tex.sh + $(QUIET)$(call run-script,$(SHELL),$<,$@) + +%.tex:: %.tex.py + $(QUIET)$(call run-script,$(PYTHON),$<,$@) + +%.tex:: %.tex.pl + $(QUIET)$(call run-script,$(PERL),$<,$@) + +%.tex:: %.rst $(RST_STYLE_FILE) + $(QUIET)\ + $(call run-script,$(RST2LATEX)\ + --documentoptions=letterpaper\ + $(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@) + +# +# GRAPHICS TARGETS +# +.PHONY: all-graphics +all-graphics: $(all_graphics_targets); + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-pstex +all-pstex: $(all_pstex_targets); +endif + +.PHONY: all-dot2tex +all-dot2tex: $(all_dot2tex_targets); + +.PHONY: show-graphics +show-graphics: all-graphics + $(VIEW_GRAPHICS) $(all_known_graphics) + +$(gray_eps_file): + $(QUIET)$(call echo-build,$^,$@) + $(QUIET)$(call create-gray-eps-file,$@) + +ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" +%.pdf: %.eps $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY)) + +ifeq "$(strip $(GNUPLOT_OUTPUT_EXTENSION))" "pdf" +%.pdf: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) +endif + +%.pdf: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +endif + +%.eps: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) + +%.eps: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +%.eps: %.dot $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY)) + +%.eps: %.xvg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-xvg,$<,$@,$(GRAY)) + +%.eps: %.svg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-svg,$<,$@,$(GRAY)) + +%.eps: %.jpg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-jpg,$<,$@,$(GRAY)) + +%.eps: %.png $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-png,$<,$@,$(GRAY)) + +%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-epsgz,$<,$@,$(GRAY)) + +%.pstex: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY)) + +%.pstex_t: %.fig %.pstex + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY)) + +%.dot_t: %.dot + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot-tex,$<,$@) + +# +# DEPENDENCY-RELATED TARGETS. +# + +# Generate all of the information needed to get dependencies +# As a side effect, this creates a .dvi or .pdf file (depending on the build +# strategy). We need to be sure to remove it if there are errors. Errors can +# take several forms and all of them are found within the log file: +# * There was a LaTeX error +# * A needed file was not found +# * Cross references need adjustment +# +# Behavior: +# This rule is responsible for generating the following: +# %.aux +# %.d +# %.aux.make +# %.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved) +# +# Steps: +# +# Run latex +# Move .pdf or .dvi somewhere else (make no judgements about success) +# Flatten the .aux file into another file +# Add source dependencies +# Add graphic dependencies +# Add bib dependencies +# +# Create cookies for various suffixes that may represent files that +# need to be read by LaTeX in order for it to function properly. +# +# Note that if some of the dependencies are discovered because they turn +# up missing in the log file, we really need the .d file to be reloaded. +# Adding a sleep command helps with this. Otherwise make is extremely +# nondeterministic, sometimes working, sometimes not. +# +# Usually we can force this by simply removing the generated pdf file and +# not creating a .1st.make file.. +# +%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex + $(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1) + $(QUIET)\ + $(call run-latex,$<,--recorder) || $(sh_true); \ + $(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \ + $(call die-on-dot2tex,$*.log); \ + $(call die-on-no-aux,$*); \ + $(call flatten-aux,$*.aux,$*.aux.make); \ + $(ECHO) "# vim: ft=make" > $*.d; \ + $(ECHO) ".PHONY: $*._graphics" >> $*.d; \ + $(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(ECHO) ".SECONDEXPANSION:" >> $*.d; \ + $(call get-graphics,$*) >> $*.d; \ + $(call get-log-index,$*,$(addprefix $*.,d aux aux.make)) >> $*.d; \ + $(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \ + $(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \ + $(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \ + for s in toc out lot lof lol nav; do \ + if [ -e "$*.$$s" ]; then \ + if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \ + $(TOUCH) $*.run.cookie; \ + fi; \ + $(CP) $*.$$s $*.$$s.make; \ + fi; \ + done + +# This is a cookie that is updated if the flattened aux file has changed in a +# way that affects the bibliography generation. +.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg)) +%.auxbbl.make: %.aux.make + $(QUIET)\ + $(call make-auxbbl-file,$<,$@.temp); \ + $(call replace-if-different-and-remove,$@.temp,$@) + +# Build a dependency file for .gpi files. These often plot data files that +# also reside in the directory, so if a data file changes, it's nice to know +# about it. This also handles loaded .gpi files, whose filename should have +# _include_. in it. +%.gpi.d: %.gpi + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-gpi-d,$<,$@) + +# Store the paper size for this document -- note that if beamer is used we set +# it to the special BEAMER paper size. We only do this, however, if the +# special comment exists, in which case we enlarge the output with psnup. +# +# The paper size is extracted from a documentclass attribute. +%.paper.make: %.tex + $(QUIET)$(SED) \ + -e '/\\documentclass/,/}/{' \ + -e ' s/%.*//' \ + -e ' H' \ + -e ' /}/{' \ + -e ' s/.*//' \ + -e ' x' \ + -e ' /\\documentclass/!d' \ + -e ' s/[\n[:space:]]*//g' \ + -e ' s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/^[^%]*%-//' \ + -e ' s/-%[^%]*$$//' \ + -e ' s/-%[^%]%-/ /g' \ + -e ' p' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e 'd' \ + $< > $@; \ + $(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \ + (\ + $(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \ + $(ECHO) "BEAMER" > $@ || \ + : > $@ \ + ) || $(sh_true) + +# Store embedding instructions for this document using a special comment +%.embed.make: %.tex + $(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \ + && $(ECHO) '' > $@ \ + || $(ECHO) '1' > $@; + +# +# HELPFUL PHONY TARGETS +# + +.PHONY: _all_programs +_all_programs: + $(QUIET)$(ECHO) "== All External Programs Used ==" + $(QUIET)$(call output-all-programs) + +.PHONY: _check_programs +_check_programs: + $(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO) + $(QUIET) \ + $(ECHO) hi; \ + allprogs=`\ + ($(call output-all-programs)) | \ + $(SED) \ + -e 's/^[[:space:]]*//' \ + -e '/^#/d' \ + -e 's/[[:space:]]*#.*//' \ + -e '/^=/s/[[:space:]]/_/g' \ + -e '/^[[:space:]]*$$/d' \ + -e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \ + `; \ + spaces=' '; \ + for p in $${allprogs}; do \ + case $$p in \ + =*) $(ECHO); $(ECHO) "$$p";; \ + *) \ + $(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \ + loc=`$(WHICH) $$p`; \ + if [ x"$$?" = x"0" ]; then \ + $(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \ + else \ + $(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \ + fi; \ + ;; \ + esac; \ + done + +.PHONY: _check_gpi_files +_check_gpi_files: + $(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \ + $(ECHO); \ + for f in $(files.gpi); do \ + result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \ + $(ECHO) -n "$$f: "; \ + if [ x"$$result" = x"" ]; then \ + $(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \ + else \ + $(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\ + $(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \ + fi; \ + done; \ + $(ECHO) + +.PHONY: _all_stems +_all_stems: + $(QUIET)$(ECHO) "== All Stems ==" + $(QUIET)$(call echo-list,$(sort $(default_stems_ss))) + +.PHONY: _includes +_includes: + $(QUIET)$(ECHO) "== Include Stems ==" + $(QUIET)$(ECHO) "=== Sources ===" + $(QUIET)$(call echo-list,$(sort $(source_includes))) + $(QUIET)$(ECHO) "=== Graphics ===" + $(QUIET)$(call echo-list,$(sort $(graphic_includes))) + +.PHONY: _all_sources +_all_sources: + $(QUIET)$(ECHO) "== All Sources ==" + $(QUIET)$(call echo-list,$(sort $(all_files.tex))) + +.PHONY: _dependency_graph +_dependency_graph: + $(QUIET)$(ECHO) "/* LaTeX Dependency Graph */" + $(QUIET)$(call output-dependency-graph) + +.PHONY: _show_dependency_graph +_show_dependency_graph: + $(QUIET)$(call output-dependency-graph,$(graph_stem).dot) + $(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot + $(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps + $(QUIET)$(call remove-temporary-files,$(graph_stem).*) + +.PHONY: _sources +_sources: + $(QUIET)$(ECHO) "== Sources ==" + $(QUIET)$(call echo-list,$(sort $(files.tex))) + +.PHONY: _scripts +_scripts: + $(QUIET)$(ECHO) "== Scripts ==" + $(QUIET)$(call echo-list,$(sort $(files_scripts))) + +.PHONY: _graphic_outputs +_graphic_outputs: + $(QUIET)$(ECHO) "== Graphic Outputs ==" + $(QUIET)$(call echo-list,$(sort $(all_graphics_targets))) + +.PHONY: _env +_env: +ifdef .VARIABLES + $(QUIET)$(ECHO) "== MAKE VARIABLES ==" + $(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)')) +endif + $(QUIET)$(ECHO) "== ENVIRONMENT ==" + $(QUIET)$(ENV) + +# +# CLEAN TARGETS +# +# clean-generated is somewhat unique - it relies on the .fls file being +# properly built so that it can determine which of the files was generated, and +# which was not. Expect it to silently fail if the .fls file is missing. +# +# This is used to, e.g., clean up index files that are generated by the LaTeX. +.PHONY: clean-generated +clean-generated: + $(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\ + $(shell $(call get-generated-names,$e)))) + +.PHONY: clean-deps +clean-deps: + $(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie) + +.PHONY: clean-tex +clean-tex: clean-deps + $(QUIET)$(call clean-files,$(rm_tex)) + +.PHONY: clean-graphics +# TODO: This *always* deletes pstex files, even if they were not generated by +# anything.... In other words, if you create a pstex and pstex_t pair by hand +# an drop them in here without the generating fig file, they will be deleted +# and you won't get them back. It's a hack put in here because I'm not sure we +# even want to keep pstex functionality, so my motivation is not terribly high +# for doing it right. +clean-graphics: + $(QUIET)$(call clean-files,$(all_graphics_targets) $(intermediate_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t) + +.PHONY: clean-backups +clean-backups: + $(QUIET)$(call clean-files,$(backup_patterns) *.temp) + +.PHONY: clean-auxiliary +clean-auxiliary: + $(QUIET)$(call clean-files,$(graph_stem).*) + +.PHONY: clean-nographics +clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ; + +.PHONY: clean +clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary + +# +# HELP TARGETS +# + +.PHONY: help +help: + $(help_text) + +.PHONY: version +version: + $(QUIET)\ + $(ECHO) "$(fileinfo) Version $(version)"; \ + $(ECHO) "by $(author)"; \ + +# +# HELP TEXT +# + +define help_text +# $(fileinfo) Version $(version) +# +# by $(author) +# +# Generates a number of possible output files from a LaTeX document and its +# various dependencies. Handles .bib files, \include and \input, and .eps +# graphics. All dependencies are handled automatically by running LaTeX over +# the source. +# +# USAGE: +# +# make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] <target(s)> +# +# STANDARD OPTIONS: +# GRAY: +# Setting this variable forces all recompiled graphics to be grayscale. +# It is useful when creating a document for printing. The default is +# to allow colors. Note that it only changes graphics that need to be +# rebuilt! It is usually a good idea to do a 'make clean' first. +# +# VERBOSE: +# This turns off all @ prefixes for commands invoked by make. Thus, +# you get to see all of the gory details of what is going on. +# +# SHELL_DEBUG: +# This enables the -x option for sh, meaning that everything it does is +# echoed to stderr. This is particularly useful for debugging +# what is going on in $$(shell ...) invocations. One of my favorite +# debugging tricks is to do this: +# +# make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less +# +# STANDARD AUXILIARY FILES: +# +# Makefile.ini +# +# This file can contain variable declarations that override various +# aspects of the makefile. For example, one might specify +# +# neverclean := *.pdf *.ps +# onlysources.tex := main.tex +# LATEX_COLOR_WARNING := 'bold red uline' +# +# And this would override the neverclean setting to ensure that pdf +# and ps files always remain behind, set the makefile to treat all +# .tex files that are not "main.tex" as includes (and therefore not +# default targets). It also changes the LaTeX warning output to be +# red, bold, and underlined. +# +# There are numerous variables in this file that can be overridden in +# this way. Search for '?=' to find them all. +# +# Also, you can put arbitrary targets into it if, for example, you +# want your source built from something else, e.g.: +# +# generated.tex: generating_script.weird_lang depA depB +# ./generating_script.weird_lang > $$@ +# +# Note that if you are not careful, you can override the default +# target (what happens when you type "make" without arguments), so if +# you do use Makefile.ini, you probably want to start it with +# something like the following line: +# +# default: all +# +# Since the first target in any makefile is automatically the default, +# and the makefile already has a sensible "all" target, this will do +# what you want. +# +# The Makefile.ini is imported before *anything else* is done, so go +# wild with your ideas for changes to this makefile in there. It +# makes it easy to test them before submitting patches. +# +# STANDARD ENVIRONMENT VARIABLES: +# +# LATEX_COLOR_WARNING '$(LATEX_COLOR_WARNING)' +# LATEX_COLOR_ERROR '$(LATEX_COLOR_ERROR)' +# LATEX_COLOR_UNDERFULL '$(LATEX_COLOR_UNDERFULL)' +# LATEX_COLOR_OVERFULL '$(LATEX_COLOR_OVERFULL)' +# LATEX_COLOR_PAGES '$(LATEX_COLOR_PAGES)' +# LATEX_COLOR_BUILD '$(LATEX_COLOR_BUILD)' +# LATEX_COLOR_GRAPHIC '$(LATEX_COLOR_GRAPHIC)' +# LATEX_COLOR_DEP '$(LATEX_COLOR_DEP)' +# LATEX_COLOR_SUCCESS '$(LATEX_COLOR_SUCCESS)' +# LATEX_COLOR_FAILURE '$(LATEX_COLOR_FAILURE)' +# +# These may be redefined in your environment to be any of the following: +# +# black +# red +# green +# yellow +# blue +# magenta +# cyan +# white +# +# Bold or underline may be used, as well, either alone or in combination +# with colors: +# +# bold +# uline +# +# Order is not important. You may want, for example, to specify: +# +# export LATEX_COLOR_SUCCESS='bold blue uline' +# +# in your .bashrc file. I don't know why, but you may want to. +# +# STANDARD TARGETS: +# +# all: +# Make all possible documents in this directory. The documents are +# determined by scanning for .tex and .tex.sh (described in more detail +# later) and omitting any file that ends in ._include_.tex or +# ._nobuild_.tex. The output is a set of .pdf files. +# +# If you wish to omit files without naming them with the special +# underscore names, set the following near the top of the Makefile, +# or (this is recommended) within a Makefile.ini in the same directory: +# +# includes.tex := file1.tex file2.tex +# +# This will cause the files listed to be considered as include files. +# +# If you have only few source files, you can set +# +# onlysources.tex := main.tex +# +# This will cause only the source files listed to be considered in +# dependency detection. All other .tex files will be considered as +# include files. Note that these options work for *any* source type, +# so you could do something similar with includes.gpi, for example. +# Note that this works for *any valid source* target. All of the +# onlysources.* variables are commented out in the shipping version of +# this file, so it does the right thing when they simply don't exist. +# The comments are purely documentation. If you know, for example, that +# file.mycoolformat is supported by this Makefile, but don't see the +# "onlysources.mycoolformat" declared in the comments, that doesn't mean +# you can't use it. Go ahead and set "onlysources.mycoolformat" and it +# should do the right thing. +# +# show: +# Builds and displays all documents in this directory. It uses the +# environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to +# do its work. +# +# all-graphics: +# Make all of the graphics in this directory. +# +# all-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into pstex and pstex_t files. Gray DOES NOT WORK. +# +# all-gray-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into grayscale pstex and pstex_t files. +# +# all-dot2tex: +# Build all dot files into tex files. +# +# show-graphics: +# Builds and displays all graphics in this directory. Uses the +# environment-overridable value of VIEW_GRAPHICS (currently +# $(VIEW_GRAPHICS)) to do its work. +# +# clean: +# Remove ALL generated files, leaving only source intact. +# This will *always* skip files mentioned in the "neverclean" variable, +# either in this file or specified in Makefile.ini: +# +# neverclean := *.pdf *.ps +# +# The neverclean variable works on all "clean" targets below, as well. +# +# clean-graphics: +# Remove all generated graphics files. +# +# clean-backups: +# Remove all backup files: $(backup_patterns) +# (XFig and other editors have a nasty habit of leaving them around) +# Also removes Makefile-generated .temp files +# +# clean-tex: +# Remove all files generated from LaTeX invocations except dependency +# information. Leaves graphics alone. +# +# clean-deps: +# Removes all auto-generated dependency information. +# +# clean-auxiliary: +# Removes extra files created by various targets (like the dependency +# graph output). +# +# clean-nographics: +# Cleans everything *except* the graphics files. +# +# help: +# This help text. +# +# version: +# Version information about this LaTeX makefile. +# +# DEBUG TARGETS: +# +# _all_programs: +# A list of the programs used by this makefile. +# +# _check_programs: +# Checks your system for the needed software and reports what it finds. +# +# _check_gpi_files: +# Checks the .gpi files in the current directory for common errors, such +# as specification of the terminal or output file inside of the gpi file +# itself. +# +# _dependency_graph: +# Outputs a .dot file to stdout that represents a graph of LaTeX +# dependencies. To see it, use the _show_dependency_graph target or +# direct the output to a file, run dot on it, and view the output, e.g.: +# +# make _dependency_graph > graph.dot +# dot -T ps -o graph.eps graph.dot +# gv graph.eps +# +# _show_dependency_graph: +# Makes viewing the graph simple: extracts, builds and displays the +# dependency graph given in the _dependency_graph target using the value +# of the environment-overridable VIEW_POSTSCRIPT variable (currently set +# to $(VIEW_POSTSCRIPT)). The postscript viewer is used because it +# makes it easier to zoom in on the graph, a critical ability for +# something so dense and mysterious. +# +# _all_sources: +# List all .tex files in this directory. +# +# _sources: +# Print out a list of all compilable sources in this directory. This is +# useful for determining what make thinks it will be using as the +# primary source for 'make all'. +# +# _scripts: +# Print out a list of scripts that make knows can be used to generate +# .tex files (described later). +# +# _all_stems: +# Print a list of stems. These represent bare targets that can be +# executed. Listing <stem> as a bare target will produce <stem>.pdf. +# +# _includes: +# A list of .d files that would be included in this run if _includes +# weren't specified. This target may be used alone or in conjunction +# with other targets. +# +# _graphic_outputs: +# A list of all generated .eps files +# +# _env: +# A list of environment variables and their values. If supported by +# your version of make, also a list of variables known to make. +# +# FILE TARGETS: +# +# %, %.pdf: +# Build a PDF file from the corresponding %.tex file. +# +# If BUILD_STRATEGY=pdflatex, then this builds the pdf directly. +# Otherwise, it uses this old-school but effective approach: +# +# latex -> dvips -> ps2pdf +# +# The BUILD_STRATEGY can be overridden in Makefile.ini in the same +# directory. The default is pdflatex. +# +# Reasons for using latex -> dvips include the "psfrag" package, and the +# generation of postscript instead of PDF. Arguments for using pdflatex +# include "new and shiny" and "better supported." I can't argue with +# either of those, and supporting them both didn't turn out to be that +# difficult, so there you have it. Choices. +# +# %._show: +# A phony target that builds the pdf file and then displays it using the +# environment-overridable value of VIEW_PDF ($(VIEW_PDF)). +# +# %._graphics: +# A phony target that generates all graphics on which %.pdf (or %.dvi) +# depends. +# +# %.ps (only for BUILD_STRATEGY=latex): +# Build a Postscript file from the corresponding %.tex file. +# This is done using dvips. Paper size is automatically +# extracted from the declaration +# +# \documentclass[<something>paper] +# +# or it is the system default. +# +# If using beamer (an excellent presentation class), the paper +# size is ignored. More on this later. +# +# %.dvi (only for BUILD_STRATEGY=latex): +# Build the DVI file from the corresponding %.tex file. +# +# %.ind: +# Build the index for this %.tex file. +# +# %.gls: +# Build the nomenclature glossary for this %.tex file. +# +# %.nls: +# Build the (newer) nomenclature file for this %.tex file. +# +# %.eps: +# Build an eps file from one of the following file types: +# +# .dot : graphviz +# .gpi : gnuplot +# .fig : xfig +# .xvg : xmgrace +# .svg : scalable vector graphics (goes through inkscape) +# .png : png (goes through NetPBM) +# .jpg : jpeg (goes through ImageMagick) +# .eps.gz : gzipped eps +# +# The behavior of this makefile with each type is described in +# its own section below. +# +# %.pstex{,_t} (only for BUILD_STRATEGY=latex): +# Build a .pstex_t file from a .fig file. +# +# FEATURES: +# +# Optional Binary Directory: +# If you create the _out_ directory in the same place as the makefile, +# it will automatically be used as a dumping ground for .pdf (or .dvi, +# .ps, and .pdf) output files. +# +# Alternatively, you can set the BINARY_TARGET_DIR variable, either as a +# make argument or in Makefile.ini, to point to your directory of +# choice. Note that no pathname wildcard expansion is done in the +# makefile, so make sure that the path is complete before going in +# there. E.g., if you want to specify something in your home directory, +# use $$HOME/ instead of ~/ so that the shell expands it before it gets +# to the makefile. +# +# External Program Dependencies: +# Every external program used by the makefile is represented by an +# ALLCAPS variable at the top of this file. This should allow you to +# make judgments about whether your system supports the use of this +# makefile. The list is available in the ALL_PROGRAMS variable and, +# provided that you are using GNU make 3.80 or later (or you haven't +# renamed this file to something weird like "mylatexmakefile" and like +# invoking it with make -f) can be viewed using +# +# make _all_programs +# +# Additionally, the availability of these programs can be checked +# automatically for you by running +# +# make _check_programs +# +# The programs are categorized according to how important they are and +# what function they perform to help you decide which ones you really +# need. +# +# Colorized Output: +# The output of commands is colorized to highlight things that are often +# important to developers. This includes {underfull,overfull} +# {h,v}boxes, general LaTeX Errors, each stage of document building, and +# the number of pages in the final document. The colors are obtained +# using 'tput', so colorization should work pretty well on any terminal. +# +# The colors can be customized very simply by setting any of the +# LATEX_COLOR_<CONTEXT> variables in your environment (see above). +# +# Predecessors to TeX Files: +# Given a target <target>, if no <target>.tex file exists but a +# corresponding script or predecessor file exists, then appropriate +# action will be taken to generate the tex file. +# +# Currently supported script or predecessor languages are: +# +# sh: %.tex.sh +# perl: %.tex.pl +# python: %.tex.py +# +# Calls the script using the appropriate interpreter, assuming that +# its output is a .tex file. +# +# The script is called thus: +# +# <interpreter> <script file name> <target tex file> +# +# and therefore sees exactly one parameter: the name of the .tex +# file that it is to create. +# +# Why does this feature exist? I ran into this while working on +# my paper dissertation. I wrote a huge bash script that used a +# lot of sed to bring together existing papers in LaTeX. It +# would have been nice had I had something like this to make my +# life easier, since as it stands I have to run the script and +# then build the document with make. This feature provides hooks +# for complicated stuff that you may want to do, but that I have +# not considered. It should work fine with included dependencies, +# too. +# +# Scripts are run every time make is invoked. Some trickery is +# employed to make sure that multiple restarts of make don't cause +# them to be run again. +# +# reST: %.rst +# +# Runs the reST to LaTeX converter to generate a .tex file +# If it finds a file names _rststyle_._include_.tex, uses it as +# the "stylesheet" option to rst2latex. +# +# Note that this does not track sub-dependencies in rst files. It +# assumes that the top-level rst file will change if you want a +# rebuild. +# +# Dependencies: +# +# In general, dependencies are extracted directly from LaTeX output on +# your document. This includes +# +# * Bibliography information +# * \include or \input files (honoring \includeonly, too) +# * Graphics files inserted by the graphicx package +# +# Where possible, all of these are built correctly and automatically. +# In the case of graphics files, these are generated from the following +# file types: +# +# GraphViz: .dot +# GNUPlot: .gpi +# XFig: .fig +# XMgrace: .xvg +# SVG: .svg +# PNG: .png +# JPEG: .jpg +# GZipped EPS: .eps.gz +# +# If the file exists as a .eps already, it is merely used (and will not +# be deleted by 'clean'!). +# +# LaTeX and BibTeX are invoked correctly and the "Rerun to get +# cross-references right" warning is heeded a reasonable number of +# times. In my experience this is enough for even the most troublesome +# documents, but it can be easily changed (if LaTeX has to be run after +# BibTeX more than three times, it is likely that something is moving +# back and forth between pages, and no amount of LaTeXing will fix +# that). +# +# \includeonly is honored by this system, so files that are not +# specified there will not trigger a rebuild when changed. +# +# Beamer: +# A special TeX source comment is recognized by this makefile (only when +# BUILD_STRATEGY=latex, since this invokes psnup): +# +# %%[[:space:]]*BEAMER[[:space:]]*LARGE +# +# The presence of this comment forces the output of dvips through psnup +# to enlarge beamer slides to take up an entire letter-sized page. This +# is particularly useful when printing transparencies or paper versions +# of the slides. For some reason landscape orientation doesn't appear +# to work, though. +# +# If you want to put multiple slides on a page, use this option and then +# print using mpage, a2ps, or psnup to consolidate slides. My personal +# favorite is a2ps, but your mileage may vary. +# +# When beamer is the document class, dvips does NOT receive a paper size +# command line attribute, since beamer does special things with sizes. +# +# GNUPlot Graphics: +# When creating a .gpi file, DO NOT INCLUDE the "set terminal" or "set +# output" commands! The makefile will include terminal information for +# you. Besides being unnecessary and potentially harmful, including the +# terminal definition in the .gpi file makes it harder for you, the one +# writing the document, to preview your graphics, e.g., with +# +# gnuplot -persist myfile.gpi +# +# so don't do specify a terminal or an output file in your .gpi files. +# +# When building a gpi file into an eps file, there are several features +# available to the document designer: +# +# Global Header: +# The makefile searches for the files in the variable GNUPLOT_GLOBAL +# in order: +# +# ($(GNUPLOT_GLOBAL)) +# +# Only the first found is used. All .gpi files in the directory are +# treated as though the contents of GNUPLOT_GLOBAL were directly +# included at the top of the file. +# +# NOTE: This includes special comments! (see below) +# +# Font Size: +# A special comment in a .gpi file (or a globally included file) of +# the form +# +# ## FONTSIZE=<number> +# +# will change the font size of the GPI output. If font size is +# specified in both the global file and the GPI file, the +# specification in the individual GPI file is used. +# +# Grayscale Output: +# GNUplot files also support a special comment to force them to be +# output in grayscale *no matter what*: +# +# ## GRAY +# +# This is not generally advisable, since you can always create a +# grayscale document using the forms mentioned above. But, if your +# plot simply must be grayscale even in a document that allows +# colors, this is how you do it. +# +# XFig Graphics: +# No special handling is done with XFig, except when a global +# grayscale method is used, e.g. +# +# make GRAY=1 document +# +# In these cases the .eps files is created using the -N switch to +# fig2dev to turn off color output. (Only works with eps, not pstex +# output) +# +# GraphVis Graphics: +# Color settings are simply ignored here. The 'dot' program is used +# to transform a .dot file into a .eps file. +# +# If you want, you can use the dot2tex program to convert dot files +# to tex graphics. The default is to just call dot2tex with no +# arguments, but you can change the DOT2TEX definition to include +# options as needed (in your Makefile.ini). +# +# Note that, as with pstex, the makefile cannot use latex's own +# output to discover all missing dot_t (output) files, since anytime +# TeX includes TeX, it has to bail when it can't find the include +# file. It can therefore only stop on the first missing file it +# discovers, and we can't get a large list of them out easily. +# +# So, the makefile errors out if it's missing an included dot_t +# file, then prompts the user to run this command manually: +# +# make all-dot2tex +# +# GZipped EPS Graphics: +# +# A .eps.gz file is sometimes a nice thing to have. EPS files can get +# very large, especially when created from bitmaps (don't do this if you +# don't have to). This makefile will unzip them (not in place) to +# create the appropriate EPS file. +# +endef + +# +# DEPENDENCY CHART: +# +#digraph "g" { +# rankdir=TB +# size="9,9" +# edge [fontsize=12 weight=10] +# node [shape=box fontsize=14 style=rounded] +# +# eps [ +# shape=Mrecord +# label="{{<gpi> GNUplot|<epsgz> GZip|<dot> Dot|<fig> XFig}|<eps> eps}" +# ] +# pstex [label="%.pstex"] +# pstex_t [label="%.pstex_t"] +# tex_outputs [shape=point] +# extra_tex_files [shape=point] +# gpi_data [label="<data>"] +# gpi_includes [label="_include_.gpi"] +# aux [label="%.aux"] +# fls [label="%.fls"] +# idx [label="%.idx"] +# glo [label="%.glo"] +# ind [label="%.ind"] +# log [label="%.log"] +# tex_sh [label="%.tex.sh"] +# rst [label="%.rst"] +# tex [ +# shape=record +# label="<tex> %.tex|<include> _include_.tex" +# ] +# include_aux [label="_include_.aux"] +# file_bib [label=".bib"] +# bbl [label="%.bbl"] +# dvi [label="%.dvi"] +# ps [label="%.ps"] +# pdf [label="%.pdf"] +# fig [label=".fig"] +# dot [label=".dot"] +# gpi [label=".gpi"] +# eps_gz [label=".eps.gz"] +# +# gpi_files [shape=point] +# +# rst -> tex:tex [label="reST"] +# tex_sh -> tex:tex [label="sh"] +# tex_pl -> tex:tex [label="perl"] +# tex_py -> tex:tex [label="python"] +# tex -> tex_outputs [label="latex"] +# tex_outputs -> dvi +# tex_outputs -> aux +# tex_outputs -> log +# tex_outputs -> fls +# tex_outputs -> idx +# tex_outputs -> include_aux +# aux -> bbl [label="bibtex"] +# file_bib -> bbl [label="bibtex"] +# idx -> ind [label="makeindex"] +# glo -> gls [label="makeindex"] +# nlo -> nls [label="makeindex"] +# gls -> extra_tex_files +# nls -> extra_tex_files +# ind -> extra_tex_files +# bbl -> extra_tex_files +# eps -> extra_tex_files +# extra_tex_files -> dvi [label="latex"] +# gpi_files -> eps:gpi [label="gnuplot"] +# gpi -> gpi_files +# gpi_data -> gpi_files +# gpi_includes -> gpi_files +# eps_gz -> eps:epsgz [label="gunzip"] +# fig -> eps:fig [label="fig2dev"] +# fig -> pstex [label="fig2dev"] +# fig -> pstex_t [label="fig2dev"] +# pstex -> pstex_t [label="fig2dev"] +# dot -> eps:dot [label="dot"] +# dvi -> ps [label="dvips"] +# include_aux -> bbl [label="bibtex"] +# ps -> pdf [label="ps2pdf"] +# +# edge [ color=blue label="" style=dotted weight=1 fontcolor=blue] +# fls -> tex:include [label="INPUT: *.tex"] +# fls -> file_bib [label="INPUT: *.aux"] +# aux -> file_bib [label="\\bibdata{...}"] +# include_aux -> file_bib [label="\\bibdata{...}"] +# log -> gpi [label="Graphic file"] +# log -> fig [label="Graphic file"] +# log -> eps_gz [label="Graphic file"] +# log -> dot [label="Graphic file"] +# log -> idx [label="No file *.ind"] +# log -> glo [label="No file *.gls"] +# log -> nlo [label="No file *.nls"] +# gpi -> gpi_data [label="plot '...'"] +# gpi -> gpi_includes [label="load '...'"] +# tex:tex -> ps [label="paper"] +# tex:tex -> pdf [label="embedding"] +#} + +# +# DEPENDENCY CHART SCRIPT +# +# $(call output_dependency_graph,[<output file>]) +define output-dependency-graph + if [ -f '$(this_file)' ]; then \ + $(SED) \ + -e '/^[[:space:]]*#[[:space:]]*DEPENDENCY CHART:/,/^$$/!d' \ + -e '/DEPENDENCY CHART/d' \ + -e '/^$$/d' \ + -e 's/^[[:space:]]*#//' \ + $(this_file) $(if $1,> '$1',); \ + else \ + $(ECHO) "Cannot determine the name of this makefile."; \ + fi +endef +# vim: noet sts=0 sw=8 ts=8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/figures/intevation-logo.eps Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,1222 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%For: Frank Koormann,,, +%%CreationDate: Thu Mar 29 14:37:25 2001 +%%Title: intevation_logo-thin.eps +%%Creator: Sketch 0.6.8 +%%Pages: 1 +%%BoundingBox: 78 68 132 94 +%%Extensions: CMYK +%%DocumentSuppliedResources: (atend) +%%EndComments + +%%BeginProlog +%%BeginResource: procset Linux-Sketch-Procset 1.0 2 +/SketchDict 100 dict def +SketchDict begin +/bd { bind def } bind def +/x { exch } bd +/xd { exch def } bd +/PI 3.14159265358979323846264338327 def +/radgrad { 180 mul PI div } bd +/skstartmatrix matrix currentmatrix def +/tmpmat matrix def +/ISOLatin1Encoding dup where +{ pop pop } +{ [/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand +/quoteright /parenleft /parenright /asterisk /plus /comma /minus /period +/slash /zero /one /two /three /four /five /six /seven /eight /nine /colon +/semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J +/K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash +/bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i +/j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright +/asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve +/dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek +/caron /space /exclamdown /cent /sterling /currency /yen /brokenbar /section +/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen +/registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu +/paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright +/onequarter /onehalf /threequarters /questiondown /Agrave /Aacute /Acircumflex +/Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex +/Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve +/Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute +/Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute +/acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute +/ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde +/ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] def +} +ifelse +/arct dup where +{pop pop} +{ +/arct {arcto pop pop pop pop} bd +} +ifelse +/size 0 def +/fontname 0 def +/newfont 0 def +/sf { +/size xd +/fontname xd +fontname findfont +dup /Encoding get StandardEncoding eq +{ +dup +length dict /newfont xd +{ +1 index +/FID ne +{ newfont 3 1 roll put } +{ pop pop } +ifelse +} forall +newfont /Encoding ISOLatin1Encoding put +fontname newfont definefont +} +if +size scalefont setfont +} bd +/pusht {matrix currentmatrix} bd +/popt {setmatrix} bd +/pushc {gsave} bd +/popc {grestore} bd +/rgb {setrgbcolor} bd +/w { setlinewidth } bd +/j { setlinejoin } bd +/J { setlinecap } bd +/d { setdash } bd +/F { eofill } bd +/f { closepath F } bd +/S { +pusht +skstartmatrix setmatrix stroke +popt +} bd +/s { closepath S } bd +/m { moveto } bd +/l { lineto } bd +/c { curveto } bd +/txt { +/tmpmat tmpmat currentmatrix def +dup type /arraytype eq {concat} {translate} ifelse +0 0 m +tmpmat +} bd +/T {txt x show popt} bd +/P {txt x true charpath popt} bd +/TP {txt x dup show 0 0 m true charpath popt} bd +/C {newpath 0 360 arc} bd +/R { +2 copy m +x 2 index l +x 2 index x l +l +closepath +} bd +/ellipse { +dup type /arraytype eq +{ +pusht x concat +0 0 1.0 C +popt +} +{ +pusht 5 1 roll +4 -1 roll concat +newpath +dup 2 eq { +0 0 m +} if +3 1 roll +radgrad x +radgrad x +0 0 1 5 -2 roll +arc +0 ne { closepath } if +popt +} +ifelse +} bd +/radius1 0 def +/radius2 0 def +/factor 0 def +/rect { +dup type /arraytype eq +{ +pusht x concat +0 0 m 1 0 l 1 1 l 0 1 l closepath +popt +} +{ +/radius2 xd +/radius1 xd +pusht x concat +radius1 radius2 div 1 scale +0 radius2 m +0 1 radius2 1 radius2 arct +radius2 radius1 div +dup 1 1 index 0 radius2 arct +0 0 0 radius2 arct +0 0 0 1 radius2 arct +closepath +popt +} +ifelse +} bd +/buf 0 def +/width 0 def +/height 0 def +/skcimg { +/tmpmat tmpmat currentmatrix def +{ concat } if +/height xd +/width xd +/buf width 3 mul string def +width height scale +width height 8 +[width 0 0 height neg 0 height] +{ currentfile buf readhexstring pop } bind +false 3 colorimage +tmpmat setmatrix +} bd +/skgimg { +/tmpmat tmpmat currentmatrix def +{ concat } if +/height xd +/width xd +/buf width string def +width height scale +width height 8 +[width 0 0 height neg 0 height] +{ currentfile buf readhexstring pop } bind +image +tmpmat setmatrix +} bd +/rclip { +4 2 roll m +dup 0 x rlineto +x 0 rlineto +neg 0 x rlineto +closepath +clip +} bd +/skeps { +10 dict begin +/sk_state save def +concat +3 index neg 3 index neg translate +rclip +0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin +10 setmiterlimit [ ] 0 setdash +newpath +/sk_dict_count countdictstack def +/sk_count count 1 sub def +userdict begin +/showpage { } def +/languagelevel where +{ +pop +languagelevel 1 ne +{ +false setstrokeadjust +false setoverprint +} if +} if +} bd +/skepsend { +count sk_count sub { pop } repeat +countdictstack sk_dict_count sub { end } repeat +sk_state restore +end +} bd +/gradidx 0 def +/gradient { +3 mul array +/gradidx 0 def +} bd +/$ { +3 index gradidx 5 -1 roll put +2 index gradidx 1 add 4 -1 roll put +1 index gradidx 2 add 3 -1 roll put +/gradidx gradidx 3 add def +} bd +/! { +3 +{ +dup dup gradidx dup 3 1 roll 3 sub get put +/gradidx gradidx 1 add def +} +repeat +} bd +/gradcolor { +3 mul dup 2 add 1 exch % idx 1 idx+2 +{ +1 index exch % array array i +get % array component +exch % component array +} +for +4 1 roll +} bd +/x0 0 def /y0 0 def /x1 0 def /y1 0 def +/left 0 def /right 0 def /top 0 def /bottom 0 def +/numcolors 0 def +/axial { +/y1 xd /x1 xd /y0 xd /x0 xd +dup length 3 idiv /numcolors xd +pusht exch % ctm array +x0 x1 ne y0 y1 ne or +{ +x0 y0 translate +[x1 x0 sub y1 y0 sub dup neg 2 index 0 0] concat +clippath flattenpath pathbbox +/top xd /right xd /bottom xd /left xd +newpath +0 gradcolor rgb clippath f +0 1 numcolors 1 sub +{ +dup numcolors div +3 1 roll +gradcolor rgb +exch +bottom right top R f +} +for +} +if +pop +popt +} bd +/r0 0 def /r1 0 def /dr 0 def +/radial { +/r1 xd /r0 xd /y0 xd /x0 xd +/dr r1 r0 sub def +dup length 3 idiv /numcolors xd +pusht exch % ctm array +r0 r1 ne +{ +x0 y0 translate +clippath flattenpath pathbbox +/top xd /right xd /bottom xd /left xd +newpath +dr 0 gt {numcolors 1 sub}{0} ifelse gradcolor rgb +clippath f +dr 0 gt {numcolors 1 sub -1 0} { 0 1 numcolors 1 sub} ifelse +{ +dup numcolors div dr mul r0 add +3 1 roll +gradcolor rgb +exch +0 0 3 -1 roll C f +} +for +} +if +pop +popt +} bd +/max { +2 copy lt {exch} if pop +} bd +/conical { +pusht 5 1 roll +3 1 roll /y0 xd /x0 xd +x0 y0 translate +radgrad rotate +dup length 3 idiv /numcolors xd +clippath flattenpath pathbbox newpath +4 { abs 4 1 roll} repeat +3 { max } repeat +2 mul +dup scale +0 gradcolor rgb +0 0 1 0 360 arc f +1 1 numcolors 1 sub +{ +dup numcolors div 180 mul +3 1 roll +gradcolor rgb +exch +0 0 moveto +0 0 1 4 -1 roll dup neg arc +closepath f +} +for +pop +popt +} bd +/XStep 0 def /YStep 0 def /imagedata 0 def /components 0 def +/tileimage2 { +exch 4 2 roll +/height xd +/width xd +mark +/components 2 index +/PatternType 1 +/PaintType 1 +/TilingType 1 +/BBox [0 0 width height] +/XStep width +/YStep height +/PaintProc { +begin +XStep YStep 8 +matrix +imagedata +false +components +colorimage +end +} +counttomark 2 div cvi dup dict begin +{ def } repeat +pop currentdict end +dup +/imagedata +4 -1 roll +width height mul mul string +currentfile exch readhexstring pop +put +exch +makepattern +setpattern +clippath +eofill +} bd +/tileimage1 { +concat +/components xd +/height xd +/width xd +/imagedata +currentfile +width height mul components mul string +readhexstring pop +def +clippath flattenpath pathbbox +/top xd /right xd /bottom xd /left xd +left width div floor width mul +bottom height div floor height mul +translate +top bottom sub height div ceiling cvi +{ +gsave +right left sub width div ceiling cvi +{ +width height 8 matrix +components 1 eq +{ +{ imagedata } +image +} +{ +imagedata +false components +colorimage +} +ifelse +width 0 translate +} +repeat +grestore +0 height translate +} +repeat +} bd +/makepattern where +{ +pop +/tileimage /tileimage2 load def +} +{ +/tileimage /tileimage1 load def +} +ifelse +end +%%EndResource +%%EndProlog + +%%BeginSetup + +10.433 setmiterlimit +%%EndSetup + +%%Page: 1 1 +SketchDict begin +newpath +81.1479 90.3363 m +83.1262 89.4518 85.8962 89.4399 87.7755 90.732 c +88.4885 91.2221 89.1744 91.8548 89.1744 92.7451 c +89.3805 92.7446 89.5146 92.3854 89.7059 92.4617 c +90.3588 92.7216 91.0745 92.5334 91.5725 92.3012 c +91.8169 92.1873 92.0442 92.7366 92.3141 92.7358 c +92.4246 92.4106 93.2359 91.4866 93.2359 91.4372 c +95.3948 89.4748 99.2768 88.555 102.019 89.186 c +102.881 89.3844 110.268 92.0436 110.268 92.7837 c +110.735 92.6454 111.042 92.3763 111.801 92.3588 c +113.208 92.7366 l +114.425 92.9532 114.356 92.6862 114.93 92.6609 c +114.93 90.5837 114.005 87.8389 114.95 85.8136 c +115.043 85.6129 115.327 85.1931 115.474 85.044 c +119.365 81.1112 125.41 82.6691 129.868 84.5493 c +129.868 84.4181 130.124 84.2636 130.124 84.1323 c +130.124 83.9504 129.868 83.7916 129.868 83.6096 c +129.521 83.6096 129.294 83.4821 129.005 83.2726 c +126.771 81.6517 123.827 80.5003 121.756 78.5645 c +121.551 78.3735 121.558 78.1688 121.558 77.872 c +121.756 77.6246 122.036 77.2541 122.315 77.061 c +122.399 77.0029 122.564 76.8961 124.449 75.877 c +126.015 75.0309 127.68 74.6575 129.194 74.6604 c +129.194 74.475 129.046 74.2851 129.051 74.0807 c +129.052 74.0297 129.066 73.9744 129.086 73.9171 c +129.106 73.8599 129.132 73.8003 129.158 73.7411 c +129.183 73.6819 129.209 73.6226 129.227 73.5659 c +129.245 73.5087 129.255 73.4539 129.252 73.4038 c +129.238 73.1617 129.151 72.9814 129.076 72.7773 c +126.75 73.9407 124.211 75.0082 121.611 75.7449 c +120.232 76.1358 118.876 76.4938 117.501 76.7872 c +116.305 77.0426 113.981 77.2912 113.298 75.7452 c +112.578 74.1158 113.329 72.4451 113.544 70.8622 c +113.245 70.9989 113.04 71.6163 112.826 71.3291 c +112.556 70.799 l +112.21 71.5408 111.908 72.5375 111.698 73.3754 c +111.413 74.5161 110.852 75.2644 109.473 75.4597 c +107.323 75.7648 107.541 75.5249 106.808 75.0986 c +105.489 74.3316 104.447 72.6469 104.427 70.7633 c +104.103 70.8166 104.04 71.1029 103.715 71.1562 c +103.661 71.1361 103.594 71.1001 103.521 71.0624 c +103.448 71.0247 103.368 70.985 103.288 70.9575 c +103.209 70.9303 103.129 70.9147 103.056 70.9254 c +102.983 70.9359 102.916 70.9725 102.862 71.049 c +102.814 71.2619 102.513 71.4476 102.165 71.1947 c +101.229 70.799 l +101.108 71.1117 100.582 71.3382 100.316 71.5037 c +99.0659 72.2807 97.0528 71.5295 96.2781 70.5102 c +96.093 70.57 95.9079 70.6298 95.7225 70.6896 c +95.5289 70.7905 95.2567 70.9099 94.8114 70.6321 c +94.4917 70.5802 l +94.4917 70.8373 94.9407 70.8557 95.0994 71.1094 c +95.4787 71.7155 95.856 72.5599 96.434 73.236 c +97.4233 74.3934 98.3768 75.7545 97.6356 77.2578 c +97.415 77.7045 97.576 77.5078 96.6749 78.2941 c +96.1414 78.7598 95.3594 79.3486 94.7173 79.6468 c +91.9201 80.9465 88.4556 81.0936 85.1714 80.6681 c +83.4604 80.4467 81.7831 80.1902 80.3068 79.6031 c +80.2609 79.585 80.3031 79.5122 80.2535 79.5122 c +80.306 79.6936 80.6359 79.9461 80.4556 80.0496 c +80.2343 80.1389 80.2481 80.2886 80.2552 80.4833 c +80.2731 80.7971 l +80.4213 80.7971 80.3077 80.824 80.4554 80.8396 c +82.6332 81.0712 84.5517 81.7552 86.5887 82.4718 c +87.2231 82.6952 87.987 83.0019 88.527 83.452 c +88.8771 83.744 89.3216 84.2214 89.3216 84.6667 c +89.3216 85.0624 88.8949 85.959 88.6166 86.1815 c +86.4209 87.9381 80.8845 88.8736 80.8346 88.9422 c +80.7828 89.0136 l +80.7856 89.1103 81.0512 89.1729 81.1198 89.3575 c +81.1731 89.5006 81.0506 89.7858 81.1017 89.9232 c +81.1924 90.1679 81.2247 90.3363 81.1479 90.3363 c +closepath +gsave +0.9 0.9 0.9 rgb +F +grestore +0.9 0.9 0.9 rgb +0.215433 w +0 j +0 J +[] 0 d +S +newpath +108.203 84.2032 m +107.659 84.1536 106.67 83.9557 106.373 83.5107 c +106.324 83.5107 106.274 83.4611 106.274 83.4118 c +106.126 83.3622 106.027 82.9665 105.829 82.8675 c +105.829 82.1257 105.533 81.4828 106.126 80.8396 c +106.225 80.7407 l +106.423 80.6914 l +107.907 79.8999 109.341 79.9989 110.726 80.8892 c +110.776 80.9882 l +110.875 81.0375 111.072 81.3343 111.27 81.3343 c +111.27 81.8782 111.765 82.4225 111.418 83.115 c +111.32 83.3129 110.825 83.4611 110.825 83.659 c +110.726 83.659 110.132 84.0054 110.132 84.0547 c +109.935 84.0547 l +109.737 84.2525 108.401 84.2525 108.203 84.2032 c +closepath +gsave +0.8 0.8 0.8 rgb +F +grestore +0.7 0.7 0.7 rgb +0.566929 w +0 j +0 J +[] 0 d +S +newpath +129.218 74.6074 m +126.745 74.9042 123.636 75.6956 121.805 77.5256 c +121.657 77.6742 121.459 78.0203 121.459 78.2677 c +121.558 78.3171 l +121.558 78.3667 121.757 78.5634 121.805 78.6139 c +123.135 79.9966 125.128 80.6576 126.673 81.7561 c +128.047 82.7323 129.427 83.5107 129.67 83.5107 c +129.775 83.5629 130.033 83.615 130.115 83.659 c +129.109 72.8173 m +127.427 73.3119 125.912 74.363 124.229 74.9042 c +121.542 75.7684 l +120.528 76.0947 119.51 76.4014 118.523 76.5599 c +116.741 76.8465 115.229 77.6229 113.743 76.2892 c +112.805 75.4467 113.006 74.657 113.006 73.4205 c +113.121 72.9094 113.569 71.2846 113.569 70.7888 c +112.54 70.8024 m +111.897 72.0885 111.86 74.2406 110.585 75.1462 c +109.981 75.576 107.912 75.6808 107.214 75.4484 c +106.724 75.2851 106.373 74.7559 106.027 74.4095 c +105.087 73.4698 104.431 72.0363 104.431 70.7009 c +101.387 70.7216 m +100.435 71.9918 98.2462 72.4301 97.0247 71.1409 c +96.8801 71.0068 96.6052 70.7772 96.0915 70.388 c +94.588 70.6593 m +95.3302 71.0054 95.6213 71.8212 95.9603 72.5171 c +96.561 73.7499 98.571 75.6363 97.6602 77.1169 c +97.3518 77.6183 l +97.063 78.124 95.8361 79.0019 95.7069 79.1312 c +95.509 79.329 94.9892 79.5357 94.7496 79.6525 c +90.7346 81.6135 86.2429 80.9354 82.0379 80.1471 c +81.4945 80.0454 80.7354 79.496 80.1915 79.496 c +80.855 88.9875 m +81.4486 88.839 81.943 88.619 82.5326 88.4566 c +83.9216 88.0751 85.6935 87.8542 86.9841 87.1708 c +87.3753 86.9639 87.8251 86.5772 88.2209 86.3794 c +88.9627 86.0333 89.3091 85.2418 89.2595 84.4008 c +89.2595 84.2032 88.8592 83.7624 88.7155 83.6096 c +88.0678 82.9214 86.6839 82.482 85.7972 82.175 c +84.1118 81.5919 82.1369 80.7407 80.3068 80.7407 c +80.2575 80.6914 l +81.2564 90.302 m +81.7865 90.031 81.8707 90.1115 82.3007 89.9334 c +83.7949 89.3152 85.8009 89.932 87.1823 90.5344 c +88.1222 90.944 89.2116 91.7442 89.2116 92.8407 c +92.2753 92.7032 m +92.9678 91.6646 93.7564 90.8221 94.8982 90.2869 c +95.3392 90.0803 95.9901 89.7098 96.481 89.5944 c +98.5129 89.1165 100.233 88.7908 102.318 89.1987 c +102.511 89.2367 102.58 89.2282 103.109 89.3966 c +105.253 90.0783 107.678 91.2292 109.638 92.3148 c +109.697 92.3474 110.336 92.8129 110.352 92.8129 c +114.93 92.7352 m +114.815 91.7541 114.609 90.9627 114.61 90.427 c +114.611 88.8645 114.327 87.8086 114.634 86.6268 c +115.198 84.4504 118.458 82.8638 119.975 82.7193 c +123.178 82.4137 126.158 83.2958 129.076 84.3515 c +129.123 84.3682 129.274 84.4008 129.373 84.4008 c +129.423 84.4997 129.818 84.6483 129.967 84.6483 c +0.8 0.8 0.8 rgb +1 j +1 J +S +newpath +81.6246 86.9766 m +82.6698 86.9766 l +82.6698 79.2655 l +81.6246 79.2655 l +81.6246 86.9766 l +closepath +84.0446 82.4667 m +84.0446 82.7598 84.0959 83.0368 84.1988 83.297 c +84.3014 83.5575 84.4553 83.8013 84.6606 84.0286 c +84.8734 84.2486 85.1226 84.4155 85.4086 84.5292 c +85.6946 84.6429 86.0209 84.6996 86.3877 84.6996 c +86.4464 84.6996 86.5104 84.6959 86.5802 84.6885 c +86.6499 84.6811 86.725 84.6704 86.8058 84.6556 c +86.8863 84.6409 86.9688 84.6227 87.0533 84.6006 c +87.1375 84.5785 87.2236 84.5493 87.3118 84.5125 c +87.4657 84.4467 87.6123 84.3622 87.7517 84.2596 c +87.8909 84.157 88.0267 84.0323 88.1588 83.8857 c +88.2906 83.7463 88.3898 83.5739 88.4559 83.3687 c +88.5216 83.1632 88.5548 82.9285 88.5548 82.6646 c +88.5548 82.6572 88.5548 82.6481 88.5548 82.6371 c +88.5548 82.626 88.5548 82.6133 88.5548 82.5985 c +88.5548 82.5911 88.5548 82.5821 88.5548 82.571 c +88.5548 82.56 88.5548 82.5472 88.5548 82.5325 c +88.5548 79.2655 l +87.5097 79.2655 l +87.5097 82.3786 l +87.5097 82.5398 87.4858 82.6994 87.4382 82.857 c +87.3906 83.0146 87.3192 83.1632 87.2236 83.3026 c +87.1284 83.4492 87.0037 83.5592 86.8497 83.6326 c +86.6958 83.706 86.5124 83.7426 86.2998 83.7426 c +86.1017 83.7426 85.9276 83.7097 85.7771 83.6437 c +85.6269 83.5776 85.4968 83.4787 85.3868 83.3466 c +85.2768 83.2145 85.1906 83.0733 85.1283 82.9231 c +85.0659 82.7729 85.0237 82.6133 85.0016 82.4446 c +85.0016 79.2655 l +84.0446 79.2655 l +84.0446 82.4667 l +closepath +89.6767 85.8436 m +90.7108 85.8436 l +90.7108 84.5456 l +92.7126 84.5456 l +92.7126 83.5997 l +90.7108 83.5997 l +90.7108 80.9156 l +90.7108 80.813 90.7179 80.7211 90.7326 80.6406 c +90.7474 80.5598 90.7695 80.483 90.7987 80.4096 c +90.8279 80.3362 90.8922 80.2832 90.9912 80.25 c +91.0901 80.2171 91.2276 80.2007 91.4036 80.2007 c +92.6248 80.2225 l +92.6248 79.2655 l +91.3268 79.2655 l +91.3194 79.2655 91.312 79.2655 91.3047 79.2655 c +91.2973 79.2655 91.2899 79.2655 91.2826 79.2655 c +91.2755 79.2655 91.2698 79.2655 91.2661 79.2655 c +91.2624 79.2655 91.2571 79.2619 91.2497 79.2545 c +91.2423 79.2545 91.2349 79.2545 91.2276 79.2545 c +91.2205 79.2545 91.2131 79.2545 91.2057 79.2545 c +91.1984 79.2545 91.193 79.2545 91.1893 79.2545 c +91.1856 79.2545 91.18 79.2545 91.1726 79.2545 c +90.9234 79.2545 90.7071 79.2913 90.5237 79.3645 c +90.3403 79.4379 90.1901 79.5516 90.0727 79.7055 c +89.9554 79.8597 89.8655 80.0247 89.8032 80.2007 c +89.7408 80.3764 89.7023 80.5598 89.6878 80.7506 c +89.6804 80.7654 89.6767 80.7818 89.6767 80.7999 c +89.6767 80.8184 89.6767 80.8385 89.6767 80.8606 c +89.6767 80.8753 89.6767 80.8918 89.6767 80.9099 c +89.6767 80.9283 89.6767 80.9485 89.6767 80.9706 c +89.6767 80.9927 l +89.6767 85.8436 l +closepath +96.7829 83.1595 m +96.7682 83.1669 96.7534 83.1762 96.7387 83.187 c +96.7242 83.198 96.7095 83.2145 96.6948 83.2366 c +96.68 83.2513 96.6636 83.2695 96.6454 83.2916 c +96.627 83.3137 96.6069 83.3355 96.5848 83.3576 c +96.5629 83.3724 96.5388 83.3888 96.5133 83.407 c +96.4875 83.4254 96.4637 83.4455 96.4419 83.4676 c +96.4124 83.4824 96.3832 83.4988 96.3537 83.5172 c +96.3246 83.5354 96.2914 83.5518 96.2548 83.5666 c +96.1814 83.6031 96.0952 83.6289 95.9963 83.6437 c +95.8974 83.6584 95.7854 83.6655 95.6607 83.6655 c +95.3747 83.6655 95.1235 83.6142 94.9072 83.5116 c +94.6909 83.4089 94.5095 83.2587 94.3627 83.0606 c +94.2161 82.8627 94.1062 82.6535 94.0327 82.4335 c +93.9593 82.2136 93.9228 81.9862 93.9228 81.7515 c +93.9228 81.7442 93.9228 81.7368 93.9228 81.7297 c +93.9228 81.7186 l +93.9228 81.5058 93.9613 81.3025 94.0384 81.1081 c +94.1152 80.9136 94.2272 80.7285 94.3737 80.5525 c +94.5206 80.3764 94.702 80.2446 94.9183 80.1565 c +95.1346 80.0686 95.382 80.0247 95.6607 80.0247 c +95.9614 80.0247 96.2126 80.0592 96.4144 80.129 c +96.616 80.1987 96.7682 80.3033 96.8708 80.4425 c +96.9734 80.5893 97.0669 80.7617 97.1514 80.9595 c +97.2356 81.1577 97.3107 81.3813 97.3768 81.6305 c +97.3768 81.6415 l +97.3878 81.6526 l +97.3878 81.6637 l +98.3448 81.6087 l +98.3448 81.5939 98.3448 81.5812 98.3448 81.5701 c +98.3448 81.5591 98.3485 81.55 98.3559 81.5426 c +98.3559 81.5279 98.3559 81.5168 98.3559 81.5094 c +98.3559 81.5024 98.3559 81.4913 98.3559 81.4766 c +98.3559 81.4692 98.3559 81.4601 98.3559 81.4491 c +98.3559 81.438 98.3595 81.4289 98.3669 81.4216 c +98.3669 81.4068 98.3669 81.3958 98.3669 81.3887 c +98.3669 81.3813 98.3669 81.374 98.3669 81.3666 c +98.3669 81.3079 98.3632 81.2475 98.3559 81.1852 c +98.3485 81.1228 98.3374 81.0585 98.323 80.9927 c +98.3156 80.9632 98.3063 80.9303 98.2952 80.8935 c +98.2844 80.8569 98.2751 80.824 98.2677 80.7946 c +98.2532 80.758 98.2402 80.7231 98.2294 80.69 c +98.2184 80.6571 98.2056 80.6222 98.1909 80.5856 c +98.1027 80.4022 97.9854 80.2225 97.8388 80.0465 c +97.6923 79.8705 97.5126 79.7055 97.3 79.5516 c +97.0944 79.3976 96.8543 79.282 96.5794 79.2052 c +96.3044 79.1281 95.9983 79.0895 95.6607 79.0895 c +95.272 79.0895 94.9129 79.1502 94.5827 79.2709 c +94.2527 79.392 93.9559 79.5774 93.6917 79.8265 c +93.4205 80.0833 93.2189 80.3711 93.0868 80.69 c +92.9547 81.0091 92.8887 81.3629 92.8887 81.7515 c +92.8887 82.1623 92.9437 82.5254 93.0536 82.8406 c +93.1636 83.1558 93.3289 83.4274 93.5489 83.6547 c +93.7688 83.882 93.9999 84.0688 94.2417 84.2157 c +94.4837 84.3622 94.7369 84.4685 95.0008 84.5346 c +95.0303 84.542 95.0577 84.5473 95.0833 84.551 c +95.1091 84.5547 95.1366 84.5604 95.1657 84.5675 c +95.1952 84.5675 95.2227 84.5695 95.2482 84.5731 c +95.274 84.5768 95.3015 84.5822 95.3307 84.5896 c +95.3894 84.5969 95.4464 84.6023 95.5014 84.606 c +95.5564 84.6097 95.6094 84.6117 95.6607 84.6117 c +95.9614 84.6117 96.2421 84.5695 96.5023 84.485 c +96.7628 84.4008 97.0029 84.2744 97.2229 84.1057 c +97.4354 83.937 97.6279 83.75 97.8003 83.5447 c +97.9726 83.3392 98.1248 83.1192 98.2569 82.8845 c +94.6158 80.9156 l +94.1867 81.6855 l +96.7829 83.1595 l +closepath +99.6431 84.5456 m +101.282 80.3875 l +102.756 84.5456 l +103.889 84.5456 l +102.063 79.7826 l +102.019 79.6726 101.969 79.5791 101.914 79.502 c +101.859 79.4251 101.799 79.3608 101.733 79.3095 c +101.667 79.2655 101.599 79.229 101.53 79.1995 c +101.46 79.1703 101.385 79.1519 101.304 79.1445 c +101.297 79.1445 101.291 79.1445 101.287 79.1445 c +101.284 79.1445 101.278 79.1445 101.271 79.1445 c +101.264 79.1445 101.256 79.1445 101.249 79.1445 c +101.168 79.1445 101.09 79.1556 101.012 79.1777 c +100.935 79.1995 100.857 79.2327 100.776 79.2766 c +100.703 79.3353 100.637 79.403 100.578 79.4801 c +100.519 79.5569 100.468 79.6505 100.424 79.7605 c +98.5101 84.5456 l +99.6431 84.5456 l +closepath +108.388 82.3015 m +108.388 82.463 108.357 82.6223 108.294 82.7802 c +108.232 82.9378 108.139 83.0864 108.014 83.2255 c +107.889 83.3724 107.713 83.4824 107.486 83.5555 c +107.259 83.6289 106.984 83.6655 106.661 83.6655 c +106.609 83.6655 106.556 83.6618 106.501 83.6547 c +106.447 83.6473 106.386 83.6363 106.32 83.6215 c +106.254 83.6142 106.188 83.5997 106.122 83.5776 c +106.056 83.5555 105.99 83.5263 105.924 83.4897 c +105.807 83.4381 105.693 83.3667 105.583 83.2751 c +105.473 83.1833 105.367 83.0753 105.264 82.9506 c +105.169 82.8332 105.092 82.6884 105.033 82.516 c +104.974 82.3437 104.938 82.1475 104.923 81.9276 c +104.923 81.6342 104.963 81.3793 105.044 81.1631 c +105.125 80.9468 105.245 80.7654 105.407 80.6185 c +105.576 80.4793 105.75 80.3674 105.929 80.2832 c +106.109 80.1987 106.298 80.1454 106.496 80.1236 c +106.503 80.1236 106.513 80.1236 106.523 80.1236 c +106.534 80.1236 106.544 80.1236 106.551 80.1236 c +106.566 80.1162 106.578 80.1125 106.589 80.1125 c +106.6 80.1125 106.609 80.1125 106.617 80.1125 c +106.632 80.1125 106.643 80.1125 106.65 80.1125 c +106.657 80.1125 106.668 80.1125 106.683 80.1125 c +106.69 80.1125 106.699 80.1125 106.71 80.1125 c +106.721 80.1125 106.731 80.1125 106.738 80.1125 c +106.826 80.1125 106.909 80.1179 106.985 80.129 c +107.062 80.14 107.138 80.1602 107.211 80.1896 c +107.248 80.2041 107.282 80.2188 107.315 80.2336 c +107.348 80.2483 107.383 80.2628 107.42 80.2775 c +107.449 80.2996 107.482 80.3214 107.519 80.3436 c +107.556 80.3657 107.589 80.3912 107.618 80.4207 c +107.655 80.4425 107.689 80.47 107.722 80.5032 c +107.756 80.536 107.79 80.5672 107.827 80.5967 c +107.864 80.6333 107.9 80.6681 107.937 80.701 c +107.974 80.7342 108.01 80.7688 108.047 80.8056 c +108.047 79.6066 l +108.04 79.5918 108.032 79.5808 108.025 79.5737 c +108.025 79.5626 l +107.937 79.5039 107.845 79.4506 107.75 79.403 c +107.655 79.3554 107.556 79.3132 107.453 79.2766 c +107.35 79.2471 107.225 79.2233 107.079 79.2052 c +106.932 79.1867 106.764 79.1777 106.573 79.1777 c +106.566 79.1777 106.56 79.1777 106.556 79.1777 c +106.553 79.1777 106.547 79.1777 106.54 79.1777 c +106.533 79.1777 106.522 79.1777 106.507 79.1777 c +106.5 79.1777 106.492 79.1777 106.485 79.1777 c +106.478 79.1777 106.47 79.1777 106.463 79.1777 c +106.456 79.1777 106.45 79.1777 106.447 79.1777 c +106.443 79.1777 106.437 79.1777 106.43 79.1777 c +106.092 79.1777 105.779 79.238 105.49 79.3591 c +105.2 79.4801 104.934 79.6652 104.692 79.9147 c +104.45 80.1712 104.268 80.4663 104.147 80.7999 c +104.026 81.1339 103.966 81.5094 103.966 81.9276 c +103.966 82.2944 104.025 82.6354 104.142 82.9506 c +104.259 83.2658 104.435 83.5555 104.67 83.8197 c +104.904 84.0836 105.194 84.2817 105.539 84.4135 c +105.884 84.5456 106.283 84.6117 106.738 84.6117 c +107.17 84.6117 107.556 84.553 107.893 84.4357 c +108.23 84.3183 108.513 84.1423 108.74 83.9076 c +108.975 83.6729 109.149 83.4254 109.262 83.1652 c +109.376 82.9047 109.433 82.6354 109.433 82.3564 c +109.433 79.2655 l +108.388 79.2655 l +108.388 82.3015 l +closepath +110.467 85.8436 m +111.501 85.8436 l +111.501 84.5456 l +113.503 84.5456 l +113.503 83.5997 l +111.501 83.5997 l +111.501 80.9156 l +111.501 80.813 111.508 80.7211 111.523 80.6406 c +111.538 80.5598 111.56 80.483 111.589 80.4096 c +111.618 80.3362 111.683 80.2832 111.782 80.25 c +111.881 80.2171 112.018 80.2007 112.194 80.2007 c +113.415 80.2225 l +113.415 79.2655 l +112.117 79.2655 l +112.11 79.2655 112.102 79.2655 112.095 79.2655 c +112.088 79.2655 112.08 79.2655 112.073 79.2655 c +112.066 79.2655 112.06 79.2655 112.057 79.2655 c +112.053 79.2655 112.047 79.2619 112.04 79.2545 c +112.033 79.2545 112.025 79.2545 112.018 79.2545 c +112.011 79.2545 112.004 79.2545 111.996 79.2545 c +111.989 79.2545 111.983 79.2545 111.98 79.2545 c +111.976 79.2545 111.97 79.2545 111.963 79.2545 c +111.714 79.2545 111.498 79.2913 111.314 79.3645 c +111.131 79.4379 110.981 79.5516 110.863 79.7055 c +110.746 79.8597 110.656 80.0247 110.594 80.2007 c +110.531 80.3764 110.493 80.5598 110.478 80.7506 c +110.471 80.7654 110.467 80.7818 110.467 80.7999 c +110.467 80.8184 110.467 80.8385 110.467 80.8606 c +110.467 80.8753 110.467 80.8918 110.467 80.9099 c +110.467 80.9283 110.467 80.9485 110.467 80.9706 c +110.467 80.9927 l +110.467 85.8436 l +closepath +114.449 84.5456 m +115.406 84.5456 l +115.406 79.2655 l +114.449 79.2655 l +114.449 84.5456 l +closepath +114.372 85.7665 m +114.372 85.8473 114.387 85.9224 114.416 85.9922 c +114.446 86.0619 114.493 86.1223 114.559 86.1736 c +114.618 86.2175 114.682 86.2524 114.752 86.2782 c +114.821 86.3037 114.893 86.3167 114.966 86.3167 c +115.047 86.3167 115.12 86.3057 115.186 86.2836 c +115.252 86.2617 115.318 86.2249 115.384 86.1736 c +115.45 86.1223 115.5 86.0619 115.533 85.9922 c +115.566 85.9224 115.582 85.8399 115.582 85.7447 c +115.582 85.6492 115.566 85.565 115.533 85.4916 c +115.5 85.4181 115.454 85.3561 115.395 85.3045 c +115.329 85.2532 115.263 85.2166 115.197 85.1945 c +115.131 85.1727 115.062 85.1616 114.988 85.1616 c +114.915 85.1542 114.842 85.1616 114.768 85.1837 c +114.695 85.2055 114.625 85.2424 114.559 85.2937 c +114.493 85.345 114.446 85.4091 114.416 85.4862 c +114.387 85.563 114.372 85.6492 114.372 85.7447 c +114.372 85.7665 l +closepath +116.792 82.0375 m +116.792 82.4409 116.862 82.804 117.001 83.1266 c +117.14 83.4492 117.346 83.7315 117.617 83.9736 c +117.896 84.2157 118.191 84.3971 118.503 84.5181 c +118.814 84.6392 119.143 84.6996 119.487 84.6996 c +119.502 84.6996 119.518 84.6996 119.537 84.6996 c +119.555 84.6996 119.571 84.6996 119.586 84.6996 c +119.601 84.6922 119.617 84.6885 119.636 84.6885 c +119.654 84.6885 119.674 84.6885 119.696 84.6885 c +119.711 84.6885 119.727 84.6885 119.746 84.6885 c +119.764 84.6885 119.784 84.6885 119.806 84.6885 c +119.821 84.6811 119.837 84.6777 119.856 84.6777 c +119.874 84.6777 119.89 84.6777 119.905 84.6777 c +120.199 84.6335 120.479 84.5473 120.747 84.4192 c +121.014 84.2908 121.273 84.1202 121.522 83.9076 c +121.764 83.6876 121.947 83.4126 122.072 83.0827 c +122.197 82.7527 122.259 82.3675 122.259 81.9276 c +122.259 81.8984 122.259 81.8689 122.259 81.8397 c +122.259 81.8102 122.256 81.7847 122.248 81.7626 c +122.248 81.7331 122.246 81.7039 122.243 81.6747 c +122.239 81.6452 122.237 81.616 122.237 81.5865 c +122.23 81.5279 122.221 81.4692 122.21 81.4105 c +122.199 81.3518 122.186 81.2932 122.171 81.2345 c +122.105 80.9706 122.004 80.7194 121.869 80.481 c +121.733 80.2426 121.559 80.0173 121.346 79.8044 c +121.141 79.5918 120.895 79.4342 120.609 79.3316 c +120.323 79.229 120.004 79.1777 119.652 79.1777 c +119.153 79.1777 118.723 79.2454 118.36 79.3809 c +117.997 79.5167 117.701 79.7239 117.474 80.0025 c +117.247 80.2812 117.076 80.5893 116.962 80.9266 c +116.849 81.264 116.792 81.6268 116.792 82.0154 c +116.792 82.0375 l +closepath +117.837 82.0375 m +117.837 81.9789 117.837 81.9259 117.837 81.878 c +117.837 81.8303 117.841 81.781 117.848 81.7297 c +117.855 81.6781 117.865 81.6288 117.876 81.5812 c +117.887 81.5335 117.896 81.4839 117.903 81.4326 c +117.94 81.2713 117.999 81.1134 118.079 80.9595 c +118.16 80.8056 118.259 80.6588 118.376 80.5196 c +118.501 80.3801 118.655 80.2775 118.838 80.2115 c +119.022 80.1454 119.238 80.1125 119.487 80.1125 c +119.722 80.1125 119.942 80.1454 120.147 80.2115 c +120.352 80.2775 120.54 80.3764 120.708 80.5085 c +120.877 80.6406 121.003 80.8331 121.088 81.086 c +121.172 81.3391 121.214 81.6489 121.214 82.0154 c +121.214 82.2722 121.178 82.505 121.104 82.7142 c +121.031 82.9231 120.921 83.1082 120.774 83.2695 c +120.627 83.4237 120.446 83.541 120.23 83.6215 c +120.013 83.7023 119.766 83.7426 119.487 83.7426 c +119.223 83.7426 118.996 83.7077 118.805 83.638 c +118.615 83.5685 118.457 83.4603 118.332 83.3137 c +118.207 83.1742 118.107 83.024 118.03 82.8627 c +117.953 82.7011 117.899 82.5362 117.87 82.3675 c +117.863 82.3383 117.855 82.3088 117.848 82.2796 c +117.841 82.2501 117.837 82.2209 117.837 82.1915 c +117.837 82.1623 117.837 82.1328 117.837 82.1036 c +117.837 82.0741 117.837 82.0449 117.837 82.0154 c +117.837 82.0375 l +closepath +123.205 82.4667 m +123.205 82.7598 123.257 83.0368 123.359 83.297 c +123.462 83.5575 123.616 83.8013 123.821 84.0286 c +124.034 84.2486 124.283 84.4155 124.569 84.5292 c +124.855 84.6429 125.182 84.6996 125.548 84.6996 c +125.607 84.6996 125.671 84.6959 125.741 84.6885 c +125.811 84.6811 125.886 84.6704 125.966 84.6556 c +126.047 84.6409 126.129 84.6227 126.214 84.6006 c +126.298 84.5785 126.384 84.5493 126.472 84.5125 c +126.626 84.4467 126.773 84.3622 126.912 84.2596 c +127.052 84.157 127.187 84.0323 127.319 83.8857 c +127.451 83.7463 127.55 83.5739 127.616 83.3687 c +127.682 83.1632 127.715 82.9285 127.715 82.6646 c +127.715 82.6572 127.715 82.6481 127.715 82.6371 c +127.715 82.626 127.715 82.6133 127.715 82.5985 c +127.715 82.5911 127.715 82.5821 127.715 82.571 c +127.715 82.56 127.715 82.5472 127.715 82.5325 c +127.715 79.2655 l +126.67 79.2655 l +126.67 82.3786 l +126.67 82.5398 126.646 82.6994 126.599 82.857 c +126.551 83.0146 126.48 83.1632 126.384 83.3026 c +126.289 83.4492 126.164 83.5592 126.01 83.6326 c +125.856 83.706 125.673 83.7426 125.46 83.7426 c +125.262 83.7426 125.088 83.7097 124.938 83.6437 c +124.788 83.5776 124.657 83.4787 124.547 83.3466 c +124.437 83.2145 124.351 83.0733 124.289 82.9231 c +124.227 82.7729 124.184 82.6133 124.162 82.4446 c +124.162 79.2655 l +123.205 79.2655 l +123.205 82.4667 l +closepath +0 0 0 rgb +F +newpath +113.172 76.343 m +113.172 76.6049 113.208 76.8397 113.279 77.0474 c +113.35 77.2549 113.455 77.4355 113.593 77.5889 c +113.736 77.7422 113.883 77.8732 114.037 77.9817 c +114.19 78.0903 114.351 78.1745 114.519 78.2343 c +114.549 78.2456 114.58 78.2558 114.612 78.2652 c +114.644 78.2746 114.676 78.2848 114.71 78.2961 c +114.74 78.3035 114.771 78.3111 114.803 78.3185 c +114.835 78.3259 114.865 78.3315 114.895 78.3352 c +114.959 78.3465 115.02 78.3551 115.078 78.3607 c +115.136 78.3661 115.193 78.3689 115.249 78.3689 c +115.402 78.3689 115.55 78.3539 115.692 78.3242 c +115.835 78.2941 115.969 78.2513 116.096 78.1952 c +116.223 78.1391 116.349 78.0659 116.472 77.9761 c +116.596 77.8865 116.718 77.7816 116.837 77.662 c +116.484 77.2745 l +116.469 77.2821 116.454 77.2915 116.441 77.3026 c +116.428 77.3139 116.414 77.3269 116.4 77.3419 c +116.392 77.3493 116.384 77.357 116.377 77.3643 c +116.369 77.372 116.362 77.3794 116.354 77.3867 c +116.343 77.3944 116.334 77.4018 116.326 77.4094 c +116.319 77.4168 116.311 77.4242 116.304 77.4318 c +116.237 77.4879 116.164 77.5412 116.085 77.5917 c +116.007 77.6421 115.922 77.6917 115.833 77.7405 c +115.743 77.7853 115.649 77.8199 115.552 77.8443 c +115.455 77.8686 115.354 77.8808 115.249 77.8808 c +115.021 77.8808 114.819 77.8479 114.645 77.7825 c +114.472 77.717 114.325 77.6189 114.205 77.4879 c +114.089 77.3607 113.995 77.2252 113.921 77.0809 c +113.849 76.9369 113.799 76.7864 113.773 76.6293 c +113.769 76.603 113.764 76.5777 113.759 76.5534 c +113.753 76.5293 113.75 76.5037 113.75 76.4777 c +113.747 76.4516 113.745 76.4264 113.745 76.402 c +113.745 76.3776 113.745 76.3541 113.745 76.3317 c +113.745 76.1446 113.776 75.964 113.837 75.7903 c +113.899 75.6162 113.992 75.4507 114.115 75.2934 c +114.239 75.1363 114.395 75.0156 114.584 74.9314 c +114.773 74.8472 114.994 74.7996 115.249 74.7885 c +115.253 74.7885 115.255 74.7885 115.257 74.7885 c +115.259 74.7885 115.262 74.7885 115.266 74.7885 c +115.269 74.7885 115.273 74.7885 115.277 74.7885 c +115.281 74.7885 115.284 74.7885 115.288 74.7885 c +115.296 74.7885 115.301 74.7885 115.305 74.7885 c +115.309 74.7885 115.312 74.7885 115.313 74.7885 c +115.315 74.7885 115.318 74.7885 115.322 74.7885 c +115.49 74.7845 115.644 74.8072 115.782 74.8557 c +115.92 74.9044 116.042 74.9793 116.147 75.0802 c +116.255 75.1774 116.346 75.2814 116.419 75.3917 c +116.492 75.502 116.549 75.6171 116.59 75.737 c +116.601 75.7667 116.612 75.7957 116.621 75.8237 c +116.631 75.8518 116.637 75.879 116.641 75.9054 c +116.644 75.9201 116.647 75.9343 116.649 75.9473 c +116.651 75.9603 116.652 75.9745 116.652 75.9895 c +116.656 76.0006 116.659 76.0128 116.66 76.0258 c +116.662 76.0389 116.663 76.053 116.663 76.0681 c +115.294 76.0791 l +115.294 76.6123 l +117.236 76.6123 l +117.236 76.1242 l +117.213 75.8285 117.148 75.5695 117.039 75.3469 c +116.931 75.1241 116.781 74.9342 116.59 74.7772 c +116.396 74.6201 116.187 74.5031 115.964 74.4262 c +115.742 74.3497 115.503 74.3114 115.249 74.3114 c +114.95 74.3114 114.676 74.3571 114.429 74.4489 c +114.183 74.5405 113.964 74.6816 113.773 74.8727 c +113.582 75.0595 113.436 75.2758 113.335 75.5207 c +113.234 75.7659 113.18 76.0363 113.172 76.3317 c +113.172 76.343 l +closepath +117.724 76.2138 m +117.724 76.33 117.746 76.4394 117.791 76.5423 c +117.836 76.6452 117.905 76.7396 117.999 76.8258 c +118.092 76.9117 118.201 76.9763 118.324 77.0194 c +118.448 77.0622 118.586 77.0837 118.74 77.0837 c +118.848 77.0837 118.944 77.0755 119.026 77.0585 c +119.108 77.0418 119.175 77.0182 119.228 76.9885 c +119.28 76.9584 119.329 76.9219 119.374 76.8791 c +119.419 76.836 119.458 76.7864 119.492 76.7302 c +119.525 76.775 119.567 76.8173 119.615 76.8564 c +119.664 76.8958 119.722 76.9341 119.789 76.9715 c +119.857 77.0089 119.931 77.0369 120.014 77.0557 c +120.096 77.0744 120.188 77.0837 120.289 77.0837 c +120.416 77.0837 120.536 77.0661 120.648 77.0304 c +120.76 76.995 120.865 76.9397 120.962 76.8649 c +121.059 76.7937 121.133 76.7124 121.184 76.6208 c +121.234 76.5293 121.261 76.4272 121.265 76.315 c +121.265 76.3113 121.265 76.3084 121.265 76.3065 c +121.265 76.3048 121.265 76.3019 121.265 76.298 c +121.265 76.2943 121.265 76.2914 121.265 76.2897 c +121.265 76.2878 121.265 76.2849 121.265 76.2812 c +121.261 76.2775 121.26 76.2747 121.26 76.2727 c +121.26 76.271 121.26 76.2682 121.26 76.2645 c +121.26 76.2605 121.26 76.258 121.26 76.256 c +121.26 76.254 121.26 76.2512 121.26 76.2475 c +121.26 74.3562 l +120.771 74.3562 l +120.771 76.0791 l +120.771 76.0754 120.771 76.0746 120.771 76.0763 c +120.771 76.0783 120.773 76.0791 120.777 76.0791 c +120.777 76.0828 120.777 76.0856 120.777 76.0876 c +120.777 76.0896 120.777 76.0922 120.777 76.0961 c +120.777 76.1035 120.777 76.11 120.777 76.1157 c +120.777 76.1214 120.777 76.1259 120.777 76.1296 c +120.777 76.1409 120.776 76.1523 120.774 76.1633 c +120.772 76.1746 120.769 76.1877 120.766 76.2027 c +120.762 76.2138 120.759 76.226 120.757 76.2393 c +120.756 76.2523 120.753 76.2662 120.749 76.2812 c +120.734 76.326 120.712 76.3691 120.682 76.4102 c +120.651 76.4516 120.616 76.4907 120.575 76.5281 c +120.534 76.5655 120.489 76.5936 120.44 76.6123 c +120.392 76.631 120.341 76.6404 120.289 76.6404 c +120.221 76.6404 120.159 76.6282 120.101 76.6038 c +120.043 76.5797 119.989 76.5432 119.941 76.4944 c +119.892 76.4459 119.854 76.3943 119.826 76.3402 c +119.798 76.286 119.778 76.2288 119.767 76.169 c +119.763 76.1616 119.76 76.1531 119.758 76.1437 c +119.756 76.1344 119.755 76.1259 119.755 76.1185 c +119.755 76.1072 119.755 76.0978 119.755 76.0905 c +119.755 76.0828 119.755 76.0754 119.755 76.0681 c +119.755 74.3562 l +119.273 74.3562 l +119.273 76.0343 l +119.273 76.1165 119.262 76.1934 119.239 76.2645 c +119.217 76.3354 119.183 76.4008 119.138 76.4609 c +119.093 76.5208 119.037 76.5655 118.97 76.5956 c +118.903 76.6254 118.826 76.6404 118.74 76.6404 c +118.631 76.6293 118.541 76.6049 118.47 76.5675 c +118.399 76.5301 118.347 76.4797 118.313 76.4159 c +118.279 76.3524 118.254 76.2849 118.237 76.2138 c +118.22 76.1429 118.212 76.0698 118.212 75.9949 c +118.212 75.9912 118.212 75.9876 118.212 75.9839 c +118.212 75.9782 l +118.212 74.3562 l +117.724 74.3562 l +117.724 76.2138 l +closepath +122.23 78.2456 m +122.23 75.7256 l +122.23 75.576 122.249 75.4422 122.286 75.3242 c +122.324 75.2066 122.378 75.1026 122.449 75.0127 c +122.524 74.9231 122.613 74.8557 122.716 74.8109 c +122.819 74.7658 122.936 74.7434 123.067 74.7434 c +123.19 74.7434 123.3 74.7613 123.398 74.7967 c +123.495 74.8324 123.579 74.8857 123.65 74.9566 c +123.718 75.0277 123.774 75.1026 123.819 75.1811 c +123.864 75.2599 123.897 75.3401 123.92 75.4226 c +123.927 75.4413 123.932 75.4609 123.934 75.4816 c +123.936 75.502 123.939 75.5235 123.942 75.5459 c +123.946 75.5686 123.949 75.5899 123.95 75.6105 c +123.952 75.6312 123.953 75.6508 123.953 75.6695 c +123.953 75.8192 123.934 75.9501 123.894 76.0624 c +123.855 76.1746 123.798 76.2662 123.723 76.3374 c +123.649 76.4122 123.569 76.4711 123.485 76.5142 c +123.401 76.5573 123.313 76.5843 123.224 76.5956 c +123.213 76.5956 123.202 76.5956 123.193 76.5956 c +123.184 76.5956 123.175 76.5956 123.168 76.5956 c +123.164 76.5956 123.159 76.5956 123.154 76.5956 c +123.148 76.5956 123.143 76.5973 123.14 76.6013 c +123.132 76.6013 123.126 76.6013 123.123 76.6013 c +123.119 76.6013 123.115 76.6013 123.112 76.6013 c +123.056 76.6013 123.003 76.5973 122.954 76.5899 c +122.906 76.5826 122.861 76.5712 122.82 76.5562 c +122.779 76.5412 122.738 76.5253 122.699 76.5086 c +122.66 76.4918 122.62 76.474 122.578 76.4553 c +122.573 76.4496 l +122.567 76.4496 l +122.56 76.4459 122.552 76.4422 122.545 76.4383 c +122.537 76.4346 122.532 76.4329 122.528 76.4329 c +122.52 76.4289 122.514 76.4252 122.508 76.4215 c +122.503 76.4179 122.496 76.4142 122.489 76.4102 c +122.474 76.4065 122.46 76.402 122.446 76.3963 c +122.433 76.3906 122.419 76.3841 122.404 76.3768 c +122.404 76.8762 l +122.446 76.8949 122.486 76.9136 122.525 76.9323 c +122.564 76.9511 122.605 76.9678 122.646 76.9828 c +122.687 76.9978 122.728 77.0109 122.769 77.0222 c +122.81 77.0333 122.853 77.0426 122.898 77.0503 c +122.917 77.054 122.936 77.0568 122.957 77.0585 c +122.978 77.0605 122.999 77.0633 123.022 77.067 c +123.033 77.067 123.043 77.067 123.053 77.067 c +123.062 77.067 123.072 77.069 123.084 77.0727 c +123.091 77.0727 123.1 77.0727 123.112 77.0727 c +123.123 77.0727 123.134 77.0727 123.145 77.0727 c +123.321 77.0727 123.486 77.0435 123.639 76.9856 c +123.793 76.9275 123.937 76.8388 124.071 76.7189 c +124.206 76.603 124.308 76.4646 124.377 76.3036 c +124.446 76.1429 124.481 75.9615 124.481 75.7594 c +124.481 75.5723 124.451 75.3926 124.391 75.2205 c +124.331 75.0484 124.242 74.8838 124.122 74.7267 c +124.006 74.5694 123.859 74.4534 123.681 74.3786 c +123.503 74.3038 123.298 74.2664 123.067 74.2664 c +122.835 74.2664 122.633 74.3029 122.461 74.3758 c +122.288 74.4489 122.146 74.56 122.034 74.7097 c +121.922 74.8633 121.837 75.0269 121.781 75.2009 c +121.725 75.375 121.697 75.5609 121.697 75.7594 c +121.697 78.2456 l +122.23 78.2456 l +closepath +124.969 78.2904 m +125.497 78.2904 l +125.497 76.6965 l +127.181 76.6965 l +127.181 78.2904 l +127.708 78.2904 l +127.708 74.3562 l +127.181 74.3562 l +127.181 76.169 l +125.497 76.169 l +125.497 74.3562 l +124.969 74.3562 l +124.969 78.2904 l +closepath +F +%%PageTrailer +showpage +%%Trailer +end +%%DocumentSuppliedResources: procset Linux-Sketch-Procset 1.0 2 +%%EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/installation-admin-manual.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,204 @@ +\documentclass[12pt]{scrartcl} + +%---------------------------------------------- +% Load packages + +\usepackage{a4} +\usepackage{times} +\usepackage[latin1]{inputenc} +\usepackage{fancyhdr} +%\usepackage{german} +%\usepackage[marvosym]{eurofont} +%\usepackage[all, light]{draftcopy} +%\usepackage{supertabular} +%\usepackage{colortbl} +%\usepackage{epsf} +\usepackage{graphicx} +\usepackage{lastpage} +%\usepackage{proposal} +\usepackage{listings} +\usepackage[hyperindex=true, bookmarks=true, breaklinks=true, +colorlinks=true, linkcolor=red,bookmarksopen]{hyperref} + +%---------------------------------------------- +% Document DATE and VERSION +% set these values when releasing a new version + +\newcommand{\documentdate}{April 27th, 2010} +\newcommand{\documentversion}{1.0} +\newcommand{\documentrevision}{FIXME SVN REV} +\newcommand{\documentID}{installation-admin-manual.tex} +%---------------------------------------------- + +%---------------------------------------------- +% Document TITLE +\newcommand{\documenttitle}{Generic Viewer -- Installation and Operations} + + +%---------------------------------------------- +% Some parameters for layouting + +\paperwidth=21cm +\hoffset=-0.54cm +\textwidth=17cm + +\paperheight=29.7cm +\voffset=-1.5cm +\topmargin=0cm +\headheight=1cm +\textheight=24cm + +\setcounter{secnumdepth}{4} +\setcounter{tocdepth}{4} + +%---------------------------------------------- + +\begin{document} + +\lstset{ % +language=sh, +basicstyle=\ttfamily, % the size of the fonts that are used for the code +numbers=left, % where to put the line-numbers +numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers +numbersep=5pt, % how far the line-numbers are from the code +% backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color} +showspaces=false, % show spaces adding particular underscores +showstringspaces=false, % underline spaces within strings +showtabs=false, % show tabs within strings adding particular underscores +frame=single, % adds a frame around the code +tabsize=2, % sets default tabsize to 2 spaces +captionpos=b, % sets the caption-position to bottom +breaklines=true, % sets automatic line breaking +breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace +title=\lstname, % show the filename of files included with \lstinputlisting; also try caption instead of title +escapeinside={\%*}{*)} % if you want to add a comment within your code +% morekeywords={*,...} % if you want to add more keywords to the set +} + +%----------------------------------- +% HEADER/FOOTER DEFINITION + +% for some pages latex switches back to pagestyle plain :-( +\fancypagestyle{plain}{% + \fancyhf{} % clear all header and footer fields + \fancyhead[LO,RE]{\footnotesize \documenttitle\\ \leftmark} + \fancyfoot[RO,LE]{\footnotesize Intevation GmbH} % Author + \fancyfoot[CO,CE]{\footnotesize \thepage/\pageref{LastPage}} + \fancyfoot[LO,RE]{\footnotesize \documentdate + \\\documentID} + \renewcommand{\footrulewidth}{0.4pt} +} + +% and now define pagestyle fancy +\fancyhead{} % clear all fields +\fancyhead[LO]{\footnotesize \documenttitle\\ \leftmark} + +\fancyfoot{}% clear all fields +\fancyfoot[RO]{\footnotesize Intevation GmbH} % Author +\fancyfoot[CO]{\footnotesize \thepage/\pageref{LastPage}} +\fancyfoot[LO]{\footnotesize \documentdate +\\\documentID} + +\renewcommand{\footrulewidth}{0.4pt} + +% +% END Header/Footer Definition +%----------------------------------- + +%---------------------------------------------- +% MACRO DEFINITION +% +% \Fig{figure}{lof text}{caption} : +% places 'figure' and +% writes 'caption' at the bottom with leading +% 'Abbildung figno:'. 'lof text' is added to the list of +% figures. +% Example: +% \Fig{\epsfxsize30mm \epsffile{x.eps}}{the x}{the x} +% +% \FigNoEntry{}{} : +% same as above, no entry in figures list +% +% \FigCaption{} : +% line with figure caption, setting figure +% counter and figures list +% +% \Tab{table}{lot text}{caption} : +% places 'table' and writes caption on top of the table +% with leading 'Tabelle tabno:'. 'lot text' is added to +% the list of tables. +%**************************************************************************** +% Figure makro for graphics continously enumerated. +% + +\newcounter{FigCnt} +\newcounter{TabCnt} + +\newcommand{\Fig}[3]% +{ + \refstepcounter{FigCnt} + \addcontentsline{lof}{figure}% + {\protect\numberline{\arabic{FigCnt}}{#2}} + \mbox{#1} + +\nopagebreak + {Abbildung \arabic{FigCnt}: #3} + +} + +\newcommand{\FigNoEntry}[2]% +{ + \refstepcounter{FigCnt} + \mbox{#1} + +\nopagebreak + {Abbildung \arabic{FigCnt}: #2} + +} + +\newcommand{\FigCaption}[1]% +{ + \refstepcounter{FigCnt} + \addcontentsline{lof}{figure}% + {\protect\numberline{\arabic{FigCnt}}{#1}} + + %{Figure \thesection.\arabic{FigCnt}: #1} +} + +\newcommand{\Tab}[3]% +{ + \refstepcounter{TabCnt} + \addcontentsline{lot}{figure}% + {\protect\numberline{\arabic{TabCnt}}{#2}} + {Tabelle \arabic{TabCnt}: #3} +\nopagebreak + #1 + +} + +\hyphenation{Intevation} +% end macro definition + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcounter{schritt} +\renewcommand{\theschritt}{\Roman{schritt}} +%\makeatletter\renewcommand{\p@schritt}{Abschnitt~\thesubsubsection~}\makeatother + +%----------------------------------- +% DOCUMENT SETTINGS +\pagestyle{fancy} +\setlength{\parindent}{0cm} +\setlength{\parskip}{5pt plus 2pt minus 1pt} + +% Start actual content here +\include{title} +\newpage +\tableofcontents +\include{overview} +\include{installation-base} +\include{installation-artifact-server} +\include{installation-webclient} +\include{operating-the-system} + +\end{document}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/installation-artifact-server.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,139 @@ +\subsection{Artifact-Server} +The Artifact-Server contains the entire business logic of the system. +The server provides a RESTful interface with a XML-based protocol to the +webclient. Technically the server is a standalone java process serving the +REST interface. + +\subsubsection*{Installation} +\label{ref:artifact-server-install} + +Running the server with its own user\footnote{Remark: A group with the +same name is created automatically.}: +\begin{lstlisting} + adduser artifacts +\end{lstlisting} + +Setup and configuring logging: +\begin{lstlisting} + cd /var/log + mkdir artifacts + chown -r root:artifacts artifacts + chmod 770 artifacts + chmod g+s artifacts +\end{lstlisting} + +The log level can be adjusted in the file \verb+ conf/log4j.properties+. +Further information can be found there. + +Integrate software of artifact-server into filesystem: +\begin{lstlisting} + cd /opt + tar xfvj /root/artifact-server-$VERSION.tar.bz2 + ln -s artifact-server-$VERSION artifact-server + cd artifact-server +\end{lstlisting} + +Setting the access rights: +\begin{lstlisting} + bin/setup.sh +\end{lstlisting} + +Configure connection to database: +\begin{lstlisting} + cd /opt/artifact-server + vim conf/arcsdeconnectionpool.properties + + # in conf/arcsdeconnectionpool.properties do: + server=xyz.server.com + username=guest + credentials=XYZ + port=5151 + database=esri_sde +\end{lstlisting} + +Configure address for finding the WMS-Server: +\begin{lstlisting} + cd /opt/artifact-server/ + vim conf/conf.xml + # adapt the address in the element + # artifact-database/gnv/mapserver/server. This is + # the string the server uses to provide an address of the mapserver to enduser. + e.g. http://SERVER/cgi-bin/gnv-wms +\end{lstlisting} + +The artifact server can export and import projects of the user's +parameterizations. In order to protect the server against invalid files, +configure a secret for signing artifacts. + +{\em Hint: If the secret is changed, all files that were created before +are not valid anymore.} + +\begin{lstlisting} + # generate a randomized string, e.g. + cd /opt/artifact-server/ + pwgen -s 30 + # populate the tag artifact-database/export-secret +\end{lstlisting} + +Adapt TCP-port of artifact-server, if the default has to be changed +(default:8181): +\begin{lstlisting} + cd /opt/artifact-server + vim conf/conf.xml + + # in conf/conf.xml edit the element artifact-database/rest-server/port +\end{lstlisting} + +Integrate artifact-server in startup-process of operating system: +\begin{lstlisting} + cp -i /opt/artifact-server/install/debian/artifact-server/artifact-server-init-scipt + /etc/init.d/artifact-server + chmod +x /etc/init.d/artifact-server + update-rc.d artifact-server defaults +\end{lstlisting} + +The server can be started and stopped via +\begin{lstlisting} + /etc/init.d/artifact-server {start | stop} +\end{lstlisting} + +The installation of the artifact-server is finished. It can be tested +now. + +\subsubsection*{Test of the Installation} +\label{ref:artifact-server-testing} + Start the server: + \begin{lstlisting} + /etc/init.d/artifact-server start + \end{lstlisting} + + 1. Operating System: Check if the process of the server called "App" + is running: + \begin{lstlisting} + jps + + # Example with list of java processes: + 19252 + 19509 Jps + 19441 App + + cat /var/run/artifact-server.pid + \end{lstlisting} + + Task: Compare the running process numbers. + + 2. Network: Check if the artifact-server opens a TCP-port (default: 8181) + \begin{lstlisting} + netstat -nltp | grep 8181 + + # Check for an entry like: + tcp 0 0 127.0.0.1:8181 0.0.0.0:* LISTEN 18648/java + \end{lstlisting} + + 3. Artifact-Server ready for communication with client? + \begin{lstlisting} + curl "http://localhost:8181/factories" | xmllint --format - + \end{lstlisting} + + Task: Check for a XML-document describing possible expert information + systems (FIS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/installation-base.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,414 @@ +\section{Installation and Configuration} + +This section describes preconditions for the entire system and an installation +on a Debian 5.0.x (Lenny) for the GNV-System without an running X-Environment. +Mostly, the debian package management\footnote{Further information at +\url{http://www.debian.org/doc/manuals/debian-reference/ch02.en.html}} +using \verb+ aptitude+ is used in this manual. + +If existing configurations have to be changed, the following notation will be +used: \verb|+| for adding a line replacing the marked by \verb|-|. + +\subsection{Preconditions} + +\subsubsection*{System} + +\begin{itemize} + \item Storage for the delivered software: 100 MB + \item Current processor on a 32-bit Architecture (Beginning + 2010)\footnote{Running on a 64-bit system should work out of the box + and improve scalibility issues (not tested yet).} + \item RAM: 1 GB for production as minimum.\footnote{This value depends + mainly on the amount of connected users.} + \item Network access to Database Backend + \item RW-Access to the filesystem for logging, shapefile-export, + caching +\end{itemize} + +\subsubsection*{Database: Software and Data} + +The software has been developed for the following system: + +\begin{itemize} + \item ESRI ArcSDE 9.3.1 on Oracle 10.2\footnote{The development + started in ESRI ArcSDE 9.2. There are known + problems with this version.} + \item ArcMarineBSH, model package "Time Series and Measurements" + \item ArcMarineBSH, model package " MeshFeature" + \item ArcMarineBSH, model package "Marine Feature" + \item ArcS57 -- International Hydrographic Organization (IHO) S-57 for + ENC Data Model. - ESRI Data Models. http://support.esri.com/datamodels + \item CONTIS -- Federal Maritime and Hydrographic Agency (BSH). Continental + Shelf Information System -- \\ + \url{http://www.bsh.de/en/Marine\_uses/Industry/CONTIS\_maps/index.jsp} + \item GNV specific schema MapViewer interface -- Schema for integrating with MapViewer and + their WMS services + \item GNV specific schema for managing the cache -- The central + dataware house is updated regulary. To keep the cache up-to-date, + needs to cleaned after database updates. +\end{itemize} + + +\subsection{Operating System} + +{\em Hint}: Configuring of partitions, firewalls, etc. for the system is out of +the scope of this documentation. + +\subsection{Preparations} + +In some steps it is required to use templates wich are packed in +\verb+ artifact-server-$VERSION.tar.bz2+ to get access to those files. + +Please extract the tar.bz2 file as explained in +Chapter~\ref{ref:artifact-server-install}, + p.~\pageref{ref:artifact-server-install}. + +The complete document use the system-variable \verb+$ARTIFACT_SERVER_HOME+ +to refer the root-directory of the Artifac-Server. +It might be helpful to export this variable using the following command: + +\verb+ export ARTIFACT_SERVER_HOME=/opt/artifact-server+ + +\subsection{Java Environment} + +\subsubsection*{Installation Sun Java 6} + +This GNV-system is developed for Sun Java 6. + +Add non-free packages of the Debian distribution to the system in +\verb+/etc/apt/sources.list+: + +\begin{lstlisting} + [...] + deb http://ftp.de.debian.org/debian/ lenny main non-free + deb-src http://ftp.de.debian.org/debian/ lenny main + + deb http://security.debian.org/ lenny/updates main + deb-src http://security.debian.org/ lenny/updates main + [...] +\end{lstlisting} + + +Install Sun Java 6 and its dependencies by executing the following: + +\begin{lstlisting} + apt-get update + apt-get install sun-java6-jdk +\end{lstlisting} + +\subsubsection*{Install Native Components for Java6 (optional)} + +This step is optional but recommended\footnote{For background +information, c.f. \url{http://tomcat.apache.org/tomcat-5.5-doc/apr.html}}. + +For a better support of the native server technologies, the package +\verb+libtcnative+ can be installed. + +\begin{lstlisting} + apt-get install libtcnative-1 + cd /usr/lib/jvm/java-6-sun/jre/lib/i386/client + ln -s /usr/lib/libtcnative-1.so +\end{lstlisting} + +\subsubsection*{Configuration} + +To ensure that the Apache Tomcat and the GNV Artifact-Server will use +Sun Java 6 exclusively, switch to the default Java version +globally\footnote{This manual assumes that there are no other packages +depending to another Java version.}. + +Use \verb+update-alternatives+ mechanism of the Debian +system\footnote{Background information: {\tt man update-alternatives}}, execute: + +\verb+ update-alternatives --list java+ + +Lists all installed Java-Environments. E.g.: + +\begin{lstlisting} + Auswahl Alternative + ----------------------------------------------- + 1 /usr/bin/gij-4.3 + + 2 /usr/lib/jvm/java-gcj/jre/bin/java + 3 /usr/lib/jvm/java-1.5.0-sun/jre/bin/java + * 4 /usr/lib/jvm/java-6-sun/jre/bin/java +\end{lstlisting} + + +\verb+update-alternatives --config java+ + +Opens a dialog to reconfigure the java version which should be used as default. +Type the Number of the the java which should be used. +For the example above, type "4". + +\subsubsection*{Test of the Installation} + +Execute \verb+ java -version+ + +Check if a version of 1.6.0* has been set. Check: + +\begin{lstlisting} + java version "1.6.0_20-b02" + Java(TM) SE Runtime Environment (build 1.6.0_20-b02) + Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode) +\end{lstlisting} + + +\subsection{Tomcat Application Server} +To run the GNV-System a Apache Tomcat Server Version 5.5 is required. +This section describes the steps for installing and configuring +Apache Tomcat. + +\subsubsection*{Installation} + +To install the Tomcat Application-Server and its dependencies, execute: + +\verb+ apt-get install tomcat5.5+ + +\subsubsection*{Configuration} + +Adapt some run-time specific properties in +\verb+/etc/default/tomcat5.5+: + +\begin{lstlisting} + - #JAVA_HOME="/usr/lib/jvm/java-6-sun/" + + JAVA_HOME="/usr/lib/jvm/java-6-sun/" + + - #JAVA_OPTS="-Djava.awt.headless=true -Xmx128M" + + JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -server" + + - #TOMCAT5_SECURITY=yes + + TOMCAT5_SECURITY=no +\end{lstlisting} + +{\bf Hint: As there is no Java security policy for the GNV WebClient, +Java Security Management is switched off.} + +The Apache Tomcat is integrate with Apache WebServer just via the Apache +JServ Protocoll (AJP). To secure the connection, just local connections +are allowed for AJP on Tomcat\footnote{For background information, c.f. +\url{http://tomcat.apache.org/tomcat-5.5-doc/connectors.html}}. + +Modify the \verb+ /etc/tomcat5.5/server.xml+: +\begin{lstlisting} + + # Deactivate Standard HTTP Connector: + + +<!-- + <Connector port="8180" maxHttpHeaderSize="8192" address="127.0.0.1" + maxThreads="150" minSpareThreads="25" maxSpareThreads="75" + enableLookups="false" redirectPort="8443" acceptCount="100" + connectionTimeout="20000" disableUploadTimeout="true" /> + +--> + + - <Connector port="8009" + - enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> + + + <Connector port="8009" + + enableLookups="false" redirectPort="8443" protocol="AJP/1.3" address="127.0.0.1"/> +\end{lstlisting} + +To activate these changes, restart Apache Tomcat: + +\verb+ /etc/init.d/tomcat5.5 restart+ + + \subsubsection*{Test of the Installation} + +Check if the port 8009 is opened via: +\verb+ netstat -nltp | grep 8009+ + +A possible listing looks like this: +\begin{lstlisting} + tcp 0 0 127.0.0.1:8009 0.0.0.0:* LISTEN 19252/jsvc +\end{lstlisting} + +So fare, there is no commandline client for AJP to test the connection. +If there are problems, setup \verb+ mod_jk+ module in Apache WebServer +and check its according log files. + +\subsection{Apache Webserver} +This section describes the required steps for the installation and configuration +of the Apache Webserver Version 2.2. Apache WebServer controls all +HTTP-Connections to the outside of the system. Apache Tomcat is +integrated via mod\_jk. + +\subsubsection*{Installation} + +To install the Apache Webserver you have to execute the following command: + +\verb+ apt-get install apache2+ + +To establish the connection between the Tomcat application server and +Apache Webserver an additional Module "mod\_jk" has to be installed. + +\verb+ apt-get install libapache2-mod-jk+ + +\subsubsection*{Configuring mod\_jk} + +Edit the settings for mod\_jk in +file \verb+ /etc/libapache2-mod-jk/workers.properties+. For further +information, there are comments in the configuration file\footnote{Background +information can be found at \\ +\url{http://tomcat.apache.org/connectors-doc/generic\_howto/workers.html}}. + + +\begin{lstlisting} + - workers.java_home= /usr/lib/jvm/java-gcj/ + + workers.java_home=/usr/lib/jvm/java-6-sun +\end{lstlisting} + +In file \verb+ /etc/apache2/httpd.conf+: + +\begin{lstlisting} + + JkWorkersFile "/etc/libapache2-mod-jk/workers.properties" + + JkLogFile "/var/log/mod_jk.log" +\end{lstlisting} + +After finishing the configuration, enable the module in Apache +WebServer: \verb+ a2enmod jk+ and restart the server +\verb+ /etc/init.d/apache2 restart+. + + +\subsubsection*{Publish the site in Apache WebServer} + +Depending of the existing configuration of Apache WebServer, the +following steps can differ. In this case, a vanilla configuration is +assumed\footnote{Background information about Apache WebServer can +be found at \url{http://httpd.apache.org/docs/2.2/}}. + +Disable default configuration +\verb+ a2dissite default+ + +Adapt eMail-address for configuration in +\verb+ $ARTIFACT_SERVER_HOME/install/debian/apache2/gnv+. + +Enable the specific site (VirtualHost) in Apache WebServer: +\begin{lstlisting} + cp -i $ARTIFACT_SERVER_HOME/install/debian/apache2/gnv to /etc/apache2/sites-available + # Activate site for GNV + a2ensite gnv + /etc/init.d/apache reload +\end{lstlisting} + + +\subsubsection*{Test of the Installation} + +You can test the installation by executing the following url: + +\verb+ curl "http://localhost/gnv/" -o test+ + +After a successful installation, the file {test} will contain HTML describing +the startpage of the GNV WebClient. + + +\subsection{UMN MapServer: Installation and configuration} +The UMN MapServer is part of the artifact server. It is responsible for +rendering shapefiles produced by the artifact-server and publish them as +OGC Web Map Service. + +\subsubsection*{Installation} +It is recommended to use a more recent version than the one in Debian +Lenny. In the installation package, there is a debian package of +MapServer that should be installed. + +In order to verify the integrity of the installation package, it is necessary to import +a GPG-Key which was used to sign the packages: + +\begin{lstlisting} +gpg --keyserver hkp://keys.gnupg.net --recv-keys EC70B1B8 +gpg --export EC70B1B8 | apt-key add - +\end{lstlisting} + +Installing the mapserver-gp and its dependencies, executing the following command: + +\begin{lstlisting} +cd $ARTIFACT_SERVER_HOME/install/debian/umn-mapserver +dpkg -i cgi-mapserver-gp_5.6.3-1~gp+1_i386.deb +\end{lstlisting} + +If there are libraries which are required by the Mapserver but not +installed yet run the following command: +\begin{lstlisting} +apt-get -f install +\end{lstlisting} + + +Provide a possibility to integrate Mapserver properly and transfer +configurations to MapServer during runtime: + +\begin{lstlisting} +cd /usr/lib/cgi-bin +cp -i $ARTIFACT_SERVER_HOME/install/debian/umn-mapserver/gnv-wms . +chmod +x gnv-wms +\end{lstlisting} + +For setting proper contact details in the WMS Capabilities response, +edit the file \verb+ $ARTIFACT_SERVER_HOME/conf/maptemplates/mapfile.vm+ +in the section WEB $\rightarrow$ METADATA. + +The Mapserver will need fonts for rendering lables in the map. +To provide this it is required to install the freefonts. +\begin{lstlisting} +apt-get install ttf-freefont +\end{lstlisting} + + +\subsubsection*{Test of installation} +Check for a sucessful installation via: + +\begin{lstlisting} +cd root +curl \ +"http://localhost/cgi-bin/gnv-wms" \ +-o mapserver +\end{lstlisting} + +For a sucessful configuration, the response document \verb+ mapserver+ +contains a Value which contains the following message of the mapserver. + +TODO: QUERYSTRING WAS EMPTY HINZUFUEGEN + +\subsection{Proxy-Script: Installation and Configuration} +The Proxy-Script is required to allow the Map-Client to request external +services. Security policies forbit and prevent requesting those services - like +a GetFeatureInfo request - directly. + +\subsubsection{Installation} + +First make sure that python is installed on the operating system. +Otherwise install python using the following command: + +\verb+ apt-get install python+ + +Then the script itself must be published on the server by executing the +following steps: + +\begin{lstlisting} +cd /usr/lib/cgi-bin +cp -i $ARTIFACT_SERVER_HOME/install/debian/ol-proxy/proxy.cgi . +\end{lstlisting} + +\subsubsection{Configuration} +The Proxy-Script can only communicate with servers it is allowed to. +To enable the communication to the server where the UMN-Mapserver is hosted +or to other Server it is necessary to edit {\tt allowedHosts} in the +Proxy-Script at line 18. + +There you have to replace the placeholder THISHOSTNAME with the name which +will be used to reach the GNV-Web-Client. + +You can add further servers using the syntax which is given in the script. + +\subsubsection{Test of installation} + +It is possible to test the installation using the following command: + +\begin{lstlisting} +curl http://localhost/cgi-bin/proxy.cgi?url=http%3A%2F%2Flocalhost/cgi-bin/mapserv-gp +\end{lstlisting} + +If localhost is allowed in the proxy-script the result might be this: + +\begin{lstlisting} +TODO: QUERYSTRING WAS EMPTY HINZUFUEGEN +\end{lstlisting} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/installation-webclient.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,52 @@ +\subsection{GNV-WebClient} +The last step of the installationprcess is to install the WebClient called +GNV-Client. The GNV-Client is a web Application ARchive (WAR) which has to be published +via Apache Tomcat. + + +\subsubsection*{Installation} + +Make sure, the Apache Tomcat is stopped. Deploying the +WAR-file\footnote{There are several ways of deployment in Apache Tomcat. +Background information can be found at +\url{http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html}}: +\begin{lstlisting} + cp -i gnv-\$VERSION.war /usr/share/tomcat5.5/webapps/gnv.war + # Start Tomcat: + /etc/init.d/tomcat5.5 start +\end{lstlisting} + + +\subsubsection*{Configuration} +\label{ref:webclient-config} + +As default, the GNV-Client looks for an artifact-server running on +\verb+ http://localhost:8181/+. If this address needs not to be changed, +there is nothing to do to considering the execution environment. + +If the address of the artifact-server has been changed (c.f. +chapter~\ref{ref:artifact-server-install}, +p.\pageref{ref:artifact-server-install}), it can be adapted in the file {\tt +WEB-INF/web.xml} for the parameter name +\verb+de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.url.1+. + +As default log information is written into the file +\verb+/usr/share/tomcat5.5/logs/gnv.log+. The log level can be adjusted +in the file \verb+WEB-INF/classes/log4j.properties+. For further +instructions look into the file. + +{\em Hint: The changes need to be done within the compressed +war-file because of the deployment mechanism of Apache Tomcat in case of +a restart. Keep in mind to repackage the war-file for a solution +surveiving a restart of Tomcat.} + + +\subsubsection*{Test of the Installation} + +Testing the installation via Apache WebServer, mod\_jk and Apache Tomcat: +\begin{lstlisting} + curl "http://localhost/gnv/start.do" -o gnv +\end{lstlisting} + +The file \verb+gnv+ includes HTML describing the startpage of the +GNV-WebClient.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/operating-the-system.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,135 @@ +\section{Management of operational processes} + +For running the entire GNV-system the following components have to be +available in the described sequence: +\begin{enumerate} + \item Database server + \item Artifact-server + \item Apache Tomcat running the WebClient + \item Apache WebServer +\end{enumerate} + +During a server startup the installed components get started +automatically. + +\subsection{Managing the Artifact Server} + +\subsubsection*{Starting and Stopping} + +The artifact-server can be restarted without stopping the WebClient. +During the restart-process client accessing the server get an approriate +message. Their session data will not be lost if the artifact database +will remain untouched. + + Stopping artifact-server: + \begin{lstlisting} + /etc/init.d/artifact-server stop + \end{lstlisting} + + Starting artifact server + \begin{lstlisting} + /etc/init.d/artifact-server start + \end{lstlisting} + + Restarting artifact server + \begin{lstlisting} + /etc/init.d/artifact-server restart + \end{lstlisting} + +\subsubsection*{Troubleshooting} + +\paragraph*{Database problems} +For checking problems with the connection to the database server, check +the logfile of the artifact-server (c.f. +Chapter~\ref{ref:artifact-server-install}, +p.~\pageref{ref:artifact-server-install}). + +In most cases, a restart of the artifact-server will help to solve +problems in the artifact-server. If you still encounter problems, check +for the network connection to the database server and the maturity of +the database server. + +\paragraph*{Caching problems} +Inconsistencies between original data and cached data: +The artifact-server stores result sets of the database in a cache and +provides maps via configuration files for MapServer based on shapefiles. +In case of inconsistencies showing up for longer than twice the +maximum of the update cycle of internal ETL processes, do the following +as user \verb+root+: + +\begin{lstlisting} + cd /opt/artifact-server + /etc/init.d/artifact-server stop + rm -ri cache/* + /etc/init.d/artifact-server start +\end{lstlisting} + +\subsection{Managing the GNV-Client} +\subsubsection*{Start Stop Restart} + +The GNV-WebClient can be managed by controlling Apache Tomcat instance: + + Status GNV-WebClient + \begin{lstlisting} + /etc/init.d/tomcat5.5 status + \end{lstlisting} + + Stopping GNV-WebClient + \begin{lstlisting} + /etc/init.d/tomcat5.5 stop + \end{lstlisting} + + Starting GNV-WebClient + \begin{lstlisting} + /etc/init.d/tomcat5.5 start + \end{lstlisting} + + Restarting GNV-WebClient + \begin{lstlisting} + /etc/init.d/tomcat5.5 restart + \end{lstlisting} + +\subsubsection*{Troubleshooting} + +If the GNV-WebClient can not be accessed through the Apache WebServer, do the +following: +\begin{lstlisting} + 1. /etc/init.d/apache2 restart + 2. Check in your browser at http://$SERVERNAME/gnv +\end{lstlisting} + +If you still encounter problems, follow the next these steps: + +{\bf Caution: The entire application will be down until the WebServer is +back up.} +\begin{lstlisting} + /etc/init.d/apache2 stop + /etc/init.d/tomcat5.5 stop + rm -r /usr/share/tomcat5.5/work/Catalina/localhost/gnv/* + /etc/init.d/tomcat5.5 start # wait until tomcat is up + /etc/init.d/apache2 start +\end{lstlisting} + +For further information, you look into the log information during the use of the +GNV WebClient +\begin{lstlisting} + tail -f -n 50 /usr/share/tomcat5.5/logs/gnv.log +\end{lstlisting} + +To get even more logging, do the following: + +{\bf Caution: The entire application will be down until the Apache Tomcat +has been started properly; the higher log-level can affect the +runtime-behaviour of the client. For further instructions, c.f. +Chapter~\ref{ref:webclient-config}, p.~\pageref{ref:webclient-config}.} + +\begin{lstlisting} + /etc/init.d/tomcat5.5 stop + Set logging to DEBUG + vim /usr/share/tomcat5.5/webapps/gnv/WEB-INF/classes/log4j.properties + /etc/init.d/tomcat5.5 start # wait until tomcat is up + tail -f -n 50 /usr/share/tomcat5.5/logs/gnv.log +\end{lstlisting} + +It is recommended to undo the logging configuration, after the relevant +part has been found.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/overview.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,72 @@ +\section{Overview of the GNV-System} + +The GNV systems consists of the mainly 4 components, serving the +following tasks: + +% TODO: Add architecture of the system in english + +\begin{enumerate} +\item Artifact-Server \\ +The Artifact-Server is a middleware component, managing the core tasks: +\begin{itemize} + \item Access to the database backend + \item Providing a RESTful-Interface with a XML-based protocol to serve + the expert information systems (FIS) with their products + \item (diagrams like timeseries, verticalprofile, map layers) to make + them accessable for the GNV-WebClient + \item Processing of data for interpolation, classification and vectorisation + \item Configuration capabilities for FIS and products + \item Caching database result sets + \item Managing the WMS-Server for creating maps dynamically +\end{itemize} + +\item Database Backend \\ +Database schemata like ESRI ArcMarineBSH, ArcS57 and CONTIS can be +served out of a ESRI ArcSDE 9.3.1 database. + +\item WMS-Server \\ +The WMS-Server provides maps via the standardized interface of the OGC +Web Map Service. The configuration is managed through the +artifact-server depending on the parameterization done be the user in +the GNV-WebClient + +\item GNV-WebClient \\ +The GNV-WebClient is a thin webbased client providing a HTML-based user +interface for the user to parameterize the FIS and products via the +XML-based protocol provided by the artifact-server through its +RESTful-interface. Within the client the user can manage these tasks: +\begin{itemize} + \item Select FIS, producs and their parameterisation + \item Visualize different diagrams like timeseries, vertical- and +horizontalprofiles, vertical and horizontal cross-sections and map +layers + \item Calculate and visualize (histograms) statistics + \item Export diagrams for printing in PNG, SVG, vectorized PDFs + \item Export data as in raw formats like CSV, Ocean Data View (ODV) and +ESRI Shapefiles +\end{itemize} + +The GNV-WebClient can be integrated with different MapViewers. The +GNV-WebClients supports a XML-based interface to the MapViewers +describung geometrical data and information about +used layers in order to adapt the selection of FIS and areas of interest +for the parameterization. +\end{enumerate} + +The systems has been designed as a distributed system. This manual +descibes the installation of a centralized system on one server for the +middleware and an existing database server. + +\section{Deliverables} +\begin{enumerate} + \item \verb+ artifact-server-$VERSION.tar.bz2+ -- Artifact-Server of the + GNV-System as package for installation + \item \verb+ gnv-$VERSION.war+ -- Web Application Archive for + deploying in Apache Tomcat + \item \verb| cgi-mapserver-gp_5.6.3-1~gp+1_i386| -- UMN MapServer + 5.6.3 (in Debian Lenny, UMN MapServer 5.0.3) + \item \verb+ installation-admin-manual.pdf+ -- this document + \item \verb+ configuration-manual.pdf+ -- Explaining the configuration + possibilities for the GNV-System in order to adapt FIS and products + (diagrams and maps) according to the database schema +\end{enumerate}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/admin-manual/title.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,51 @@ +%----------------------------------- +% TITLE PAGE + +\begin{figure}[ht] + \begin{minipage}[b]{0.5\linewidth} + \centering + \includegraphics[scale=0.75]{figures/bsh_logo} \\ + {\tt http://www.bsh.de/en}\\[4.0cm] + \end{minipage} + \begin{minipage}[b]{0.5\linewidth} + \centering + \includegraphics[width=0.75\textwidth]{figures/intevation-logo} + {\tt http://intevation.de/geospatial}\\[2.0cm] + \end{minipage} +\end{figure} + + \vspace{4cm} + + { + \sffamily\large + Documentation Generic Viewer + + \vspace{1cm} + { + \bfseries\huge + Installation and Operations + } + + \vspace{1cm} + Version \documentversion~-~Date: \documentdate + + %% Revision \documentrevision + } + + \vspace{4cm} + + \thispagestyle{empty} + + \vfill + + \begin{flushleft} + {\bf Authors}:\\ + Tim Englich$<$tim.englich@intevation.de$>$\\ + Hans Plum $<$hans.plum@intevation.de$>$\\ + Sascha Teichmann $<$sascha.teichmann@intevation.de$>$\\ + {\bf Intevation GmbH},\\ + Neuer Graben 17, 49074 Osnabrück, Germany\\ + Tel: ++49 541 33 50 83 - 0 \\ + \url{http://www.intevation.net/geospatial} + + \end{flushleft}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/Makefile Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,3492 @@ +# Copyright 2004 Chris Monson (shiblon@gmail.com) +# Latest version available at http://www.bouncingchairs.net/oss +# +# This file is part of ``Chris Monson's Free Software''. +# +# ``Chris Monson's Free Software'' is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, Version 2. +# +# ``Chris Monson's Free Software'' is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with ``Chris Monson's Free Software''; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# It is also available on the web at http://www.gnu.org/copyleft/gpl.html +# +# Note that using this makefile to build your documents does NOT place them +# under the GPL unless you, the author, specifically do so. In other words, +# I, Chris Monson, the copyright holder and author of this makefile, +# consider it impossible to ``link'' to this makefile in any way covered by +# the GPL. +# +# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN: +# make help +# +fileinfo := LaTeX Makefile +author := Chris Monson +version := 2.2.0-rc1 +# +# Note that the user-global version is imported *after* the source directory, +# so that you can use stuff like ?= to get proper override behavior. +.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini +-include Makefile.ini +-include $(HOME)/.latex-makefile/Makefile.ini +# +# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini: +# BUILD_STRATEGY := latex +BUILD_STRATEGY ?= pdflatex +# +# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be +# # immune to changes to the locale in the user environment. +export LC_ALL ?= C +# +# +# If you specify sources here, all other files with the same suffix +# will be treated as if they were _include_ files. +#onlysources.tex ?= main.tex +#onlysources.tex.sh ?= +#onlysources.tex.pl ?= +#onlysources.tex.py ?= +#onlysources.rst ?= +#onlysources.fig ?= +#onlysources.gpi ?= +#onlysources.dot ?= +#onlysources.xvg ?= +#onlysources.svg ?= +#onlysources.eps.gz ?= +#onlysources.eps ?= +# +# If you list files here, they will be treated as _include_ files +#includes.tex ?= file1.tex file2.tex +#includes.tex.sh ?= +#includes.tex.pl ?= +#includes.tex.py ?= +#includes.rst ?= +#includes.fig ?= +#includes.gpi ?= +#includes.dot ?= +#includes.xvg ?= +#includes.svg ?= +#includes.eps.gz ?= +#includes.eps ?= +# +# If you list files or wildcards here, they will *not* be cleaned - default is +# to allow everything to be cleaned. +#neverclean ?= *.pdf +# +# Alternatively (recommended), you can add those lines to a Makefile.ini file +# and it will get picked up automatically without your having to edit this +# Makefile. +# +# KNOWN ISSUES: +# * The following occurs: +# file with: \usepackage{named}\bibliographystyle{named} +# Compile +# change to: \usepackage{apalike}\bibliographystyle{apalike} +# Compile again -- BARF! +# +# The workaround: make clean-nographics; make +# +# Note that we may not be able to fix this. LaTeX itself barfs +# on this, not the makefile. The very first invocation of LaTeX +# (when something like this has happened) reads the existing .aux +# file and discovers invalid commands like \citeauthoryear that +# are only valid in the package that was just removed. It then +# tries to parse them and explodes. It's not at all clear to me +# how to fix this. I tried removing the .aux files on the first +# run of LaTeX, but that necessarily requires more subsequent +# rebuilds on common edits. There does not appear to be a +# graceful solution to this issue. +# +# CHANGES: +# Chris Monson (2010-04-08): +# * Bumped version to 2.2.0-rc1 +# * Added back in the rst_style_file stuff that got broken when switching +# rst -> tex to use the script mechanism +# Chris Monson (2010-03-23): +# * Bumped version to 2.2.0-beta8 +# * Work on issue 76: bad backtick escape for some sed versions, failure +# to clear out the hold buffer when outputting MISSING comment. +# - Backed out 2>&1 to &> (doesn't work in sh) +# - Backed out using . to source variables +# Chris Monson (2010-03-22): +# * Bumped version to 2.2.0-beta7 +# * Issue 72: Fix latex/bibtex invocation order for annotated bib styles +# * Fixed informational output to reflect which LaTeX run we're on +# * Fixed graphic detection to include graphics that are already there in +# .d files +# * Tightened up the .d file output to only make .d depend on graphic +# *source* files. This means that building foo.d no longer +# builds all of the graphics files on which foo.tex depends. +# Had to use .SECONDEXPANSION trickery to make it work. +# * Changed get-graphics to only accept a stem. +# * Fixed build-once logic for scripted .tex to work better +# * Made get-inputs sed script more maintainable. +# * Moved Makefile.ini import up higher. +# * Changed bare stems to not recursively invoke make +# * Updated diff output to be more silent everywhere +# * Added a MISSING comment to the .d file if stuff isn't found - forces +# removal of .1st.make file, which often forces it to try again. +# * Fixed broken graphics-target function +# * Added sleep to .d file generation when stuff is missing - if it +# builds too fast, make doesn't realize it needs to be reloaded, +# and thus never discovers some deeper dependencies (especially +# evident when graphics are included from scripted include +# files). +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta6 +# * Fixed bareword builds to actually work (requires static patterns) +# * Fixed colorization to work with new paragraph stuff +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta5 +# * Fixed graphic detection to be much more focused - splits log file +# into paragraphs before doing pattern matching. +# * Fixed make foo to work properly (recursively calls make foo.pdf) +# * Fixed gpi -> pdf generation to not waste time building .eps *after* +# the pdf already exists. +# * Changed log copies to include MAKE_RESTARTS as part of the name. +# * Fixed missing include file detection (also makes use of the paragraph +# stuff) to detect missing scripted include files. +# Chris Monson (2010-03-16): +# * Bumped version to 2.2.0-beta4 +# * issue 70: .pdf not moved out of the way properly on first +# compilation, resulting in early error detection failure. +# * issue 74: fixed broken error on missing .aux files: the +# implementation was masking real errors. +# Chris Monson (2010-03-15): +# * Bumped version to 2.2.0-beta3 +# * issue 71: Made the tput dependency optional +# * issue 73: Made .tex targets not pull in .d files (building them from +# scripts should not require a .d) +# * issue 74: Output a much saner error when a .aux file is not produced +# (e.g., when you are typing "make" without arguments in a +# directory with included .tex files that are not named with +# ._include_.) +# Chris Monson (2010-03-11): +# * Bumped version to 2.2.0-beta2 +# * Fixed clean-graphics to get rid of intermediate .eps files that may +# be hanging around +# * Added an automatic setting to use eps terminals in pdflatex mode for +# gnuplot if it doesn't understand pdf. +# * issue 66: Removed grayscale generation via magic suffix. Grayscale +# generation is now only available via GRAY=1 +# * issue 68: Added explicit handling of LC_ALL for locale-aware tools +# like "sort" +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-beta1 +# * Fixed success message to handle output message in different places +# * Added name of produced file to success message +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-alpha3 +# * Added meaningful error message for wrong hyperref options +# * Added meaningful error message for incorrect graphics extensions +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha2 +# * Updated graphics handling (gnuplot and fig generate pdf natively) +# * Changed xmgrace to output monochrome natively +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha1 - major change! +# * Support pdflatex natively and by default (issue 6 - a long time coming) +# * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for +# all invocations +# * Reworked graphic inclusion detection so that extensions need not be +# specified for either build strategy (e.g., +# \includegraphics{test1.eps} -> \includegrahpics{test1}) +# * Changed log format to include filenames and line numbers +# Chris Monson (2010-02-04): +# * Bumped version to 2.1.43 +# * All of the following are for issue 63 (thanks to mojoh81): +# * Added documentation about fixing Makefile.ini default target +# * Added perl and python script targets +# * Fixed run logic to allow included .tex files to be scripted (the +# run-again logic now detects missing .tex files, and the MV +# command has been switched out for a command that only invokes +# MV if the files exist) +# * Changed scripted generation to only run once per make invocation +# * Added dependency on expr +# Chris Monson (2010-01-19): +# * Bumped version to 2.1.42 +# * issue 62: Added .brf extension to cleanable files (backrefs) +# Chris Monson (2010-01-07): +# * Bumped version to 2.1.41 +# * issue 60: bad makeindex runs now error out on subsequent tries +# Chris Monson (2009-12-01): +# * Bumped version to 2.1.40 +# * issue 36: build all indices (for e.g., splitidx usage) +# * issue 59: clean up all generated files (including indices) +# Chris Monson (2009-11-23): +# * Bumped version to 2.1.39 +# * issue 57: change ps2pdf invocations to just use gs directly +# Chris Monson (2009-11-19): +# * Bumped version to 2.1.38 +# * issue 57: Added some limited support for Cygwin (spaces in filenames) +# Chris Monson (2009-11-15): +# * Bumped version to 2.1.37 +# * Removed svninfo, since this is now managed by mercurial +# * Fixed typo in changelist +# * Issue 52: added jpg->eps conversion (thanks to brubakee) +# * Issue 54: fix missing Overfull colorization due to lack of a blank +# line preceding the first error. +# * Issue 51: remove head.tmp and body.tmp in make clean invocation +# * Issue 56: maintain multiple versions of log files (for debugging) +# Chris Monson (2009-11-14): +# * Bumped version to 2.1.36 +# * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables +# Chris Monson (2009-11-05): +# * Bumped version to 2.1.35 +# * Added nomenclature support (see issue 48) +# Chris Monson (2009-10-29): +# * Bumped version to 2.1.34 +# * Fixed _out_ creation bug introduced in 2.1.33 (it was always created) +# * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR +# * Changed contact email address - bring on the spam! +# Chris Monson (2009-10-21): +# * Bumped version to 2.1.33 +# * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay) +# * Made all_files.* settable in Makefile.ini (using ?= instead of :=) +# * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy +# dvi, pdf, and ps if it exists +# Chris Monson (2009-09-25): +# * Bumped version to 2.1.32 +# * Fixed so that a changed lol file will cause a rebuild +# * Added .lol files to the cleanable list +# Chris Monson (2009-09-08): +# * Bumped version to 2.1.31 +# * Closed issue 43: evince doesn't notice pdf change w/out touch +# Chris Monson (2009-08-28): +# * Bumped version to 2.1.30 +# * Closed issue 39: Capture multi-line log warnings/errors to output +# Chris Monson (2009-08-26): +# * Bumped version to 2.1.29 +# * Closed issue 42: add svg support using inkscape +# Chris Monson (2009-08-17): +# * Bumped version to 2.1.28 +# * Patch from paul.biggar for issue 38: package warnings are overlooked +# Chris Monson (2009-08-07): +# * Bumped version to 2.1.27 +# * Included patch for issue 37 - removes pdf/ps files before copying, +# allowing some broken viewers to see changes properly. +# Chris Monson (2009-05-15): +# * Bumped version to 2.1.26 +# * Included patch for issue 9 from favonia - detects .fig changes for +# pstex files during regular compilation, so long as the pstex +# has been built at least once with make all-pstex. +# Chris Monson (2009-03-27): +# * Bumped version to 2.1.25 +# * Cleaned up a bunch of variable setting stuff - more stuff is now +# settable from Makefile.ini +# * Cleaned up documentation for various features, especially settable +# variables. +# * issue 28: support for png -> eps conversion (it even looks good!) +# * issue 29: support for "neverclean" files in Makefile.ini +# * issue 30: make ps2pdf14 the default - fall back when not there +# Chris Monson (2009-03-09): +# * Bumped version to 2.1.24 +# * issue 27: xmgrace support (thanks to rolandschulzhd) +# Chris Monson (2008-10-23): +# * Bumped version to 2.1.23 +# * issue 23: fixed _check_programs to not use bash string subs +# Chris Monson (2008-09-02): +# * Bumped version to 2.1.22 +# * Appled patch from Holger <yllohy@googlemail.com> to add include +# sources and some documentation updates. +# * Updated backup_patterns to be a bit more aggressive (also thanks to +# Holger) +# Chris Monson (2008-08-30): +# * Bumped version to 2.1.21 +# * Added ability to specify onlysources.* variables to indicate the only +# files that should *not* be considered includes. Thanks to Holger +# <yllohy@googlemail.com> for this patch. +# * Added an automatic include of Makefile.ini if it exists. Allows +# settings to be made outside of this makefile. +# Chris Monson (2008-05-21): +# * Bumped version to 2.1.20 +# * Added manual pstex compilation support (run make all-pstex first) +# * Removed all automatic pstex support. It was totally breaking +# everything and is very hard to incorporate into the makefile +# concept because it requires LaTeX to *fail* before it can +# determine that it needs the files. +# Chris Monson (2008-04-17): +# * Bumped version to 2.1.19 +# * Changed the pstex build hack to be on by default +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.18 +# * issue 16: fixed pstex build problems, seems nondeterministic. Added +# gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1. +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.17 +# * issue 20: fixed accumulation of <pid>*.make files - wildcard was +# refusing to work on files that are very recently created. +# Chris Monson (2008-04-02): +# * Bumped version to 2.1.16 +# * issue 19: Removed the use of "type" to fix broken "echo" settings +# Chris Monson (2008-03-27): +# * Bumped version to 2.1.15 +# * issue 18: Favors binary echo over builtin, as binary understands -n +# * issue 16: Fixed handling of missing pstex_t files in the log +# * issue 9: Added .SECONDARY target for .pstex files +# Chris Monson (2008-03-21): +# * Bumped version to 2.1.14 +# * Fixed broken aux file flattening, which caused included bibs to be +# missed. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.13 +# * Changed error output colorization to show errors for missing files +# that are not graphics files. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.12 +# * Fixed a regression introduced in r28 that makes bibtex fail when +# there is no index file present +# Chris Monson (2008-03-03): +# * Bumped version to 2.1.11 +# * Fixed issue 11 (handle index files, reported by abachn) +# * Cleaned up some comments and help text +# Chris Monson (2008-01-24): +# * Bumped version to 2.1.10 +# * Fixed to work when 'sh' is a POSIX shell like 'dash' +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.9 +# * Fixed documentation and dependency graph for pstex files +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.8 +# * Added basic pstex_t support for fig files (Issue 9 by favonia) +# I still suggest that psfrag be used instead. +# Chris Monson (2007-10-16): +# * Bumped version to 2.1.7 +# * Removed todo item: allow other comment directives for rst conversion +# * Added ability to use global rst style file _rststyle_._include_.tex +# * Added help text to that effect +# Chris Monson (2007-05-20): +# * Bumped version to 2.1.6 +# * Changed default paper size for rst files +# * Added todo item: fix paper size for rst files +# * Added todo item: allow other comment directives for rst conversion +# Chris Monson (2007-04-02): +# * Bumped version to 2.1.5 +# * Addressed Issue 7, incorrect .gpi.d generation in subdirectories +# Chris Monson (2007-03-28): +# * Bumped version to 2.1.4 +# * Fixed syntax error in dot output +# Chris Monson (2007-03-01): +# * Bumped version to 2.1.3 +# * Added reST to the included documentation +# * Fixed graphics and script generation to be settable in the +# environment. +# Chris Monson (2007-02-23): +# * Bumped version to 2.1.2 +# * Added the ability to generate .tex files from .rst files +# Chris Monson (2006-10-17): +# * Bumped version to 2.1.1 +# * Fixed includes from subdirectories (sed-to-sed slash escape problem) +# Chris Monson (2006-10-05): +# * Bumped version to 2.1.0 (pretty serious new feature added) +# * New feature: bib files can now be anywhere on the BIBINPUTS path +# * New programs: kpsewhich (with tetex) and xargs (BSD) +# Chris Monson (2006-09-28): +# * Bumped version to 2.0.9 +# * Added ability to parse more than one bibliography +# Chris Monson (2006-06-01): +# * Bumped version to 2.0.8 +# * Added .vrb to the list of cleaned files +# Chris Monson (2006-04-26): +# * Bumped version to 2.0.7 +# * Fixed so that clean-nographics does not remove .gpi.d files +# * Removed jpg -> eps hack (not working properly -- just pre-convert) +# * Fixed so that postscript grayscale can be done with BSD sed +# Chris Monson (2006-04-25): +# * Bumped version to 2.0.6 +# * Fixed so that changed toc, lot, lof, or out causes a rebuild +# Chris Monson (2006-04-17): +# * Bumped version to 2.0.5 +# * Added jpg -> eps conversion target +# Chris Monson (2006-04-12): +# * Bumped version to 2.0.4 +# * Fixed BSD sed invocation to not use \| as a branch delimiter +# * Added a comment section on what is and is not allowed in BSD sed +# * Made paper size handling more robust while I was at it +# * Fixed postscript RGB grayscale to use a weighted average +# * Fixed postscript HSB grayscale to convert to RGB first +# * Fixed a problem with rebuilding .bbl files +# Chris Monson (2006-04-11): +# * Bumped version to 2.0.3 +# * Fixed some BSD sed problems: can't use \n in substitutions +# Chris Monson (2006-04-10): +# * Bumped version to 2.0.2 +# * Once again removed ability to create .tex files from scripts +# * \includeonly works again +# Chris Monson (2006-04-09): +# * Bumped version to 2.0.1 +# * Fixed grayscale postscript handling to be more robust +# * Added ability to generate ._gray_. files from eps and eps.gz +# * Added ability to clean ._gray_.eps files created from .eps files +# Chris Monson (2006-04-07): +# * Bumped version to 2.0.0 +# * Removed clunky ability to create included .tex files from scripts +# * Added note in the help about included tex scripting not working +# * Fixed the .eps generation to delete %.gpihead.make when finished +# * Abandoned designs to use shell variables to create sed scripts +# * Abandoned __default__.tex.sh idea: it causes recursion with %: . +# * Removed web page to-do. All items are now complete. +# * Added better grayscale conversion for dot figures (direct ps fixup). +# * Include files can now be scripted (at the expense of \includeonly). +# * Updated dependency graph to contain better node names. +# Chris Monson (2006-04-06): +# * Bumped version to 2.0b3 +# * Top level includes now fail if there is no rule to build them +# * A helpful message is printed when they do fail +# * Grayscale has been changed to be ._gray_, other phonies use _ now, too +# * Grayscale handling has been completed +# * Changed _include_stems target to _includes target. +# * Fixed _includes target to be useful by itself. +# * Removed the ability to specify clean and build targets at once +# * Verified that epsfig works fine with current code +# * Fixed included scripts so that they are added to the dep files +# * Fixed so that graphics includes don't happen if they aren't for gpi +# * Fixed dot output to allow grayscale. +# Chris Monson (2006-04-05): +# * Bumped version to 2.0b2 +# * Removed automatic -gray output. It needs fixing in a bad way. +# * Revamped dependency creation completely. +# * Fixed conditional inclusion to actually work (test.nobuild.d, test.d). +# * Fixed clean target to remove log targets +# * Added the 'monochrome' word for gray gpi output +# * Added a _check_gpi_files target that checks for common problems +# * Changed the _version target into the version target (no _) +# * Added better handling of grayscale files. Use the .gray.pdf target. +# * Fixed testing for rebuilds +# Chris Monson (2006-04-04): +# * Bumped version to 2.0b1 +# * Changed colorization of output +# * Made .auxbbl and .auxtex .make files secondary targets +# * Shortened and simplified the final latex invocation loop +# * Added version-specific output ($$i vs. $$$$i) in latex loop +# * Added a build message for the first .dvi run (Building .dvi (0)) +# * Removed some build messages that most people don't care about. +# * Simplified procedure for user-set colors -- simple text specification +# * Fixed diff output to...not output. +# * Fixed rerun bug -- detect not only when preceded with LaTeX Warning +# * Sped up gpi plotting +# * Added error handling and colorized output for gpi failure +# * Documented color changing stuff. +# * Now sort the flattened aux file to avoid false recompilation needs +# * Added clean-nographics target +# * Don't remove self.dvi file if self.aux is missing in the log +# * Clarified some code. Did some very minor adjusting. +# Chris Monson (2006-04-03): +# * Bumped version to 2.0a7 +# * Added .dvi and .ps files as secondary files. +# * Fixed handling of multiple run detection when includeonly is in use. +# * Added code to flatten .aux files. +# * Added more files as .SECONDARY prerequisites to avoid recompilation. +# * Fixed the inputs generation to be much simpler and to use pipes. +# * Added the dependency graph directly into the makefile. +# * Changed flatten-aux to remove \@writefile \relax \newlabel, etc. +# * Undid pipe changes with sed usage (BSD sed doesn't know -f-). +# * Added a _check_programs target that tells you what your system has. +# * Fixed an error in colorization that made unnecessary errors appear +# * Added view targets. +# * Updated help text. +# * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds +# * Added more informative error handling for dvips and ps2pdf +# Chris Monson (2006-04-02): +# * Bumped version to 2.0a6 +# * Added indirection to .bbl dependencies to avoid rebuilding .bbl files +# * Streamlined the diff invocation to eliminate an existence test +# * Removed special shell quote escape variables +# * Moved includes to a more prominent location +# * Fixed .inputs.make to not contain .aux files +# * Fixed embedding to use a file instead of always grepping. +# * Added *.make.temp to the list of cleanable files +# * Fixed Ruby. It should now be supported properly. +# * Now differentiate between all, default, and buildable files. +# * Fixed to bail out on serious errors. +# * Revised the handling of includable files. Still working on it. +# Chris Monson (2006-03-31): +# * Bumped version to 2.0a5 +# * Fixed a bug with LaTeX error detection (there can be spaces) +# * Added .bbl support, simplifying everything and making it more correct +# * Refactored some tests that muddy the code +# * Did a little cleanup of some shell loops that can safely be make loops +# * Added support for graphviz .dot files +# * Made _all_programs output easier to read +# * Added the ruby support that has long been advertised +# * Font embedding was screwed up for PostScript -- now implicit +# * Changed the generation of -gray.gpi files to a single command +# * Changed any make-generated file that is not included from .d to .make +# Chris Monson (2006-03-30): +# * Bumped version to 2.0a4 +# * Fixed a bug with very long graphics file names +# * Added a todo entry for epsfig support +# * Fixed a bug paper size bug: sometimes more than one entry appears +# * Fixed DVI build echoing to display the number instead of process ID +# * DVI files are now removed on first invocation if ANY file is missing +# * Added a simple grayscale approach: if a file ends with -gray.gpi, it +# is created from the corresponding .gpi file with a special +# comment ##GRAY in its header, which causes coloring to be +# turned off. +# * Fixed a bug in the handling of .tex.sh files. For some reason I had +# neglected to define file stems for scripted output. +# * Removed a trailing ; from the %.graphics dependencies +# * Added dvips embedding (I think it works, anyway) +# Chris Monson (2006-03-29): +# * Bumped version to 2.0a3 +# * Fixed error in make 3.79 with MAKEFILE_LIST usage +# * Added the presumed filename to the _version output +# * Added a vim macro for converting sed scripts to make commands +# * Added gpi dependency support (plotting external files and loading gpi) +# * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi +# * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}. +# Chris Monson (2006-03-28): +# * Bumped version to 2.0a2 +# * Added SHELL_DEBUG and VERBOSE options +# * Changed the default shell back to /bin/sh (unset, in other words) +# * Moved .PHONY declarations closer to their targets +# * Moved help text into its own define block to obtain better formatting +# * Removed need for double-entry when adding a new program invocation +# * Moved .SECONDARY declaration closer to its relevant occurrence +# * Commented things more heavily +# * Added help text about setting terminal and output in gnuplot +# * Created more fine-grained clean targets +# * Added a %.graphics target that generates all of %'s graphics +# * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps) +# * For now, we're just GPL 2, not 3. Maybe it will change later +# * Made the version and svninfo into variables +# Chris Monson (2006-03-27): +# * Bumped version to 2.0a1 +# * Huge, sweeping changes -- automatic dependencies + +# IMPORTANT! +# +# When adding to the following list, do not introduce any blank lines. The +# list is extracted for documentation using sed and is terminated by a blank +# line. +# +# EXTERNAL PROGRAMS: +# = ESSENTIAL PROGRAMS = +# == Basic Shell Utilities == +CAT ?= cat +CP ?= cp -f +DIFF ?= diff +ECHO ?= echo +EGREP ?= egrep +ENV ?= env +EXPR ?= expr +MV ?= mv -f +SED ?= sed +SORT ?= sort +TOUCH ?= touch +UNIQ ?= uniq +WHICH ?= which +XARGS ?= xargs +SLEEP ?= sleep +# == LaTeX (tetex-provided) == +BIBTEX ?= bibtex +DVIPS ?= dvips +LATEX ?= latex +PDFLATEX ?= pdflatex +EPSTOPDF ?= epstopdf +MAKEINDEX ?= makeindex +KPSEWHICH ?= kpsewhich +GS ?= gs +# = OPTIONAL PROGRAMS = +# == Makefile Color Output == +TPUT ?= tput +# == TeX Generation == +PERL ?= perl +PYTHON ?= python +RST2LATEX ?= rst2latex.py +# == EPS Generation == +CONVERT ?= convert # ImageMagick +DOT ?= dot # GraphViz +DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed +FIG2DEV ?= fig2dev # XFig +GNUPLOT ?= gnuplot # GNUplot +INKSCAPE ?= inkscape # Inkscape (svg support) +XMGRACE ?= xmgrace # XMgrace +PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps +PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps +PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps +GUNZIP ?= gunzip # GZipped EPS +# == Beamer Enlarged Output == +PSNUP ?= psnup +# == Viewing Stuff == +VIEW_POSTSCRIPT ?= gv +VIEW_PDF ?= xpdf +VIEW_GRAPHICS ?= display + +# Command options for embedding fonts and postscript->pdf conversion +PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100 +PS_COMPATIBILITY ?= 1.4 + +# Defaults for GPI +DEFAULT_GPI_EPS_FONTSIZE ?= 22 +DEFAULT_GPI_PDF_FONTSIZE ?= 12 + +# Style file for ReST +RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex) + +# This ensures that even when echo is a shell builtin, we still use the binary +# (the builtin doesn't always understand -n) +FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO)) +ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO)) + +define determine-gnuplot-output-extension +$(if $(shell $(WHICH) $(GNUPLOT)), + $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)), + eps, pdf), + none) +endef + +GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension)) + +# Directory into which we place "binaries" if it exists. +# Note that this can be changed on the commandline or in Makefile.ini: +# +# Command line: +# make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf +# +# Also, you can specify a relative directory (relative to the Makefile): +# make BINARY_TARGET_DIR=pdfs myfile.pdf +# +# Or, you can use Makefile.ini: +# +# BINARY_TARGET_DIR := $(HOME)/bin_out +# +BINARY_TARGET_DIR ?= _out_ + +RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0) +# SH NOTES +# +# On some systems, /bin/sh, which is the default shell, is not linked to +# /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it +# just isn't. This section details some of the things you have to stay away +# from to remain sh-compatible. +# +# * File pattern expansion does not work for {} +# * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ] +# * &> for stderr redirection doesn't work, use 2>&1 instead +# +# BSD SED NOTES +# +# BSD SED is not very nice compared to GNU sed, but it is the most +# commonly-invoked sed on Macs (being based on BSD), so we have to cater to +# it or require people to install GNU sed. It seems like the GNU +# requirement isn't too bad since this makefile is really a GNU makefile, +# but apparently GNU sed is much less common than GNU make in general, so +# I'm supporting it here. +# +# Sad experience has taught me the following about BSD sed: +# +# * \+ is not understood to mean \{1,\} +# * \| is meaningless (does not branch) +# * \n cannot be used as a substitution character +# * ? does not mean \{0,1\}, but is literal +# * a\ works, but only reliably for a single line if subsequent lines +# have forward slashes in them (as is the case in postscript) +# +# For more info (on the Mac) you can consult +# +# man -M /usr/share/man re_format +# +# And look for the word "Obsolete" near the bottom. + +# +# EXTERNAL PROGRAM DOCUMENTATION SCRIPT +# + +# $(call output-all-programs,[<output file>]) +define output-all-programs + [ -f '$(this_file)' ] && \ + $(SED) \ + -e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \ + -e '/EXTERNAL PROGRAMS/d' \ + -e '/^$$/d' \ + -e '/^[[:space:]]*#/i\ '\ + -e 's/^[[:space:]]*#[[:space:]][^=]*//' \ + $(this_file) $(if $1,> '$1',) || \ + $(ECHO) "Cannot determine the name of this makefile." +endef + +# If they misspell gray, it should still work. +GRAY ?= $(call get-default,$(GREY),) + +# +# Utility Functions and Definitions +# + +# While not exactly a make function, this vim macro is useful. It takes a +# verbatim sed script and converts each line to something suitable in a command +# context. Just paste the script's contents into the editor, yank this into a +# register (starting at '0') and run the macro once for each line of the +# original script: +# +# 0i -e :s/\$/$$/eg :s/'/'"'"'/eg ^Ela'A' \:noh j + +# don't call this directly - it is here to avoid calling wildcard more than +# once in remove-files. +remove-files-helper = $(if $1,$(RM) $1,$(sh_true)) + +# $(call remove-files,file1 file2) +remove-files = $(call remove-files-helper,$(wildcard $1)) + +# Removes all cleanable files in the given list +# $(call clean-files,file1 file2 file3 ...) +# Works exactly like remove-files, but filters out files in $(neverclean) +clean-files = \ + $(call remove-files-helper,$(call cleanable-files,$(wildcard $1))) + +# Outputs all generated files to STDOUT, along with some others that are +# created by these (e.g., .idx files end up producing .ilg and .ind files). +# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind +# filenames as needed. +# +# $(call get-generated-names,<source recorder file (*.fls)>) +define get-generated-names +[ -f '$1' ] && \ +$(SED) \ + -e '/^OUTPUT /{' \ + -e ' s///' \ + -e ' p' \ + -e ' s/\.idx/\.ind/p' \ + -e ' s/\.ind/\.ilg/p' \ + -e '}' \ + -e 'd' \ + '$1' \ +| $(SORT) | $(UNIQ) +endef + +# This removes files without checking whether they are there or not. This +# sometimes has to be used when the file is created by a series of shell +# commands, but there ends up being a race condition: make doesn't know about +# the file generation as quickly as the system does, so $(wildcard ...) doesn't +# work right. Blech. +# $(call remove-temporary-files,filenames) +remove-temporary-files = $(if $1,$(RM) $1,:) + +# Create an identifier from a file name +# $(call cleanse-filename,filename) +cleanse-filename = $(subst .,_,$(subst /,__,$1)) + +# Escape dots +# $(call escape-dots,str) +escape-dots = $(subst .,\\.,$1) + +# Test that a file exists +# $(call test-exists,file) +test-exists = [ -e '$1' ] + +# $(call move-files,source,destination) +move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2' + +# Copy file1 to file2 only if file2 doesn't exist or they are different +# $(call copy-if-different,sfile,dfile) +copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2' +copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2' +move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2' +replace-if-different-and-remove = \ + $(call test-different,$1,$2) \ + && $(MV) '$1' '$2' \ + || $(call remove-files,'$1') + +# Note that $(DIFF) returns success when the files are the SAME.... +# $(call test-different,sfile,dfile) +test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1 +test-exists-and-different = \ + $(call test-exists,$2) && $(call test-different,$1,$2) + +# Return value 1, or value 2 if value 1 is empty +# $(call get-default,<possibly empty arg>,<default value if empty>) +get-default = $(if $1,$1,$2) + +# Copy a file and log what's going on +# $(call copy-with-logging,<source>,<target>) +define copy-with-logging +if [ -d '$2/' ]; then \ + if $(CP) '$1' '$2/'; then \ + $(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \ + else \ + $(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \ + fi; \ +fi +endef + +# Gives a reassuring message about the failure to find include files +# $(call include-message,<list of include files>) +define include-message +$(strip \ +$(if $(filter-out $(wildcard $1),$1),\ + $(shell $(ECHO) \ + "$(C_INFO)NOTE: You may ignore warnings about the"\ + "following files:" >&2;\ + $(ECHO) >&2; \ + $(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\ + $(ECHO) "$(C_RESET)" >&2) +)) +endef +# Characters that are hard to specify in certain places +space := $(empty) $(empty) +colon := \: +comma := , + +# Useful shell definitions +sh_true := : +sh_false := ! : + +# Clear out the standard interfering make suffixes +.SUFFIXES: + +# Turn off forceful rm (RM is usually mapped to rm -f) +ifdef SAFE_RM +RM := rm +endif + +# Turn command echoing back on with VERBOSE=1 +ifndef VERBOSE +QUIET := @ +endif + +# Turn on shell debugging with SHELL_DEBUG=1 +# (EVERYTHING is echoed, even $(shell ...) invocations) +ifdef SHELL_DEBUG +SHELL += -x +endif + +# Get the name of this makefile (always right in 3.80, often right in 3.79) +# This is only really used for documentation, so it isn't too serious. +ifdef MAKEFILE_LIST +this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +else +this_file := $(wildcard GNUmakefile makefile Makefile) +endif + +# Terminal color definitions + +REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT))) + +# $(call get-term-code,codeinfo) +# e.g., +# $(call get-term-code,setaf 0) +get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),) + +black := $(call get-term-code,setaf 0) +red := $(call get-term-code,setaf 1) +green := $(call get-term-code,setaf 2) +yellow := $(call get-term-code,setaf 3) +blue := $(call get-term-code,setaf 4) +magenta := $(call get-term-code,setaf 5) +cyan := $(call get-term-code,setaf 6) +white := $(call get-term-code,setaf 7) +bold := $(call get-term-code,bold) +uline := $(call get-term-code,smul) +reset := $(call get-term-code,sgr0) + +# +# User-settable definitions +# +LATEX_COLOR_WARNING ?= magenta +LATEX_COLOR_ERROR ?= red +LATEX_COLOR_INFO ?= green +LATEX_COLOR_UNDERFULL ?= magenta +LATEX_COLOR_OVERFULL ?= red bold +LATEX_COLOR_PAGES ?= bold +LATEX_COLOR_BUILD ?= cyan +LATEX_COLOR_GRAPHIC ?= yellow +LATEX_COLOR_DEP ?= green +LATEX_COLOR_SUCCESS ?= green bold +LATEX_COLOR_FAILURE ?= red bold + +# Gets the real color from a simple textual definition like those above +# $(call get-color,ALL_CAPS_COLOR_NAME) +# e.g., $(call get-color,WARNING) +get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c))) + +# +# STANDARD COLORS +# +C_WARNING := $(call get-color,WARNING) +C_ERROR := $(call get-color,ERROR) +C_INFO := $(call get-color,INFO) +C_UNDERFULL := $(call get-color,UNDERFULL) +C_OVERFULL := $(call get-color,OVERFULL) +C_PAGES := $(call get-color,PAGES) +C_BUILD := $(call get-color,BUILD) +C_GRAPHIC := $(call get-color,GRAPHIC) +C_DEP := $(call get-color,DEP) +C_SUCCESS := $(call get-color,SUCCESS) +C_FAILURE := $(call get-color,FAILURE) +C_RESET := $(reset) + +# +# PRE-BUILD TESTS +# + +# Check that clean targets are not combined with other targets (weird things +# happen, and it's not easy to fix them) +hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1) +hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1) +ifneq "$(hasbuildgoals)" "" +ifneq "$(hascleangoals)" "" +$(error $(C_ERROR)Clean and build targets specified together$(C_RESET))) +endif +endif + +# +# VARIABLE DECLARATIONS +# + +# Names of sed scripts that morph gnuplot files -- only the first found is used +GNUPLOT_SED := global-gpi.sed gnuplot.sed +GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_graphic_extension ?= eps +latex_build_program ?= $(LATEX) +build_target_extension ?= dvi +hyperref_driver_pattern ?= hdvips +hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options. +else +default_graphic_extension ?= pdf +latex_build_program ?= $(PDFLATEX) +build_target_extension ?= pdf +hyperref_driver_pattern ?= hpdf.* +hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank). +endif + +# Files of interest +all_files.tex ?= $(wildcard *.tex) +all_files.tex.sh ?= $(wildcard *.tex.sh) +all_files.tex.pl ?= $(wildcard *.tex.pl) +all_files.tex.py ?= $(wildcard *.tex.py) +all_files.rst ?= $(wildcard *.rst) +all_files.fig ?= $(wildcard *.fig) +all_files.gpi ?= $(wildcard *.gpi) +all_files.dot ?= $(wildcard *.dot) +all_files.xvg ?= $(wildcard *.xvg) +all_files.svg ?= $(wildcard *.svg) +all_files.png ?= $(wildcard *.png) +all_files.jpg ?= $(wildcard *.jpg) +all_files.eps.gz ?= $(wildcard *.eps.gz) +all_files.eps ?= $(wildcard *.eps) + +# Utility function for obtaining all files not specified in $(neverclean) +# $(call cleanable-files,file1 file2 file3 ...) +# Returns the list of files that is not in $(wildcard $(neverclean)) +cleanable-files = $(filter-out $(wildcard $(neverclean)), $1) + +# Utility function for getting all .$1 files that are to be ignored +# * files listed in $(includes.$1) +# * files not listed in $(onlysources.$1) if it is defined +ignore_files = \ + $(includes.$1) \ + $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1))) + +# Patterns to never be allowed as source targets +ignore_patterns := %._include_ + +# Patterns allowed as source targets but not included in 'all' builds +nodefault_patterns := %._nobuild_ $(ignore_patterns) + +# Utility function for getting targets suitable building +# $(call filter-buildable,suffix) +filter-buildable = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(ignore_patterns)),$(all_files.$1)) + +# Utility function for getting targets suitable for 'all' builds +# $(call filter-default,suffix) +filter-default = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1)) + +# Top level sources that can be built even when they are not by default +files.tex := $(call filter-buildable,tex) +files.tex.sh := $(call filter-buildable,tex.sh) +files.tex.pl := $(call filter-buildable,tex.pl) +files.tex.py := $(call filter-buildable,tex.py) +files.rst := $(call filter-buildable,rst) +files.gpi := $(call filter-buildable,gpi) +files.dot := $(call filter-buildable,dot) +files.fig := $(call filter-buildable,fig) +files.xvg := $(call filter-buildable,xvg) +files.svg := $(call filter-buildable,svg) +files.png := $(call filter-buildable,png) +files.jpg := $(call filter-buildable,jpg) +files.eps.gz := $(call filter-buildable,eps.gz) + +# Make all pstex targets secondary. The pstex_t target requires the pstex +# target, and nothing else really depends on it, so it often gets deleted. +# This avoids that by allowing *all* fig files to be pstex targets, which is +# perfectly valid and causes no problems even if they're going to become eps +# files in the end. +.SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig)) + +# Top level sources that are built by default targets +default_files.tex := $(call filter-default,tex) +default_files.tex.sh := $(call filter-default,tex.sh) +default_files.tex.pl := $(call filter-default,tex.pl) +default_files.tex.py := $(call filter-default,tex.py) +default_files.rst := $(call filter-default,rst) +default_files.gpi := $(call filter-default,gpi) +default_files.dot := $(call filter-default,dot) +default_files.fig := $(call filter-default,fig) +default_files.xvg := $(call filter-default,xvg) +default_files.svg := $(call filter-default,svg) +default_files.png := $(call filter-default,png) +default_files.jpg := $(call filter-default,jpg) +default_files.eps.gz := $(call filter-default,eps.gz) + +# Utility function for creating larger lists of files +# $(call concat-files,suffixes,[prefix]) +concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s)) + +# Useful file groupings +all_files_source := $(call concat-files,tex,all) +all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all) + +.PHONY: $(all_files_scripts) + +default_files_source := $(call concat-files,tex,default) +default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default) + +files_source := $(call concat-files,tex) +files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst) + +# Utility function for obtaining stems +# $(call get-stems,suffix,[prefix]) +get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%)) + +# List of all stems (including ._include_ and ._nobuild_ file stems) +all_stems.tex := $(call get-stems,tex,all) +all_stems.tex.sh := $(call get-stems,tex.sh,all) +all_stems.tex.pl := $(call get-stems,tex.pl,all) +all_stems.tex.py := $(call get-stems,tex.py,all) +all_stems.rst := $(call get-stems,rst,all) +all_stems.fig := $(call get-stems,fig,all) +all_stems.gpi := $(call get-stems,gpi,all) +all_stems.dot := $(call get-stems,dot,all) +all_stems.xvg := $(call get-stems,xvg,all) +all_stems.svg := $(call get-stems,svg,all) +all_stems.png := $(call get-stems,png,all) +all_stems.jpg := $(call get-stems,jpg,all) +all_stems.eps.gz := $(call get-stems,eps.gz,all) +all_stems.eps := $(call get-stems,eps,all) + +# List of all default stems (all default PDF targets): +default_stems.tex := $(call get-stems,tex,default) +default_stems.tex.sh := $(call get-stems,tex.sh,default) +default_stems.tex.pl := $(call get-stems,tex.pl,default) +default_stems.tex.py := $(call get-stems,tex.py,default) +default_stems.rst := $(call get-stems,rst,default) +default_stems.fig := $(call get-stems,fig,default) +default_stems.gpi := $(call get-stems,gpi,default) +default_stems.dot := $(call get-stems,dot,default) +default_stems.xvg := $(call get-stems,xvg,default) +default_stems.svg := $(call get-stems,svg,default) +default_stems.png := $(call get-stems,png,default) +default_stems.jpg := $(call get-stems,jpg,default) +default_stems.eps.gz := $(call get-stems,eps.gz,default) + +# List of all stems (all possible bare PDF targets created here): +stems.tex := $(call get-stems,tex) +stems.tex.sh := $(call get-stems,tex.sh) +stems.tex.pl := $(call get-stems,tex.pl) +stems.tex.py := $(call get-stems,tex.py) +stems.rst := $(call get-stems,rst) +stems.fig := $(call get-stems,fig) +stems.gpi := $(call get-stems,gpi) +stems.dot := $(call get-stems,dot) +stems.xvg := $(call get-stems,xvg) +stems.svg := $(call get-stems,svg) +stems.png := $(call get-stems,png) +stems.jpg := $(call get-stems,jpg) +stems.eps.gz := $(call get-stems,eps.gz) + +# Utility function for creating larger lists of stems +# $(call concat-stems,suffixes,[prefix]) +concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s))) + +# The most likely to be source but not finished product go first +graphic_source_extensions := fig \ + gpi \ + xvg \ + svg \ + dot \ + eps.gz + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +graphic_source_extensions += png jpg +graphic_target_extensions := eps ps +else +graphic_source_extensions += eps +graphic_target_extensions := pdf png jpg mps tif +endif + +all_stems_source := $(call concat-stems,tex,all) +all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all) +all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all) +all_stems_ss := $(sort $(all_stems_source) $(all_stems_script)) +all_stems_sg := $(sort $(all_stems_script)) +all_stems_ssg := $(sort $(all_stems_ss)) + +default_stems_source := $(call concat-stems,tex,default) +default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default) +default_stems_ss := $(sort $(default_stems_source) $(default_stems_script)) +default_stems_sg := $(sort $(default_stems_script)) +default_stems_ssg := $(sort $(default_stems_ss)) + +stems_source := $(call concat-stems,tex) +stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst) +stems_graphic := $(call concat-stems,$(graphic_source_extensions)) +stems_gg := $(sort $(stems_graphic)) +stems_ss := $(sort $(stems_source) $(stems_script)) +stems_sg := $(sort $(stems_script)) +stems_ssg := $(sort $(stems_ss)) + +# Calculate names that can generate the need for an include file. We can't +# really do this with patterns because it's too easy to screw up, so we create +# an exhaustive list. +allowed_source_suffixes := \ + pdf \ + ps \ + dvi \ + ind \ + nls \ + bbl \ + aux \ + aux.make \ + d \ + auxbbl.make \ + _graphics \ + _show +allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes)) + +allowed_graphic_suffixes := \ + pdf \ + eps \ + gpihead.make \ + gpi.d +allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes)) + +# All targets allowed to build documents +allowed_source_targets := \ + $(foreach suff,$(allowed_source_suffixes),\ + $(addsuffix .$(suff),$(stems_ssg))) + +# All targets allowed to build graphics +allowed_graphic_targets := \ + $(foreach suff,$(allowed_graphic_suffixes),\ + $(addsuffix .$(suff),$(stems_gg))) + +# All targets that build multiple documents (like 'all') +allowed_batch_source_targets := \ + all \ + all-pdf \ + all-ps \ + all-dvi \ + all-bbl \ + all-ind \ + all-gls \ + all-nls \ + show + +# All targets that build multiple graphics (independent of document) +allowed_batch_graphic_targets := \ + all-graphics \ + all-pstex \ + all-dot2tex \ + show-graphics + +# Now we figure out which stuff is available as a make target for THIS RUN. +real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\ + all) + +specified_source_targets := $(strip \ + $(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \ + ) + +specified_batch_source_targets := $(strip \ + $(filter $(allowed_batch_source_targets),$(real_goals)) \ + ) + +specified_graphic_targets := $(strip \ + $(filter $(allowed_graphic_targets),$(real_goals)) \ + ) + +specified_batch_graphic_targets := $(strip \ + $(filter $(allowed_batch_graphic_targets),$(real_goals)) \ + ) + +specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\ + $(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\ + $(all_files.gpi)) \ + ) + +# Determine which .d files need including from the information gained above. +# This is done by first checking whether a batch target exists. If it does, +# then all *default* stems are used to create possible includes (nobuild need +# not apply for batch status). If no batch targets exist, then the individual +# targets are considered and appropriate includes are taken from them. +source_stems_to_include := \ + $(sort\ + $(if $(specified_batch_source_targets),\ + $(default_stems_ss),\ + $(foreach t,$(specified_source_targets),\ + $(foreach p,$(allowed_source_patterns),\ + $(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \ + )) \ + )) + +# Determine which .gpi.d files are needed using the above information. We +# first check whether a batch target is specified, then check individual +# graphics that may have been specified. +graphic_stems_to_include := \ + $(sort\ + $(if $(specified_batch_graphic_targets),\ + $(default_stems.gpi),\ + $(foreach t,$(specified_gpi_targets),\ + $(foreach p,$(allowed_graphic_patterns),\ + $(patsubst $p,%,$(filter $p,$t)) \ + )) \ + )) + +# All dependencies for the 'all' targets +all_pdf_targets := $(addsuffix .pdf,$(stems_ssg)) +all_ps_targets := $(addsuffix .ps,$(stems_ssg)) +all_dvi_targets := $(addsuffix .dvi,$(stems_ssg)) +all_tex_targets := $(addsuffix .tex,$(stems_sg)) +all_d_targets := $(addsuffix .d,$(stems_ssg)) +all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg)) +intermediate_graphics_targets := $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),) +all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig)) +all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot)) + +all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension))) + +default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss)) +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_ps_targets := $(addsuffix .ps,$(default_stems_ss)) +default_dvi_targets := $(addsuffix .dvi,$(default_stems_ss)) +pre_pdf_extensions := dvi ps +endif + +# Extensions generated by LaTeX invocation that can be removed when complete +rm_ext := \ + log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \ + fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf +backup_patterns := *~ *.bak *.backup body.tmp head.tmp + +graph_stem := _graph + +# All LaTeX-generated files that can be safely removed + +rm_tex := \ + $(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \ + $(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \ + $(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \ + $(addsuffix .*.log,$(stems_graphic)) + +# These are the files that will affect .gpi transformation for all .gpi files. +# +# Use only the first one found. Backward compatible values are at the end. +# Note that we use foreach, even though wildcard also returns a list, to ensure +# that the order in the uppercase variables is preserved. Directory listings +# provide no such guarantee, so we avoid relying on them. +gpi_sed := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f)))) +gpi_global := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f)))) + +# +# Functions used in generating output +# + +# Outputs all source dependencies to stdout. The first argument is the file to +# be parsed, the second is a list of files that will show up as dependencies in +# the new .d file created here. +# +# NOTE: BSD sed does not understand \|, so we have to do something more +# clunky to extract suitable extensions. +# +# Also, we do a little bit of funny rewriting up front (TARGETS=) to make sure +# that we can properly backslash-escape spaces in file names (e.g, on Cygwin +# for tex distributions that have "Program Files" in their name). +# +# $(call get-inputs,<parsed file>,<target files>) +define get-inputs +$(SED) \ +-e '/^INPUT/!d' \ +-e 's!^INPUT \(\./\)\{0,1\}!!' \ +-e 's/[[:space:]]/\\ /g' \ +-e 's/\(.*\)\.aux$$/\1.tex/' \ +-e '/\.tex$$/b addtargets' \ +-e '/\.cls$$/b addtargets' \ +-e '/\.sty$$/b addtargets' \ +-e '/\.pstex_t$$/b addtargets' \ +-e '/\.dot_t$$/b addtargets' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# $(call get-missing-inputs,<log file>,<target files>) +define get-missing-inputs +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/Default extension: /!d' \ +-e 's/[[:space:]]\{1,\}/ /g' \ +-e 's/\n\{1,\}/ /g' \ +-e 's/^.*File `//' \ +-e 's/'"'"' not found\..*//' \ +-e '/\.tex/!s/$$/.tex/' \ +-e 's/[[:space:]]/\\ /g' \ +-e 'h' \ +-e 's/.*/# MISSING input "&" - (presence of comment affects build)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# Get source file for specified graphics stem. +# +# $(call graphics-source,<stem>) +define graphics-source +$(strip $(firstword \ + $(wildcard \ + $(addprefix $1.,\ + $(graphic_source_extensions))) \ + $1 \ +)) +endef + +# Get the target file for the specified graphics file/stem +# +# $(call graphics-target,<stem>) +define graphics-target +$(strip $(if $(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1, + $(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension)))) +endef + +# Outputs all of the graphical dependencies to stdout. The first argument is +# the stem of the source file being built, the second is a list of suffixes +# that will show up as dependencies in the generated .d file. +# +# Note that we try to escape spaces in filenames where possible. We have to do +# it with three backslashes so that as the name percolates through the makefile +# it eventually ends up with the proper escaping when the build rule is found. +# Ugly, but it appears to work. Note that graphicx doesn't allow filenames +# with spaces, so this could in many ways be moot unless you're using something +# like grffile. +# +# For pdflatex, we really need the missing file to be specified without an +# extension, otherwise compilation barfs on the first missing file. Truly +# annoying, but there you have it. +# +# It turns out that the graphics errors, although they have lines with empty +# space, are only made of two paragraphs. So, we just use some sed magic to +# get everything into paragraphs, detect when it's a paragraph that interests +# us, and double it up. Then we get the filename only if we're missing +# extensions (a sign that it's graphicx complaining). +# +# $(call get-graphics,<target file stem>) +#.log,$(addprefix $*.,d $(build_target_extension) _graphics) +define get-graphics +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File `/{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/{' \ +-e ' s/\n\{1,\}/ /g' \ +-e ' s/[[:space:]]\{1,\}/ /g' \ +-e ' s/^.*File `//' \ +-e ' s/'"'"' not found\..*//' \ +-e ' h' \ +-e ' s/.*/# MISSING stem "&" - (presence of comment affects build)/' \ +-e ' p' \ +-e ' g' \ +-e ' b addtargets' \ +-e '}' \ +-e '/.*File: \(.*\) Graphic file (type [^)]*).*/{' \ +-e ' s//\1/' \ +-e ' b addtargets' \ +-e '}' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/[[:space:]]/\\\\\\&/g' \ +-e 'h' \ +-e 's/.*/-include &.gpi.d/' \ +-e 'p' \ +-e 'g' \ +-e 's/.*/$(addprefix $1,.d): $$$$(call graphics-source,&)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/.*/$(addprefix $1.,$(build_target_extension) _graphics): $$$$(call graphics-target,&)/' \ +-e 'p' \ +-e 'd' \ +$*.log +endef + +# Checks for build failure due to pstex inclusion, and gives instructions. +# +# $(call die-on-pstexs,<parsed file>) +define die-on-pstexs +if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-pstex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for build failure due to dot2tex, and gives instructions. +# +# $(call die-on-dot2tex,<parsed file>) +define die-on-dot2tex +if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-dot2tex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for the existence of a .aux file, and dies with an error message if it +# isn't there. Note that we pass the file stem in, not the full filename, +# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo) +# +# $(call die-on-no-aux,<aux stem>) +define die-on-no-aux +if [ ! -e '$1.aux' ]; then \ + $(call colorize-latex-errors,$1.log); \ + exit 1; \ +fi +endef + +# Outputs all index files to stdout. Arg 1 is the source file stem, arg 2 is +# the list of targets for the discovered dependency. +# +# $(call get-log-index,<log file stem>,<target files>) +define get-log-index +$(SED) \ +-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \ +-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \ +-e 's/[[:space:]]/\\&/g' \ +-e '/^TARGETS=/{' \ +-e ' h' \ +-e ' s/^TARGETS=/$2: /p' \ +-e ' g' \ +-e ' s/^TARGETS=\(.*\)/\1: $1.tex/p' \ +-e '}' \ +-e 'd' \ +'$1.log' | $(SORT) | $(UNIQ) +endef + + +# Outputs all bibliography files to stdout. Arg 1 is the source stem, arg 2 is +# a list of targets for each dependency found. +# +# The script kills all lines that do not contain bibdata. Remaining lines have +# the \bibdata macro and delimiters removed to create a dependency list. A +# trailing comma is added, then all adjacent commas are collapsed into a single +# comma. Then commas are replaced with the string .bib[space], and the +# trailing space is killed off. Finally, all filename spaces are escaped. +# This produces a list of space-delimited .bib filenames, which is what the +# make dep file expects to see. +# +# Note that we give kpsewhich a bogus argument so that a failure of sed to +# produce output will not cause an error. +# +# $(call get-bibs,<aux file>,<targets>) +define get-bibs +$(SED) \ +-e '/^\\bibdata/!d' \ +-e 's/\\bibdata{\([^}]*\)}/\1,/' \ +-e 's/,\{2,\}/,/g' \ +-e 's/[[:space:]]/\\&/g' \ +-e 's/,/.bib /g' \ +-e 's/ \{1,\}$$//' \ +$1 | $(XARGS) $(KPSEWHICH) '#######' | \ +$(SED) \ +-e 's/^/$2: /' | \ +\$(SORT) | $(UNIQ) +endef + +# Makes a an aux file that only has stuff relevant to the target in it +# $(call make-auxtarget-file,<flattened-aux>,<new-aux>) +define make-auxtarget-file +$(SED) \ +-e '/^\\newlabel/!d' \ +$1 > $2 +endef + +# Makes an aux file that only has stuff relevant to the bbl in it +# $(call make-auxbbl-file,<flattened-aux>,<new-aux>) +define make-auxbbl-file +$(SED) \ +-e '/^\\newlabel/d' \ +$1 > $2 +endef + +# Makes a .gpi.d file from a .gpi file +# $(call make-gpi-d,<.gpi>,<.gpi.d>) +define make-gpi-d +$(ECHO) '# vim: ft=make' > $2; \ +$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \ +$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \ +$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GNUPLOT_OUTPUT_EXTENSION) gpi.d)) >> $2; \ +$(ECHO) 'endif' >> $2; +endef + +# Parse .gpi files for data and loaded dependencies, output to stdout +# +# The sed script here tries to be clever about obtaining valid +# filenames from the gpi file. It assumes that the plot command starts its own +# line, which is not too difficult a constraint to satisfy. +# +# This command script also generates 'include' directives for every 'load' +# command in the .gpi file. The load command must appear on a line by itself +# and the file it loads must have the suffix .gpi. If you don't want it to be +# compiled when running make graphics, then give it a suffix of ._include_.gpi. +# +# $(call get-gpi-deps,<gpi file>,<targets>) +define get-gpi-deps +$(SED) \ +-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \ +-e ' H' \ +-e ' /[^\\]$$/{' \ +-e ' s/.*//' \ +-e ' x' \ +-e ' s/\\\{0,1\}\n//g' \ +-e ' s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \ +-e ' s/[[:space:]]*\(['\''"][^'\''"]*['\''"]\)\{0,1\}[^,]*/\1/g' \ +-e ' s/,['\''"]-\{0,1\}['\''"]//g' \ +-e ' s/[,'\''"]\{1,\}/ /g' \ +-e ' s!.*!$2: &!' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e 's/^[[:space:]]*load[[:space:]]*['\''"]\([^'\''"]*\.gpi\)['\''"].*$$/-include \1.d/p' \ +-e 'd' \ +$1 +endef + +# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with +# recompilation. +# +# Note that we only ignore file not found errors for things that we know how to +# build, like graphics files. +# +# $(call colorize-latex-errors,<log file>) +define colorize-latex-errors +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/d' \ +-e '/Missing .begin.document/{' \ +-e ' h' \ +-e ' s/.*/Are you trying to build an include file?/' \ +-e ' x' \ +-e ' G' \ +-e '}' \ +-e '/ LaTeX Error: Cannot determine size/d' \ +-e 's/.* LaTeX Error .*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/Error: pdflatex (file .*/$(C_ERROR)& - try specifying it without an extension$(C_RESET)/p' \ +-e '/.*\*hyperref using.*driver \(.*\)\*.*/{' \ +-e ' s//\1/' \ +-e ' /^$(hyperref_driver_pattern)$$/!{' \ +-e ' s/.*//' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)--- Using incorrect driver for hyperref! ---$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)$(hyperref_driver_error)$(C_RESET)/' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e '/ LaTeX Error: Unknown graphics extension/{' \ +-e ' s/^/ /' \ +-e ' h' \ +-e ' s/.*/--- Graphics extension error:/' \ +-e ' G' \ +-e ' h' \ +-e ' s/.*/--- If you specified the extension explicitly in your .tex file, try removing it./' \ +-e ' H' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*//' \ +-e ' h' \ +-e ' b' \ +-e '}' \ +-e 's/.*\(\n\{0,\}! .*\)/$(C_ERROR)\1$(C_RESET)/p' \ +-e 'd' \ +$1 +endef + +# Colorize Makeindex errors +define colorize-makeindex-errors +$(SED) \ +-e '/^!! /{' \ +-e ' N' \ +-e ' s/^.*$$/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize epstopdf errors +# +# $(call colorize-epstopdf-errors,<log file>) +define colorize-epstopdf-errors +$(SED) \ +-e '/^Error:/,/^Execution stack:/{' \ +-e ' /^Execution stack:/d' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GNUplot errors +# +# $(call colorize-gnuplot-errors,<log file>) +define colorize-gnuplot-errors +$(SED) \ +-e '/, line [0-9]*:/!{' \ +-e ' H' \ +-e ' x' \ +-e ' s/.*\n\(.*\n.*\)$$/\1/' \ +-e ' x' \ +-e '}' \ +-e '/, line [0-9]*:/{' \ +-e ' H' \ +-e ' /unknown.*terminal type/{' \ +-e ' s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to 'eps'./' \ +-e ' H' \ +-e ' }' \ +-e ' /gpihead/{' \ +-e ' s/.*/--- This could be a Makefile bug - contact the maintainer./' \ +-e ' H' \ +-e ' }' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e '/^gnuplot>/,/^$$/{' \ +-e ' s/^gnuplot.*/$(C_ERROR)&/' \ +-e ' s/^$$/$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GraphViz errors +# +# $(call colorize-dot-errors,<log file>) +define colorize-dot-errors +$(SED) \ +-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \ +-e 'd' \ +'$1' +endef + +# Get all important .aux files from the top-level .aux file and merges them all +# into a single file, which it outputs to stdout. +# +# $(call flatten-aux,<toplevel aux>,<output file>) +define flatten-aux +$(SED) \ +-e '/\\@input{\(.*\)}/{' \ +-e 's//\1/' \ +-e 's![.:]!\\&!g' \ +-e 'h' \ +-e 's!.*!\\:\\\\@input{&}:{!' \ +-e 'p' \ +-e 'x' \ +-e 's/\\././g' \ +-e 's/.*/r &/p' \ +-e 's/.*/d/p' \ +-e 's/.*/}/p' \ +-e 'd' \ +-e '}' \ +-e 'd' \ +'$1' > "$1.$$$$.sed.make"; \ +$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \ +$(SED) \ +-e '/^\\relax/d' \ +-e '/^\\bibcite/d' \ +-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \ +"$1.$$$$.make" | $(SORT) > '$2'; \ +$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make) +endef + +# Generate pdf from postscript +# +# Note that we don't just call ps2pdf, since there are so many versions of that +# script on various systems. Instead, we call the postscript interpreter +# directly. +# +# $(call ps2pdf,infile,outfile,[embed fonts]) +define ps2pdf + $(GS) \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -q -dNOPAUSE -dBATCH \ + -sDEVICE=pdfwrite -sstdout=%stderr \ + '-sOutputFile=$2' \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -c .setpdfwrite \ + -f '$1' +endef + +# Colorize LaTeX output. +# This uses a neat trick from the Sed & Awk Book from O'Reilly: +# 1) If a line has a single ending paren, delete it to make a blank line (so +# that we catch the first error, which is not always preceded by a blank +# line). +# 2) Ensure that the last line of the file gets appended to the hold buffer, +# and blank it out to trigger end-of-paragraph logic below. +# 3) When encountering a blank line (LaTeX output helpfully breaks output on +# newlines) +# a) swap the hold buffer (containing the paragraph) into the pattern buffer (putting a blank line into the hold buffer), +# b) remove the newline at the beginning (don't ask), +# c) apply any colorizing substitutions necessary to ensure happiness. +# d) get the newline out of the hold buffer and append it +# e) profit! (print) +# 4) Anything not colorized is deleted, unless in verbose mode. +color_tex := \ + $(SED) \ + -e '$${' \ + -e ' /^$$/!{' \ + -e ' H' \ + -e ' s/.*//' \ + -e ' }' \ + -e '}' \ + -e '/^$$/!{' \ + -e ' H' \ + -e ' d' \ + -e '}' \ + -e '/^$$/{' \ + -e ' x' \ + -e ' s/^\n//' \ + -e ' /Output written on /{' \ + -e ' s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success! Wrote \2 to \1/' \ + -e ' s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \ + -e ' s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \ + -e ' s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' / *LaTeX Error:.*/{' \ + -e ' s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /.*Warning:.*/{' \ + -e ' s//$(C_WARNING)&$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Underfull.*/{' \ + -e ' s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Overfull.*/{' \ + -e ' s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + $(if $(VERBOSE),,-e ' d') \ + -e ' :end' \ + -e ' G' \ + -e '}' \ + +# Colorize BibTeX output. +color_bib := \ + $(SED) \ + -e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' -e 't' \ + -e '/---/,/^.[^:]/{' \ + -e ' H' \ + -e ' /^.[^:]/{' \ + -e ' x' \ + -e ' s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' p' \ + -e ' s/.*//' \ + -e ' h' \ + -e ' d' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \ + $(if $(VERBOSE),,-e 'd') + + +# Make beamer output big enough to print on a full page. Landscape doesn't +# seem to work correctly. +enlarge_beamer = $(PSNUP) -l -1 -W128mm -H96mm -pletter + +# $(call test-run-again,<source stem>) +test-run-again = $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log + +# This tests whether the build target commands should be run at all, from +# viewing the log file. +# $(call test-log-for-need-to-run,<source stem>) +define test-log-for-need-to-run +$(SED) \ +-e '/^No file $(call escape-dots,$1)\.aux\./d' \ +$1.log \ +| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$' +endef + +# LaTeX invocations +# +# $(call latex,<tex file>,[<extra LaTeX args>]) +run-latex = $(latex_build_program) --interaction=batchmode $(if $2,$2,) $1 > /dev/null + +# $(call latex-color-log,<LaTeX stem>) +latex-color-log = $(color_tex) $1.log + +# $(call run-makeindex,<input>,<output>,<log>,<extra flags>) +define run-makeindex +success=1; \ +if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $4 > /dev/null || $(EGREP) -q '^!!' $3; then \ + $(call colorize-makeindex-errors,$3); \ + $(RM) -f '$2'; \ + success=0; \ +fi; \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# This runs the given script to generate output, and it uses MAKE_RESTARTS to +# ensure that it never runs it more than once for a particular root make +# invocation. +# +# $(call run-script,<interpreter>,<input>,<output>) +define run-script +[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \ +restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \ +level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \ +if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \ + $(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \ + $1 '$2' '$3'; \ + $(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \ + $(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \ +fi +endef + +# BibTeX invocations +# +# $(call run-bibtex,<tex stem>) +run-bibtex = $(BIBTEX) $1 | $(color_bib) + + +# $(call convert-eps-to-pdf,<eps file>,<pdf file>,[gray]) +# Note that we don't use the --filter flag because it has trouble with bounding boxes that way. +define convert-eps-to-pdf +$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \ +$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \ +$(call colorize-epstopdf-errors,$1.log); +endef + +# $(call convert-gpi,<gpi file>,<output file>,[gray]) +# +define convert-gpi +$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps)' \ +$(if $(filter %.pdf,$2),fsize ,)$(call get-default,$(strip \ +$(firstword \ + $(shell \ + $(SED) \ + -e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' \ + -e 'd' \ + $1 $(strip $(gpi_global)) \ + ) \ +) \ +),$(if $(filter %.pdf,$2),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE))) \ +$(strip $(if $3,monochrome,$(if \ +$(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $< $(gpi_global)),\ +,color))) > $1head.make; \ +$(ECHO) 'set output "$2"' >> $1head.make; \ +$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \ +fnames='$1head.make $1';\ +$(if $(gpi_sed),\ + $(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \ + fnames=$1.temp.make;,\ +) \ +success=1; \ +if ! $(GNUPLOT) $$fnames 2>$1.log; then \ + $(call colorize-gnuplot-errors,$1.log); \ + success=0; \ +fi; \ +$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \ +$(call remove-temporary-files,$1head.make); \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# Creation of .eps files from .png files +# +# The intermediate step of PNM (using NetPBM) produces much nicer output than +# ImageMagick's "convert" binary. I couldn't get the right combination of +# flags to make it look nice, anyway. +# +# To handle gray scale conversion, we pipe things through ppmtopgm in the +# middle. +# +# $(call convert-png,<png file>,<eps file>) +define convert-png +$(PNGTOPNM) "$1" \ + $(if $3,| $(PPMTOPGM),) \ + | $(PNMTOPS) -noturn \ + > "$2" +endef + +# Creation of .eps files from .jpg files +# +# Thanks to brubakee for this solution. +# +# Uses Postscript level 2 to avoid file size bloat +# $(call convert-jpg,<jpg file>,<eps file>) +define convert-jpg +$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2' +endef + +# Creation of .eps files from .fig files +# $(call convert-fig,<fig file>,<output file>,[gray]) +convert-fig = $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2 + +# Creation of .pstex files from .fig files +# $(call convert-fig-pstex,<fig file>,<pstex file>) +convert-fig-pstex = $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1 + +# Creation of .pstex_t files from .fig files +# $(call convert-fig-pstex-t,<fig file>,<pstex file>,<pstex_t file>) +convert-fig-pstex-t = $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1 + +# Creation of .dot_t files from .dot files +# #(call convert-dot-tex,<dot file>,<dot_t file>) +convert-dot-tex = $(DOT2TEX) '$1' > '$2' + +# Converts svg files into .eps files +# +# $(call convert-svg,<svg file>,<eps file>,[gray]) +convert-svg = $(INKSCAPE) --export-eps='$2' '$1' + +# Converts xvg files into .eps files +# +# $(call convert-xvg,<xvg file>,<eps file>,[gray]) +convert-xvg = $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2' + +# Converts .eps.gz files into .eps files +# +# $(call convert-epsgz,<eps.gz file>,<eps file>,[gray]) +convert-epsgz = $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2' + +# Converts .eps files into .eps files (usually a no-op, but can make grayscale) +# +# $(call convert-eps,<in file>,<out file>,[gray]) +convert-eps = $(if $3,$(call kill-ps-color) $1 > $2) + +# The name of the file containing special postscript commands for grayscale +gray_eps_file := gray.eps.make + +# Changes sethsbcolor and setrgbcolor calls in postscript to always produce +# grayscale. In general, this is accomplished by writing new versions of those +# functions into the user dictionary space, which is looked up before the +# global or system dictionaries (userdict is one of the permanent dictionaries +# in postscript and is not read-only like systemdict). +# +# For setrgbcolor, the weighted average of the triple is computed and the +# triple is replaced with three copies of that average before the original +# procedure is called: .299R + .587G + .114B +# +# For sethsbcolor, the color is first converted to RGB, then to grayscale by +# the new setrgbcolor operator as described above. Why is this done? +# Because simply using the value component will tend to make pure colors +# white, a very undesirable thing. Pure blue should not translate to white, +# but to some level of gray. Conversion to RGB does the right thing. It's +# messy, but it works. +# +# From +# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB, +# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is +# as follows: +# +# Hi = int(floor(6 * H)) mod 6 +# f = 6 * H - Hi +# p = V(1-S) +# q = V(1-fS) +# t = V(1-(1-f)S) +# if Hi = 0: R G B <-- V t p +# if Hi = 1: R G B <-- q V p +# if Hi = 2: R G B <-- p V t +# if Hi = 3: R G B <-- p q V +# if Hi = 4: R G B <-- t p V +# if Hi = 5: R G B <-- V p q +# +# The messy stack-based implementation is below +# $(call create-gray-eps-file,filename) +define create-gray-eps-file +$(ECHO) -n -e '\ +/OLDRGB /setrgbcolor load def\n\ +/setrgbcolor {\n\ + .114 mul exch\n\ + .587 mul add exch\n\ + .299 mul add\n\ + dup dup\n\ + OLDRGB\n\ +} bind def\n\ +/OLDHSB /sethsbcolor load def\n\ +/sethsbcolor {\n\ + 2 index % H V S H\n\ + 6 mul floor cvi 6 mod % Hi V S H\n\ + 3 index % H Hi V S H\n\ + 6 mul % 6H Hi V S H\n\ + 1 index % Hi 6H Hi V S H\n\ + sub % f Hi V S H\n\ + 2 index 1 % 1 V f Hi V S H\n\ + 4 index % S 1 V f Hi V S H\n\ + sub mul % p f Hi V S H\n\ + 3 index 1 % 1 V p f Hi V S H\n\ + 6 index % S 1 V p f Hi V S H\n\ + 4 index % f S 1 V p f Hi V S H\n\ + mul sub mul % q p f Hi V S H\n\ + 4 index 1 1 % 1 1 V q p f Hi V S H\n\ + 5 index % f 1 1 V q p f Hi V S H\n\ + sub % (1-f) 1 V q p f Hi V S H\n\ + 8 index % S (1-f) 1 V q p f Hi V S H\n\ + mul sub mul % t q p f Hi V S H\n\ + 4 -1 roll pop % t q p Hi V S H\n\ + 7 -2 roll pop pop % t q p Hi V\n\ + 5 -2 roll % Hi V t q p\n\ + dup 0 eq\n\ + {1 index 3 index 6 index}\n\ + {\n\ + dup 1 eq\n\ + {3 index 2 index 6 index}\n\ + {\n\ + dup 2 eq\n\ + {4 index 2 index 4 index}\n\ + {\n\ + dup 3 eq\n\ + {4 index 4 index 3 index}\n\ + {\n\ + dup 4 eq\n\ + {2 index 5 index 3 index}\n\ + {\n\ + dup 5 eq\n\ + {1 index 5 index 5 index}\n\ + {0 0 0}\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse % B G R Hi V t q p\n\ + setrgbcolor\n\ + 5 {pop} repeat\n\ +} bind def\n'\ +> $1 +endef + +# This actually inserts the color-killing code into a postscript file +# $(call kill-ps-color) +define kill-ps-color +$(SED) -e '/%%EndComments/r $(gray_eps_file)' +endef + +# Converts graphviz .dot files into .eps files +# Grayscale is not directly supported by dot, so we pipe it through fig2dev in +# that case. +# $(call convert-dot,<dot file>,<eps file>,<log file>,[gray]) +define convert-dot +$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \ +$(call colorize-dot-errors,$3) +endef + +# Convert DVI to Postscript +# $(call make-ps,<dvi file>,<ps file>,<log file>,[<paper size>]) +make-ps = \ + $(DVIPS) -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \ + $(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1 + +# Convert Postscript to PDF +# $(call make-pdf,<ps file>,<pdf file>,<log file>,<embed file>) +make-pdf = \ + $(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1 + +# Display information about what is being done +# $(call echo-build,<input file>,<output file>,[<run number>]) +echo-build = $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)" +echo-graphic = $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)" +echo-dep = $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)" + +# Display a list of something +# $(call echo-list,<values>) +echo-list = for x in $1; do $(ECHO) "$$x"; done + +# +# DEFAULT TARGET +# + +.PHONY: all +all: $(default_pdf_targets) ; + +.PHONY: all-pdf +all-pdf: $(default_pdf_targets) ; + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-ps +all-ps: $(default_ps_targets) ; + +.PHONY: all-dvi +all-dvi: $(default_dvi_targets) ; +endif + +# +# VIEWING TARGET +# +.PHONY: show +show: all + $(QUIET)for x in $(default_pdf_targets); do \ + [ -e "$$x" ] && $(VIEW_PDF) $$x & \ + done + +# +# INCLUDES +# +source_includes := $(addsuffix .d,$(source_stems_to_include)) +graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include)) + +# Include only the dependencies used +ifneq "" "$(source_includes)" +include $(source_includes)$(call include-message,$(source_includes)) +endif +ifneq "" "$(graphic_includes)" +include $(graphic_includes)$(call include-message,$(graphic_includes)) +endif + +# +# MAIN TARGETS +# + +# Note that we don't just say %: %.pdf here - this can tend to mess up our +# includes, which detect what kind of file we are asking for. For example, +# asking to build foo.pdf is much different than asking to build foo when +# foo.gpi exists, because we look through all of the goals for *.pdf that +# matches *.gpi, then use that to determine which include files we need to +# build. +# +# Thus, we invoke make recursively with better arugments instead, restarting +# all of the appropriate machinery. +.PHONY: $(default_stems_ss) +$(default_stems_ss): %: %.pdf ; + +# This builds and displays the wanted file. +.PHONY: $(addsuffix ._show,$(stems_ssg)) +%._show: %.pdf + $(QUIET)$(VIEW_PDF) $< & + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_pdf_targets) +%.pdf: %.ps %.embed.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-pdf,$<,$@.temp,$@.log,$*.embed.make); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi + +.SECONDARY: $(all_ps_targets) +%.ps: %.dvi %.paper.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-ps,$<,$@.temp,$@.log,\ + $(firstword $(shell $(CAT) $*.paper.make))); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi +endif + +# Build the final target (dvi or pdf) file. This is a very tricky rule because +# of the way that latex runs multiple times, needs graphics after the first run +# (or maybe already has them), and relies on bibliographies or indices that may +# not exist. +# +# Check the log for fatal errors. If they exist, colorize and bail. +# +# Create the .auxtarget.cookie file. (Needed for next time if not present) +# +# If any of the following are true, we must rebuild at least one time: +# +# * the .bbl was recently rebuilt +# +# check a cookie, then delete it +# +# * any of several output files was created or changed: +# +# check $*.run.cookie, then delete it +# +# * the .aux file changed in a way that necessitates attention +# +# Note that if the .auxtarget.make file doesn't exist, this means +# that we are doing a clean build, so it doesn't figure into the +# test for running again. +# +# compare against .auxtarget.make +# +# move if different, remove if not +# +# * the .log file has errors or warnings requiring at least one more run +# +# We use a loop over a single item to simplify the process of breaking +# out when we find one of the conditions to be true. +# +# If we do NOT need to run latex here, then we move the $@.1st.make file +# over to $@ because the target file has already been built by the first +# dependency run and is valid. +# +# If we do, we delete that cookie file and do the normal multiple-runs +# routine. +# +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_dvi_targets) +endif +%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make + $(QUIET)\ + fatal=`$(call colorize-latex-errors,$*.log)`; \ + if [ x"$$fatal" != x"" ]; then \ + $(ECHO) "$$fatal"; \ + exit 1; \ + fi; \ + $(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \ + run=0; \ + for i in 1; do \ + if $(call test-exists,$*.bbl.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call test-exists,$*.run.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call \ + test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\ + then \ + run=1; \ + break; \ + fi; \ + if $(call test-log-for-need-to-run,$*); then \ + run=1; \ + break; \ + fi; \ + done; \ + $(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \ + $(MV) $*.auxtarget.cookie $*.auxtarget.make; \ + if [ x"$$run" = x"1" ]; then \ + $(call remove-files,$@.1st.make); \ + for i in 2 3 4 5; do \ + $(if $(findstring 3.79,$(MAKE_VERSION)),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\ + ); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \ + $(call test-run-again,$*) || break; \ + done; \ + else \ + $(MV) '$@.1st.make' '$@'; \ + fi; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + $(call latex-color-log,$*) + +# Build the .bbl file. When dependencies are included, this will (or will +# not!) depend on something.bib, which we detect, acting accordingly. The +# dependency creation also produces the %.auxbbl.make file. BibTeX is a bit +# finicky about what you call the actual files, but we can rest assured that if +# a .auxbbl.make file exists, then the .aux file does, as well. The +# .auxbbl.make file is a cookie indicating whether the .bbl needs to be +# rewritten. It only changes if the .aux file changes in ways relevant to .bbl +# creation. +# +# Note that we do NOT touch the .bbl file if there is no need to +# create/recreate it. We would like to leave existing files alone if they +# don't need to be changed, thus possibly avoiding a rebuild trigger. +%.bbl: %.auxbbl.make + $(QUIET)\ + $(if $(filter %.bib,$^),\ + $(call echo-build,$(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + if $(EGREP) -q 'bibstyle.(apacann|chcagoa|[^}]*annot)' '$*.aux'; then \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \ + $(if $(filter %.bib,$^),\ + $(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \ + $(call run-latex,$*); \ + fi + +# Create the index file - note that we do *not* depend on %.tex here, since +# that unnecessarily restricts the kinds of indices that we can build to those +# with exactly the same stem as the source file. Things like splitidx create +# idx files with other names. +# +# Therefore, we add the .tex dependency in the sourcestem.d file in the call to +# get index file dependencies from the logs. +%.ind: %.idx + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.ilg) + +# Create the glossary file +%.gls: %.glo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.glg,-s nomencl.ist) + +# Create the nomenclature file +%.nls: %.nlo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.nlg,-s nomencl.ist) + +# SCRIPTED LaTeX TARGETS +# +# Keep the generated .tex files around for debugging if needed. +.SECONDARY: $(all_tex_targets) + +%.tex:: %.tex.sh + $(QUIET)$(call run-script,$(SHELL),$<,$@) + +%.tex:: %.tex.py + $(QUIET)$(call run-script,$(PYTHON),$<,$@) + +%.tex:: %.tex.pl + $(QUIET)$(call run-script,$(PERL),$<,$@) + +%.tex:: %.rst $(RST_STYLE_FILE) + $(QUIET)\ + $(call run-script,$(RST2LATEX)\ + --documentoptions=letterpaper\ + $(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@) + +# +# GRAPHICS TARGETS +# +.PHONY: all-graphics +all-graphics: $(all_graphics_targets); + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-pstex +all-pstex: $(all_pstex_targets); +endif + +.PHONY: all-dot2tex +all-dot2tex: $(all_dot2tex_targets); + +.PHONY: show-graphics +show-graphics: all-graphics + $(VIEW_GRAPHICS) $(all_known_graphics) + +$(gray_eps_file): + $(QUIET)$(call echo-build,$^,$@) + $(QUIET)$(call create-gray-eps-file,$@) + +ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" +%.pdf: %.eps $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY)) + +ifeq "$(strip $(GNUPLOT_OUTPUT_EXTENSION))" "pdf" +%.pdf: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) +endif + +%.pdf: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +endif + +%.eps: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) + +%.eps: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +%.eps: %.dot $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY)) + +%.eps: %.xvg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-xvg,$<,$@,$(GRAY)) + +%.eps: %.svg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-svg,$<,$@,$(GRAY)) + +%.eps: %.jpg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-jpg,$<,$@,$(GRAY)) + +%.eps: %.png $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-png,$<,$@,$(GRAY)) + +%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-epsgz,$<,$@,$(GRAY)) + +%.pstex: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY)) + +%.pstex_t: %.fig %.pstex + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY)) + +%.dot_t: %.dot + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot-tex,$<,$@) + +# +# DEPENDENCY-RELATED TARGETS. +# + +# Generate all of the information needed to get dependencies +# As a side effect, this creates a .dvi or .pdf file (depending on the build +# strategy). We need to be sure to remove it if there are errors. Errors can +# take several forms and all of them are found within the log file: +# * There was a LaTeX error +# * A needed file was not found +# * Cross references need adjustment +# +# Behavior: +# This rule is responsible for generating the following: +# %.aux +# %.d +# %.aux.make +# %.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved) +# +# Steps: +# +# Run latex +# Move .pdf or .dvi somewhere else (make no judgements about success) +# Flatten the .aux file into another file +# Add source dependencies +# Add graphic dependencies +# Add bib dependencies +# +# Create cookies for various suffixes that may represent files that +# need to be read by LaTeX in order for it to function properly. +# +# Note that if some of the dependencies are discovered because they turn +# up missing in the log file, we really need the .d file to be reloaded. +# Adding a sleep command helps with this. Otherwise make is extremely +# nondeterministic, sometimes working, sometimes not. +# +# Usually we can force this by simply removing the generated pdf file and +# not creating a .1st.make file.. +# +%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex + $(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1) + $(QUIET)\ + $(call run-latex,$<,--recorder) || $(sh_true); \ + $(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \ + $(call die-on-dot2tex,$*.log); \ + $(call die-on-no-aux,$*); \ + $(call flatten-aux,$*.aux,$*.aux.make); \ + $(ECHO) "# vim: ft=make" > $*.d; \ + $(ECHO) ".PHONY: $*._graphics" >> $*.d; \ + $(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(ECHO) ".SECONDEXPANSION:" >> $*.d; \ + $(call get-graphics,$*) >> $*.d; \ + $(call get-log-index,$*,$(addprefix $*.,d aux aux.make)) >> $*.d; \ + $(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \ + $(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \ + $(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \ + for s in toc out lot lof lol nav; do \ + if [ -e "$*.$$s" ]; then \ + if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \ + $(TOUCH) $*.run.cookie; \ + fi; \ + $(CP) $*.$$s $*.$$s.make; \ + fi; \ + done + +# This is a cookie that is updated if the flattened aux file has changed in a +# way that affects the bibliography generation. +.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg)) +%.auxbbl.make: %.aux.make + $(QUIET)\ + $(call make-auxbbl-file,$<,$@.temp); \ + $(call replace-if-different-and-remove,$@.temp,$@) + +# Build a dependency file for .gpi files. These often plot data files that +# also reside in the directory, so if a data file changes, it's nice to know +# about it. This also handles loaded .gpi files, whose filename should have +# _include_. in it. +%.gpi.d: %.gpi + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-gpi-d,$<,$@) + +# Store the paper size for this document -- note that if beamer is used we set +# it to the special BEAMER paper size. We only do this, however, if the +# special comment exists, in which case we enlarge the output with psnup. +# +# The paper size is extracted from a documentclass attribute. +%.paper.make: %.tex + $(QUIET)$(SED) \ + -e '/\\documentclass/,/}/{' \ + -e ' s/%.*//' \ + -e ' H' \ + -e ' /}/{' \ + -e ' s/.*//' \ + -e ' x' \ + -e ' /\\documentclass/!d' \ + -e ' s/[\n[:space:]]*//g' \ + -e ' s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/^[^%]*%-//' \ + -e ' s/-%[^%]*$$//' \ + -e ' s/-%[^%]%-/ /g' \ + -e ' p' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e 'd' \ + $< > $@; \ + $(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \ + (\ + $(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \ + $(ECHO) "BEAMER" > $@ || \ + : > $@ \ + ) || $(sh_true) + +# Store embedding instructions for this document using a special comment +%.embed.make: %.tex + $(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \ + && $(ECHO) '' > $@ \ + || $(ECHO) '1' > $@; + +# +# HELPFUL PHONY TARGETS +# + +.PHONY: _all_programs +_all_programs: + $(QUIET)$(ECHO) "== All External Programs Used ==" + $(QUIET)$(call output-all-programs) + +.PHONY: _check_programs +_check_programs: + $(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO) + $(QUIET) \ + $(ECHO) hi; \ + allprogs=`\ + ($(call output-all-programs)) | \ + $(SED) \ + -e 's/^[[:space:]]*//' \ + -e '/^#/d' \ + -e 's/[[:space:]]*#.*//' \ + -e '/^=/s/[[:space:]]/_/g' \ + -e '/^[[:space:]]*$$/d' \ + -e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \ + `; \ + spaces=' '; \ + for p in $${allprogs}; do \ + case $$p in \ + =*) $(ECHO); $(ECHO) "$$p";; \ + *) \ + $(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \ + loc=`$(WHICH) $$p`; \ + if [ x"$$?" = x"0" ]; then \ + $(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \ + else \ + $(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \ + fi; \ + ;; \ + esac; \ + done + +.PHONY: _check_gpi_files +_check_gpi_files: + $(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \ + $(ECHO); \ + for f in $(files.gpi); do \ + result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \ + $(ECHO) -n "$$f: "; \ + if [ x"$$result" = x"" ]; then \ + $(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \ + else \ + $(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\ + $(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \ + fi; \ + done; \ + $(ECHO) + +.PHONY: _all_stems +_all_stems: + $(QUIET)$(ECHO) "== All Stems ==" + $(QUIET)$(call echo-list,$(sort $(default_stems_ss))) + +.PHONY: _includes +_includes: + $(QUIET)$(ECHO) "== Include Stems ==" + $(QUIET)$(ECHO) "=== Sources ===" + $(QUIET)$(call echo-list,$(sort $(source_includes))) + $(QUIET)$(ECHO) "=== Graphics ===" + $(QUIET)$(call echo-list,$(sort $(graphic_includes))) + +.PHONY: _all_sources +_all_sources: + $(QUIET)$(ECHO) "== All Sources ==" + $(QUIET)$(call echo-list,$(sort $(all_files.tex))) + +.PHONY: _dependency_graph +_dependency_graph: + $(QUIET)$(ECHO) "/* LaTeX Dependency Graph */" + $(QUIET)$(call output-dependency-graph) + +.PHONY: _show_dependency_graph +_show_dependency_graph: + $(QUIET)$(call output-dependency-graph,$(graph_stem).dot) + $(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot + $(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps + $(QUIET)$(call remove-temporary-files,$(graph_stem).*) + +.PHONY: _sources +_sources: + $(QUIET)$(ECHO) "== Sources ==" + $(QUIET)$(call echo-list,$(sort $(files.tex))) + +.PHONY: _scripts +_scripts: + $(QUIET)$(ECHO) "== Scripts ==" + $(QUIET)$(call echo-list,$(sort $(files_scripts))) + +.PHONY: _graphic_outputs +_graphic_outputs: + $(QUIET)$(ECHO) "== Graphic Outputs ==" + $(QUIET)$(call echo-list,$(sort $(all_graphics_targets))) + +.PHONY: _env +_env: +ifdef .VARIABLES + $(QUIET)$(ECHO) "== MAKE VARIABLES ==" + $(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)')) +endif + $(QUIET)$(ECHO) "== ENVIRONMENT ==" + $(QUIET)$(ENV) + +# +# CLEAN TARGETS +# +# clean-generated is somewhat unique - it relies on the .fls file being +# properly built so that it can determine which of the files was generated, and +# which was not. Expect it to silently fail if the .fls file is missing. +# +# This is used to, e.g., clean up index files that are generated by the LaTeX. +.PHONY: clean-generated +clean-generated: + $(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\ + $(shell $(call get-generated-names,$e)))) + +.PHONY: clean-deps +clean-deps: + $(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie) + +.PHONY: clean-tex +clean-tex: clean-deps + $(QUIET)$(call clean-files,$(rm_tex)) + +.PHONY: clean-graphics +# TODO: This *always* deletes pstex files, even if they were not generated by +# anything.... In other words, if you create a pstex and pstex_t pair by hand +# an drop them in here without the generating fig file, they will be deleted +# and you won't get them back. It's a hack put in here because I'm not sure we +# even want to keep pstex functionality, so my motivation is not terribly high +# for doing it right. +clean-graphics: + $(QUIET)$(call clean-files,$(all_graphics_targets) $(intermediate_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t) + +.PHONY: clean-backups +clean-backups: + $(QUIET)$(call clean-files,$(backup_patterns) *.temp) + +.PHONY: clean-auxiliary +clean-auxiliary: + $(QUIET)$(call clean-files,$(graph_stem).*) + +.PHONY: clean-nographics +clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ; + +.PHONY: clean +clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary + +# +# HELP TARGETS +# + +.PHONY: help +help: + $(help_text) + +.PHONY: version +version: + $(QUIET)\ + $(ECHO) "$(fileinfo) Version $(version)"; \ + $(ECHO) "by $(author)"; \ + +# +# HELP TEXT +# + +define help_text +# $(fileinfo) Version $(version) +# +# by $(author) +# +# Generates a number of possible output files from a LaTeX document and its +# various dependencies. Handles .bib files, \include and \input, and .eps +# graphics. All dependencies are handled automatically by running LaTeX over +# the source. +# +# USAGE: +# +# make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] <target(s)> +# +# STANDARD OPTIONS: +# GRAY: +# Setting this variable forces all recompiled graphics to be grayscale. +# It is useful when creating a document for printing. The default is +# to allow colors. Note that it only changes graphics that need to be +# rebuilt! It is usually a good idea to do a 'make clean' first. +# +# VERBOSE: +# This turns off all @ prefixes for commands invoked by make. Thus, +# you get to see all of the gory details of what is going on. +# +# SHELL_DEBUG: +# This enables the -x option for sh, meaning that everything it does is +# echoed to stderr. This is particularly useful for debugging +# what is going on in $$(shell ...) invocations. One of my favorite +# debugging tricks is to do this: +# +# make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less +# +# STANDARD AUXILIARY FILES: +# +# Makefile.ini +# +# This file can contain variable declarations that override various +# aspects of the makefile. For example, one might specify +# +# neverclean := *.pdf *.ps +# onlysources.tex := main.tex +# LATEX_COLOR_WARNING := 'bold red uline' +# +# And this would override the neverclean setting to ensure that pdf +# and ps files always remain behind, set the makefile to treat all +# .tex files that are not "main.tex" as includes (and therefore not +# default targets). It also changes the LaTeX warning output to be +# red, bold, and underlined. +# +# There are numerous variables in this file that can be overridden in +# this way. Search for '?=' to find them all. +# +# Also, you can put arbitrary targets into it if, for example, you +# want your source built from something else, e.g.: +# +# generated.tex: generating_script.weird_lang depA depB +# ./generating_script.weird_lang > $$@ +# +# Note that if you are not careful, you can override the default +# target (what happens when you type "make" without arguments), so if +# you do use Makefile.ini, you probably want to start it with +# something like the following line: +# +# default: all +# +# Since the first target in any makefile is automatically the default, +# and the makefile already has a sensible "all" target, this will do +# what you want. +# +# The Makefile.ini is imported before *anything else* is done, so go +# wild with your ideas for changes to this makefile in there. It +# makes it easy to test them before submitting patches. +# +# STANDARD ENVIRONMENT VARIABLES: +# +# LATEX_COLOR_WARNING '$(LATEX_COLOR_WARNING)' +# LATEX_COLOR_ERROR '$(LATEX_COLOR_ERROR)' +# LATEX_COLOR_UNDERFULL '$(LATEX_COLOR_UNDERFULL)' +# LATEX_COLOR_OVERFULL '$(LATEX_COLOR_OVERFULL)' +# LATEX_COLOR_PAGES '$(LATEX_COLOR_PAGES)' +# LATEX_COLOR_BUILD '$(LATEX_COLOR_BUILD)' +# LATEX_COLOR_GRAPHIC '$(LATEX_COLOR_GRAPHIC)' +# LATEX_COLOR_DEP '$(LATEX_COLOR_DEP)' +# LATEX_COLOR_SUCCESS '$(LATEX_COLOR_SUCCESS)' +# LATEX_COLOR_FAILURE '$(LATEX_COLOR_FAILURE)' +# +# These may be redefined in your environment to be any of the following: +# +# black +# red +# green +# yellow +# blue +# magenta +# cyan +# white +# +# Bold or underline may be used, as well, either alone or in combination +# with colors: +# +# bold +# uline +# +# Order is not important. You may want, for example, to specify: +# +# export LATEX_COLOR_SUCCESS='bold blue uline' +# +# in your .bashrc file. I don't know why, but you may want to. +# +# STANDARD TARGETS: +# +# all: +# Make all possible documents in this directory. The documents are +# determined by scanning for .tex and .tex.sh (described in more detail +# later) and omitting any file that ends in ._include_.tex or +# ._nobuild_.tex. The output is a set of .pdf files. +# +# If you wish to omit files without naming them with the special +# underscore names, set the following near the top of the Makefile, +# or (this is recommended) within a Makefile.ini in the same directory: +# +# includes.tex := file1.tex file2.tex +# +# This will cause the files listed to be considered as include files. +# +# If you have only few source files, you can set +# +# onlysources.tex := main.tex +# +# This will cause only the source files listed to be considered in +# dependency detection. All other .tex files will be considered as +# include files. Note that these options work for *any* source type, +# so you could do something similar with includes.gpi, for example. +# Note that this works for *any valid source* target. All of the +# onlysources.* variables are commented out in the shipping version of +# this file, so it does the right thing when they simply don't exist. +# The comments are purely documentation. If you know, for example, that +# file.mycoolformat is supported by this Makefile, but don't see the +# "onlysources.mycoolformat" declared in the comments, that doesn't mean +# you can't use it. Go ahead and set "onlysources.mycoolformat" and it +# should do the right thing. +# +# show: +# Builds and displays all documents in this directory. It uses the +# environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to +# do its work. +# +# all-graphics: +# Make all of the graphics in this directory. +# +# all-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into pstex and pstex_t files. Gray DOES NOT WORK. +# +# all-gray-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into grayscale pstex and pstex_t files. +# +# all-dot2tex: +# Build all dot files into tex files. +# +# show-graphics: +# Builds and displays all graphics in this directory. Uses the +# environment-overridable value of VIEW_GRAPHICS (currently +# $(VIEW_GRAPHICS)) to do its work. +# +# clean: +# Remove ALL generated files, leaving only source intact. +# This will *always* skip files mentioned in the "neverclean" variable, +# either in this file or specified in Makefile.ini: +# +# neverclean := *.pdf *.ps +# +# The neverclean variable works on all "clean" targets below, as well. +# +# clean-graphics: +# Remove all generated graphics files. +# +# clean-backups: +# Remove all backup files: $(backup_patterns) +# (XFig and other editors have a nasty habit of leaving them around) +# Also removes Makefile-generated .temp files +# +# clean-tex: +# Remove all files generated from LaTeX invocations except dependency +# information. Leaves graphics alone. +# +# clean-deps: +# Removes all auto-generated dependency information. +# +# clean-auxiliary: +# Removes extra files created by various targets (like the dependency +# graph output). +# +# clean-nographics: +# Cleans everything *except* the graphics files. +# +# help: +# This help text. +# +# version: +# Version information about this LaTeX makefile. +# +# DEBUG TARGETS: +# +# _all_programs: +# A list of the programs used by this makefile. +# +# _check_programs: +# Checks your system for the needed software and reports what it finds. +# +# _check_gpi_files: +# Checks the .gpi files in the current directory for common errors, such +# as specification of the terminal or output file inside of the gpi file +# itself. +# +# _dependency_graph: +# Outputs a .dot file to stdout that represents a graph of LaTeX +# dependencies. To see it, use the _show_dependency_graph target or +# direct the output to a file, run dot on it, and view the output, e.g.: +# +# make _dependency_graph > graph.dot +# dot -T ps -o graph.eps graph.dot +# gv graph.eps +# +# _show_dependency_graph: +# Makes viewing the graph simple: extracts, builds and displays the +# dependency graph given in the _dependency_graph target using the value +# of the environment-overridable VIEW_POSTSCRIPT variable (currently set +# to $(VIEW_POSTSCRIPT)). The postscript viewer is used because it +# makes it easier to zoom in on the graph, a critical ability for +# something so dense and mysterious. +# +# _all_sources: +# List all .tex files in this directory. +# +# _sources: +# Print out a list of all compilable sources in this directory. This is +# useful for determining what make thinks it will be using as the +# primary source for 'make all'. +# +# _scripts: +# Print out a list of scripts that make knows can be used to generate +# .tex files (described later). +# +# _all_stems: +# Print a list of stems. These represent bare targets that can be +# executed. Listing <stem> as a bare target will produce <stem>.pdf. +# +# _includes: +# A list of .d files that would be included in this run if _includes +# weren't specified. This target may be used alone or in conjunction +# with other targets. +# +# _graphic_outputs: +# A list of all generated .eps files +# +# _env: +# A list of environment variables and their values. If supported by +# your version of make, also a list of variables known to make. +# +# FILE TARGETS: +# +# %, %.pdf: +# Build a PDF file from the corresponding %.tex file. +# +# If BUILD_STRATEGY=pdflatex, then this builds the pdf directly. +# Otherwise, it uses this old-school but effective approach: +# +# latex -> dvips -> ps2pdf +# +# The BUILD_STRATEGY can be overridden in Makefile.ini in the same +# directory. The default is pdflatex. +# +# Reasons for using latex -> dvips include the "psfrag" package, and the +# generation of postscript instead of PDF. Arguments for using pdflatex +# include "new and shiny" and "better supported." I can't argue with +# either of those, and supporting them both didn't turn out to be that +# difficult, so there you have it. Choices. +# +# %._show: +# A phony target that builds the pdf file and then displays it using the +# environment-overridable value of VIEW_PDF ($(VIEW_PDF)). +# +# %._graphics: +# A phony target that generates all graphics on which %.pdf (or %.dvi) +# depends. +# +# %.ps (only for BUILD_STRATEGY=latex): +# Build a Postscript file from the corresponding %.tex file. +# This is done using dvips. Paper size is automatically +# extracted from the declaration +# +# \documentclass[<something>paper] +# +# or it is the system default. +# +# If using beamer (an excellent presentation class), the paper +# size is ignored. More on this later. +# +# %.dvi (only for BUILD_STRATEGY=latex): +# Build the DVI file from the corresponding %.tex file. +# +# %.ind: +# Build the index for this %.tex file. +# +# %.gls: +# Build the nomenclature glossary for this %.tex file. +# +# %.nls: +# Build the (newer) nomenclature file for this %.tex file. +# +# %.eps: +# Build an eps file from one of the following file types: +# +# .dot : graphviz +# .gpi : gnuplot +# .fig : xfig +# .xvg : xmgrace +# .svg : scalable vector graphics (goes through inkscape) +# .png : png (goes through NetPBM) +# .jpg : jpeg (goes through ImageMagick) +# .eps.gz : gzipped eps +# +# The behavior of this makefile with each type is described in +# its own section below. +# +# %.pstex{,_t} (only for BUILD_STRATEGY=latex): +# Build a .pstex_t file from a .fig file. +# +# FEATURES: +# +# Optional Binary Directory: +# If you create the _out_ directory in the same place as the makefile, +# it will automatically be used as a dumping ground for .pdf (or .dvi, +# .ps, and .pdf) output files. +# +# Alternatively, you can set the BINARY_TARGET_DIR variable, either as a +# make argument or in Makefile.ini, to point to your directory of +# choice. Note that no pathname wildcard expansion is done in the +# makefile, so make sure that the path is complete before going in +# there. E.g., if you want to specify something in your home directory, +# use $$HOME/ instead of ~/ so that the shell expands it before it gets +# to the makefile. +# +# External Program Dependencies: +# Every external program used by the makefile is represented by an +# ALLCAPS variable at the top of this file. This should allow you to +# make judgments about whether your system supports the use of this +# makefile. The list is available in the ALL_PROGRAMS variable and, +# provided that you are using GNU make 3.80 or later (or you haven't +# renamed this file to something weird like "mylatexmakefile" and like +# invoking it with make -f) can be viewed using +# +# make _all_programs +# +# Additionally, the availability of these programs can be checked +# automatically for you by running +# +# make _check_programs +# +# The programs are categorized according to how important they are and +# what function they perform to help you decide which ones you really +# need. +# +# Colorized Output: +# The output of commands is colorized to highlight things that are often +# important to developers. This includes {underfull,overfull} +# {h,v}boxes, general LaTeX Errors, each stage of document building, and +# the number of pages in the final document. The colors are obtained +# using 'tput', so colorization should work pretty well on any terminal. +# +# The colors can be customized very simply by setting any of the +# LATEX_COLOR_<CONTEXT> variables in your environment (see above). +# +# Predecessors to TeX Files: +# Given a target <target>, if no <target>.tex file exists but a +# corresponding script or predecessor file exists, then appropriate +# action will be taken to generate the tex file. +# +# Currently supported script or predecessor languages are: +# +# sh: %.tex.sh +# perl: %.tex.pl +# python: %.tex.py +# +# Calls the script using the appropriate interpreter, assuming that +# its output is a .tex file. +# +# The script is called thus: +# +# <interpreter> <script file name> <target tex file> +# +# and therefore sees exactly one parameter: the name of the .tex +# file that it is to create. +# +# Why does this feature exist? I ran into this while working on +# my paper dissertation. I wrote a huge bash script that used a +# lot of sed to bring together existing papers in LaTeX. It +# would have been nice had I had something like this to make my +# life easier, since as it stands I have to run the script and +# then build the document with make. This feature provides hooks +# for complicated stuff that you may want to do, but that I have +# not considered. It should work fine with included dependencies, +# too. +# +# Scripts are run every time make is invoked. Some trickery is +# employed to make sure that multiple restarts of make don't cause +# them to be run again. +# +# reST: %.rst +# +# Runs the reST to LaTeX converter to generate a .tex file +# If it finds a file names _rststyle_._include_.tex, uses it as +# the "stylesheet" option to rst2latex. +# +# Note that this does not track sub-dependencies in rst files. It +# assumes that the top-level rst file will change if you want a +# rebuild. +# +# Dependencies: +# +# In general, dependencies are extracted directly from LaTeX output on +# your document. This includes +# +# * Bibliography information +# * \include or \input files (honoring \includeonly, too) +# * Graphics files inserted by the graphicx package +# +# Where possible, all of these are built correctly and automatically. +# In the case of graphics files, these are generated from the following +# file types: +# +# GraphViz: .dot +# GNUPlot: .gpi +# XFig: .fig +# XMgrace: .xvg +# SVG: .svg +# PNG: .png +# JPEG: .jpg +# GZipped EPS: .eps.gz +# +# If the file exists as a .eps already, it is merely used (and will not +# be deleted by 'clean'!). +# +# LaTeX and BibTeX are invoked correctly and the "Rerun to get +# cross-references right" warning is heeded a reasonable number of +# times. In my experience this is enough for even the most troublesome +# documents, but it can be easily changed (if LaTeX has to be run after +# BibTeX more than three times, it is likely that something is moving +# back and forth between pages, and no amount of LaTeXing will fix +# that). +# +# \includeonly is honored by this system, so files that are not +# specified there will not trigger a rebuild when changed. +# +# Beamer: +# A special TeX source comment is recognized by this makefile (only when +# BUILD_STRATEGY=latex, since this invokes psnup): +# +# %%[[:space:]]*BEAMER[[:space:]]*LARGE +# +# The presence of this comment forces the output of dvips through psnup +# to enlarge beamer slides to take up an entire letter-sized page. This +# is particularly useful when printing transparencies or paper versions +# of the slides. For some reason landscape orientation doesn't appear +# to work, though. +# +# If you want to put multiple slides on a page, use this option and then +# print using mpage, a2ps, or psnup to consolidate slides. My personal +# favorite is a2ps, but your mileage may vary. +# +# When beamer is the document class, dvips does NOT receive a paper size +# command line attribute, since beamer does special things with sizes. +# +# GNUPlot Graphics: +# When creating a .gpi file, DO NOT INCLUDE the "set terminal" or "set +# output" commands! The makefile will include terminal information for +# you. Besides being unnecessary and potentially harmful, including the +# terminal definition in the .gpi file makes it harder for you, the one +# writing the document, to preview your graphics, e.g., with +# +# gnuplot -persist myfile.gpi +# +# so don't do specify a terminal or an output file in your .gpi files. +# +# When building a gpi file into an eps file, there are several features +# available to the document designer: +# +# Global Header: +# The makefile searches for the files in the variable GNUPLOT_GLOBAL +# in order: +# +# ($(GNUPLOT_GLOBAL)) +# +# Only the first found is used. All .gpi files in the directory are +# treated as though the contents of GNUPLOT_GLOBAL were directly +# included at the top of the file. +# +# NOTE: This includes special comments! (see below) +# +# Font Size: +# A special comment in a .gpi file (or a globally included file) of +# the form +# +# ## FONTSIZE=<number> +# +# will change the font size of the GPI output. If font size is +# specified in both the global file and the GPI file, the +# specification in the individual GPI file is used. +# +# Grayscale Output: +# GNUplot files also support a special comment to force them to be +# output in grayscale *no matter what*: +# +# ## GRAY +# +# This is not generally advisable, since you can always create a +# grayscale document using the forms mentioned above. But, if your +# plot simply must be grayscale even in a document that allows +# colors, this is how you do it. +# +# XFig Graphics: +# No special handling is done with XFig, except when a global +# grayscale method is used, e.g. +# +# make GRAY=1 document +# +# In these cases the .eps files is created using the -N switch to +# fig2dev to turn off color output. (Only works with eps, not pstex +# output) +# +# GraphVis Graphics: +# Color settings are simply ignored here. The 'dot' program is used +# to transform a .dot file into a .eps file. +# +# If you want, you can use the dot2tex program to convert dot files +# to tex graphics. The default is to just call dot2tex with no +# arguments, but you can change the DOT2TEX definition to include +# options as needed (in your Makefile.ini). +# +# Note that, as with pstex, the makefile cannot use latex's own +# output to discover all missing dot_t (output) files, since anytime +# TeX includes TeX, it has to bail when it can't find the include +# file. It can therefore only stop on the first missing file it +# discovers, and we can't get a large list of them out easily. +# +# So, the makefile errors out if it's missing an included dot_t +# file, then prompts the user to run this command manually: +# +# make all-dot2tex +# +# GZipped EPS Graphics: +# +# A .eps.gz file is sometimes a nice thing to have. EPS files can get +# very large, especially when created from bitmaps (don't do this if you +# don't have to). This makefile will unzip them (not in place) to +# create the appropriate EPS file. +# +endef + +# +# DEPENDENCY CHART: +# +#digraph "g" { +# rankdir=TB +# size="9,9" +# edge [fontsize=12 weight=10] +# node [shape=box fontsize=14 style=rounded] +# +# eps [ +# shape=Mrecord +# label="{{<gpi> GNUplot|<epsgz> GZip|<dot> Dot|<fig> XFig}|<eps> eps}" +# ] +# pstex [label="%.pstex"] +# pstex_t [label="%.pstex_t"] +# tex_outputs [shape=point] +# extra_tex_files [shape=point] +# gpi_data [label="<data>"] +# gpi_includes [label="_include_.gpi"] +# aux [label="%.aux"] +# fls [label="%.fls"] +# idx [label="%.idx"] +# glo [label="%.glo"] +# ind [label="%.ind"] +# log [label="%.log"] +# tex_sh [label="%.tex.sh"] +# rst [label="%.rst"] +# tex [ +# shape=record +# label="<tex> %.tex|<include> _include_.tex" +# ] +# include_aux [label="_include_.aux"] +# file_bib [label=".bib"] +# bbl [label="%.bbl"] +# dvi [label="%.dvi"] +# ps [label="%.ps"] +# pdf [label="%.pdf"] +# fig [label=".fig"] +# dot [label=".dot"] +# gpi [label=".gpi"] +# eps_gz [label=".eps.gz"] +# +# gpi_files [shape=point] +# +# rst -> tex:tex [label="reST"] +# tex_sh -> tex:tex [label="sh"] +# tex_pl -> tex:tex [label="perl"] +# tex_py -> tex:tex [label="python"] +# tex -> tex_outputs [label="latex"] +# tex_outputs -> dvi +# tex_outputs -> aux +# tex_outputs -> log +# tex_outputs -> fls +# tex_outputs -> idx +# tex_outputs -> include_aux +# aux -> bbl [label="bibtex"] +# file_bib -> bbl [label="bibtex"] +# idx -> ind [label="makeindex"] +# glo -> gls [label="makeindex"] +# nlo -> nls [label="makeindex"] +# gls -> extra_tex_files +# nls -> extra_tex_files +# ind -> extra_tex_files +# bbl -> extra_tex_files +# eps -> extra_tex_files +# extra_tex_files -> dvi [label="latex"] +# gpi_files -> eps:gpi [label="gnuplot"] +# gpi -> gpi_files +# gpi_data -> gpi_files +# gpi_includes -> gpi_files +# eps_gz -> eps:epsgz [label="gunzip"] +# fig -> eps:fig [label="fig2dev"] +# fig -> pstex [label="fig2dev"] +# fig -> pstex_t [label="fig2dev"] +# pstex -> pstex_t [label="fig2dev"] +# dot -> eps:dot [label="dot"] +# dvi -> ps [label="dvips"] +# include_aux -> bbl [label="bibtex"] +# ps -> pdf [label="ps2pdf"] +# +# edge [ color=blue label="" style=dotted weight=1 fontcolor=blue] +# fls -> tex:include [label="INPUT: *.tex"] +# fls -> file_bib [label="INPUT: *.aux"] +# aux -> file_bib [label="\\bibdata{...}"] +# include_aux -> file_bib [label="\\bibdata{...}"] +# log -> gpi [label="Graphic file"] +# log -> fig [label="Graphic file"] +# log -> eps_gz [label="Graphic file"] +# log -> dot [label="Graphic file"] +# log -> idx [label="No file *.ind"] +# log -> glo [label="No file *.gls"] +# log -> nlo [label="No file *.nls"] +# gpi -> gpi_data [label="plot '...'"] +# gpi -> gpi_includes [label="load '...'"] +# tex:tex -> ps [label="paper"] +# tex:tex -> pdf [label="embedding"] +#} + +# +# DEPENDENCY CHART SCRIPT +# +# $(call output_dependency_graph,[<output file>]) +define output-dependency-graph + if [ -f '$(this_file)' ]; then \ + $(SED) \ + -e '/^[[:space:]]*#[[:space:]]*DEPENDENCY CHART:/,/^$$/!d' \ + -e '/DEPENDENCY CHART/d' \ + -e '/^$$/d' \ + -e 's/^[[:space:]]*#//' \ + $(this_file) $(if $1,> '$1',); \ + else \ + $(ECHO) "Cannot determine the name of this makefile."; \ + fi +endef +# vim: noet sts=0 sw=8 ts=8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/adding_new_languages.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,23 @@ +\subsection{Adding new Languages} +The GNV-Server has the possibility to handle different languages. It is +necessary to configure those. + +The configuration is divided into three steps: + +\begin{enumerate} + \item Adding the required resource-file to the GNV-Server + \\{\tt /gnv-artifacts/src/main/resources/lang } + \item Adding the required resource-file to the GNV-Web-Client + {\tt /gnv/src/main/resources} + \item Publishing the new language to the GNV-Server by adding the + language-code to the file + \\{\tt /gnv-artifacts/src/main/resources/lang/lang.conf} +\end{enumerate} + +To generate the resource-files it might be helpful to copy an existing one and +translate its content into the desired language. + +Please note that you have to re-package the modules gnv and gnv-artifacts to +enable the new languages - currently, only german and english are provided. +If you want to provide further languages you have to change the toggle-mechanism +for switching the language in the web-client.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/administering_artifact-server.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,103 @@ +\subsection{Configuring and Running the Artifact-Server} + +This section describes the possibilities to configure the +artifact-server. The following properties do affect mostly technical +funtions of the server. + +This section describes the possibilities in a kind of a reference +manual. Information for the process of installing and integration can be +found in the Administration Manual of the GNV-System. +The following elements are covered here: + +\begin{lstlisting} +artifact-database +|-- geo-backend # pointing to database connection, SQL configuration +|-- rest-server # port, listen addresses +|-- database # internal database storing artifacts +|-- ehcache # pointing to cache configuration +|-- cleaner # time of cleanups FIXME +`-- export-secret # signing project files +\end{lstlisting} + +\paragraph*{geo-backend} +{\em Function}: The geo-backend encapsulates the logic for accessing the +database backend. At this time, the use of ESRI ArcSDE 9.3.1 is supported. + +At least, the following options for configuring the element {\tt +geo-backend} are required: + +\begin{itemize} + \item {\tt backend-configuration}: path to the file defining the + connection properties to the database backend, preconfigured to {\tt + arcsdeconnection.properties}. Normally, just the + connection parameters have to de adapted. Further information can be + found in the file itself. + + \item {\tt query-configuration}: path to the file listing a SQL statements,\\ + preconfigured to \texttt{queries.properties}. Further information can be + found at chapter~\ref{ref:queries.properties}, + p.~\ref{ref:queries.properties} +\end{itemize} + + +\paragraph*{rest-server} +{\em Function}: The REST-Server needs a HTTP binding configured via: + +\begin{itemize} + \item {\tt port}: port the server should listen on. Preconfigured on + 8181. + \item {\tt listen}: for security reason the accessibility can be + limited. The parameter needs an IP-address or a hostname. + Accessibility to the entire network can be done by + removing/commenting out of the element. +\end{itemize} + + +\paragraph*{database} +{\em Function}: The internal database of the system for storing +artifacts representing a parameterisation of a client session. So fare, +the filebased database H2 is supported. Connecting to other backends can +be provided. + +\begin{itemize} + \item {\tt user}: database user for connecting to the + artifact-database. In new installations "SA" is used. + \item {\tt password}: password of the database user for + authentification. + \item {\tt url}: Connection URL to the database-files. + In the preconfiguration, they are written to \\ + \verb| ${artifacts.config.dir}/../artifactdb| +\end{itemize} + + +\paragraph*{ehcache} +{\em Function}: The cache for storing result sets of the database. The +configuration in {\tt ehcache.xml} should not been adapted. Changing has +at least consequence to the system requirements. + +\begin{itemize} + \item {\tt configuration}: the path to the configuration file. \\ + Preconfigured: \verb+${artifacts.config.dir}/ehcache.xml+ +\end{itemize} + + +\paragraph*{cleaner} +{\em Function}: Process for cleaning up the artifact-database. Artifacts +have a time-to-life. Died artifacts need to be removed. Changing the +interval has consequences to the size of the database. + +\begin{itemize} + \item {\tt sleep-time}: Time interval in milliseconds between 2 + checks. Preconfigured: 60000 (1 minute) +\end{itemize} + + +\paragraph*{export-secret} +{\em Function}: Signature for signing project files that were created by +the artifact-server instance. Before reading a projectfile the server +checks the file against that signature/check sum. + +{\bf Be aware, changing the signature of updating the source code of +artifacts will prevent of using existing project-files.} + +For setting up the secret, c.f. the tips in the admin manual.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/config-manual.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,206 @@ +\documentclass[12pt]{scrartcl} + +%---------------------------------------------- +% Load packages + +\usepackage{a4} +\usepackage{times} +\usepackage[latin1]{inputenc} +\usepackage{fancyhdr} +%\usepackage{german} +%\usepackage[marvosym]{eurofont} +%\usepackage[all, light]{draftcopy} +%\usepackage{supertabular} +%\usepackage{colortbl} +%\usepackage{epsf} +\usepackage{graphicx} +\usepackage{lastpage} +%\usepackage{proposal} +\usepackage{listings} +\usepackage[hyperindex=true, bookmarks=true, breaklinks=true, +colorlinks=true, linkcolor=red,bookmarksopen]{hyperref} + +%---------------------------------------------- +% Document DATE and VERSION +% set these values when releasing a new version + +\newcommand{\documentdate}{May 12th, 2010} +\newcommand{\documentversion}{1.0} +\newcommand{\documentrevision}{FIXME SVN REV} +\newcommand{\documentID}{config-manual.tex} +%---------------------------------------------- + +%---------------------------------------------- +% Document TITLE +\newcommand{\documenttitle}{Generic Viewer -- Reference and Configuration} + + +%---------------------------------------------- +% Some parameters for layouting + +\paperwidth=21cm +\hoffset=-0.54cm +\textwidth=17cm + +\paperheight=29.7cm +\voffset=-1.5cm +\topmargin=0cm +\headheight=1cm +\textheight=24cm + +\setcounter{secnumdepth}{4} +\setcounter{tocdepth}{4} + +%---------------------------------------------- + +\begin{document} + +\lstset{ % +language=sh, +basicstyle=\ttfamily, % the size of the fonts that are used for the code +numbers=left, % where to put the line-numbers +numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers +numbersep=5pt, % how far the line-numbers are from the code +% backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color} +showspaces=false, % show spaces adding particular underscores +showstringspaces=false, % underline spaces within strings +showtabs=false, % show tabs within strings adding particular underscores +frame=single, % adds a frame around the code +tabsize=2, % sets default tabsize to 2 spaces +captionpos=b, % sets the caption-position to bottom +breaklines=true, % sets automatic line breaking +breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace +title=\lstname, % show the filename of files included with \lstinputlisting; also try caption instead of title +escapeinside={\%*}{*)} % if you want to add a comment within your code +% morekeywords={*,...} % if you want to add more keywords to the set +} + +%----------------------------------- +% HEADER/FOOTER DEFINITION + +% for some pages latex switches back to pagestyle plain :-( +\fancypagestyle{plain}{% + \fancyhf{} % clear all header and footer fields + \fancyhead[LO,RE]{\footnotesize \documenttitle\\ \leftmark} + \fancyfoot[RO,LE]{\footnotesize Intevation GmbH} % Author + \fancyfoot[CO,CE]{\footnotesize \thepage/\pageref{LastPage}} + \fancyfoot[LO,RE]{\footnotesize \documentdate + \\\documentID} + \renewcommand{\footrulewidth}{0.4pt} +} + +% and now define pagestyle fancy +\fancyhead{} % clear all fields +\fancyhead[LO]{\footnotesize \documenttitle\\ \leftmark} + +\fancyfoot{}% clear all fields +\fancyfoot[RO]{\footnotesize Intevation GmbH} % Author +\fancyfoot[CO]{\footnotesize \thepage/\pageref{LastPage}} +\fancyfoot[LO]{\footnotesize \documentdate +\\\documentID} + +\renewcommand{\footrulewidth}{0.4pt} + +% +% END Header/Footer Definition +%----------------------------------- + +%---------------------------------------------- +% MACRO DEFINITION +% +% \Fig{figure}{lof text}{caption} : +% places 'figure' and +% writes 'caption' at the bottom with leading +% 'Abbildung figno:'. 'lof text' is added to the list of +% figures. +% Example: +% \Fig{\epsfxsize30mm \epsffile{x.eps}}{the x}{the x} +% +% \FigNoEntry{}{} : +% same as above, no entry in figures list +% +% \FigCaption{} : +% line with figure caption, setting figure +% counter and figures list +% +% \Tab{table}{lot text}{caption} : +% places 'table' and writes caption on top of the table +% with leading 'Tabelle tabno:'. 'lot text' is added to +% the list of tables. +%**************************************************************************** +% Figure makro for graphics continously enumerated. +% + +\newcounter{FigCnt} +\newcounter{TabCnt} + +\newcommand{\Fig}[3]% +{ + \refstepcounter{FigCnt} + \addcontentsline{lof}{figure}% + {\protect\numberline{\arabic{FigCnt}}{#2}} + \mbox{#1} + +\nopagebreak + {Abbildung \arabic{FigCnt}: #3} + +} + +\newcommand{\FigNoEntry}[2]% +{ + \refstepcounter{FigCnt} + \mbox{#1} + +\nopagebreak + {Abbildung \arabic{FigCnt}: #2} + +} + +\newcommand{\FigCaption}[1]% +{ + \refstepcounter{FigCnt} + \addcontentsline{lof}{figure}% + {\protect\numberline{\arabic{FigCnt}}{#1}} + + %{Figure \thesection.\arabic{FigCnt}: #1} +} + +\newcommand{\Tab}[3]% +{ + \refstepcounter{TabCnt} + \addcontentsline{lot}{figure}% + {\protect\numberline{\arabic{TabCnt}}{#2}} + {Tabelle \arabic{TabCnt}: #3} +\nopagebreak + #1 + +} + +\hyphenation{Intevation} +% end macro definition + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcounter{schritt} +\renewcommand{\theschritt}{\Roman{schritt}} +%\makeatletter\renewcommand{\p@schritt}{Abschnitt~\thesubsubsection~}\makeatother + +%----------------------------------- +% DOCUMENT SETTINGS +\pagestyle{fancy} +\setlength{\parindent}{0cm} +\setlength{\parskip}{5pt plus 2pt minus 1pt} + +% Start actual content here +\include{title} +\newpage +\tableofcontents +\include{overview} +\include{general_settings} +\include{administering_artifact-server} +\include{generating_charts} +\include{generating_maps} +\include{adding_new_languages} +\include{model_of_transitions} +\include{miscellanea} +\end{document}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/config-manual.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,59 @@ +Configuration of the GNV Artifact Server + +1. Overview of Artifact Server + +artifact-server +|-- artifactdb +|-- bin +| `-- lib +|-- cache +|-- conf +| |-- maptemplates +| |-- palette +| `-- products +|-- install +| `-- debian +|-- mapfiles +`-- shapefiles + +2. General settings +- structure of conf.xml +- Port +- Logging +- ... + + +3. Model of transitions + General principle of model of transitions + - FIS -> product -> transitions in data model + + Adding a new FIS and product + - One short example: using timeseries on ArcMarineBSH TimeSeries + + SQL: + Clarify the special mechanism of the internal functions + ST_ASTEXT(SHAPE) + ST_ASTEXT(RASTER) + + +4. Configuring diagrams + Global template + Configuring 2D-diagrams + - matching mechanism + + +5. Map Generator + General functionality + Configuring new maps + Self generated layers: Cross Sections + - matching mechanism + Complex data models from central datawarehouse + - matching mechanism!!!!! + +4. Other configurations +- gap detection: +%% FIXME HP: Meaning of keys time gap defintions (time_gap def.xml) +%% Gaps are defined in WIKI of BSH. mediawiki/index.php/MEDIAN_Coded_Value_Domains#TSIntervalTypes +%% FIXME HP: Gaps in verticalprofiles? configurable? +- cache cleaner +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/figures/intevation-logo.eps Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,1222 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%For: Frank Koormann,,, +%%CreationDate: Thu Mar 29 14:37:25 2001 +%%Title: intevation_logo-thin.eps +%%Creator: Sketch 0.6.8 +%%Pages: 1 +%%BoundingBox: 78 68 132 94 +%%Extensions: CMYK +%%DocumentSuppliedResources: (atend) +%%EndComments + +%%BeginProlog +%%BeginResource: procset Linux-Sketch-Procset 1.0 2 +/SketchDict 100 dict def +SketchDict begin +/bd { bind def } bind def +/x { exch } bd +/xd { exch def } bd +/PI 3.14159265358979323846264338327 def +/radgrad { 180 mul PI div } bd +/skstartmatrix matrix currentmatrix def +/tmpmat matrix def +/ISOLatin1Encoding dup where +{ pop pop } +{ [/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand +/quoteright /parenleft /parenright /asterisk /plus /comma /minus /period +/slash /zero /one /two /three /four /five /six /seven /eight /nine /colon +/semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J +/K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash +/bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i +/j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright +/asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve +/dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek +/caron /space /exclamdown /cent /sterling /currency /yen /brokenbar /section +/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen +/registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu +/paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright +/onequarter /onehalf /threequarters /questiondown /Agrave /Aacute /Acircumflex +/Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex +/Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve +/Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute +/Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute +/acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute +/ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde +/ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] def +} +ifelse +/arct dup where +{pop pop} +{ +/arct {arcto pop pop pop pop} bd +} +ifelse +/size 0 def +/fontname 0 def +/newfont 0 def +/sf { +/size xd +/fontname xd +fontname findfont +dup /Encoding get StandardEncoding eq +{ +dup +length dict /newfont xd +{ +1 index +/FID ne +{ newfont 3 1 roll put } +{ pop pop } +ifelse +} forall +newfont /Encoding ISOLatin1Encoding put +fontname newfont definefont +} +if +size scalefont setfont +} bd +/pusht {matrix currentmatrix} bd +/popt {setmatrix} bd +/pushc {gsave} bd +/popc {grestore} bd +/rgb {setrgbcolor} bd +/w { setlinewidth } bd +/j { setlinejoin } bd +/J { setlinecap } bd +/d { setdash } bd +/F { eofill } bd +/f { closepath F } bd +/S { +pusht +skstartmatrix setmatrix stroke +popt +} bd +/s { closepath S } bd +/m { moveto } bd +/l { lineto } bd +/c { curveto } bd +/txt { +/tmpmat tmpmat currentmatrix def +dup type /arraytype eq {concat} {translate} ifelse +0 0 m +tmpmat +} bd +/T {txt x show popt} bd +/P {txt x true charpath popt} bd +/TP {txt x dup show 0 0 m true charpath popt} bd +/C {newpath 0 360 arc} bd +/R { +2 copy m +x 2 index l +x 2 index x l +l +closepath +} bd +/ellipse { +dup type /arraytype eq +{ +pusht x concat +0 0 1.0 C +popt +} +{ +pusht 5 1 roll +4 -1 roll concat +newpath +dup 2 eq { +0 0 m +} if +3 1 roll +radgrad x +radgrad x +0 0 1 5 -2 roll +arc +0 ne { closepath } if +popt +} +ifelse +} bd +/radius1 0 def +/radius2 0 def +/factor 0 def +/rect { +dup type /arraytype eq +{ +pusht x concat +0 0 m 1 0 l 1 1 l 0 1 l closepath +popt +} +{ +/radius2 xd +/radius1 xd +pusht x concat +radius1 radius2 div 1 scale +0 radius2 m +0 1 radius2 1 radius2 arct +radius2 radius1 div +dup 1 1 index 0 radius2 arct +0 0 0 radius2 arct +0 0 0 1 radius2 arct +closepath +popt +} +ifelse +} bd +/buf 0 def +/width 0 def +/height 0 def +/skcimg { +/tmpmat tmpmat currentmatrix def +{ concat } if +/height xd +/width xd +/buf width 3 mul string def +width height scale +width height 8 +[width 0 0 height neg 0 height] +{ currentfile buf readhexstring pop } bind +false 3 colorimage +tmpmat setmatrix +} bd +/skgimg { +/tmpmat tmpmat currentmatrix def +{ concat } if +/height xd +/width xd +/buf width string def +width height scale +width height 8 +[width 0 0 height neg 0 height] +{ currentfile buf readhexstring pop } bind +image +tmpmat setmatrix +} bd +/rclip { +4 2 roll m +dup 0 x rlineto +x 0 rlineto +neg 0 x rlineto +closepath +clip +} bd +/skeps { +10 dict begin +/sk_state save def +concat +3 index neg 3 index neg translate +rclip +0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin +10 setmiterlimit [ ] 0 setdash +newpath +/sk_dict_count countdictstack def +/sk_count count 1 sub def +userdict begin +/showpage { } def +/languagelevel where +{ +pop +languagelevel 1 ne +{ +false setstrokeadjust +false setoverprint +} if +} if +} bd +/skepsend { +count sk_count sub { pop } repeat +countdictstack sk_dict_count sub { end } repeat +sk_state restore +end +} bd +/gradidx 0 def +/gradient { +3 mul array +/gradidx 0 def +} bd +/$ { +3 index gradidx 5 -1 roll put +2 index gradidx 1 add 4 -1 roll put +1 index gradidx 2 add 3 -1 roll put +/gradidx gradidx 3 add def +} bd +/! { +3 +{ +dup dup gradidx dup 3 1 roll 3 sub get put +/gradidx gradidx 1 add def +} +repeat +} bd +/gradcolor { +3 mul dup 2 add 1 exch % idx 1 idx+2 +{ +1 index exch % array array i +get % array component +exch % component array +} +for +4 1 roll +} bd +/x0 0 def /y0 0 def /x1 0 def /y1 0 def +/left 0 def /right 0 def /top 0 def /bottom 0 def +/numcolors 0 def +/axial { +/y1 xd /x1 xd /y0 xd /x0 xd +dup length 3 idiv /numcolors xd +pusht exch % ctm array +x0 x1 ne y0 y1 ne or +{ +x0 y0 translate +[x1 x0 sub y1 y0 sub dup neg 2 index 0 0] concat +clippath flattenpath pathbbox +/top xd /right xd /bottom xd /left xd +newpath +0 gradcolor rgb clippath f +0 1 numcolors 1 sub +{ +dup numcolors div +3 1 roll +gradcolor rgb +exch +bottom right top R f +} +for +} +if +pop +popt +} bd +/r0 0 def /r1 0 def /dr 0 def +/radial { +/r1 xd /r0 xd /y0 xd /x0 xd +/dr r1 r0 sub def +dup length 3 idiv /numcolors xd +pusht exch % ctm array +r0 r1 ne +{ +x0 y0 translate +clippath flattenpath pathbbox +/top xd /right xd /bottom xd /left xd +newpath +dr 0 gt {numcolors 1 sub}{0} ifelse gradcolor rgb +clippath f +dr 0 gt {numcolors 1 sub -1 0} { 0 1 numcolors 1 sub} ifelse +{ +dup numcolors div dr mul r0 add +3 1 roll +gradcolor rgb +exch +0 0 3 -1 roll C f +} +for +} +if +pop +popt +} bd +/max { +2 copy lt {exch} if pop +} bd +/conical { +pusht 5 1 roll +3 1 roll /y0 xd /x0 xd +x0 y0 translate +radgrad rotate +dup length 3 idiv /numcolors xd +clippath flattenpath pathbbox newpath +4 { abs 4 1 roll} repeat +3 { max } repeat +2 mul +dup scale +0 gradcolor rgb +0 0 1 0 360 arc f +1 1 numcolors 1 sub +{ +dup numcolors div 180 mul +3 1 roll +gradcolor rgb +exch +0 0 moveto +0 0 1 4 -1 roll dup neg arc +closepath f +} +for +pop +popt +} bd +/XStep 0 def /YStep 0 def /imagedata 0 def /components 0 def +/tileimage2 { +exch 4 2 roll +/height xd +/width xd +mark +/components 2 index +/PatternType 1 +/PaintType 1 +/TilingType 1 +/BBox [0 0 width height] +/XStep width +/YStep height +/PaintProc { +begin +XStep YStep 8 +matrix +imagedata +false +components +colorimage +end +} +counttomark 2 div cvi dup dict begin +{ def } repeat +pop currentdict end +dup +/imagedata +4 -1 roll +width height mul mul string +currentfile exch readhexstring pop +put +exch +makepattern +setpattern +clippath +eofill +} bd +/tileimage1 { +concat +/components xd +/height xd +/width xd +/imagedata +currentfile +width height mul components mul string +readhexstring pop +def +clippath flattenpath pathbbox +/top xd /right xd /bottom xd /left xd +left width div floor width mul +bottom height div floor height mul +translate +top bottom sub height div ceiling cvi +{ +gsave +right left sub width div ceiling cvi +{ +width height 8 matrix +components 1 eq +{ +{ imagedata } +image +} +{ +imagedata +false components +colorimage +} +ifelse +width 0 translate +} +repeat +grestore +0 height translate +} +repeat +} bd +/makepattern where +{ +pop +/tileimage /tileimage2 load def +} +{ +/tileimage /tileimage1 load def +} +ifelse +end +%%EndResource +%%EndProlog + +%%BeginSetup + +10.433 setmiterlimit +%%EndSetup + +%%Page: 1 1 +SketchDict begin +newpath +81.1479 90.3363 m +83.1262 89.4518 85.8962 89.4399 87.7755 90.732 c +88.4885 91.2221 89.1744 91.8548 89.1744 92.7451 c +89.3805 92.7446 89.5146 92.3854 89.7059 92.4617 c +90.3588 92.7216 91.0745 92.5334 91.5725 92.3012 c +91.8169 92.1873 92.0442 92.7366 92.3141 92.7358 c +92.4246 92.4106 93.2359 91.4866 93.2359 91.4372 c +95.3948 89.4748 99.2768 88.555 102.019 89.186 c +102.881 89.3844 110.268 92.0436 110.268 92.7837 c +110.735 92.6454 111.042 92.3763 111.801 92.3588 c +113.208 92.7366 l +114.425 92.9532 114.356 92.6862 114.93 92.6609 c +114.93 90.5837 114.005 87.8389 114.95 85.8136 c +115.043 85.6129 115.327 85.1931 115.474 85.044 c +119.365 81.1112 125.41 82.6691 129.868 84.5493 c +129.868 84.4181 130.124 84.2636 130.124 84.1323 c +130.124 83.9504 129.868 83.7916 129.868 83.6096 c +129.521 83.6096 129.294 83.4821 129.005 83.2726 c +126.771 81.6517 123.827 80.5003 121.756 78.5645 c +121.551 78.3735 121.558 78.1688 121.558 77.872 c +121.756 77.6246 122.036 77.2541 122.315 77.061 c +122.399 77.0029 122.564 76.8961 124.449 75.877 c +126.015 75.0309 127.68 74.6575 129.194 74.6604 c +129.194 74.475 129.046 74.2851 129.051 74.0807 c +129.052 74.0297 129.066 73.9744 129.086 73.9171 c +129.106 73.8599 129.132 73.8003 129.158 73.7411 c +129.183 73.6819 129.209 73.6226 129.227 73.5659 c +129.245 73.5087 129.255 73.4539 129.252 73.4038 c +129.238 73.1617 129.151 72.9814 129.076 72.7773 c +126.75 73.9407 124.211 75.0082 121.611 75.7449 c +120.232 76.1358 118.876 76.4938 117.501 76.7872 c +116.305 77.0426 113.981 77.2912 113.298 75.7452 c +112.578 74.1158 113.329 72.4451 113.544 70.8622 c +113.245 70.9989 113.04 71.6163 112.826 71.3291 c +112.556 70.799 l +112.21 71.5408 111.908 72.5375 111.698 73.3754 c +111.413 74.5161 110.852 75.2644 109.473 75.4597 c +107.323 75.7648 107.541 75.5249 106.808 75.0986 c +105.489 74.3316 104.447 72.6469 104.427 70.7633 c +104.103 70.8166 104.04 71.1029 103.715 71.1562 c +103.661 71.1361 103.594 71.1001 103.521 71.0624 c +103.448 71.0247 103.368 70.985 103.288 70.9575 c +103.209 70.9303 103.129 70.9147 103.056 70.9254 c +102.983 70.9359 102.916 70.9725 102.862 71.049 c +102.814 71.2619 102.513 71.4476 102.165 71.1947 c +101.229 70.799 l +101.108 71.1117 100.582 71.3382 100.316 71.5037 c +99.0659 72.2807 97.0528 71.5295 96.2781 70.5102 c +96.093 70.57 95.9079 70.6298 95.7225 70.6896 c +95.5289 70.7905 95.2567 70.9099 94.8114 70.6321 c +94.4917 70.5802 l +94.4917 70.8373 94.9407 70.8557 95.0994 71.1094 c +95.4787 71.7155 95.856 72.5599 96.434 73.236 c +97.4233 74.3934 98.3768 75.7545 97.6356 77.2578 c +97.415 77.7045 97.576 77.5078 96.6749 78.2941 c +96.1414 78.7598 95.3594 79.3486 94.7173 79.6468 c +91.9201 80.9465 88.4556 81.0936 85.1714 80.6681 c +83.4604 80.4467 81.7831 80.1902 80.3068 79.6031 c +80.2609 79.585 80.3031 79.5122 80.2535 79.5122 c +80.306 79.6936 80.6359 79.9461 80.4556 80.0496 c +80.2343 80.1389 80.2481 80.2886 80.2552 80.4833 c +80.2731 80.7971 l +80.4213 80.7971 80.3077 80.824 80.4554 80.8396 c +82.6332 81.0712 84.5517 81.7552 86.5887 82.4718 c +87.2231 82.6952 87.987 83.0019 88.527 83.452 c +88.8771 83.744 89.3216 84.2214 89.3216 84.6667 c +89.3216 85.0624 88.8949 85.959 88.6166 86.1815 c +86.4209 87.9381 80.8845 88.8736 80.8346 88.9422 c +80.7828 89.0136 l +80.7856 89.1103 81.0512 89.1729 81.1198 89.3575 c +81.1731 89.5006 81.0506 89.7858 81.1017 89.9232 c +81.1924 90.1679 81.2247 90.3363 81.1479 90.3363 c +closepath +gsave +0.9 0.9 0.9 rgb +F +grestore +0.9 0.9 0.9 rgb +0.215433 w +0 j +0 J +[] 0 d +S +newpath +108.203 84.2032 m +107.659 84.1536 106.67 83.9557 106.373 83.5107 c +106.324 83.5107 106.274 83.4611 106.274 83.4118 c +106.126 83.3622 106.027 82.9665 105.829 82.8675 c +105.829 82.1257 105.533 81.4828 106.126 80.8396 c +106.225 80.7407 l +106.423 80.6914 l +107.907 79.8999 109.341 79.9989 110.726 80.8892 c +110.776 80.9882 l +110.875 81.0375 111.072 81.3343 111.27 81.3343 c +111.27 81.8782 111.765 82.4225 111.418 83.115 c +111.32 83.3129 110.825 83.4611 110.825 83.659 c +110.726 83.659 110.132 84.0054 110.132 84.0547 c +109.935 84.0547 l +109.737 84.2525 108.401 84.2525 108.203 84.2032 c +closepath +gsave +0.8 0.8 0.8 rgb +F +grestore +0.7 0.7 0.7 rgb +0.566929 w +0 j +0 J +[] 0 d +S +newpath +129.218 74.6074 m +126.745 74.9042 123.636 75.6956 121.805 77.5256 c +121.657 77.6742 121.459 78.0203 121.459 78.2677 c +121.558 78.3171 l +121.558 78.3667 121.757 78.5634 121.805 78.6139 c +123.135 79.9966 125.128 80.6576 126.673 81.7561 c +128.047 82.7323 129.427 83.5107 129.67 83.5107 c +129.775 83.5629 130.033 83.615 130.115 83.659 c +129.109 72.8173 m +127.427 73.3119 125.912 74.363 124.229 74.9042 c +121.542 75.7684 l +120.528 76.0947 119.51 76.4014 118.523 76.5599 c +116.741 76.8465 115.229 77.6229 113.743 76.2892 c +112.805 75.4467 113.006 74.657 113.006 73.4205 c +113.121 72.9094 113.569 71.2846 113.569 70.7888 c +112.54 70.8024 m +111.897 72.0885 111.86 74.2406 110.585 75.1462 c +109.981 75.576 107.912 75.6808 107.214 75.4484 c +106.724 75.2851 106.373 74.7559 106.027 74.4095 c +105.087 73.4698 104.431 72.0363 104.431 70.7009 c +101.387 70.7216 m +100.435 71.9918 98.2462 72.4301 97.0247 71.1409 c +96.8801 71.0068 96.6052 70.7772 96.0915 70.388 c +94.588 70.6593 m +95.3302 71.0054 95.6213 71.8212 95.9603 72.5171 c +96.561 73.7499 98.571 75.6363 97.6602 77.1169 c +97.3518 77.6183 l +97.063 78.124 95.8361 79.0019 95.7069 79.1312 c +95.509 79.329 94.9892 79.5357 94.7496 79.6525 c +90.7346 81.6135 86.2429 80.9354 82.0379 80.1471 c +81.4945 80.0454 80.7354 79.496 80.1915 79.496 c +80.855 88.9875 m +81.4486 88.839 81.943 88.619 82.5326 88.4566 c +83.9216 88.0751 85.6935 87.8542 86.9841 87.1708 c +87.3753 86.9639 87.8251 86.5772 88.2209 86.3794 c +88.9627 86.0333 89.3091 85.2418 89.2595 84.4008 c +89.2595 84.2032 88.8592 83.7624 88.7155 83.6096 c +88.0678 82.9214 86.6839 82.482 85.7972 82.175 c +84.1118 81.5919 82.1369 80.7407 80.3068 80.7407 c +80.2575 80.6914 l +81.2564 90.302 m +81.7865 90.031 81.8707 90.1115 82.3007 89.9334 c +83.7949 89.3152 85.8009 89.932 87.1823 90.5344 c +88.1222 90.944 89.2116 91.7442 89.2116 92.8407 c +92.2753 92.7032 m +92.9678 91.6646 93.7564 90.8221 94.8982 90.2869 c +95.3392 90.0803 95.9901 89.7098 96.481 89.5944 c +98.5129 89.1165 100.233 88.7908 102.318 89.1987 c +102.511 89.2367 102.58 89.2282 103.109 89.3966 c +105.253 90.0783 107.678 91.2292 109.638 92.3148 c +109.697 92.3474 110.336 92.8129 110.352 92.8129 c +114.93 92.7352 m +114.815 91.7541 114.609 90.9627 114.61 90.427 c +114.611 88.8645 114.327 87.8086 114.634 86.6268 c +115.198 84.4504 118.458 82.8638 119.975 82.7193 c +123.178 82.4137 126.158 83.2958 129.076 84.3515 c +129.123 84.3682 129.274 84.4008 129.373 84.4008 c +129.423 84.4997 129.818 84.6483 129.967 84.6483 c +0.8 0.8 0.8 rgb +1 j +1 J +S +newpath +81.6246 86.9766 m +82.6698 86.9766 l +82.6698 79.2655 l +81.6246 79.2655 l +81.6246 86.9766 l +closepath +84.0446 82.4667 m +84.0446 82.7598 84.0959 83.0368 84.1988 83.297 c +84.3014 83.5575 84.4553 83.8013 84.6606 84.0286 c +84.8734 84.2486 85.1226 84.4155 85.4086 84.5292 c +85.6946 84.6429 86.0209 84.6996 86.3877 84.6996 c +86.4464 84.6996 86.5104 84.6959 86.5802 84.6885 c +86.6499 84.6811 86.725 84.6704 86.8058 84.6556 c +86.8863 84.6409 86.9688 84.6227 87.0533 84.6006 c +87.1375 84.5785 87.2236 84.5493 87.3118 84.5125 c +87.4657 84.4467 87.6123 84.3622 87.7517 84.2596 c +87.8909 84.157 88.0267 84.0323 88.1588 83.8857 c +88.2906 83.7463 88.3898 83.5739 88.4559 83.3687 c +88.5216 83.1632 88.5548 82.9285 88.5548 82.6646 c +88.5548 82.6572 88.5548 82.6481 88.5548 82.6371 c +88.5548 82.626 88.5548 82.6133 88.5548 82.5985 c +88.5548 82.5911 88.5548 82.5821 88.5548 82.571 c +88.5548 82.56 88.5548 82.5472 88.5548 82.5325 c +88.5548 79.2655 l +87.5097 79.2655 l +87.5097 82.3786 l +87.5097 82.5398 87.4858 82.6994 87.4382 82.857 c +87.3906 83.0146 87.3192 83.1632 87.2236 83.3026 c +87.1284 83.4492 87.0037 83.5592 86.8497 83.6326 c +86.6958 83.706 86.5124 83.7426 86.2998 83.7426 c +86.1017 83.7426 85.9276 83.7097 85.7771 83.6437 c +85.6269 83.5776 85.4968 83.4787 85.3868 83.3466 c +85.2768 83.2145 85.1906 83.0733 85.1283 82.9231 c +85.0659 82.7729 85.0237 82.6133 85.0016 82.4446 c +85.0016 79.2655 l +84.0446 79.2655 l +84.0446 82.4667 l +closepath +89.6767 85.8436 m +90.7108 85.8436 l +90.7108 84.5456 l +92.7126 84.5456 l +92.7126 83.5997 l +90.7108 83.5997 l +90.7108 80.9156 l +90.7108 80.813 90.7179 80.7211 90.7326 80.6406 c +90.7474 80.5598 90.7695 80.483 90.7987 80.4096 c +90.8279 80.3362 90.8922 80.2832 90.9912 80.25 c +91.0901 80.2171 91.2276 80.2007 91.4036 80.2007 c +92.6248 80.2225 l +92.6248 79.2655 l +91.3268 79.2655 l +91.3194 79.2655 91.312 79.2655 91.3047 79.2655 c +91.2973 79.2655 91.2899 79.2655 91.2826 79.2655 c +91.2755 79.2655 91.2698 79.2655 91.2661 79.2655 c +91.2624 79.2655 91.2571 79.2619 91.2497 79.2545 c +91.2423 79.2545 91.2349 79.2545 91.2276 79.2545 c +91.2205 79.2545 91.2131 79.2545 91.2057 79.2545 c +91.1984 79.2545 91.193 79.2545 91.1893 79.2545 c +91.1856 79.2545 91.18 79.2545 91.1726 79.2545 c +90.9234 79.2545 90.7071 79.2913 90.5237 79.3645 c +90.3403 79.4379 90.1901 79.5516 90.0727 79.7055 c +89.9554 79.8597 89.8655 80.0247 89.8032 80.2007 c +89.7408 80.3764 89.7023 80.5598 89.6878 80.7506 c +89.6804 80.7654 89.6767 80.7818 89.6767 80.7999 c +89.6767 80.8184 89.6767 80.8385 89.6767 80.8606 c +89.6767 80.8753 89.6767 80.8918 89.6767 80.9099 c +89.6767 80.9283 89.6767 80.9485 89.6767 80.9706 c +89.6767 80.9927 l +89.6767 85.8436 l +closepath +96.7829 83.1595 m +96.7682 83.1669 96.7534 83.1762 96.7387 83.187 c +96.7242 83.198 96.7095 83.2145 96.6948 83.2366 c +96.68 83.2513 96.6636 83.2695 96.6454 83.2916 c +96.627 83.3137 96.6069 83.3355 96.5848 83.3576 c +96.5629 83.3724 96.5388 83.3888 96.5133 83.407 c +96.4875 83.4254 96.4637 83.4455 96.4419 83.4676 c +96.4124 83.4824 96.3832 83.4988 96.3537 83.5172 c +96.3246 83.5354 96.2914 83.5518 96.2548 83.5666 c +96.1814 83.6031 96.0952 83.6289 95.9963 83.6437 c +95.8974 83.6584 95.7854 83.6655 95.6607 83.6655 c +95.3747 83.6655 95.1235 83.6142 94.9072 83.5116 c +94.6909 83.4089 94.5095 83.2587 94.3627 83.0606 c +94.2161 82.8627 94.1062 82.6535 94.0327 82.4335 c +93.9593 82.2136 93.9228 81.9862 93.9228 81.7515 c +93.9228 81.7442 93.9228 81.7368 93.9228 81.7297 c +93.9228 81.7186 l +93.9228 81.5058 93.9613 81.3025 94.0384 81.1081 c +94.1152 80.9136 94.2272 80.7285 94.3737 80.5525 c +94.5206 80.3764 94.702 80.2446 94.9183 80.1565 c +95.1346 80.0686 95.382 80.0247 95.6607 80.0247 c +95.9614 80.0247 96.2126 80.0592 96.4144 80.129 c +96.616 80.1987 96.7682 80.3033 96.8708 80.4425 c +96.9734 80.5893 97.0669 80.7617 97.1514 80.9595 c +97.2356 81.1577 97.3107 81.3813 97.3768 81.6305 c +97.3768 81.6415 l +97.3878 81.6526 l +97.3878 81.6637 l +98.3448 81.6087 l +98.3448 81.5939 98.3448 81.5812 98.3448 81.5701 c +98.3448 81.5591 98.3485 81.55 98.3559 81.5426 c +98.3559 81.5279 98.3559 81.5168 98.3559 81.5094 c +98.3559 81.5024 98.3559 81.4913 98.3559 81.4766 c +98.3559 81.4692 98.3559 81.4601 98.3559 81.4491 c +98.3559 81.438 98.3595 81.4289 98.3669 81.4216 c +98.3669 81.4068 98.3669 81.3958 98.3669 81.3887 c +98.3669 81.3813 98.3669 81.374 98.3669 81.3666 c +98.3669 81.3079 98.3632 81.2475 98.3559 81.1852 c +98.3485 81.1228 98.3374 81.0585 98.323 80.9927 c +98.3156 80.9632 98.3063 80.9303 98.2952 80.8935 c +98.2844 80.8569 98.2751 80.824 98.2677 80.7946 c +98.2532 80.758 98.2402 80.7231 98.2294 80.69 c +98.2184 80.6571 98.2056 80.6222 98.1909 80.5856 c +98.1027 80.4022 97.9854 80.2225 97.8388 80.0465 c +97.6923 79.8705 97.5126 79.7055 97.3 79.5516 c +97.0944 79.3976 96.8543 79.282 96.5794 79.2052 c +96.3044 79.1281 95.9983 79.0895 95.6607 79.0895 c +95.272 79.0895 94.9129 79.1502 94.5827 79.2709 c +94.2527 79.392 93.9559 79.5774 93.6917 79.8265 c +93.4205 80.0833 93.2189 80.3711 93.0868 80.69 c +92.9547 81.0091 92.8887 81.3629 92.8887 81.7515 c +92.8887 82.1623 92.9437 82.5254 93.0536 82.8406 c +93.1636 83.1558 93.3289 83.4274 93.5489 83.6547 c +93.7688 83.882 93.9999 84.0688 94.2417 84.2157 c +94.4837 84.3622 94.7369 84.4685 95.0008 84.5346 c +95.0303 84.542 95.0577 84.5473 95.0833 84.551 c +95.1091 84.5547 95.1366 84.5604 95.1657 84.5675 c +95.1952 84.5675 95.2227 84.5695 95.2482 84.5731 c +95.274 84.5768 95.3015 84.5822 95.3307 84.5896 c +95.3894 84.5969 95.4464 84.6023 95.5014 84.606 c +95.5564 84.6097 95.6094 84.6117 95.6607 84.6117 c +95.9614 84.6117 96.2421 84.5695 96.5023 84.485 c +96.7628 84.4008 97.0029 84.2744 97.2229 84.1057 c +97.4354 83.937 97.6279 83.75 97.8003 83.5447 c +97.9726 83.3392 98.1248 83.1192 98.2569 82.8845 c +94.6158 80.9156 l +94.1867 81.6855 l +96.7829 83.1595 l +closepath +99.6431 84.5456 m +101.282 80.3875 l +102.756 84.5456 l +103.889 84.5456 l +102.063 79.7826 l +102.019 79.6726 101.969 79.5791 101.914 79.502 c +101.859 79.4251 101.799 79.3608 101.733 79.3095 c +101.667 79.2655 101.599 79.229 101.53 79.1995 c +101.46 79.1703 101.385 79.1519 101.304 79.1445 c +101.297 79.1445 101.291 79.1445 101.287 79.1445 c +101.284 79.1445 101.278 79.1445 101.271 79.1445 c +101.264 79.1445 101.256 79.1445 101.249 79.1445 c +101.168 79.1445 101.09 79.1556 101.012 79.1777 c +100.935 79.1995 100.857 79.2327 100.776 79.2766 c +100.703 79.3353 100.637 79.403 100.578 79.4801 c +100.519 79.5569 100.468 79.6505 100.424 79.7605 c +98.5101 84.5456 l +99.6431 84.5456 l +closepath +108.388 82.3015 m +108.388 82.463 108.357 82.6223 108.294 82.7802 c +108.232 82.9378 108.139 83.0864 108.014 83.2255 c +107.889 83.3724 107.713 83.4824 107.486 83.5555 c +107.259 83.6289 106.984 83.6655 106.661 83.6655 c +106.609 83.6655 106.556 83.6618 106.501 83.6547 c +106.447 83.6473 106.386 83.6363 106.32 83.6215 c +106.254 83.6142 106.188 83.5997 106.122 83.5776 c +106.056 83.5555 105.99 83.5263 105.924 83.4897 c +105.807 83.4381 105.693 83.3667 105.583 83.2751 c +105.473 83.1833 105.367 83.0753 105.264 82.9506 c +105.169 82.8332 105.092 82.6884 105.033 82.516 c +104.974 82.3437 104.938 82.1475 104.923 81.9276 c +104.923 81.6342 104.963 81.3793 105.044 81.1631 c +105.125 80.9468 105.245 80.7654 105.407 80.6185 c +105.576 80.4793 105.75 80.3674 105.929 80.2832 c +106.109 80.1987 106.298 80.1454 106.496 80.1236 c +106.503 80.1236 106.513 80.1236 106.523 80.1236 c +106.534 80.1236 106.544 80.1236 106.551 80.1236 c +106.566 80.1162 106.578 80.1125 106.589 80.1125 c +106.6 80.1125 106.609 80.1125 106.617 80.1125 c +106.632 80.1125 106.643 80.1125 106.65 80.1125 c +106.657 80.1125 106.668 80.1125 106.683 80.1125 c +106.69 80.1125 106.699 80.1125 106.71 80.1125 c +106.721 80.1125 106.731 80.1125 106.738 80.1125 c +106.826 80.1125 106.909 80.1179 106.985 80.129 c +107.062 80.14 107.138 80.1602 107.211 80.1896 c +107.248 80.2041 107.282 80.2188 107.315 80.2336 c +107.348 80.2483 107.383 80.2628 107.42 80.2775 c +107.449 80.2996 107.482 80.3214 107.519 80.3436 c +107.556 80.3657 107.589 80.3912 107.618 80.4207 c +107.655 80.4425 107.689 80.47 107.722 80.5032 c +107.756 80.536 107.79 80.5672 107.827 80.5967 c +107.864 80.6333 107.9 80.6681 107.937 80.701 c +107.974 80.7342 108.01 80.7688 108.047 80.8056 c +108.047 79.6066 l +108.04 79.5918 108.032 79.5808 108.025 79.5737 c +108.025 79.5626 l +107.937 79.5039 107.845 79.4506 107.75 79.403 c +107.655 79.3554 107.556 79.3132 107.453 79.2766 c +107.35 79.2471 107.225 79.2233 107.079 79.2052 c +106.932 79.1867 106.764 79.1777 106.573 79.1777 c +106.566 79.1777 106.56 79.1777 106.556 79.1777 c +106.553 79.1777 106.547 79.1777 106.54 79.1777 c +106.533 79.1777 106.522 79.1777 106.507 79.1777 c +106.5 79.1777 106.492 79.1777 106.485 79.1777 c +106.478 79.1777 106.47 79.1777 106.463 79.1777 c +106.456 79.1777 106.45 79.1777 106.447 79.1777 c +106.443 79.1777 106.437 79.1777 106.43 79.1777 c +106.092 79.1777 105.779 79.238 105.49 79.3591 c +105.2 79.4801 104.934 79.6652 104.692 79.9147 c +104.45 80.1712 104.268 80.4663 104.147 80.7999 c +104.026 81.1339 103.966 81.5094 103.966 81.9276 c +103.966 82.2944 104.025 82.6354 104.142 82.9506 c +104.259 83.2658 104.435 83.5555 104.67 83.8197 c +104.904 84.0836 105.194 84.2817 105.539 84.4135 c +105.884 84.5456 106.283 84.6117 106.738 84.6117 c +107.17 84.6117 107.556 84.553 107.893 84.4357 c +108.23 84.3183 108.513 84.1423 108.74 83.9076 c +108.975 83.6729 109.149 83.4254 109.262 83.1652 c +109.376 82.9047 109.433 82.6354 109.433 82.3564 c +109.433 79.2655 l +108.388 79.2655 l +108.388 82.3015 l +closepath +110.467 85.8436 m +111.501 85.8436 l +111.501 84.5456 l +113.503 84.5456 l +113.503 83.5997 l +111.501 83.5997 l +111.501 80.9156 l +111.501 80.813 111.508 80.7211 111.523 80.6406 c +111.538 80.5598 111.56 80.483 111.589 80.4096 c +111.618 80.3362 111.683 80.2832 111.782 80.25 c +111.881 80.2171 112.018 80.2007 112.194 80.2007 c +113.415 80.2225 l +113.415 79.2655 l +112.117 79.2655 l +112.11 79.2655 112.102 79.2655 112.095 79.2655 c +112.088 79.2655 112.08 79.2655 112.073 79.2655 c +112.066 79.2655 112.06 79.2655 112.057 79.2655 c +112.053 79.2655 112.047 79.2619 112.04 79.2545 c +112.033 79.2545 112.025 79.2545 112.018 79.2545 c +112.011 79.2545 112.004 79.2545 111.996 79.2545 c +111.989 79.2545 111.983 79.2545 111.98 79.2545 c +111.976 79.2545 111.97 79.2545 111.963 79.2545 c +111.714 79.2545 111.498 79.2913 111.314 79.3645 c +111.131 79.4379 110.981 79.5516 110.863 79.7055 c +110.746 79.8597 110.656 80.0247 110.594 80.2007 c +110.531 80.3764 110.493 80.5598 110.478 80.7506 c +110.471 80.7654 110.467 80.7818 110.467 80.7999 c +110.467 80.8184 110.467 80.8385 110.467 80.8606 c +110.467 80.8753 110.467 80.8918 110.467 80.9099 c +110.467 80.9283 110.467 80.9485 110.467 80.9706 c +110.467 80.9927 l +110.467 85.8436 l +closepath +114.449 84.5456 m +115.406 84.5456 l +115.406 79.2655 l +114.449 79.2655 l +114.449 84.5456 l +closepath +114.372 85.7665 m +114.372 85.8473 114.387 85.9224 114.416 85.9922 c +114.446 86.0619 114.493 86.1223 114.559 86.1736 c +114.618 86.2175 114.682 86.2524 114.752 86.2782 c +114.821 86.3037 114.893 86.3167 114.966 86.3167 c +115.047 86.3167 115.12 86.3057 115.186 86.2836 c +115.252 86.2617 115.318 86.2249 115.384 86.1736 c +115.45 86.1223 115.5 86.0619 115.533 85.9922 c +115.566 85.9224 115.582 85.8399 115.582 85.7447 c +115.582 85.6492 115.566 85.565 115.533 85.4916 c +115.5 85.4181 115.454 85.3561 115.395 85.3045 c +115.329 85.2532 115.263 85.2166 115.197 85.1945 c +115.131 85.1727 115.062 85.1616 114.988 85.1616 c +114.915 85.1542 114.842 85.1616 114.768 85.1837 c +114.695 85.2055 114.625 85.2424 114.559 85.2937 c +114.493 85.345 114.446 85.4091 114.416 85.4862 c +114.387 85.563 114.372 85.6492 114.372 85.7447 c +114.372 85.7665 l +closepath +116.792 82.0375 m +116.792 82.4409 116.862 82.804 117.001 83.1266 c +117.14 83.4492 117.346 83.7315 117.617 83.9736 c +117.896 84.2157 118.191 84.3971 118.503 84.5181 c +118.814 84.6392 119.143 84.6996 119.487 84.6996 c +119.502 84.6996 119.518 84.6996 119.537 84.6996 c +119.555 84.6996 119.571 84.6996 119.586 84.6996 c +119.601 84.6922 119.617 84.6885 119.636 84.6885 c +119.654 84.6885 119.674 84.6885 119.696 84.6885 c +119.711 84.6885 119.727 84.6885 119.746 84.6885 c +119.764 84.6885 119.784 84.6885 119.806 84.6885 c +119.821 84.6811 119.837 84.6777 119.856 84.6777 c +119.874 84.6777 119.89 84.6777 119.905 84.6777 c +120.199 84.6335 120.479 84.5473 120.747 84.4192 c +121.014 84.2908 121.273 84.1202 121.522 83.9076 c +121.764 83.6876 121.947 83.4126 122.072 83.0827 c +122.197 82.7527 122.259 82.3675 122.259 81.9276 c +122.259 81.8984 122.259 81.8689 122.259 81.8397 c +122.259 81.8102 122.256 81.7847 122.248 81.7626 c +122.248 81.7331 122.246 81.7039 122.243 81.6747 c +122.239 81.6452 122.237 81.616 122.237 81.5865 c +122.23 81.5279 122.221 81.4692 122.21 81.4105 c +122.199 81.3518 122.186 81.2932 122.171 81.2345 c +122.105 80.9706 122.004 80.7194 121.869 80.481 c +121.733 80.2426 121.559 80.0173 121.346 79.8044 c +121.141 79.5918 120.895 79.4342 120.609 79.3316 c +120.323 79.229 120.004 79.1777 119.652 79.1777 c +119.153 79.1777 118.723 79.2454 118.36 79.3809 c +117.997 79.5167 117.701 79.7239 117.474 80.0025 c +117.247 80.2812 117.076 80.5893 116.962 80.9266 c +116.849 81.264 116.792 81.6268 116.792 82.0154 c +116.792 82.0375 l +closepath +117.837 82.0375 m +117.837 81.9789 117.837 81.9259 117.837 81.878 c +117.837 81.8303 117.841 81.781 117.848 81.7297 c +117.855 81.6781 117.865 81.6288 117.876 81.5812 c +117.887 81.5335 117.896 81.4839 117.903 81.4326 c +117.94 81.2713 117.999 81.1134 118.079 80.9595 c +118.16 80.8056 118.259 80.6588 118.376 80.5196 c +118.501 80.3801 118.655 80.2775 118.838 80.2115 c +119.022 80.1454 119.238 80.1125 119.487 80.1125 c +119.722 80.1125 119.942 80.1454 120.147 80.2115 c +120.352 80.2775 120.54 80.3764 120.708 80.5085 c +120.877 80.6406 121.003 80.8331 121.088 81.086 c +121.172 81.3391 121.214 81.6489 121.214 82.0154 c +121.214 82.2722 121.178 82.505 121.104 82.7142 c +121.031 82.9231 120.921 83.1082 120.774 83.2695 c +120.627 83.4237 120.446 83.541 120.23 83.6215 c +120.013 83.7023 119.766 83.7426 119.487 83.7426 c +119.223 83.7426 118.996 83.7077 118.805 83.638 c +118.615 83.5685 118.457 83.4603 118.332 83.3137 c +118.207 83.1742 118.107 83.024 118.03 82.8627 c +117.953 82.7011 117.899 82.5362 117.87 82.3675 c +117.863 82.3383 117.855 82.3088 117.848 82.2796 c +117.841 82.2501 117.837 82.2209 117.837 82.1915 c +117.837 82.1623 117.837 82.1328 117.837 82.1036 c +117.837 82.0741 117.837 82.0449 117.837 82.0154 c +117.837 82.0375 l +closepath +123.205 82.4667 m +123.205 82.7598 123.257 83.0368 123.359 83.297 c +123.462 83.5575 123.616 83.8013 123.821 84.0286 c +124.034 84.2486 124.283 84.4155 124.569 84.5292 c +124.855 84.6429 125.182 84.6996 125.548 84.6996 c +125.607 84.6996 125.671 84.6959 125.741 84.6885 c +125.811 84.6811 125.886 84.6704 125.966 84.6556 c +126.047 84.6409 126.129 84.6227 126.214 84.6006 c +126.298 84.5785 126.384 84.5493 126.472 84.5125 c +126.626 84.4467 126.773 84.3622 126.912 84.2596 c +127.052 84.157 127.187 84.0323 127.319 83.8857 c +127.451 83.7463 127.55 83.5739 127.616 83.3687 c +127.682 83.1632 127.715 82.9285 127.715 82.6646 c +127.715 82.6572 127.715 82.6481 127.715 82.6371 c +127.715 82.626 127.715 82.6133 127.715 82.5985 c +127.715 82.5911 127.715 82.5821 127.715 82.571 c +127.715 82.56 127.715 82.5472 127.715 82.5325 c +127.715 79.2655 l +126.67 79.2655 l +126.67 82.3786 l +126.67 82.5398 126.646 82.6994 126.599 82.857 c +126.551 83.0146 126.48 83.1632 126.384 83.3026 c +126.289 83.4492 126.164 83.5592 126.01 83.6326 c +125.856 83.706 125.673 83.7426 125.46 83.7426 c +125.262 83.7426 125.088 83.7097 124.938 83.6437 c +124.788 83.5776 124.657 83.4787 124.547 83.3466 c +124.437 83.2145 124.351 83.0733 124.289 82.9231 c +124.227 82.7729 124.184 82.6133 124.162 82.4446 c +124.162 79.2655 l +123.205 79.2655 l +123.205 82.4667 l +closepath +0 0 0 rgb +F +newpath +113.172 76.343 m +113.172 76.6049 113.208 76.8397 113.279 77.0474 c +113.35 77.2549 113.455 77.4355 113.593 77.5889 c +113.736 77.7422 113.883 77.8732 114.037 77.9817 c +114.19 78.0903 114.351 78.1745 114.519 78.2343 c +114.549 78.2456 114.58 78.2558 114.612 78.2652 c +114.644 78.2746 114.676 78.2848 114.71 78.2961 c +114.74 78.3035 114.771 78.3111 114.803 78.3185 c +114.835 78.3259 114.865 78.3315 114.895 78.3352 c +114.959 78.3465 115.02 78.3551 115.078 78.3607 c +115.136 78.3661 115.193 78.3689 115.249 78.3689 c +115.402 78.3689 115.55 78.3539 115.692 78.3242 c +115.835 78.2941 115.969 78.2513 116.096 78.1952 c +116.223 78.1391 116.349 78.0659 116.472 77.9761 c +116.596 77.8865 116.718 77.7816 116.837 77.662 c +116.484 77.2745 l +116.469 77.2821 116.454 77.2915 116.441 77.3026 c +116.428 77.3139 116.414 77.3269 116.4 77.3419 c +116.392 77.3493 116.384 77.357 116.377 77.3643 c +116.369 77.372 116.362 77.3794 116.354 77.3867 c +116.343 77.3944 116.334 77.4018 116.326 77.4094 c +116.319 77.4168 116.311 77.4242 116.304 77.4318 c +116.237 77.4879 116.164 77.5412 116.085 77.5917 c +116.007 77.6421 115.922 77.6917 115.833 77.7405 c +115.743 77.7853 115.649 77.8199 115.552 77.8443 c +115.455 77.8686 115.354 77.8808 115.249 77.8808 c +115.021 77.8808 114.819 77.8479 114.645 77.7825 c +114.472 77.717 114.325 77.6189 114.205 77.4879 c +114.089 77.3607 113.995 77.2252 113.921 77.0809 c +113.849 76.9369 113.799 76.7864 113.773 76.6293 c +113.769 76.603 113.764 76.5777 113.759 76.5534 c +113.753 76.5293 113.75 76.5037 113.75 76.4777 c +113.747 76.4516 113.745 76.4264 113.745 76.402 c +113.745 76.3776 113.745 76.3541 113.745 76.3317 c +113.745 76.1446 113.776 75.964 113.837 75.7903 c +113.899 75.6162 113.992 75.4507 114.115 75.2934 c +114.239 75.1363 114.395 75.0156 114.584 74.9314 c +114.773 74.8472 114.994 74.7996 115.249 74.7885 c +115.253 74.7885 115.255 74.7885 115.257 74.7885 c +115.259 74.7885 115.262 74.7885 115.266 74.7885 c +115.269 74.7885 115.273 74.7885 115.277 74.7885 c +115.281 74.7885 115.284 74.7885 115.288 74.7885 c +115.296 74.7885 115.301 74.7885 115.305 74.7885 c +115.309 74.7885 115.312 74.7885 115.313 74.7885 c +115.315 74.7885 115.318 74.7885 115.322 74.7885 c +115.49 74.7845 115.644 74.8072 115.782 74.8557 c +115.92 74.9044 116.042 74.9793 116.147 75.0802 c +116.255 75.1774 116.346 75.2814 116.419 75.3917 c +116.492 75.502 116.549 75.6171 116.59 75.737 c +116.601 75.7667 116.612 75.7957 116.621 75.8237 c +116.631 75.8518 116.637 75.879 116.641 75.9054 c +116.644 75.9201 116.647 75.9343 116.649 75.9473 c +116.651 75.9603 116.652 75.9745 116.652 75.9895 c +116.656 76.0006 116.659 76.0128 116.66 76.0258 c +116.662 76.0389 116.663 76.053 116.663 76.0681 c +115.294 76.0791 l +115.294 76.6123 l +117.236 76.6123 l +117.236 76.1242 l +117.213 75.8285 117.148 75.5695 117.039 75.3469 c +116.931 75.1241 116.781 74.9342 116.59 74.7772 c +116.396 74.6201 116.187 74.5031 115.964 74.4262 c +115.742 74.3497 115.503 74.3114 115.249 74.3114 c +114.95 74.3114 114.676 74.3571 114.429 74.4489 c +114.183 74.5405 113.964 74.6816 113.773 74.8727 c +113.582 75.0595 113.436 75.2758 113.335 75.5207 c +113.234 75.7659 113.18 76.0363 113.172 76.3317 c +113.172 76.343 l +closepath +117.724 76.2138 m +117.724 76.33 117.746 76.4394 117.791 76.5423 c +117.836 76.6452 117.905 76.7396 117.999 76.8258 c +118.092 76.9117 118.201 76.9763 118.324 77.0194 c +118.448 77.0622 118.586 77.0837 118.74 77.0837 c +118.848 77.0837 118.944 77.0755 119.026 77.0585 c +119.108 77.0418 119.175 77.0182 119.228 76.9885 c +119.28 76.9584 119.329 76.9219 119.374 76.8791 c +119.419 76.836 119.458 76.7864 119.492 76.7302 c +119.525 76.775 119.567 76.8173 119.615 76.8564 c +119.664 76.8958 119.722 76.9341 119.789 76.9715 c +119.857 77.0089 119.931 77.0369 120.014 77.0557 c +120.096 77.0744 120.188 77.0837 120.289 77.0837 c +120.416 77.0837 120.536 77.0661 120.648 77.0304 c +120.76 76.995 120.865 76.9397 120.962 76.8649 c +121.059 76.7937 121.133 76.7124 121.184 76.6208 c +121.234 76.5293 121.261 76.4272 121.265 76.315 c +121.265 76.3113 121.265 76.3084 121.265 76.3065 c +121.265 76.3048 121.265 76.3019 121.265 76.298 c +121.265 76.2943 121.265 76.2914 121.265 76.2897 c +121.265 76.2878 121.265 76.2849 121.265 76.2812 c +121.261 76.2775 121.26 76.2747 121.26 76.2727 c +121.26 76.271 121.26 76.2682 121.26 76.2645 c +121.26 76.2605 121.26 76.258 121.26 76.256 c +121.26 76.254 121.26 76.2512 121.26 76.2475 c +121.26 74.3562 l +120.771 74.3562 l +120.771 76.0791 l +120.771 76.0754 120.771 76.0746 120.771 76.0763 c +120.771 76.0783 120.773 76.0791 120.777 76.0791 c +120.777 76.0828 120.777 76.0856 120.777 76.0876 c +120.777 76.0896 120.777 76.0922 120.777 76.0961 c +120.777 76.1035 120.777 76.11 120.777 76.1157 c +120.777 76.1214 120.777 76.1259 120.777 76.1296 c +120.777 76.1409 120.776 76.1523 120.774 76.1633 c +120.772 76.1746 120.769 76.1877 120.766 76.2027 c +120.762 76.2138 120.759 76.226 120.757 76.2393 c +120.756 76.2523 120.753 76.2662 120.749 76.2812 c +120.734 76.326 120.712 76.3691 120.682 76.4102 c +120.651 76.4516 120.616 76.4907 120.575 76.5281 c +120.534 76.5655 120.489 76.5936 120.44 76.6123 c +120.392 76.631 120.341 76.6404 120.289 76.6404 c +120.221 76.6404 120.159 76.6282 120.101 76.6038 c +120.043 76.5797 119.989 76.5432 119.941 76.4944 c +119.892 76.4459 119.854 76.3943 119.826 76.3402 c +119.798 76.286 119.778 76.2288 119.767 76.169 c +119.763 76.1616 119.76 76.1531 119.758 76.1437 c +119.756 76.1344 119.755 76.1259 119.755 76.1185 c +119.755 76.1072 119.755 76.0978 119.755 76.0905 c +119.755 76.0828 119.755 76.0754 119.755 76.0681 c +119.755 74.3562 l +119.273 74.3562 l +119.273 76.0343 l +119.273 76.1165 119.262 76.1934 119.239 76.2645 c +119.217 76.3354 119.183 76.4008 119.138 76.4609 c +119.093 76.5208 119.037 76.5655 118.97 76.5956 c +118.903 76.6254 118.826 76.6404 118.74 76.6404 c +118.631 76.6293 118.541 76.6049 118.47 76.5675 c +118.399 76.5301 118.347 76.4797 118.313 76.4159 c +118.279 76.3524 118.254 76.2849 118.237 76.2138 c +118.22 76.1429 118.212 76.0698 118.212 75.9949 c +118.212 75.9912 118.212 75.9876 118.212 75.9839 c +118.212 75.9782 l +118.212 74.3562 l +117.724 74.3562 l +117.724 76.2138 l +closepath +122.23 78.2456 m +122.23 75.7256 l +122.23 75.576 122.249 75.4422 122.286 75.3242 c +122.324 75.2066 122.378 75.1026 122.449 75.0127 c +122.524 74.9231 122.613 74.8557 122.716 74.8109 c +122.819 74.7658 122.936 74.7434 123.067 74.7434 c +123.19 74.7434 123.3 74.7613 123.398 74.7967 c +123.495 74.8324 123.579 74.8857 123.65 74.9566 c +123.718 75.0277 123.774 75.1026 123.819 75.1811 c +123.864 75.2599 123.897 75.3401 123.92 75.4226 c +123.927 75.4413 123.932 75.4609 123.934 75.4816 c +123.936 75.502 123.939 75.5235 123.942 75.5459 c +123.946 75.5686 123.949 75.5899 123.95 75.6105 c +123.952 75.6312 123.953 75.6508 123.953 75.6695 c +123.953 75.8192 123.934 75.9501 123.894 76.0624 c +123.855 76.1746 123.798 76.2662 123.723 76.3374 c +123.649 76.4122 123.569 76.4711 123.485 76.5142 c +123.401 76.5573 123.313 76.5843 123.224 76.5956 c +123.213 76.5956 123.202 76.5956 123.193 76.5956 c +123.184 76.5956 123.175 76.5956 123.168 76.5956 c +123.164 76.5956 123.159 76.5956 123.154 76.5956 c +123.148 76.5956 123.143 76.5973 123.14 76.6013 c +123.132 76.6013 123.126 76.6013 123.123 76.6013 c +123.119 76.6013 123.115 76.6013 123.112 76.6013 c +123.056 76.6013 123.003 76.5973 122.954 76.5899 c +122.906 76.5826 122.861 76.5712 122.82 76.5562 c +122.779 76.5412 122.738 76.5253 122.699 76.5086 c +122.66 76.4918 122.62 76.474 122.578 76.4553 c +122.573 76.4496 l +122.567 76.4496 l +122.56 76.4459 122.552 76.4422 122.545 76.4383 c +122.537 76.4346 122.532 76.4329 122.528 76.4329 c +122.52 76.4289 122.514 76.4252 122.508 76.4215 c +122.503 76.4179 122.496 76.4142 122.489 76.4102 c +122.474 76.4065 122.46 76.402 122.446 76.3963 c +122.433 76.3906 122.419 76.3841 122.404 76.3768 c +122.404 76.8762 l +122.446 76.8949 122.486 76.9136 122.525 76.9323 c +122.564 76.9511 122.605 76.9678 122.646 76.9828 c +122.687 76.9978 122.728 77.0109 122.769 77.0222 c +122.81 77.0333 122.853 77.0426 122.898 77.0503 c +122.917 77.054 122.936 77.0568 122.957 77.0585 c +122.978 77.0605 122.999 77.0633 123.022 77.067 c +123.033 77.067 123.043 77.067 123.053 77.067 c +123.062 77.067 123.072 77.069 123.084 77.0727 c +123.091 77.0727 123.1 77.0727 123.112 77.0727 c +123.123 77.0727 123.134 77.0727 123.145 77.0727 c +123.321 77.0727 123.486 77.0435 123.639 76.9856 c +123.793 76.9275 123.937 76.8388 124.071 76.7189 c +124.206 76.603 124.308 76.4646 124.377 76.3036 c +124.446 76.1429 124.481 75.9615 124.481 75.7594 c +124.481 75.5723 124.451 75.3926 124.391 75.2205 c +124.331 75.0484 124.242 74.8838 124.122 74.7267 c +124.006 74.5694 123.859 74.4534 123.681 74.3786 c +123.503 74.3038 123.298 74.2664 123.067 74.2664 c +122.835 74.2664 122.633 74.3029 122.461 74.3758 c +122.288 74.4489 122.146 74.56 122.034 74.7097 c +121.922 74.8633 121.837 75.0269 121.781 75.2009 c +121.725 75.375 121.697 75.5609 121.697 75.7594 c +121.697 78.2456 l +122.23 78.2456 l +closepath +124.969 78.2904 m +125.497 78.2904 l +125.497 76.6965 l +127.181 76.6965 l +127.181 78.2904 l +127.708 78.2904 l +127.708 74.3562 l +127.181 74.3562 l +127.181 76.169 l +125.497 76.169 l +125.497 74.3562 l +124.969 74.3562 l +124.969 78.2904 l +closepath +F +%%PageTrailer +showpage +%%Trailer +end +%%DocumentSuppliedResources: procset Linux-Sketch-Procset 1.0 2 +%%EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/general_settings.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,80 @@ +\section{Configuring the GNV-Server} + +The configuration of the artifact- and mapserver is been done in the +central configuration directory at {\tt artifact-server/conf/}. The +central entry point is the file {\tt conf.xml}. All components of the +configuration are linked from this document. + +{\bf Within the configuration the key +{\verb+${artifacts.config.dir}+} can be used to reference the central +configuration directory of the artifact-server instance, e.g. +\texttt{/opt/artifact-server/conf}.} + +The following structure gives an overview of the entire structure +starting from {\tt conf/}: + +%% tree /opt/artifact-server/ +\begin{lstlisting} +conf/ +|-- arcsdeconnectionpool.properties # database connection +|-- charttemplate.xml # general properties for chart generation +|-- conf.xml # central configuration +|-- ehcache.xml # configuration of caching system +|-- log4j.properties # logging of server +|-- maptemplates # style defintions for rendering maps +| `-- *.vm +|-- meshwidth.xml # buffer-size for querying different FIS on + # meshes +|-- palette # styling for 2D charts +| `-- *.xml +|-- products # configuration of steps in workflows +| |-- horizontalcrosssection +| | `-- *.xml +| |-- horizontalprofile +| | `-- *.xml +| |-- layer +| | `-- *.xml +| |-- timeseries +| | |-- *.xml +| | `-- timegap_definition.xml # definition of a gaps as defines in MEDIAN Coded Value Domains section TSIntervalTypes. The meaning of the defined gaps are detailed explained in the file itself. +| |-- verticalcrosssection +| | `-- *.xml +| `-- verticalprofile +| `-- *.xml +`-- queries.properties # SQL configuration according to products +\end{lstlisting} + + +The central config-file {\tt conf/conf.xml} is XML-based and contains the +following main elements: + +\begin{lstlisting} +artifact-database +|-- geo-backend # pointing to database connection, SQL configuration +|-- rest-server # port, listen addresses +|-- database # internal database storing artifacts +|-- ehcache # pointing to cache configuration +|-- cleaner # time of cleanups FIXME +|-- export-secret # signing project files +|-- factories # list of expert information systems +|-- artifacts # list of products +|-- gnv # charts, palettes, interpolation parameters +|-- mapserver # integration of mapserver +`-- velocity # templating language used in maptemplates +\end{lstlisting} + +The documentation of the configuration will be split up in 4 sections +addressing different tasks: +\begin{enumerate} + \item "Configuring and Running Artifact-Server" covering the main elements + \texttt{ +geo-backend, rest-server, database, ehcache, cleaner, export-secret} + \item "Generating Charts -- Background and Configuration" covering + the main element {\tt gnv} + \item "Generating Maps -- Background and Configuration" covering the + main elements {\tt mapserver, velocity} + \item "Configuring FIS, Products, States, Transitions and + SQL-Statements" covering the main elements {\tt factories, + artifacts} +\end{enumerate} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/generating_charts.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,84 @@ +\subsection{Generating Charts -- Background Information and Configuration} + +The artifact-server is able to render different types of charts like 1D +(timeseries, vertical- and horizontalprofiles, horizontal-cross-section +profiles (a special case of the horizontalprofiles) and histograms) and 2D-diagrams +(vertical-cross section profiles). This section describes the +possibilities to configure different aspects for interpolating of data and +visualising them in charts. + +\begin{lstlisting} +artifact-database +`-- gnv # charts, palettes, interpolation parameters + |-- charttemplate + |-- palettes + |-- horizontal-cross-section-profile + `-- vertical-cross-section +\end{lstlisting} + +\paragraph*{charttemplate} +{\em Function}: The chart template is a global template for setting the +visualization of charts globally like font styles, background, title, +subtitle, etc. Further information can be found in the configuration +file referenced via the attribute {\tt configuration}. + +\begin{itemize} + \item {\tt configuration}: path to the configuration XML-file. +\end{itemize} + + +\paragraph*{palettes} +{\em Function}: This section lists the available palettes used for rendering +vertical-cross-section charts (2D). Each {\tt palette}-element contains +the following attributes: + +\begin{itemize} + \item {\tt name}: a descriptive name. + \item {\tt parameter-ids}: identifier used as keys for matching + between data (from the database) and palette. {\bf The {\tt + parameter-ids} have to been in sync with the database parameters + (normally in {\tt MEDIAN.Parameter})} + \item {\tt description}: a description. + \item {\tt file}: reference to the defintion of the palette. +\end{itemize} + +For defining ranges for a palette, a range is definied by: + +\begin{itemize} + \item {\tt index}: Index for accessing the explicit range from the + program logic. + \item {\tt from}: lower limit of a range. + \item {\tt to}: upper limit of a range + \item {\tt rgb}: Red-Green-Blue (RGB) value for rendering the range + \item {\tt description}: description for rendering the legend. For + special characters use HTML-encoded values like {\tt \<} for $<$ + or {\tt \>} for $>$. +\end{itemize} + + +\paragraph*{horizontal-cross-section-profile} + +{\em Function}: Parameterization for the interpolation algorithm for +horizontal-cross-section-profile calculating the interpolated value +along the distance. + +\begin{itemize} + \item {\tt samples}: Number of samples calculated for a + interpolation along the passed geometric line. +\end{itemize} + + +\paragraph*{vertical-cross-section} +{\em Function}: Parameterization for the interpolation algorithm for +vertical-cross-sections (2D-charts). + +\begin{itemize} + \item {\tt samples}: Parameters for defining the interpolation grid. + {\tt width} for horizontal distances; {\tt height} for the vertical + distance. + \item {\tt ground}: {\tt interpolation} method for calculating the + interpolation from the last measured value against the seafloor. + Available methods are {\tt nearest-neighbor | bilinear | bicubic}.\\ + {\tt fill-color}: setting the file color for the seafloor in the + diagram. +\end{itemize}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/generating_maps.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,149 @@ +\subsection{Generating Maps-- Background Information and Configuration} + +The artifact-server is able to process geographic data and provide them +for a WMS service rendering maps via a HTTP-based interface. The +following process chains are covered. For generating horizontal-cross sections, +the following steps have to be processed: + +\begin{enumerate} +%% FIXME: When do we clip? Sequence will influence the interpolation + \item Selecting the data from datawarehouse + \item Clipping the datasets along the passed polygon + \item Calculating interpolation in the plane + \item Generating contour lines + \item Matching processed parameter data to the corresponding style + \item Rendering requested map +\end{enumerate} + +For generating maps from object-based datamodels like CONTIS, NAUTHIS +and Marine Features, just the following steps are needed: + +\begin{enumerate} + \item Selecting the data from datawarehouse + \item Clipping the datasets along the passed polygon + \item Matching processed object data to the corresponding style + \item Rendering requested map +\end{enumerate} + +In order to understand the configuration facilities for generating maps +in more detail, the internal +interaction of the artifact-server and the mapserver is described below +for the use case when a user parameterizes a horizontal-cross-section +profile and visualizes it as a map (without regarding the caching +facilities) + +\begin{enumerate} + \item After finishing the parameterization, the artifact-server + requests the data from the database-backend and processes the data + (see above). + + \item By requesting a map in the GNV-WebClient, the artifact-server writes + a ESRI shapefile with (clipped) geometries, attribute data, projection + information and a special file storing meta information (\texttt{meta.xml}) + for this artifact in the a corresponding directory in the + \texttt{shapefile-directory}. + + \item After that the so called \texttt{map-generator} is triggered. The + map-generator searches the \texttt{shape-directory} and its subfolders with + all existing \texttt{meta.xml} files and generates a central configuration + file for the mapserver at \texttt{ map-generator/mapfile@path}. Each + shapefile will be published as a WMS layer. \\ + The generated mapfile is constructed out of a base template from \texttt{ + map-generator/templates/maptemplate} and a parameter-/layer-specific part + generated from \texttt{map-generator/templates/path}. The selection of the + correct file-based templates is extracted out of the + \texttt{meta.xml}-file. + + \item The matching between the generated geograpic data and the + corresponding style files is been done by the artifact-server, constructing + filenames of maptemplates out of parameter-information. For + horizontal-cross-sections the schema looks like this \texttt{ + horizontalcrosssection\_\$NAME-OF-PARAMETER}; for layer-orientated FIS like + e.g. NAUTHIS and CONTIS like this \texttt{ + layer\_\$ID\_MAPSERVICE\_\$ID\_LAYER} e.g. + \texttt{layer\_BSH\_IMS\_CONTIS\_Resources\_2}. + %% FIXME@TE: Marine Feature? Name of WMS? + In order to set at least title, geometry-type and path to the + corresponding shapefile dynamically a templating language, called + \texttt{velocity} is used. + + \item The corresponding subfolder of an artifact in \texttt{ + shape-directory} with their shapefiles + and \texttt{meta.xml}-document will be deleted after the time of + expiry. By triggering the \texttt{map-generator} the next time, the + geographic data and the central configuration of the mapserver will + be updated. + +\end{enumerate} + +The coupling of the artifact-server and mapserver is free of +maintenance. The artifact-server as master cares about deleting and +updating the configuration of the mapserver. + +\begin{lstlisting} +artifact-database +|-- gnv # charts, palettes, interpolation parameters +| |-- map-generator +| |-- shapefile-directory +| `-- horizontal-cross-section +|-- mapserver +`-- velocity +\end{lstlisting} + +\paragraph*{mapserver} +{\em Function}: URL of the mapserver where request can be send to. The +URL will be used for displaying the location e.g. in the GNV-WebClient and in +the {\tt meta.xml}-file. + +\begin{itemize} + \item {\tt server}: URL of the mapserver where request can send to. +\end{itemize} + +\paragraph*{velocity} +{\em Function}: Templating language used in the maptemplates at +\texttt{map-generator/templates/path} for accessing the parameters from +dynamically generated \texttt{meta.xml}-configuration of artifacts. + +\begin{itemize} + \item {\tt logfile}: Setting the path to write log files. \\ + Preconfigured to \texttt{/var/log/artifacts/velocity.log}. + {\bf Just + absolute pathes are allowed here!} +\end{itemize} + +\paragraph*{map-generator} +{\em Function}: Mechanism for generating configuration for the {\tt +mapserver} dynamically. For background information about the interaction +between artifact-server and mapserver, see above. + +\begin{itemize} + \item {\tt mapfile}: path to the mapfile accessed by the WMS wrapper + {\tt gnv-wms} + \item {\tt templates}: \\ {\tt path} to the directory where + parameter-specific mapconfiguartions (as *.vm) are stored. + \\ {\tt + maptemplate} containing the WMS instance-specific configurations and + metadata, like overall boundingbox, spatial reference systems and + contact data. + \end{itemize} + +\paragraph*{shapefile-directory} +{\em Function}: Pointer where shapefiles for map-generation are stored + +\begin{itemize} + \item {\tt path}: path to the directory where shapefiles are stored + and accessed by {\tt mapserver} +\end{itemize} + +\paragraph*{horizontal-cross-section} +{\em Function}: Parameterization for the interpolation algorithm for +horizontal-cross-sections (maps). + + +\begin{itemize} + \item {\tt sample}: The attribute {\tt number} sets the number of + steps for the interpolation grid. + \item {\tt ground}: {\tt interpolation} method for calculating the + interpolation from the last measured value in meshes against the seafloor. + Available methods are {\tt nearest-neighbor | bilinear | bicubic}. +\end{itemize}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/miscellanea.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,14 @@ +\section{Miscellanea} + +This section describes some additional possibilities to affect the +behaviour of the GNV-server. They should only be used if the +consequences for the system are known: + +\begin{itemize} + \item artifact.database.dir The folder where the configuration of + the artifact-server is located. + \item caching.cleaner.interval: The Interval in seconds the caches should be + cleaned compared to updates in the database. + \item chart.gap.percentage: gap-size in percent for evaluating gaps + in in the products timeseries, vertical- and horizontal-profile. +\end{itemize}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/model_of_transitions.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,860 @@ +\section{Model of transitions} +\subsection{Overview of Subject-Specific Configuration: From FIS, Products, States, +Transitions and SQL-statements} + +The GNV-system provides several expert information systems (FIS). Within a FIS +users can select products for analysing and visualising different +subject-specific issues like timeseries diagrams and different types of +profiles. In order to generate these products, different kind of data out of the +dataware house is needed. + +The configuration is mainly split up into two steps\footnote{Except for +integrating the MapViewer. There is a third step necessary by configuring +additional tables in the datawarehouse}: +\begin{enumerate} + \item FIS and their according products (Metainformation) + \item Products with their states, transitions, outputs and SQL-statements + (Implementation) +\end{enumerate} + +%% TODO to improve: Add a Screenshot of the GNV WebClient marking GUI elements for FIS, +%% product, states and transitions + +Main entry point for the configuration also is the file {\tt conf/conf.xml } +defining the list of FIS and the according products based on the different +datamodels in the datawarehouse. + +The provided datamodels are: + +\begin{enumerate} + \item ESRI ArcMarineBSH with following subtypes + \begin{enumerate} + \item TimeSeriesPoints + \item MeshFeatures + \item Measurements/InstantaneousPoints + \item Marine Features + \end{enumerate} + \item ESRI ArcS57, + \item CONTIS +\end{enumerate} + +Each product configuration consists of a datamodel specific configuration +organized in a product specific folder in {\tt conf/products} \footnote{The +special case of a {\tt Horizontales Schnittprofil} is configured in +{\tt conf/horizontalprofile/conf\_mesh\_cross.xml} }. The directory layout looks +like this: + +\begin{verbatim} +products/ +|-- horizontalcrosssection +| `-- conf_mesh.xml +|-- horizontalprofile +| |-- conf_instantaneouspoint.xml +| |-- conf_mesh.xml +| `-- conf_mesh_cross.xml +|-- layer +| `-- conf.xml +|-- timeseries +| |-- conf_mesh.xml +| |-- conf_timeseriespoint.xml +| `-- timegap_definition.xml +|-- verticalcrosssection +| `-- conf_mesh.xml +`-- verticalprofile + |-- conf_instantaneouspoint.xml + |-- conf_mesh.xml + `-- conf_timeseriespoint.xml +\end{verbatim} + +The subtypes of the ArcMarineBSH based datamodel are configured in the files below: +\begin{itemize} + \item TimeSeriesPoints: {\tt conf\_timeseriespoint.xml} + \item Mesh: {\tt conf\_mesh.xml} + \item InstantaneousPoints: {\tt conf\_instantaneouspoint.xml} +\end{itemize} + +Within each of these files, the steps for gathering the values for the +parameterisation are configured by defining states, transitions and outputs +(c.f. \ref{ref:config-a-product}). The definition of states, transitions and +outputs reference the actual SQL-statements via an identifier. The SQL-statements +are gathered in the file {\tt conf/queries.properties}. + + +\subsection{Background information of the XML configuration} + +It is possible to configure the GNV in many ways. +It is possible to add or remove FIS, add or remove products from a FIS or +to manipulate the steps which must be prepared until products like +a diagram or CSV-export can be generated. + +The configuration of the provided FIS are divided in three main parts. + +\begin{itemize} + \item Configuration of the list of FIS via {\tt artifact-factories} + \item Configuration of main {\tt artifacts} which will be instantiated if an + {\tt artifact-factory} was called. + \item Configuration of the different {\tt artifacts} which provides products which can be + served by the FIS. +\end{itemize} + +\subsubsection{Configuration of a FIS} +The point of entry into the system is to configure an {\tt artifact-factory}. +Each artifact-factory represents one FIS. +It is possible to configure several {\tt artifact-factories}, which +represent the list of FIS in GUI. +The {\tt artifact-factories} will be configured in the section +\texttt{/artifact-database/artifact-factories} of the configuration-file. + +\begin{lstlisting} +<artifact-factory name='fis_NEWFISNAME' + description='Factory to create an artifact to be used with the FIS NEWFISNAME' + ttl='3600000' + artifact='de.intevation.artifactdatabase.ProxyArtifact'> + de.intevation.gnv.artifacts.GNVProductArtifactFactory +</artifact-factory> +\end{lstlisting} + +At this moment the following attributes of an {\tt artifact-factory} are +configurable: +\begin{itemize} + \item {\tt name}: The name of the {\tt artifact}. Must be unique in one {\tt artifact-server} + \item {\tt description}: Short description which job the {\tt artifact-factory} has to do. + \item {\tt ttl}: The time to live: The time using milliseconds an + {\tt artifact}, created using this factory, can live without any + user-interaction. + \item {\tt artifact}: The name of the class of the {\tt artifact} which should be created. +\end{itemize} + +The next listing shows the dependencies between the FIS and the name +of the {\tt artifact-factory} which belongs to it. + +\begin{itemize} + \item Marnet: {\tt fis\_marnet} + \item IMIS: {\tt fis\_imis} + \item STAUN: {\tt fis\_staun} + \item Modeldata {\tt fis\_modeldata} + \item Iceclimatology: {\tt fis\_eisklimatologie} + \item Ice Station Report: {\tt fis\_icestations} + \item SST: {\tt fis\_sst} + \item Delphin: {\tt fis\_delphin} + \item Thermosalinograph: {\tt fis\_thermosalinograph} + \item Chemusurvey: {\tt fis\_chemusurvey} + \item GTS: {\tt fis\_gts} + \item CTD: {\tt fis\_bsh\_ctd} + \item XBT: {\tt fis\_bsh\_xbt} + \item SeaCat: {\tt fis\_seacat} + \item Sea State: {\tt fis\_seastate} + \item Current Meter: {\tt fis\_currentmeter} + \item Nauthis: {\tt fis\_nauthis} + \item Contis: {\tt fis\_contis} + \item Marine Features: {\tt fis\_marinefeatures} +\end{itemize} + +\subsubsection{Configuration of main Artifact} +For each {\tt artifact-factory} it is necessary to configure one {\tt artifact} which will be +created using the factory. +This {\tt artifact} is the representation of the specific FIS. +It contains the configuration which products will be served for this FIS. + +The {\tt artifacts} are configured in the section {\tt /artifact-database/artifacts} of +the configurationfile. + +\begin{lstlisting} +<artifact name='fis_NEWFISNAME'> + <products> + ... + </products> +</artifact> +\end{lstlisting} + +The key is to use the same name for the {\tt artifact} as used for the {\tt artifact-factory}. +The name has to be unique. +In the section {\tt /artifact/products} it is possible to define several products as +explained in the next section. + +\subsection{Products to an FIS} +One FIS can provide several products. +To do this it is required to configure them as shown below in the section +{\tt /artifact/products} + +\begin{lstlisting} +<product name= "timeSeries"> + <artifact-factory name="timeSeries" + description="Artiefactfactory for Instantiating the Artifact for TimeSeries on TimeSeriesPoints" + ttl="300000" + artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact"> + de.intevation.gnv.artifacts.GNVArtifactFactory + </artifact-factory> + <parameters> + <parameter name="sourceid" + value="4"/> + <parameter name="fisname" + value="fis\_marnet"/> + </parameters> + </product> + \end{lstlisting} + +Each {\tt product} is also represented by an {\tt artifact}. In order to +create this {\tt artifact}, the {\tt artifact-factory} has to be used. +It is configured in each product +({\tt /product/artifact-factory}). + +Each product can have several parameters ({\tt +/product/parameters/parameters}). The {\tt parameter} named {\tt +sourceid} and {\tt fisname} are required parameters. + +The parameter {\tt fisname} contains the key to the name of the FIS. The +key must be unique. The parameter {\tt sourceid} contains the key to +identify the FIS in the datawarehouse. ({\tt MEDIAN.SOURCEINFO}) + + +\subsubsection{Configuration of an Product} +\label{ref:config-a-product} +The {\tt products} of the different FIS are also modeled as artifact-objects. +The different products which are currently available are stored in separate +files in the folder {\tt project}. + +In those files the workflow of each product is configured. Each step which is +required to model a new diagram is represented using a {\tt state} in the +configuration-file. + +%% FIXME: fix wording +To move between those {\tt states} it is required to model {\tt transitions} which define +between which states it is possible to move and which conditions must be +fulfilled. + +The last step is called {\tt output-state}. This state is responsible to generate the +output for the different formats which can be served from the product ({\tt Diagram, +CSV, ODV, WMS,..}.). + +\paragraph{States} +A {\tt state} is one step which is required to fetch the data for generating e.g. an +diagram. + +For example in each product it is possible to choose one or more parameters. + +To configure a state you have to use a XML-fragment as shown below: + +\begin{lstlisting} +<state id="timeseries_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>timeseries_parameter</queryID> + <dataname>parameterid</dataname> + <data-multiselect>true</data-multiselect> + <inputvalues> + ... + </inputvalues> +</state> +\end{lstlisting} + +At this moment the following attributes of an {\tt state} are configurable. +\begin{itemize} + \item {\tt id}: The name of the artifact. Must be unique in one artifact-server + \item {\tt description}: Short description which job the artifact-factory has to do. + \item {\tt queryID}: The id of the query which should be used to fetch the data + displayed in this state. All queries are defined in the file + conf/queries.properties + \item {\tt dataname}: The id of the data which will be displayed in this state. + The id will be use to localize the description of the data. + The localization is located in module gnv-artifacts in folder + src/main/resources. + \item {\tt data-multiselect}: {\tt true} it is possible to select 1 or more items. + {\tt false} it is possible to select only one item. + \item {\tt inputvalues}: The values which can be "feed" to this state and which + will be used as values in SQL-statements. +\end{itemize} + +\paragraph{Input Values of a State} +At section {\tt /state/inputvalues} it is possible to add definitions for inputvalues. +Those values have two meanings for the {\tt state}. + +\begin{itemize} + \item They were used to fill the SQL-statements to fetch the data. + (Each entry replace one ore more "?" ) + \item They were used to validate the inputdata which is "feed" to + the FIS in the current state. +\end{itemize} + +{\bf WARNING: The order of the input-values is significant at which position the value will +be put into the SQL-statement!} + +It is possible to add one inputvalue twice or more often to put its value at +different positions of the SQL-statement. + +\begin{lstlisting} +<inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/> +</inputvalues> +\end{lstlisting} + +\begin{itemize} + \item {\tt name}: Name of the value that could be feed or should be used in SQL-statment. + The name must fit to one dataname configured in this state or one other + state which was visited before. + \item {\tt type}: The type of the value. This is required for the validation + of the value. + This might be String, Integer, Double, Date, Point, LineString, + Polygon, Coordinate, Geometry and AttributeName. \\ + Coordinate is a format which accepts geographical coordinates in + the following Syntax: 56n30 6e20 \\ + AttributeName marks a stringvalue which will be used in + SQL-statement without surrounding with "'" in the statement. + Usage is e.g. for determining the Axis (i or j) in the workflow + of Horizontalprofiles. + \item {\tt multiselect}: true if more than on value can be feed or put into the SQL-statement. + false if one on value will be accepted. + \item {\tt usedinquery}: Number how often the value should be put into the SQL-statement: + 0: Value will not out into the statement. + 1: Value will put once into the statement, + 2 or more: Value will be put as often as configured + into the SQL-statement (this is useful if + inner-selects are used) +\end{itemize} + +The next part will explain the usage of inputvalues. + +This SQL-statement is configured to use in the state above, which will fetch +all parameter-ids with the according german name which are reffered to the given +TimeSeriesPoint (e.g.Arkona Basin Buoy FeatureID = 100011 ) + + +\begin{lstlisting} +SELECT DISTINCT + p.PARAMETERID KEY, + p.GERMANNAME || ' ['|| p.UNIT ||']' VALUE, + p.GERMANNAME +FROM MEDIAN.PARAMETER P, + MEDIAN.TIMESERIES TS, + MEDIAN.TIMESERIESVALUE TSV, + MEDIAN.MEASUREMENT M, + MEDIAN.TIMESERIESPOINT TSP +WHERE M.FEATUREID = TSP.FEATUREID AND + M.MEASUREMENTID = TSV.MEASUREMENTID AND + TS.TIMESERIESID = TSV.TIMESERIESID AND + P.PARAMETERID = TS.PARAMETERID AND + TSP.FEATUREID = ? +ORDER BY P.GERMANNAME +\end{lstlisting} + +Including inputvalues, the example for choosing the FIS ({\tt fisname}) +and the Station 342 ({\tt featureid}: Arkona Basin Buoy) will look like +this: +\begin{itemize} + \item {\tt featureid}: 100011 (Marnet $\rightarrow$ Arkona Basin Buoy) + \item {\tt fisname}: fis\_marnet + \item {\tt parameterid}: not set because it's the value that should be + chosen in this state. +\end{itemize} + +\begin{lstlisting} +SELECT DISTINCT + p.PARAMETERID KEY, + p.GERMANNAME || ' ['|| p.UNIT ||']' VALUE, + p.GERMANNAME +FROM MEDIAN.PARAMETER P, + MEDIAN.TIMESERIES TS, + MEDIAN.TIMESERIESVALUE TSV, + MEDIAN.MEASUREMENT M, + MEDIAN.TIMESERIESPOINT TSP +WHERE M.FEATUREID = TSP.FEATUREID AND + M.MEASUREMENTID = TSV.MEASUREMENTID AND + TS.TIMESERIESID = TSV.TIMESERIESID AND + P.PARAMETERID = TS.PARAMETERID AND + TSP.FEATUREID = 100011 +ORDER BY P.GERMANNAME +\end{lstlisting} + +The value of {\tt featureid} will be inserted into the query because +the attribute {\tt usedinquery} is set to "1". + +The values of the inputvalues {\tt fisname} and {\tt parameterid} will be +excluded because the attribute {\tt usedinquery} is set to "0" + + +If the attribute {\tt usedinquery} of the inputvalue {\tt featureid} is set to "2" +this might happen. + +\begin{lstlisting} +<inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/> +</inputvalues> +\end{lstlisting} + +\begin{lstlisting} +SELECT DISTINCT + ... + TSP.FEATUREID = ? AND + TSP.FEATUREID = ? + ORDER BY P.GERMANNAME +\end{lstlisting} + +This SQL-statement will be modified to + +\begin{lstlisting} +SELECT DISTINCT + ... + TSP.FEATUREID = 100011 AND + TSP.FEATUREID = 100011 +ORDER BY P.GERMANNAME +\end{lstlisting} + + +At the next step of the workflow it is nessesary to determine all depths where +the choosen parameters are measured. +To do this we might have the following inputvalues: + +\begin{lstlisting} +<inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="measurementid" type="Integer" multiselect="true" usedinquery="0"/> +</inputvalues> +\end{lstlisting} + +\begin{itemize} + \item {\tt featureid}: 100011 (Marnet $\rightarrow$ Arkona Basin Buoy) + \item {\tt fisname}: fis\_marnet + \item {\tt parameterid}: 2 (Salzgehalt [pSal]) + \item {\tt measurementid}: not set because it's the value that should be + chosen in this state. +\end{itemize} + +\begin{lstlisting} +SELECT DISTINCT + M.MEASUREMENTID KEY, + M.ZLOCATION VALUE, + P.PARAMETERID PARAMETERID +FROM MEDIAN.MEASUREMENT M, + MEDIAN.TIMESERIESVALUE TSV, + MEDIAN.TIMESERIES T, + MEDIAN.PARAMETER P +WHERE M.MEASUREMENTID = TSV.MEASUREMENTID AND + TSV.TIMESERIESID = T.TIMESERIESID AND + T.PARAMETERID = P.PARAMETERID AND + M.FEATUREID = ? AND + M.FEATUREID = ? AND + P.PARAMETERID IN (?) +ORDER BY m.ZLOCATION DESC +\end{lstlisting} + +This SQL-statement will be modified to + +\begin{lstlisting} +SELECT DISTINCT + M.MEASUREMENTID KEY, + M.ZLOCATION VALUE, + P.PARAMETERID PARAMETERID +FROM MEDIAN.MEASUREMENT M, + MEDIAN.TIMESERIESVALUE TSV, + MEDIAN.TIMESERIES T, + MEDIAN.PARAMETER P +WHERE M.MEASUREMENTID = TSV.MEASUREMENTID AND + TSV.TIMESERIESID = T.TIMESERIESID AND + T.PARAMETERID = P.PARAMETERID AND + M.FEATUREID = 100011 AND + M.FEATUREID = 100011 AND + P.PARAMETERID IN (2) +ORDER BY m.ZLOCATION DESC +\end{lstlisting} + +The queries which are shown above are configurable. +Configuring takes place in the \\ file \texttt{queries.properties } which will +be explained in the next paragraph. + +\paragraph{Query-configuration (queries.properties)} +\label{ref:queries.properties} + +This file contains key-value-pairs to define SQL-statements. +All queries will be handle using the prepared-statement-syntax using "?" +to define a place where an dynamic value should be placed into the statement. + +There is one special implementation to support spatial access to the +{\tt ESRI ArcSDE}-database. This mechanism is used to realize the access to spatial- +objects. + +All queries containing the following literals will be handled separatly +using the ESRI ArcSDE-API. + +\begin{itemize} + \item {\tt ST\_ASTEXT(SHAPE)}: Will return the geometry as an WellKnowText (WKT) + \item {\tt ST\_ASTEXT(RASTER)}: Will return the raster in an readable way. + \item {\tt INTERSECTS(SHAPE,"?")}: Will only return the elements which geometry + intersects the given geometry ("?" will be + replace with an WKT) +\end{itemize} + + +\paragraph{Transitions} + +To move between two states it is necessary to configure dependencies +between the different states. This dependencies are called {\tt +transitions}. + +There are different kinds of {\tt transitions} which can be used. +\begin{itemize} + \item Transitions which only link two states + \item Transition which link two states with a additional condition. + (e.g. If a region was selected in the Regionfilter or not ) +\end{itemize} + +The listing below shows a transition with an additional condition. +\begin{lstlisting} +<transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="timeseries_area"/> + <to state="timeseries_without_geom"/> + <condition inputvalue="areaid" value="n/n" operator="equal"/> +</transition> +\end{lstlisting} + +\begin{itemize} + \item {\tt from}: The {\tt id} of the {\tt state} which you have to come from + \item {\tt to}: The {\tt id} of the {\tt state} which can be reached. + \item {\tt condition}: The condition which have to be fulfilled. +\end{itemize} + +At this moment only {\tt EQUAL} and {\tt NOTEQUAL} are supported as +{\tt condition} for an {\tt ValueCompare\-Transition}. + +\paragraph{Outputstate} + +The {\tt outputstate} is a special {\tt state} which was created to define +the different possibilities of outputs for each product. +An {\tt outputstate} is handled as a {\tt state} which is described above. +Additionally you are able to configure which kind of outputs should +be provided. + +There are several {\tt outputstates}. Each one is designed to create +the output for one special product. + +\begin{itemize} + \item TimeSeries: {\tt TimeSeriesOutputState} + \item Horizontalprofile: {\tt HorizontalProfileOutputState} + \item Horizontalprofile on Meshes: {\tt HorizontalProfileMeshOutputState} + \item Verticalcrosssection: {\tt VerticalCrossSectionOutputState} + \item Verticalprofiles: {\tt VerticalProfileOutputState} + \item Horizontalcrosssections: {\tt HorizontalCrossSectionMeshOutputState} + \item Layer: {\tt LayerOutputState} +\end{itemize} + +All these outputstates are implemented in {\tt package de.intevation.gnv.state} +and its {\tt sub\-packages}. + +The fullqualified name of the {\tt outputstate} to the attribute +{\tt state} is shown below. + +An example for an {\tt outputstate}: + +\begin{lstlisting} +<state id="timeseries_calculate_results" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesOutputState"> + <queryID>timeseries_chart_data</queryID> + ... + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + ... + </outputsMode> + </outputsModes> + </state> +\end{lstlisting} + +At section {\tt /state/outputsModes} it is possible to add one ore more +{\tt outputmodes} to one state as shown in the next paragraph. + +\paragraph{OutputModes} + +It is possible to configure several {\tt outputmodes} in one {\tt outputstate}. +Inserting or deleting the configuration of a special +{\tt outputmode} will control if an item in the GUI will be displayed. + +{\bf +WARNING: IT MIGHT BE POSSIBLE THAT ONE OR MORE OUTPUTMODES ARE NOT + SUPPORTED BY AN PRODUCT. IN THAT CASE IT IS NECESSARY TO + IMPLEMENT THE REQUIRED FUNCTIONALITY BEFORE IT IS POSSIBLE + TO OFFER THIS OUTPUTMODE. +} + +Currently the following {\tt outputmodes} are supported: + +\begin{itemize} + \item {\tt chart} + \item {\tt histogram} + \item {\tt csv} + \item {\tt odv} + \item {\tt statistics} + \item {\tt wms} + \item {\tt shapefile} +\end{itemize} + +The following example shows how to configure an {\tt outputmode chart}: + +\begin{lstlisting} +<outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="points" type="Boolean" value="false"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> +</outputsMode> +\end{lstlisting} + + +\begin{itemize} + \item {\tt name}: The name of the mode. This must not be changed because it + is used by the program. + \item {\tt description}: a short description of this outputmode. + \item {\tt parameters}: one ore more parameters which will be shown in the + GUI e.g. for changing the size of an chart. + \item {\tt exportModes} : one or more formats which can be served. +\end{itemize} + + +\section{Adding a new FIS} +In this section it will be explained which steps have to be done to integrate a +new FIS into the {\tt artifact-server}. This will be done using the configuration for +a FIS which uses data from the table {\tt MEDIAN.TIMESERIES} section of +the datawarehouse (e.g. MARNET or STAUN). + +For publishing the changes to the {\tt artifact-server}, it needs to be +restarted. + +\subsection{Adding a new Artifact-factory} +First step is to add a new {\tt artifact-factory} to the configuration conf/conf.xml +To do this you have to add a new XML-fragment into the section +/factories/artifact-factories which look like that: + +\begin{lstlisting} +<artifact-factory name='fis_NEWFISNAME' + description='Factory to create an artifact to be used with the FIS NEWFISNAME' + ttl='3600000' + artifact='de.intevation.artifactdatabase.ProxyArtifact'> + de.intevation.gnv.artifacts.GNVProductArtifactFactory +</artifact-factory> +\end{lstlisting} + +In this XML-fragment you only have to replace the placeholder {\tt NEWFISNAME} +with a unique short name for the new FIS. + +\paragraph*{Example} +This example shows how to add a FIS and illustrates the effect on the +artifact-server's output. + +First , the following {\tt artifact-factory} has to be added into the file +{\tt conf/conf.xml} in section {\tt /artifact-database/artifact-factories} +adding a new FIS called {\tt justanewfis} to the server: + +\begin{lstlisting} +<artifact-factory name='fis_justanewfis' + description='Factory to create an artifact to be used with the FIS NEWFISNAME' + ttl='3600000' + artifact='de.intevation.artifactdatabase.ProxyArtifact'> + de.intevation.gnv.artifacts.GNVProductArtifactFactory +</artifact-factory> +\end{lstlisting} + +Restart the {\tt artifact-database} executing: + +\begin{lstlisting} +/etc/init.d/artifact-server restart +\end{lstlisting} + +Checking if the new FIS is served by the REST-Server +calling the following command: + +\begin{lstlisting} +curl http://localhost:8181/factories | xmllint --format - | grep fis_justanewfis +\end{lstlisting} + +If the FIS was added, the new {\tt artifact-factory} will be found in the generated +XML-output. Otherwise no XML-output will be shown. + +\subsection{Adding a new Artifact for Artifact-factory} +The next step is to define the artifact itself. +For this it is necessary to add an XML-fragment into the section +{\tt /artifacts} of the main configurationfile {\tt /conf/conf.xml}. + +\begin{lstlisting} +<artifact name='fis_NEWFISNAME'> + <products> + ... + </products> +</artifact> +\end{lstlisting} + +In this XML-fragment it is also required to replace the placeholder {\tt NEWFISNAME} +with the name which was used to configure the {\tt artifact-factory}. + +Now the {\tt artifact-server} can handle an additional FIS without any products yet. + +To prevent needless configuration-work, it is a useful way to clone an +existing artifact handling the same kind of work. + + +\paragraph*{Example} +Now will an artifact to the FIS {\tt fis\_justanewfis}, will be configured. + +The following XML-fragment has to be added to the file +{\tt conf/conf.xml} in section {\tt /artifact-database/artifacts}: + +\begin{lstlisting} +<artifact name='fis_justanewfis'> + <products> + </products> +</artifact> +\end{lstlisting} + +Restart the artifact-server + +\begin{lstlisting} +/etc/init.d/artifact-server restart +\end{lstlisting} + +Now it should be possible to choose the artifact. + +The listbox in the GUI would be empty. +\begin{lstlisting} +curl -d "@sample-documents/create-artifact.xml" http://localhost:8181/create | xmllint --format - +\end{lstlisting} + +\subsection{Adding/Removing Products to the Specific Artifact} +Next step is, to configure the different products which the FIS should +be able to provide. To do this it is necessary to copy the +XML-fragments of the products into the XML-element {\tt products} of the +previously integrated artifact. + +\begin{lstlisting} +<artifact name='fis_NEWFISNAME'> + <products> + <product name= "timeSeries"> + <artifact-factory name="timeSeries" + description="Artifactfactory for instantiating the artifact for TimeSeries on TimeSeriesPoints" + ttl="300000" + artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact"> + de.intevation.gnv.artifacts.GNVArtifactFactory + </artifact-factory> + <parameters> + <parameter name="sourceid" + value="VALUEOFSOURCEID"/> + <parameter name="fisname" + value="fis\_NEWFISNAME"/> + </parameters> + </product> + <product name= "verticalProfile"> + <artifact-factory name="verticalProfile" + description="Artifactfactory for instantiating the artifact for Verticalprofiles on TimeSeriesPoints" + ttl="300000" + artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact"> + de.intevation.gnv.artifacts.GNVArtifactFactory + </artifact-factory> + <parameters> + <parameter name="sourceid" + value="VALUEOFSOURCEID"/> + <parameter name="fisname" + value="fis\_NEWFISNAME"/> + </parameters> + </product> + </products> +</artifact> +\end{lstlisting} + +In this XML-fragment the placeholders {\tt NEWFISNAME} have to be +replaced. The source-id \texttt{VALUEOFSOURCEID} with the value for the new +FIS as defined in the table {\tt MEDIAN.SOURCEINFO} needs to be added. + +\paragraph*{Example} +Adding a product to the new FIS, choosing sourceid of an existing FIS +(e.g 4 $\rightarrow$ Marnet). + +Add the following XML-fragment to the new artifact. +\begin{lstlisting} +<product name= "timeSeries"> + <artifact-factory name="timeSeries" + description="Artifactfactory for instantiating the artifact for TimeSeries on TimeSeriesPoints" + ttl="300000" + artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact"> + de.intevation.gnv.artifacts.GNVArtifactFactory + </artifact-factory> + <parameters> + <parameter name="sourceid" + value="4"/> + <parameter name="fisname" + value="fis\_justanewfis"/> + </parameters> +</product> +\end{lstlisting} + +Restart the artifact-server + +\begin{lstlisting} +/etc/init.d/artifact-server restart +\end{lstlisting} + +If +\begin{lstlisting} +curl -d "@sample-documents/create-artifact.xml" http://localhost:8181/create | xmllint --format - +\end{lstlisting} + +is called, the product {\tt timeSeries} should be available for the FIS {\tt justanewfis}. + +Now, it should be able to choose the product. +This product including the definied outputformats should be available in +the GUI. + +\subsection{Adding a new Product} +To add a new product to the system it is necessary that the required +artifact representation is implemented in the {\tt sourcecode}. +Without doing that step it is not possible to create a new product. + +All products are configured in separated files that will be included into the +main configuration using Xlink-references. + +First step is to create a new file in the folder {\tt products} and in the +sub-folder where the product belongs to ({\tt timeseries,verticalprofile, +horizontalprofile,horizontal\-crosssection,layer,...}) + +Then the new product can be referenced in the file {\tt /conf/conf.xml} in the +section {\tt/artifacts} using the following XML-fragment. + +\begin{lstlisting} +<artifact name="timeSeries" + xmlns:xlink="http://www.w3.org/1999/xlink" + xlink:href="${artifacts.config.dir}/products/PATHTOFILE" /> +\end{lstlisting} + +The placeholder {\tt PATHTOFILE} has to be replaced with the relative path and +the name of the file starting in the folder products. + +Then it is possible to add the product to a FIS as explained in the next section. +Please note that the defined name of the {\tt artifact-factory} has to match to the +name of the added products which is also designed as an artifact. + +\subsection{Adding an additional Product to a FIS} +To add an additional product to a FIS the XML-fragment which +represents the product to the artifact-configuration of the FIS in section +{\tt /artifacts/artifact/products} needs to be added. + +\begin{lstlisting} + <product name= "timeSeries"> + <artifact-factory name="timeSeries" + description="Artifactfactory for instantiating the artifact for TimeSeries on TimeSeriesPoints" + ttl="300000" + artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact"> + de.intevation.gnv.artifacts.GNVArtifactFactory + </artifact-factory> + <parameters> + <parameter name="sourceid" + value="VALUEOFSOURCEID"/> + <parameter name="fisname" + value="fis\_NEWFISNAME"/> + </parameters> + </product> + \end{lstlisting} + +Please note that the placeholders have to be explained above.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/overview.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,88 @@ +\section{Overview of the GNV-Server} + +\subsection{Tasks and Components of the GNV-Server} + +The GNV-server is a middleware-component and consists of two functional +components: +\begin{enumerate} + \item artifact-server -- providing access to the database and + managing the users' workflow to the GNV-WebClient + \item mapserver -- providing user-generated maps. Mapserver is + controlled by the artifact-server. +\end{enumerate} + +%% TODO includegraphics + +The central concept of the artifact-server is to model the workflow of +users by the following steps: +\begin{enumerate} + \item selection of data (parameterization) + \item processing of result sets (interpolation, clipping) + \item exporting processed result sets (charts, statistics, raw data) +\end{enumerate} + +Within the artifact-server, these steps are supported by the following +core components for the entire GNV-system. The naming refers to +components used in the configuration. In order to simplify a first +orientation in the configuration and this manual, the XML-tags/words in +the central configuration file at {\tt conf/conf.xml} are used. They are +marked in {\tt typewriter} style: + +\begin{itemize} + \item {\tt geo-backend} -- access to the database backend + \item {\tt rest-server} -- providing a RESTful-Interface with a + XML-based protocol to serve the expert information systems (FIS) with + their products to different clients, e.g. GNV WebClient + \item {\tt factories/*}, {\tt artifacts/*} -- managing the steps and + operations of users' workflow for all expert information + systems (FIS) + \item {\tt gnv} -- processing pipeline providing results of the + products with the following subtasks: + \begin{itemize} + \item processing of result sets like interpolation, clipping + \item visualization of charts and maps + \item exporting selected raw data + \end{itemize} + \item {\tt mapserver} -- managing the Web Map Service for creating maps + dynamically +\end{itemize} + +Each component has a specific configuration for its functionality and +subsystems. + +\subsection{Internal Structure of the GNV-Server} + +\subsubsection{Internal Structure of Artifact-Server} +Per default the artifact-server can be found at {\tt +/opt/artifact-server}\footnote{Information about installation and +operation can be found in the admin-manual.}. The internal directory +structure of the artifact-server looks like this: + +%% tree /opt -d -L1 +\begin{lstlisting} +artifact-server +|-- artifactdb # storing artifacts in a database +|-- bin # binaries including all libraries +|-- cache # storage for cached data (e.g. result sets) +|-- conf # central configuration of artifact-server +|-- install # files for system integration (just for setup) +|-- mapfiles # generated configurations for map-server (done by + # map-generator) +`-- shapefiles # raw data for map generating (done by map-generator) +\end{lstlisting} + + +\subsubsection{Internal Structure of Mapserver} +Per default the mapserver can be found at {\tt +/usr/lib/cgi-bin}.\footnote{Information about installation and +operation can be found in the admin-manual.} The internal structure of +the mapserver looks like this: + +%% tree /usr/lib/ +\begin{lstlisting} +cgi-bin/ +|-- gnv-wms # wrapper pointing to the configuration (default: + # artifact-server/mapfiles/mapfile.map), invoked by + # webserver +`-- mapserv-gp # binary of mapserver, invoked by wrapper +\end{lstlisting}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/sample-documents/create-artifact.xml Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,1 @@ +<?xml version="1.0" encoding="UTF-8"?><art:action xmlns:art="http://www.intevation.de/2009/artifacts"><art:type name="create"/><art:factory name="fis_justanewfis"/></art:action>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/config-manual/title.tex Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,52 @@ +%----------------------------------- +% TITLE PAGE + +% FIXME BSH Logo + +\begin{figure}[ht] + \begin{minipage}[b]{0.5\linewidth} + \centering + \includegraphics[scale=0.75]{figures/bsh_logo} \\ + {\tt http://www.bsh.de/en}\\[4.0cm] + \end{minipage} + \begin{minipage}[b]{0.5\linewidth} + \centering + \includegraphics[width=0.75\textwidth]{figures/intevation-logo} + {\tt http://intevation.de/geospatial}\\[2.0cm] + \end{minipage} +\end{figure} + + \vspace{4cm} + + { + \sffamily\large + Documentation Generic Viewer + + \vspace{1cm} + { + \bfseries\huge + Configuration and Reference + } + + \vspace{1cm} + Version \documentversion~-~Date: \documentdate + +% Revision \documentrevision + } + + \vspace{4cm} + + \thispagestyle{empty} + + \vfill + + \begin{flushleft} + Authors:\\ + Tim Englich$<$tim.englich@intevation.de$>$\\ + Hans Plum $<$hans.plum@intevation.de$>$\\ + {\bf Intevation GmbH},\\ + Neuer Graben 17, 49074 Osnabrück, Germany\\ + Tel: ++49 541 33 50 83 - 0 \\ + http://www.intevation.net/geospatial + + \end{flushleft}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/licenses/overview.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,225 @@ +=============================================================================== +Primärabhängigkeiten: + * junit-3.8.1.jar (gnv + gnv-artifacts + geo-backend) + - Common Public License Version 1.0 + - http://www.opensource.org/licenses/cpl1.0.txt + + * log4j-1.2.14.jar (gnv + gnv-artifacts + geo-backend) + - Apache License Version 2.0 + + * jfreechart-1.0.13.jar (gnv-artifacts) + - LGPL v2.1 or later + + * batik-dom-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * batik-svggen-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * velocity-1.6.1.jar (gnv-artifacts) + - Apache License 2.0 + + * itext-2.1.7.jar (gnv-artifacts) + - Mozilla Public License 1.1 + + * opencsv-2.0.jar (gnv-artifacts) + - Apache License Version 2.0 + + * commons-math-2.0.jar (gnv-artifacts + geo-backend) + - Apache License Version 2.0) + + * ehcache-1.6.2.jar (gnv-artifacts + geo-backend) + - Apache License Version 2.0 + + * commons-validator-1.3.1.jar (gnv + gnv-artifacts) + - Apache License Version 2.0 + + * oro-2.0.8.jar (gnv-artifacts) + - Apache License 1.1 + + * gt-epsg-wkt-2.5.8.jar (gnv-artifacts) + - LGPL v2 or later + + * gt-shapefile-2.5.8.jar (gnv-artifact) + - LGPL v2 or later + + * jts-1.9.jar (gnv-artifacts + geo-backend) + - LGPL v2.1 or later) + + * trove-2.1.1.jar (gnv-artifacts) + - LGPL v2.1 or later + + * commons-fileupload-1.2.1.jar (gnv) + - Apache License Version 2.0 + + * commons-pool-1.3.jar (artifact-database + gnv-artifacts + geo-backend) + - Apache License Version 2.0) + + * org.restlet-2.0-SNAPSHOT.jar (artifact-database + gnv + gnv-artifacts) + - LGPL V3.0 or LGPL V2.1 or CDDL V1.0 or EPL V1.0) + + * org.restlet.ext.xml-2.0-SNAPSHOT.jar (artifact-database + gnv + gnv-artifacts) + - LGPL V3.0 or LGPL V2.1 or CDDL V1.0 or EPL V1.0 + + * servlet-api-5.5.15.jar (gnv) + - Apache License 2.0 + + * struts-1.2.9.jar (gnv) + - Apache License 2.0 + + * struts-el-1.2.9.jar (gnv) + - Apache License 2.0 + + * h2-1.1.117.jar (artifact-database + gnv-artifacts) + - Dual licensed: + - MPL 1.1 + - http://www.mozilla.org/MPL + - EPL 1.0 + - http://opensource.org/licenses/eclipse-1.0.php + + * postgresql-8.3-603.jdbc4.jar (artifact-database + gnv-artifacts) + - BSD License + + * commons-codec-1.4.jar (artifact-database + gnv-artifacts) + - Apache License Version 2.0 + + * jul-to-slf4j-1.5.11.jar (artifact-database + gnv-artifacts) + - MIT License + + * slf4j-log4j12-1.5.11.jar (artifact-database + gnv-artifacts) + - MIT License + +=============================================================================== +Sekundärabhängigkeiten: + * antlr-2.7.2.jar (gnv) + - ANTLR 3 License + - http://www.antlr.org/license.html + + * batik-awt-util-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * batik-css-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * batik-ext-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * batik-util-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * batik-xml-1.7.jar (gnv-artifacts) + - Apache License Version 2.0 + + * bcmail-jdk14-1.38.jar (gnv-artifacts) + - Bouncy Castle Licence (Adaption der Apache License) + - http://www.bouncycastle.org/licence.html + + * bcprov-jdk14-1.38.jar (gnv-artifacts) + - Bouncy Castle Licence (Adaption der Apache License) + - http://www.bouncycastle.org/licence.html + + * bctsp-jdk14-1.38.jar (gnv-artifacts) + - Bouncy Castle Licence (Adaption der Apache License) + - http://www.bouncycastle.org/licence.html + + * commons-beanutils-1.7.0.jar (gnv + gnv-artifacts) + - Apache License Version 2.0 + + * commons-collections-3.2.1.jar (gnv + gnv-artifacts) + - Apache License Version 2.0 + + * commons-dbcp-1.2.2.jar (artifact-database + gnv-artifacts) + - Apache License Version 2.0 + + * commons-digester-1.6.jar (gnv + gnv-artifacts) + - Apache License Version 2.0 + + * commons-lang-2.4.jar (gnv-artifacts) + - Apache License Version 2.0 + + * commons-logging-1.0.4.jar (gnv + gnv-artifacts) + - Apache License Version 2.0 + + * geoapi-2.2.0.jar (gnv-artifacts) + - eine OGC License + - http://www.opengeospatial.org/ogc/legal + + * gt-api-2.5.8.jar (gnv-artifacts) + - LGPL v2 or later + + * gt-main-2.5.8.jar (gnv-artifacts) + - LGPL v2 or later + + * gt-metadata-2.5.8.jar (gnv-artifacts) + - LGPL v2 or later + + * gt-referencing-2.5.8.jar (gnv-artifacts) + - LGPL v2 or later + + * jcommon-1.0.13.jar (gnv-artifacts) + - LGPL v2.1 or later + + * jdom-1.0.jar (gnv-artifacts) + - eigene Lizenz + - (siehe ./licenses/JDOM-LICENSE.txt) + + * jsr-275-1.0-beta-2.jar (gnv-artifacts) + - BSD License + - http://jscience.org/doc/license.txt + + * jstl-1.0.6.jar (gnv) + - Apache License 2.0 + + * oro-2.0.7.jar (gnv) + - Apache License 1.1 + + * osgi_R4_core-1.0.jar (artifact-database + gnv + gnv-artifacts) + - EPL 1.0 + + * slf4j-api-1.5.11.jar (artifact-database + gnv-artifacts) + - MIT License + + * standard-1.0.6.jar (gnv) + - Apache License 2.0 + + * velocity-1.4.jar (gnv-artifacts) + - Apache License 2.0 + + * velocity-dep-1.4.jar (gnv-artifacts) + - Apache License 2.0 + + * xalan-2.6.0.jar (gnv-artifacts) + - Apache License 2.0 + + * xalan-2.5.1.jar (gnv) + - Apache License 2.0 + + * xml-apis-1.0.b2.jar (gnv) + - Apache License 2.0 + - W3C License (siehe ./licenses/XML-APIS-DOM-LICENSE.txt) + + * xml-apis-1.3.04.jar (gnv-artifacts) + - Apache License 2.0 and W3C License + - (siehe ./licenses/XML-APIS-DOM-LICENSE.txt) + + * xml-apis-ext-1.3.04.jar (gnv-artifacts) + - Apache License 2.0 and W3C License + - (siehe ./licenses/XML-APIS-DOM-LICENSE.txt) + +=============================================================================== +Proprietäre Bibliotheken: + * jpe_sdkres-9.3.jar (gnv-artifacts + geo-backend) + + * jsde_sdk-9.3.jar (gnv-artifacts + geo-backend) + + * jpe_sdk-9.3.jar (gnv-artifacts + geo-backend) + +=============================================================================== +Bibliotheken mit unklarer Lizenz: + * icu4j-3.2.jar (gnv-artifacts + geo-backend) + - ICU License + - http://source.icu-project.org/repos/icu/icu/trunk/license.html + + * vecmath-1.3.1.jar (gnv-artifacts) + - JRL + - (siehe ./licenses/JRL.txt)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/README Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,5 @@ +This directory contains a test guideline for the GNV-system. +So fare, it is just a guideline and not a entire test protocol. +Therefore, static test data sets are needed. + +For an entry goto "gnv-test-guideline.txt"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-framework.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +GNV Framework + +- Behaviour + - when Server is down: Parameter, Loading of an artifact + - when a process hangs + - when a user switches the language + +- Different instances in the same browser +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-horizontal-cross-section.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,57 @@ +6. Horizontal cross-section + +6.1 Horizontal cross-section@Modeldata (ArcMarineBSH MeshFeature) + +# General Szenario +- No multiple selections available for one of the list of parameters + +a. fill paramterization + +Data set: Modeldata +Product: Horizontal cross-section + +Area: No Selection + +Mesh: Tagesmittel Nord- und Ostseemodell + +Area (WKT) +POLYGON ((-1.5763 58.3616, 0.7526 53.8428, 4.2686 53.1972, 7.9217 54.1441, 7.6020 56.2959, 11.5747 57.2857, 10.4788 58.4908, 4.2686 58.8996, 0.0219 58.5768, -1.5763 58.3616)) + +Layer and Depth range [m] +Layer + +Parameter +Temperatur [degC] + +Year +2010 + +Measurement date +2010.04.26 12:00:00 + +b. draw map + + +# Reactions: Elements to check +# General (static) +metainformation + - URL + - Name + - TTL +shapes + - color palette +curves/isolines + - range + - colors + - with points +legend + - entries + - labeling + - title + + + +c. save as project +e. reload project +f. change WMS options +k. export as raw data (Shapefile)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-horizontales-schnittprofil.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,43 @@ +4. Horizontales Schnittprofil + +4.1 Horizontales Schnittprofil@Modeldata (ArcMarineBSH MeshFeatures) + +# Scenario + +Parameter: 1 + +Depth: 1 + +a. fill paramterization + +Data set: Modeldata +Product: Horizontales Schnittprofil +Area: No Selection +Mesh: Tagesmittel Nord- und Ostseemodell + +Line (WKT) +LINESTRING (0.4911 56.2489, 10.4464 58.1608, 12.2321 56.4127, 13.1250 54.8832, 15.4018 54.5008, 19.6875 56.4127, 20.6250 59.0349, 28.1250 60.2640) + +Parameter +Temperatur [degC] + +Layer and Depth range [m] +Layer 1: 0 - 8 + +Year +2010 + +Measurement date +2010.04.26 12:00:00 + +b. draw diagram +f. change diagram options +g. export diagram as file (PNG, PDF, SVG) +h. calculate statistics +i. draw histogram +j. change histogram options +k. export as raw data (CSV, ODV, Shapefile) + + +Notices: +- Check ODV with several parameters and depths
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-horizontalprofile.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,158 @@ +3. Horizontalprofile + +3.1 Horizontalprofile@Modeldata (ArcMarineBSH MeshFeatures) + +# General Data Range +Sample: +Modeldata +Tagesmittel Nord- und Ostseemodell +# for gap detection +<- Janckes Test +# One arbitary point of time +2010.04.25 12:00:00 + +# Scenario for a parameters that can be used out of a list: +# Vary one parameter of each testcase +Depth: 1 Layer + 0-8 + +Depth: 2 Layers + 0-8 + depthest layer (with data?) + + +a. fill parameterization +# ~ Depth +# Aim: One depth as status for 2 layers + + + +b. draw diagram +# Reactions: Elements to check +# General (static) +y-axis + - range + - labeling + - units +x-axis + - range + - labeling + - units +helperlines + - direction +curves + - colors + - with points +legend + - entries + - labeling + +# Dynamic part +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +legend + - entries + - labeling + +c. save as project +e. reload project +f. change diagram options +g. export diagram as file (PNG, PDF, SVG) +h. calculate statistics +i. draw histogram +j. change histogram options +k. export as raw data (CSV, ODV, Shapefile) + + +# ~ Number of Parameters +a. fill paramterization + +Parameter: + 1 Parameter + +Parameter: + 2 Parameters with different units + + +# Reactions: Elements to check +# General (static) + +nothing so fare + + +# Dynamic part +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +legend + - entries + - labeling +helperline + - directions +curves + - colors + +b. draw diagram +g. export diagram as file (PNG, PDF, SVG) +h. calculate statistics +i. draw histogram +j. change histogram options +k. export as raw data (CSV, ODV, Shapefile) + + + +a. fill paramterization + +Axis: + East-West + +Axis: + North-South + +b. draw diagram + +# Dynamic part +title + - content - Does it have to change? + +k. export as raw data (CSV, ODV, Shapefile) + + +3.2. Horitontalprofile@Thermosalinograph (ArcMarineBSH Measurements) + +a. fill paramterization + +Ship: FS Gauss +Cruise: FS Gauss 412 TSG +Track: 28.01.2004 06:33 - 03.02.2004 15:42 - FS Gauss 412 TSG +Survey Info: 28.01.2004 06:33 - 03.02.2004 15:42 - FS Gauss 412 TSG + +# ~ Parameters + +Parameter: + 1 (Salzgehalt) + +Parameters: + 2 (Salzgehalt, Temperatur) + +# ~ Depth +# so fare just one deepth for Thermosalinograph + + +b. draw diagram +k. export as raw data (CSV, ODV, Shapefile)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-layer.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,26 @@ +7. User-generated Layers from object-oriented data models + +7.1 Layers@NAUTHIS (ArcS57) + + + +FIS: NAUTHIS +Product: Layer + + +a. fill paramterization + +# Aim: Select relevant data within the selected area +# Scenarios: +# ~ Area +# ~ Subtype + +Area: No selection +Area: A clipping polygon + +Subtype: Using one with a join + +b. draw a map +c. save as project +e. reload project +k. export as raw data (Shapefile)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-test-guideline.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,85 @@ +Guideline for testing the GNV-System + +This guideline can be used for testing the entire GNV-system based on +features of the specification. From the perspective of the database +schemas and procucts, there are 11 unique combinations. + +Testing matrix of products to database schemata: +Testing products on the following FIS should test all functionality in +the sense of different types of data models + + - TimeSeries: Marnet, Modeldata + - Verticalprofile: Marnet, Modeldata, CTD + - Horizontalprofile: Modeldata, Thermosalinograph + - ("Horizontales Schnittprofil"): Modeldata + - Vertical Cross-Section: Modeldata + - Horizontal Cross-Section: Modeldata + - Layer: NAUTHIS, CONTIS + + +Test procedures: +Environment for the client +Browser: Firefox 3.6.3 and Internet Explorer 8.0.6 +Resolution: 1024x768 +Language: English + +Environment for the server +Operating System: Debian GNU/Linux 5.0.x (Lenny) + +a. fill paramterization +b. draw diagram +c. save as project +e. reload project +f. change diagram options +g. export diagram as file (PNG, PDF, SVG) +h. calculate statistics +i. draw histogram +j. change histogram options +k. export as raw data (CSV, ODV, Shapefile) + +For each product, there is a guideline testing the product against the +different database schemata: + +- gnv-timerseries.txt +- gnv-verticalprofile.txt +- gnv-horizontalprofile.txt +- gnv-horizontales-schnittprofil.txt +- gnv-vertical-cross-section.txt +- gnv-horizontal-cross-section.txt +- gnv-layer.txt +- gnv-framework.txt + +Notes for the matrix: +- Relationship between Products and and different Datamodels + - ArcMarineBSH TimeSeries + - ArcMarineBSH Measurements + - ArcMarineBSH MeshFeatures + - ArcS57 + - CONTIS + + +- All products can be tested based on minimal amount of the following + FIS using different data models: + - Marnet (ArcMarineBSH TimeSeries): + - TimeSeries, + - Verticalprofile + + - Modeldata (ArcMarineBSH MeshFeatures): + - TimeSeries, + - Verticalprofile, + - Horizontalprofile, + - ("Horizontales Schnittprofil"), + - Vertical Cross-Section, + - Horizontal Cross-Section + + - Thermosalinograph (ArcMarineBSH Measurements): + - Horizontalprofile + + - CTD (ArcMarineBSH Measurements): + - Verticalprofile + + - NAUTHIS (ArcS57): + - Layer + + - CONTIS (CONTIS): + - Layer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-timerseries.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,182 @@ +1. Timeseries +1.1 Timeseries on Marnet (ArcMarineBSH TimeSeries) + +# General Data Range +Sample: +MARNET +FINO1 +Salzgehalt +# for gap detection +6m 25m (?) +# 1.5 years with change of year +2005.08.21 12:15:00 +2007.01.21 12:15:00 + +a. fill parameterization +# ~ Time +# Aim: Check for labeling of axis +# Aim: General check for all elements +Time: 1 Day + 2006.12.31 12:15:00 + 2007.01.01 12:15:00 + +Time: 1 Month + 2006.12.21 12:15:00 + 2007.01.21 12:15:00 + +Time: 1 Year + 2006.01.21 12:15:00 + 2007.01.21 12:15:00 + +Time: Max + +b. draw diagram +# Reactions: Elements to check +# General (static) +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +helperlines + - direction +curves + - colors + - with points +legend + - entries + - labeling + +# Dynamic part +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +legend + - entries + - labeling + +c. save as project +e. reload project +f. change diagram options +g. export diagram as file (PNG, PDF, SVG) +h. calculate statistics +i. draw histogram +j. change histogram options +k. export as raw data (CSV, ODV) + +a. fill parameterization +# ~Depth +# Aim: Check for labeling of legend +# Aim: Check for different curves with same axis +Time: 1 Month + 2006.12.21 12:15:00 + 2007.01.21 12:15:00 + +Depth: 1 + +Depth: 2 + +(Depth: 3) + +b. draw diagram +# Reactions: Elements to check +# Dynamic part +y-axis + - rang + - labeling + - units +curves + - colors + - with points +legend + - entries + - labeling + +h. calculate statistics +i. draw histogram +k. export as raw data (CSV, ODV) + + +a. fill parameterization +# ~ Parameter: 1 and more +# Aim: Check for axis with different units and ranges +Time: 1 Year + 2006.01.21 12:15:00 + 2007.01.21 12:15:00 + +Parameters: 2 parameters with same unit but different name: +Temperatur [degC] and Lufttemperatur [degC] + +Parameters: 4 different parameters (to get 2 axis at each side): +Temperatur [degC], Lufttemperatur [degC], Salzgehalt [] and Luftdruck[hPa] + +b. draw diagram +# Reactions: Elements to check +# Dynamic part +y-axis + - amount of axis + - range + - units +x-axis + - range +helperlines + - direction: 1 (without horizontal lines) +curves + - colors + +k. export as raw data (CSV, ODV) + + +a. fill parameterization +# ~ Area +# Aim: Check for Selection of Stations: One and Many +# Fehler in Abb 3.19: Verbindung von Line zu einem Punkt? Soll dies ein +Korridor sein? + +Area: Point (with Buffer) + +[Line: Line with Buffer] + +Area: Polygon + +# Reactions: List of Selections or direct + +# Dynamic part +Station: + - One result + - List of Results + +c. save as project +e. reload project + + + + +1.2 Timeseries on Modeldata (ArcMarineBSH MeshFeatures) + +# Task: What's the difference between TimeSeriesPoint and +MeshPoint/-Feature? + +? Wenn die Daten als Key-Value angeliefert werden, sollten die Code-Pfade ab +da gleich sein. Richtig? + +Sample: +Modeldata +Tagesmittel Nord- und Ostseemodell +Layer 0-8 +Temperatur +youngest date + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-vertical-cross-section.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,46 @@ +5. Vertical Cross-Section Profile + +5.1 Vertical Cross-Section Profile@Modeldata (ArcMarineBSH MeshFeatures) + +a. fill paramterization + +# just one Tupel is allowed +# no list of any parameter + +Data set: Modeldata +Product: Vertical cross-section +Area: No Selection +Mesh: Tagesmittel Nord- und Ostseemodell +Line (WKT) +LINESTRING (0.4911 56.2489, 10.4464 58.1608, 12.2321 56.4127, 13.1250 54.8832, 15.4018 54.5008, 19.6875 56.4127, 20.6250 59.0349, 28.1250 60.2640) +Parameter +Salzgehalt [pSal] + +Measurement date +2010.04.26 12:00:00 + +# Reactions: Elements to check +# General (static) +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +curves/isolines + - colors + - with points +legend + - entries + - labeling + +b. draw diagram + +f. change diagram options +g. export diagram as file (PNG, PDF, SVG) +k. export as raw data (ODV) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/test-guideline/gnv-verticalprofile.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,240 @@ +2. Verticalprofile: + +2.1 Verticalprofile@MARNET (ArcMarineBSH TimeSeriesPoint) + +# General Data Range +Sample: +MARNET +FINO1 +Salzgehalt +# for gap detection +??? - c.f. specification +# Just one arbitrary point of time +2007.01.21 12:15:00 + +a. fill parameterization +# ~ Range of Depth +# Aim: Check for drawing of curve +# Aim: General check for all elements + +# General Case +Depth: End-Start= Max + +# Clipping one Point of Measurement +Depth: End-Start= Max-1 + +# None Range +Depth: End=Start + +# Out of Range +Depth: End-Start<0 + +b. draw diagram +# Reactions: Elements to check +# General (static) +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +helperlines + - direction +curves + - colors + - with points +legend + - entries + - labeling + +# Dynamic part +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +legend + - entries + - labeling + +c. save as project +e. reload project +f. change diagram options +g. export diagram as file (PNG, PDF, SVG) +h. calculate statistics +i. draw histogram +j. change histogram options +k. export as raw data (CSV, ODV) + + +a. fill parameterization +# ~Depth +# Aim: Check for labeling of legend +# Aim: Check for different curves with same axis +Time: 1 Month + 2006.12.21 12:15:00 + 2007.01.21 12:15:00 + +Number of Depth: 1 + +Number of Depth: 2 + +(Number of Depth: 3) + +b. draw diagram +# Reactions: Elements to check +# Dynamic part +y-axis + - rang + - labeling + - units +curves + - colors + - with points +legend + - entries + - labeling + + + +2.2 Verticalprofile@Modeldata (ArcMarineBSH MeshFeatures) + +# General Data Range +Sample: +Modeldata +56n30 6e20 +56°N 33,000' 06°O 15,000' + +# for gap detection +??? - specified? +# Just one arbitrary point of time +2010.03.13 12:00:00 + +a. fill parameterization +# ~ Range of Depth +# Aim: Check for drawing of curve +# Aim: General check for all elements + +# Further need for this cases? Difference between TimeSeriesPoint +and Modeldata? +# General Case +Depth: End-Start= Max + +# Clipping one Point of Measurement +Depth: End-Start= Max-1 + +# None Range +Depth: End=Start + +# Out of Range +Depth: End-Start<0 + +b. draw diagram +# Reactions: Elements to check +# General (static) +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +helperlines + - number of directions (1|2) +curves + - colors + - with points +legend + - entries + - labeling + +# Dynamic part +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +legend + - entries + - labeling + + +h. calculate statistics +i. draw histogram +k. export as raw data (CSV, ODV, Shapefile) + + +2.3 Verticalprofile@CTD (ArcMarineBSH Measurements) + + +# General Data Range +Sample: +CTD +Area: No Selection +Series: FS Alkor 292 +23.01.2007 10:17 - 54°N 1,960' 08°O 12,550' + + +# for gap detection +??? - specified? +# Just one arbitrary point of time +23.01.2007 10:17 + +a. fill parameterization +# ~ Range of Depth +# Aim: Check for drawing of curve +# Aim: General check for all elements + +# General Case +Depth: End-Start= Max + +b. draw diagram +# Reactions: Elements to check +# General (static) +titel + - content +helperlines + - number of directions (1|2) +curves + - colors + - with points +legend + - entries + - labeling + +# Dynamic part +titel + - content +y-axis + - rang + - labeling + - units +x-axis + - range + - labeling + - units +legend + - entries + - labeling + + +h. calculate statistics +i. draw histogram +k. export as raw data (CSV, ODV, Shapefile)
--- a/geo-backend/ChangeLog Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/ChangeLog Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,336 @@ +2010-11-02 Ingo Weinzierl <ingo@intevation.de> + + * src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java, + src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java, + src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java, + src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java, + src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java, + src/main/java/de/intevation/gnv/geobackend/config/Configuration.java, + src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java, + src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java, + src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java, + src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java, + src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java, + src/main/java/de/intevation/gnv/geobackend/base/Result.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java, + src/main/java/de/intevation/gnv/geobackend/util/XMLUtils.java, + src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java: + Added license headers at the top of each of these files. + + * LGPL.txt: Added license file of the GNU LGPL v2.1 + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + RELEASE 1.1 + + * ChangeLog, Changes, NEWS: Summarized changes. + +2010-06-14 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * pom.xml: Write svn revision to MANIFEST file while creating jar archive. + +2010-06-04 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java: + The ehcache CacheManager and the MBeanServer of the JVM are connected + so that the statistics of the sql-cache is available as MBean using + JConsole. + +2010-06-04 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java: + A new marker interface. It should be implemented by objects that should + not be cached. + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java: + A new SDEResultSet class that implements Uncacheable. Currently, it is + used for raster elements returned from ArcSDE. + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java: + Raster elements are put into an UncacheableSDEResultSet container. This + has the effect that raster elements are not cached. + + * src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java: + Only objects that do not implement Uncacheable will be cached. + +2010-06-03 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/config/Configuration.java: A + global configuration for this geo-backend. Before using the geo-backend, + it is now necessary to create an instance of this class and call its + initialize(.) method. This method currently takes the following arguments: + + - conf: an xml document that should contain a node named 'geo-backend' + that contains all configurations required by the geo-backend. + - configDir: the absolute path to the root configuration directory that + might contain further configuration files. + - placeholder: the placeholder string that is used in the central config + file to replace the path to the configuration directory. + + Furthermore, this Configuration is used to initialize the so-called + 'sql-cache' that caches sql statements - it has been configured via system + properties until now. + + * src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java: + The sql-cache configuration is not read from system properties but from + global configuration now. + +2010-06-03 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/util/XMLUtils.java: Some + functions to handle xml stuff. + +2010-05-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java: + Show the execution time of a database query as INFO log. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + RELEASE 1.0 + + * Changes, NEWS, ChangeLog: Summarized changes. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java, + src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java, + src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java, + src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java: Removed + trailing whitespace. + +2010-04-20 Tim Englich <tim.englich@intevation.de> + + * src/test/ressources/QueryExecutorTestCase.properties, + src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java: + Integrated Testcase for testing the Basefunctionality of the CacheCleaner. + +2010-04-20 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java: + Integrated the initialization of the CacheCleaner if an SQl-Cache is used. + Also implemented the Method for CleanUp the SQL-Cache in the extended + QueryExecutor. + + * src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java: + Extended Interface adding an Method that should do the Cleanup of the + SQL-Cache. + + * src/main/java/de/intevation/gnv/geobackend/base/query/cache/package.html: + Added Documentation. + + * src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java: + Added Threadimplementation that looks every n-Seconds into the Database + if there are Tables that where updated during the Time to the last Cleanup. + If there are Tables that has been modified the CacheCleaner will call the + used QueryExecutor. The Queryexecutor will clean up it's Cache using the + Names of the affected Tables. + It is Possible to configure the Interval between two cleanups. for this + you have to set the Systemproperty -Dcaching.cleaner.interval using Seconds + as unit. + +2010-04-16 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java, + src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java: + Using unix line endings only. + +2010-04-17 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java: + Removed trailing whitespace. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/query/package.html, + src/main/java/de/intevation/gnv/geobackend/util/package.html, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/package.html, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/package.html, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/package.html, + src/main/java/de/intevation/gnv/geobackend/sde/package.html, + src/main/java/de/intevation/gnv/geobackend/base/query/exception/package.html, + src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/package.html, + src/main/java/de/intevation/gnv/geobackend/base/query/container/package.html, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/package.html, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/package.html, + src/main/java/de/intevation/gnv/geobackend/base/package.html: + Added more Javadoc. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java, + src/main/java/de/intevation/gnv/geobackend/base/Result.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java: + Modified some JavaDoc so that the Warnings that where caused by mistakes + are removed. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java, + src/main/java/de/intevation/gnv/geobackend/base/Result.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java, + src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java: + Modified some JavaDoc so that the Warnings that where caused by mistakes + are removed. + +2009-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/**/package.html: New. + Added package description with text 'DOCUMENT ME!'. + +2009-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/test/java/de/intevation/gnv/geobackend/**/*.java: + Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>' + + find -name \*.java | \ + xargs sed -i \ + -e 's/@author[ ]\+\([^(<]\+\)[<(]\([^>)]\+\)[>)]/@author <a href="mailto:\2">\1<\/a>/g' \ + -e 's@[ ]\+</a>@</a>@g' + +2009-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/**/*.java: + Ordered imports. Removed empty headers. + +2009-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java, + src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java, + src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java, + src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java, + src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java, + src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java, + src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java, + src/main/java/de/intevation/gnv/geobackend/util/BlockCollection.java, + src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java: + Removed trailing whitespace. + find -name \*.java | xargs sed -i 's/[ \t]\+$//' + +2010-03-26 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/*.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/*.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/*.java: + Updated Javadocs to the Listed Classes. + Also done some Codecleanup and removed unused Methods from the Code. + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java: + Removed unused Class ArcSDEConnectionParams. + +2010-03-26 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java: + Removed unused Class Datasource. + +2010-03-26 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java: + Removed unused Class DatasourceConnection. + +2010-03-26 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java: + Removed unused Class SDEQuery. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java (createPoints): + Now it is also possible to extract Points from a given LineString. + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java (executeQuery): + Added Support for SpatialQueries using LineString as Geometry of Interest. + +2010-03-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): + Added support for MultiLineString-Geometries. The Points do not belong to one + Geometryelement. We have to lookup if the Geometry is Multiparted. + If it is we have to split the Points into several LineStrings which belongs + to one MultiLineString. + +2010-03-12 Tim Englich <tim.englich@intevation.de> + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java (getColumnClassName): + Added more ClassName identificaton for the different datatypes of the ArcSDE. + Now it is possible to distinguish between Integer, Long, String, Date, + Float and Double Objects. + This is required to get a valid Shape- and WMS-Export. + +2010-03-09 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): + Switched to using asText(...)-Function of SeShapes-Objects for generating + an WKT-String for Polygons. Going this way we are able to produce valid + WKT for all kinds of Polygons deliverd by the ArcSDE. + We cannot use this Method for Points and LineStrings because the WKT + which will be produced is invalid e.g. Point Z (...) LineString m (...) + I didn't find Invalid WKTs for Polygons which in Database-Rables we are + using right now. + + It has to be monitored if there are Polygons in the Database which will + produce invalid WKT-Strings. + 2010-03-08 Tim Englich <tim.englich@intevation.de> * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue):
--- a/geo-backend/Changes Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/Changes Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,42 @@ +2010-06-30 RELEASE 1.1 + + NEW: + + * Cache statistics are available as MBean using JConsole. + + * Deactivated the caching of raster elements to improve performance. + + DDED: + + * A central Configuration instance that might be used to adjust settings + of the geo-backend. + + +2010-04-28 RELEASE 1.0 + + NEW: + + * Support for MultiLinestring and MultiPolygon detection retrieved by + the database. + + * Spatial queries using LineStrings can be sent to the database. + + * Sql-cache synchronization after database upates have taken place. A + thread is started in a specific time interval. Elements are removed + from cache if the sql-statement that has been used to retrieve these + elements contains a table that have been updated since the last + synchronization. The time interval (in seconds) can be configured via + system property 'caching.cleaner.interval' (e.g. + caching.cleaner.interval=600 for an interval of 10 minutes). + + Added: + + * JavaDoc documentation. + + +2010-03-08 RELEASE 0.5 + + 2010-01-27 RELEASE 0.4 New:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/LGPL.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it!
--- a/geo-backend/NEWS Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/NEWS Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,31 @@ +2010-06-30 RELEASE 1.1 + + * Evaluable cache statistics + + * Central configuration for this Geo-Backend + + +2010-04-28 RELEASE 1.0 + + NEW: + + * Support for MultiPolygons retrieved by database. + + * Support for MultiLinestrings retrieved by database. + + * Support for spatial queries using LineStrings. + + * Support for cache synchronization after database updates. + + + Added: + + * Added JavaDoc documentation. + + +2010-03-08 RELEASE 0.5 + + 2010-01-27 RELEASE 0.4 * Support for raster data access to SDE via RasterObject
--- a/geo-backend/pom.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/pom.xml Fri Sep 28 12:15:21 2012 +0200 @@ -4,10 +4,14 @@ <groupId>de.intevation.bsh</groupId> <artifactId>geo-backend</artifactId> <packaging>jar</packaging> - - <version>1.0-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <name>geo-backend</name> <url>http://maven.apache.org</url> + <scm> + <connection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/geo-backend</connection> + <developerConnection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/geo-backend</developerConnection> + <url>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/geo-backend</url> + </scm> <build> <plugins> <plugin> @@ -24,6 +28,36 @@ <target>1.5</target> </configuration> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>buildnumber-maven-plugin</artifactId> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>create</goal> + </goals> + </execution> + </executions> + <configuration> + <doCheck>true</doCheck> + <doUpdate>false</doUpdate> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + </manifest> + <manifestEntries> + <SCM-Revision>${buildNumber}</SCM-Revision> + </manifestEntries> + </archive> + </configuration> + </plugin> </plugins> </build> <dependencies>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,40 +1,40 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base; import java.util.Date; import java.util.GregorianCalendar; -import java.util.HashMap; import de.intevation.gnv.geobackend.util.DateUtils; /** * Defaultimplementation of the Interface Result. * This Class stores the Attributevalues of one Result. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ -public class DefaultResult -implements Result +public class DefaultResult +implements Result { /** * THE UID of this Classe */ private static final long serialVersionUID = -6886218808840982766L; - - /** - * HashMap which stores the Columnvalues identified by the unique Columnname + * Array which stores the Columnvalues */ - private Object [] values; - /** * The ResultDescriptor which describes the ColumnValues */ private ResultDescriptor resultDescriptor = null; - + /** * Constructor */ @@ -50,6 +50,9 @@ return getDate(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getDate(int) + */ public Date getDate(int column) { Object o = values[column]; Date d = null; @@ -68,6 +71,9 @@ return getDouble(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getDouble(int) + */ public Double getDouble(int column) { return (Double)values[column]; } @@ -79,6 +85,9 @@ return getFloat(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getFloat(int) + */ public Float getFloat(int column) { return (Float)values[column]; } @@ -88,11 +97,12 @@ */ public Integer getInteger(String columnName) { int idx = resultDescriptor.getColumnIndex(columnName); - return idx > -1 ? getInteger(idx) : -1; - //return getInteger(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getInteger(int) + */ public Integer getInteger(int column) { Object value = values[column]; if (value instanceof Double){ @@ -100,6 +110,7 @@ } return (Integer)value; } + /** * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor() */ @@ -112,28 +123,26 @@ */ public String getString(String columnName) { int idx = resultDescriptor.getColumnIndex(columnName); - return idx > -1 ? getString(idx) : null; } + /** + * @see de.intevation.gnv.geobackend.base.Result#getString(int) + */ public String getString(int column) { - Object o = values[column]; - if (o instanceof Date){ return DateUtils.getPatternedDateAmer((Date)o); } - if (o instanceof GregorianCalendar){ Date d = ((GregorianCalendar)o).getTime(); return DateUtils.getPatternedDateAmer(d); } - return o != null ? o.toString() : null; } /** - * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(java.lang.String, java.lang.Object) + * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(int, java.lang.Object) */ public void addColumnValue(int column, Object value) { values[column] = value; @@ -146,6 +155,9 @@ return getObject(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getObject(int) + */ public Object getObject(int column) { return values[column]; }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base; import java.util.ArrayList; @@ -11,7 +16,7 @@ /** * This Class is the DefaultImplementation of the * Interface ResultDescriptor - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultResultDescriptor implements ResultDescriptor { @@ -20,22 +25,19 @@ *The Uid of this Class */ private static final long serialVersionUID = 7016889733270716130L; - /** * The Names of the Columns of one Result */ private List<String> columnNames = new ArrayList<String>(); - /** * The Name of the Classes of the Values of one Result. */ private List<String> columnClassNames = new ArrayList<String>(); - /** - * + * The Lookup for the Columnindex of the Columnnames */ private Map<String, Integer> columnIndexLookup = new HashMap<String, Integer>(); - + /** * Constructor */ @@ -80,13 +82,10 @@ if (columnNames == null) { return null; } - int [] indices = new int[columnNames.length]; - for (int i = 0; i < indices.length; ++i) { indices[i] = this.getColumnIndex(columnNames[i]); } - return indices; } @@ -94,11 +93,15 @@ * @see de.intevation.gnv.geobackend.base.ResultDescriptor#getColumnIndex(java.lang.String) */ public int getColumnIndex(String columnName) { - + Integer value = this.columnIndexLookup.get(columnName); return value != null ? value.intValue() : -1; } + /** + * @see java.lang.Object#toString() + */ + @Override public String toString() { StringBuilder sb = new StringBuilder("["); int N = Math.min(columnNames.size(), columnClassNames.size());
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,27 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base; import java.io.Serializable; import java.util.Date; - /** * Interface which provides the Methods for Accessing * the Data of an ResultEntry - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface Result extends Serializable{ - + /** * Returns the ResultDescriptor which provides the * ResultMetadatse * @return the ResultDescriptor */ public ResultDescriptor getResultDescriptor(); - + /** * Returns the Columnvalue as a String * @param columnName the Name of the column @@ -29,9 +33,13 @@ */ public String getString(String columnName); + /** + * Returns the Columnvalue as a String + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a String + */ + public String getString(int column); - public String getString(int column); - /** * Returns the Columnvalue as a Date * @param columnName the Name of the column @@ -39,8 +47,13 @@ */ public Date getDate(String columnName); + /** + * Returns the Columnvalue as a Date + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Date + */ public Date getDate(int column); - + /** * Returns the Columnvalue as a Integer * @param columnName the Name of the column @@ -48,6 +61,11 @@ */ public Integer getInteger(String columnName); + /** + * Returns the Columnvalue as a Integer + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Integer + */ public Integer getInteger(int column); /** @@ -57,8 +75,13 @@ */ public Float getFloat(String columnName); + /** + * Returns the Columnvalue as a Float + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Float + */ public Float getFloat(int column); - + /** * Returns the Columnvalue as a Double * @param columnName the Name of the column @@ -66,8 +89,13 @@ */ public Double getDouble(String columnName); + /** + * Returns the Columnvalue as a Double + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Double + */ public Double getDouble(int column); - + /** * Returns the Columnvalue as a Object * @param columnName the Name of the column @@ -75,11 +103,16 @@ */ public Object getObject(String columnName); + /** + * Returns the Columnvalue as a Object + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Object + */ public Object getObject(int column); - + /** - * Adds an new Coumnvalue to the Result. - * @param columnName the Name of the Column + * Adds an new Columnvalue to the Result. + * @param column the Position where the column should be inserted. * @param value the Value of the Column */ public void addColumnValue(int column, Object value);
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base; import java.io.Serializable; @@ -8,7 +13,7 @@ /** * Interface which provides the Methods for Accessing * the MetaData of an ResultEntry - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ResultDescriptor extends Serializable{ @@ -18,20 +23,20 @@ * @return the Classname of the Column */ public String getColumnClassName(int column); - + /** * Returns the Number of Columns * @return the Number of Columns */ public int getColumnCount(); - + /** * Returns the Name of the Column which belongs to the given Columnindex * @param column the Index of the Column * @return the Name of the Column */ public String getColumnName(int column); - + /** * Adds a new ColumnDescription into the Descriptor * @param name the Name of the Column (unique) @@ -39,7 +44,19 @@ */ public void addColumn(String name, String className); + /** + * Returns the Indices of the Columns which are specified in the + * param columnNames. + * @param columnNames the Name of the Columns for which the Indices should returned. + * @return the Indices of the Columns which are specified in the + * param columnNames. + */ public int [] getColumnIndices(String [] columnNames); + /** + * Returns the index of the given columnName + * @param columnName the Name of the Index which should be looked up. + * @return the index of the given columnName + */ public int getColumnIndex(String columnName); }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,19 +1,28 @@ -package de.intevation.gnv.geobackend.base.connectionpool; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import java.sql.Connection; -import java.util.Properties; +package de.intevation.gnv.geobackend.base.connectionpool; import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; +import java.sql.Connection; + +import java.util.Properties; + /** * Interfacedefinition for an Generic ConnectionPool - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ConnectionPool { - + /** * Delivers the Connection to the Database - * @param connectionID the ID of the Connection + * @param connectionID the ID of the Connection * @return the Connection to the Database * @throws ConnectionException */
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,23 @@ -/** - * +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.connectionpool; +import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool; + import java.util.Properties; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool; - /** * Factoryimplementation for the Interface ConnectionPool. * This factory delivers Instances of the Interface ConnectionPool. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ConnectionPoolFactory { @@ -21,7 +26,7 @@ */ private static Logger log = Logger.getLogger(ConnectionPoolFactory.class); - + /** * The singleton Instance of this Factory. */ @@ -49,8 +54,7 @@ } return instance; } - - + /** * Getting the ConnectionPool * @return the ConnectionPool @@ -72,7 +76,7 @@ this.connectionPool.initialize(properties); }else{ log.warn("ConnectionPool already initialized"); - } + } } /**
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,114 +1,111 @@ -/** - * Title: lConnectionException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: drewnak $ - * modified on: $Date: 2008/08/18 14:50:33 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.base.connectionpool.exception; - -import com.esri.sde.sdk.client.SeError; -import com.esri.sde.sdk.client.SeException; - -import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; - -import org.apache.log4j.Logger; - -/** - * The class <code>lConnectionException</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:13:05 - */ -public class ConnectionException extends TechnicalException { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(ConnectionException.class); - - /** - * Constructs a new exception with <code>null</code> as its detail message. - * The cause is not initialized, and may subsequently be initialized by a - * call to {@link #initCause}. - */ - public ConnectionException() { - } - - /** - * Constructs a new exception with the specified detail message. The - * cause is not initialized, and may subsequently be initialized by - * a call to {@link #initCause}. - * - * @param message the detail message. The detail message is saved for - * later retrieval by the {@link #getMessage()} method. - */ - public ConnectionException(String message) { - super(message); - } - public ConnectionException(Throwable pCause) { - super(pCause); - } - - /** - * Constructs a new exception with the specified detail message and - * cause. <p>Note that the detail message associated with - * <code>cause</code> is <i>not</i> automatically incorporated in - * this exception's detail message. - * - * @param message the detail message (which is saved for later retrieval - * by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A <tt>null</tt> value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public ConnectionException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Displays the details of an SeException (if available). - * - */ - public void printError() { - if (getCause() != null && getCause() instanceof SeException) { - SeException exception = (SeException) getCause(); - SeError error = exception.getSeError(); - - sLogger.debug("\n ArcSDE Error Number : " + error.getSdeError()); - sLogger.debug(" Error Description : " + error.getErrDesc()); - - int extError = error.getExtError(); - if (extError != 0) - sLogger.debug(" Extended Error Number : " + extError); - - String desc = error.getSdeErrMsg(); - if (desc != null && desc.length() != 0) - sLogger.debug(" Extended Error Description : " + desc); - - desc = error.getExtErrMsg(); - if (desc != null && desc.length() != 0) - sLogger.debug(" Extended Error Description : " + desc); - - sLogger.debug(exception); - - } - - } -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.base.connectionpool.exception; + +import com.esri.sde.sdk.client.SeError; +import com.esri.sde.sdk.client.SeException; + +import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; + +import org.apache.log4j.Logger; + +/** + * The class <code>lConnectionException</code> fulfills the following purposes: + * + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class ConnectionException extends TechnicalException { + + /** + * The UID of this Class. + */ + private static final long serialVersionUID = 102459262123219617L; + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(ConnectionException.class); + + /** + * Constructs a new exception with <code>null</code> as its detail message. + * The cause is not initialized, and may subsequently be initialized by a + * call to {@link #initCause}. + */ + public ConnectionException() { + } + + /** + * Constructs a new exception with the specified detail message. The + * cause is not initialized, and may subsequently be initialized by + * a call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public ConnectionException(String message) { + super(message); + } + + /** + * Constructor + * @param pCause the Throwable which cause this exception + */ + public ConnectionException(Throwable pCause) { + super(pCause); + } + + /** + * Constructs a new exception with the specified detail message and + * cause. <p>Note that the detail message associated with + * <code>cause</code> is <i>not</i> automatically incorporated in + * this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A <tt>null</tt> value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public ConnectionException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Displays the details of an SeException (if available). + * + */ + public void printError() { + if (getCause() != null && getCause() instanceof SeException) { + SeException exception = (SeException) getCause(); + SeError error = exception.getSeError(); + + sLogger.debug("\n ArcSDE Error Number : " + error.getSdeError()); + sLogger.debug(" Error Description : " + error.getErrDesc()); + + int extError = error.getExtError(); + if (extError != 0) + sLogger.debug(" Extended Error Number : " + extError); + + String desc = error.getSdeErrMsg(); + if (desc != null && desc.length() != 0) + sLogger.debug(" Extended Error Description : " + desc); + + desc = error.getExtErrMsg(); + if (desc != null && desc.length() != 0) + sLogger.debug(" Extended Error Description : " + desc); + + sLogger.debug(exception); + + } + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Package that contains Exceptionclasses for it's Parentpackage. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains Classes that provides an <code>ConnectionPool</code> +for <code>java.sql.Connection</code>-Objects +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains Interfaces and Classes to provide Access to Data without +using an <code>java.sql.ResultSet</code>-object in the Code that use this Module. +</body> +</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,23 +1,40 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.base.query; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner; + +import de.intevation.gnv.geobackend.config.Configuration; + +import java.lang.management.ManagementFactory; + import java.util.Collection; +import java.util.Iterator; + +import javax.management.MBeanServer; import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; -import net.sf.ehcache.CacheManager; + +import net.sf.ehcache.management.ManagementService; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.base.Result; - /** - * @author Sascha L. Teichmann <sascha.teichmann@intevation.de> - * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class CachingQueryExecutorFactory extends QueryExecutorFactory { - public static final String QUERY_EXECUTOR_FACTORY = "caching.query.executor.config"; public static final String CACHE_NAME = "sql.cache"; private static Logger log = Logger.getLogger(CachingQueryExecutorFactory.class); @@ -26,11 +43,28 @@ public CachingQueryExecutorFactory() { log.info("using SQL cache"); - String configFile = System.getProperty(QUERY_EXECUTOR_FACTORY); + init(); + } + + private void init() { + Configuration config = Configuration.getInstance(); + + if (config == null) { + log.error("No geobackend configuration found. " + + "Wasn't able to initialize cache."); + return; + } + String configFile = config.getCacheConfiguration(); manager = configFile != null ? new CacheManager(configFile) : new CacheManager(); manager.addCache(CACHE_NAME); + MBeanServer mBeanServer = + ManagementFactory.getPlatformMBeanServer(); + ManagementService.registerMBeans( + manager, mBeanServer, false, false, false, true); + CacheCleaner cc = new CacheCleaner(); + cc.start(); } public QueryExecutor getQueryExecutor() { @@ -52,6 +86,27 @@ Cache cache = manager.getCache(CACHE_NAME); cache.put(new Element(query, results)); } + + public void clearCache(String[] tableNames) { + Cache cache = manager.getCache(CACHE_NAME); + Iterator keys = cache.getKeys().iterator(); + while (keys.hasNext()){ + String origKey = (String)keys.next(); + String key = origKey.toUpperCase(); + log.debug(key); + for (int i = 0; i < tableNames.length; i++){ + if (key.contains(tableNames[i])){ + log.debug(tableNames[i]+ " is contained in "+key); + log.debug("Cacheentry will be removed"); + boolean success = cache.remove(origKey); + if (!success){ + log.warn("Object could not be reoved from Cache."); + } + break; + } + } + } + } }; }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,43 +1,57 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; + +import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; + +import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; + +import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; + +import de.intevation.gnv.geobackend.base.query.exception.QueryException; + +import de.intevation.gnv.geobackend.sde.datasources.Uncacheable; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; + import java.util.Collection; +import java.util.Date; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; -import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; -import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; -import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; -import de.intevation.gnv.geobackend.base.query.exception.QueryException; - /** * This is an Standard Implementation of the Interface QueryExecutor. * It fetchs the Query from the Querycontainer an put the Filtervalues into the Query. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultQueryExceutor extends QueryExecutorBase{ - - + + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(DefaultQueryExceutor.class); - + /** * The ConnectionID identifing the Connection to use executing the Query. */ private String connectionID = "N/N"; - + /** * Constructor */ @@ -57,7 +71,7 @@ //Insert the Filtervalues into the QueryString queryString = super.setFilterValues(queryString, filter); } - + if (log.isDebugEnabled()) { log.debug("############ QUERY ##################"); log.debug(queryString); @@ -70,23 +84,36 @@ return returnValue; } - Connection connection = null; + boolean cacheable = true; + Connection connection = null; ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool(); try { // Submit the Query connection = connectionPool.getConnection(this.connectionID); if (connection != null){ Statement stmt = connection.createStatement(); + Date start = new Date(); ResultSet rs = stmt.executeQuery(queryString); + Date end = new Date(); + log.info("-> Database query took " + + (end.getTime() - start.getTime()) + " ms."); + + cacheable = !(rs instanceof Uncacheable); + returnValue = super.createResultCollection(rs); - }else{ log.error("Could not establish Databaseconnection."); throw new QueryException("Could not establish Databaseconnection."); } - cacheResults(queryString, returnValue); - + if (cacheable) { + log.debug("Elements are cacheable."); + cacheResults(queryString, returnValue); + } + else { + log.debug("Elements are NOT cacheable."); + } + } catch (ConnectionException e) { log.error(e,e); throw new QueryException("Could not establish Databaseconnection.",e); @@ -107,7 +134,7 @@ log.error("No QueryString defined for "+queryID); throw new QueryException("Cannot get the Querystring"); } - + } catch (QueryContainerException e) { log.error(e,e); throw new QueryException("Cannot get the Querystring",e);
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query; import java.util.Collection; @@ -11,7 +16,7 @@ /** * This Interface provides the Method to execute Queries * against a Datastore eg. Databases - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface QueryExecutor { @@ -25,9 +30,27 @@ * @return the fetched Values * @throws QueryException */ - Collection<Result> executeQuery(String queryID, String[] filter) throws QueryException; + Collection<Result> executeQuery(String queryID, + String[] filter) + throws QueryException; + /** + * Returns the cached results to a given Query. + * @param query the Query that should identify the Result + * @return the Cached results or null if no results are cached. + */ Collection<Result> cachedResults(String query); + /** + * Writes the Result into the Cache + * @param query the Query that will be used as Identifier. + * @param results The Results that should be cached. + */ void cacheResults(String query, Collection<Result> results); + + /** + * Clears the Cache using the Names of the Database-Tables + * @param tableNames the Tablenames that should be used to Clear the Cache. + */ + void clearCache(String[] tableNames); }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query; import java.sql.ResultSet; @@ -18,7 +23,7 @@ /** * This is an abstract Basicimplementation of the Interface * QueryExecutor providing several Helpermethods. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public abstract class QueryExecutorBase implements QueryExecutor { @@ -29,7 +34,7 @@ public QueryExecutorBase() { super(); } - + /** * This Method puts the Filtervalues into the Querystring * @param queryString the Query which should be manipulated @@ -43,7 +48,7 @@ } return returnValue; } - + /** * This Methods converts the ResultSet into an Collection of Result-objects * @param resultSet the ResultSet which should be converted @@ -52,7 +57,7 @@ */ protected Collection<Result> createResultCollection(ResultSet resultSet) throws SQLException{ Collection<Result> returnValue = new ArrayList<Result>(); - + ResultDescriptor resultDescriptor = null; int columns = -1; @@ -68,9 +73,9 @@ resultDescriptor.addColumn(rsmd.getColumnName(i), rsmd.getColumnClassName(i)); } } - + Result result = convertResult(resultSet, resultDescriptor); - + returnValue.add(result); } return returnValue; @@ -101,4 +106,7 @@ public void cacheResults(String query, Collection<Result> result) { } + public void clearCache(String[] tableNames) { + } + }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query; +import de.intevation.gnv.geobackend.config.Configuration; + import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class QueryExecutorFactory { public static final String QUERY_EXECUTOR_FACTORY = "query.executor.factory"; - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(QueryExecutorFactory.class); - + /** * The singleton Instance of this Factory. */ @@ -37,31 +44,18 @@ */ public static synchronized QueryExecutorFactory getInstance(){ if (instance == null) { - String className = System.getProperty(QUERY_EXECUTOR_FACTORY); - if (className != null) { - try { - Class clazz = Class.forName(className); - final QueryExecutorFactory factory = - (QueryExecutorFactory)clazz.newInstance(); - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - factory.shutdown(); - } - }); - return instance = factory; - } - catch (ClassNotFoundException cnfe) { - log.error(cnfe); - } - catch (InstantiationException ie) { - log.error(ie); - } - catch(IllegalAccessException iae) { - log.error(iae); - } - catch (ClassCastException cce) { - log.error(cce); - } + Configuration config = Configuration.getInstance(); + + if (config.isCacheEnabled()) { + final QueryExecutorFactory factory = + new CachingQueryExecutorFactory(); + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + factory.shutdown(); + } + }); + return instance = factory; } instance = new QueryExecutorFactory(); @@ -71,7 +65,7 @@ public void shutdown() { } - + /** * Getting the QueryExecutor * @return the QueryExecutor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * + */ +package de.intevation.gnv.geobackend.base.query.cache; + +import java.sql.Date; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.log4j.Logger; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.query.DefaultQueryExceutor; +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.geobackend.util.DateUtils; + +/** + * Thread that looks every n - Minutes if an Cache has to be cleanedup. + * You can configure the Timeout in Seconds using the Systemproperty + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * + */ +public class CacheCleaner extends Thread { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = Logger.getLogger(CacheCleaner.class); + + /** + * The Systemproperty-identifier for the Configuration of the TimeInterval + */ + public static final String CACHE_CLEANER_INTERVAL = "caching.cleaner.interval"; + + /** + * The Time To wait between two Cleanups. + */ + private long timeout = 1000 * 60; // 1 Minute + + /** + * The Border which has to be used to Query the updated Tables. + */ + private long lowerBorderTime = 0; + + /** + * The Id to Lookup the SQL-Statement for fetchung the Names of the + * updated Tables. + */ + private String queryID = "updated_tables"; + + /** + * Constructor + */ + public CacheCleaner() { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + */ + public CacheCleaner(Runnable arg0) { + super(arg0); + this.setUp(); + } + + /** + * Constructor + * @param arg0 + */ + public CacheCleaner(String arg0) { + super(arg0); + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + */ + public CacheCleaner(ThreadGroup arg0, Runnable arg1) { + super(arg0, arg1); + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + */ + public CacheCleaner(ThreadGroup arg0, String arg1) { + super(arg0, arg1); + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + */ + public CacheCleaner(Runnable arg0, String arg1) { + super(arg0, arg1); + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + * @param arg2 + */ + public CacheCleaner(ThreadGroup arg0, Runnable arg1, String arg2) { + super(arg0, arg1, arg2); + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + * @param arg2 + * @param arg3 + */ + public CacheCleaner(ThreadGroup arg0, Runnable arg1, String arg2, long arg3) { + super(arg0, arg1, arg2, arg3); + this.setUp(); + } + + /** + * Sets up the members of the CacheCleaner. + */ + protected void setUp(){ + String intervalValue = System.getProperty(CACHE_CLEANER_INTERVAL); + if (intervalValue != null){ + log.info("Set Interval to "+intervalValue+" Seconds"); + try { + this.timeout = Long.parseLong(intervalValue) * 1000; + } catch (NumberFormatException e) { + log.error(e,e); + } + } + } + + /** + * This Method can be used do run the Main-Mechanism of the Thread e.g + * from a Unittest. + * @return + */ + public boolean test(){ + log.debug("CacheCleaner.test"); + this.cleanup(); + return true; + } + + @Override + public void run() { + log.debug("CacheCleaner.run"); + long requiredTime = 0; + this.lowerBorderTime = System.currentTimeMillis(); + while (true){ + long startTime = 0; + try { + long nextTimeout = timeout-requiredTime; + if (nextTimeout > 0){ + Thread.sleep(nextTimeout); + } + startTime = System.currentTimeMillis(); + log.debug("Sleep "+nextTimeout+"ms cleanup Cache now"); + this.cleanup(); + } catch (InterruptedException e) { + log.error(e,e); + } catch (Exception e){ + log.error(e,e); + } catch (Throwable t){ + log.error(t,t); + }finally{ + requiredTime = System.currentTimeMillis() - startTime; + log.debug("CleanUp required "+requiredTime); + } + } + } + + /** + * Method that do the Cleanup-Work + */ + protected void cleanup(){ + log.debug("CacheCleaner.cleanup"); + try { + // We have to go this Way to avoid using the Cache for this Query. + String[] tableNames = this.getUpdatedTableNames(); + if (tableNames != null){ + QueryExecutorFactory.getInstance() + .getQueryExecutor().clearCache(tableNames); + } + } catch (QueryException e) { + log.error(e,e); + } + + } + + /** + * Returns the Names of the Tables which have been updated. + * @return the Names of the Tables which have been updated. + * @throws QueryException + */ + protected String[] getUpdatedTableNames()throws QueryException { + String[] tableNames = null; + QueryExecutor queryExecutor = new DefaultQueryExceutor(); + Date date = new Date(this.lowerBorderTime); + this.lowerBorderTime = System.currentTimeMillis(); + log.debug("New Lookup at "+DateUtils.getPatternedDateAmer(new Date(lowerBorderTime))); + String queryDate = DateUtils.getPatternedDateAmer(date); + Collection<Result> result = queryExecutor. + executeQuery(queryID, + new String[]{queryDate}); + if (result != null && !result.isEmpty()){ + tableNames = new String[result.size()]; + Iterator<Result> it = result.iterator(); + int i = 0; + while (it.hasNext()){ + tableNames[i++] = it.next().getString(0).toUpperCase(); + log.debug("Table that was updated: "+tableNames[i-1]); + } + } + return tableNames; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/cache/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains the CacheCleaner. An Thread that is responsible to +Cleanup the SQL-Cache if the Data in the Database has been updated. +</body> +</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,21 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query.container; +import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; + import java.util.Properties; -import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; - /** * Defaultimplementation of an QueryContainer. * All Queries are provided using a Propertiescontainer. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultQueryContainer implements QueryContainer {
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query.container; import java.util.Properties; @@ -8,11 +13,13 @@ import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; /** - * @author Tim Englich <tim.englich@intevation.de> + * Querycontainer is an Interface which defines the Method that are + * required to provide the access to SQL-Queries. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface QueryContainer { - + /** * Returns the Query specified by the given queryID.
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query.container; import java.util.Properties; @@ -10,17 +15,18 @@ import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Factoryclass to provide a singleton-Instance of an + * <code>QueryContainer</code>-Object + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class QueryContainerFactory { - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(QueryContainerFactory.class); - + /** * The singleton Instance of this Factory. */ @@ -48,8 +54,8 @@ } return instance; } - - + + /** * Getting the QueryContainer * @return the QueryContainer @@ -62,7 +68,7 @@ * Initializes the QueryContainer. * Should only be called once on system startup * @param properties the Properties for the Individual Configuration of the QueryContainerbb - * @throws QueryContainerException + * @throws QueryContainerException */ public synchronized void initializeQueryContainer(Properties properties) throws QueryContainerException{ log.debug("ConnectionPoolFactory.initializeConnectionPool");
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query.container.exception; + /** * Exceptioncalls which will be used to retun Exception in * the QuerContainer-Package. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class QueryContainerException extends Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Package that contains Exceptionclasses for it's Parentpackage. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains Classes which provide the Access to SQL-Queries which +are stored in an separate Resource-File (e.g. an Propertiesfile). +</body> +</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query.exception; + /** - * @author Tim Englich <tim.englich@intevation.de> + * This is a specialized Exceptionclass for Exceptions that occurse during + * querying Data from the Database- + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class QueryException extends Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Package that contains Exceptionclasses for it's Parentpackage. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains Interfaces and Classes which provide the possibility to +send a SQL-Query against a Databasebackend and get the returned Rows as Result. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/config/Configuration.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.config; + +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; + +import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; + +import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; + +import de.intevation.gnv.geobackend.util.XMLUtils; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +import java.util.Properties; + +import javax.xml.xpath.XPathConstants; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public final class Configuration { + + public static final String CONFIGURATION_ROOT = "geo-backend"; + public static final String XPATH_QUERIES = "query-configuration"; + public static final String XPATH_BACKEND = "backend-configuration"; + public static final String XPATH_CACHE = "cache"; + public static final String XPATH_CACHE_ENABLED = "@enabled"; + public static final String XPATH_CACHE_CONFIG = "configuration"; + + private static Logger logger = Logger.getLogger(Configuration.class); + + private static Configuration instance; + + private Node config; + private String configDir; + private String placeholder; + + private boolean cacheEnabled; + private String cacheConfiguration; + + + + /** + * Returns an instance of Configuration. + * + * @return an instance of Configuration. + */ + public static Configuration getInstance() { + if (instance == null) + instance = new Configuration(); + + return instance; + } + + + /** + * Constructor that creates a new Configuration object with disabled cache. + */ + public Configuration() { + cacheEnabled = false; + } + + + /** + * Initialize the geo-backend before it is ready to be used. This method + * calls other <i>init*</i> methods. + * + * @param conf A configuration document. This document should contain a node + * <i>geo-backend</i>. If there are more nodes named <i>geo-backend</i>, the + * first node is used. + * @param configDir The path to the root configuration directory. + * @param placeholder The placeholder used in the configuration document for + * the root configuration directory. + */ + public void init(Document conf, String configDir, String placeholder) + throws QueryContainerException, FileNotFoundException, IOException + { + this.config = conf; + this.configDir = configDir; + this.placeholder = placeholder; + + NodeList root = conf.getElementsByTagName(CONFIGURATION_ROOT); + if (root == null || root.getLength() == 0) { + logger.error("No valid configuration for this geobackend given!"); + return; + } + + initQueries(root.item(0)); + initConnection(root.item(0)); + initCache(root.item(0)); + } + + + /** + * Initialize sql statements. + * + * @param conf The geo-backend configuration node. + */ + protected void initQueries(Node conf) + throws FileNotFoundException, IOException, QueryContainerException + { + String queriesFile = (String) XMLUtils.xpath( + conf, XPATH_QUERIES, XPathConstants.STRING, null); + + queriesFile = replaceConfigDir(queriesFile); + logger.info("Initialize queries: " + queriesFile); + + Properties queries = getProperties(queriesFile); + QueryContainerFactory qcf = QueryContainerFactory.getInstance(); + qcf.initializeQueryContainer(queries); + } + + + /** + * Initialize necessary objects used for the database connection. + * + * @param connection The geo-backend configuration node. + */ + protected void initConnection(Node connection) + throws FileNotFoundException, IOException + { + String config = (String)XMLUtils.xpath( + connection, XPATH_BACKEND, XPathConstants.STRING, null); + + config = replaceConfigDir(config); + logger.info("Initialize database connection: " + config); + + Properties properties = getProperties(config); + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); + cpf.initializeConnectionPool(properties); + } + + + /** + * Initialize necessary objects used for the sql cache. + * + * @param conf The geo-backend configuration node. + */ + protected void initCache(Node conf) { + Node cache = (Node) XMLUtils.xpath( + conf, XPATH_CACHE, XPathConstants.NODE, null); + + String on = (String) XMLUtils.xpath( + cache, XPATH_CACHE_ENABLED, XPathConstants.STRING, null); + + boolean enabled = Boolean.parseBoolean(on); + + if (enabled) { + String config = (String) XMLUtils.xpath( + cache, XPATH_CACHE_CONFIG, XPathConstants.STRING, null); + + if (config != null && config.length() > 0) { + config = replaceConfigDir(config); + logger.info("Initialize sql cache with config: " + config); + + this.cacheConfiguration = config; + this.cacheEnabled = true; + } + else { + logger.error("SQL cache is enabled, " + + "but no configuration was found."); + } + } + else { + logger.info("SQL cache is disabled."); + } + } + + + /** + * Replace placeholder in the configuration. Placeholder are used for the + * base configuration directory. + * + * @param path A string that might contain placeholders. + * + * @return <i>path</i> with replaced placeholder. + */ + protected String replaceConfigDir(String path) { + return path.replace(placeholder, configDir); + } + + + /** + * Read a file that contains properties and return a Java Properties object. + * + * @param path Path to a properties file. + * + * @return the properties contained in the file. + */ + protected Properties getProperties(String path) + throws FileNotFoundException, IOException + { + InputStream inputStream = null; + + try { + inputStream = new FileInputStream(path); + Properties properties = new Properties(); + properties.load(inputStream); + + return properties; + } + finally { + if (inputStream != null) { + try { + inputStream.close(); + } + catch (IOException ioe) { + } + } + } + } + + + /** + * Returns the state of the cache. + * + * @return true if sql queries are cache, otherwise false. + */ + public boolean isCacheEnabled() { + return cacheEnabled; + } + + + /** + * Returns the path of the cache configuration file. + * + * @return configuration path. + */ + public String getCacheConfiguration() { + return cacheConfiguration; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.sde.connectionpool; import java.sql.Connection; @@ -12,8 +20,8 @@ /** *This is the ArcSDE specific implementation of the Interface ConnectionPool - * - * @author Tim Englich <tim.englich@intevation.de> + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ArcSDEConnectionPool implements ConnectionPool { @@ -29,7 +37,7 @@ private GenericObjectPool pool = null; /** - * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#closeConnection(java.lang.Object) + * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#closeConnection(java.sql.Connection) */ public void closeConnection(Connection connection) throws ConnectionException { @@ -103,7 +111,7 @@ boolean testWhileIdle = Boolean.parseBoolean(properties .getProperty("testWhileIdle", "" + GenericObjectPool.DEFAULT_TEST_WHILE_IDLE)); - + log.info("Maximum Number of active Connections: " + maxActive); log.info("Maximum Number of waiting: " + maxWait); log.info("Maximum Number of idle: " + maxIdle); @@ -114,7 +122,7 @@ log.info("NumTestsPerEvictionRun: " + numTestsPerEvictionRun); log.info("MinEvictableIdleTimeMillis: " + minEvictableIdleTimeMillis); log.info("TestWhileIdle: " + testWhileIdle); - + this.pool = new GenericObjectPool(poolableObjectFactory, maxActive, GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION, maxWait, maxIdle, minIdle, testOnBorrow, testOnReturn,
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.sde.connectionpool; import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; @@ -14,8 +22,11 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * ArcSDE specific Implementation of an PoolableObjectFactory. + * This factory instantiate Objects of type ArcSDEConnection. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class ArcSDEPoolableObjectFactory implements PoolableObjectFactory { @@ -25,9 +36,14 @@ private static Logger log = Logger.getLogger( ArcSDEPoolableObjectFactory.class); - // The 5 seconds are inspired by GeoTools's testServer() usage. - private int serverRoundtripInterval = 5; - + /** + * The 5 seconds are inspired by GeoTools's testServer() usage. + */ + private int serverRoundtripInterval = 5; + /** + * The value of the maximum Time a Connection is allowed to + * be inactive without the validation of the Connection. + */ private long serverInactiveInterval = 5L*60L*1000L; // 5 minutes /** * The URL to the ArcSDE Server @@ -49,7 +65,7 @@ * The Credentials which belongs to the User */ private String credentials = null; - + /** * Constructor of this Class * @param properties the Properties which includes the ConnectionParams to the Database @@ -68,7 +84,7 @@ properties.getProperty("serverRoundtripInterval"); String serverInactiveIntervalValue = properties.getProperty("serverInactiveInterval"); - + try { if (serverRoundtripIntervalValue != null) { serverRoundtripInterval = @@ -88,7 +104,7 @@ catch (NumberFormatException e) { log.error(e,e); } - + log.info("ArcSDEPoolableObjectFactory initialized"); log.info("Server: " + server); log.info("Port: " + port); @@ -125,9 +141,9 @@ Connection con; try { con = new ArcSDEConnection( - server, + server, port, - database, + database, username, credentials, serverRoundtripInterval,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains Classes that provides an <code>ConnectionPool</code> +for <code>ArcSDEConnection</code>-Objects. +</body> +</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,12 @@ -/** - * - */ - package de.intevation.gnv.geobackend.sde.datasources; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; import java.sql.Array; import java.sql.Blob; @@ -30,52 +35,80 @@ import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Wrapperclass between an @see java.sql.Connection and an + * @see com.esri.sde.sdk.client.SeConnection + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ArcSDEConnection implements Connection { - /** + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); - - private SeConnection seConnection = null; - - private long serverRoundtripInterval; + /** + * The Connection to the ArcSDE-backend. + */ + private SeConnection seConnection = null; + /** + * Time that have to be gone until the Server will be requested if + * the Connection is valid. + */ + private long serverRoundtripInterval ; + + /** + * The Time which a Connection can be inactive until the Connection + * will be set to invalid. + */ private long inactiveInterval; + /** + * The TimeStamp of the last usage of this Connection. + */ private long lastTouch; - - /** - * Constructor - */ - public ArcSDEConnection( + + /** + * Constructor + * @param server the URL to the Server + * @param port the Port of the Server + * @param database the Name of the Database + * @param username the Name of the User + * @param credentials the Credentials to the User- + * @param serverRoundtripInterval Time that have to be gone until the Server + * will be requested if the Connection is valid. + * @param inactiveInterval the Time which a Connection can be inactive until + * the Connection will be set to invalid. + * @throws ConnectionException + */ + public ArcSDEConnection( String server, String port, String database, String username, - String credentials, + String credentials, long serverRoundtripInterval, long inactiveInterval - ) + ) throws ConnectionException { this.serverRoundtripInterval = serverRoundtripInterval; this.inactiveInterval = inactiveInterval; lastTouch = System.currentTimeMillis(); - try { - seConnection = new SeConnection( server, port, database, username, credentials); + try { + seConnection = new SeConnection( server, port, database, username, credentials); } catch (SeException e) { - log.error(e,e); - throw new ConnectionException(e); + log.error(e,e); + throw new ConnectionException(e); } - } + } + /** + * Validates if the Connection is active + * @return true if the Connection is active. False if not. + */ public boolean isActive() { long current = System.currentTimeMillis(); long last; @@ -85,6 +118,9 @@ return Math.abs(current - last) < inactiveInterval; } + /** + * Sets the last-Usage-Time to the Current-time + */ public void touch() { long time = System.currentTimeMillis(); synchronized (this) { @@ -92,303 +128,291 @@ } } - /** - * @see java.sql.Connection#clearWarnings() - */ - public void clearWarnings() throws SQLException { - } - - /** - * @see java.sql.Connection#close() - */ - public void close() throws SQLException { - try { - this.seConnection.close(); - } catch (SeException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.Connection#commit() - */ - public void commit() throws SQLException { - try{ - this.seConnection.commitTransaction(); - } catch (SeException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.Connection#createStatement() - */ - public Statement createStatement() throws SQLException { - - return new ArcSDEStatement(this); - } - - /** - * @see java.sql.Connection#createStatement(int, int) - */ - public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException { - return new ArcSDEStatement(this); - } - - /** - * @see java.sql.Connection#createStatement(int, int, int) - */ - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - return new ArcSDEStatement(this); - } - - /** - * @see java.sql.Connection#getAutoCommit() - */ - public boolean getAutoCommit() throws SQLException { - return false; - } - - /** - * @see java.sql.Connection#getCatalog() - */ - public String getCatalog() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#getHoldability() - */ - public int getHoldability() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Connection#getMetaData() - */ - public DatabaseMetaData getMetaData() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#getTransactionIsolation() - */ - public int getTransactionIsolation() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Connection#getTypeMap() - */ - public Map<String, Class<?>> getTypeMap() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#getWarnings() - */ - public SQLWarning getWarnings() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#isClosed() - */ - public boolean isClosed() throws SQLException { - try{ - return this.seConnection.isClosed(); - } catch (Exception e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.Connection#isReadOnly() - */ - public boolean isReadOnly() throws SQLException { - return false; - } - - /** - * @see java.sql.Connection#nativeSQL(java.lang.String) - */ - public String nativeSQL(String sql) throws SQLException { - return null; - } - - /** - * @see java.sql.Connection#prepareCall(java.lang.String) - */ - public CallableStatement prepareCall(String sql) throws SQLException { - return null; - } + /** + * @see java.sql.Connection#clearWarnings() + */ + public void clearWarnings() throws SQLException { + } - /** - * @see java.sql.Connection#prepareCall(java.lang.String, int, int) - */ - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - return null; - } - - /** - * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) - */ - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String) - */ - public PreparedStatement prepareStatement(String sql) throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int) - */ - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) - */ - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) - */ - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) - */ - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) - */ - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - - return null; - } + /** + * @see java.sql.Connection#close() + */ + public void close() throws SQLException { + try { + this.seConnection.close(); + } catch (SeException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } - /** - * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) - */ - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - } - - /** - * @see java.sql.Connection#rollback() - */ - public void rollback() throws SQLException { - try { - this.seConnection.rollbackTransaction(); + /** + * @see java.sql.Connection#commit() + */ + public void commit() throws SQLException { + try{ + this.seConnection.commitTransaction(); } catch (SeException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); + log.error(e,e); + throw new SQLException(e.getMessage()); } - } - - /** - * @see java.sql.Connection#rollback(java.sql.Savepoint) - */ - public void rollback(Savepoint savepoint) throws SQLException { - this.rollback(); - } - - /** - * @see java.sql.Connection#setAutoCommit(boolean) - */ - public void setAutoCommit(boolean autoCommit) throws SQLException { - } - - /** - * @see java.sql.Connection#setCatalog(java.lang.String) - */ - public void setCatalog(String catalog) throws SQLException { - } + } - /** - * @see java.sql.Connection#setHoldability(int) - */ - public void setHoldability(int holdability) throws SQLException { - } - - /** - * @see java.sql.Connection#setReadOnly(boolean) - */ - public void setReadOnly(boolean readOnly) throws SQLException { - } - - /** - * @see java.sql.Connection#setSavepoint() - */ - public Savepoint setSavepoint() throws SQLException { - - return null; - } + /** + * @see java.sql.Connection#createStatement() + */ + public Statement createStatement() throws SQLException { + return new ArcSDEStatement(this); + } - /** - * @see java.sql.Connection#setSavepoint(java.lang.String) - */ - public Savepoint setSavepoint(String name) throws SQLException { - - return null; - } + /** + * @see java.sql.Connection#createStatement(int, int) + */ + public Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException { + return new ArcSDEStatement(this); + } - /** - * @see java.sql.Connection#setTransactionIsolation(int) - */ - public void setTransactionIsolation(int level) throws SQLException { - } + /** + * @see java.sql.Connection#createStatement(int, int, int) + */ + public Statement createStatement(int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return new ArcSDEStatement(this); + } - /** - * @see java.sql.Connection#setTypeMap(java.util.Map) - */ - public void setTypeMap(Map<String, Class<?>> map) throws SQLException { - } - - /** + /** + * @see java.sql.Connection#getAutoCommit() + */ + public boolean getAutoCommit() throws SQLException { + return false; + } + + /** + * @see java.sql.Connection#getCatalog() + */ + public String getCatalog() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#getHoldability() + */ + public int getHoldability() throws SQLException { + return 0; + } + + /** + * @see java.sql.Connection#getMetaData() + */ + public DatabaseMetaData getMetaData() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#getTransactionIsolation() + */ + public int getTransactionIsolation() throws SQLException { + return 0; + } + + /** + * @see java.sql.Connection#getTypeMap() + */ + public Map<String, Class<?>> getTypeMap() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#getWarnings() + */ + public SQLWarning getWarnings() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#isClosed() + */ + public boolean isClosed() throws SQLException { + try{ + return this.seConnection.isClosed(); + } catch (Exception e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.Connection#isReadOnly() + */ + public boolean isReadOnly() throws SQLException { + return false; + } + + /** + * @see java.sql.Connection#nativeSQL(java.lang.String) + */ + public String nativeSQL(String sql) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareCall(java.lang.String) + */ + public CallableStatement prepareCall(String sql) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareCall(java.lang.String, int, int) + */ + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) + */ + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String) + */ + public PreparedStatement prepareStatement(String sql) throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int) + */ + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) + */ + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) + throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) + */ + public PreparedStatement prepareStatement(String sql, String[] columnNames) + throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) + */ + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) + */ + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) + */ + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + } + + /** + * @see java.sql.Connection#rollback() + */ + public void rollback() throws SQLException { + try { + this.seConnection.rollbackTransaction(); + } catch (SeException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.Connection#rollback(java.sql.Savepoint) + */ + public void rollback(Savepoint savepoint) throws SQLException { + this.rollback(); + } + + /** + * @see java.sql.Connection#setAutoCommit(boolean) + */ + public void setAutoCommit(boolean autoCommit) throws SQLException { + } + + /** + * @see java.sql.Connection#setCatalog(java.lang.String) + */ + public void setCatalog(String catalog) throws SQLException { + } + + /** + * @see java.sql.Connection#setHoldability(int) + */ + public void setHoldability(int holdability) throws SQLException { + } + + /** + * @see java.sql.Connection#setReadOnly(boolean) + */ + public void setReadOnly(boolean readOnly) throws SQLException { + } + + /** + * @see java.sql.Connection#setSavepoint() + */ + public Savepoint setSavepoint() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#setSavepoint(java.lang.String) + */ + public Savepoint setSavepoint(String name) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#setTransactionIsolation(int) + */ + public void setTransactionIsolation(int level) throws SQLException { + } + + /** + * @see java.sql.Connection#setTypeMap(java.util.Map) + */ + public void setTypeMap(Map<String, Class<?>> map) throws SQLException { + } + + /** * @return the seConnection */ public SeConnection getSeConnection() { - return seConnection; + return seConnection; } public Array createArrayOf(String arg0, Object[] arg1) throws SQLException { @@ -424,7 +448,6 @@ } public boolean isValid(int arg0) throws SQLException { - boolean valid = true; try { this.seConnection.testServer(serverRoundtripInterval); @@ -432,7 +455,7 @@ log.debug("The validation of the Connection has occured an Error. The connection is invalid."); valid = false; } - + return valid; }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/** - * Title: ArcSDEConnectionParams, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEConnectionParams.java,v 1.1 2007/11/22 07:40:11 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEConnectionParams.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 22.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2007/11/22 07:40:11 $ - * Version: $Revision: 1.1 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import org.apache.log4j.Logger; - -/** - * The class <code>ArcSDEConnectionParams</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 22.11.2007 08:10:11 - */ -public class ArcSDEConnectionParams { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(ArcSDEConnectionParams.class); - private static boolean sDebug = sLogger.isDebugEnabled(); - - private String mServer; - private int mInstance; - private String mDatabase; - private String mUser; - private String mPwd; - private int mInitConnections; - private int mMaxConnections; - private long mTimeToHold; - - public ArcSDEConnectionParams(String pServer, int pInstance, String pDatabase, String pUser, String pPwd, int pInitConnections, int pMaxConnections, long pTimeToHold) { - mServer = pServer; - mInstance = pInstance; - mDatabase = pDatabase; - mUser = pUser; - mPwd = pPwd; - mMaxConnections = pMaxConnections; - mInitConnections = pInitConnections; - mTimeToHold = pTimeToHold; - } - - - public String getServer() { - return mServer; - } - - public int getInstance() { - return mInstance; - } - - public String getDatabase() { - return mDatabase; - } - - public String getUser() { - return mUser; - } - - public String getPwd() { - return mPwd; - } - - public int getInitConnections() { - return mInitConnections; - } - - public int getMaxConnections() { - return mMaxConnections; - } - - public long getTimeToHold() { - return mTimeToHold; - } -}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,19 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.sde.datasources; import java.sql.ResultSetMetaData; import java.sql.SQLException; + import java.util.List; /** - * @author Tim Englich <tim.englich@intevation.de> + * This Class is an Wrapperclass for the ResultSetMetaData and the + * ColumnDefinitions which are retrieved from the ArcSDE-Backend. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ArcSDEResultSetMetaData implements ResultSetMetaData { + /** + * The Columndefinitions which are required to explain the retrieved Data. + */ private List<ColDefinition> columnDefinitions = null; + /** * Constructor */ @@ -25,7 +37,6 @@ * @see java.sql.ResultSetMetaData#getCatalogName(int) */ public String getCatalogName(int column) throws SQLException { - return null; } @@ -33,14 +44,26 @@ * @see java.sql.ResultSetMetaData#getColumnClassName(int) */ public String getColumnClassName(int column) throws SQLException { - int type = this.getColumnType(column); - Class clazz = java.lang.Object.class; - if (type == 2){ - clazz = int.class; + if (type == ColDefinition.INT16){ + return "Integer"; + }else if (type == ColDefinition.INT32){ + return "Integer"; + }else if (type == ColDefinition.INT64){ + return "Long"; + }else if (type == ColDefinition.NSTRING || type == ColDefinition.STRING){ + return "String"; + }else if (type == ColDefinition.DATE){ + return "Date"; + }else if (type == ColDefinition.FLOAT){ + return "Float"; + }else if (type == ColDefinition.FLOAT32){ + return "Double"; + }else if (type == ColDefinition.FLOAT64){ + return "Double"; + }else{ + return java.lang.Object.class.getName(); } - // TODO weitere Klassen Implementieren - return clazz.getName(); } /** @@ -54,7 +77,6 @@ * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int) */ public int getColumnDisplaySize(int column) throws SQLException { - return 0; } @@ -83,7 +105,6 @@ * @see java.sql.ResultSetMetaData#getColumnTypeName(int) */ public String getColumnTypeName(int column) throws SQLException { - return null; } @@ -91,7 +112,6 @@ * @see java.sql.ResultSetMetaData#getPrecision(int) */ public int getPrecision(int column) throws SQLException { - return 0; } @@ -99,7 +119,6 @@ * @see java.sql.ResultSetMetaData#getScale(int) */ public int getScale(int column) throws SQLException { - return 0; } @@ -107,7 +126,6 @@ * @see java.sql.ResultSetMetaData#getSchemaName(int) */ public String getSchemaName(int column) throws SQLException { - return null; } @@ -115,7 +133,6 @@ * @see java.sql.ResultSetMetaData#getTableName(int) */ public String getTableName(int column) throws SQLException { - return null; } @@ -123,7 +140,6 @@ * @see java.sql.ResultSetMetaData#isAutoIncrement(int) */ public boolean isAutoIncrement(int column) throws SQLException { - return false; } @@ -131,7 +147,6 @@ * @see java.sql.ResultSetMetaData#isCaseSensitive(int) */ public boolean isCaseSensitive(int column) throws SQLException { - return false; } @@ -139,7 +154,6 @@ * @see java.sql.ResultSetMetaData#isCurrency(int) */ public boolean isCurrency(int column) throws SQLException { - return false; } @@ -147,7 +161,6 @@ * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int) */ public boolean isDefinitelyWritable(int column) throws SQLException { - return false; } @@ -155,7 +168,6 @@ * @see java.sql.ResultSetMetaData#isNullable(int) */ public int isNullable(int column) throws SQLException { - return 0; } @@ -163,7 +175,6 @@ * @see java.sql.ResultSetMetaData#isReadOnly(int) */ public boolean isReadOnly(int column) throws SQLException { - return true; } @@ -171,7 +182,6 @@ * @see java.sql.ResultSetMetaData#isSearchable(int) */ public boolean isSearchable(int column) throws SQLException { - return true; } @@ -189,10 +199,16 @@ return false; } + /** + * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) + */ public boolean isWrapperFor(Class<?> iface) throws SQLException { return false; } + /** + * @see java.sql.Wrapper#unwrap(java.lang.Class) + */ public <T> T unwrap(Class<T> iface) throws SQLException { return null; }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.sde.datasources; import com.esri.sde.sdk.client.SDEPoint; @@ -20,6 +28,7 @@ import com.esri.sde.sdk.client.SeSqlConstruct; import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Polygon; @@ -36,180 +45,194 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This Class wrapps an SDE-Statment to an java.sql.Statement. + * This Class also handles the SDE-Specific -Spatial-Queries and + * RasterQueries. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class ArcSDEStatement implements Statement { - /** + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEStatement.class); - - private ArcSDEConnection connection = null; - - /** - * Constructor - */ - public ArcSDEStatement(ArcSDEConnection connection) { - this.connection = connection; - } - - /** - * @see java.sql.Statement#addBatch(java.lang.String) - */ - public void addBatch(String arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#cancel() - */ - public void cancel() throws SQLException { - } - - /** - * @see java.sql.Statement#clearBatch() - */ - public void clearBatch() throws SQLException { - } - - /** - * @see java.sql.Statement#clearWarnings() - */ - public void clearWarnings() throws SQLException { - } - - /** - * @see java.sql.Statement#close() - */ - public void close() throws SQLException { - } - - /** - * @see java.sql.Statement#execute(java.lang.String) - */ - public boolean execute(String arg0) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#execute(java.lang.String, int) - */ - public boolean execute(String arg0, int arg1) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#execute(java.lang.String, int[]) - */ - public boolean execute(String arg0, int[] arg1) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#execute(java.lang.String, java.lang.String[]) - */ - public boolean execute(String arg0, String[] arg1) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#executeBatch() - */ - public int[] executeBatch() throws SQLException { - - return null; - } - /** - * @see java.sql.Statement#executeQuery(java.lang.String) - */ - public ResultSet executeQuery(String statement) throws SQLException { - try { - SeQuery query = null; - if (statement.toLowerCase().contains("st_astext") || statement.toLowerCase().contains("intersects")){ - - String[] values = statement.toLowerCase().split("where", 2); - String where = values.length > 1 ? values[1].trim() : ""; - String[] tableNames = values[0].substring(values[0].indexOf("from")).replaceFirst("from", "").toUpperCase().trim().split(", "); - String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim(); - columnValueString = columnValueString.replaceFirst("select", "").trim(); - String[] returnFields = columnValueString.split(", "); - String geometryColumnName = null; - String byClause = null; - int byClausePos = where.indexOf("group by"); - if (byClausePos < 0){ - byClausePos = where.indexOf("order by"); - } - if (byClausePos > 0){ - byClause = where.substring(byClausePos); - where = where.substring(0,byClausePos); - } - - for (int i = 0; i < returnFields.length; i++){ - returnFields[i] = returnFields[i].trim(); - if (returnFields[i].startsWith("st_astext(")){ - returnFields[i] = returnFields[i].replaceAll("st_astext", ""); - returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1); - geometryColumnName = returnFields[i]; - } - } - - for (int i = 0; i < tableNames.length; i++){ - tableNames[i] = tableNames[i].trim(); - } - - Geometry g = null; - int pos = where.indexOf("intersects"); - if (pos >= 0 ){ - String substr = where.substring(pos); - where = where.substring(0,where.lastIndexOf("intersects")); - int andPos = where.lastIndexOf("and"); - if (andPos < 0){ - andPos = 0; - } - where = where.substring(0,andPos); // TODO support or also - String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Spatial-Statment is the last one - String wkt = null; - if (intersectsStmt.contains("select")){ - // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben. - String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")")); - ResultSet resultSet = this.executeQuery(stmt); - if (resultSet != null && resultSet.next()){ - // TODO: Support the selection of more than one Geometry - wkt = resultSet.getString("SHAPE"); - } - }else{ - wkt = intersectsStmt.substring(intersectsStmt.indexOf("\""), intersectsStmt.lastIndexOf("\"")).replace("\"", "").trim(); - } - g = new WKTReader().read(wkt.toUpperCase()); - - if (geometryColumnName == null){ - geometryColumnName = "SHAPE"; // TODO dynamisch aus Intersects auslesen. - } - - } - - return this.executeQuery(this.connection.getSeConnection(), tableNames, geometryColumnName, where, g, returnFields,byClause); - }else{ - query = new SeQuery(this.connection.getSeConnection()); - query.prepareSql(statement); - query.execute(); - return this.handleResultSet(query,false,null); - } - - } catch (Exception e) { - log.error(e,e); - throw new SQLException(e.getMessage()); + /** + * The Connection to the ArcSDE-Backend + */ + private ArcSDEConnection connection = null; + + /** + * Constructor + * @param connection the Connection to the ArcSDE-Backend. + */ + public ArcSDEStatement(ArcSDEConnection connection) { + this.connection = connection; + } + + /** + * @see java.sql.Statement#addBatch(java.lang.String) + */ + public void addBatch(String arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#cancel() + */ + public void cancel() throws SQLException { + } + + /** + * @see java.sql.Statement#clearBatch() + */ + public void clearBatch() throws SQLException { + } + + /** + * @see java.sql.Statement#clearWarnings() + */ + public void clearWarnings() throws SQLException { + } + + /** + * @see java.sql.Statement#close() + */ + public void close() throws SQLException { + } + + /** + * @see java.sql.Statement#execute(java.lang.String) + */ + public boolean execute(String arg0) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#execute(java.lang.String, int) + */ + public boolean execute(String arg0, int arg1) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#execute(java.lang.String, int[]) + */ + public boolean execute(String arg0, int[] arg1) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#execute(java.lang.String, java.lang.String[]) + */ + public boolean execute(String arg0, String[] arg1) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#executeBatch() + */ + public int[] executeBatch() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#executeQuery(java.lang.String) + */ + public ResultSet executeQuery(String statement) throws SQLException { + try { + SeQuery query = null; + if (statement.toLowerCase().contains("st_astext") || statement.toLowerCase().contains("intersects")){ + + String[] values = statement.toLowerCase().split("where", 2); + String where = values.length > 1 ? values[1].trim() : ""; + String[] tableNames = values[0].substring(values[0].indexOf("from")).replaceFirst("from", "").toUpperCase().trim().split(", "); + String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim(); + columnValueString = columnValueString.replaceFirst("select", "").trim(); + String[] returnFields = columnValueString.split(", "); + String geometryColumnName = null; + String byClause = null; + int byClausePos = where.indexOf("group by"); + if (byClausePos < 0){ + byClausePos = where.indexOf("order by"); + } + if (byClausePos > 0){ + byClause = where.substring(byClausePos); + where = where.substring(0,byClausePos); + } + + for (int i = 0; i < returnFields.length; i++){ + returnFields[i] = returnFields[i].trim(); + if (returnFields[i].startsWith("st_astext(")){ + returnFields[i] = returnFields[i].replaceAll("st_astext", ""); + returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1); + geometryColumnName = returnFields[i]; + } + } + + for (int i = 0; i < tableNames.length; i++){ + tableNames[i] = tableNames[i].trim(); + } + + Geometry g = null; + int pos = where.indexOf("intersects"); + if (pos >= 0 ){ + String substr = where.substring(pos); + where = where.substring(0,where.lastIndexOf("intersects")); + int andPos = where.lastIndexOf("and"); + if (andPos < 0){ + andPos = 0; + } + where = where.substring(0,andPos); // TODO support or also + String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Spatial-Statment is the last one + String wkt = null; + if (intersectsStmt.contains("select")){ + // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben. + String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")")); + ResultSet resultSet = this.executeQuery(stmt); + if (resultSet != null && resultSet.next()){ + // TODO: Support the selection of more than one Geometry + wkt = resultSet.getString("SHAPE"); + } + }else{ + wkt = intersectsStmt.substring(intersectsStmt.indexOf("\""), intersectsStmt.lastIndexOf("\"")).replace("\"", "").trim(); + } + g = new WKTReader().read(wkt.toUpperCase()); + + if (geometryColumnName == null){ + geometryColumnName = "SHAPE"; // TODO dynamisch aus Intersects auslesen. + } + + } + + return this.executeQuery(this.connection.getSeConnection(), tableNames, geometryColumnName, where, g, returnFields,byClause); + }else{ + query = new SeQuery(this.connection.getSeConnection()); + query.prepareSql(statement); + query.execute(); + return this.handleResultSet(query,false,null); + } + + } catch (Exception e) { + log.error(e,e); + throw new SQLException(e.getMessage()); } - - - } - + + + } + /** + * This Methods Executes the ArcSDE Query if Spatial-Restrictions + * are given + * @param con The Connection to the ArcSDE-Backend. + * @param pLayername The Name of tables which should be used in the Query + * @param pSpatialColumnName the Name of the Spatial Column. + * @param pWhere The where-Clause to limit the Data + * @param g the Geometry to limit the Data + * @param pReturnFields the Fileds that should be fetched from the Database + * @param byClause the byClaus to order the Results. + * @return the @see java.sql.ResultSet with the Data which was retrieved. + * @throws SQLException + */ private ResultSet executeQuery(SeConnection con, String[] pLayername, String pSpatialColumnName, String pWhere, Geometry g, String[] pReturnFields, String byClause) @@ -218,24 +241,27 @@ try { // get the layer for querying boolean isRaster = pSpatialColumnName.equalsIgnoreCase("raster"); - + SeShapeFilter[] filters = null; if (g != null){ if (!isRaster){ SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); SeShape shape = new SeShape(); shape.setCoordRef(lLayer.getCoordRef()); - + SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g); - + int searchMode = SeFilter.METHOD_AI; if (g instanceof Polygon){ shape.generatePolygon(lPoints.length, 1, null, lPoints); }else if (g instanceof Point){ shape.generatePoint(1, lPoints); searchMode = SeFilter.METHOD_PC; + }else if (g instanceof LineString){ + shape.generateLine(lPoints.length, 1, null, lPoints); + searchMode = SeFilter.METHOD_LCROSS; } - + SeShapeFilter filter = new SeShapeFilter(pLayername[0], pSpatialColumnName, shape,searchMode); filters = new SeShapeFilter[1]; @@ -246,14 +272,14 @@ SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); spatialQuery = new SeQuery(con);//, pReturnFields, sqlCons); - + SeQueryInfo queryInfo = new SeQueryInfo(); queryInfo.setColumns(pReturnFields); - + if (byClause != null){ queryInfo.setByClause(byClause); } - + queryInfo.setConstruct(sqlCons); spatialQuery.prepareQueryInfo(queryInfo); @@ -264,11 +290,11 @@ spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, filters); } - + if (!isRaster){ spatialQuery.execute(); } - + return this.handleResultSet(spatialQuery,isRaster,g); } catch (Exception e) { @@ -277,219 +303,208 @@ }else{ log.error(e.getMessage(), e); } - + throw new SQLException(e.getMessage()); } } - /** - * @see java.sql.Statement#executeUpdate(java.lang.String) - */ - public int executeUpdate(String arg0) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#executeUpdate(java.lang.String, int) - */ - public int executeUpdate(String arg0, int arg1) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#executeUpdate(java.lang.String, int[]) - */ - public int executeUpdate(String arg0, int[] arg1) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[]) - */ - public int executeUpdate(String arg0, String[] arg1) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getConnection() - */ - public Connection getConnection() throws SQLException { - return this.connection; - } - - /** - * @see java.sql.Statement#getFetchDirection() - */ - public int getFetchDirection() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getFetchSize() - */ - public int getFetchSize() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getGeneratedKeys() - */ - public ResultSet getGeneratedKeys() throws SQLException { - - return null; - } - - /** - * @see java.sql.Statement#getMaxFieldSize() - */ - public int getMaxFieldSize() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getMaxRows() - */ - public int getMaxRows() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getMoreResults() - */ - public boolean getMoreResults() throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#getMoreResults(int) - */ - public boolean getMoreResults(int arg0) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#getQueryTimeout() - */ - public int getQueryTimeout() throws SQLException { + /** + * @see java.sql.Statement#executeUpdate(java.lang.String) + */ + public int executeUpdate(String arg0) throws SQLException { + return 0; + } - return 0; - } - - /** - * @see java.sql.Statement#getResultSet() - */ - public ResultSet getResultSet() throws SQLException { - - return null; - } - - /** - * @see java.sql.Statement#getResultSetConcurrency() - */ - public int getResultSetConcurrency() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getResultSetHoldability() - */ - public int getResultSetHoldability() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getResultSetType() - */ - public int getResultSetType() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getUpdateCount() - */ - public int getUpdateCount() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getWarnings() - */ - public SQLWarning getWarnings() throws SQLException { + /** + * @see java.sql.Statement#executeUpdate(java.lang.String, int) + */ + public int executeUpdate(String arg0, int arg1) throws SQLException { + return 0; + } - return null; - } - - /** - * @see java.sql.Statement#setCursorName(java.lang.String) - */ - public void setCursorName(String arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#setEscapeProcessing(boolean) - */ - public void setEscapeProcessing(boolean arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#setFetchDirection(int) - */ - public void setFetchDirection(int arg0) throws SQLException { - } + /** + * @see java.sql.Statement#executeUpdate(java.lang.String, int[]) + */ + public int executeUpdate(String arg0, int[] arg1) throws SQLException { + return 0; + } - /** - * @see java.sql.Statement#setFetchSize(int) - */ - public void setFetchSize(int arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#setMaxFieldSize(int) - */ - public void setMaxFieldSize(int arg0) throws SQLException { - } + /** + * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[]) + */ + public int executeUpdate(String arg0, String[] arg1) throws SQLException { + return 0; + } - /** - * @see java.sql.Statement#setMaxRows(int) - */ - public void setMaxRows(int arg0) throws SQLException { - } + /** + * @see java.sql.Statement#getConnection() + */ + public Connection getConnection() throws SQLException { + return this.connection; + } - /** - * @see java.sql.Statement#setQueryTimeout(int) - */ - public void setQueryTimeout(int arg0) throws SQLException { - } - - /** - * Copied from de.intevation.gnv.geobackend.sde.datasources.SDEQuery - * @param pSeQuery - * @return - * @throws SeException - */ - private ResultSet handleResultSet(SeQuery pSeQuery, boolean isRaster, Geometry geometry) throws SeException { + /** + * @see java.sql.Statement#getFetchDirection() + */ + public int getFetchDirection() throws SQLException { + return 0; + } + /** + * @see java.sql.Statement#getFetchSize() + */ + public int getFetchSize() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getGeneratedKeys() + */ + public ResultSet getGeneratedKeys() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#getMaxFieldSize() + */ + public int getMaxFieldSize() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getMaxRows() + */ + public int getMaxRows() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getMoreResults() + */ + public boolean getMoreResults() throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#getMoreResults(int) + */ + public boolean getMoreResults(int arg0) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#getQueryTimeout() + */ + public int getQueryTimeout() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getResultSet() + */ + public ResultSet getResultSet() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#getResultSetConcurrency() + */ + public int getResultSetConcurrency() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getResultSetHoldability() + */ + public int getResultSetHoldability() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getResultSetType() + */ + public int getResultSetType() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getUpdateCount() + */ + public int getUpdateCount() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getWarnings() + */ + public SQLWarning getWarnings() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#setCursorName(java.lang.String) + */ + public void setCursorName(String arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setEscapeProcessing(boolean) + */ + public void setEscapeProcessing(boolean arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setFetchDirection(int) + */ + public void setFetchDirection(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setFetchSize(int) + */ + public void setFetchSize(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setMaxFieldSize(int) + */ + public void setMaxFieldSize(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setMaxRows(int) + */ + public void setMaxRows(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setQueryTimeout(int) + */ + public void setQueryTimeout(int arg0) throws SQLException { + } + + /** + * This Method fetches all Rows from the SeQuery-Object and convert it into + * an @see java.sql.ResultSet. + * + * @param pSeQuery the Queryobject where the Data should be fetched from. + * @param isRaster Flag which indicates if the Result is Rasterdata. + * @param geometry The Geometry which might be used to limit the data. + * @return an java.sql:ResultSet which contains the Data. + * @throws SeException + */ + private ResultSet handleResultSet(SeQuery pSeQuery, + boolean isRaster, + Geometry geometry) throws SeException { boolean debug = log.isDebugEnabled(); if (debug) { log.debug("ArcSDEStatement.handleResultSet()"); } - SDEResultSet lSet = new SDEResultSet(); + SDEResultSet lSet = isRaster + ? new UncacheableSDEResultSet() + : new SDEResultSet(); SeRow row = null; int lCount; if (!isRaster){ @@ -514,7 +529,7 @@ Row lBackingRow = new Row(lNumCols); for (int i = 0; i < lNumCols; i++) { lBackingRow.addObject( - removers[i].filter(row.getObject(i)), + removers[i].filter(row.getObject(i)), i); } lSet.addRow(lBackingRow); @@ -541,27 +556,18 @@ SeRaster raster = attr.getRasterInfo(); SeRasterBand [] bands = raster.getBands(); SeRasterBand rasterBand = bands[0]; - + SeExtent extent = rasterBand.getExtent(); - /* - if (debug) { - log.debug("Extent: " + - extent.getMinX() + " " + extent.getMinY() + " "+ - extent.getMaxX() + " " + extent.getMaxY()); - log.debug("Query geometry: "+geometry.toText()); - } - */ - double x = ((Point)geometry).getX(); double y = ((Point)geometry).getY(); boolean isPointInRaster = - x >= extent.getMinX() && x <= extent.getMaxX() + x >= extent.getMinX() && x <= extent.getMaxX() && y >= extent.getMinY() && y <= extent.getMaxY(); - + if (isPointInRaster){ - + if (row == null){ pSeQuery.execute(); row = pSeQuery.fetch(); @@ -572,7 +578,7 @@ SDEPoint origin = rasterBand.getTileOrigin(); - double maxX = origin.getX() < midX + double maxX = origin.getX() < midX ? extent.getMaxX() : extent.getMinX(); @@ -580,13 +586,6 @@ ? extent.getMaxY() : extent.getMinY(); - /* - 0 = origin.getX()*mx + bx - rasterBand.getBandWidth() = maxX + bx - - rasterBand.getBandWidth() = (maxX-origin.getX())*mx - */ - double mx = rasterBand.getBandWidth()/(maxX-origin.getX()); double bx = -origin.getX()*mx; double px = mx*x + bx; @@ -595,12 +594,6 @@ double by = -origin.getY()*my; double py = my*y + by; - /* - if (debug) { - log.debug("p(x, y): " + px + " / " + py); - } - */ - SeRasterConstraint constraint = new SeRasterConstraint(); constraint.setLevel(0); // best resolution constraint.setBands(rasterBand.getBandNumber()); @@ -617,12 +610,6 @@ lSet.addCol(new ColDefinition("tile", ColDefinition.FLOAT64)); Row lBackingRow = new Row(1); - /* - 0 = wx1*mt + bt - tileWidth-EPS = wx2*mt + bt - tileWidth-EPS = mt*(wx2 - wx1) - */ - double wx1 = (rasterBand.getTileWidth()*tx - bx)/mx; double wx2 = (rasterBand.getTileWidth()*(tx+1) - bx)/mx; double mxt = (rasterBand.getTileWidth()-1e-5d)/(wx2 - wx1); @@ -644,28 +631,6 @@ lBackingRow.addObject(ro, 0); lSet.addRow(lBackingRow); - /* - if (debug) { - log.debug("x / y: " + x + " / " + y); - log.debug("wx1: " + wx1); - log.debug("wx1 -> " + (wx1*mxt+bxt)); - log.debug("wx2: " + wx2); - log.debug("wx2 -> " + (wx2*mxt+bxt)); - log.debug("wx2 - wx1: " + Math.abs(wx2-wx1)); - log.debug("wy2 - wy1: " + Math.abs(wy2-wy1)); - log.debug("pix: " + (x*mxt + bxt)+ " " + (y*myt + byt)); - log.debug("requesting tile: " + tx + " / " + ty); - log.debug("got tile: " + tile.getColumnIndex() + " / " + tile.getRowIndex()); - log.debug("tile orig: " + origin.getX() + " / " + origin.getY()); - log.debug("tile width: " + rasterBand.getTileWidth()); - log.debug("tile height: " + rasterBand.getTileHeight()); - log.debug("Rasterdimesion (Pixel) " + - rasterBand.getBandWidth() + " / " + rasterBand.getBandHeight()); - log.debug("BAND-ID "+rasterBand.getId().longValue()); - log.debug("Pixels: "+ tile.getNumPixels()); - log.debug("Column / Row "+tile.getColumnIndex()+" / "+tile.getRowIndex()); - } - */ } } else{ @@ -680,23 +645,38 @@ return lSet; } + /** + * @see java.sql.Statement#isClosed() + */ public boolean isClosed() throws SQLException { return false; } + /** + * @see java.sql.Statement#isPoolable() + */ public boolean isPoolable() throws SQLException { return false; } + /** + * @see java.sql.Statement#setPoolable(boolean) + */ public void setPoolable(boolean arg0) throws SQLException { } + /** + * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) + */ public boolean isWrapperFor(Class<?> iface) throws SQLException { return false; } + /** + * @see java.sql.Wrapper#unwrap(java.lang.Class) + */ public <T> T unwrap(Class<T> iface) throws SQLException { return null; - + } }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,163 +1,92 @@ -/** - * Title: ArcSDEUtils, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v 1.7 2007/11/28 14:05:39 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2007/11/28 14:05:39 $ - * Version: $Revision: 1.7 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import java.util.Vector; - -import org.apache.log4j.Logger; - -import com.esri.sde.sdk.client.SDEPoint; -import com.esri.sde.sdk.client.SeColumnDefinition; -import com.esri.sde.sdk.client.SeError; -import com.esri.sde.sdk.client.SeException; -import com.esri.sde.sdk.client.SeTable; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.Point; -import com.vividsolutions.jts.geom.Polygon; - -/** - * The class <code>ArcSDEUtils</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:20:40 - */ -public class ArcSDEUtils { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class); - - public void displayStats(SeTable.SeTableStats tableStats) { - - sLogger.debug("\n--> Table Statistics\n"); - if (tableStats != null) { - - sLogger.debug("Average - " + tableStats.getAverage()); - sLogger.debug("No of rows - " + tableStats.getCount()); - sLogger.debug("Maximum Value - " + tableStats.getMax()); - sLogger.debug("Minimum Value - " + tableStats.getMin()); - sLogger.debug("No of distinct values - " - + tableStats.getNumDistinct()); - sLogger.debug("Standard Deviation - " + tableStats.getStdDev()); - - sLogger.debug("Distinct type - " - + ArcSDEUtils.resolveType(tableStats - .getDistinctType())); - - int[] distinctFreq = tableStats.getDistinctValueFrequencies(); - Vector distinctValues = tableStats.getDistinctValues(); - sLogger.debug("Distinct values & their frequencies : "); - for (int i = 0; i < distinctFreq.length; i++) - sLogger.debug(distinctValues.elementAt(i) + " - " - + distinctFreq[i]); - }// End if - - }// End displayStats - - /** - * Takes an integer corresponding to an ArcSDE data type and returns a - * string description of the type. - * - * @param type - * SDE data type bit-mask. - */ - public static String resolveType(int type) { - - String typeName = "Invalid Type"; - switch (type) { - - case SeColumnDefinition.TYPE_SMALLINT: - typeName = "Small Int"; - break; - case SeColumnDefinition.TYPE_INTEGER: - typeName = "Int"; - break; - case SeColumnDefinition.TYPE_FLOAT: - typeName = "Float"; - break; - case SeColumnDefinition.TYPE_DOUBLE: - typeName = "Double"; - break; - case SeColumnDefinition.TYPE_STRING: - typeName = "String"; - break; - case SeColumnDefinition.TYPE_BLOB: - typeName = "Blob"; - break; - case SeColumnDefinition.TYPE_DATE: - typeName = "Date"; - break; - case SeColumnDefinition.TYPE_SHAPE: - typeName = "Shape"; - break; - case SeColumnDefinition.TYPE_RASTER: - typeName = "Raster"; - break; - } - return typeName; - }// End method resolveType - - public static void printError(SeException exception) { - - SeError error = exception.getSeError(); - - sLogger.debug("\n ArcSDE Error Number : " + error.getSdeError()); - sLogger.debug(" Error Description : " + error.getErrDesc()); - - int extError = error.getExtError(); - if (extError != 0) - sLogger.debug(" Extended Error Number : " + extError); - - String desc = error.getSdeErrMsg(); - if (desc != null && desc.length() != 0) - sLogger.debug(" Extended Error Description : " + desc); - - desc = error.getExtErrMsg(); - if (desc != null && desc.length() != 0) - sLogger.debug(" Extended Error Description : " + desc); - - sLogger.debug(exception); - - }// End printError - - public SDEPoint[] createPoints(Geometry g) { - sLogger.debug("createPoints()"); - Coordinate[] coords = null; - if (g instanceof Polygon) { - coords = ((Polygon) g).getCoordinates(); - }else if (g instanceof Point){ - coords = ((Point)g).getCoordinates(); - } - if (coords != null){ - SDEPoint[] lSDEPoints = new SDEPoint[coords.length]; - for (int i = 0; i < coords.length; i++) { - lSDEPoints[i] = new SDEPoint(coords[i].x, coords[i].y); - } - return lSDEPoints; - }else{ - return null; - } - - } -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +import com.esri.sde.sdk.client.SDEPoint; +import com.esri.sde.sdk.client.SeError; +import com.esri.sde.sdk.client.SeException; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Polygon; + +import org.apache.log4j.Logger; + +/** + * The class <code>ArcSDEUtils</code> fulfills the following purposes: + * + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class ArcSDEUtils { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class); + + /** + * Prints an SEEsception into the Logger of this Class + * @param exception + */ + public static void printError(SeException exception) { + + SeError error = exception.getSeError(); + + sLogger.debug("\n ArcSDE Error Number : " + error.getSdeError()); + sLogger.debug(" Error Description : " + error.getErrDesc()); + + int extError = error.getExtError(); + if (extError != 0) + sLogger.debug(" Extended Error Number : " + extError); + + String desc = error.getSdeErrMsg(); + if (desc != null && desc.length() != 0) + sLogger.debug(" Extended Error Description : " + desc); + + desc = error.getExtErrMsg(); + if (desc != null && desc.length() != 0) + sLogger.debug(" Extended Error Description : " + desc); + + sLogger.debug(exception); + + } + + /** + * Generate an SDEPoint-Array from a given Geometry. + * This Method did not put the Holes to the Array. + * @param g The Geometry which should be converted. + * @return an SDEPoint-Array from a given Ggeometry. + */ + public SDEPoint[] createPoints(Geometry g) { + sLogger.debug("createPoints()"); + Coordinate[] coords = null; + if (g instanceof Polygon) { + coords = ((Polygon) g).getCoordinates(); + }else if (g instanceof Point){ + coords = ((Point)g).getCoordinates(); + }else if (g instanceof LineString){ + coords = ((LineString)g).getCoordinates(); + }else{ + coords = g.getCoordinates(); + } + + if (coords != null){ + SDEPoint[] lSDEPoints = new SDEPoint[coords.length]; + for (int i = 0; i < coords.length; i++) { + lSDEPoints[i] = new SDEPoint(coords[i].x, coords[i].y); + } + return lSDEPoints; + }else{ + return null; + } + } +}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,86 +1,85 @@ -/** - * Title: ColDefinition, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v 1.2 2007/12/21 12:31:15 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2007/12/21 12:31:15 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import org.apache.log4j.Logger; - -/** - * The class <code>ColDefinition</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 10:59:45 - */ -public class ColDefinition { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(ColDefinition.class); - - /** - * @deprecated - */ - public static final int SMALLINT = 1; - /** - * @deprecated - */ - public static final int INTEGER = 2; - /** - * @deprecated - */ - public static final int FLOAT = 3; - /** - * @deprecated - */ - public static final int DOUBLE = 4; - public static final int INT16 = 1; - public static final int INT32 = 2; - public static final int FLOAT32 = 3; - public static final int FLOAT64 = 4; - public static final int STRING = 5; - public static final int BLOB = 6; - public static final int DATE = 7; - public static final int SHAPE = 8; - public static final int RASTER = 9; - public static final int XML = 10; - public static final int INT64 = 11; - public static final int UUID = 12; - public static final int CLOB = 13; - public static final int NSTRING = 14; - public static final int NCLOB = 15; - - private String mName; - private int mType; - - public ColDefinition(String pName, int pType) { - mName = pName; - mType = pType; - } - - public String getName() { - return mName; - } - - public int getType() { - return mType; - } -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +import org.apache.log4j.Logger; + +/** + * The class <code>ColDefinition</code> fulfills the following purposes: + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class ColDefinition { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(ColDefinition.class); + + /** + * @deprecated + */ + public static final int SMALLINT = 1; + /** + * @deprecated + */ + public static final int INTEGER = 2; + /** + * @deprecated + */ + public static final int FLOAT = 3; + /** + * @deprecated + */ + public static final int DOUBLE = 4; + public static final int INT16 = 1; + public static final int INT32 = 2; + public static final int FLOAT32 = 3; + public static final int FLOAT64 = 4; + public static final int STRING = 5; + public static final int BLOB = 6; + public static final int DATE = 7; + public static final int SHAPE = 8; + public static final int RASTER = 9; + public static final int XML = 10; + public static final int INT64 = 11; + public static final int UUID = 12; + public static final int CLOB = 13; + public static final int NSTRING = 14; + public static final int NCLOB = 15; + + private String mName; + private int mType; + + /** + * Constructor + * @param pName the Name of an Column. + * @param pType the Type of an Column. + */ + public ColDefinition(String pName, int pType) { + mName = pName; + mType = pType; + } + + /** + * Returns the Name of an Column. + * @return the Name of an Column. + */ + public String getName() { + return mName; + } + + /** + * Returns the Type of an Column. + * @return the Type of an Column. + */ + public int getType() { + return mType; + } +}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) - * All rights reserved - * - * $Id: Datasource.java,v 1.4 2008/01/30 12:38:34 blume Exp $ - * - * created by: drewnak - * created at : 21.11.2007 - * created at : 14:25:50 - * - * modified by: $Author: blume $ - * modified at: $Date: 2008/01/30 12:38:34 $ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import java.util.Map; - -import de.intevation.gnv.geobackend.sde.datasources.exception.DatasourceException; - -/** - * Abstract class for handling different datasources. - * This method provides a static method for creating dataosurce objects. - * - * @author drewnak - */ -public abstract class Datasource { - - protected Map mParameters; - - protected String mName; - - - /** - * Triggers the creation of a dataosurce object. Following the guidelines, the parameters for creating this datasource are delivered by the configuration file. - * - * @param pName a name for the datasource. - * @param pClassname The name of the class extending this abstract datasource class. Used to create a new instance. - * @param pParams a Map of Parameters needed for the initialization of the datasource. - * @return a datasourceobject - * @throws DatasourceException if the class could not be found or the initialization of the datasource fails. - */ - public static final Datasource create(String pName, String pClassname, - Map pParams) throws DatasourceException { - Class lDatasourceClass; - try { - lDatasourceClass = Class.forName(pClassname); - } catch (ClassNotFoundException e) { - throw new DatasourceException("Could not load class " + pClassname); - } - Datasource lNewInstance; - try { - lNewInstance = (Datasource) lDatasourceClass.newInstance(); - } catch (Exception e) { - throw new DatasourceException("Could not create instance of " + pClassname, e); - } - lNewInstance.init(pName, pParams); - - return lNewInstance; - } - - /** - * An abstract method for the initialization of a datasource instance. - * Of course, only the concrete implementation knwos about the ncessary parameters for the initialization. - * - * @param pName a name for the datasource. - * @param pParams a Map of Parameters needed for the initialization of the datasource. - */ - protected abstract void init(String pName, Map pParams) throws DatasourceException; - - /** - * @return - */ - public String getName() { - return mName; - } - - - /** - * This method returns a datasourceconnection. - * Only the concrete implementation of the Datasource knwos about the DatasourceConnection-Implementation to return. - * - * @return a DatasourceConnection - */ - public abstract DatasourceConnection getConnection(); - - /** - * Returns a DatasourceConnection. This method is usualy called after an executed query. - * See: Some datasource implementations need to explicitly close an existing connection. - * - * @param pConnection the connection to be returned. - */ - public abstract void returnConnection(DatasourceConnection pConnection); -}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/** - * Title: IDatasourceConnection, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/DatasourceConnection.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/DatasourceConnection.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -/** - * The interface <code>DatasourceConnection</code> fulfills the following purposes: - * <ol> - * <li>Beeing a marker interface for datasource connections.</li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:50:20 - */ -public interface DatasourceConnection { -}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.sde.datasources; import com.vividsolutions.jts.geom.Coordinate; @@ -16,10 +21,10 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ -public class RasterObject +public class RasterObject implements Serializable { private static Logger log = Logger.getLogger(RasterObject.class); @@ -50,7 +55,7 @@ public RasterObject( double mx, double bx, double my, double by, - int columnIndex, + int columnIndex, int rowIndex, double [] rasterData, int tileWidth, @@ -92,7 +97,7 @@ public int getRowIndex() { return rowIndex; } - + public double getValue(Coordinate coordinate) { return getValue(coordinate, NEAREST_NEIGHBOR); }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,68 +1,55 @@ -/** - * Title: ResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import org.apache.log4j.Logger; - -/** - * The class <code>ResultSet</code> fulfills the following purposes: - * <ol> - * <li>Providing an abstract object for dealing with result sets.</li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 09:26:53 - */ -public abstract class ResultSet implements java.sql.ResultSet { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(ResultSet.class); - - /** - * Returns the number of hits. - * - * @return count of results. - */ - public abstract int getCount(); - - /** - * Returns the number of columns returned through the query. - * - * @return the number of columns. - */ - public abstract int getNumberOfColumns(); - - /** - * A ResultSet can tell about the concrete definition of each column. - * This method returns an array of {@link de.conterra.bsh.gdi.gnviewer.datasources.ColDefinition}-Objects. - * - * @return the definitions describing the result set. - */ - public abstract ColDefinition[] getColumnDefinitions(); - - /** - * Returns an array of Rows. The rows contain the "content" of the current ResultSet. - * - * @return the results itself. - */ - public abstract Row[] getResults(); - -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +import org.apache.log4j.Logger; + +/** + * The class <code>ResultSet</code> fulfills the following purposes: + * <ol> + * <li>Providing an abstract object for dealing with result sets.</li> + * </ol> + * + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public abstract class ResultSet implements java.sql.ResultSet { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(ResultSet.class); + + /** + * Returns the number of hits. + * @return count of results. + */ + public abstract int getCount(); + + /** + * Returns the number of columns returned through the query. + * @return the number of columns. + */ + public abstract int getNumberOfColumns(); + + /** + * A ResultSet can tell about the concrete definition of each column. + * This method returns an array of ColDefinition-Objects. + * @return the definitions describing the result set. + */ + public abstract ColDefinition[] getColumnDefinitions(); + + /** + * Returns an array of Rows. The rows contain the "content" of the current ResultSet. + * + * @return the results itself. + */ + public abstract Row[] getResults(); + +}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,330 +1,294 @@ -/** - * Title: Row, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v 1.4 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.4 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; - -import org.apache.log4j.Logger; - -import com.esri.sde.sdk.client.SDEPoint; -import com.esri.sde.sdk.client.SeException; -import com.esri.sde.sdk.client.SeShape; - -import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; -import de.intevation.gnv.geobackend.util.DateUtils; - -/** - * A Row represents a set of values. - * In a technical manner (e.g. database manner) a row contains all attributes of a single "hit". - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 11:00:54 - */ -public class Row { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(Row.class); - - /** - * Data container. - */ - private Object[] mObjects; - - /** - * Constructor. - * - * @param pRowSize the number of attributes contained by this row. - */ - public Row(int pRowSize) { - mObjects = new Object[pRowSize]; - } - - /** - * Constructor. - * - * @param ArrayStr a line from CSV-File. - */ - public Row (String[] ArrayStr){ - this (ArrayStr.length); - int nLength = ArrayStr.length; - for (int i=0; i < nLength; i++){ - addObject(ArrayStr[i], i); - - } - - } - - - /** - * Adds an attribute value to a specific position of this row. - * - * @param pObject the object to be stored. - * @param pPos the postion the value to be saved - */ - public void addObject(Object pObject, int pPos) { - mObjects[pPos] = pObject; - } - - /** - * Returns a Value out of the Row. - * - * @param pPos the position of the value to be returned. - * @return an Object! (not strongly typed) - * @throws TechnicalException - */ - public Object getValue(int pPos) throws TechnicalException { - if (pPos < mObjects.length) { - - Object o = mObjects[pPos]; - if (o instanceof SeShape){ - return this.getPosValue(pPos); - }else{ - return o; - } - } else { - throw new TechnicalException("Cannot access this field position. Size is: " + mObjects.length); - } - } - - - /** - * This is a covenient method for getting strongly typed objects out of the row. - * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). - * In fact, this method executes a simple cast to the desired type. - * - * @param pPos the position of the object to be resolved. - * @return a strongly typed Date - * @throws TechnicalException - * @see #getValue(int) - */ - public Date getDateValue(int pPos) throws TechnicalException { - Date date = null; - try { - Calendar lCalendar = (Calendar) getValue(pPos); - date = lCalendar.getTime(); - } - catch (ClassCastException e) { - try{ - //SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); - date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos)); - - - } - catch (Exception ex){ - sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); - throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } - - return date; - } - - /** - * This is a covenient method for getting strongly typed objects out of the row. - * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). - * In fact, this method executes a simple cast to the desired type. - * - * @param pPos the position of the object to be resolved. - * @return a strongly typed String - * @throws TechnicalException - * @see #getValue(int) - */ - public String getStringValue(int pPos) throws TechnicalException { - try { - Object o = this.getValue(pPos); - String returnValue = null; - if (o instanceof SeShape){ - returnValue = this.getPosValue(pPos); - }else{ - returnValue = (String)o; - } - return returnValue; - } catch (ClassCastException e) { - throw new TechnicalException("Could not cast this value to the String Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } - - /** - * This is a covenient method for getting strongly typed objects out of the row. - * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). - * In fact, this method executes a simple cast to the desired type. - * - * @param pPos the position of the object to be resolved. - * @throws TechnicalException - * @see #getValue(int) - * * @return a strongly typed int - */ - public int getIntValue(int pPos) throws TechnicalException { - try { - return (Integer) getValue(pPos); - } catch (ClassCastException e) { - throw new TechnicalException("Could not cast this value to the Integer Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } - - /** - * This is a covenient method for getting strongly typed objects out of the row. - * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). - * In fact, this method executes a simple cast to the desired type. - * - * @param pPos the position of the object to be resolved. - * @throws TechnicalException - * @see #getValue(int) - * * @return a strongly typed Double - */ - public Double getDoubleValue(int pPos) throws TechnicalException { - try { - return (Double) getValue(pPos); - } catch (ClassCastException e) { - try{ - return new Double ((String)getValue(pPos)); - } - catch(Exception ex){ - sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); - throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } - } - - /** - * This is a covenient method for getting strongly typed objects out of the row. - * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). - * In fact, this method executes a simple cast to the desired type. - * - * @param pPos the position of the object to be resolved. - * @return a strongly typed Float - * @throws TechnicalException - * @see #getValue(int) - */ - public Float getFloatValue(int pPos) throws TechnicalException { - try { - return (Float) getValue(pPos); - } catch (ClassCastException e) { - throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } - /** - * This is a covenient method for getting strongly typed objects out of the row. - * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). - * In fact, this method executes a simple cast to the desired type. - * - * @param pPos the position of the object to be resolved. - * @return a strongly typed Float - * @throws TechnicalException - * @see #getValue(int) - */ - public String getPosValue(int pPos)throws TechnicalException{ - SeShape val; - ArrayList aList; - SDEPoint mPoint[]; - StringBuffer returnValue = new StringBuffer(); - synchronized (returnValue) { - try { - val = (SeShape) this.mObjects[pPos]; - aList = val.getAllPoints(0,false); - mPoint = (SDEPoint[])aList.get(0); - if (val.isPoint()){ - returnValue.append("POINT(") - .append(mPoint[0].getX()) - .append(" ") - .append(mPoint[0].getY()); - if (mPoint[0].is3D()){ - returnValue.append(" ") - .append(mPoint[0].getZ()); - } - returnValue.append(")"); - }else if (val.isLine() || val.isSimpleLine()){ - returnValue.append("LINESTRING("); - for (int i = 0; i< mPoint.length;i++){ - returnValue.append(mPoint[i].getX()) - .append(" ") - .append(mPoint[i].getY()); - if (mPoint[i].is3D()){ - returnValue.append(" ") - .append(mPoint[i].getZ()); - } - if (i < mPoint.length-1){ - returnValue.append(" , "); - } - } - returnValue.append(")"); - } else if (val.isPolygon()){ - int[] offsets = (int[])aList.get(1); - int offsetPos = 1; - int length = mPoint.length; - int nextOffset = length; - - if (val.isMultiPart()){ - returnValue.append("MULTIPOLYGON((("); - nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length; - }else{ - returnValue.append("POLYGON(("); - } - - for (int i = 0; i< length ;i++){ - SDEPoint p = mPoint[i]; - - if (i == nextOffset){ - returnValue.append(")),(("); - nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length; - } - returnValue.append(p.getX()) - .append(" ") - .append(p.getY()); - if (p.is3D()){ - returnValue.append(" ") - .append(p.getZ()); - } - if (i < length-1 && i < nextOffset -1 ){ - returnValue.append(" , "); - } - } - returnValue.append(")"); - if (val.isMultiPart()){ - returnValue.append(")"); - } - // TODO How are Rings supported -// for (int i =1 ; i < aList.size(); i++){ -// returnValue.append("("); -// mPoint = (SDEPoint[])aList.get(i); -// for (int j = 0; j < mPoint.length;j++){ -// returnValue.append(mPoint[j].getX()) -// .append(" ") -// .append(mPoint[j].getY()) -// .append(" ") -// .append(mPoint[i].getZ()); -// if (i < mPoint.length-1){ -// returnValue.append(" , "); -// } -// } -// returnValue.append(")"); -// } - returnValue.append(")"); - } - } catch (SeException e) { - throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } - return returnValue.toString(); - } -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +import com.esri.sde.sdk.client.SDEPoint; +import com.esri.sde.sdk.client.SeException; +import com.esri.sde.sdk.client.SeShape; + +import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; + +import de.intevation.gnv.geobackend.util.DateUtils; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; + +import org.apache.log4j.Logger; + +/** + * A Row represents a set of values. + * In a technical manner (e.g. database manner) a row contains all attributes of a single "hit". + * + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class Row { + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(Row.class); + + /** + * Data container. + */ + private Object[] mObjects; + + /** + * Constructor. + * @param pRowSize the number of attributes contained by this row. + */ + public Row(int pRowSize) { + mObjects = new Object[pRowSize]; + } + + /** + * Constructor. + * @param ArrayStr a line from CSV-File. + */ + public Row (String[] ArrayStr){ + this (ArrayStr.length); + int nLength = ArrayStr.length; + for (int i=0; i < nLength; i++){ + addObject(ArrayStr[i], i); + + } + + } + + /** + * Adds an attribute value to a specific position of this row. + * + * @param pObject the object to be stored. + * @param pPos the postion the value to be saved + */ + public void addObject(Object pObject, int pPos) { + mObjects[pPos] = pObject; + } + + /** + * Returns a Value out of the Row. + * + * @param pPos the position of the value to be returned. + * @return an Object! (not strongly typed) + * @throws TechnicalException + */ + public Object getValue(int pPos) throws TechnicalException { + if (pPos < mObjects.length) { + + Object o = mObjects[pPos]; + if (o instanceof SeShape){ + return this.getPosValue(pPos); + }else{ + return o; + } + } else { + throw new TechnicalException("Cannot access this field position. Size is: " + mObjects.length); + } + } + + /** + * This is a covenient method for getting strongly typed objects out of the row. + * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). + * In fact, this method executes a simple cast to the desired type. + * + * @param pPos the position of the object to be resolved. + * @return a strongly typed Date + * @throws TechnicalException + * @see #getValue(int) + */ + public Date getDateValue(int pPos) throws TechnicalException { + Date date = null; + try { + Calendar lCalendar = (Calendar) getValue(pPos); + date = lCalendar.getTime(); + } + catch (ClassCastException e) { + try{ + //SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos)); + + + } + catch (Exception ex){ + sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); + throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } + } + + return date; + } + + /** + * This is a covenient method for getting strongly typed objects out of the row. + * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). + * In fact, this method executes a simple cast to the desired type. + * + * @param pPos the position of the object to be resolved. + * @return a strongly typed String + * @throws TechnicalException + * @see #getValue(int) + */ + public String getStringValue(int pPos) throws TechnicalException { + try { + Object o = this.getValue(pPos); + String returnValue = null; + if (o instanceof SeShape){ + returnValue = this.getPosValue(pPos); + }else{ + returnValue = (String)o; + } + return returnValue; + } catch (ClassCastException e) { + throw new TechnicalException("Could not cast this value to the String Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } + } + + /** + * This is a covenient method for getting strongly typed objects out of the row. + * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). + * In fact, this method executes a simple cast to the desired type. + * + * @param pPos the position of the object to be resolved. + * @throws TechnicalException + * @see #getValue(int) + * * @return a strongly typed int + */ + public int getIntValue(int pPos) throws TechnicalException { + try { + return (Integer) getValue(pPos); + } catch (ClassCastException e) { + throw new TechnicalException("Could not cast this value to the Integer Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } + } + + /** + * This is a covenient method for getting strongly typed objects out of the row. + * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). + * In fact, this method executes a simple cast to the desired type. + * + * @param pPos the position of the object to be resolved. + * @throws TechnicalException + * @see #getValue(int) + * * @return a strongly typed Double + */ + public Double getDoubleValue(int pPos) throws TechnicalException { + try { + return (Double) getValue(pPos); + } catch (ClassCastException e) { + try{ + return new Double ((String)getValue(pPos)); + } + catch(Exception ex){ + sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); + throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } + } + } + + /** + * This is a covenient method for getting strongly typed objects out of the row. + * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). + * In fact, this method executes a simple cast to the desired type. + * + * @param pPos the position of the object to be resolved. + * @return a strongly typed Float + * @throws TechnicalException + * @see #getValue(int) + */ + public Float getFloatValue(int pPos) throws TechnicalException { + try { + return (Float) getValue(pPos); + } catch (ClassCastException e) { + throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } + } + /** + * This is a covenient method for getting strongly typed objects out of the row. + * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). + * In fact, this method executes a simple cast to the desired type. + * + * @param pPos the position of the object to be resolved. + * @return a strongly typed Float + * @throws TechnicalException + * @see #getValue(int) + */ + public String getPosValue(int pPos)throws TechnicalException{ + StringBuffer returnValue = new StringBuffer(); + synchronized (returnValue) { + try { + SeShape val = (SeShape) this.mObjects[pPos]; + if (val.isPoint()){ + // Cannot use val.asText() because the + // generated WKT is invalid. + ArrayList aList = val.getAllPoints(0,false); + SDEPoint[] mPoint = (SDEPoint[])aList.get(0); + returnValue.append("POINT(") + .append(mPoint[0].getX()) + .append(" ") + .append(mPoint[0].getY()); + if (mPoint[0].is3D()){ + returnValue.append(" ").append(mPoint[0].getZ()); + } + returnValue.append(")"); + }else if (val.isLine() || val.isSimpleLine()){ + // Cannot use val.asText() because the + // generated WKT is invalid. + ArrayList aList = val.getAllPoints(0,false); + SDEPoint[] mPoint = (SDEPoint[])aList.get(0); + boolean isMultiLineString = val.isMultiPart(); + int length = mPoint.length; + int nextOffset = length; + int[] offsets = (int[])aList.get(1); + int offsetPos = 1; + + if(isMultiLineString){ + returnValue.append("MULTILINESTRING(("); + nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length; + }else{ + returnValue.append("LINESTRING("); + } + + for (int i = 0; i< length;i++){ + + if (i == nextOffset){ + returnValue.append("),("); + nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length; + } + + returnValue.append(mPoint[i].getX()) + .append(" ") + .append(mPoint[i].getY()); + if (mPoint[i].is3D()){ + returnValue.append(" ").append(mPoint[i].getZ()); + } + if (i < length-1 && i < nextOffset -1){ + returnValue.append(" , "); + } + } + + if(isMultiLineString){ + returnValue.append("))"); + }else{ + returnValue.append(")"); + } + + } else{ + returnValue.append(val.asText(val.getTextSize())); + } + } catch (SeException e) { + throw new TechnicalException("Could not cast this value to the " + + "Float Type. Object is of value " + + "type: " + + getValue(pPos).getClass().getName()); + } + } + return returnValue.toString(); + } +}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,325 +0,0 @@ -/** - * Title: SdeQuery, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v 1.3 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.3 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import com.esri.sde.sdk.client.SeColumnDefinition; -import com.esri.sde.sdk.client.SeConnection; -import com.esri.sde.sdk.client.SeException; -import com.esri.sde.sdk.client.SeQuery; -import com.esri.sde.sdk.client.SeRow; -import com.esri.sde.sdk.client.SeShapeFilter; -import com.esri.sde.sdk.client.SeSqlConstruct; - -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; - -import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; - -import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; - -import java.sql.Connection; -import java.sql.Statement; - -import org.apache.log4j.Logger; -/** - * // todo: supply a general interface for Query-Objects (Query = read access to datasource implementation) - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 11:32:19 - */ -public class SDEQuery { - - /** - * Default Logging instance - */ - private static final Logger sLogger = Logger.getLogger(SDEQuery.class); - private static boolean sDebug = sLogger.isDebugEnabled(); - - - private ConnectionPool connectionPool = null; - private String connectionID = "N/N"; - - public SDEQuery(ConnectionPool connectionPool) { - if (sDebug) sLogger.debug("SDEQuery()"); - this.connectionPool = connectionPool; - } - - /** - * Execute a query against a sde datasource. - * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. - * - * @param pTables - * @param pCols - * @param pWhere the where-clause to be executed. - * @return a ResultSet - * @see SeSqlConstruct - * @see SeQuery - */ - public ResultSet executeQuery(String pTables[], String pCols[], String pWhere) throws TechnicalException { - sLogger.debug("executeQuery()"); - Connection con = null; - try { - con = getConnection(); -// SeSqlConstruct lSeSqlConstruct = new SeSqlConstruct(pTables, pWhere); -// SeQuery lSeQuery = new SeQuery(con, pCols, lSeSqlConstruct); -// long lStart = System.currentTimeMillis(); -// lSeQuery.prepareQuery(); - ResultSet lSet = null;//handleResultSet(lSeQuery); -// long lEnd = System.currentTimeMillis(); -// if (sDebug) -// sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString()); - return lSet; - } catch (TechnicalException e) { - sLogger.error(e.getMessage(), e); - throw e; - } catch (Exception e) { - sLogger.error(e.getMessage(), e); - throw new TechnicalException("Error during executeQuery", e); - } finally { - returnConnection(con); - } - - } - - /** - * Execute a query against a sde datasource. - * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. - * - * @param pSQLStatement the SQL-Statement to be executed. - * @return a ResultSet - * @see SeQuery - */ - public ResultSet executeQuery(String pSQLStatement) throws TechnicalException { - if (sDebug) sLogger.debug("executeQuery():\n" + pSQLStatement); - Connection con = null; - try { - con = getConnection(); - - - long lStart = System.currentTimeMillis(); - - Statement stmt = con.createStatement(); - java.sql.ResultSet rs = stmt.executeQuery(pSQLStatement); - - long lEnd = System.currentTimeMillis(); - if (sDebug) - sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString()); - return (ResultSet)rs; - } catch (TechnicalException e) { - sLogger.error(e.getMessage(), e); - throw e; - } catch (Exception e) { - sLogger.error(e.getMessage(), e); - throw new TechnicalException("Error during executeQuery", e); - } finally { - returnConnection(con); - } - - - } - -// /** -// * Execute a query against a sde datasource. -// * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. -// * -// * @param pSQLStatement the SQL-Statement to be executed. -// * @return File -// * @see SeQuery -// */ -// public TempFile executeQueryDiagram (String pSQLStatement) throws TechnicalException { -// if (sDebug) sLogger.debug("executeQueryDiagram():\n" + pSQLStatement); -// SeConnection con = null; -// TempFile lImageFile = null; -// try { -// con = getConnection(); -// -// SeQuery lSeQuery = new SeQuery(con); -// long lStart = System.currentTimeMillis(); -// lSeQuery.prepareSql(pSQLStatement); -// lSeQuery.execute(); -// -// //ResultSet lSet = handleResultSet(lSeQuery); -// lImageFile = handleRowToCSVFile(lSeQuery); -// -// -// long lEnd = System.currentTimeMillis(); -// if (sDebug) -// sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString()); -// -// } catch (TechnicalException e) { -// sLogger.error(e.getMessage(), e); -// throw e; -// } catch (SeException e) { -// sLogger.error(e.getMessage(), e); -// throw new TechnicalException("Error during executeQuery", e); -// } finally { -// returnConnection(con); -// } -// return lImageFile; -// -// } - - /** - * Execute a spatial query against a sde datasource. - * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. - * // todo: there is work needed to fully implement the wanted functionality. - * - * @param pLayername - * @param pSpatialColumnName - * @param pPoints - * @param pReturnFields - * @return a ResultSet - * @see SeShapeFilter - * @see SeQuery - */ - public ResultSet executeQuery(String pLayername, String pSpatialColumnName, double[][] pPoints, String[] pReturnFields) throws TechnicalException { - sLogger.debug("executeQuery()"); - Connection con = null; - try { - con = getConnection(); - return null; - - } catch (TechnicalException e) { - sLogger.error(e.getMessage(), e); - throw e; - } catch (Exception e) { - sLogger.error(e.getMessage(), e); - throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e); - } finally { - returnConnection(con); - } - } - /** - * Execute a spatial query against a sde datasource. - * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. - * // todo: there is work needed to fully implement the wanted functionality. - * - * @param pLayername - * @param pSpatialColumnName - * @param pPoints - * @param pReturnFields - * @return a ResultSet - * @see SeShapeFilter - * @see SeQuery - */ - public ResultSet executeQuery(String pLayername, String pSpatialColumnName, String pWhere, double[][] pPoints, String[] pReturnFields) throws TechnicalException { - sLogger.debug("executeQuery()"); - Connection con = null; - try { - con = getConnection(); - return null; - - } catch (TechnicalException e) { - sLogger.error(e.getMessage(), e); - throw e; - } catch (Exception e) { - sLogger.error(e.getMessage(), e); - throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e); - } finally { - returnConnection(con); - } - } - private Connection getConnection() throws TechnicalException { - Connection connection = connectionPool.getConnection(connectionID); - return connection; - } - - private void returnConnection(Connection connection) { - try { - this.connectionPool.closeConnection(connection); - } catch (ConnectionException e) { - sLogger.error(e,e); - } - } - - - private ResultSet handleResultSet(SeQuery pSeQuery) throws SeException { - sLogger.debug("handleResultSet()"); - SDEResultSet lSet = new SDEResultSet(); - SeRow row; - int lCount; - for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) { - // one time execution - if (lCount == 0) { - // analyze cols of result set - SeColumnDefinition[] lCols = row.getColumns(); - for (SeColumnDefinition lCol : lCols) { - lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));// notice: esri-types have been copied into colDefinition class! - } - } - short lNumCols = row.getNumColumns(); - Row lBackingRow = new Row(lNumCols); - for (int i = 0; i < lNumCols; i++) { - lBackingRow.addObject(row.getObject(i), i); - } - lSet.addRow(lBackingRow); - } - pSeQuery.close(); - return lSet; - } - -// private TempFile handleRowToCSVFile(SeQuery pSeQuery) throws SeException { -// sLogger.debug("handleRowToTempFile()"); -// TempFile lImageFile = TemporaryFileDirectory.getInstance().createFile(".csv"); -// sLogger.debug("handleRowToTempFile() erstellen " + lImageFile.getFile().getName()); -// CSVWriter writer = null; -// ColDefinition[] lColDefinitions = null; -// -// SeRow row; -// int lCount; -// try { -// writer = new CSVWriter(new FileWriter(lImageFile.getFile()), ';'); -// for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) { -// // one time execution -// if (lCount == 0) { -// lColDefinitions = new ColDefinition[row.getNumColumns()]; -// // analyze cols of result set -// SeColumnDefinition[] lCols = row.getColumns(); -// int j = 0; -// for (SeColumnDefinition lCol : lCols) { -// lColDefinitions[j] = new ColDefinition(lCol.getName(), lCol.getType()); -// j = j + 1; -// } -// } -// short lNumCols = row.getNumColumns(); -// Row lBackingRow = new Row(lNumCols); -// for (int i = 0; i < lNumCols; i++) { -// lBackingRow.addObject(row.getObject(i), i); -// } -// -// writer.writeRow(lBackingRow,lColDefinitions, false); -// } -// } catch (IOException e) { -// sLogger.error(e.getMessage(), e); -// } catch (TechnicalException e) { -// sLogger.error(e.getMessage(), e); -// } -// finally { -// pSeQuery.close(); -// try{ -// writer.close(); -// } -// catch (Exception e){ -// sLogger.error(e.getMessage(), e); -// } -// } -// -// return lImageFile; -// } - -}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,1351 +1,1516 @@ -/** - * Title: SDEResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; - -/** - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 11:01:27 - */ -public class SDEResultSet extends ResultSet { - - /** - * Default Logging instance - */ - private static Logger log = Logger.getLogger(SDEResultSet.class); - - private List<Row> mRows = Collections.synchronizedList(new ArrayList<Row>()); - private List<ColDefinition> mCols = Collections.synchronizedList(new ArrayList<ColDefinition>()); - - private Row currentRow = null; - private int cursor = 0; - - public SDEResultSet() { - } - - public int getCount() { - return mRows.size(); - } - - public int getNumberOfColumns() { - return mCols.size(); - } - - public ColDefinition[] getColumnDefinitions() { - ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()]; - return mCols.toArray(lColDefinitions); - } - - public Row[] getResults() { - Row[] lRows = new Row[mRows.size()]; - return mRows.toArray(lRows); - } - - public void addRow(Row pRow) { - mRows.add(pRow); - } - - public void addCol(ColDefinition pColDefinition) { - mCols.add(pColDefinition); - } - - /** - * @see java.sql.ResultSet#absolute(int) - */ - public boolean absolute(int row) throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#afterLast() - */ - public void afterLast() throws SQLException { - } - - /** - * @see java.sql.ResultSet#beforeFirst() - */ - public void beforeFirst() throws SQLException { - } - - /** - * @see java.sql.ResultSet#cancelRowUpdates() - */ - public void cancelRowUpdates() throws SQLException { - } - - /** - * @see java.sql.ResultSet#clearWarnings() - */ - public void clearWarnings() throws SQLException { - } - - /** - * @see java.sql.ResultSet#close() - */ - public void close() throws SQLException { - } - - /** - * @see java.sql.ResultSet#deleteRow() - */ - public void deleteRow() throws SQLException { - } - - /** - * @see java.sql.ResultSet#findColumn(java.lang.String) - */ - public int findColumn(String columnName) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#first() - */ - public boolean first() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#getArray(int) - */ - public Array getArray(int i) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getArray(java.lang.String) - */ - public Array getArray(String colName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getAsciiStream(int) - */ - public InputStream getAsciiStream(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getAsciiStream(java.lang.String) - */ - public InputStream getAsciiStream(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBigDecimal(int) - */ - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBigDecimal(java.lang.String) - */ - public BigDecimal getBigDecimal(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBigDecimal(int, int) - */ - public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int) - */ - public BigDecimal getBigDecimal(String columnName, int scale) - throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBinaryStream(int) - */ - public InputStream getBinaryStream(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBinaryStream(java.lang.String) - */ - public InputStream getBinaryStream(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBlob(int) - */ - public Blob getBlob(int i) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBlob(java.lang.String) - */ - public Blob getBlob(String colName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBoolean(int) - */ - public boolean getBoolean(int columnIndex) throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#getBoolean(java.lang.String) - */ - public boolean getBoolean(String columnName) throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#getByte(int) - */ - public byte getByte(int columnIndex) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getByte(java.lang.String) - */ - public byte getByte(String columnName) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getBytes(int) - */ - public byte[] getBytes(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getBytes(java.lang.String) - */ - public byte[] getBytes(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getCharacterStream(int) - */ - public Reader getCharacterStream(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getCharacterStream(java.lang.String) - */ - public Reader getCharacterStream(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getClob(int) - */ - public Clob getClob(int i) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getClob(java.lang.String) - */ - public Clob getClob(String colName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getConcurrency() - */ - public int getConcurrency() throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getCursorName() - */ - public String getCursorName() throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getDate(int) - */ - public Date getDate(int columnIndex) throws SQLException { - try { - return new java.sql.Date(this.currentRow.getDateValue(columnIndex-1).getTime()); - } catch (TechnicalException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.ResultSet#getDate(java.lang.String) - */ - public Date getDate(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getDate(columnIndex); - } - - /** - * @see java.sql.ResultSet#getDate(int, java.util.Calendar) - */ - public Date getDate(int columnIndex, Calendar cal) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar) - */ - public Date getDate(String columnName, Calendar cal) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getDouble(int) - */ - public double getDouble(int columnIndex) throws SQLException { - try { - return this.currentRow.getDoubleValue(columnIndex-1); - } catch (TechnicalException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.ResultSet#getDouble(java.lang.String) - */ - public double getDouble(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getDouble(columnIndex); - } - - /** - * @see java.sql.ResultSet#getFetchDirection() - */ - public int getFetchDirection() throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getFetchSize() - */ - public int getFetchSize() throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getFloat(int) - */ - public float getFloat(int columnIndex) throws SQLException { - try { - return this.currentRow.getFloatValue(columnIndex-1); - } catch (TechnicalException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.ResultSet#getFloat(java.lang.String) - */ - public float getFloat(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getFloat(columnIndex); - } - - /** - * @see java.sql.ResultSet#getInt(int) - */ - public int getInt(int columnIndex) throws SQLException { - - try { - return this.currentRow.getIntValue(columnIndex-1); - } catch (TechnicalException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.ResultSet#getInt(java.lang.String) - */ - public int getInt(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getInt(columnIndex); - } - - /** - * @see java.sql.ResultSet#getLong(int) - */ - public long getLong(int columnIndex) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getLong(java.lang.String) - */ - public long getLong(String columnName) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getMetaData() - */ - public ResultSetMetaData getMetaData() throws SQLException { - log.debug("SDEREsultSet.getMetaData"); - return new ArcSDEResultSetMetaData(this.mCols); - } - - /** - * @see java.sql.ResultSet#getObject(int) - */ - public Object getObject(int columnIndex) throws SQLException { - try { - return this.currentRow.getValue(columnIndex-1); - } catch (TechnicalException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.ResultSet#getObject(java.lang.String) - */ - public Object getObject(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getObject(columnIndex); - } - - /** - * @see java.sql.ResultSet#getObject(int, java.util.Map) - */ - public Object getObject(int i, Map<String, Class<?>> map) - throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map) - */ - public Object getObject(String colName, Map<String, Class<?>> map) - throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getRef(int) - */ - public Ref getRef(int i) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getRef(java.lang.String) - */ - public Ref getRef(String colName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getRow() - */ - public int getRow() throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getShort(int) - */ - public short getShort(int columnIndex) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getShort(java.lang.String) - */ - public short getShort(String columnName) throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getStatement() - */ - public Statement getStatement() throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getString(int) - */ - public String getString(int columnIndex) throws SQLException { - - try { - return this.currentRow.getStringValue(columnIndex-1); - } catch (TechnicalException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.ResultSet#getString(java.lang.String) - */ - public String getString(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getString(columnIndex); - } - - /** - * @see java.sql.ResultSet#getTime(int) - */ - public Time getTime(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTime(java.lang.String) - */ - public Time getTime(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTime(int, java.util.Calendar) - */ - public Time getTime(int columnIndex, Calendar cal) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar) - */ - public Time getTime(String columnName, Calendar cal) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTimestamp(int) - */ - public Timestamp getTimestamp(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTimestamp(java.lang.String) - */ - public Timestamp getTimestamp(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar) - */ - public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getTimestamp(java.lang.String, - * java.util.Calendar) - */ - public Timestamp getTimestamp(String columnName, Calendar cal) - throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getType() - */ - public int getType() throws SQLException { - - return 0; - } - - /** - * @see java.sql.ResultSet#getURL(int) - */ - public URL getURL(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getURL(java.lang.String) - */ - public URL getURL(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getUnicodeStream(int) - */ - public InputStream getUnicodeStream(int columnIndex) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getUnicodeStream(java.lang.String) - */ - public InputStream getUnicodeStream(String columnName) throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#getWarnings() - */ - public SQLWarning getWarnings() throws SQLException { - - return null; - } - - /** - * @see java.sql.ResultSet#insertRow() - */ - public void insertRow() throws SQLException { - } - - /** - * @see java.sql.ResultSet#isAfterLast() - */ - public boolean isAfterLast() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#isBeforeFirst() - */ - public boolean isBeforeFirst() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#isFirst() - */ - public boolean isFirst() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#isLast() - */ - public boolean isLast() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#last() - */ - public boolean last() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#moveToCurrentRow() - */ - public void moveToCurrentRow() throws SQLException { - } - - /** - * @see java.sql.ResultSet#moveToInsertRow() - */ - public void moveToInsertRow() throws SQLException { - } - - /** - * @see java.sql.ResultSet#next() - */ - public boolean next() throws SQLException { - - boolean next = this.mRows.size() > this.cursor; - if (next){ - //log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert."); - this.currentRow = this.mRows.get(this.cursor); - this.cursor++; - }else{ - this.currentRow = null; - } - return next; - } - - /** - * @see java.sql.ResultSet#previous() - */ - public boolean previous() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#refreshRow() - */ - public void refreshRow() throws SQLException { - } - - /** - * @see java.sql.ResultSet#relative(int) - */ - public boolean relative(int rows) throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#rowDeleted() - */ - public boolean rowDeleted() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#rowInserted() - */ - public boolean rowInserted() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#rowUpdated() - */ - public boolean rowUpdated() throws SQLException { - - return false; - } - - /** - * @see java.sql.ResultSet#setFetchDirection(int) - */ - public void setFetchDirection(int direction) throws SQLException { - } - - /** - * @see java.sql.ResultSet#setFetchSize(int) - */ - public void setFetchSize(int rows) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateArray(int, java.sql.Array) - */ - public void updateArray(int columnIndex, Array x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array) - */ - public void updateArray(String columnName, Array x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int) - */ - public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, - * java.io.InputStream, int) - */ - public void updateAsciiStream(String columnName, InputStream x, int length) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal) - */ - public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBigDecimal(java.lang.String, - * java.math.BigDecimal) - */ - public void updateBigDecimal(String columnName, BigDecimal x) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int) - */ - public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, - * java.io.InputStream, int) - */ - public void updateBinaryStream(String columnName, InputStream x, int length) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob) - */ - public void updateBlob(int columnIndex, Blob x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob) - */ - public void updateBlob(String columnName, Blob x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBoolean(int, boolean) - */ - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean) - */ - public void updateBoolean(String columnName, boolean x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateByte(int, byte) - */ - public void updateByte(int columnIndex, byte x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateByte(java.lang.String, byte) - */ - public void updateByte(String columnName, byte x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBytes(int, byte[]) - */ - public void updateBytes(int columnIndex, byte[] x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[]) - */ - public void updateBytes(String columnName, byte[] x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int) - */ - public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, - * java.io.Reader, int) - */ - public void updateCharacterStream(String columnName, Reader reader, - int length) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateClob(int, java.sql.Clob) - */ - public void updateClob(int columnIndex, Clob x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob) - */ - public void updateClob(String columnName, Clob x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateDate(int, java.sql.Date) - */ - public void updateDate(int columnIndex, Date x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date) - */ - public void updateDate(String columnName, Date x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateDouble(int, double) - */ - public void updateDouble(int columnIndex, double x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateDouble(java.lang.String, double) - */ - public void updateDouble(String columnName, double x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateFloat(int, float) - */ - public void updateFloat(int columnIndex, float x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateFloat(java.lang.String, float) - */ - public void updateFloat(String columnName, float x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateInt(int, int) - */ - public void updateInt(int columnIndex, int x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateInt(java.lang.String, int) - */ - public void updateInt(String columnName, int x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateLong(int, long) - */ - public void updateLong(int columnIndex, long x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateLong(java.lang.String, long) - */ - public void updateLong(String columnName, long x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateNull(int) - */ - public void updateNull(int columnIndex) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateNull(java.lang.String) - */ - public void updateNull(String columnName) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateObject(int, java.lang.Object) - */ - public void updateObject(int columnIndex, Object x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object) - */ - public void updateObject(String columnName, Object x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int) - */ - public void updateObject(int columnIndex, Object x, int scale) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object, - * int) - */ - public void updateObject(String columnName, Object x, int scale) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateRef(int, java.sql.Ref) - */ - public void updateRef(int columnIndex, Ref x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref) - */ - public void updateRef(String columnName, Ref x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateRow() - */ - public void updateRow() throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateShort(int, short) - */ - public void updateShort(int columnIndex, short x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateShort(java.lang.String, short) - */ - public void updateShort(String columnName, short x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateString(int, java.lang.String) - */ - public void updateString(int columnIndex, String x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String) - */ - public void updateString(String columnName, String x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateTime(int, java.sql.Time) - */ - public void updateTime(int columnIndex, Time x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time) - */ - public void updateTime(String columnName, Time x) throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp) - */ - public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#updateTimestamp(java.lang.String, - * java.sql.Timestamp) - */ - public void updateTimestamp(String columnName, Timestamp x) - throws SQLException { - } - - /** - * @see java.sql.ResultSet#wasNull() - */ - public boolean wasNull() throws SQLException { - - return false; - } - - - private int getColumnIndex(String columnName) throws SQLException{ - for (int i = 0 ; i < this.mCols.size();i++){ - if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){ - return i +1; // PLUS 1 da SQL-Cursor 1 basiert sind - } - } - throw new SQLException("Column "+columnName+" does not exist in ResulSet"); - } - - public int getHoldability() throws SQLException { - return 0; - } - - public Reader getNCharacterStream(int arg0) throws SQLException { - return null; - } - - public Reader getNCharacterStream(String arg0) throws SQLException { - return null; - } - - public NClob getNClob(int arg0) throws SQLException { - return null; - } - - public NClob getNClob(String arg0) throws SQLException { - return null; - } - - public String getNString(int arg0) throws SQLException { - return null; - } - - public String getNString(String arg0) throws SQLException { - return null; - } - - public RowId getRowId(int arg0) throws SQLException { - - return null; - } - - public RowId getRowId(String arg0) throws SQLException { - - return null; - } - - public SQLXML getSQLXML(int arg0) throws SQLException { - - return null; - } - - public SQLXML getSQLXML(String arg0) throws SQLException { - - return null; - } - - public boolean isClosed() throws SQLException { - - return false; - } - - public void updateAsciiStream(int arg0, InputStream arg1) - throws SQLException { - } - - public void updateAsciiStream(String arg0, InputStream arg1) - throws SQLException { - } - - public void updateAsciiStream(int arg0, InputStream arg1, long arg2) - throws SQLException { - } - - public void updateAsciiStream(String arg0, InputStream arg1, long arg2) - throws SQLException { - } - - public void updateBinaryStream(int arg0, InputStream arg1) - throws SQLException { - } - - public void updateBinaryStream(String arg0, InputStream arg1) - throws SQLException { - } - - public void updateBinaryStream(int arg0, InputStream arg1, long arg2) - throws SQLException { - } - - public void updateBinaryStream(String arg0, InputStream arg1, long arg2) - throws SQLException { - } - - public void updateBlob(int arg0, InputStream arg1) throws SQLException { - } - - public void updateBlob(String arg0, InputStream arg1) throws SQLException { - } - - public void updateBlob(int arg0, InputStream arg1, long arg2) - throws SQLException { - } - - public void updateBlob(String arg0, InputStream arg1, long arg2) - throws SQLException { - } - - public void updateCharacterStream(int arg0, Reader arg1) - throws SQLException { - } - - public void updateCharacterStream(String arg0, Reader arg1) - throws SQLException { - } - - public void updateCharacterStream(int arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateCharacterStream(String arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateClob(int arg0, Reader arg1) throws SQLException { - } - - public void updateClob(String arg0, Reader arg1) throws SQLException { - } - - public void updateClob(int arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateClob(String arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateNCharacterStream(int arg0, Reader arg1) - throws SQLException { - } - - public void updateNCharacterStream(String arg0, Reader arg1) - throws SQLException { - } - - public void updateNCharacterStream(int arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateNCharacterStream(String arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateNClob(int arg0, NClob arg1) throws SQLException { - } - - public void updateNClob(String arg0, NClob arg1) throws SQLException { - } - - public void updateNClob(int arg0, Reader arg1) throws SQLException { - } - - public void updateNClob(String arg0, Reader arg1) throws SQLException { - } - - public void updateNClob(int arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateNClob(String arg0, Reader arg1, long arg2) - throws SQLException { - } - - public void updateNString(int arg0, String arg1) throws SQLException { - } - - public void updateNString(String arg0, String arg1) throws SQLException { - } - - public void updateRowId(int arg0, RowId arg1) throws SQLException { - } - - public void updateRowId(String arg0, RowId arg1) throws SQLException { - } - - public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException { - } - - public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException { - } - - public boolean isWrapperFor(Class<?> arg0) throws SQLException { - - return false; - } - - public <T> T unwrap(Class<T> arg0) throws SQLException { - - return null; - } - -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; + +import java.io.InputStream; +import java.io.Reader; + +import java.math.BigDecimal; + +import java.net.URL; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +/** + * SDEResultSet is an Implementation of the Interface @see java.sql.resultSet + * It is an Wrapper between the resultsets whcih are produced using the ArcSDE + * and the Java-Interface for the Representation of ResultSets. + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class SDEResultSet extends ResultSet { + + /** + * Default Logging instance + */ + private static Logger log = Logger.getLogger(SDEResultSet.class); + + private List<Row> mRows = Collections.synchronizedList(new ArrayList<Row>()); + private List<ColDefinition> mCols = Collections.synchronizedList(new ArrayList<ColDefinition>()); + + private Row currentRow = null; + private int cursor = 0; + + /** + * Constructor + */ + public SDEResultSet() { + } + + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getCount() + */ + public int getCount() { + return mRows.size(); + } + + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getNumberOfColumns() + */ + public int getNumberOfColumns() { + return mCols.size(); + } + + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getColumnDefinitions() + */ + public ColDefinition[] getColumnDefinitions() { + ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()]; + return mCols.toArray(lColDefinitions); + } + + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getResults() + */ + public Row[] getResults() { + Row[] lRows = new Row[mRows.size()]; + return mRows.toArray(lRows); + } + + /** + * Add an Row to the Resultset + * @param pRow The Row that should be added. + */ + public void addRow(Row pRow) { + mRows.add(pRow); + } + + /** + * Adds a Column to the Resultset. + * @param pColDefinition The Definition of the Column + */ + public void addCol(ColDefinition pColDefinition) { + mCols.add(pColDefinition); + } + + /** + * @see java.sql.ResultSet#absolute(int) + */ + public boolean absolute(int row) throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#afterLast() + */ + public void afterLast() throws SQLException { + } + + /** + * @see java.sql.ResultSet#beforeFirst() + */ + public void beforeFirst() throws SQLException { + } + + /** + * @see java.sql.ResultSet#cancelRowUpdates() + */ + public void cancelRowUpdates() throws SQLException { + } + + /** + * @see java.sql.ResultSet#clearWarnings() + */ + public void clearWarnings() throws SQLException { + } + + /** + * @see java.sql.ResultSet#close() + */ + public void close() throws SQLException { + } + + /** + * @see java.sql.ResultSet#deleteRow() + */ + public void deleteRow() throws SQLException { + } + + /** + * @see java.sql.ResultSet#findColumn(java.lang.String) + */ + public int findColumn(String columnName) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#first() + */ + public boolean first() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#getArray(int) + */ + public Array getArray(int i) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getArray(java.lang.String) + */ + public Array getArray(String colName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getAsciiStream(int) + */ + public InputStream getAsciiStream(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getAsciiStream(java.lang.String) + */ + public InputStream getAsciiStream(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBigDecimal(int) + */ + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBigDecimal(java.lang.String) + */ + public BigDecimal getBigDecimal(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBigDecimal(int, int) + */ + public BigDecimal getBigDecimal(int columnIndex, int scale) + throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int) + */ + public BigDecimal getBigDecimal(String columnName, int scale) + throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBinaryStream(int) + */ + public InputStream getBinaryStream(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBinaryStream(java.lang.String) + */ + public InputStream getBinaryStream(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBlob(int) + */ + public Blob getBlob(int i) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBlob(java.lang.String) + */ + public Blob getBlob(String colName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBoolean(int) + */ + public boolean getBoolean(int columnIndex) throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#getBoolean(java.lang.String) + */ + public boolean getBoolean(String columnName) throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#getByte(int) + */ + public byte getByte(int columnIndex) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getByte(java.lang.String) + */ + public byte getByte(String columnName) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getBytes(int) + */ + public byte[] getBytes(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getBytes(java.lang.String) + */ + public byte[] getBytes(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getCharacterStream(int) + */ + public Reader getCharacterStream(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getCharacterStream(java.lang.String) + */ + public Reader getCharacterStream(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getClob(int) + */ + public Clob getClob(int i) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getClob(java.lang.String) + */ + public Clob getClob(String colName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getConcurrency() + */ + public int getConcurrency() throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getCursorName() + */ + public String getCursorName() throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getDate(int) + */ + public Date getDate(int columnIndex) throws SQLException { + try { + return new java.sql.Date(this.currentRow.getDateValue(columnIndex-1).getTime()); + } catch (TechnicalException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.ResultSet#getDate(java.lang.String) + */ + public Date getDate(String columnName) throws SQLException { + int columnIndex = this.getColumnIndex(columnName); + return this.getDate(columnIndex); + } + + /** + * @see java.sql.ResultSet#getDate(int, java.util.Calendar) + */ + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar) + */ + public Date getDate(String columnName, Calendar cal) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getDouble(int) + */ + public double getDouble(int columnIndex) throws SQLException { + try { + return this.currentRow.getDoubleValue(columnIndex-1); + } catch (TechnicalException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.ResultSet#getDouble(java.lang.String) + */ + public double getDouble(String columnName) throws SQLException { + int columnIndex = this.getColumnIndex(columnName); + return this.getDouble(columnIndex); + } + + /** + * @see java.sql.ResultSet#getFetchDirection() + */ + public int getFetchDirection() throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getFetchSize() + */ + public int getFetchSize() throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getFloat(int) + */ + public float getFloat(int columnIndex) throws SQLException { + try { + return this.currentRow.getFloatValue(columnIndex-1); + } catch (TechnicalException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.ResultSet#getFloat(java.lang.String) + */ + public float getFloat(String columnName) throws SQLException { + int columnIndex = this.getColumnIndex(columnName); + return this.getFloat(columnIndex); + } + + /** + * @see java.sql.ResultSet#getInt(int) + */ + public int getInt(int columnIndex) throws SQLException { + + try { + return this.currentRow.getIntValue(columnIndex-1); + } catch (TechnicalException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.ResultSet#getInt(java.lang.String) + */ + public int getInt(String columnName) throws SQLException { + int columnIndex = this.getColumnIndex(columnName); + return this.getInt(columnIndex); + } + + /** + * @see java.sql.ResultSet#getLong(int) + */ + public long getLong(int columnIndex) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getLong(java.lang.String) + */ + public long getLong(String columnName) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getMetaData() + */ + public ResultSetMetaData getMetaData() throws SQLException { + log.debug("SDEREsultSet.getMetaData"); + return new ArcSDEResultSetMetaData(this.mCols); + } + + /** + * @see java.sql.ResultSet#getObject(int) + */ + public Object getObject(int columnIndex) throws SQLException { + try { + return this.currentRow.getValue(columnIndex-1); + } catch (TechnicalException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.ResultSet#getObject(java.lang.String) + */ + public Object getObject(String columnName) throws SQLException { + int columnIndex = this.getColumnIndex(columnName); + return this.getObject(columnIndex); + } + + /** + * @see java.sql.ResultSet#getObject(int, java.util.Map) + */ + public Object getObject(int i, Map<String, Class<?>> map) + throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map) + */ + public Object getObject(String colName, Map<String, Class<?>> map) + throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getRef(int) + */ + public Ref getRef(int i) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getRef(java.lang.String) + */ + public Ref getRef(String colName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getRow() + */ + public int getRow() throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getShort(int) + */ + public short getShort(int columnIndex) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getShort(java.lang.String) + */ + public short getShort(String columnName) throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getStatement() + */ + public Statement getStatement() throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getString(int) + */ + public String getString(int columnIndex) throws SQLException { + + try { + return this.currentRow.getStringValue(columnIndex-1); + } catch (TechnicalException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.ResultSet#getString(java.lang.String) + */ + public String getString(String columnName) throws SQLException { + int columnIndex = this.getColumnIndex(columnName); + return this.getString(columnIndex); + } + + /** + * @see java.sql.ResultSet#getTime(int) + */ + public Time getTime(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTime(java.lang.String) + */ + public Time getTime(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTime(int, java.util.Calendar) + */ + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar) + */ + public Time getTime(String columnName, Calendar cal) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTimestamp(int) + */ + public Timestamp getTimestamp(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTimestamp(java.lang.String) + */ + public Timestamp getTimestamp(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar) + */ + public Timestamp getTimestamp(int columnIndex, Calendar cal) + throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getTimestamp(java.lang.String, + * java.util.Calendar) + */ + public Timestamp getTimestamp(String columnName, Calendar cal) + throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getType() + */ + public int getType() throws SQLException { + + return 0; + } + + /** + * @see java.sql.ResultSet#getURL(int) + */ + public URL getURL(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getURL(java.lang.String) + */ + public URL getURL(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getUnicodeStream(int) + */ + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getUnicodeStream(java.lang.String) + */ + public InputStream getUnicodeStream(String columnName) throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#getWarnings() + */ + public SQLWarning getWarnings() throws SQLException { + + return null; + } + + /** + * @see java.sql.ResultSet#insertRow() + */ + public void insertRow() throws SQLException { + } + + /** + * @see java.sql.ResultSet#isAfterLast() + */ + public boolean isAfterLast() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#isBeforeFirst() + */ + public boolean isBeforeFirst() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#isFirst() + */ + public boolean isFirst() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#isLast() + */ + public boolean isLast() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#last() + */ + public boolean last() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#moveToCurrentRow() + */ + public void moveToCurrentRow() throws SQLException { + } + + /** + * @see java.sql.ResultSet#moveToInsertRow() + */ + public void moveToInsertRow() throws SQLException { + } + + /** + * @see java.sql.ResultSet#next() + */ + public boolean next() throws SQLException { + + boolean next = this.mRows.size() > this.cursor; + if (next){ + //log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert."); + this.currentRow = this.mRows.get(this.cursor); + this.cursor++; + }else{ + this.currentRow = null; + } + return next; + } + + /** + * @see java.sql.ResultSet#previous() + */ + public boolean previous() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#refreshRow() + */ + public void refreshRow() throws SQLException { + } + + /** + * @see java.sql.ResultSet#relative(int) + */ + public boolean relative(int rows) throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#rowDeleted() + */ + public boolean rowDeleted() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#rowInserted() + */ + public boolean rowInserted() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#rowUpdated() + */ + public boolean rowUpdated() throws SQLException { + + return false; + } + + /** + * @see java.sql.ResultSet#setFetchDirection(int) + */ + public void setFetchDirection(int direction) throws SQLException { + } + + /** + * @see java.sql.ResultSet#setFetchSize(int) + */ + public void setFetchSize(int rows) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateArray(int, java.sql.Array) + */ + public void updateArray(int columnIndex, Array x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array) + */ + public void updateArray(String columnName, Array x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int) + */ + public void updateAsciiStream(int columnIndex, InputStream x, int length) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, + * java.io.InputStream, int) + */ + public void updateAsciiStream(String columnName, InputStream x, int length) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal) + */ + public void updateBigDecimal(int columnIndex, BigDecimal x) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBigDecimal(java.lang.String, + * java.math.BigDecimal) + */ + public void updateBigDecimal(String columnName, BigDecimal x) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int) + */ + public void updateBinaryStream(int columnIndex, InputStream x, int length) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, + * java.io.InputStream, int) + */ + public void updateBinaryStream(String columnName, InputStream x, int length) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob) + */ + public void updateBlob(int columnIndex, Blob x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob) + */ + public void updateBlob(String columnName, Blob x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBoolean(int, boolean) + */ + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean) + */ + public void updateBoolean(String columnName, boolean x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateByte(int, byte) + */ + public void updateByte(int columnIndex, byte x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateByte(java.lang.String, byte) + */ + public void updateByte(String columnName, byte x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBytes(int, byte[]) + */ + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[]) + */ + public void updateBytes(String columnName, byte[] x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int) + */ + public void updateCharacterStream(int columnIndex, Reader x, int length) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, + * java.io.Reader, int) + */ + public void updateCharacterStream(String columnName, Reader reader, + int length) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateClob(int, java.sql.Clob) + */ + public void updateClob(int columnIndex, Clob x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob) + */ + public void updateClob(String columnName, Clob x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateDate(int, java.sql.Date) + */ + public void updateDate(int columnIndex, Date x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date) + */ + public void updateDate(String columnName, Date x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateDouble(int, double) + */ + public void updateDouble(int columnIndex, double x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateDouble(java.lang.String, double) + */ + public void updateDouble(String columnName, double x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateFloat(int, float) + */ + public void updateFloat(int columnIndex, float x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateFloat(java.lang.String, float) + */ + public void updateFloat(String columnName, float x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateInt(int, int) + */ + public void updateInt(int columnIndex, int x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateInt(java.lang.String, int) + */ + public void updateInt(String columnName, int x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateLong(int, long) + */ + public void updateLong(int columnIndex, long x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateLong(java.lang.String, long) + */ + public void updateLong(String columnName, long x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNull(int) + */ + public void updateNull(int columnIndex) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNull(java.lang.String) + */ + public void updateNull(String columnName) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateObject(int, java.lang.Object) + */ + public void updateObject(int columnIndex, Object x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object) + */ + public void updateObject(String columnName, Object x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int) + */ + public void updateObject(int columnIndex, Object x, int scale) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object, + * int) + */ + public void updateObject(String columnName, Object x, int scale) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateRef(int, java.sql.Ref) + */ + public void updateRef(int columnIndex, Ref x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref) + */ + public void updateRef(String columnName, Ref x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateRow() + */ + public void updateRow() throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateShort(int, short) + */ + public void updateShort(int columnIndex, short x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateShort(java.lang.String, short) + */ + public void updateShort(String columnName, short x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateString(int, java.lang.String) + */ + public void updateString(int columnIndex, String x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String) + */ + public void updateString(String columnName, String x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateTime(int, java.sql.Time) + */ + public void updateTime(int columnIndex, Time x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time) + */ + public void updateTime(String columnName, Time x) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp) + */ + public void updateTimestamp(int columnIndex, Timestamp x) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateTimestamp(java.lang.String, + * java.sql.Timestamp) + */ + public void updateTimestamp(String columnName, Timestamp x) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#wasNull() + */ + public boolean wasNull() throws SQLException { + + return false; + } + + /** + * TODO: DOCUMENT ME + * @param columnName + * @return + * @throws SQLException + */ + private int getColumnIndex(String columnName) throws SQLException{ + for (int i = 0 ; i < this.mCols.size();i++){ + if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){ + return i +1; // PLUS 1 da SQL-Cursor 1 basiert sind + } + } + throw new SQLException("Column "+columnName+" does not exist in ResulSet"); + } + + /** + * @see java.sql.ResultSet#getHoldability() + */ + public int getHoldability() throws SQLException { + return 0; + } + + /** + * @see java.sql.ResultSet#getNCharacterStream(int) + */ + public Reader getNCharacterStream(int arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getNCharacterStream(java.lang.String) + */ + public Reader getNCharacterStream(String arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getNClob(int) + */ + public NClob getNClob(int arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getNClob(java.lang.String) + */ + public NClob getNClob(String arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getNString(int) + */ + public String getNString(int arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getNString(java.lang.String) + */ + public String getNString(String arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getRowId(int) + */ + public RowId getRowId(int arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getRowId(java.lang.String) + */ + public RowId getRowId(String arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getSQLXML(int) + */ + public SQLXML getSQLXML(int arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#getSQLXML(java.lang.String) + */ + public SQLXML getSQLXML(String arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#isClosed() + */ + public boolean isClosed() throws SQLException { + return false; + } + + /** + * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream) + */ + public void updateAsciiStream(int arg0, InputStream arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream) + */ + public void updateAsciiStream(String arg0, InputStream arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long) + */ + public void updateAsciiStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long) + */ + public void updateAsciiStream(String arg0, InputStream arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream) + */ + public void updateBinaryStream(int arg0, InputStream arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream) + */ + public void updateBinaryStream(String arg0, InputStream arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long) + */ + public void updateBinaryStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long) + */ + public void updateBinaryStream(String arg0, InputStream arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream) + */ + public void updateBlob(int arg0, InputStream arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream) + */ + public void updateBlob(String arg0, InputStream arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long) + */ + public void updateBlob(int arg0, InputStream arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long) + */ + public void updateBlob(String arg0, InputStream arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader) + */ + public void updateCharacterStream(int arg0, Reader arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader) + */ + public void updateCharacterStream(String arg0, Reader arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long) + */ + public void updateCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long) + */ + public void updateCharacterStream(String arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateClob(int, java.io.Reader) + */ + public void updateClob(int arg0, Reader arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader) + */ + public void updateClob(String arg0, Reader arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long) + */ + public void updateClob(int arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long) + */ + public void updateClob(String arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader) + */ + public void updateNCharacterStream(int arg0, Reader arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader) + */ + public void updateNCharacterStream(String arg0, Reader arg1) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long) + */ + public void updateNCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long) + */ + public void updateNCharacterStream(String arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNClob(int, java.sql.NClob) + */ + public void updateNClob(int arg0, NClob arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob) + */ + public void updateNClob(String arg0, NClob arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNClob(int, java.io.Reader) + */ + public void updateNClob(int arg0, Reader arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader) + */ + public void updateNClob(String arg0, Reader arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long) + */ + public void updateNClob(int arg0, Reader arg1, long arg2) + throws SQLException { + } + + public void updateNClob(String arg0, Reader arg1, long arg2) + throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNString(int, java.lang.String) + */ + public void updateNString(int arg0, String arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String) + */ + public void updateNString(String arg0, String arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateRowId(int, java.sql.RowId) + */ + public void updateRowId(int arg0, RowId arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId) + */ + public void updateRowId(String arg0, RowId arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML) + */ + public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException { + } + + /** + * @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML) + */ + public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException { + } + + /** + * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) + */ + public boolean isWrapperFor(Class<?> arg0) throws SQLException { + return false; + } + + /** + * @see java.sql.Wrapper#unwrap(java.lang.Class) + */ + public <T> T unwrap(Class<T> arg0) throws SQLException { + return null; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +/** + * This interface is a marker interface. It is used for objects that should + * not be cached. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public interface Uncacheable { + +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources; + +/** + * This <i>ResultSet</i> has no special tasks but implements <i>Uncacheable</i> + * to avoid this objects being cached. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class UncacheableSDEResultSet +extends SDEResultSet +implements Uncacheable +{ + /** + * Creates a new UncacheableSDResultSet object. + */ + public UncacheableSDEResultSet() { + + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,37 +1,59 @@ -/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) - * All rights reserved - * - * $Id: DatasourceException.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * - * created by: drewnak - * created at : 21.11.2007 - * created at : 14:56:32 - * - * modified by: $Author: blume $ - * modified at: $Date: 2008/01/30 12:38:34 $ - */ -package de.intevation.gnv.geobackend.sde.datasources.exception; - -/** - * A Class for encapsulating implementation specific datasource exceptions. - * This exception class can be used for all exceptions occuring in connection to "datasources actions". - */ -public class DatasourceException extends Exception { - - public DatasourceException() { - super(); - } - - public DatasourceException(String pMessage) { - super(pMessage); - } - - public DatasourceException(String pMessage, Throwable pCause) { - super(pMessage, pCause); - } - - public DatasourceException(Throwable pCause) { - super(pCause); - } - -} \ No newline at end of file +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources.exception; + +/** + * A Class for encapsulating implementation specific datasource exceptions. + * This exception class can be used for all exceptions occuring in connection + * to "datasources actions". + * + * @author blume + * @author drewnak + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class DatasourceException extends Exception { + + /** + * The UID of this Class. + */ + private static final long serialVersionUID = 2593142889158383466L; + + /** + * Constructor + */ + public DatasourceException() { + super(); + } + + /** + * Constructor + * @param pMessage the Exceptionmessage + */ + public DatasourceException(String pMessage) { + super(pMessage); + } + + /** + * Constructor + * @param pMessage the Exceptionmessage + * @param pCause the Throwable which cause this exception + */ + public DatasourceException(String pMessage, Throwable pCause) { + super(pMessage, pCause); + } + + /** + * Constructor + * @param pCause the Throwable which cause this exception + */ + public DatasourceException(Throwable pCause) { + super(pCause); + } + +}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,79 +1,76 @@ -/** - * Title: TechnicalException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: drewnak $ - * modified on: $Date: 2008/08/18 14:50:33 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.sde.datasources.exception; - -import org.apache.log4j.Logger; - -/** - * The class <code>TechnicalException</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:12:08 - */ -public class TechnicalException extends Exception{ - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(TechnicalException.class); - - /** - * Constructs a new exception with <code>null</code> as its detail message. - * The cause is not initialized, and may subsequently be initialized by a - * call to {@link #initCause}. - */ - public TechnicalException() { - } - - /** - * Constructs a new exception with the specified detail message. The - * cause is not initialized, and may subsequently be initialized by - * a call to {@link #initCause}. - * - * @param message the detail message. The detail message is saved for - * later retrieval by the {@link #getMessage()} method. - */ - public TechnicalException(String message) { - super(message); - } - public TechnicalException(Throwable pCause) { - super(pCause); - } - - /** - * Constructs a new exception with the specified detail message and - * cause. <p>Note that the detail message associated with - * <code>cause</code> is <i>not</i> automatically incorporated in - * this exception's detail message. - * - * @param message the detail message (which is saved for later retrieval - * by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A <tt>null</tt> value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public TechnicalException(String message, Throwable cause) { - super(message, cause); - } -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.sde.datasources.exception; + +import org.apache.log4j.Logger; + +/** + * The class <code>TechnicalException</code> fulfills the following purposes: + * + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class TechnicalException extends Exception{ + + /** + * The UID of this Class. + */ + private static final long serialVersionUID = -5296559414323169553L; + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(TechnicalException.class); + + /** + * Constructs a new exception with <code>null</code> as its detail message. + * The cause is not initialized, and may subsequently be initialized by a + * call to {@link #initCause}. + */ + public TechnicalException() { + } + + /** + * Constructs a new exception with the specified detail message. The + * cause is not initialized, and may subsequently be initialized by + * a call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public TechnicalException(String message) { + super(message); + } + + /** + * Constructor + * @param pCause the Throwable which cause this exception + */ + public TechnicalException(Throwable pCause) { + super(pCause); + } + + /** + * Constructs a new exception with the specified detail message and + * cause. <p>Note that the detail message associated with + * <code>cause</code> is <i>not</i> automatically incorporated in + * this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A <tt>null</tt> value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public TechnicalException(String message, Throwable cause) { + super(message, cause); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Package that contains Exceptionclasses for it's Parentpackage. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,12 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains Classes that Wrapps an ArcSDEConnection into a +<code>java.sql.Connection</code>. +All other required Wrapper-Classes +(e.g Statements,ResultSet, ResultSetMetadata) +are also available in the package. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package and it's subpackages contains Classes for the DataAccess to +the ArcSDE-Databasebackend. +</body> +</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,128 +1,91 @@ -/** - * Title: DateUtisl, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.12.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: drewnak $ - * modified on: $Date: 2008/08/18 14:50:33 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.geobackend.util; - -import org.apache.log4j.Logger; - -import java.text.SimpleDateFormat; -import java.util.Date; - - -/** - * The class <code>DateUtisl</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.12.2007 10:34:01 - */ -public class DateUtils { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(DateUtils.class); - private static boolean sDebug = sLogger.isDebugEnabled(); - - public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss"; - public static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss"; - public static final String TimeRangeFilterPattern = "yyyy-MM-dd'T'HH:mm:ssZ"; - public static final String TimeRangeFilterFormPattern = "dd.MM.yyyy HH:mm"; - - public static String getPatternedDateSDF(Date pDate) { - SimpleDateFormat fmt = new SimpleDateFormat(); - fmt.applyPattern(DATE_PATTERN); - return fmt.format(pDate); - } - - public static String getPatternedDate(Date pDate, String sPattern) { -// DateTimeZone.setDefault(DateTimeZone.UTC); -// DateTime dtf = new DateTime (pDate); -// String sStr = dtf.toString(sPattern); -// return sStr; - SimpleDateFormat fmt = new SimpleDateFormat(); - fmt.applyPattern(sPattern); - return fmt.format(pDate); - } - - public static String getPatternedDateAmer(Date pDate) { - - String sStr = getPatternedDate(pDate, DATE_PATTERN); - return sStr; - } - - public static String getPatternedDateGerm(Date pDate) { - - String sStr = getPatternedDate(pDate, DATE_PATTERN1); - return sStr; - } - - public static String getPatternedDateTimeRangeFilter(Date pDate) { - - String sStr = getPatternedDate(pDate, TimeRangeFilterPattern); - return sStr; - } - - public static String getPatternedDateTimeRangeFilterForm(Date pDate) { - - String sStr = getPatternedDate(pDate, TimeRangeFilterFormPattern); - return sStr; - } - - public synchronized static Date getDateFromStringSDF (String sStr)throws Exception { - SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); - Date date = (Date)formatter.parse(sStr); - return date; - } - - public static Date getDateFromString (String sStr)throws Exception { - - Date date = getDateFromString (sStr, DATE_PATTERN1); - return date; - } - - public static Date getDateFromStringTimeRangeFilter (String sStr)throws Exception { - - Date date = getDateFromString (sStr, TimeRangeFilterPattern); - return date; - } - - public static Date getDateFromStringTimeRangeFilterForm (String sStr)throws Exception { - - Date date = getDateFromString (sStr, TimeRangeFilterFormPattern); - return date; - } - - public static Date getDateFromString (String sStr, String sPattern)throws Exception { -// DateTime dtf = null; -// DateTimeZone.setDefault(DateTimeZone.UTC); -// -// dtf = DateTimeFormat.forPattern(sPattern).parseDateTime(sStr); -// -// Date date = dtf.toDate(); -// -// return date; - SimpleDateFormat fmt = new SimpleDateFormat(); - fmt.applyPattern(sPattern); - return fmt.parse(sStr); - } - - -} +/** + * Title: DateUtisl, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $ + * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v $ + * created by: Stefan Blume (blume) + * erstellt am: 21.12.2007 + * Copyright: con terra GmbH, 2005 + * + * modified by: $Author: drewnak $ + * modified on: $Date: 2008/08/18 14:50:33 $ + * Version: $Revision: 1.2 $ + * TAG: $Name: $ + * locked from: $Locker: $ + * CVS State: $State: Exp $ + * Project: $ProjectName$ + */ +package de.intevation.gnv.geobackend.util; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.log4j.Logger; + +/** + * The class <code>DateUtils</code> fulfills the following purposes: + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class DateUtils { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(DateUtils.class); + + /** + * The Dateformat which will be used e.g for Querying the Database + */ + public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss"; + + private static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss"; + + /** + * The Method returns a Date using the given pattern as a String + * @param pDate The Date which should be formatted + * @param sPattern The Pattern which should be used. + * @return the Date formatted a a String + */ + public static String getPatternedDate(Date pDate, String sPattern) { + SimpleDateFormat fmt = new SimpleDateFormat(); + fmt.applyPattern(sPattern); + return fmt.format(pDate); + } + + /** + * Returns the Date as a String formated using the + * <code>DateUtils.DATE_PATTERN</code> format- + * @param pDate the Date which should be formatted + * @return the given Data as a String + */ + public static String getPatternedDateAmer(Date pDate) { + String sStr = getPatternedDate(pDate, DATE_PATTERN); + return sStr; + } + + /** + * This method decodes a Datevalue from the given String useing the + * <code>DateUtils.DATE_PATTERN1</code> format- + * @param sStr The String which contains the encoded Datevalue + * @return the decoded Datevalue as an Date-object. + * @throws Exception throws all Expetion which occurs during the Process. + */ + public static Date getDateFromString (String sStr)throws Exception { + Date date = getDateFromString (sStr, DATE_PATTERN1); + return date; + } + + /** + * Formats a given Date encoded as a String using the given Pattern + * into a Date Object. + * @param sStr The String with the encoded DateValue + * @param sPattern The pattern which should be used to decode the Date + * @return the given Datevalue as an Date-Object. + * @throws Exception throws all Expetion which occurs during the Process. + */ + public static Date getDateFromString (String sStr, + String sPattern)throws Exception { + SimpleDateFormat fmt = new SimpleDateFormat(); + fmt.applyPattern(sPattern); + return fmt.parse(sStr); + } +}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,15 +1,23 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.util; import java.util.LinkedHashMap; import java.util.Map; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public final class RedundancyRemover extends LinkedHashMap { - /** ceil(1029 * 1.75) = 1801, which is prime + /** ceil(1029 * 1.75) = 1801, which is prime * -> suitable for a hash map slot size. */ public static final int DEFAULT_LOOKBACK =
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/XMLUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.util; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.apache.log4j.Logger; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public final class XMLUtils { + + private static Logger logger = Logger.getLogger(XMLUtils.class); + + + private XMLUtils() { + } + + + public static Object xpath( + Object root, + String query, + QName returnType, + NamespaceContext namespaceContext + ) { + if (root == null) { + return null; + } + + try { + XPath xpath = newXPath(namespaceContext); + + if (xpath != null) { + return xpath.evaluate(query, root, returnType); + } + } + catch (XPathExpressionException xpee) { + logger.error(xpee.getLocalizedMessage(), xpee); + } + + return null; + } + + + public static XPath newXPath(NamespaceContext namespaceContext) { + XPathFactory factory = XPathFactory.newInstance(); + XPath xpath = factory.newXPath(); + + if (namespaceContext != null) { + xpath.setNamespaceContext(namespaceContext); + } + + return xpath; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Package that contains utility-Classes for this Module +</body> +</html>
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.base.query; import com.esri.sde.sdk.client.SDEPoint; @@ -15,22 +23,22 @@ public class GroupBySample { - + public void executeQuery(SeConnection con, String[] pLayername, String pSpatialColumnName, String pWhere, SDEPoint[] g, String[] pReturnFields, String byClause) { - + try { // get the layer for querying - + SeShapeFilter[] filters = null; if (g != null){ SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); SeShape shape = new SeShape(); shape.setCoordRef(lLayer.getCoordRef()); - - - + + + shape.generatePolygon(g.length, 1, null, g); SeShapeFilter filter = new SeShapeFilter(pLayername[0], pSpatialColumnName, shape, SeFilter.METHOD_AI); @@ -41,14 +49,14 @@ SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); spatialQuery = new SeQuery(con); - + SeQueryInfo queryInfo = new SeQueryInfo(); queryInfo.setColumns(pReturnFields); - + if (byClause != null){ queryInfo.setByClause(byClause); } - + queryInfo.setConstruct(sqlCons); spatialQuery.prepareQueryInfo(queryInfo); @@ -68,29 +76,29 @@ if (lCount == 0) { // analyze cols of result set SeColumnDefinition[] lCols = row.getColumns(); - + } short lNumCols = row.getNumColumns(); - + for (int i = 0; i < lNumCols; i++) { System.out.println(row.getObject(i)); } - + } spatialQuery.close(); - } catch (Exception e){ + } catch (Exception e){ e.printStackTrace(); } - + } - - + + /** * @param args */ public static void main(String[] args) { - + try { String[] layerNames = new String[] { "median.meshpoint", "median.mesh" }; String spatialColumnName = "SHAPE"; @@ -109,13 +117,13 @@ String database = ""; String username = ""; String credentials = ""; - SeConnection con = new SeConnection(server, port, + SeConnection con = new SeConnection(server, port, database, username, credentials); new GroupBySample().executeQuery(con, layerNames, spatialColumnName, where, g, returnFields, byClause); - - + + } catch (SeException e) { e.printStackTrace(); }
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,42 +1,52 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.geobackend.base.query; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; + +import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; + +import de.intevation.gnv.geobackend.base.query.exception.QueryException; + import java.io.FileInputStream; import java.io.InputStream; + import java.util.Collection; import java.util.Iterator; import java.util.Properties; +import junit.framework.TestCase; + import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.geobackend.base.ResultDescriptor; -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; -import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; -import de.intevation.gnv.geobackend.base.query.exception.QueryException; -import junit.framework.TestCase; - /** * TestCase for the QueryExecutor interface - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class QueryExecutorTestCase extends TestCase { - - + + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = null; - + static{ BasicConfigurator.configure(); log = Logger.getLogger(QueryExecutorTestCase.class); } - + /** * Constructor * @param name @@ -44,18 +54,18 @@ public QueryExecutorTestCase(String name) { super(name); } - - + + public void testSpatialQuery(){ try { - + this.testQuery(5, "spatial_query", null); } catch (QueryException e) { log.error(e,e); fail(); } } - + public void testSpatialQueryWithoutIntersects(){ try { // this.testQuery(286, "spatial_query_without_intersects", null); @@ -69,7 +79,7 @@ fail(); } } - + public void testSpatialQueryWithInnerSelect(){ try { this.testQuery(1998, "spatial_query_with_innerselect", null); @@ -78,8 +88,8 @@ fail(); } } - - + + public void testChooseFis(){ try { this.testQuery(1, "choose_fis_query", null); @@ -88,44 +98,44 @@ fail(); } } - - + + /** * Tests if the Databaseconnection can be established and * Data could be read from the Database */ public void testQueryExecutor(){ - + try { - + this.testQuery(6, "mesh", null); - + this.testQuery(1, "mesh_id", new String[]{"5"}); - - - + + + } catch (QueryException e) { log.error(e,e); fail(); } } - + public void testTimeSeriesQueries(){ - + try{ // Test zum initialisieren der umgebung this.testQuery(6, "mesh", null); - - + + this.testQuery(11, "timeseries_stations", new String[]{"4"}); this.testQuery(11, "timeseries_stations_op", new String[]{"4"}); this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"}); - + } catch (QueryException e) { log.error(e,e); fail(); } - + } /** @@ -159,7 +169,7 @@ // } log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms"); } - + /** @@ -167,20 +177,20 @@ */ @Override protected void setUp() throws Exception { - + super.setUp(); InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); Properties properties = new Properties(); properties.load(inputStream); - + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); cpf.initializeConnectionPool(properties); - - + + inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); properties = new Properties(); properties.load(inputStream); - + QueryContainerFactory qcf = QueryContainerFactory.getInstance(); qcf.initializeQueryContainer(properties); }
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.base.query; import com.esri.sde.sdk.client.SDEPoint; @@ -15,22 +23,22 @@ public class ToCharSample { - + public boolean executeQuery(SeConnection con, String[] pLayername, String pSpatialColumnName, String pWhere, SDEPoint[] g, String[] pReturnFields, String byClause) { - + try { // get the layer for querying - + SeShapeFilter[] filters = null; if (g != null){ SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); SeShape shape = new SeShape(); shape.setCoordRef(lLayer.getCoordRef()); - - - + + + shape.generatePolygon(g.length, 1, null, g); SeShapeFilter filter = new SeShapeFilter(pLayername[0], pSpatialColumnName, shape, SeFilter.METHOD_AI); @@ -41,14 +49,14 @@ SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); spatialQuery = new SeQuery(con); - + SeQueryInfo queryInfo = new SeQueryInfo(); queryInfo.setColumns(pReturnFields); - + if (byClause != null){ queryInfo.setByClause(byClause); } - + queryInfo.setConstruct(sqlCons); spatialQuery.prepareQueryInfo(queryInfo); @@ -68,36 +76,36 @@ if (lCount == 0) { // analyze cols of result set SeColumnDefinition[] lCols = row.getColumns(); - + } short lNumCols = row.getNumColumns(); - + for (int i = 0; i < lNumCols; i++) { System.out.println(row.getObject(i)); } - + } spatialQuery.close(); return true; - } catch (Exception e){ + } catch (Exception e){ e.printStackTrace(); return false; } - + } - - + + /** * @param args */ public static void main(String[] args) { - + try { String[] layerNames = new String[] { "MEDIAN.TRACK" }; String spatialColumnName = "SHAPE"; String where = "MEDIAN.TRACK.CRUISEID = 47"; - String[] returnFields = new String[] { "MEDIAN.TRACK.TRACKID KEY", + String[] returnFields = new String[] { "MEDIAN.TRACK.TRACKID KEY", "to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| NAME VALUE", "NAME" }; String byClause = "ORDER BY STARTDATE, ENDDATE, NAME"; @@ -113,13 +121,13 @@ String database = ""; String username = ""; String credentials = ""; - - SeConnection con = new SeConnection(server, port, + + SeConnection con = new SeConnection(server, port, database, username, credentials); boolean success = new ToCharSample().executeQuery(con, layerNames, spatialColumnName, where, g, returnFields, byClause); - + if (success){ System.out.println("Terminated successful."); }else{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.geobackend.base.query.cache; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +import junit.framework.TestCase; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; + +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; +import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; + +public class CacheCleanerTestCase extends TestCase { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = null; + + static{ + BasicConfigurator.configure(); + log = Logger.getLogger(CacheCleanerTestCase.class); + } + + public void testCachCleaner(){ + log.debug("CacheCleanerTestCase.testCachCleaner"); + CacheCleaner cc = new CacheCleaner(); + boolean success = cc.test(); + if (!success){ + log.error("TestCase failed."); + fail(); + } + } + + /** + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception { + + super.setUp(); + InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); + Properties properties = new Properties(); + properties.load(inputStream); + + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); + cpf.initializeConnectionPool(properties); + + + inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); + properties = new Properties(); + properties.load(inputStream); + + QueryContainerFactory qcf = QueryContainerFactory.getInstance(); + qcf.initializeQueryContainer(properties); + } +}
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,28 +1,40 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.geobackend.sde.datasources; +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; + +import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; + +import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; + import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; + import java.sql.Connection; +import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; + import java.util.Properties; -import java.sql.ResultSet; import junit.framework.TestCase; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; -import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; -import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; - /** * TestCase for the usage of the ArcSDEConnectionPool. - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ArcSDEConnectionPoolTestCase extends TestCase { @@ -31,26 +43,26 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = null; - + static { BasicConfigurator.configure(); log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); } /** - * + * */ public ArcSDEConnectionPoolTestCase() { super(); } - + /** - * + * * @param name */ public ArcSDEConnectionPoolTestCase(String name) { super(name); } - + /** * Test if the ArcSDEConnectionPool can be established * and if a Request could be done. @@ -61,18 +73,18 @@ InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); Properties properties = new Properties(); properties.load(inputStream); - + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); cpf.initializeConnectionPool(properties); - + assertTrue(cpf.isInitialized()); log.debug("ConnectionPoolFactory ist initialisiert."); - + ConnectionPool cp = cpf.getConnectionPool(); assertNotNull(cp); - log.debug("ConnectionPool ist initialisiert."); - - Connection connection = null; + log.debug("ConnectionPool ist initialisiert."); + + Connection connection = null; try{ try { connection = cp.getConnection("N/N"); @@ -82,20 +94,20 @@ log.error("Es traten Probleme bei der Verbinung zur Datenbank auf."); fail(); } - - + + try { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH"); - + while (rs.next()){ log.debug(rs.getInt(1)); log.debug(rs.getString(2)); - + log.debug(rs.getInt("MESHID")); log.debug(rs.getString("NAME")); } - + } catch (SQLException e) { log.error(e,e); }
--- a/geo-backend/src/test/ressources/QueryExecutorTestCase.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/geo-backend/src/test/ressources/QueryExecutorTestCase.properties Fri Sep 28 12:15:21 2012 +0200 @@ -96,3 +96,9 @@ (SELECT st_astext(SHAPE) FROM MEDIAN.FEATUREAREA WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND FEATURECODE = 41 )\ ) \ order by M.NAME +test_regionfilter = SELECT M.OBJECTID KEY, M.NAME VALUE FROM MEDIAN.MESHPOINT, MEDIAN.MESH M WHERE M.SOURCEID IN (2) AND M.MESHID = MEDIAN.MESHPOINT.MESHID AND INTERSECTS(SHAPE, (SELECT st_astext(SHAPE) FROM MEDIAN.FEATUREAREA WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND FEATURECODE = ? )) order by M.NAME + + +updated_tables = SELECT FULLTABLENAME \ + FROM MEDIAN.LASTUPDATED \ + WHERE LASTUPDATE >= to_date('?', 'YYYY.MM.DD HH24:MI:SS')
--- a/gnv-artifacts/ChangeLog Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/ChangeLog Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,2672 @@ +2012-03-12 Ingo Weinzierl <ingo@intevation.de> + + * src/test/java/de/intevation/gnv/artifacts/TestCallContext.java, + src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java, + src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java, + src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java, + src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java, + src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java, + src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java, + src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java, + src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java, + src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java, + src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java, + src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java, + src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java, + src/main/java/de/intevation/gnv/layer/LayerArtifact.java, + pom.xml: Made it compile again with an updated ArtifactDatabase. + +2011-03-14 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/**/*.java: Changed imports to fit new positions of XMLUtils and Config: + $ find -name \*.java | xargs sed -i \ + -e 's/import de\.intevation\.artifactdatabase\.Config/import de.intevation.artifacts.common.utils.Config/' \ + -e 's/import de\.intevation\.artifactdatabase\.XMLUtils/import de.intevation.artifacts.common.utils.XMLUtils/' + +2010-11-04 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * contrib/palette2polygonVM.xsl, + contrib/visualize-transitions.xsl: Added author names. + +2010-11-02 Ingo Weinzierl <ingo@intevation.de> + + * contrib/palette2polygonVM.xsl, + contrib/palette2qgis.xsl, + contrib/visualize-transitions.xsl, + doc/schema/externalinterface_schema.sql, + doc/schema/externalinterface_testdata.sql, + doc/conf/maptemplates/caps.xml, + src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java, + src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestSuite.java, + src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java, + src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/TestCallContext.java, + src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java, + src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java, + src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java, + src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java, + src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/ressource/RessourceFactoryTestCase.java, + src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/util/DistanceCalculatorTestCase.java, + src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java, + src/main/java/de/intevation/gnv/artifacts/APP.java, + src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java, + src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java, + src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java, + src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java, + src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java, + src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java, + src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java, + src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java, + src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java, + src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java, + src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java, + src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java, + src/main/java/de/intevation/gnv/state/OutputState.java, + src/main/java/de/intevation/gnv/state/DefaultInputValue.java, + src/main/java/de/intevation/gnv/state/OutputMode.java, + src/main/java/de/intevation/gnv/state/StateFactory.java, + src/main/java/de/intevation/gnv/state/exception/StateException.java, + src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java, + src/main/java/de/intevation/gnv/state/cache/QueryObject.java, + src/main/java/de/intevation/gnv/state/MeasurementState.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java, + src/main/java/de/intevation/gnv/state/AutoResumeState.java, + src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java, + src/main/java/de/intevation/gnv/state/DefaultExportMode.java, + src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java, + src/main/java/de/intevation/gnv/state/InputValue.java, + src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java, + src/main/java/de/intevation/gnv/state/SingleInputState.java, + src/main/java/de/intevation/gnv/state/SwitchModeState.java, + src/main/java/de/intevation/gnv/state/DefaultOutputMode.java, + src/main/java/de/intevation/gnv/state/ExtendedInputData.java, + src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java, + src/main/java/de/intevation/gnv/state/State.java, + src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java, + src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java, + src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileMeshVectorOutputState.java, + src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/DefaultState.java, + src/main/java/de/intevation/gnv/state/ExportMode.java, + src/main/java/de/intevation/gnv/state/MinMaxDateState.java, + src/main/java/de/intevation/gnv/state/InputData.java, + src/main/java/de/intevation/gnv/state/MinMaxState.java, + src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java, + src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java, + src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java, + src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java, + src/main/java/de/intevation/gnv/state/OutputStateBase.java, + src/main/java/de/intevation/gnv/state/DefaultInputData.java, + src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java, + src/main/java/de/intevation/gnv/math/ConstantFunction.java, + src/main/java/de/intevation/gnv/math/ConstantXYDepth.java, + src/main/java/de/intevation/gnv/math/LinearMetrics.java, + src/main/java/de/intevation/gnv/math/QueriedXYDepth.java, + src/main/java/de/intevation/gnv/math/L1Comparator.java, + src/main/java/de/intevation/gnv/math/HeightValue.java, + src/main/java/de/intevation/gnv/math/Metrics.java, + src/main/java/de/intevation/gnv/math/IJKey.java, + src/main/java/de/intevation/gnv/math/LinearToMap.java, + src/main/java/de/intevation/gnv/math/Interpolation2D.java, + src/main/java/de/intevation/gnv/math/XYColumn.java, + src/main/java/de/intevation/gnv/math/Interpolation3D.java, + src/main/java/de/intevation/gnv/math/Point2d.java, + src/main/java/de/intevation/gnv/math/AreaInterpolation.java, + src/main/java/de/intevation/gnv/math/LinearFunction.java, + src/main/java/de/intevation/gnv/math/Interpolator.java, + src/main/java/de/intevation/gnv/math/GridCell.java, + src/main/java/de/intevation/gnv/math/XYDepth.java, + src/main/java/de/intevation/gnv/math/AttributedXYColumns.java, + src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java, + src/main/java/de/intevation/gnv/statistics/StatisticSet.java, + src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java, + src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java, + src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java, + src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java, + src/main/java/de/intevation/gnv/statistics/Statistic.java, + src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java, + src/main/java/de/intevation/gnv/statistics/HorizontalProfileVectorStatistics.java, + src/main/java/de/intevation/gnv/statistics/VerticalProfileVectorStatistics.java, + src/main/java/de/intevation/gnv/statistics/Statistics.java, + src/main/java/de/intevation/gnv/statistics/VectorStatistics.java, + src/main/java/de/intevation/gnv/statistics/exception/StatisticsException.java, + src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java, + src/main/java/de/intevation/gnv/transition/DefaultTransition.java, + src/main/java/de/intevation/gnv/transition/TransitionFactory.java, + src/main/java/de/intevation/gnv/transition/TransitionBase.java, + src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java, + src/main/java/de/intevation/gnv/transition/Transition.java, + src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java, + src/main/java/de/intevation/gnv/histogram/HistogramHelper.java, + src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java, + src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java, + src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java, + src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshCrossArtifact.java, + src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshArtifact.java, + src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java, + src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileInstantaneousPointArtifact.java, + src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileMeshArtifact.java, + src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java, + src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileInstantaneousPointArtifact.java, + src/main/java/de/intevation/gnv/raster/Raster.java, + src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java, + src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java, + src/main/java/de/intevation/gnv/raster/AbstractProducer.java, + src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java, + src/main/java/de/intevation/gnv/raster/RasterToPPM.java, + src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java, + src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java, + src/main/java/de/intevation/gnv/raster/Filter.java, + src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java, + src/main/java/de/intevation/gnv/raster/KernelFilter.java, + src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java, + src/main/java/de/intevation/gnv/raster/PaletteManager.java, + src/main/java/de/intevation/gnv/raster/Vectorizer.java, + src/main/java/de/intevation/gnv/raster/Palette.java, + src/main/java/de/intevation/gnv/raster/IsoProducer.java, + src/main/java/de/intevation/gnv/utils/FileUtils.java, + src/main/java/de/intevation/gnv/utils/IndexBuffer.java, + src/main/java/de/intevation/gnv/utils/DistanceCalculator.java, + src/main/java/de/intevation/gnv/utils/InputValidator.java, + src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java, + src/main/java/de/intevation/gnv/utils/ExclusiveExec.java, + src/main/java/de/intevation/gnv/utils/exception/ValidationException.java, + src/main/java/de/intevation/gnv/utils/MetaWriter.java, + src/main/java/de/intevation/gnv/utils/MapfileGenerator.java, + src/main/java/de/intevation/gnv/utils/WKTUtils.java, + src/main/java/de/intevation/gnv/utils/StringUtils.java, + src/main/java/de/intevation/gnv/utils/Pair.java, + src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java, + src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java, + src/main/java/de/intevation/gnv/chart/Chart.java, + src/main/java/de/intevation/gnv/chart/DefaultHistogram.java, + src/main/java/de/intevation/gnv/chart/XMLChartTheme.java, + src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java, + src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java, + src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java, + src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java, + src/main/java/de/intevation/gnv/chart/HorizontalProfileVectorChart.java, + src/main/java/de/intevation/gnv/chart/AbstractHistogram.java, + src/main/java/de/intevation/gnv/chart/ChartLabels.java, + src/main/java/de/intevation/gnv/chart/AbstractChart.java, + src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java, + src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java, + src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java, + src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java, + src/main/java/de/intevation/gnv/exports/Export.java, + src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java, + src/main/java/de/intevation/gnv/exports/ChartExportHelper.java, + src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java, + src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java, + src/main/java/de/intevation/gnv/exports/DefaultProfile.java, + src/main/java/de/intevation/gnv/exports/DefaultExport.java, + src/main/java/de/intevation/gnv/exports/ODVExport.java, + src/main/java/de/intevation/gnv/exports/StringArrayKey.java, + src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java, + src/main/java/de/intevation/gnv/wms/LayerInfo.java, + src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java, + src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java, + src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java, + src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java, + src/main/java/de/intevation/gnv/layer/LayerArtifact.java, + src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java, + src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java, + bin/run.sh: Added license header to each these files. + + * LGPL.txt: Added license file of the GNU LGPL v2.1 + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + RELEASE 1.1 + + * ChangeLog, Changes, NEWS: Summarized changes. + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue320 + + * src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java: The + minimum number of bins in an histogram is set to 1. If the user has chosen + a value for the class width that results in number < 1, the bin number is + set to 1. + +2010-06-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Write missing bbox into meta file while WMS publishing - the missing bbox + prevented the map from initializing properly and it wasn't displayed in + the gui. + +2010-06-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue315, Issue314 + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: All + generated wms layers will now have a prefix 'GNV_'. On this way, we can + ensure that the name of wms layers never start with a digit. This is + necessary to prevent the mapserver from generating invalid xml while + creating a GetFeatureInfo response (mapserver generates xml elements from + layer names - xml nodes may not start with a digit!). + +2010-06-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue318 + + * doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Transition + bugfix: Given points from mapviewer call are now taken into account as + well. + +2010-06-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue286 + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: Added a buffer + of 1 second for the valid time range. The valid values that are returnd + from database differ in milliseconds. Example: the lower time returned + from database is 00:00:00.650, the gui will display 00:00:00. This caused + an error because the data given by the user was 650 ms under the lower + bound. With a 1 second range, the lower bound is moved to 23:59:59.650, so + that the time given by the user is in the valid range. + +2010-06-29 Tim Englich <tim.englich@intevation.de> + + Issue318 + + * doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: + Removed duplicate xmlns:xlink definition. + +2010-06-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue316 + + * src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Set the + specified locale in the constructor which is used to localize the axes. + + * src/main/java/de/intevation/gnv/chart/AbstractHistogram.java: Adjust the + localization of x and y axes corresponding the specified locale. + +2010-06-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue318 + + * doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Added + transition chain for the external mapviewer call. + +2010-06-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue284 + + * doc/conf/queries.properties: Added missing column MESHID to chart data + query for product 'Horizontales Schnittprofil'. This column is required + by the csv export of this product. + +2010-06-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue233 + + * src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Fixed + the range calculation for y-axes if there is only a single datapoint + existing in the chart. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + Issue283: + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getRequestedLayerMetadata): + Bugfix: Now geometries of the generated layers will also be clipped if a + polygon served by the mv-gnv-interface should be used. + +2010-06-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue281 + + * src/main/java/de/intevation/gnv/state/MeasurementState.java: Fixed an + ArrayIndexOutOfBounds exception that occured while initializing the + ParameterMatrix. + +2010-06-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue230 + + * doc/conf/queries.properties: Removed multiplication of depth value with + factor -1 for odv queries on vertical profiles. + +2010-06-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue300 + + * doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Fixed + broken transition. The transition chain ended after choosing a subarea; + now it leads to the coordinate selection. + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + ISSUE299v + + * doc/conf/products/horizontalprofile/conf_mesh.xml: + Bugfix: Change multiselect to false for the Parameter-State of + vector-values. It is not possible to render more than one Parameter if + vector-values are used. + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + ISSUE299 + + * doc/conf/products/verticalprofile/conf_mesh.xml: + Bugfix: Change multiselect to false for the Parameter-State of + vector-values. It is not possible to render more than one Parameter if + vector-values are used. + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/lang/artifactMessages_en.properties, + src/main/resources/lang/artifactMessages.properties: + Fixed typo. Scalar Values will now be written capitalized. + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + ISSUE297 + + * src/main/resources/lang/artifactMessages*.properties: + Added localized exceptionmessage for MinMaxState. + + * src/main/java/de/intevation/gnv/state/MinMaxState.java (feed): + Localized exceptionmessage which will be displayed in the GUI of the GNV + Web-Client. + +2010-06-14 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * pom.xml: Write svn revision to MANIFEST file while creating jar archive. + +2010-06-14 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue250 - Adjusted subtitle of 'Achsenparalleles Vertikalprofil' + + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java: + Adapted the subtitle of charts from type 'Achsenparalleles + Vertikalprofil'. + +2010-06-14 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Renamed + parameter 'coordinate' to 'mesh_coordinate', because the strings shown in + the gui depend on the parameter names. 'mesh_coordinate' matches + "Geographische Position (z.B. 56n30 6e20)" in the german resource bundle. + "Koordinate" has been displayed before this change has taken place. + +2010-06-12 Ingo Weinzierl <ingo_weinzierl@web.de> + + * doc/conf/products/horizontalprofile/conf_mesh_parallel.xml: Configuration + for the new product 'Achsenparalleler Vertikalschnitt'. + + * doc/conf/queries.properties: A new sql statement to query all points of a + given axis of a mesh. + + * doc/conf/conf.xml: Added the new product to fis 'Modeldaten'. + + * src/main/resources/lang/artifactMessages.properties, + src/main/resources/lang/artifactMessages_de_DE.properties, + src/main/resources/lang/artifactMessages_en.properties, + src/main/resources/lang/artifactMessages_de.properties: Added a name for + the new product 'Achsenparalleler Vertikalschnitt'. + + TODO: Find an english name for this product! + +2010-06-12 Ingo Weinzierl <ingo_weinzierl@web.de> + + * src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java: + A new artifact that is used for the product 'Achsenparalleler + Vertikalschnitt'. + + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java: + The determination of the linestring that is used in the interpolation is + outsourced to an own method. This makes it possible to be overriden by + subclasses. + + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java: + Inherits of VerticalCrossSectionOutputState. It overrides the linestring + determination. In this product, no linestring is given by user input but + an axis of the mesh is selected. The linestring is made up by the point of + this axis. + +2010-06-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue286 - Input validation of time ranges + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: Removed the + epsilon that has been used to compare time values. Now, we just compare + the seconds of a time value pair - background: datetime objects differ in + milliseconds. + +2010-06-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue290 - Centering of pdf exports + + * src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: PDF + exports of histograms are centered now. + +2010-06-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue290 - Centering of pdf exports + + * src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: PDF + exports of charts are centered now. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Improved + data initialization and range calculation. Gap detection will be entered, + if start and end position are valid indices for the array that contains + the data. The x and y range for each axis is improved. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/timeseries/conf_mesh.xml, + doc/conf/products/timeseries/conf_timeseriespoint.xml, + doc/conf/products/horizontalprofile/conf_mesh.xml, + doc/conf/products/verticalprofile/conf_mesh.xml, + doc/conf/products/verticalprofile/conf_timeseriespoint.xml: Limited + parameterization so that just a single vector can be selected at the same + time. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java: + Overide method getHistograms(.) to create histograms for + verticalprofiles that contain the components of vectorial parameters. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java: + Overide method getHistograms(.) to create histograms for + horizontalprofiles that contain the components of vectorial parameters. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java: + Override method getHistograms(.) of TimeSeriesOutputState to create + histograms that contain the components of vectorial parameters. This + method doesn't have many tasks but calls getHistograms(.) of + VectorDataProcessor. + + * src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java: The real + implementation of getHistograms(.) for creating histograms that contain + the components of vectorial parameters. This place was chosen to make it + possible to use this method in all vector output states (because multiple + inheritance is not available in Java). + + * src/main/java/de/intevation/gnv/histogram/HistogramHelper.java: + A new method to prepare the data for histograms that contain the + components of vectorial parameters. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Seperated the histogram creation into an own method. This enables + subclasses to override the histogram creation. Moved the method + createHistogramLabels(.) to HistogramHelper. + + * src/main/java/de/intevation/gnv/histogram/HistogramHelper.java: + New method to create histogram labels (moved from TimeSeriesOutputState). + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/statistics/VerticalProfileVectorStatistics.java: + This class created statistics for vertical proifles with vectorial + parameters. + + * src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java: + Added a new method that returns an instance of + VerticalProfileVectorStatistics. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/statistics/HorizontalProfileVectorStatistics.java: + This is a class to create statistics for horizontal profiles with + vectorial parameters. + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java: + Added a new method to return an instance of + HorizontalProfileVectorStatistics. + + * src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java, + src/main/java/de/intevation/gnv/statistics/VectorStatistics.java: Added a + method to clean the statistics for the next vector component. + +2010-06-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/statistics/VectorStatistics.java: This is + an abstract base class for statistics of vectorial parameters. There are + two methods that need to be overriden by subclasses. + + * src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java: + A concrete statistics class for timeseries statistics of vectorial + parameters. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java: + Added a new method that returns an instance of TimeseriesVectorStatistics + to create a statistic for this product type. + +2010-06-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java: + Added odv support for horizontal profiles using vector data. + +2010-06-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/horizontalprofile/conf_mesh.xml: Added the transitions + for horizontal profiles on meshes that make use of vector data. + +2010-06-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java: + A new output state for horizontal profiles using vector data. + + * src/main/java/de/intevation/gnv/chart/HorizontalProfileVectorChart.java: A + new horizontal profile chart type using vector data. + +2010-06-07 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/verticalprofile/conf_mesh.xml, + doc/conf/products/verticalprofile/conf_timeseriespoint.xml: Added + transitions for working with vertical profiles that contain vector data. + +2010-06-07 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileMeshVectorOutputState.java: + A new output state for verticalprofiles on meshes that contain vector + data. + +2010-06-07 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java: The + columns used for the final ResultDescriptor are no longer configured here + - they need to be configured in the output states of each product. The + VectorDataProcessor is called with the data collection and these columns + now (so the method signature of process(.) changed). + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java: + Configured ResultDescriptor columns here and adapted method call of + VectorDataProcessor.process(.). + + * src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java: + This output state is used while working vector data on verticalprofiles. + Before a chart is generated by this state, the vector data are converted + using VectorDataProcessor. + + * src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java: A + new chart type used for verticalprofiles with vector data. + + * doc/conf/queries.properties: A parameter of an sql statement got a name. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + Added functionality to publish the the mbr of the generated layer to + the client. + * src/main/java/de/intevation/gnv/utils/MetaWriter.java (insertMbr): + Added function to add an box-element to the mapserver-fragmet of the + Metafile + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Calculate the box and write it into the metafile using the insertMbr-method + of MetaWriter to publish the mbr of the data which was fetched during the + request to the client. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + * doc/conf/conf.xml: + Revert wrong Commit Revision 1163. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + * doc/conf/maptemplates/horizontalcrosssection_*.vm, + doc/conf/maptemplates/layer_polygon.vm, + doc/conf/maptemplates/layer_point.vm, + doc/conf/maptemplates/layer_linestring.vm: + Added Configuration Elements TEMPLATE, DUMP, TOLERANCE and + METADATA/gml_include_items to enable GetFeatureInforRequests using gml + as INFO_FORMAT for products of type layer. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + * doc/conf/maptemplates/mapfile.vm: + Added MAXSIZE to the mapfiletemplate so that it is possible to render the + layer in the fullscreenmode of a mapclient which will request images that + size are greater than 2048 Pixel. + +2010-06-04 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/timeseries/conf_mesh.xml: Added vector support for + timeseries points on meshes. + +2010-06-04 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java: The + ehcache CacheManager and the MBeanServer of the JVM are connected so that + the statistics of the cache is available as MBean in JConsole. + +2010-06-03 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java: + Removed needless imports. + +2010-06-03 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/sql-cache.xml: SQL-cache configuration. + + * doc/conf/conf.xml: Added a new section to the geo-backend section to + configure, enable/disable the sql-cache. The sql-cache is activated in + the default configuration. + + * src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java: + Removed the initialization of geo-backend related objects (as ArcSDE + connection settings, queries). This work is done in the geo-backend + itself, now. At this place, a new geo-backend Configuration object is + created and its init(.) method is called. + +2010-06-02 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Remove + cached elements of each state that is visited while stepping back to a + previous state. + +2010-06-01 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Do not + call endOfLife of the current state before advancing to the next state. + This would make it impossible to use the cache. + +2010-06-01 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/StateBase.java: Remove existing + elements from cache that belong to an outdated state if its enfOfLife(.) + is called. It was necessary to adapt the signature of getHash(.) for this + - removed the parameter uuid - because endOfLife is called without any + information about the current uuid. The uuid has not been used in + getHash() anyway. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java, + src/main/java/de/intevation/gnv/state/OutputStateBase.java: Adapted the + signature of getHash() regarding the changes in the implementing class + StateBase. + +2010-05-31 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added queries for TimeSeriesPoints using vectorvalues for verticalprofiles. + +2010-05-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue291 + + * src/main/java/de/intevation/gnv/exports/ODVExport.java: Fixed the + aggregation of parameters. + +2010-05-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue198 + + * src/main/java/de/intevation/gnv/utils/MetaWriter.java: Product 'Layer' and + 'Horizontalschnitt' use the same code to write meta files. To create a + meta file, it is now necessary to use four methods: + - initMeta(): creates a new xml document and inserts the root node 'meta' + - insertAbstractMeta(.): adds meta information into the meta file + - insertLayer(.): adds layer specific information into the meta file + - writeMetaFile(.): writes the meta information file to disk. + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: Make + use of the new methods of MetaWriter. Both classes use the same methods + now! + + * doc/conf/queries.properties: Fetch the layername from database while + requesting wms data. + + * src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java: Added the + title of a layer. The title is used while creating the meta information + file for wms layers. + + * doc/conf/maptemplates/horizontalcrosssection_salinity.vm, + doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm, + doc/conf/maptemplates/layer_linestring.vm, + doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm, + doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_water-levels.vm, + doc/conf/maptemplates/layer_polygon.vm, + doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm, + doc/conf/maptemplates/layer_point.vm, + doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm: + Adjusted the templates regarding the changes in meta file. Each parameter + that is necessary in these templates is contained in the LayerInfo object. + So there is no need to concatenate parameters as it was the case before + these changes. Furthermore, there is a new section that contains the title + of a layer - the title is adjustable by the user. + +2010-05-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: Fixed a + bug while exporting charts and histograms to pdf. Charts/histograms that + are larger than the pdf page have been cut. The reason was a usage of + wrong values when creating the graphics area for the charts/histograms. + +2010-05-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue288 + + * src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Use + AdvancedHistogramDataset as dataset for histograms instead of JFreeChart's + HistogramDataset. Adjusted the calculation of bin width and number of bins + for this. + + * src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java: This + class is mainly a copy of JFreeChart's class HistogramDataset. The + difference between these two classes is, that AdvancedHistogramDataset + takes an argument for setting the bin width as well as an argument to + adjust the number of bins - HistogramDataset just takes the number of + bins. The reason why AdvancedHistogramDataset doesn't inherit from + HistogramDataset is, that basic attributes of that class have private + access. + +2010-05-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue289 + + * src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Values + specifying the bin width or the number of bins are inserted into this + histogram as double values - no longer as i18n strings. So the complete + parsing code is removed. + +2010-05-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue290 - PDF format of histograms depends on histograms' apsect ratio. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Removed the boolean parameter to adjust the page format when calling the + pdf export method of a histogram. + + * src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: The format + of a histogram depends on its width and height. Width and height depends + on user input or the default size (600x400). + +2010-05-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue290 - PDF format depends on the chart's aspect ratio. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Removed reading the system property "export.pdf.landscape" to adjust the + page format of a pdf. + + * src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: The page + format of a pdf now depends on the chart's aspect ratio. If width > height + the format will be landscape, otherwise the format will be portrait. + +2010-05-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue286 + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: Introduced an + epsilon environment to be more tolerant while comparing date objects. The + value of the current epsilon is 750ms. + +2010-05-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue290 + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Added chart width and chart height as new parameters for the pdf creation. + + * src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: Don't use + the maximum size of a pdf page to draw the chart but use the parameter + chart width and chart height. Scale the chart down if its size and/or + height exceed the maximum size of the pdf page - the original aspect + ratio keeps alive. + +2010-05-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue287 + + * src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: + Corrected the distance calculation of a 'Horizontal Profil' and adjusted + the gap detection according to these changes. + +2010-05-24 Ingo Weinzierl <ingo_weinzierl@web.de> + + Issue290 + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + The size of an svg export depends on the size chosen by the user (or the + default size if the user did not change the size) - it is not fixed + anymore. + +2010-05-21 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added queries for meshes using vectorvalues for "Horizontales Schnittprofil" + +2010-05-21 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added queries for meshes using vectorvalues for horizontalprofiles. + +2010-05-21 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added queries for meshes using vectorvalues for verticalprofiles. + +2010-05-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue269 + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: + Improved the directory handling for wms requests (directories are created + if there is no directory existing for the shapefiles; the content of + directories is deleted if the directory is existing). The shapefiles are + always generated again as well if there is an directory existing and it + contains files - we cannot know if these files are shapefiles that have + been created by our application. + +2010-05-21 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added queries for Meshes using Vectorvalues for TimeSeries. + +2010-05-21 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Integrated View MEDIAN.TIMESERIESFULLVECTORVALUE in queries for fetching + the data for Charts and ODV-Export on TimeSeriesPoints using vetcor data. + +2010-05-20 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue27 - Implemented odv export for vector data of timeseriespoints. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java: + Implemented the odv export for vector data on timeseriespoints.Therefore, + the getData(.) method for processing vector data has been removed. The + processing needs to take place after getData(.) fetched the data from + database, because it's not necessary to process vector data used for an + odv export (which is fetched via getData(.) as well). + +2010-05-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue27 - Vector data support for timeseriespoints finished. + + * doc/conf/products/timeseries/conf_timeseriespoint.xml: Adjusted the + relevant OutputState for timeseries with components of vector data. + + * src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java: A helper + class that converts vector data into a useful container for our chart + classes. Our chart classes just use one single data value of each Result + object - but there is a data value for each component of a vector. So we + need to split Result object into many Result objects - one for each vector + component. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java: + Inherits from TimeSeriesOutputStates. Currently, the only reason for this + class is to instantiate TimeSeriesVectorChart objects instead of + TimeSeriesChart objects. + + * src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java: This + chart type inherits from TimeSeriesChart. The only difference between + these two types is the way how to add datasets and how to create names for + series - most of the code is equal. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Timegap definitions have protected access now. + +2010-05-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/timeseries/conf_timeseriespoint.xml: Added the vector + value path. + +2010-05-18 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue27 - First step to provide vector values. + + * doc/conf/products/timeseries/conf_timeseriespoint.xml: Added a further + step to choose between vector or scalar values. + + TODO: Configure the parameterization path for working with vector values. + + * src/main/java/de/intevation/gnv/state/SwitchModeState.java: A new state + that allows users to choose between scalar or vector values. + + * src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/state/MeasurementState.java, + src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java, + src/main/java/de/intevation/gnv/state/SingleInputState.java: Adjusted + method signature of getDescriptionForInputData(.) - added the CallContext + as further parameter that is necessary to retrieve the current locale. + + * src/main/resources/lang/artifactMessages.properties, + src/main/resources/lang/artifactMessages_de_DE.properties, + src/main/resources/lang/artifactMessages_en.properties, + src/main/resources/lang/artifactMessages_de.properties: Added labels for + the user interface. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added queries for TimeSeriesPoints on Vectorvalues for TimeSeries. + +2010-05-17 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/cache/package.html, + src/main/java/de/intevation/gnv/state/cache/QueryObject.java: + Add more JavaDocs. + +2010-05-10 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/timeseries/timegap_definition.xml: + Added Documentation for the definition of gaps in TimeSeries on + TimeSeriesPoints. Also added the reference to the Place where the + definitions are taken. + +2010-05-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue260 (Implemented an odv export for 'Horizontales Schnittprofil') + + * doc/conf/products/horizontalprofile/conf_mesh_cross.xml: Added odv as + further export format of product type 'Horizontales Schnittprofil'. + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java: + Implemented an odv exporter for this product type. + + * src/main/java/de/intevation/gnv/exports/StringArrayKey.java: Added a + getKey() method to be able to retrieve the key of such objects. + +2010-05-07 Hans Plum <hans@intevation.de> + + * doc/conf/queries.properties: + Added a comment after implementing the admin tables for cache cleaner + +2010-05-06 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * contrib/mapserv, + contrib/gnv-wms: Renamed mapserv to gnv-wms relating to the configuration + changes in rev1068. + +2010-05-06 Hans Plum <hans@intevation.de> + + * doc/conf/conf.xml: + Adapted path to gnv-wrapper after changing it upstream. + +2010-05-06 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue264 & Issue268 (Removed bugs in the caching mechanism) + + * src/main/java/de/intevation/gnv/state/DefaultInputData.java: Implemented + hashCode() and equals(.) method. The hashCode() method is used while + creating hashes for caching elements (see StateBase). + + * src/main/java/de/intevation/gnv/state/StateBase.java: Improved hash + creation. The hashes are used as keys for the caching mechanism. The key + contains the uuid of the current artifact, the state id and a hash code + created by InputData elements. User input is stored in a TreeMap instead + of a HashMap, because the elements in a TreeMap are sorted. This is very + import for us, because we need a defined order to create equal hashes if + the input data elements, uuid and state id are equal. + + * src/main/java/de/intevation/gnv/state/MeasurementState.java: Replaced the + HashMap to store user input with a TreeMap which elements are sorted. + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java: + Added some more debug output that shows the usage of the cache. + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java: + Removed a critical bug that avoided using this product type if no cache + have been initialized. + + * src/main/java/de/intevation/gnv/state/OutputStateBase.java: Adjusted + getHash(.) method call. + +2010-05-04 Tim Englich <tim.englich@intevation.de> + + * doc/conf/conf.xml: + Do some Documentation of the Artifact-Database. + +2010-05-04 Tim Englich <tim.englich@intevation.de> + * src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java (appendSelectProducts): + BUGFIX: Added NULL-Check to Variable products to prevent NPEs if + no Products are configured to the FIS. + * src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java (parseProductFactories): + BUGFIX: Trim Classname to prevent ClassNotFound-Exceptions if the + Configuration contains whitespaces in the XML-Element which configures the + Artifact. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/maptemplates/layer_polygon.vm: Do not use point symbols to draw + polygons. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + RELEASE 1.0 + + * NEWS, Changes: Summarized changes. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue260 + + * doc/conf/products/horizontalprofile/conf_mesh_cross.xml: Deactivated odv + export for 'Horizontale Schnittprofile'. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/maptemplates/mapfile.vm: Defined a point symbol. + + * doc/conf/maptemplates/layer_linestring.vm, + doc/conf/maptemplates/layer_polygon.vm: Use point symbol for lines with a + yellow color. + + * doc/conf/maptemplates/layer_point.vm: Use point symbol with a yellow + color. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java, + src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java, + src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java, + src/main/java/de/intevation/gnv/statistics/Statistic.java, + src/main/java/de/intevation/gnv/statistics/Statistics.java, + src/main/java/de/intevation/gnv/utils/MetaWriter.java, + src/main/java/de/intevation/gnv/chart/ChartLabels.java, + src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java: + Removed trailing whitespace. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java: + Removed duplicated and unused imports. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/conf.xml: Replaced the path to the artifact database with a + relative path since the artifact-server is able to read relative pathes + for the database configuration. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/conf.xml: Changed the default directory of the artifact database. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * contrib/visualize-transitions.xsl: + Added XSL-Transformation to create an Graphic for the TransitionModels of + the Configuration. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + * doc/conf/conf.xml, + doc/conf/products/verticalprofile/conf_mesh.xml, + doc/conf/products/timeseries/conf_timeseriespoint.xml, + doc/conf/products/timeseries/conf_mesh.xml, + doc/conf/products/horizontalprofile/conf_mesh.xml: + Added missing Namespace declarations to Configurationfiles. + +2010-04-27 Tim Englich <tim.englich@intevation.de> + + ISSUE262 + + * doc/conf/products/horizontalprofile/conf_mesh_cross.xml: + Renamed StateIds because they were similar to the StateIds of + the product Horrizontal Profile. + This was done to prevent possible trouble using the Cachemechanism + which use the StateId as part of the Key. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue218 & Issue220 + + * doc/conf/conf.xml: Removed duplicated mapfile path configurations and + replaced absolute path definitions with relative ones. + + * src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java: + Changed XPath expression regarding the changes in conf.xml. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue6 + + * doc/conf/log.conf: Removed, because this file is not used. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue246 (Added missing units to the legend text.) + + * contrib/palette2polygonVM.xsl: Use description attribute from palette xml + file to create the legend text instead of from/to attributes. + + * doc/conf/maptemplates/flow-velocity_polygons.class.vm, + doc/conf/maptemplates/water-temperature_polygons.class.vm, + doc/conf/maptemplates/salinity_polygons.class.vm: Added units to the + legend text. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue251 + + * src/main/java/de/intevation/gnv/state/SingleInputState.java: Override feed + method for input validation. + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: New case: an + empty string is invalid. + +2010-04-26 Tim Englich <tim.englich@intevation.de> + + ISSUE252 + + * doc/conf/queries.properties: + Modified Query for selecting metadata for creating ZipFiles or publish + Layer as WMS so that it is possible to handle more than one Layer in one + request. + * doc/conf/products/layer/conf.xml: + Modified workflow so that it is possible to select more than one Layer + to download them as Shapefile or publish them as WMS. + * src/main/java/de/intevation/gnv/utils/MetaWriter.java + (writeLayerMeta), (writeLayerMeta), writeMetaFile): + modified Methods so that it is possible to generate a Metafile containing + more than one Layer in it. + * src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java: + Added Beanclass for temporal storing the Metadata which is required to + generate a Shapafile or an WMS-Layer. + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: + Modified the workflow so that it is possible to export multiple Layer + in one Zip-File or publish multiple Layers in one WMS. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue235 + + * doc/conf/conf.xml: Adapted the MapServer path in the configuration to call + the wrapper that exports the mapfile path (see below). + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue220 + + * contrib/mapserv: Added a very simple wrapper script to export the + mapfile path for MapServer. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java: + Inherit from HorizontalProfileMeshOutputState - both are used on meshes. + Subtitle creation for charts is the same here + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java: + Add newline strings after each point in the chart subtitle. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue138 + + * doc/conf/products/horizontalprofile/conf_mesh.xml: Splitted the + outputstates of horizontalprofiles into meshes and non-meshes to handle + the chart subtitle creation. + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java: + Outputstates for horizontal profiles. + +2010-04-23 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): + Fixed Bug Renaming Layer. Now the Title is set and the correct method + is called. + + * src/main/java/de/intevation/gnv/utils/MetaWriter.java (writeLayerMeta): + Put Node Title into XML-Fragment of an Layer so that it is + possible to change the name of an Layer. + + * doc/conf/maptemplates/layer_polygon.vm, + doc/conf/maptemplates/layer_point.vm, + doc/conf/maptemplates/layer_linestring.vm: + Modified Templates so that the Name of an layer is fetched from the Title + of the Layerbean. This is the same way as used in any other Templates. + +2010-04-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue217 + + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java: + Added the cell width of the interpolation to the constructor call of the + odv export. + + * src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java: + Corrected the depth calculation. + +2010-04-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue228 + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + The presentation of values contained in the statistic are language + specific, now. + +2010-04-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue217 + + * src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java: The + first column (cruise) in an odv export is filled with a static "GNVExport" + string. The second column (station) is filled with a generated string + "Station" concartinated with the index of the current coordinate + (e.g. "Station_1"). Both columns are written to odv only if the coordinate + changes - otherwise these strings are replaced by tabs. + +2010-04-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue233 + + * src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Expand + the range of the range axis (y-axis) manually if there is only one data + point or more data points with the same value. + +2010-04-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue243 + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Added an y-axis label for histogram creation. + + * src/main/resources/lang/artifactMessages.properties, + src/main/resources/lang/artifactMessages_de_DE.properties, + src/main/resources/lang/artifactMessages_en.properties, + src/main/resources/lang/artifactMessages_de.properties: Added the string + used as y-axis label in histograms. + +2010-04-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue231 + + * doc/conf/products/timeseries/conf_mesh.xml, + doc/conf/products/horizontalprofile/conf_mesh.xml, + doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml, + doc/conf/products/horizontalprofile/conf_mesh_cross.xml, + doc/conf/products/verticalprofile/conf_mesh.xml, + doc/conf/products/verticalprofile/conf_timeseriespoint.xml, + doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Switched + histogram parameter type 'binwidth' from integer to double. + +2010-04-21 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue229 + JFreeChart needs at least a lower and a different upper bounds to + calculate the range of the domain axis automatically. + + * src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Override + method that adjusts the range of domain and range axes. + + * src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: + Override method that adjusts the range of domain and range axes. If there + are more changes to be done in the future, caused by inheritance from + VerticalProfileChart, we should stop that and derive this class from + AbstractXYLineChart! + +2010-04-20 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java (initializeCache): + Initialize the CacheCline after the initialization of the ThematicDataCache. + + * src/main/java/de/intevation/gnv/state/StateBase.java (setHash): + Integrate an '#' as separator in the Hashvalue of an State to separate the + StateId unambiguously. This is required because a StateId can be a + Substring of an other StateId. + + * src/main/java/de/intevation/gnv/state/cache/QueryObject.java: + Bean for representing all database-Queries which are used for fetching + Data which is stoted in the ThematicDataCache. + + * src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java: + Specific CacheCleaner for cleaning the ThematicData-Cache. It extend the + CacheCleaner of the geo-backand and has the same configuration + possibilities. + +2010-04-20 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added Query for the CacheCleaner that it use to determin which Tables has + been updated. + +2010-04-20 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Removed a TODO from code -> TODO already implemented. + +2010-04-20 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue163: Workaround improved. + + * src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java: + Removed the bottom and left space between data area and plot border and + set a padding of 10px between each border of the whole area (containing + plot area, legend, chart title, etc). + +2010-04-20 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue163: Workaround implemented. + + * src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java: + Added a gap between data area and the plot border to avoid an amount of + cut axes labels (small labels aren't cut anymore, large labels will still + be cut). + + * src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java: Added some + necessary methods to set the first domain and range axis. + +2010-04-20 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue235 + + * doc/conf/maptemplates/mapfile.vm: Added a metadata section into the + mapfile template. + + * src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Read the URL + of the MapServer from configuration and feed the template with this + information. The URL is used in the metadata section for filling the 'wms + onlineresource' field. + +2010-04-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue152 + + * src/main/java/de/intevation/gnv/state/StateBase.java: + Added a date formatter for parsing dates from internal data objects. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Added the time interval of timeseries charts into the subtitle of this + charts. + +2010-04-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue226 + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Iterate through former states when searching for an input collections - + searching in the current state is not enough because it stores the current + input values only. + +2010-04-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue217 + + * doc/conf/products/verticalcrosssection/conf_mesh.xml: Added odv as + possible export format. + + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java: + Collect the necessary data for an odv export and trigger + VerticalCrossODVExport that writes this data as odv to an output stream. + + * src/main/java/de/intevation/gnv/math/Interpolation3D.java: Store + coordinates for each colum in a class variable. + + * src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java: + Write data used in 'Profilschnitten' to an odv file. + + TODO: The implementation is not finished yet. There are no cruises and + stations for 'Profilschnitte', so we need to clarify if this columns can + be skipped. + +2010-04-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Using unix line endings only. + +2010-04-17 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Removed trailing whitespace. + +2010-04-16 Tim Englich <tim.englich@intevation.de> + + ISSUE232 + + * doc/conf/meshwidth.xml: + Added missing Meshes to the Configuration and added more detailed + descriptions to the entries so they can be refred easier to the Meshes in + the System. + +2010-04-16 Tim Englich <tim.englich@intevation.de> + + ISSUE200 + + * doc/conf/queries.properties: + Modified Query for selecting available Layer for product Layer. + The table has an Column named Items which contains the Number of Items + that are in the Layer. Only Layer which are not empty should be + displayed. + +2010-04-15 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue175 + + * src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Read + percentage that defines the gap size in charts from system property + "chart.gap.percentage". The default value is 5 (percent) if this property + is not existing. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java (createODV), + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java (createODV): + Extract ODV-Generation into its own method that it is possible to override + it in subclasses. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java (getWMS): + Bugfix: Put some Code that is responsible for Synchonization into the + final-block to prevent that the lock is not released. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/layer/conf.xml, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java : + Integrated the possibility to change the Title of an Layer in Product Layer. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java: + Removed obsolet SuppressWarnings-Annotations. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/package.html: + Added more Javadoc. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/transition/package.html, + src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java, + src/main/java/de/intevation/gnv/transition/TransitionFactory.java, + src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java: + Added more Javadoc. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/transition/package.html: + Added more Javadoc. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java, + src/main/java/de/intevation/gnv/state/MinMaxDateState.java, + src/main/java/de/intevation/gnv/state/MinMaxState.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java, + src/main/java/de/intevation/gnv/state/OutputStateBase.java, + src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java, + src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java : + Removed obsolet SuppressWarnings-Annotations. + +2010-04-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/package.html: + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java : + Added more Javadoc. + Removed obsolet TODO-Flags. + +2010-04-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java: + * src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java (MetaDataServiceException): + * src/main/java/de/intevation/gnv/artifacts/services/package.html: + Added more Javadoc. + +2010-04-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/layer/package.html, + src/main/java/de/intevation/gnv/layer/LayerArtifact.java: + Added more Javadoc. + +2010-04-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/OutputStateBase.java (putInputData): + BUGFIX: Chartresults where stored in Cache using null-Value as Key. + This happend because the setHash-method was not called in Method + putInputData of this Class. + This causes that the Data was fetched every time from the Database when + out was called and twice during the intialisationprocess of the State. + +2010-04-12 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/fis/product/package.html, + src/main/java/de/intevation/gnv/artifacts/fis/package.html, + src/main/java/de/intevation/gnv/artifacts/cache/package.html, + src/main/java/de/intevation/gnv/artifacts/context/package.html, + src/main/java/de/intevation/gnv/artifacts/ressource/package.html, + src/main/java/de/intevation/gnv/artifacts/package.html, + src/main/java/de/intevation/gnv/state/exception/package.html, + src/main/java/de/intevation/gnv/state/package.html, + src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/package.html, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/package.html, + src/main/java/de/intevation/gnv/state/profile/horizontal/package.html, + src/main/java/de/intevation/gnv/state/profile/vertical/package.html, + src/main/java/de/intevation/gnv/state/timeseries/package.html, + src/main/java/de/intevation/gnv/state/describedata/package.html, + src/main/java/de/intevation/gnv/statistics/exception/package.html, + src/main/java/de/intevation/gnv/statistics/package.html, + src/main/java/de/intevation/gnv/histogram/package.html, + src/main/java/de/intevation/gnv/profile/horizontalcrosssection/package.html, + src/main/java/de/intevation/gnv/profile/verticalcrosssection/package.html, + src/main/java/de/intevation/gnv/profile/horizontal/package.html, + src/main/java/de/intevation/gnv/profile/vertical/package.html, + src/main/java/de/intevation/gnv/utils/exception/package.html, + src/main/java/de/intevation/gnv/utils/package.html, + src/main/java/de/intevation/gnv/chart/exception/package.html + src/main/java/de/intevation/gnv/chart/package.html, + src/main/java/de/intevation/gnv/exports/package.html, + src/main/java/de/intevation/gnv/wms/package.html, + src/main/java/de/intevation/gnv/timeseries/gap/package.html, + src/main/java/de/intevation/gnv/timeseries/package.html, + src/main/java/de/intevation/gnv/jfreechart/package.html: Added package + descriptions for the different packages. + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java, + src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java, + src/main/java/de/intevation/gnv/chart/ChartLabels.java: Added missing + class descriptions. + +2010-04-12 Tim Englich <tim.englich@intevation.de> + + ISSUE 215 msg1189 + + * src/main/java/de/intevation/gnv/exports/ODVExport.java (writeData): + Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601 and + manipulate the Values that they are in the correct Format. + This is nessessary because of the definitions of Timeseries in ODV-Exports. + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java (getStartTime): + Modified Format of the TimeStamp of the Starttime of TimeSeries in that + case that it does not contains the values for the seconds. + +2010-04-12 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java, + src/main/java/de/intevation/gnv/state/DefaultInputValue.java, + src/main/java/de/intevation/gnv/state/SingleInputState.java, + src/main/java/de/intevation/gnv/state/StateFactory.java, + src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/state/MeasurementState.java, + src/main/java/de/intevation/gnv/state/InputData.java, + src/main/java/de/intevation/gnv/state/MinMaxState.java, + src/main/java/de/intevation/gnv/state/DefaultExportMode.java, + src/main/java/de/intevation/gnv/state/OutputStateBase.java, + src/main/java/de/intevation/gnv/state/DefaultInputData.java, + src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java, + src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java, + src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java, + src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java, + src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java, + src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java, + src/main/java/de/intevation/gnv/math/AreaInterpolation.java, + src/main/java/de/intevation/gnv/math/GridCell.java, + src/main/java/de/intevation/gnv/transition/Transition.java, + src/main/java/de/intevation/gnv/utils/ExclusiveExec.java, + src/main/java/de/intevation/gnv/chart/DefaultHistogram.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java, + src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java, + src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java, + src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java, + src/main/java/de/intevation/gnv/exports/ChartExportHelper.java, + src/main/java/de/intevation/gnv/exports/DefaultExport.java, + src/main/java/de/intevation/gnv/exports/ODVExport.java, + src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java, + src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java: Removed + JavaDoc compiler warnings caused by broken references and fields without + content. + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/statistics/StatisticSet.java, + src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java, + src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java, + src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java, + src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java, + src/main/java/de/intevation/gnv/statistics/Statistic.java, + src/main/java/de/intevation/gnv/statistics/Statistics.java, + src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java: Added + more Javadoc. + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/exception/StateException.java, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java, + src/main/java/de/intevation/gnv/transition/DefaultTransition.java, + src/main/java/de/intevation/gnv/transition/TransitionFactory.java, + src/main/java/de/intevation/gnv/transition/TransitionBase.java, + src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java, + src/main/java/de/intevation/gnv/transition/Transition.java, + src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java: + Added Javadoc. + +2010-04-09 Tim Englich <tim.englich@intevation.de> + + ISSUE 215 msg1170 + + * src/main/java/de/intevation/gnv/exports/ODVExport.java : + Modified ODV-Export that it is possible to integrate an Timestamp which + identifies a TimeSeries. + The additional Column will only be integrated if the given Timestamp has + an value and is not null. + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java (getStartTime): + Integrated Method for lookup the Starttimevalue of an TimeSeries to use it + in ODV-Exports. If no Startdate is stored (e.g. if this Methos is called + by an verticalProfileOutputstate) null will be returned an put into the + ODV-Export. + * doc/conf/products/timeseries/conf_mesh.xml: + Added valuename for the Timeinterval to fetch the Starttime of an TimeSeries + from the inputData to integrate it into the ODV-Export. + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java: + Added more Javadoc. + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java, + src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java, + src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java, + src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java: Added + more Javadoc. + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java, + src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java, + src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java, + src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java, + src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java: + More Javadoc. + +2010-04-08 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/math/Interpolation3D.java, + src/main/java/de/intevation/gnv/math/package.html, + src/main/java/de/intevation/gnv/math/AreaInterpolation.java, + src/main/java/de/intevation/gnv/math/AttributedXYColumns.java, + src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java: + Finished the javadoc of the math package. + +2010-04-08 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/math/ConstantFunction.java, + src/main/java/de/intevation/gnv/math/L1Comparator.java, + src/main/java/de/intevation/gnv/math/HeightValue.java, + src/main/java/de/intevation/gnv/math/Interpolation2D.java, + src/main/java/de/intevation/gnv/math/XYColumn.java, + src/main/java/de/intevation/gnv/math/LinearFunction.java, + src/main/java/de/intevation/gnv/math/GridCell.java, + src/main/java/de/intevation/gnv/math/AttributedXYColumns.java: + Added more javadoc. + + * src/main/java/de/intevation/gnv/utils/FileUtils.java, + src/main/java/de/intevation/gnv/utils/MetaWriter.java, + src/main/java/de/intevation/gnv/utils/DistanceCalculator.java, + src/main/java/de/intevation/gnv/utils/MapfileGenerator.java, + src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java, + src/main/java/de/intevation/gnv/utils/Pair.java: + Removed trailing whitespace + +2010-04-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/utils/FileUtils.java, + src/main/java/de/intevation/gnv/utils/DistanceCalculator.java, + src/main/java/de/intevation/gnv/utils/InputValidator.java, + src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java, + src/main/java/de/intevation/gnv/utils/ExclusiveExec.java, + src/main/java/de/intevation/gnv/utils/MetaWriter.java, + src/main/java/de/intevation/gnv/utils/MapfileGenerator.java, + src/main/java/de/intevation/gnv/utils/WKTUtils.java, + src/main/java/de/intevation/gnv/utils/StringUtils.java, + src/main/java/de/intevation/gnv/utils/Pair.java, + src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Added Javadoc. + + * src/main/java/de/intevation/gnv/utils/ArtifactFactoryUtilities.java: + Removed. + +2010-04-08 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Removed trailing whitespace. + + * src/main/java/de/intevation/gnv/math/ConstantXYDepth.java, + src/main/java/de/intevation/gnv/math/LinearMetrics.java, + src/main/java/de/intevation/gnv/math/QueriedXYDepth.java, + src/main/java/de/intevation/gnv/math/L1Comparator.java, + src/main/java/de/intevation/gnv/math/Metrics.java, + src/main/java/de/intevation/gnv/math/LinearToMap.java, + src/main/java/de/intevation/gnv/math/LinearFunction.java, + src/main/java/de/intevation/gnv/math/Interpolator.java: + Added more javadoc. + +2010-04-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java, + src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Added Javadoc. + +2010-04-07 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Removed trailing whitespace. + +2010-04-07 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java, + src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java, + src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java, + src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java, + src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java, + src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java, + src/main/java/de/intevation/gnv/raster/IsoProducer.java: + Finished Javadoc of the raster package. + +2010-04-06 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: More javadoc. + +2010-04-06 Tim Englich <tim.englich@intevation.de> + + ISSUE215: Rows will not be merged to one Single Row if their values are identical. + + * src/main/java/de/intevation/gnv/exports/ODVExport.java (writeData): + Replaced the StringArray using as Key against the new Class StringArrayKey. + This was nessesarry tp detect Rows with same Values joining them to one + Row. + * src/main/java/de/intevation/gnv/exports/StringArrayKey.java (StringArrayKey): + Added new Class for representing the Key of an StringArray not using the + Hash of the Array but using the hash of the values which are stored in + the Array. + +2010-04-06 Tim Englich <tim.englich@intevation.de> + ISSUE213: Wrong Geometrytype used for the generation of an Layer with + Multipolygon-Geometries + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): + Integrated lookup of the Geometrytypes using a separat SQL-Statement. + Also added a separat Function for determining the Defaulttemplate for the + Mapfile-Generation. + * src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java (writeDataToFile): + Changed Methodsignature. Now it's possible to put the Geometrytype which + is required to generate the Layer and not use the Geometrytype of the + first Geometry of the Resultvalues. + This was nessessary because we can have several kinds of geometrytypes + (e.g. MultiPolygons and Polygons) in one Layer. In that case we have to + use the Multi* (e.g. MultiPolygon) as Geometrytype. + * doc/conf/queries.properties: + Added Query for determining the geometryType of a Layer. + +2010-04-06 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: Fixed vim modeline. + + * src/main/java/de/intevation/gnv/math/L1Comparator.java: Moved + L1 code here. + + * src/main/java/de/intevation/gnv/math/Point2d.java: Removed dead + inverse L1 code. Added Javadoc. + + * src/main/java/de/intevation/gnv/math/IJKey.java: Added Javadoc. + +2010-04-06 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/test/java/de/intevation/gnv/artifacts/TestCallContext.java, + src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java: + Fix to let the test mockups implement their interfaces. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java, + src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java, + src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java: Added + JavaDoc. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/exports/Export.java, + src/main/java/de/intevation/gnv/exports/ChartExportHelper.java, + src/main/java/de/intevation/gnv/exports/ODVExport.java: Repaired JavaDoc. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/chart/Chart.java, + src/main/java/de/intevation/gnv/chart/XMLChartTheme.java, + src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java: + Added missing vim control comments. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java, + src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java, + src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java, + src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java, + src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java, + src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java: + Added and repaired JavaDoc. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java: Added + and repaired JavaDoc. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java, + src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java, + src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java, + src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java, + src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java: Added + JavaDoc for this package. + +2010-03-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/chart/XMLChartTheme.java, + src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java, + src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java, + src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java, + src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java, + src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Corrected + JavaDoc errors. + +2010-03-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue214 + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: Added code for + validating polygons and linestrings. The input type needs to be 'polygon' + or 'linestring'. + + * doc/conf/products/horizontalcrosssection/conf_mesh.xml: Changed the input + type of the wkt string from 'string' to 'polygon'. + + * doc/conf/products/verticalcrosssection/conf_mesh.xml: Changed the input + type of the wkt string from 'string' to 'linestring'. + +2010-03-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/ExtendedInputData.java: Added a + method splitParameter() to retrieve the parameter ids as array (analog to + splitValue() in DefaultInputData). + +2010-03-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue210 (First work for saving relation between selected measurement and + the parameter it belongs to completed) + + * src/main/java/de/intevation/gnv/state/DefaultInputData.java: Added a + further constructor and changed the visibility of the separator character + used by this class to public. + + * src/main/java/de/intevation/gnv/state/ExtendedInputData.java: This class + enhances DefaultInputData and has a further field storing a string + parameter. This is necessary to save the information about the + relation between selected measurement and the parameter it belongs to. + + * src/main/java/de/intevation/gnv/state/MeasurementState.java: Little + changes in the data of the describe document. The value for the checkboxes + are composed of the measurement id and the parameter id separated by a + semicolon. Furthermore the incoming document of a feed call is parsed in + this class to save the relation between selected measurement and the + parameter it belongs to. ExtendedInputData class is used as storage. + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: Changed the + method signatures of all methods to static for using it without + instantiating an object of this class. + +2010-03-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue212 (Improved input validation) + + * src/main/java/de/intevation/gnv/state/MinMaxDateState.java: Improved date + input validation. The chosen date needs to be in range between upper and + lower date, otherwise an error message is displayed and the user needs to + correct his choice. + + * src/main/java/de/intevation/gnv/utils/InputValidator.java: Added a new + method to validate a given date being in range between an upper and a + lower date bound. + + * src/main/resources/lang/artifactMessages.properties, + src/main/resources/lang/artifactMessages_de_DE.properties, + src/main/resources/lang/artifactMessages_en.properties, + src/main/resources/lang/artifactMessages_de.propertie: Added error + messages for failures while date validation. + +2010-03-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue192 + + * src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Added an + offset of 15px between the right data area and the right axis. Long axes + labels near the right border aren't cut on this way. + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/package.html: New + Added package description with text 'DOCUMENT ME!'. + +2010-03-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Each TimeSeriesArtifacts stores information about its TimeGapDefinitions, + otherwise we are not able to continue with an artifact after a restart of + the artifact server. + + TODO: The information about TimeGapDefinitions are equal for each type of + artifacts. It would be better to store these definitions on a central + place (i.e. see ChartTheme configuration). + + * src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java: Implements + Serializable. + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>' + + find -name \*.java | \ + xargs sed -i \ + -e 's/@author[ ]\+\([^(<]\+\)[<(]\([^>)]\+\)[>)]/@author <a href="mailto:\2">\1<\/a>/g' \ + -e 's@[ ]\+</a>@</a>@g' + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java, + src/main/java/de/intevation/gnv/**/*.java: + Ordered imports. Removed needless imports. Removed empty headers. + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/test/java/de/intevation/gnv/**/*.java, + src/main/java/de/intevation/gnv/**/*.java: + Removed trailing whitespace. + find -name \*.java | xargs sed -i 's/[ \t]\+$// + +2010-03-26 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added Query for fetching the Series and Instantaneouspoints of Series using + an WKT as the Geometryvalue or using the Values set by the Regionfilter + to define the Region of Interest. + + * doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: + Modified the Workflow for Verticalprofiles on Instantaneouspoints so + that the Inputvalues of the Mapviewer-Interface take effect. E.g. + The Regionfilter will not be displaied if an Polygon was send by the + Mapviewer. Also integrated the Regionfilter to the Workflow. + +2010-03-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue164 + + * src/main/java/de/intevation/gnv/utils/ExclusiveExec.java: New. This class + can be used to synchronize threads with a given key. To use this + synchronization, you just have to do something like the following: + UniqueKey token = ExclusiveExec.INSTANCE.acquire(key); + // your code to be synchronized + ExclusiveExec.INSTANCE.release(token); + A thread needs to wait if there is already a thread with the given key + which has acquired a token. Threads with a different key don't need to + wait for this thread. + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Synchronize shapefile writing of artifacts which have the same uuid. + + * src/main/java/de/intevation/gnv/utils/FileUtils.java: Added a function to + delete the content of a directory. + +2010-03-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue211 (Applied patch) + + * src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Removed + race-condition when trying to access the index of the next line color used + in chart. + +2010-03-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/utils/MetaWriter.java: Avoid danger to get + a NullPointerException if no time to live is served by CallContext. + +2010-03-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue197 + + * src/main/java/de/intevation/gnv/utils/MetaWriter.java: Fetch time to live + of an artifact from CallContext and put it into meta document. + +2010-03-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/exports/Export.java, + src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java, + src/main/java/de/intevation/gnv/exports/ChartExportHelper.java, + src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java, + src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java, + src/main/java/de/intevation/gnv/exports/DefaultProfile.java, + src/main/java/de/intevation/gnv/exports/DefaultExport.java, + src/main/java/de/intevation/gnv/exports/ODVExport.java: Added javadoc and + turned javadoc author tag into a 'mailto' form. + +2010-03-24 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/histogram/HistogramHelper.java: Removed a + method which was commented out, added javadocs and turned javadoc author + tag into a 'mailto' form. + +2010-03-24 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/layer/LayerArtifact.java: Removed empty + comment lines at the beginning of the class and turned javadoc author tag + into a form which displays a mailto link in html. + +2010-03-24 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/wms/LayerInfo.java: Added javadoc in wms + package. + +2010-03-24 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/chart/Chart.java, + src/main/java/de/intevation/gnv/chart/DefaultHistogram.java, + src/main/java/de/intevation/gnv/chart/XMLChartTheme.java, + src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java, + src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java, + src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java, + src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java, + src/main/java/de/intevation/gnv/chart/AbstractHistogram.java, + src/main/java/de/intevation/gnv/chart/ChartLabels.java, + src/main/java/de/intevation/gnv/chart/AbstractChart.java, + src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java, + src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java, + src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Added + and repaired javadoc in chart package. + + * src/main/java/de/intevation/gnv/chart/Insets.java, + src/main/java/de/intevation/gnv/chart/ChartStyle.java: Removed these + classes, because they aren't used anymore. + +2010-03-23 Tim Englich <tim.englich@intevation.de> + + * src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml, + src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml: + Switched to valid Timestamps to enable testing ODV-Output. + +2010-03-23 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/exports/ODVExport.java: + Added new Export-Class which will generate the special ODV-Format. + This one is required because we have to switch the Format from a Rowbased + Representation to a Columnbased. + This meas that for each Parameter which was requested two additonal Columns, + one for the Parametervalue and one for the Quality, has to be added to the + Export. This differs to the "normal" CSV-Export. + + * src/main/java/de/intevation/gnv/exports/DefaultExport.java (collector): + Switched Member from private to protected to make it available from + extending Classes. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Modified the Colums and the Column-headers and Columns-names for the ODV-Export + that all required Data is put into the Document in the right order and the + right nameing. + Switche to the NEW ODVExport-Class to use it for all ODV-Exports. + + * doc/conf/queries.properties: + Modified the Queries for the ODV-Export that all required Informations are + fetched from the Database. + +2010-03-22 Tim Englich <tim.englich@intevation.de> + + * src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_feed.xml, + src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_feed.xml: + Switched to valid Timestamps to enable testing CSV-Output. + +2010-03-22 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/StateBase.java (feed): + Bugfix: The Description of an InputData-Object will now only be fetched if + the Name of the data of the Current State is equal to the Name of the + InputData-Object. This Fix prevent some Exceptions that happen if the + Query need som Inputdata which was not set at that moment. + +2010-03-22 Tim Englich <tim.englich@intevation.de> + + ISSUE 122 + + * src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java: + Added all required Columns for the CSV-Export. Integrated own + Columnspecifications for the different Kinds of Profiles (TimeSeriesPoints, + Mesh, InstantaneousPoint). + + * doc/conf/queries.properties: + Manipulated the Queries for fetching the Data for generating the CSV-Output + for all kinds of Vertical- and Horizontalprofiles in that way that now all + required Columns were included. + + * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Removed deprecated TODO-Flags. + +2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue209 + + * doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm: + Improved the template configuration for the given changes in rev814. + + * src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Moved the + settings of the format used to write floating point numbers into the + shapefile description column into a static block of this class to avoid + doing this each time converting a double value to a description. + +2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue209 + + * src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Added a + further column in the isolines shapefile to store a description for each + line. This description column contains the double value with three maximum + fraction digits. This is a workaround to adjust the rendering of double + values which cannot be adjusted in MapServer at the moment. MapServer + would display all fraction digits contained in the shapefile causing very + long labels. + +2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue208 (Added a cleanup mechanism to do some things before exporting an + artifact) + + * src/main/java/de/intevation/gnv/state/State.java: Added a cleanup method + to remove special data stored at this state while processing an + 'out'-target. + + * src/main/java/de/intevation/gnv/state/StateBase.java: Default + implementation of this cleanup method - nothing is done here so far. + Override this method in states which should remove data before being + exported. + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Overrides this cleanup method to remove the current shapefile path. + + * src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java: + Call cleanup method of the current state if the cleanup method of this + artifact itself is called. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/horizontalprofile/conf_mesh_cross.xml: + Modified the Workflow for "Horizontales Schnittprofil" so that the Inputvalues + of the Mapviewer-Interface take effect. E.g. The Regionfilter will not be + displaied if an Polygon was send by the Mapviewer. Also the Input of an + LineString will be skipped if a LineString was send by the MapViewer. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/lang/artifactMessages_de*.properties: + Added new German resources for fis_marinefeatures according to msg1067 + of Issue2005. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: + Added Support of Layers which are Joined from two Tables. + Only the Columns of the first Table will be inserted to prevent Namecollisions + of Attributenames. + + * doc/conf/queries.properties: + Added full qualified Columnname to prevent Namecolliosions in SQL-Statement + for querying Layer-Data if two Tables are Joined to one Layer. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/lang/artifactMessages*.properties: + Added Ressources for new FIS Marine Features. + + * doc/conf/conf.xml: + + ISSUE 205 + + Integrated FIS Marine Features with Product Layer into the System. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + + ISSUE92 + + Integrated Column BAND for Query of Layers which belong to a FIS. + The Displayname of an Layer is now TITLE - LAYER_NAME - BAND + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/verticalcrosssection/conf_mesh.xml: + Modified the Workflow of the verticalcrosssection that the Geometry is now + copied to the Inpuvalues if it comes from the Mapviewer-Interfacecall. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/horizontalcrosssection/conf_mesh.xml: + Modified the Workflow for Horizontalcrosssections so that the Inputvalues + of the Mapviewer-Interface take effect. E.g. The Regionfilter will not be + displaied if an Polygon was send by the Mapviewer. Also the Input of an + Polygon will be skipped if a Polygon was send by the MapViewer. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/horizontalprofile/conf_mesh.xml: + Modified the Workflow for Horizontalprofiles so that the Inputvalues + of the Mapviewer-Interface take effect. E.g. The Regionfilter will not be + displaied if an Polygon was send by the Mapviewer. Also the Input of an + Point will be skipped if a Point was send by the MapViewer. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/verticalcrosssection/conf_mesh.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-Interface + take effect. E.g. The Regionfilter will not be displaied if an Polygon + was send by the Mapviewer. Also the Input of an LineString will be skipped + if a LineString was send by the MapViewer. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Bugfixes: Fixed the Query for Parameters in Timeseries and + VerticalProfiles in Meshes. Now all Parts of an Mesh will be used and not + only the last one. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/timeseries/conf_mesh.xml, + doc/conf/products/verticalprofile/conf_mesh.xml: + Modified the Workflow for Verticalprofiles and Timeseries on Meshes in + that case that the Inputvalues of the Mapviewer-Interface take effect. + E.g. The Regionfilter will not be displaied if an Polygon was send by + the Mapviewer. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java: + Added an new State wich will handle the Display of Coordinatevalues and + fetch given Inputparameters from the Presettings and copy them to + the InputValues. + This new Class is necessary because we can have Pointobjects given in + the Presettings which should be used to fetch all MeshPoints within a + given Distance aroud the Coordinate and display its Coordindatevalues. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/utils/InputValidator.java (getPointValue): + Integrated handling of WKT-Strings for Points to extract Points from + a given Inputstring. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/StateBase.java (generateFilterValuesFromInputData): + Improvement: Values of Type Geometry which are Points will be + prepared as Regions for DB-Query. + +2010-03-16 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue199 + + * src/main/java/de/intevation/gnv/state/MeasurementState.java: Changed the + describe document creation a bit. The describe document will now have a + section for measurement/parameter with each parameter in an own + xform:select node which contains different xform:item nodes for each + measurement for this parameter. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/layer/conf.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-Interface + take effect. E.g. The Regionfilter will not be displaied if an Polygon + was send by the Mapviewer. + +2010-03-16 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (fetchData): + BugFix: Fixed NPE using the Presettings-Object without given Presettings. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/verticalprofile/conf_timeseriespoint.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-Interface + take effect. E.g. The Regionfilter will not be displaied if an Polygon + was send by the Mapviewer. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added Query for fetching the TimeSeriespoint using an WKT as the + Geometryvalue to define the Region of Interest. + + * doc/conf/products/timeseries/conf_timeseriespoint.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-Interface + take effect. E.g. The Regionfilter will not be displaied if an Polygon + was send by the Mapviewer. + +2010-03-15 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue120 + + * src/main/java/de/intevation/gnv/state/StateBase.java: New method + implemented which searches for a specific parameter by its name in the + current state and in all parent states. Null is returned if no parameter + could be found with this name, otherwise the InputData object. + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java: + Display that point in chart subtitle which have been entered by the user. + + * src/main/java/de/intevation/gnv/utils/WKTUtils.java: Added a new method + to transform a Point object to a user-friendly formatted string. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * doc/conf/products/verticalprofile/conf_timeseriespoint.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-Interface + take effect. E.g. The Regionfilter will not be displaied if an Polygon + was send by the Mapviewer. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added Query for fetching the TimeSeriespoint using an WKT as the + Geometryvalue to define the Region of Interest. + + * doc/conf/products/timeseries/conf_timeseriespoint.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-Interface + take effect. E.g. The Regionfilter will not be displaied if an Polygon + was send by the Mapviewer. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Integrated and modified Queries for Timeseries on Meshes. + + * doc/conf/products/timeseries/conf_mesh.xml: + Modified the Workflow so that the Inputvalues of the Mapviewer-interface + take effect. E.g. The regionfilter will not be displaied if an Polygon + was send by the Mapviewer. Also the State for typing an Point will be + skipped an the Geometry of the Mapviewercall will be used. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java: + Revoke Changes of r771. The Switch if the QueryId is null has several + Effects which causes NPEs in other Parts of this Module. + So I removed the Changes of r771 and override the effected Methods in + DefaultAutoResumeState. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: + Integrated the handling of AutoResumeStates into the initialization + Process of an Artifact. After an Initialization of an Artifact it will be + proved if the Current State is an AutoResumeState. If it is the next valid + state in the sequence will be set to the current State. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java, + src/main/java/de/intevation/gnv/state/AutoResumeState.java: + Added new Interface and its DefaultImplementation to the Project. + This Interface will mark States which can be handled automatically without + any interaction from the User. + So it is possible to fork a Sequence e.g. by given Constructorparameters + of an Artifact. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/StateBase.java (feed): + Bugfix: We have States which don't have tor Query Data from a Database + for its Description. So now the Description will only be determined if a + Query was configured to this State. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java (setup): + Bugfix: Corrected C&P-Error in the Setup-Method of the PreSettingsTransferState + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/utils/InputValidator.java (isInputValid): + Added Objecttype Geometry for the Validation of Inputdata. Geometry will + be validated in the same way as Pointobjects. + +2010-03-15 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue198 + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Read the layer title which might have been adjusted by the user and store + it in the CallContext object to be available in MetaWriter. + + * src/main/java/de/intevation/gnv/utils/MetaWriter.java: Write the layer + title stored in the CallContext object into meta.xml file. + + * src/main/java/de/intevation/gnv/wms/LayerInfo.java: Added a further + attribute named 'title' to adjust the layer name. + + * src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Read layer + title from meta.xml file. The uuid is used as layer title if no title is + given. + + * doc/conf/products/horizontalcrosssection/conf_mesh.xml: Added a string + input parameter in wms output mode to adjust a wms layer's title. + + * doc/conf/maptemplates/horizontalcrosssection_salinity.vm, + doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm, + doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_water-levels.vm, + doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm, + doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm, + doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm: + Read title attribute from LayerInfo object for filling the layer name in + template files. The title can be adjusted by the user himself, but the + shapefiles are stored in the path {shapefile_path}/{uuid}/xxx.shp. + +2010-03-15 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (fetchData): + Integrated lookup of the Geometry which was put to the Artifact during + the Instantiation (e.g. was send from the MapViewer to the GNV). + +2010-03-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (fetchColumns): + Integrated an Method for fetching all required Columns for an given Layer + and put them into the Query witch will load the Layerdata from the + Database. + + * doc/conf/products/layer/conf.xml: + Added an Configuration-Element to determine the Query which should be used + to Query the Columns of a choosen Layer. + + * doc/conf/queries.properties: + Manipulated the Queries for fetching the Layerdata in that way that it is + possible to put the requested-Columns into it using the ?-Syntax. + +2010-03-12 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java (writeDataToFile): + Added generic Export for all Columns which are in an ResultValue. + The first Column must be the Geometryvalue. all other Columns will be added + to the Shapefile using the defined Attribute-Class. + +2010-03-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue201 + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: + Use a better key - hash served by getHash() from StateBase - to put + chart results into cache. + +2010-03-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * doc/conf/products/timeseries/conf_timeseriespoint.xml: Use MinMaxDateState + to handle date input instead of MinMaxState. + + * src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java: Added + EXCEPTION_NO_INPUT key used for a lookup in resource bundles. + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java + src/main/java/de/intevation/gnv/state/OutputStateBase.java + src/main/java/de/intevation/gnv/state/StateBase.java, + src/main/java/de/intevation/gnv/state/MinMaxState.java, + src/main/java/de/intevation/gnv/state/State.java: Return localized + error messages as xml documents if something failed while feeding the + current artifact/state. These error messages are used to be displayed in + the user interface. There are two different error messages at the moment - + for general error messages related to server errors and a message invalid + user input. The difference between these messages is their location in the + xml document. Each message type is created with a separate method in + ArtifactXMLUtilities (createExceptionReport() and createInputException()). + The intention to separate these message types is to display them on + different places in the user interface. + + * src/main/java/de/intevation/gnv/state/MinMaxDateState.java: New state to + handle date input. + + * src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java: Converted + some class methods into static methods and added a new method to create an + xml document which contains an error message for invalid user input. + + * src/main/resources/lang/artifactMessages.properties, + src/main/resources/lang/artifactMessages_de_DE.properties, + src/main/resources/lang/artifactMessages_en.properties, + src/main/resources/lang/artifactMessages_de.properties: Added text for + error messages. + +2010-03-09 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Modified the Query for the lookup of the Tablename and the Whereclaus to + a choosen Layer. Now also the Templateid containing the Mapservice-ID and + the Layer-Id was added to the Query. + + * src/main/java/de/intevation/gnv/utils/MapfileGenerator.java (templateExists): + Add a method which will return if a given Template exists. + this could be used for determining if a specialized Template for a Layer + is given or the Default one should be used. + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): + Integrate lookup for MapFileTemplate for the different Layer. + If a special Template should be used it must be storde according to the + following Syntax in the Folder which contain all other Mapfile-Templates. + + layer_{ID_MAPSERVICE}_${ID_LAYER} e.g. layer_BSH_IMS_CONTIS_Resources_2 + + If there is no Template matching the given Name the Defaulttemplates + layer_point, + layer_polygon or + layer_linestring + will be used. + +2010-03-09 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (out): + Integrated ExceptionHandling if no Data was found for the given Layer. + If no data couuld be retrieved from the Database an XMl-Exceptionreport + will be generated which must be analized by the Clients. + 2010-03-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> Issue186
--- a/gnv-artifacts/Changes Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/Changes Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,121 @@ +2010-06-30 RELEASE 1.1 + + NEW: + + * New product: 'Achsenparalleles Vertikalprofil' + * Support for products with vectorial parameters (#27) + * Integrated configuration section for sql-cache + * Statistics of ehcaches are available as MBean using JConsole + * N-Step back history for the parameterization + * ODV export for product 'Horizontales Schnittprofil' (#260) + * MANIFEST contains svn buildnumbers + + FIXES: + + * Corrected chart titles (#138, #120) + * Fixed defect range calculation for chart axes (#233) + * Corrected distance calculation in product 'Horizontalprofil' (#287) + * Fixed bin width calculation in histograms (#288) + * Changing width/height of charts ended in Stacktace (#294) + * Multi layer selection for product 'Layer' (#252) + * Renaming a layer just changes its title (#198), + * WMS layers now have a prefix 'GNV_' (#315, #314) + * Disabled multi selection for vectorial parameter (#299) + * Fixed broken transition chain of 'Achsenparalleler + Vertikalprofil' (#300, #318, #154) + * Fixed ODV export that created invalid odv files (#291) + * Added missing column for csv export for product 'Horizontales + Schnittprofil' (#284) + * Depths have negative values in odv exports (#230) + * Keep aspect ratio in PDF/SVG exports (#290) + * Fixed hash creation for caching elements (#264, #268) + * Further JavaDoc (#274) + * Fixed discrepancy in parameter matrix between parameter values and + description (#281) + * Fixed broken geometry clipping (#283) + * Fixed user input validation (#286, #289) + * Exception handling improvements (#188, #251, #265, #18, #269, #266) + + +2010-04-28 RELEASE 1.0 + + NEW: + + * Support for renaming wms layers (#198) + + * Support for Contis, Nauthis and Marine Features (#92, #205) + + * Support for exporting/importing artifacts (#208) + Before an artifact is exported, the cleanup() method is called to do + relevant things before an export. + + * Improved the matrix for parameter-measurement selection. The user can + choose between different depths only without relation to a specific + parameter (#210) + + * ODV export of a 'Profilschnitt' is possible now (#217) + + * The MapServer can be called without explicitly declaration of the + mapfile path (#235, #220). A wrapper script is used - located in the + cgi directory of apache - to export the mapfile path. + + * The transition model can be plotted as pdf or svg (#262) with the help + of an xsl sheet contained in the contrib directory. + + * Added a template mechanism for 'Layer' product. A default layer is + used if there is no specific template for a layer. + + * Support for MapViewer call. A MapViewer call feeds an artifact + initially with parameters that are used if the artifact reaches states + which require these parameters. These states are called + AutoResumeStates and leads the artifact to the next state immediately. + + + Fixed: + + * Date changes have no effect on wms output (#201) + * The subtitle of a horizontalprofile chart contains its beginning + coordinate (#120) + * Limit rendering of floating point numbers to 3 decimals in + MapServer (#209) + * Improvements respective to csv exports (#122) + * Improvements respective to odv exports (#215) + * Display the the time to live of an artifact / wms layer in gui (#197) + * Avoid race-conditions while chart creation (#211) + * Remove shapefile directories if an artifact reaches its end of + life (#164) + * Avoid cut axes labels with a gap between data area and chart + border (#192, #163) + * Wrong time intervals inserted by a user don't cause NPE anymore (#212) + * User inserted wkt string are validated (#214, #251) + * The geometry type used for wms publishing is fetched from database (#213) + * Improved gap detection in timeseries charts (#175) + * Selection of layer without items not possible anymore (#200) + * Improved chart creation for product type SST (#232) + * Added the station name to the subtitle of timeseries charts (#226) + * Added the timeinterval to the subtitle of timeseries charts (#152) + * Calculate the x-range of verticalprofile charts correct (#229) + * Calculate the y-range of horizontalprofile charts correct (#233) + * The width of a class in histograms can be specified by a floating + point number (#231) + * Added label for y-axes in histograms (#243) + * 'Profilschnitte' can be exported as png-image (#216) + * I18N support for statistic output (#228) + * Improved subtitles of horizontalprofile charts (#138) + * Removed a duplicated path to the mapfile in the configuration (#220) + * The layer selection in the product 'Layer' is no longer limited to + a single layer (#252) + * Added missing units into class templates that are displayed when + calling WMS GetLegendGraphic operation on 'Horizontalschnitten' (#246) + * The Restlet server uses the same log4j configuration as the rest of + the application (#6) + * Files used by artifact-database and cache are written to an own + directory - no longer into the conf directory (#218) + + +2010-03-08 RELEASE 0.5 + + 2010-01-27 RELEASE 0.4 New:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/LGPL.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it!
--- a/gnv-artifacts/NEWS Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/NEWS Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,52 @@ +2010-06-30 RELEASE 1.1 + + * Integration of a new product 'Achsenparalleles Vertikalprofil' + + * Support for vectorial parameters + + * Configuration supports the usage of an sql-cache + + * Evaluable cache statistics + + * Parameterization supports an N-Step-Back history + + +2010-04-28 RELEASE 1.0 + + NEW: + + * Support for renaming wms layers + + * Support for Contis, Nauthis and Marine Features + + * Support for saving/loading existing artifacts (e.g. for saving/loading + the current parametrization) + + * Improved the matrix for parameter-measurement selection. The user can + choose between different depths only without relation to a specific + parameter (#210) + + * Support for odv exports on 'Profilschnitten' (#217) + + * The MapServer can be called without explicitly declaration of the + mapfile path (#235, #220) + + * The configuration of the transition model can be plotted as svg or + pdf (#262) + + * Improved shapefile writing in 'Layer' product - write each column + retrieved by database into shapefile. + + * Improved the input validation. More specific error messages are + * displayed if the validation fails. + + * Support for an initial parameterization via MapViewer call. + + + +2010-03-08 RELEASE 0.5 + + 2010-01-27 RELEASE 0.4 Processing:
--- a/gnv-artifacts/bin/run.sh Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/bin/run.sh Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,11 @@ #!/bin/bash +# Copyright (c) 2010 by Intevation GmbH\ +# +# This program is free software under the LGPL (>=v2.1)\ +# Read the file LGPL.txt coming with the software for details\ +# or visit http://www.gnu.org/licenses/ if it does not exist.\ + DIR=`dirname $0`/.. CLASSPATH= for l in `find -name \*.jar -print`; do
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/contrib/gnv-wms Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,3 @@ +#!/bin/sh +export MS_MAPFILE=/opt/artifacts/mapfiles/mapfile.map +./mapserv-gp
--- a/gnv-artifacts/contrib/palette2polygonVM.xsl Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/contrib/palette2polygonVM.xsl Fri Sep 28 12:15:21 2012 +0200 @@ -1,4 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> + +<!-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. + + Author: Ingo Weinzierl (ingo.weinzierl@intevation.de) +--> + <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output @@ -10,7 +21,7 @@ <xsl:template match="range"> CLASS - NAME "<xsl:value-of select="./@from" /> - <xsl:value-of select="./@to" />" + NAME "<xsl:value-of select="./@description" />" EXPRESSION ("[CLASS]"="<xsl:value-of select ="./@index" />") STYLE COLOR "<xsl:value-of select="./@rgb" />"
--- a/gnv-artifacts/contrib/palette2qgis.xsl Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/contrib/palette2qgis.xsl Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- palette2qgis.xsl ================ + + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. + Transforms palette XML files into QGIS style files. Useful to display "Horizontalschnitte" with the right colors.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/contrib/visualize-transitions.xsl Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. + + Author: Sascha L. Teichmann (sascha.teichmann@intevation.de) +--> + +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.0"> + + <xsl:output method="text" encoding="UTF-8"/> + + <xsl:param name="base-dir">.</xsl:param> + + <xsl:template match="/"> + <xsl:text>digraph transition_model {
</xsl:text> + <xsl:apply-templates /> + <xsl:text>}
</xsl:text> + </xsl:template> + + <xsl:template match="artifact"> + <xsl:choose> + <xsl:when test="@xlink:href != ''"> + <!-- handle external artifacts --> + <xsl:variable name="path"> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="@xlink:href" /> + <xsl:with-param name="replace">${artifacts.config.dir}</xsl:with-param> + <xsl:with-param name="by" select="$base-dir" /> + </xsl:call-template> + </xsl:variable> + <xsl:for-each select="document($path)"> + <xsl:apply-templates select="/artifact"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <!-- handle internal artifacts --> + <xsl:text>subgraph </xsl:text><xsl:value-of select="@name"/> + <xsl:text> {
</xsl:text> + <xsl:text> label = "Artefakt: </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>";
</xsl:text> + <xsl:apply-templates mode="inside-artifact" select="./states/state"/> + <xsl:apply-templates mode="inside-artifact" select="./states/transition"/> + <xsl:text>}
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="state" mode="inside-artifact"> + <xsl:text> </xsl:text> + <xsl:value-of select="@id"/> + <xsl:text disable-output-escaping="yes" + > [ shape = "record" label=<<table border="0" cellborder="0" cellpadding="3"> + <tr><td align="center" colspan="2" bgcolor="black"><font color="white"></xsl:text> + <xsl:value-of select="@id"/> + <xsl:text disable-output-escaping="yes" + ></font></td></tr></xsl:text> + <xsl:apply-templates mode="inside-artifact" select="./inputvalues"/> + <xsl:text disable-output-escaping="yes" + ></table>>]</xsl:text> + <xsl:text>;
</xsl:text> + </xsl:template> + + <xsl:template match="inputvalue" mode="inside-artifact"> + <xsl:text disable-output-escaping="yes" + ><tr><td align="right"></xsl:text> + <xsl:value-of select="@name"/> + <xsl:text disable-output-escaping="yes" + ></td><td align="left"></xsl:text> + <xsl:value-of select="@type"/> + <xsl:text disable-output-escaping="yes" + ></td></tr></xsl:text> + </xsl:template> + + <xsl:template match="transition" mode="inside-artifact"> + <xsl:text> </xsl:text> + <xsl:value-of select="from/@state"/> + <xsl:text disable-output-escaping="yes"> -> </xsl:text> + <xsl:value-of select="to/@state"/> + <xsl:apply-templates mode="inside-artifact"/> + <xsl:text>;
</xsl:text> + </xsl:template> + + <xsl:template match="condition" mode="inside-artifact"> + <xsl:text> [ label="</xsl:text> + <xsl:value-of select="@inputvalue"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@operator"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@value"/> + <xsl:text>" ]</xsl:text> + </xsl:template> + + <xsl:template match="text()" mode="inside-artifact"/> + <xsl:template match="text()"/> + + <xsl:template name="string-replace-all"> + <xsl:param name="text" /> + <xsl:param name="replace" /> + <xsl:param name="by" /> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text,$replace)" /> + <xsl:value-of select="$by" /> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" + select="substring-after($text,$replace)" /> + <xsl:with-param name="replace" select="$replace" /> + <xsl:with-param name="by" select="$by" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> +
--- a/gnv-artifacts/doc/conf/conf.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/conf.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,10 @@ <artifact-database> + <export-secret>BLABLABLBALBLABL</export-secret> <factories> <context-factory>de.intevation.gnv.artifacts.context.GNVArtifactContextFactory</context-factory> <artifact-factories> + <!-- All Artifactfactories which are available in this Database. + Each Artifactfactory represents one FIS. --> <artifact-factory name="fis_marnet" description="Factory to create an artifact to be used with the FIS Marnet" ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory> <artifact-factory name="fis_imis" description="Factory to create an artifact to be used with the FIS IMIS" @@ -38,8 +41,11 @@ 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-factory name="fis_marinefeatures" 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> + <!-- The Servicefactory which is responsible to handle MV-GNV-Interface-Calls --> <service-factory name="metadata" service="de.intevation.gnv.artifacts.services.MetaDataService" @@ -195,6 +201,14 @@ <parameter name="fisname" value="fis_modeldata"/> </parameters> </product> + <product name= "verticalcrosssectionparallel"> + <artifact-factory name="verticalCrossSectionMeshParallel" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata" + ttl="300000" artifact="de.intevation.gnv.profile.verticalcrosssection.VerticalCrossSectionMeshParallelArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory> + <parameters> + <parameter name="sourceid" value="2"/> + <parameter name="fisname" value="fis_modeldata"/> + </parameters> + </product> <product name= "horizontalCrossSection"> <artifact-factory name="horizontalCrossSectionMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata" ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory> @@ -401,27 +415,43 @@ </products> </artifact> + <artifact name="fis_marinefeatures"> + <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="median%"/> + <parameter name="fisname" value="fis_marinefeatures"/> + </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 using an xlink:href-Attribute. --> - - <artifact name="timeSeries" xlink:href="${artifacts.config.dir}/products/timeseries/conf_timeseriespoint.xml" /> - <artifact name="timeSeriesMesh" xlink:href="${artifacts.config.dir}/products/timeseries/conf_mesh.xml" /> - - <artifact name="verticalProfile" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_timeseriespoint.xml" /> - <artifact name="verticalProfileMesh" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_mesh.xml" /> - <artifact name="verticalProfileInstantaneousPoint" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_instantaneouspoint.xml" /> + <artifact name="timeSeries" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/conf_timeseriespoint.xml" /> + <artifact name="timeSeriesMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/conf_mesh.xml" /> - <artifact name="horizontalProfileMesh" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh.xml" /> - <artifact name="horizontalProfileMeshCross" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh_cross.xml" /> - <artifact name="horizontalProfileInstantaneousPoint" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_instantaneouspoint.xml" /> + <artifact name="verticalProfile" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_timeseriespoint.xml" /> + <artifact name="verticalProfileMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_mesh.xml" /> + <artifact name="verticalProfileInstantaneousPoint" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_instantaneouspoint.xml" /> - <artifact name="verticalCrossSectionMesh" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh.xml" /> + <artifact name="horizontalProfileMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh.xml" /> + <artifact name="horizontalProfileMeshCross" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh_cross.xml" /> + <artifact name="horizontalProfileInstantaneousPoint" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_instantaneouspoint.xml" /> - <artifact name="horizontalCrossSectionMesh" xlink:href="${artifacts.config.dir}/products/horizontalcrosssection/conf_mesh.xml" /> + <artifact name="verticalCrossSectionMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh.xml" /> - <artifact name="layer" xlink:href="${artifacts.config.dir}/products/layer/conf.xml" /> + <artifact name="verticalCrossSectionMeshParallel" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh_parallel.xml" /> + + <artifact name="horizontalCrossSectionMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalcrosssection/conf_mesh.xml" /> + + <artifact name="layer" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/layer/conf.xml" /> </artifacts> <gnv> <!-- This section configures special parameters @@ -482,7 +512,7 @@ <!-- In this section the required Configuration for mapfile generation is given. --> <map-generator> - <mapfile path="/opt/artifacts/mapfiles/mapfile.map" /> + <mapfile path="${artifacts.config.dir}/../mapfiles/mapfile.map" /> <templates> <path>${artifacts.config.dir}/maptemplates</path> <maptemplate>mapfile.vm</maptemplate> @@ -491,11 +521,13 @@ </gnv> <mapserver> - <server path="http://denmark.atlas/cgi-bin/mapserv-gp" /> - <map path="/opt/artifacts/mapfiles/mapfile.map" /> + <!-- This Section configures the required Informations to provide the + WMS-Exports --> + <server path="http://$YOURSERVER/cgi-bin/gnv-wms" /> </mapserver> <velocity> + <!-- This Section configures all required settings for velocity. --> <logfile path="/var/log/artifacts/velocity.log" /> </velocity> @@ -513,6 +545,9 @@ Queries of the System are stored. --> <backend-configuration>${artifacts.config.dir}/arcsdeconnectionpool.properties</backend-configuration> <query-configuration>${artifacts.config.dir}/queries.properties</query-configuration> + <cache enabled="true"> + <configuration>${artifacts.config.dir}/sql-cache.xml</configuration> + </cache> </geo-backend> <rest-server> <!-- at this Point it is possible to Change the Port the ArtifactDatabase will bind to.--> @@ -524,10 +559,12 @@ <sleep-time>60000</sleep-time> </cleaner> <database> + <!-- This Section configures the Settings for connecting to the + Artifact-Database instance. e.g. SQLite --> <user>SA</user> <password></password> - <!--url>jdbc:h2:src/test/ressources/artifacts.db</url> - <driver>org.h2.Driver</driver> + <url>jdbc:h2:${artifacts.config.dir}/../artifactdb/artifacts.db</url> + <!--driver>org.h2.Driver</driver> <sql></sql> --> </database>
--- a/gnv-artifacts/doc/conf/log.conf Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -.level=FINEST -handlers=java.util.logging.ConsoleHandler -java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.FileHandler.pattern=rest-%u-%g.log
--- a/gnv-artifacts/doc/conf/maptemplates/flow-velocity_polygons.class.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/flow-velocity_polygons.class.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,7 @@ + + CLASS - NAME "-inf - 0.025" + NAME "< 0.025 [m/s]" EXPRESSION ("[CLASS]"="0") STYLE COLOR "#38a800" @@ -8,7 +10,7 @@ CLASS - NAME "0.025 - 0.05" + NAME "0.025 - 0.05 [m/s]" EXPRESSION ("[CLASS]"="1") STYLE COLOR "#56b800" @@ -17,7 +19,7 @@ CLASS - NAME "0.05 - 0.1" + NAME "0.05 - 0.1 [m/s]" EXPRESSION ("[CLASS]"="2") STYLE COLOR "#74c700" @@ -26,7 +28,7 @@ CLASS - NAME "0.1 - 0.3" + NAME "0.1 - 0.3 [m/s]" EXPRESSION ("[CLASS]"="3") STYLE COLOR "#96d600" @@ -35,7 +37,7 @@ CLASS - NAME "0.3 - 0.5" + NAME "0.3 - 0.5 [m/s]" EXPRESSION ("[CLASS]"="4") STYLE COLOR "#bfe600" @@ -44,7 +46,7 @@ CLASS - NAME "0.5 - 0.7" + NAME "0.5 - 0.7 [m/s]" EXPRESSION ("[CLASS]"="5") STYLE COLOR "#e9f500" @@ -53,7 +55,7 @@ CLASS - NAME "0.7 - 0.9" + NAME "0.7 - 0.9 [m/s]" EXPRESSION ("[CLASS]"="6") STYLE COLOR "#ffea00" @@ -62,7 +64,7 @@ CLASS - NAME "0.9 - 1.1" + NAME "0.9 - 1.1 [m/s]" EXPRESSION ("[CLASS]"="7") STYLE COLOR "#ffbb00" @@ -71,7 +73,7 @@ CLASS - NAME "1.1 - 1.3" + NAME "1.1 - 1.3 [m/s]" EXPRESSION ("[CLASS]"="8") STYLE COLOR "#ff8c00" @@ -80,7 +82,7 @@ CLASS - NAME "1.3 - 1.5" + NAME "1.3 - 1.5 [m/s]" EXPRESSION ("[CLASS]"="9") STYLE COLOR "#ff5e00" @@ -89,7 +91,7 @@ CLASS - NAME "1.5 - 1.7" + NAME "1.5 - 1.7 [m/s]" EXPRESSION ("[CLASS]"="10") STYLE COLOR "#ff2f00" @@ -98,7 +100,7 @@ CLASS - NAME "1.7 - inf" + NAME "> 1.7 [m/s]" EXPRESSION ("[CLASS]"="11") STYLE COLOR "#ff0000"
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,15 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "${info.getData()}" STATUS $info.getStatus() + TEMPLATE map.html + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("flow-velocity_polygons.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,17 @@ LAYER - NAME "$info.getName()_isolines" - GROUP "$info.getName()" - DATA "${info.getName()}/${info.getData()}" + NAME "$info.getName()" + DATA "$info.getData()" TYPE $info.getType() STATUS $info.getStatus() - LABELITEM VALUE + LABELITEM DESC + TEMPLATE map.html + TOLERANCE 10 + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("flow-velocity_isolines.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_salinity.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_salinity.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,15 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "$info.getData()" STATUS $info.getStatus() + TEMPLATE map.html + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("salinity_polygons.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,17 @@ LAYER - NAME "$info.getName()_isolines" - GROUP "$info.getName()" - DATA "${info.getName()}/${info.getData()}" + NAME "$info.getName()" + DATA "$info.getData()" TYPE $info.getType() STATUS $info.getStatus() - LABELITEM VALUE + LABELITEM DESC + TEMPLATE map.html + TOLERANCE 10 + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("salinity_isolines.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-levels.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-levels.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,15 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "$info.getData()" STATUS $info.getStatus() + TEMPLATE map.html + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("water-levels_polygons.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,17 @@ LAYER - NAME "$info.getName()_isolines" - GROUP "$info.getName()" - DATA "${info.getName()}/${info.getData()}" + NAME "$info.getName()" + DATA "$info.getData()" TYPE $info.getType() STATUS $info.getStatus() - LABELITEM VALUE + LABELITEM DESC + TEMPLATE map.html + TOLERANCE 10 + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("water-levels_isolines.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,15 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "$info.getData()" STATUS $info.getStatus() + TEMPLATE map.html + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("water-temperature_polygons.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,17 @@ LAYER - NAME "$info.getName()_isolines" - GROUP "$info.getName()" - DATA "${info.getName()}/${info.getData()}" + NAME "$info.getName()" + DATA "$info.getData()" TYPE $info.getType() STATUS $info.getStatus() - LABELITEM VALUE + LABELITEM DESC + TEMPLATE map.html + TOLERANCE 10 + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + #include("water-temperature_isolines.class.vm") END
--- a/gnv-artifacts/doc/conf/maptemplates/layer_linestring.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/layer_linestring.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,23 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "$info.getData()" STATUS $info.getStatus() - + TEMPLATE map.html + TOLERANCE 10 + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + CLASS NAME "Layer" STYLE - COLOR "#870087" + SYMBOl 'point' + SIZE 5 + COLOR "#FFFF00" END END END
--- a/gnv-artifacts/doc/conf/maptemplates/layer_point.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/layer_point.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,23 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "$info.getData()" STATUS $info.getStatus() - + TEMPLATE map.html + TOLERANCE 10 + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + CLASS NAME "Layer" STYLE - COLOR "#870087" + SYMBOL 'point' + SIZE 7 + COLOR "#FFFF00" END END END
--- a/gnv-artifacts/doc/conf/maptemplates/layer_polygon.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/layer_polygon.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,20 @@ LAYER NAME "$info.getName()" TYPE $info.getType() - DATA "${info.getName()}/${info.getData()}" + DATA "$info.getData()" STATUS $info.getStatus() - + TEMPLATE map.html + DUMP TRUE + + METADATA + "wms_title" "$info.getTitle()" + "gml_include_items" "all" + END + CLASS NAME "Layer" STYLE - COLOR "#870087" + COLOR "#FFFF00" END END END
--- a/gnv-artifacts/doc/conf/maptemplates/mapfile.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/mapfile.vm Fri Sep 28 12:15:21 2012 +0200 @@ -2,6 +2,7 @@ NAME "GNV-Map" STATUS ON SIZE 600 400 + MAXSIZE 4000 EXTENT -1 53 11 58 UNITS DD SHAPEPATH "../shapefiles" @@ -11,6 +12,36 @@ "init=epsg:4326" END + WEB + METADATA + "wms_title" "GNV Web Map Service" + "wms_onlineresource" "$MAPSERVERURL" + "wms_accessconstraints" "none" + "wms_fees" "none" + "wms_addresstype" "postal" + "wms_address" "Any Street" + "wms_city" "Any City" + "wms_stateorprovince" "Any state" + "wms_postcode" "My Postalcode" + "wms_country" "Any Country" + "wms_contactperson" "Any Person" + "wms_contactorganization" "Any Orga" + "wms_contactelectronicmailaddress" "any-email@example.com" + "wms_contactvoicetelephone" "Any's telephone number" + "wms_srs" "EPSG:4326 EPSG:32631 EPSG:32632 EPSG:32633" + "wms_feature_info_mime_type" "text/html" + END + END + + SYMBOL + NAME 'point' + TYPE ELLIPSE + POINTS + 1 1 + END + FILLED TRUE + END + ## Don't change the following lines. $LAYERS
--- a/gnv-artifacts/doc/conf/maptemplates/salinity_polygons.class.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/salinity_polygons.class.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,8 @@ CLASS - NAME "-inf - 2.0" + + NAME "< 2.0 [pSal]" EXPRESSION ("[CLASS]"="0") STYLE COLOR "#02db00" @@ -10,7 +11,8 @@ CLASS - NAME "2.0 - 3.0" + + NAME "2.0 - 3.0 [pSal]" EXPRESSION ("[CLASS]"="1") STYLE COLOR "#01e600" @@ -19,7 +21,8 @@ CLASS - NAME "3.0 - 4.0" + + NAME "3.0 - 4.0 [pSal]" EXPRESSION ("[CLASS]"="2") STYLE COLOR "#02f200" @@ -28,7 +31,8 @@ CLASS - NAME "4.0 - 5.0" + + NAME "4.0 - 5.0 [pSal]" EXPRESSION ("[CLASS]"="3") STYLE COLOR "#00ff00" @@ -37,7 +41,8 @@ CLASS - NAME "5.0 - 6.0" + + NAME "5.0 - 6.0 [pSal]" EXPRESSION ("[CLASS]"="4") STYLE COLOR "#23fd22" @@ -46,7 +51,8 @@ CLASS - NAME "6.0 - 7.0" + + NAME "6.0 - 7.0 [pSal]" EXPRESSION ("[CLASS]"="5") STYLE COLOR "#47fe46" @@ -55,7 +61,8 @@ CLASS - NAME "7.0 - 8.0" + + NAME "7.0 - 8.0 [pSal]" EXPRESSION ("[CLASS]"="6") STYLE COLOR "#5afd59" @@ -64,7 +71,8 @@ CLASS - NAME "8.0 - 9.0" + + NAME "8.0 - 9.0 [pSal]" EXPRESSION ("[CLASS]"="7") STYLE COLOR "#6ffe6e" @@ -73,7 +81,8 @@ CLASS - NAME "9.0 - 10.0" + + NAME "9.0 - 10.0 [pSal]" EXPRESSION ("[CLASS]"="8") STYLE COLOR "#89fd88" @@ -82,7 +91,8 @@ CLASS - NAME "10.0 - 12.0" + + NAME "10.0 - 12.0 [pSal]" EXPRESSION ("[CLASS]"="9") STYLE COLOR "#a5fea4" @@ -91,7 +101,8 @@ CLASS - NAME "12.0 - 14.0" + + NAME "12.0 - 14.0 [pSal]" EXPRESSION ("[CLASS]"="10") STYLE COLOR "#b3feb3" @@ -100,7 +111,8 @@ CLASS - NAME "14.0 - 16.0" + + NAME "14.0 - 16.0 [pSal]" EXPRESSION ("[CLASS]"="11") STYLE COLOR "#c2fec2" @@ -109,7 +121,8 @@ CLASS - NAME "16.0 - 18.0" + + NAME "16.0 - 18.0 [pSal]" EXPRESSION ("[CLASS]"="12") STYLE COLOR "#e0fee0" @@ -118,7 +131,8 @@ CLASS - NAME "18.0 - 20.0" + + NAME "18.0 - 20.0 [pSal]" EXPRESSION ("[CLASS]"="13") STYLE COLOR "#ffffff" @@ -127,7 +141,8 @@ CLASS - NAME "20.0 - 24.0" + + NAME "20.0 - 24.0 [pSal]" EXPRESSION ("[CLASS]"="14") STYLE COLOR "#fef5ef" @@ -136,7 +151,8 @@ CLASS - NAME "24.0 - 28.0" + + NAME "24.0 - 28.0 [pSal]" EXPRESSION ("[CLASS]"="15") STYLE COLOR "#feede0" @@ -145,7 +161,8 @@ CLASS - NAME "28.0 - 30.0" + + NAME "28.0 - 30.0 [pSal]" EXPRESSION ("[CLASS]"="16") STYLE COLOR "#fee5d1" @@ -154,7 +171,8 @@ CLASS - NAME "30.0 - 32.0" + + NAME "30.0 - 32.0 [pSal]" EXPRESSION ("[CLASS]"="17") STYLE COLOR "#fdd8ba" @@ -163,7 +181,8 @@ CLASS - NAME "32.0 - 34.0" + + NAME "32.0 - 34.0 [pSal]" EXPRESSION ("[CLASS]"="18") STYLE COLOR "#fecca4" @@ -172,7 +191,8 @@ CLASS - NAME "34.0 - 34.5" + + NAME "34.0 - 34.5 [pSal]" EXPRESSION ("[CLASS]"="19") STYLE COLOR "#fdbe8b" @@ -181,7 +201,8 @@ CLASS - NAME "34.5 - 35.0" + + NAME "34.5 - 35.0 [pSal]" EXPRESSION ("[CLASS]"="20") STYLE COLOR "#feb073" @@ -190,7 +211,8 @@ CLASS - NAME "35.0 - 35.2" + + NAME "35.0 - 35.2 [pSal]" EXPRESSION ("[CLASS]"="21") STYLE COLOR "#fda35b" @@ -199,7 +221,8 @@ CLASS - NAME "35.2 - 35.4" + + NAME "35.2 - 35.4 [pSal]" EXPRESSION ("[CLASS]"="22") STYLE COLOR "#fe9846" @@ -208,7 +231,8 @@ CLASS - NAME "35.4 - 35.6" + + NAME "35.4 - 35.6 [pSal]" EXPRESSION ("[CLASS]"="23") STYLE COLOR "#fd8422" @@ -217,7 +241,8 @@ CLASS - NAME "35.6 - 35.8" + + NAME "35.6 - 35.8 [pSal]" EXPRESSION ("[CLASS]"="24") STYLE COLOR "#fe7100" @@ -226,7 +251,8 @@ CLASS - NAME "35.8 - 36.0" + + NAME "35.8 - 36.0 [pSal]" EXPRESSION ("[CLASS]"="25") STYLE COLOR "#fe6900" @@ -235,7 +261,8 @@ CLASS - NAME "36.0 - 37.0" + + NAME "36.0 - 37.0 [pSal]" EXPRESSION ("[CLASS]"="26") STYLE COLOR "#fe6100" @@ -244,7 +271,8 @@ CLASS - NAME "37.0 - inf" + + NAME "> 37.0 [pSal]" EXPRESSION ("[CLASS]"="27") STYLE COLOR "#fe5900"
--- a/gnv-artifacts/doc/conf/maptemplates/water-temperature_polygons.class.vm Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/maptemplates/water-temperature_polygons.class.vm Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,8 @@ CLASS - NAME "-inf - -1" + + NAME "< -1 [degC]" EXPRESSION ("[CLASS]"="0") STYLE COLOR "#ff33ff" @@ -10,7 +11,8 @@ CLASS - NAME "-1 - 0" + + NAME "-1 - 0 [degC]" EXPRESSION ("[CLASS]"="1") STYLE COLOR "#ff98ff" @@ -19,7 +21,8 @@ CLASS - NAME "0 - 1" + + NAME "0 - 1 [degC]" EXPRESSION ("[CLASS]"="2") STYLE COLOR "#3300cc" @@ -28,7 +31,8 @@ CLASS - NAME "1 - 2" + + NAME "1 - 2 [degC]" EXPRESSION ("[CLASS]"="3") STYLE COLOR "#3366ff" @@ -37,7 +41,8 @@ CLASS - NAME "2 - 3" + + NAME "2 - 3 [degC]" EXPRESSION ("[CLASS]"="4") STYLE COLOR "#3399ff" @@ -46,7 +51,8 @@ CLASS - NAME "3 - 4" + + NAME "3 - 4 [degC]" EXPRESSION ("[CLASS]"="5") STYLE COLOR "#33ccff" @@ -55,7 +61,8 @@ CLASS - NAME "4 - 5" + + NAME "4 - 5 [degC]" EXPRESSION ("[CLASS]"="6") STYLE COLOR "#33ffff" @@ -64,7 +71,8 @@ CLASS - NAME "5 - 6" + + NAME "5 - 6 [degC]" EXPRESSION ("[CLASS]"="7") STYLE COLOR "#007800" @@ -73,7 +81,8 @@ CLASS - NAME "6 - 7" + + NAME "6 - 7 [degC]" EXPRESSION ("[CLASS]"="8") STYLE COLOR "#009900" @@ -82,7 +91,8 @@ CLASS - NAME "7 - 8" + + NAME "7 - 8 [degC]" EXPRESSION ("[CLASS]"="9") STYLE COLOR "#00ba00" @@ -91,7 +101,8 @@ CLASS - NAME "8 - 9" + + NAME "8 - 9 [degC]" EXPRESSION ("[CLASS]"="10") STYLE COLOR "#00de00" @@ -100,7 +111,8 @@ CLASS - NAME "9 - 10" + + NAME "9 - 10 [degC]" EXPRESSION ("[CLASS]"="11") STYLE COLOR "#00ff00" @@ -109,7 +121,8 @@ CLASS - NAME "10 - 11" + + NAME "10 - 11 [degC]" EXPRESSION ("[CLASS]"="12") STYLE COLOR "#ffff33" @@ -118,7 +131,8 @@ CLASS - NAME "11 - 12" + + NAME "11 - 12 [degC]" EXPRESSION ("[CLASS]"="13") STYLE COLOR "#ffee33" @@ -127,7 +141,8 @@ CLASS - NAME "12 - 13" + + NAME "12 - 13 [degC]" EXPRESSION ("[CLASS]"="14") STYLE COLOR "#ffdd33" @@ -136,7 +151,8 @@ CLASS - NAME "13 - 14" + + NAME "13 - 14 [degC]" EXPRESSION ("[CLASS]"="15") STYLE COLOR "#ffcc33" @@ -145,7 +161,8 @@ CLASS - NAME "14 - 15" + + NAME "14 - 15 [degC]" EXPRESSION ("[CLASS]"="16") STYLE COLOR "#ffbb33" @@ -154,7 +171,8 @@ CLASS - NAME "15 - 16" + + NAME "15 - 16 [degC]" EXPRESSION ("[CLASS]"="17") STYLE COLOR "#ffaa00" @@ -163,7 +181,8 @@ CLASS - NAME "16 - 17" + + NAME "16 - 17 [degC]" EXPRESSION ("[CLASS]"="18") STYLE COLOR "#ff9900" @@ -172,7 +191,8 @@ CLASS - NAME "17 - 18" + + NAME "17 - 18 [degC]" EXPRESSION ("[CLASS]"="19") STYLE COLOR "#ff7700" @@ -181,7 +201,8 @@ CLASS - NAME "18 - 19" + + NAME "18 - 19 [degC]" EXPRESSION ("[CLASS]"="20") STYLE COLOR "#ff0000" @@ -190,7 +211,8 @@ CLASS - NAME "19 - 20" + + NAME "19 - 20 [degC]" EXPRESSION ("[CLASS]"="21") STYLE COLOR "#ed0000" @@ -199,7 +221,8 @@ CLASS - NAME "20 - 21" + + NAME "20 - 21 [degC]" EXPRESSION ("[CLASS]"="22") STYLE COLOR "#cc0000" @@ -208,7 +231,8 @@ CLASS - NAME "21 - 22" + + NAME "21 - 22 [degC]" EXPRESSION ("[CLASS]"="23") STYLE COLOR "#ba0000" @@ -217,7 +241,8 @@ CLASS - NAME "22 - 23" + + NAME "22 - 23 [degC]" EXPRESSION ("[CLASS]"="24") STYLE COLOR "#ab0000" @@ -226,7 +251,8 @@ CLASS - NAME "23 - 24" + + NAME "23 - 24 [degC]" EXPRESSION ("[CLASS]"="25") STYLE COLOR "#990000" @@ -235,7 +261,8 @@ CLASS - NAME "24 - 25" + + NAME "24 - 25 [degC]" EXPRESSION ("[CLASS]"="26") STYLE COLOR "#870000" @@ -244,7 +271,8 @@ CLASS - NAME "25 - inf" + + NAME "> 25 [degC]" EXPRESSION ("[CLASS]"="27") STYLE COLOR "#ab0089"
--- a/gnv-artifacts/doc/conf/meshwidth.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/meshwidth.xml Fri Sep 28 12:15:21 2012 +0200 @@ -4,11 +4,15 @@ id = ID des Meshes in der Datenbank width = Durchschnittlicher Abstand zwischen zwei Netzpunkten in Grad --> - <mesh id="1" width="0.03" description="Küstenmodell"/> - <mesh id="2" width="0.30" description="Ostseemodell"/> - <mesh id="3" width="0.15" description="SST"/> - <mesh id="4" width="0.03" description="Küstenmodell Tagesmittel"/> - <mesh id="5" width="0.16" description="Nord-Ostseemodell Tagesmittel"/> - <mesh id="321" width="0.30" description="SST"/> + <mesh id="1" width="0.03" description="Modelldaten Küstenmodell"/> + <mesh id="3" width="0.15" description="Modelldaten Nord- und Ostseemodel"/> + <mesh id="4" width="0.03" description="Modelldaten Küstenmodell Tagesmittel"/> + <mesh id="5" width="0.16" description="Modelldaten Nord-Ostseemodell Tagesmittel"/> + <mesh id="641" width="0.30" description="Eisdaten"/> + + <mesh id="2" width="0.30" description="SST-Karte woechentliche Nordseetemperaturen"/> + <mesh id="321" width="0.30" description="SST-Karte woechentliche Ostseetemperaturen"/> + <mesh id="961" width="0.30" description="SST-Karte monatliche Nordseetemperaturen"/> + <mesh id="962" width="0.30" description="SST-Karte monatliche Ostseetemperaturen"/> </mesh-widths> \ No newline at end of file
--- a/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,46 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="horizontalCrossSectionMesh"> <states> - <state id="horizontalcrosssection_area" description="horizontalcrosssection_area_one" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalcrosssection_mesh_mapviewerswitch" description="horizontalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalcrosssection_mesh_mapviewerswitch"/> + <to state="horizontalcrosssection_mesh_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalcrosssection_mesh_mapviewerswitch"/> + <to state="horizontalcrosssection_mesh_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="horizontalcrosssection_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalcrosssection_mesh_with_wkt"/> + <to state="horizontalcrosssection_meshpoint_depth"/> + </transition> + + <state id="horizontalcrosssection_mesh_area" description="horizontalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> <data-multiselect>false</data-multiselect> @@ -14,17 +53,17 @@ </state> <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> - <from state="horizontalcrosssection_area"/> - <to state="horizontalcrosssection_subarea"/> + <from state="horizontalcrosssection_mesh_area"/> + <to state="horizontalcrosssection_mesh_subarea"/> <condition inputvalue="areaid" value="n/n" operator="notequal"/> </transition> <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> - <from state="horizontalcrosssection_area"/> + <from state="horizontalcrosssection_mesh_area"/> <to state="horizontalcrosssection_mesh_without_geom"/> <condition inputvalue="areaid" value="n/n" operator="equal"/> </transition> - <state id="horizontalcrosssection_subarea" description="horizontalcrosssection_area_one" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalcrosssection_mesh_subarea" description="horizontalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>subarea_filter</queryID> <dataname>subareaid</dataname> <data-multiselect>false</data-multiselect> @@ -37,7 +76,7 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalcrosssection_subarea"/> + <from state="horizontalcrosssection_mesh_subarea"/> <to state="horizontalcrosssection_mesh"/> </transition> @@ -53,9 +92,16 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> <from state="horizontalcrosssection_mesh_without_geom"/> <to state="verticalcrosssection_mesh_polygon"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalcrosssection_mesh_without_geom"/> + <to state="horizontalcrosssection_meshpoint_depth_presettings"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> </transition> <state id="horizontalcrosssection_mesh" description="horizontalcrosssection_mesh" state="de.intevation.gnv.state.DefaultState"> @@ -70,9 +116,16 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> <from state="horizontalcrosssection_mesh"/> <to state="verticalcrosssection_mesh_polygon"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalcrosssection_mesh"/> + <to state="horizontalcrosssection_meshpoint_depth_presettings"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> </transition> <state id="verticalcrosssection_mesh_polygon" description="verticalcrosssection_mesh_polygon" state="de.intevation.gnv.state.SingleInputState"> @@ -81,7 +134,7 @@ <inputvalues> <inputvalue name="meshid" type="Integer" multiselect="false"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> - <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_polygon" type="Polygon" multiselect="false" usedinquery="0"/> </inputvalues> </state> @@ -90,6 +143,24 @@ <to state="horizontalcrosssection_meshpoint_depth"/> </transition> + <state id="horizontalcrosssection_meshpoint_depth_presettings" description="horizontalcrosssection_meshpoint_depth" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>horizontalcrosssection_meshpoint_depth</queryID> + <dataname>depthid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalcrosssection_meshpoint_depth_presettings"/> + <to state="horizontalcrosssection_meshpoint_parameter"/> + </transition> + <state id="horizontalcrosssection_meshpoint_depth" description="horizontalcrosssection_meshpoint_depth" state="de.intevation.gnv.state.DefaultState"> <queryID>horizontalcrosssection_meshpoint_depth</queryID> <dataname>depthid</dataname> @@ -184,7 +255,11 @@ </value-names> <outputsModes> <outputsMode name="zip" description="Export als ZIP-Archiv" mime-type="application/zip"/> - <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url"/> + <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url"> + <parameters> + <inputvalue name="title" type="String" value="Layer Title"/> + </parameters> + </outputsMode> </outputsModes> </state>
--- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="horizontalProfileInstantaneousPoint"> <states> + <state id="horizontalprofile_instantaneouspoint_mapviewerswitch" description="horizontalprofile_instantaneouspoint_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_instantaneouspoint_mapviewerswitch"/> + <to state="horizontalprofile_instantaneouspoint_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_instantaneouspoint_mapviewerswitch"/> + <to state="horizontalprofile_instantaneouspoint_vehicle_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> <state id="horizontalprofile_instantaneouspoint_area" description="horizontalprofile_instantaneouspoint_area" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -41,6 +61,61 @@ <to state="horizontalprofile_instantaneouspoint_vehicle"/> </transition> + <!-- Anfang Sonderfall Ablaufsteuerung mit Anwendung der Geometrie aus der Mapviewer-Schnittstelle --> + <state id="horizontalprofile_instantaneouspoint_vehicle_with_wkt" description="horizontalprofile_instantaneouspoint_vehicle_with_wkt" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>horizontalprofile_instantaneouspoint_vehicle_with_wkt</queryID> + <dataname>vehicleid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="wktid"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="vehicleid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_instantaneouspoint_vehicle_with_wkt"/> + <to state="horizontalprofile_instantaneouspoint_cruise_with_wkt"/> + </transition> + + <state id="horizontalprofile_instantaneouspoint_cruise_with_wkt" description="horizontalprofile_instantaneouspoint_cruise_with_wkt" state="de.intevation.gnv.state.DefaultState"> + <queryID>horizontalprofile_instantaneouspoint_cruise_with_wkt</queryID> + <dataname>cruiseid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false"/> + <inputvalue name="vehicleid" type="Integer" multiselect="false"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="cruiseid" type="Integer" multiselect="false" usedinquery="0" /> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_instantaneouspoint_cruise_with_wkt"/> + <to state="horizontalprofile_instantaneouspoint_track_with_wkt"/> + </transition> + + <state id="horizontalprofile_instantaneouspoint_track_with_wkt" description="horizontalprofile_instantaneouspoint_track_with_wkt" state="de.intevation.gnv.state.DefaultState"> + <queryID>horizontalprofile_instantaneouspoint_track_with_wkt</queryID> + <dataname>trackid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="cruiseid" type="Integer" multiselect="false" usedinquery="1" /> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="trackid" type="Integer" multiselect="false" usedinquery="0" /> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_instantaneouspoint_track_with_wkt"/> + <to state="horizontalprofile_instantaneouspoint_surveyinfo"/> + </transition> + <!-- Ende Sonderfall Ablaufsteuerung mit Anwendung der Geometrie aus der Mapviewer-Schnittstelle --> + <!-- Anfang Sonderfall Ablaufsteuerung mit Anwendung des Gebietsfilters --> <state id="horizontalprofile_instantaneouspoint_vehicle" description="horizontalprofile_instantaneouspoint_vehicle" state="de.intevation.gnv.state.DefaultState"> <queryID>horizontalprofile_instantaneouspoint_vehicle_with_area</queryID> @@ -236,7 +311,7 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
--- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="horizontalProfileMesh"> <states> + <state id="horizontalprofile_mesh_mapviewerswitch" description="horizontalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_mapviewerswitch"/> + <to state="horizontalprofile_mesh_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_mapviewerswitch"/> + <to state="horizontalprofile_mesh_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="horizontalprofile_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_polygon" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_mesh_with_wkt"/> + <to state="horizontalprofile_mesh_point_presettings"/> + </transition> + <state id="horizontalprofile_mesh_area" description="horizontalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -51,11 +90,18 @@ <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> </state> - - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh_without_geom"/> - <to state="horizontalprofile_mesh_coordinate"/> - </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_without_geom"/> + <to state="horizontalprofile_mesh_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_without_geom"/> + <to state="horizontalprofile_mesh_point_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> <state id="horizontalprofile_mesh" description="horizontalprofile_mesh" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_with_area</queryID> @@ -69,10 +115,17 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh"/> - <to state="horizontalprofile_mesh_coordinate"/> - </transition> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh"/> + <to state="horizontalprofile_mesh_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh"/> + <to state="horizontalprofile_mesh_point_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> <state id="horizontalprofile_mesh_coordinate" description="horizontalprofile_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState"> <dataname>mesh_coordinate</dataname> @@ -99,7 +152,7 @@ <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> - <mesh-width xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> @@ -107,6 +160,25 @@ <to state="horizontalprofile_mesh_axis"/> </transition> + <state id="horizontalprofile_mesh_point_presettings" description="horizontalprofile_meshpoint" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState"> + <queryID>verticalprofile_mesh_point</queryID> + <dataname>mesh_point</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_mesh_point_presettings"/> + <to state="horizontalprofile_mesh_axis"/> + </transition> + <state id="horizontalprofile_mesh_axis" description="horizontalprofile_mesh_point" state="de.intevation.gnv.state.profile.horizontal.NorthSouthEastWestState"> <dataname>axisid</dataname> <data-multiselect>false</data-multiselect> @@ -117,12 +189,36 @@ <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="horizontalprofile_mesh_axis"/> - <to state="horizontalprofile_meshpoint_parameter"/> + <to state="horizontalprofile_meshpoint_vector_scalar"/> </transition> - + + <state id="horizontalprofile_meshpoint_vector_scalar" description="horizontalprofile_meshpoint_vector_scalar" state="de.intevation.gnv.state.SwitchModeState"> + <dataname>vectorscalar</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="horizontalprofile_meshpoint_vector_scalar"/> + <to state="horizontalprofile_meshpoint_parameter"/> + <condition inputvalue="vectorscalar" value="scalar" operator="equal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="horizontalprofile_meshpoint_vector_scalar"/> + <to state="horizontalprofile_meshpoint_parameter_vector"/> + <condition inputvalue="vectorscalar" value="vector" operator="equal"/> + </transition> + <state id="horizontalprofile_meshpoint_parameter" description="horizontalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_parameter</queryID> <dataname>parameterid</dataname> @@ -136,12 +232,31 @@ <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/> </inputvalues> </state> - + + <state id="horizontalprofile_meshpoint_parameter_vector" description="horizontalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_parameter_vector</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="horizontalprofile_meshpoint_parameter"/> <to state="horizontalprofile_meshpoint_depth"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_meshpoint_parameter_vector"/> + <to state="horizontalprofile_meshpoint_depth_vector"/> + </transition> + <state id="horizontalprofile_meshpoint_depth" description="horizontalprofile_meshpoint_depth" state="de.intevation.gnv.state.DefaultState"> <queryID>horizontalprofile_meshpoint_depth</queryID> <dataname>depthid</dataname> @@ -155,12 +270,31 @@ <inputvalue name="depthid" type="Integer" multiselect="true" usedinquery="0"/> </inputvalues> </state> - + + <state id="horizontalprofile_meshpoint_depth_vector" description="horizontalprofile_meshpoint_depth" state="de.intevation.gnv.state.DefaultState"> + <queryID>horizontalprofile_meshpoint_depth</queryID> + <dataname>depthid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="horizontalprofile_meshpoint_depth"/> <to state="horizontalprofile_mesh_year"/> </transition> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_meshpoint_depth_vector"/> + <to state="horizontalprofile_mesh_year_vector"/> + </transition> + <state id="horizontalprofile_mesh_year" description="horizontalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_year</queryID> <dataname>yearid</dataname> @@ -176,11 +310,31 @@ </inputvalues> </state> + <state id="horizontalprofile_mesh_year_vector" description="horizontalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_year_vector</queryID> + <dataname>yearid</dataname> + <data-multiselect>true</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="depthid" type="Integer" multiselect="true" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="horizontalprofile_mesh_year"/> <to state="horizontalprofile_mesh_date"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_mesh_year_vector"/> + <to state="horizontalprofile_mesh_date_vector"/> + </transition> + <state id="horizontalprofile_mesh_date" description="horizontalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_date</queryID> <dataname>dateid</dataname> @@ -196,13 +350,35 @@ <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/> </inputvalues> </state> - + + <state id="horizontalprofile_mesh_date_vector" description="horizontalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_date_vector</queryID> + <dataname>dateid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="depthid" type="Integer" multiselect="true" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="horizontalprofile_mesh_date"/> <to state="horizontalprofile_mesh_calculate_results"/> </transition> - - <state id="horizontalprofile_mesh_calculate_results" description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileOutputState"> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_mesh_date_vector"/> + <to state="horizontalprofile_mesh_calculate_results_vector"/> + </transition> + + <state id="horizontalprofile_mesh_calculate_results" + description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshOutputState"> <queryID>horizontalprofile_mesh_chart_data</queryID> <queryID-odv>horizontalprofile_mesh_odv_data</queryID-odv> <inputvalues> @@ -237,7 +413,56 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/> + </outputsModes> + </state> + + <state id="horizontalprofile_mesh_calculate_results_vector" description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshVectorOutputState"> + <queryID>horizontalprofile_mesh_chart_data_vector</queryID> + <queryID-odv>horizontalprofile_mesh_odv_data_vector</queryID-odv> + <inputvalues> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="depthid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="2"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + <value-names> + <value-name name="feature" value="mesh_point"></value-name> + <value-name name="parameter" value="parameterid"></value-name> + <value-name name="measurement" value="depthid"></value-name> + </value-names> + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="points" type="Boolean" value="false"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="bincount" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
--- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh_cross.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh_cross.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,46 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="horizontalProfileMeshCross"> <states> - <state id="horizontalprofile_mesh_area" description="horizontalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_mesh_cross_mapviewerswitch" description="horizontalprofile_mesh_cross_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_cross_mapviewerswitch"/> + <to state="horizontalprofile_mesh_cross_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_cross_mapviewerswitch"/> + <to state="horizontalprofile_mesh_cross_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="horizontalprofile_mesh_cross_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_polygon" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_mesh_cross_with_wkt"/> + <to state="horizontalprofile_mesh_cross_linestring"/> + </transition> + + <state id="horizontalprofile_mesh_cross_area" description="horizontalprofile_mesh_cross_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> <data-multiselect>false</data-multiselect> @@ -14,17 +53,17 @@ </state> <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> - <from state="horizontalprofile_mesh_area"/> - <to state="horizontalprofile_mesh_subarea"/> + <from state="horizontalprofile_mesh_cross_area"/> + <to state="horizontalprofile_mesh_cross_subarea"/> <condition inputvalue="areaid" value="n/n" operator="notequal"/> </transition> <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> - <from state="horizontalprofile_mesh_area"/> - <to state="horizontalprofile_mesh_without_geom"/> + <from state="horizontalprofile_mesh_cross_area"/> + <to state="horizontalprofile_mesh_cross_without_geom"/> <condition inputvalue="areaid" value="n/n" operator="equal"/> </transition> - <state id="horizontalprofile_mesh_subarea" description="horizontalprofile_mesh_subaera" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_mesh_cross_subarea" description="horizontalprofile_mesh_cross_subaera" state="de.intevation.gnv.state.DefaultState"> <queryID>subarea_filter</queryID> <dataname>subareaid</dataname> <data-multiselect>false</data-multiselect> @@ -37,11 +76,11 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh_subarea"/> - <to state="horizontalprofile_mesh"/> + <from state="horizontalprofile_mesh_cross_subarea"/> + <to state="horizontalprofile_mesh_cross"/> </transition> - <state id="horizontalprofile_mesh_without_geom" description="horizontalprofile_mesh_without_geom" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_mesh_cross_without_geom" description="horizontalprofile_mesh_cross_without_geom" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh</queryID> <dataname>meshid</dataname> <data-multiselect>false</data-multiselect> @@ -52,12 +91,19 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh_without_geom"/> - <to state="horizontalprofile_mesh_linestring"/> - </transition> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_cross_without_geom"/> + <to state="horizontalprofile_mesh_cross_linestring"/> + <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_cross_without_geom"/> + <to state="horizontalprofile_meshpoint_cross_parameter_presettings"/> + <condition inputvalue="geometry" value="LINESTRING" operator="equal"/> + </transition> - <state id="horizontalprofile_mesh" description="horizontalprofile_mesh" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_mesh_cross" description="horizontalprofile_mesh_cross" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_with_area</queryID> <dataname>meshid</dataname> <data-multiselect>false</data-multiselect> @@ -69,12 +115,19 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh"/> - <to state="horizontalprofile_mesh_linestring"/> - </transition> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_cross"/> + <to state="horizontalprofile_mesh_cross_linestring"/> + <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="horizontalprofile_mesh_cross"/> + <to state="horizontalprofile_meshpoint_cross_parameter_presettings"/> + <condition inputvalue="geometry" value="LINESTRING" operator="equal"/> + </transition> - <state id="horizontalprofile_mesh_linestring" description="horizontalprofile_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState"> + <state id="horizontalprofile_mesh_cross_linestring" description="horizontalprofile_mesh_cross_coordinate" state="de.intevation.gnv.state.SingleInputState"> <dataname>mesh_linestring</dataname> <data-multiselect>false</data-multiselect> <inputvalues> @@ -85,14 +138,11 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh_linestring"/> - <to state="horizontalprofile_meshpoint_parameter"/> + <from state="horizontalprofile_mesh_cross_linestring"/> + <to state="horizontalprofile_meshpoint_cross_parameter"/> </transition> - <!-- mesh_point --> - - - <state id="horizontalprofile_meshpoint_parameter" description="horizontalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_meshpoint_cross_parameter" description="horizontalprofile_mesh_crosspoint_parameter" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_parameter</queryID> <dataname>parameterid</dataname> <presettings-name>parameter</presettings-name> @@ -106,11 +156,30 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_meshpoint_parameter"/> - <to state="horizontalprofile_meshpoint_depth"/> + <from state="horizontalprofile_meshpoint_cross_parameter"/> + <to state="horizontalprofile_meshpoint_cross_depth"/> </transition> - <state id="horizontalprofile_meshpoint_depth" description="horizontalprofile_meshpoint_depth" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_meshpoint_cross_parameter_presettings" description="horizontalprofile_meshpoint_cross_parameter" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_parameter</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>true</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_linestring"/> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/> + <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="horizontalprofile_meshpoint_cross_parameter_presettings"/> + <to state="horizontalprofile_meshpoint_cross_depth"/> + </transition> + + <state id="horizontalprofile_meshpoint_cross_depth" description="horizontalprofile_meshpoint_cross_depth" state="de.intevation.gnv.state.DefaultState"> <queryID>horizontalprofile_meshpoint_depth</queryID> <dataname>depthid</dataname> <data-multiselect>true</data-multiselect> @@ -124,11 +193,11 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_meshpoint_depth"/> - <to state="horizontalprofile_mesh_year"/> + <from state="horizontalprofile_meshpoint_cross_depth"/> + <to state="horizontalprofile_mesh_cross_year"/> </transition> - <state id="horizontalprofile_mesh_year" description="horizontalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_mesh_cross_year" description="horizontalprofile_mesh_cross_year" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_year</queryID> <dataname>yearid</dataname> <data-multiselect>true</data-multiselect> @@ -144,11 +213,11 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh_year"/> - <to state="horizontalprofile_mesh_date"/> + <from state="horizontalprofile_mesh_cross_year"/> + <to state="horizontalprofile_mesh_cross_date"/> </transition> - <state id="horizontalprofile_mesh_date" description="horizontalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState"> + <state id="horizontalprofile_mesh_cross_date" description="horizontalprofile_mesh_cross_date" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_date</queryID> <dataname>dateid</dataname> <data-multiselect>true</data-multiselect> @@ -164,11 +233,11 @@ </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="horizontalprofile_mesh_date"/> - <to state="horizontalprofile_mesh_calculate_results"/> + <from state="horizontalprofile_mesh_cross_date"/> + <to state="horizontalprofile_mesh_cross_calculate_results"/> </transition> - <state id="horizontalprofile_mesh_calculate_results" description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshCrossOutputState"> + <state id="horizontalprofile_mesh_cross_calculate_results" description="horizontalprofile_mesh_cross_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshCrossOutputState"> <queryID>horizontalprofile_mesh_cross_chart_data</queryID> <queryID-ijk>horizontalprofile_meshpoint_cross_ij</queryID-ijk> <queryID-odv>horizontalprofile_mesh_odv_data</queryID-odv> @@ -203,7 +272,7 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
--- a/gnv-artifacts/doc/conf/products/layer/conf.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/layer/conf.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="layer"> <states> + + <state id="layer_mapviewerswitch" description="layer_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="layer_mapviewerswitch"/> + <to state="layer_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="layer_mapviewerswitch"/> + <to state="layer"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + <state id="layer_area" description="layer_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -44,7 +66,7 @@ <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> + <data-multiselect>true</data-multiselect> <inputvalues> <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="1"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> @@ -66,14 +88,18 @@ </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"/> + <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url"> + <parameters> + <inputvalue name="title" type="String" value="Layer Title"/> + </parameters> + </outputsMode> </outputsModes> </state> - <state id="layer" description="layer" state="de.intevation.gnv.state.DefaultState"> + <state id="layer" description="layer" state="de.intevation.gnv.state.DefaultState"> <queryID>layer</queryID> <dataname>layerid</dataname> - <data-multiselect>false</data-multiselect> + <data-multiselect>true</data-multiselect> <inputvalues> <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="1"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> @@ -91,6 +117,7 @@ <queryID>layer_request_data</queryID> <queryID-layerdata>layer_data_with_geom</queryID-layerdata> <queryID-geometry>geometry_for_subareafilter</queryID-geometry> + <queryID-columns>layer_colums</queryID-columns> <inputvalue-geometry>subareaid</inputvalue-geometry> <inputvalues> <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/> @@ -99,7 +126,11 @@ </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"/> + <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url"> + <parameters> + <inputvalue name="title" type="String" value="Layer Title"/> + </parameters> + </outputsMode> </outputsModes> </state>
--- a/gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="timeSeriesMesh"> <states> + <state id="timeseries_mesh_mapviewerswitch" description="timeseries_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="timeseries_mesh_mapviewerswitch"/> + <to state="timeseries_mesh_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="timeseries_mesh_mapviewerswitch"/> + <to state="timeseries_mesh_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + <state id="timeseries_mesh_area" description="timeseries_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -52,11 +73,37 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> <from state="timeseries_mesh_without_geom"/> <to state="timeseries_mesh_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="timeseries_mesh_without_geom"/> + <to state="timeseries_meshpoint_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> + + + <state id="timeseries_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_mesh_with_wkt"/> + <to state="timeseries_meshpoint_presettings"/> </transition> - + <state id="timeseries_mesh" description="timeseries_mesh" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_with_area</queryID> <dataname>meshid</dataname> @@ -97,18 +144,18 @@ <to state="timeseries_meshpoint"/> </transition> - <state id="timeseries_meshpoint_presettings" description="timeseries_meshpoint" state="de.intevation.gnv.state.CoordinateSelectionState"> + <state id="timeseries_meshpoint_presettings" description="timeseries_meshpoint" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState"> <queryID>timeseries_meshpoint</queryID> <dataname>mesh_point</dataname> <data-multiselect>false</data-multiselect> <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> <inputvalues> <inputvalue name="meshid" type="Integer" multiselect="false"/> - <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> - <mesh-width xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> @@ -126,14 +173,76 @@ <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> - <mesh-width xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_meshpoint"/> + <to state="timeseries_meshpoint_vector_scalar"/> + </transition> + + + <state id="timeseries_meshpoint_vector_scalar" description="timeseries_meshpoint_vector_scalar" state="de.intevation.gnv.state.SwitchModeState"> + <dataname>vectorscalar</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="timeseries_meshpoint_vector_scalar"/> + <to state="timeseries_meshpoint_parameter"/> + <condition inputvalue="vectorscalar" value="scalar" operator="equal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="timeseries_meshpoint_vector_scalar"/> + <to state="timeseries_meshpoint_parameter_vector"/> + <condition inputvalue="vectorscalar" value="vector" operator="equal"/> + </transition> + + <state id="timeseries_meshpoint_parameter" description="timeseries_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>timeseries_mesh_parameter</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>true</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <state id="timeseries_meshpoint_parameter_vector" description="timeseries_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>timeseries_mesh_parameter_vector</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_meshpoint_parameter"/> <to state="timeseries_meshpoint_depth"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_meshpoint_parameter_vector"/> + <to state="timeseries_meshpoint_depth_vector"/> + </transition> + <state id="timeseries_meshpoint_depth" description="timeseries_meshpoint_depth" state="de.intevation.gnv.state.DefaultState"> <queryID>timeseries_meshpoint_depth</queryID> <dataname>depthid</dataname> @@ -143,33 +252,33 @@ <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> - </inputvalues> - </state> - - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="timeseries_meshpoint_depth"/> - <to state="timeseries_meshpoint_parameter"/> - </transition> - - <state id="timeseries_meshpoint_parameter" description="timeseries_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> - <queryID>timeseries_mesh_parameter</queryID> - <dataname>parameterid</dataname> - <presettings-name>parameter</presettings-name> - <data-multiselect>true</data-multiselect> - <inputvalues> - <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> - <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> - <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> - <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + + <state id="timeseries_meshpoint_depth_vector" description="timeseries_meshpoint_depth" state="de.intevation.gnv.state.DefaultState"> + <queryID>timeseries_meshpoint_depth</queryID> + <dataname>depthid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="timeseries_meshpoint_parameter"/> + <from state="timeseries_meshpoint_depth"/> <to state="timeseries_meshpoint_interval"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_meshpoint_depth_vector"/> + <to state="timeseries_meshpoint_interval_vector"/> + </transition> + <state id="timeseries_meshpoint_interval" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxState"> <queryID>timeseries_mesh_interval</queryID> <dataname>timeinterval</dataname> @@ -184,12 +293,32 @@ <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + + <state id="timeseries_meshpoint_interval_vector" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxState"> + <queryID>timeseries_mesh_interval_vector</queryID> + <dataname>timeinterval</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="0"/> + <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_meshpoint_interval"/> <to state="timeseries_meshpoint_calculate_results"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_meshpoint_interval_vector"/> + <to state="timeseries_meshpoint_calculate_results_vector"/> + </transition> + <state id="timeseries_meshpoint_calculate_results" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesOutputState"> <queryID>timeseries_mesh_chart_data</queryID> <queryID-odv>timeseries_mesh_odv_data</queryID-odv> @@ -206,6 +335,7 @@ <value-name name="feature" value="mesh_point"></value-name> <value-name name="parameter" value="parameterid"></value-name> <value-name name="measurement" value="depthid"></value-name> + <value-name name="timeinterval" value="timeinterval"></value-name> </value-names> <outputsModes> <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> @@ -225,7 +355,7 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> @@ -238,6 +368,56 @@ <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/> </outputsModes> </state> - + + <state id="timeseries_meshpoint_calculate_results_vector" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesVectorOutputState"> + <queryID>timeseries_mesh_chart_data_vector</queryID> + <queryID-odv>timeseries_mesh_odv_data_vector</queryID-odv> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="1"/> + <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="1"/> + </inputvalues> + <value-names> + <value-name name="feature" value="mesh_point"></value-name> + <value-name name="parameter" value="parameterid"></value-name> + <value-name name="measurement" value="depthid"></value-name> + <value-name name="timeinterval" value="timeinterval"></value-name> + </value-names> + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="points" type="Boolean" value="false"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="bincount" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/> + </outputsModes> + </state> + </states> </artifact>
--- a/gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml Fri Sep 28 12:15:21 2012 +0200 @@ -24,7 +24,46 @@ * description: A short description which should describe the state * state: The Class which must be load to handle the required logic, This class will be load using reflection. --> - + + <state id="timeseries_mapviewerswitch" description="timeseries_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="timeseries_mapviewerswitch"/> + <to state="timeseries_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="timeseries_mapviewerswitch"/> + <to state="timeseries_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="timeseries_with_wkt" description="timeseries_timeseriespoint" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>timeseries_timeseriespoint_with_wkt</queryID> + <dataname>featureid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="wktid"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_with_wkt"/> + <to state="timeseries_vector_scalar"/> + </transition> + <state id="timeseries_area" description="timeseries_area_one" state="de.intevation.gnv.state.DefaultState"> <!-- The QueryID which identifies the Query which is configured in @@ -102,12 +141,12 @@ <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_without_geom"/> - <to state="timeseries_parameter"/> + <to state="timeseries_vector_scalar"/> </transition> - + <state id="timeseries_timeseriespoint" description="timeseries_timeseriespoint" state="de.intevation.gnv.state.DefaultState"> <queryID>timeseries_timeseriespoint_with_area</queryID> <dataname>featureid</dataname> @@ -119,12 +158,35 @@ <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_timeseriespoint"/> + <to state="timeseries_vector_scalar"/> + </transition> + + <state id="timeseries_vector_scalar" description="timeseries_vector_scalar" state="de.intevation.gnv.state.SwitchModeState"> + <dataname>vectorscalar</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="timeseries_vector_scalar"/> <to state="timeseries_parameter"/> + <condition inputvalue="vectorscalar" value="scalar" operator="equal"/> </transition> - + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="timeseries_vector_scalar"/> + <to state="timeseries_parameter_vector"/> + <condition inputvalue="vectorscalar" value="vector" operator="equal"/> + </transition> + <state id="timeseries_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState"> <queryID>timeseries_parameter</queryID> <dataname>parameterid</dataname> @@ -136,12 +198,29 @@ <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/> </inputvalues> </state> - + + <state id="timeseries_parameter_vector" description="timeseries_parameter_vector" state="de.intevation.gnv.state.DefaultState"> + <queryID>timeseries_parameter_vector</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_parameter"/> <to state="timeseries_depth_height"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_parameter_vector"/> + <to state="timeseries_depth_height_vector"/> + </transition> + <state id="timeseries_depth_height" description="timeseries_depth_height" state="de.intevation.gnv.state.MeasurementState"> <queryID>timeseries_depth_height</queryID> <dataname>measurementid</dataname> @@ -153,13 +232,30 @@ <inputvalue name="measurementid" type="Integer" multiselect="true" usedinquery="0"/> </inputvalues> </state> - + + <state id="timeseries_depth_height_vector" description="timeseries_depth_height_vector" state="de.intevation.gnv.state.DefaultState"> + <queryID>timeseries_depth_height_vector</queryID> + <dataname>measurementid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false"/> + <inputvalue name="parameterid" type="Integer" multiselect="true"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="measurementid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_depth_height"/> <to state="timeseries_interval"/> </transition> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_depth_height_vector"/> + <to state="timeseries_interval_vector"/> + </transition> - <state id="timeseries_interval" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxState"> + <state id="timeseries_interval" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxDateState"> <queryID>timeseries_interval</queryID> <dataname>timeinterval</dataname> <data-multiselect>false</data-multiselect> @@ -171,12 +267,30 @@ <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/> </inputvalues> </state> + + <state id="timeseries_interval_vector" description="timeseries_interval_vector" state="de.intevation.gnv.state.MinMaxDateState"> + <queryID>timeseries_interval_vector</queryID> + <dataname>timeinterval</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true"/> + <inputvalue name="measurementid" type="Integer" multiselect="true"/> + <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="0"/> + <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="timeseries_interval"/> <to state="timeseries_calculate_results"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="timeseries_interval_vector"/> + <to state="timeseries_calculate_results_vector"/> + </transition> + <!-- Last state is the Output-state. At this place the differen OutputModes are configured. For each OutputMode it might be necessary to configure separat Databasequery which collect the Data. --> @@ -208,7 +322,7 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> @@ -222,8 +336,52 @@ </outputsModes> <!-- Definition of the TimeGaps which are required to render the Charts properly. each Parameter in each FIS can have --> - <time-gap-definition xlink:href="${artifacts.config.dir}/products/timeseries/timegap_definition.xml" /> + <time-gap-definition xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/timegap_definition.xml" /> </state> - + + <state id="timeseries_calculate_results_vector" description="timeseries_results_vector" state="de.intevation.gnv.state.timeseries.TimeSeriesVectorOutputState"> + <queryID>timeseries_chart_data_vector</queryID> + <queryID-odv>timeseries_odv_data_vector</queryID-odv> + <inputvalues> + <inputvalue name="parameterid" type="Integer" multiselect="true"/> + <inputvalue name="measurementid" type="Integer" multiselect="true"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="minvalue" type="Date" multiselect="false"/> + <inputvalue name="maxvalue" type="Date" multiselect="false"/> + </inputvalues> + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="points" type="Boolean" value="false"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="bincount" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/> + </outputsModes> + <!-- Definition of the TimeGaps which are required to render the Charts properly. + each Parameter in each FIS can have --> + <time-gap-definition xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/timegap_definition.xml" /> + </state> </states> </artifact>
--- a/gnv-artifacts/doc/conf/products/timeseries/timegap_definition.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/timeseries/timegap_definition.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <time-gaps> + <!-- + These gaps are taken from MEDIAN Coded Value Domains. + Section is TSIntervalTypes. + The attribute key is the value which will be used to + lookup a TimeSeriesInterval defined in Table Median.TimeSeries. + The attribute gap is the value of the gap it has to be combined + with the unit of the gap + m ==> Minutes + h ==> Hours + D ==> Days + W ==> Weeks + M ==> Months + Y ==> Years + + These gaps will only be used for TimeSeries on TimeSeriesPoints. + --> <time-gap key = "1" gap="1" unit = "m"/> <time-gap key = "2" gap="2" unit = "m"/> <time-gap key = "3" gap="3" unit = "m"/>
--- a/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,46 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="verticalCrossSectionMesh"> <states> + + <state id="verticalcrosssection_mesh_mapviewerswitch" description="verticalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_mapviewerswitch"/> + <to state="verticalcrosssection_mesh_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_mapviewerswitch"/> + <to state="verticalcrosssection_mesh_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="verticalcrosssection_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_with_wkt"/> + <to state="verticalcrosssection_mesh_linestring"/> + </transition> + <state id="verticalcrosssection_mesh_area" description="verticalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -52,10 +92,18 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="verticalcrosssection_mesh_without_geom"/> - <to state="verticalcrosssection_mesh_linestring"/> - </transition> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_without_geom"/> + <to state="verticalcrosssection_mesh_linestring"/> + <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_without_geom"/> + <to state="verticalcrosssection_mesh_parameter_presettings"/> + <condition inputvalue="geometry" value="LINESTRING" operator="equal"/> + </transition> + <state id="verticalcrosssection_mesh" description="verticalcrosssection_mesh" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_with_area</queryID> @@ -68,11 +116,18 @@ <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> </state> - - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="verticalcrosssection_mesh"/> - <to state="verticalcrosssection_mesh_linestring"/> - </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh"/> + <to state="verticalcrosssection_mesh_linestring"/> + <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh"/> + <to state="verticalcrosssection_mesh_parameter_presettings"/> + <condition inputvalue="geometry" value="LINESTRING" operator="equal"/> + </transition> <state id="verticalcrosssection_mesh_linestring" description="verticalcrosssection_mesh_linestring" state="de.intevation.gnv.state.SingleInputState"> <dataname>mesh_linestring</dataname> @@ -80,7 +135,7 @@ <inputvalues> <inputvalue name="meshid" type="Integer" multiselect="false"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> - <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_linestring" type="Linestring" multiselect="false" usedinquery="0"/> </inputvalues> </state> @@ -89,6 +144,25 @@ <to state="verticalcrosssection_mesh_parameter"/> </transition> + <state id="verticalcrosssection_mesh_parameter_presettings" description="verticalcrosssection_mesh_parameter_presettings" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_parameter</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_linestring"/> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parameter_presettings"/> + <to state="verticalcrosssection_mesh_year"/> + </transition> + <state id="verticalcrosssection_mesh_parameter" description="verticalcrosssection_mesh_parameter" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_parameter</queryID> <dataname>parameterid</dataname> @@ -175,6 +249,7 @@ <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> </exportModes> </outputsMode> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> </outputsModes> </state> </states>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="UTF-8"?> +<artifact name="verticalCrossSectionMeshParallel"> + <states> + + <state id="verticalcrosssection_mesh_parallel_mapviewerswitch" description="verticalcrosssection_mesh_parallel_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel_mapviewerswitch"/> + <to state="verticalcrosssection_mesh_parallel_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel_mapviewerswitch"/> + <to state="verticalcrosssection_mesh_parallel_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_with_wkt"/> + <to state="verticalcrosssection_mesh_point_parallel_presettings"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_area" description="verticalcrosssection_mesh_parallel_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="Integer" 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="verticalcrosssection_mesh_parallel_area"/> + <to state="verticalcrosssection_mesh_parallel_subarea"/> + <condition inputvalue="areaid" value="n/n" operator="notequal"/> + </transition> + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel_area"/> + <to state="verticalcrosssection_mesh_parallel_without_geom"/> + <condition inputvalue="areaid" value="n/n" operator="equal"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_subarea" description="verticalcrosssection_mesh_parallel_area_one" state="de.intevation.gnv.state.DefaultState"> + <queryID>subarea_filter</queryID> + <dataname>subareaid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" 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="verticalcrosssection_mesh_parallel_subarea"/> + <to state="verticalcrosssection_mesh_parallel"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel" description="verticalcrosssection_mesh_parallel" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_with_area</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel"/> + <to state="verticalcrosssection_mesh_point_parallel_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel"/> + <to state="verticalcrosssection_mesh_parallel_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_without_geom" description="verticalcrosssection_mesh_parallel" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel_without_geom"/> + <to state="verticalcrosssection_mesh_parallel_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalcrosssection_mesh_parallel_without_geom"/> + <to state="verticalcrosssection_mesh_point_parallel_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_coordinate" description="verticalcrosssection_mesh_parallel_coordinate" state="de.intevation.gnv.state.SingleInputState"> + <dataname>mesh_coordinate</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_coordinate"/> + <to state="verticalcrosssection_mesh_parallel_point"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_point" description="verticalcrosssection_mesh_parallel_point" state="de.intevation.gnv.state.CoordinateSelectionState"> + <queryID>verticalprofile_mesh_point</queryID> + <dataname>mesh_point</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + </state> + + <state id="verticalcrosssection_mesh_point_parallel_presettings" description="verticalcrosssection_mesh_point_parallel_presettings" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState"> + <queryID>verticalprofile_mesh_point</queryID> + <dataname>mesh_point</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_point_parallel_presettings"/> + <to state="verticalcrosssection_mesh_parallel_axis"/> + </transition> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_point"/> + <to state="verticalcrosssection_mesh_parallel_axis"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_axis" description="verticalcrosssection_mesh_parallel_axis" state="de.intevation.gnv.state.profile.horizontal.NorthSouthEastWestState"> + <dataname>axisid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <!-- the rest is the same as in conf_mesh --> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_axis"/> + <to state="verticalcrosssection_mesh_parallel_parameter"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_parameter" description="verticalcrosssection_mesh_parallel_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_parameter</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_parameter"/> + <to state="verticalcrosssection_mesh_parallel_year"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_year" description="verticalcrosssection_mesh_parallel_year" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalcrosssection_mesh_year</queryID> + <dataname>yearid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_year"/> + <to state="verticalcrosssection_mesh_parallel_date"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_date" description="verticalcrosssection_mesh_parallel_date" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalcrosssection_mesh_date</queryID> + <dataname>dateid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalcrosssection_mesh_parallel_date"/> + <to state="verticalcrosssection_mesh_parallel_calculate_results"/> + </transition> + + <state id="verticalcrosssection_mesh_parallel_calculate_results" description="verticalcrosssection_mesh_parallel_calculate_results" state="de.intevation.gnv.state.profile.verticalcrosssection.VerticalCrossSectionParallelOutputState"> + <queryID>verticalcrosssection_mesh_chart_data</queryID> + <queryID-linestring>verticalcrosssection_mesh_linestring</queryID-linestring> + <queryID-odv>verticalcrosssection_mesh_parallel_odv_data</queryID-odv> + <inputvalues> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + <value-names> + <value-name name="feature" value="mesh_point"></value-name> + <value-name name="parameter" value="parameterid"></value-name> + <value-name name="measurement" value="depthid"></value-name> + </value-names> + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> + </outputsModes> + </state> + </states> +</artifact>
--- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,142 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="verticalProfileInstantaneousPoint"> <states> + <state id="verticalprofile_instantaneouspoint_mapviewerswitch" description="verticalprofile_instantaneouspoint_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_instantaneouspoint_mapviewerswitch"/> + <to state="verticalprofile_instantaneouspoint_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_instantaneouspoint_mapviewerswitch"/> + <to state="verticalprofile_instantaneouspoint_series_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="verticalprofile_instantaneouspoint_area" description="verticalprofile_instantaneouspoint_area" 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="Integer" 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="verticalprofile_instantaneouspoint_area"/> + <to state="verticalprofile_instantaneouspoint_subarea"/> + <condition inputvalue="areaid" value="n/n" operator="notequal"/> + </transition> + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="verticalprofile_instantaneouspoint_area"/> + <to state="verticalprofile_instantaneouspoint_series"/> + <condition inputvalue="areaid" value="n/n" operator="equal"/> + </transition> + + <state id="verticalprofile_instantaneouspoint_subarea" description="verticalprofile_instantaneouspoint_subarea" state="de.intevation.gnv.state.DefaultState"> + <queryID>subarea_filter</queryID> + <dataname>subareaid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" 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="verticalprofile_instantaneouspoint_subarea"/> + <to state="verticalprofile_instantaneouspoint_series_with_aera"/> + </transition> + + + <!-- Anfang: Sonderfall Aufruf unter Berücksichtigung des WKT --> + <state id="verticalprofile_instantaneouspoint_series_with_wkt" description="verticalprofile_instantaneouspoint_series" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_instantaneouspoint_series_with_wkt</queryID> + <dataname>seriesid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="wktid"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_instantaneouspoint_series_with_wkt"/> + <to state="verticalprofile_instantaneouspoint_point_with_wkt"/> + </transition> + + <state id="verticalprofile_instantaneouspoint_point_with_wkt" description="verticalprofile_instantaneouspoint_point" state="de.intevation.gnv.state.CoordinateSelectionState"> + <queryID>verticalprofile_instantaneouspoint_point_with_wkt</queryID> + <dataname>instantaneouspoint_point</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="instantaneouspoint_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_instantaneouspoint_point_with_wkt"/> + <to state="verticalprofile_instantaneouspoint_parameter"/> + </transition> + <!-- Ende: Sonderfall Aufruf unter Berücksichtigung des WKT --> + + + <!-- Anfang: Sonderfall Aufruf unter Berücksichtigung des Gebietsfilters --> + <state id="verticalprofile_instantaneouspoint_series_with_aera" description="verticalprofile_instantaneouspoint_series" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_instantaneouspoint_series_with_area</queryID> + <dataname>seriesid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_instantaneouspoint_series_with_aera"/> + <to state="verticalprofile_instantaneouspoint_point_with_aera"/> + </transition> + + <state id="verticalprofile_instantaneouspoint_point_with_aera" description="verticalprofile_instantaneouspoint_point" state="de.intevation.gnv.state.CoordinateSelectionState"> + <queryID>verticalprofile_instantaneouspoint_point_with_aera</queryID> + <dataname>instantaneouspoint_point</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="instantaneouspoint_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_instantaneouspoint_point_with_aera"/> + <to state="verticalprofile_instantaneouspoint_parameter"/> + </transition> + <!-- Ende: Sonderfall Aufruf unter Berücksichtigung des Gebietsfilters --> + <state id="verticalprofile_instantaneouspoint_series" description="verticalprofile_instantaneouspoint_series" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_instantaneouspoint_series</queryID> <dataname>seriesid</dataname> @@ -105,7 +241,7 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
--- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,64 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="verticalProfileMesh"> <states> + <state id="verticalprofile_mesh_mapviewerswitch" description="verticalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mesh_mapviewerswitch"/> + <to state="verticalprofile_mesh_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mesh_mapviewerswitch"/> + <to state="verticalprofile_mesh_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="verticalprofile_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>verticalprofile_mesh_with_wkt</queryID> + <dataname>meshid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_mesh_with_wkt"/> + <to state="verticalprofile_mesh_point_presettings"/> + </transition> + + <state id="verticalprofile_mesh_point_presettings" description="verticalprofile_meshpoint" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState"> + <queryID>verticalprofile_mesh_point</queryID> + <dataname>mesh_point</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false"/> + <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_mesh_point_presettings"/> + <to state="verticalprofile_mesh_mindepth"/> + </transition> + <state id="verticalprofile_mesh_area" description="verticalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -41,7 +99,7 @@ <to state="verticalprofile_mesh"/> </transition> - <state id="verticalprofile_mesh_without_geom" description="timeseries_mesh_without_geom" state="de.intevation.gnv.state.DefaultState"> + <state id="verticalprofile_mesh_without_geom" description="verticalprofile_mesh_without_geom" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh</queryID> <dataname>meshid</dataname> <data-multiselect>false</data-multiselect> @@ -52,10 +110,17 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="verticalprofile_mesh_without_geom"/> - <to state="verticalprofile_mesh_coordinate"/> - </transition> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mesh_without_geom"/> + <to state="verticalprofile_mesh_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mesh_without_geom"/> + <to state="verticalprofile_mesh_point_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> <state id="verticalprofile_mesh" description="verticalprofile_mesh" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_with_area</queryID> @@ -69,10 +134,17 @@ </inputvalues> </state> - <transition transition="de.intevation.gnv.transition.DefaultTransition"> - <from state="verticalprofile_mesh"/> - <to state="verticalprofile_mesh_coordinate"/> - </transition> + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mesh"/> + <to state="verticalprofile_mesh_coordinate"/> + <condition inputvalue="geometry" value="POINT" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mesh"/> + <to state="verticalprofile_mesh_point_presettings"/> + <condition inputvalue="geometry" value="POINT" operator="equal"/> + </transition> <state id="verticalprofile_mesh_coordinate" description="verticalprofile_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState"> <dataname>mesh_coordinate</dataname> @@ -99,7 +171,7 @@ <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> </inputvalues> - <mesh-width xlink:href="${artifacts.config.dir}/meshwidth.xml"/> + <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/> </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> @@ -139,12 +211,37 @@ <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_mesh_maxdepth"/> - <to state="verticalprofile_meshpoint_parameter"/> + <to state="verticalprofile_meshpoint_vector_scalar"/> </transition> - + + <state id="verticalprofile_meshpoint_vector_scalar" description="verticalprofile_meshpoint_vector_scalar" state="de.intevation.gnv.state.SwitchModeState"> + <dataname>vectorscalar</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="verticalprofile_meshpoint_vector_scalar"/> + <to state="verticalprofile_meshpoint_parameter"/> + <condition inputvalue="vectorscalar" value="scalar" operator="equal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="verticalprofile_meshpoint_vector_scalar"/> + <to state="verticalprofile_meshpoint_parameter_vector"/> + <condition inputvalue="vectorscalar" value="vector" operator="equal"/> + </transition> + <state id="verticalprofile_meshpoint_parameter" description="verticalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_parameter</queryID> <dataname>parameterid</dataname> @@ -160,11 +257,31 @@ </inputvalues> </state> + <state id="verticalprofile_meshpoint_parameter_vector" description="verticalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_parameter_vector</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0" /> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_meshpoint_parameter"/> <to state="verticalprofile_mesh_year"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_meshpoint_parameter_vector"/> + <to state="verticalprofile_mesh_year_vector"/> + </transition> + <state id="verticalprofile_mesh_year" description="verticalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_year</queryID> <dataname>yearid</dataname> @@ -179,12 +296,32 @@ <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/> </inputvalues> </state> + + <state id="verticalprofile_mesh_year_vector" description="verticalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_year_vector</queryID> + <dataname>yearid</dataname> + <data-multiselect>true</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1" /> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/> + </inputvalues> + </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_mesh_year"/> <to state="verticalprofile_mesh_date"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_mesh_year_vector"/> + <to state="verticalprofile_mesh_date_vector"/> + </transition> + <state id="verticalprofile_mesh_date" description="verticalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_mesh_date</queryID> <dataname>dateid</dataname> @@ -200,12 +337,33 @@ <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/> </inputvalues> </state> - + + <state id="verticalprofile_mesh_date_vector" description="verticalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_mesh_date_vector</queryID> + <dataname>dateid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1" /> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_mesh_date"/> <to state="verticalprofile_mesh_calculate_results"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_mesh_date_vector"/> + <to state="verticalprofile_mesh_calculate_results_vector"/> + </transition> + <state id="verticalprofile_mesh_calculate_results" description="verticalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileOutputState"> <queryID>verticalprofile_mesh_chart_data</queryID> <queryID-odv>verticalprofile_mesh_odv_data</queryID-odv> @@ -241,7 +399,56 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/> + </outputsModes> + </state> + + <state id="verticalprofile_mesh_calculate_results_vector" description="verticalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileMeshVectorOutputState"> + <queryID>verticalprofile_mesh_chart_data_vector</queryID> + <queryID-odv>verticalprofile_mesh_odv_data_vector</queryID-odv> + <inputvalues> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="1"/> + <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="1"/> + </inputvalues> + <value-names> + <value-name name="feature" value="mesh_point"></value-name> + <value-name name="parameter" value="parameterid"></value-name> + <value-name name="measurement" value="dateid"></value-name> + </value-names> + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="points" type="Boolean" value="false"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="bincount" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
--- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> <artifact name="verticalProfile"> <states> + <state id="verticalprofile_mapviewerswitch" description="verticalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState"> + <!-- Empty State which will be used to integrate the switch for a + standalone and an mapviewer based call. --> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mapviewerswitch"/> + <to state="verticalprofile_area"/> + <condition inputvalue="geometry" value="POLYGON" operator="notequal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition"> + <from state="verticalprofile_mapviewerswitch"/> + <to state="verticalprofile_with_wkt"/> + <condition inputvalue="geometry" value="POLYGON" operator="equal"/> + </transition> + + <state id="verticalprofile_with_wkt" description="verticalprofile_timeseriespoint" state="de.intevation.gnv.state.PreSettingsTransferState"> + <queryID>timeseries_timeseriespoint_with_wkt</queryID> + <dataname>featureid</dataname> + <data-multiselect>false</data-multiselect> + <presettings-transfer presetting="geometry" inputvalue="wktid"/> + <inputvalues> + <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_with_wkt"/> + <to state="verticalprofile_vector_scalar"/> + </transition> + <state id="verticalprofile_area" description="verticalprofile_area_one" state="de.intevation.gnv.state.DefaultState"> <queryID>area_filter</queryID> <dataname>areaid</dataname> @@ -54,7 +93,7 @@ <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_without_geom"/> - <to state="verticalprofile_parameter"/> + <to state="verticalprofile_vector_scalar"/> </transition> <state id="verticalprofile_timeseriespoint" description="timeseries_timeseriespoint" state="de.intevation.gnv.state.DefaultState"> @@ -71,9 +110,31 @@ <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_timeseriespoint"/> + <to state="verticalprofile_vector_scalar"/> + </transition> + + <state id="verticalprofile_vector_scalar" description="timeseries_vector_scalar" state="de.intevation.gnv.state.SwitchModeState"> + <dataname>vectorscalar</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="verticalprofile_vector_scalar"/> <to state="verticalprofile_parameter"/> - </transition> - + <condition inputvalue="vectorscalar" value="scalar" operator="equal"/> + </transition> + + <transition transition="de.intevation.gnv.transition.ValueCompareTransition"> + <from state="verticalprofile_vector_scalar"/> + <to state="verticalprofile_parameter_vector"/> + <condition inputvalue="vectorscalar" value="vector" operator="equal"/> + </transition> + <state id="verticalprofile_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_parameter</queryID> <dataname>parameterid</dataname> @@ -85,12 +146,29 @@ <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/> </inputvalues> </state> + + <state id="verticalprofile_parameter_vector" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_parameter_vector</queryID> + <dataname>parameterid</dataname> + <presettings-name>parameter</presettings-name> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_parameter"/> <to state="verticalprofile_year"/> </transition> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_parameter_vector"/> + <to state="verticalprofile_year_vector"/> + </transition> + <state id="verticalprofile_year" description="verticalprofile_year" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_year</queryID> <dataname>yearid</dataname> @@ -102,11 +180,28 @@ <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/> </inputvalues> </state> + + <state id="verticalprofile_year_vector" description="verticalprofile_year" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_year_vector</queryID> + <dataname>yearid</dataname> + <data-multiselect>true</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/> + </inputvalues> + </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_year"/> <to state="verticalprofile_date"/> </transition> + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_year_vector"/> + <to state="verticalprofile_date_vector"/> + </transition> <state id="verticalprofile_date" description="verticalprofile_date" state="de.intevation.gnv.state.DefaultState"> <queryID>verticalprofile_date</queryID> @@ -120,12 +215,30 @@ <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/> </inputvalues> </state> + + <state id="verticalprofile_date_vector" description="verticalprofile_date" state="de.intevation.gnv.state.DefaultState"> + <queryID>verticalprofile_date_vector</queryID> + <dataname>dateid</dataname> + <data-multiselect>false</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_date"/> <to state="verticalprofile_minmaxdepth"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_date_vector"/> + <to state="verticalprofile_minmaxdepth_vector"/> + </transition> + <state id="verticalprofile_minmaxdepth" description="verticalprofile_minmaxdepth" state="de.intevation.gnv.state.MinMaxState"> <queryID>verticalprofile_minmaxdepth</queryID> <dataname>depthrange</dataname> @@ -139,12 +252,31 @@ <inputvalue name="maxvalue" type="Double" multiselect="false" usedinquery="0"/> </inputvalues> </state> - + + <state id="verticalprofile_minmaxdepth_vector" description="verticalprofile_minmaxdepth" state="de.intevation.gnv.state.MinMaxState"> + <queryID>verticalprofile_minmaxdepth_vector</queryID> + <dataname>depthrange</dataname> + <data-multiselect>true</data-multiselect> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/> + <inputvalue name="minvalue" type="Double" multiselect="false" usedinquery="0"/> + <inputvalue name="maxvalue" type="Double" multiselect="false" usedinquery="0"/> + </inputvalues> + </state> + <transition transition="de.intevation.gnv.transition.DefaultTransition"> <from state="verticalprofile_minmaxdepth"/> <to state="verticalprofile_calculate_results"/> </transition> - + + <transition transition="de.intevation.gnv.transition.DefaultTransition"> + <from state="verticalprofile_minmaxdepth_vector"/> + <to state="verticalprofile_calculate_results_vector"/> + </transition> + <state id="verticalprofile_calculate_results" description="verticalprofile_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileOutputState"> <queryID>verticalprofile_chart_data</queryID> <queryID-odv>verticalprofile_odv_data</queryID-odv> @@ -179,7 +311,55 @@ <inputvalue name="width" type="Integer" value="600"/> <inputvalue name="height" type="Integer" value="400"/> <inputvalue name="bincount" type="Integer" value="7"/> - <inputvalue name="binwidth" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/> + <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/> + </outputsModes> + </state> + + <state id="verticalprofile_calculate_results_vector" description="verticalprofile_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileVectorOutputState"> + <queryID>verticalprofile_chart_data_vector</queryID> + <queryID-odv>verticalprofile_odv_data_vector</queryID-odv> + <inputvalues> + <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> + <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/> + <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> + <inputvalue name="minvalue" type="Double" multiselect="false" usedinquery="1"/> + <inputvalue name="maxvalue" type="Double" multiselect="false" usedinquery="1"/> + </inputvalues> + <value-names> + <value-name name="feature" value="featureid"></value-name> + <value-name name="parameter" value="parameterid"></value-name> + <value-name name="measurement" value="dateid"></value-name> + </value-names> + <outputsModes> + <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="points" type="Boolean" value="false"/> + </parameters> + <exportModes> + <export name="img" description="IMG-Export der Daten" mime-type="image/png" /> + <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" /> + <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" /> + </exportModes> + </outputsMode> + <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png"> + <parameters> + <inputvalue name="width" type="Integer" value="600"/> + <inputvalue name="height" type="Integer" value="400"/> + <inputvalue name="bincount" type="Integer" value="7"/> + <inputvalue name="binwidth" type="Double" value="7"/> </parameters> <exportModes> <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
--- a/gnv-artifacts/doc/conf/queries.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/conf/queries.properties Fri Sep 28 12:15:21 2012 +0200 @@ -28,6 +28,16 @@ )\ ORDER BY MEDIAN.TIMESERIESPOINT.NAME +timeseries_timeseriespoint_with_wkt=SELECT \ + MEDIAN.TIMESERIESPOINT.FEATUREID KEY, \ + MEDIAN.TIMESERIESPOINT.NAME VALUE \ + FROM MEDIAN.TIMESERIESPOINT, \ + MEDIAN.MEASUREMENT MMT \ + WHERE MEDIAN.TIMESERIESPOINT.FEATUREID = MMT.FEATUREID AND \ + MMT.SOURCEID = ? AND \ + INTERSECTS(SHAPE,"?")\ + ORDER BY MEDIAN.TIMESERIESPOINT.NAME + timeseries_parameter=SELECT DISTINCT \ p.PARAMETERID KEY, \ p.GERMANNAME || ' ['|| p.UNIT ||']' VALUE, \ @@ -95,7 +105,8 @@ TSV.DATAVALUE, \ TS.PARAMETERID PARAMETER, \ TSV.MEASUREMENTID, \ - TSV.TIMESERIESID \ + TSV.TIMESERIESID, \ + '1' QF \ FROM MEDIAN.TIMESERIESPOINT, \ MEDIAN.TIMESERIESVALUE TSV, \ MEDIAN.TIMESERIES TS, \ @@ -109,12 +120,114 @@ TSV.MEASUREMENTID IN ( ? ) AND \ TSV.TIMEVALUE >= ? AND \ TSV.TIMEVALUE <= ? \ - ORDER BY TSV.MEASUREMENTID, \ + ORDER BY TS.PARAMETERID, \ + TSV.MEASUREMENTID, \ TSV.TIMESERIESID, \ - TS.PARAMETERID, \ + TSV.TIMEVALUE + +############################################# +############################################# +########## Zeitserie ############## +########## Vektordaten ############### +############################################# +############################################# + +timeseries_parameter_vector=SELECT DISTINCT \ + p.PARAMETERID KEY, \ + p.GERMANNAME || ' ['|| p.UNIT ||']' VALUE, \ + p.GERMANNAME \ + FROM MEDIAN.PARAMETER P, \ + MEDIAN.TIMESERIES TS, \ + MEDIAN.TIMESERIESVECTORVALUE TSV, \ + MEDIAN.MEASUREMENT M, \ + MEDIAN.TIMESERIESPOINT TSP \ + WHERE M.FEATUREID = TSP.FEATUREID AND \ + M.MEASUREMENTID = TSV.MEASUREMENTID AND \ + TS.TIMESERIESID = TSV.TIMESERIESID AND \ + P.PARAMETERID = TS.PARAMETERID AND \ + TSP.FEATUREID = ? \ + ORDER BY P.GERMANNAME + +timeseries_depth_height_vector=SELECT DISTINCT \ + M.MEASUREMENTID KEY, \ + M.ZLOCATION VALUE, \ + P.PARAMETERID PARAMETERID \ + FROM MEDIAN.MEASUREMENT M, \ + MEDIAN.TIMESERIESVECTORVALUE TSV, \ + MEDIAN.TIMESERIES T, \ + MEDIAN.PARAMETER P \ + WHERE M.MEASUREMENTID = TSV.MEASUREMENTID AND \ + TSV.TIMESERIESID = T.TIMESERIESID AND \ + T.PARAMETERID = P.PARAMETERID AND \ + M.FEATUREID = ? AND \ + P.PARAMETERID = ? \ + ORDER BY m.ZLOCATION DESC + +timeseries_interval_vector=select min(tsv.TIMEVALUE) MIN, \ + max(tsv.TIMEVALUE) MAX \ + from MEDIAN.TIMESERIES t, \ + MEDIAN.TIMESERIESVECTORVALUE tsv \ + where tsv.TIMESERIESID = t.TIMESERIESID AND \ + t.PARAMETERID = ? AND \ + tsv.MEASUREMENTID = ? + +timeseries_chart_data_vector=SELECT tsv.TIMEVALUE XORDINATE, \ + tsv.XCOMPONENT, \ + tsv.YCOMPONENT, \ + tsv.ZCOMPONENT, \ + tsv.SPEED, \ + tsv.DIRECTION, \ + t.PARAMETERID GROUP1, \ + tsv.MEASUREMENTID GROUP2, \ + tsv.TIMESERIESID GROUP3, \ + t.TIMEINTERVAL GAPID \ + FROM MEDIAN.TIMESERIESFULLVECTORVALUE tsv, \ + MEDIAN.TIMESERIES t \ + WHERE tsv.TIMESERIESID = t.TIMESERIESID AND \ + t.PARAMETERID = ? AND \ + tsv.MEASUREMENTID = ? AND \ + tsv.TIMEVALUE >= ? AND \ + tsv.TIMEVALUE <= ? \ + ORDER BY tsv.MEASUREMENTID, \ + tsv.TIMESERIESID, \ + t.PARAMETERID, \ + tsv.TIMEVALUE + +timeseries_odv_data_vector = SELECT SI.NAME CRUISE, \ + MEDIAN.TIMESERIESPOINT.NAME STATION, \ + '*' TYPE, \ + ST_ASTEXT(SHAPE), \ + 0 BOTDEPTH, \ + (M.ZLOCATION *-1) DEPTH, \ + TSV.TIMEVALUE, \ + TSV.XCOMPONENT, \ + TSV.YCOMPONENT, \ + TSV.ZCOMPONENT, \ + TSV.SPEED, \ + TSV.DIRECTION, \ + TS.PARAMETERID PARAMETER, \ + TSV.MEASUREMENTID, \ + TSV.TIMESERIESID, \ + '1' QF \ + FROM MEDIAN.TIMESERIESPOINT, \ + MEDIAN.TIMESERIESFULLVECTORVALUE TSV, \ + MEDIAN.TIMESERIES TS, \ + MEDIAN.MEASUREMENT M, \ + MEDIAN.SOURCEINFO SI \ + WHERE SI.SOURCEID = M.SOURCEID AND \ + M.FEATUREID = MEDIAN.TIMESERIESPOINT.FEATUREID AND \ + M.MEASUREMENTID = TSV.MEASUREMENTID AND \ + TSV.TIMESERIESID = TS.TIMESERIESID AND \ + TS.PARAMETERID = ? AND \ + TSV.MEASUREMENTID = ? AND \ + TSV.TIMEVALUE >= ? AND \ + TSV.TIMEVALUE <= ? \ + ORDER BY TS.PARAMETERID, \ + TSV.MEASUREMENTID, \ + TSV.TIMESERIESID, \ TSV.TIMEVALUE -############################################# +############################################ ############################################# ########## Zeitserie Mesh ############## ############################################# @@ -154,8 +267,9 @@ from MEDIAN.PARAMETER p, \ MEDIAN.MESHSCALARVALUE msc, \ MEDIAN.MESH m \ - where m.OBJECTID = ? AND \ - msc.PARTID = m.PARTIDMIN AND \ + where m.OBJECTID = ? AND \ + msc.PARTID >= m.PARTIDMIN AND \ + msc.PARTID <= m.PARTIDMAX AND \ msc.PARAMETERID = p.PARAMETERID \ order by p.GERMANNAME timeseries_mesh_interval=select /*+ parallel(TIMEVALUE,5) */ \ @@ -200,7 +314,8 @@ (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \ msv.TIMEVALUE, \ msv.DATAVALUE, \ - msv.PARAMETERID PARAMETER \ + msv.PARAMETERID PARAMETER, \ + '1' QF \ from MEDIAN.MESHSCALARVALUE msv, \ MEDIAN.MESHPOINT, \ MEDIAN.MESH m, \ @@ -219,9 +334,101 @@ msv.TIMEVALUE <= ? \ order by MEDIAN.MESHPOINT.FEATUREID, \ msv.FEATUREID, \ - msv.PARAMETERID, \ - msv.TIMEVALUE + msv.TIMEVALUE, \ + msv.PARAMETERID +############################################# +############################################# +########## Zeitserie Mesh ############## +########## Vektordaten ############## +############################################# +############################################# + +timeseries_mesh_parameter_vector=SELECT DISTINCT \ + P.PARAMETERID KEY, \ + P.GERMANNAME || ' ['|| P.UNIT ||']' VALUE, \ + P.GERMANNAME \ + FROM MEDIAN.PARAMETER P, \ + MEDIAN.MESHVECTORVALUE MVV, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX AND \ + MVV.PARAMETERID = P.PARAMETERID \ + ORDER BY P.GERMANNAME + +timeseries_mesh_interval_vector=SELECT /*+ parallel(TIMEVALUE,5) */ \ + MIN(TIMEVALUE) MIN, \ + MAX(TIMEVALUE) MAX \ + FROM MEDIAN.MESHVECTORVALUE MVV, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX AND \ + MVV.PARAMETERID IN (?) + +timeseries_mesh_chart_data_vector =SELECT /*+ parallel(TIMEVALUE,10) */ \ + MVV.TIMEVALUE XORDINATE, \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID GROUP1, \ + MVV.FEATUREID GROUP2, \ + MP.FEATUREID GROUP3, \ + -1 GAPID \ + FROM MEDIAN.MESHCURRENTVALUE MVV, \ + MEDIAN.MESHPOINT MP, \ + MEDIAN.MESH M \ + WHERE (M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX ) AND \ + MVV.FEATUREID = MP.FEATUREID AND \ + MVV.PARAMETERID in ( ? ) AND \ + MP.FEATUREID in ( ? ) AND \ + MVV.TIMEVALUE >= ? AND \ + MVV.TIMEVALUE <= ? \ + ORDER BY MP.FEATUREID, \ + MVV.FEATUREID, \ + MVV.PARAMETERID, \ + MVV.TIMEVALUE + +timeseries_mesh_odv_data_vector = SELECT /*+ parallel(timevalue,10) */ \ + SI.NAME CRUISE, \ + M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \ + '*' TYPE, \ + ST_ASTEXT(SHAPE), \ + 0 BOTDEPTH, \ + (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \ + MVV.TIMEVALUE, \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID PARAMETER, \ + '1' QF \ + FROM MEDIAN.MESHCURRENTVALUE MVV, \ + MEDIAN.MESHPOINT, \ + MEDIAN.MESH M, \ + MEDIAN.SOURCEINFO SI, \ + MEDIAN.MESHLAYER ML \ + WHERE (M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX ) AND \ + M.SOURCEID = SI.SOURCEID AND \ + ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \ + MVV.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \ + MVV.PARAMETERID in (? ) AND \ + MEDIAN.MESHPOINT.FEATUREID in ( ? ) AND \ + MVV.TIMEVALUE >= ? AND \ + MVV.TIMEVALUE <= ? \ + ORDER BY MEDIAN.MESHPOINT.FEATUREID, \ + MVV.FEATUREID, \ + MVV.TIMEVALUE, \ + MVV.PARAMETERID ############################################# ############################################# @@ -293,7 +500,9 @@ TS.PARAMETERID GROUP1, \ TSV.TIMEVALUE GROUP2, \ 1 GROUP3, \ - 1 DATAID \ + 1 DATAID, \ + M.FEATUREID, \ + TS.TIMESERIESID \ from MEDIAN.TIMESERIES TS, \ MEDIAN.TIMESERIESVALUE TSV, \ MEDIAN.MEASUREMENT M \ @@ -314,12 +523,13 @@ '*' TYPE, \ ST_ASTEXT(SHAPE), \ 0 BOTDEPTH, \ - (M.ZLOCATION *-1) DEPTH, \ + (M.ZLOCATION) DEPTH, \ TSV.TIMEVALUE, \ TSV.DATAVALUE, \ TS.PARAMETERID PARAMETER, \ TSV.MEASUREMENTID, \ - TSV.TIMESERIESID \ + TSV.TIMESERIESID, \ + '1' QF \ FROM MEDIAN.TIMESERIESPOINT, \ MEDIAN.TIMESERIESVALUE TSV, \ MEDIAN.TIMESERIES TS, \ @@ -336,9 +546,127 @@ M.ZLOCATION <= ? \ ORDER BY TSV.MEASUREMENTID, \ TSV.TIMESERIESID, \ - TS.PARAMETERID, \ - TSV.TIMEVALUE - + TSV.TIMEVALUE, \ + TS.PARAMETERID + +############################################# +############################################# +########## Vertikalprofil ############## +########## Vektordaten ############## +############################################# +############################################# + +verticalprofile_parameter_vector=SELECT DISTINCT \ + P.PARAMETERID KEY, \ + P.GERMANNAME || ' ['|| P.UNIT ||']' VALUE, \ + P.GERMANNAME \ + from MEDIAN.PARAMETER P, \ + MEDIAN.TIMESERIES TS, \ + MEDIAN.TIMESERIESVECTORVALUE TVV, \ + MEDIAN.MEASUREMENT M \ + where TS.PARAMETERID = P.PARAMETERID AND \ + TS.TIMESERIESID = TVV.TIMESERIESID AND \ + M.MEASUREMENTID = TVV.MEASUREMENTID AND \ + M.FEATUREID = ? \ + ORDER BY P.GERMANNAME + +verticalprofile_minmaxdepth_vector= SELECT MIN(M.ZLOCATION) MIN, \ + MAX(M.ZLOCATION) MAX \ + FROM MEDIAN.MEASUREMENT M, \ + MEDIAN.TIMESERIES TS, \ + MEDIAN.TIMESERIESVECTORVALUE TVV \ + WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \ + M.MEASUREMENTID = TVV.MEASUREMENTID AND \ + M.FEATUREID = ? AND \ + TS.PARAMETERID = ? + +verticalprofile_year_vector=SELECT DISTINCT \ + TO_CHAR(TVV.TIMEVALUE,'YYYY') KEY, \ + TO_CHAR(TVV.TIMEVALUE,'YYYY') VALUE \ + FROM MEDIAN.TIMESERIES TS, \ + MEDIAN.TIMESERIESVECTORVALUE TVV, \ + MEDIAN.MEASUREMENT M \ + WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \ + M.MEASUREMENTID = TVV.MEASUREMENTID AND \ + M.FEATUREID = ? AND \ + TS.PARAMETERID = ? \ + ORDER BY to_char(TVV.TIMEVALUE,'YYYY') + +verticalprofile_date_vector=SELECT DISTINCT \ + TVV.TIMEVALUE KEY, \ + TVV.TIMEVALUE VALUE \ + from MEDIAN.TIMESERIES TS, \ + MEDIAN.TIMESERIESVECTORVALUE TVV, \ + MEDIAN.MEASUREMENT M \ + WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \ + M.MEASUREMENTID = TVV.MEASUREMENTID AND \ + M.FEATUREID = ? AND \ + TS.PARAMETERID = ? AND \ + TO_CHAR(TVV.TIMEVALUE,'YYYY') IN (?) \ + ORDER BY TVV.TIMEVALUE + +verticalprofile_chart_data_vector= SELECT M.ZLOCATION XORDINATE, \ + TS.PARAMETERID GROUP1, \ + TVV.TIMEVALUE GROUP2, \ + TVV.XCOMPONENT, \ + TVV.YCOMPONENT, \ + TVV.ZCOMPONENT, \ + TVV.SPEED, \ + TVV.DIRECTION, \ + 1 GROUP3, \ + 1 DATAID, \ + M.FEATUREID, \ + TS.TIMESERIESID \ + FROM MEDIAN.TIMESERIES TS, \ + MEDIAN.TIMESERIESFULLVECTORVALUE TVV, \ + MEDIAN.MEASUREMENT M \ + WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \ + M.MEASUREMENTID = TVV.MEASUREMENTID AND \ + M.FEATUREID = ? AND \ + TS.PARAMETERID = ? AND \ + TVV.TIMEVALUE = ? AND \ + M.ZLOCATION >= ? AND \ + M.ZLOCATION <= ? \ + ORDER BY TVV.TIMEVALUE, \ + TVV.TIMESERIESID, \ + TS.PARAMETERID, \ + TVV.TIMEVALUE + +verticalprofile_odv_data_vector = SELECT SI.NAME CRUISE, \ + MEDIAN.TIMESERIESPOINT.NAME STATION, \ + '*' TYPE, \ + ST_ASTEXT(SHAPE), \ + 0 BOTDEPTH, \ + (M.ZLOCATION) DEPTH, \ + TVV.TIMEVALUE, \ + TVV.XCOMPONENT, \ + TVV.YCOMPONENT, \ + TVV.ZCOMPONENT, \ + TVV.SPEED, \ + TVV.DIRECTION, \ + TS.PARAMETERID PARAMETER, \ + TVV.MEASUREMENTID, \ + TVV.TIMESERIESID, \ + '1' QF \ + FROM MEDIAN.TIMESERIESPOINT, \ + MEDIAN.TIMESERIESFULLVECTORVALUE TVV, \ + MEDIAN.TIMESERIES TS, \ + MEDIAN.MEASUREMENT M, \ + MEDIAN.SOURCEINFO SI \ + WHERE SI.SOURCEID = M.SOURCEID AND \ + M.FEATUREID = MEDIAN.TIMESERIESPOINT.FEATUREID AND \ + M.MEASUREMENTID = TVV.MEASUREMENTID AND \ + TVV.TIMESERIESID = TS.TIMESERIESID AND \ + M.FEATUREID = ? AND \ + TS.PARAMETERID = ? AND \ + TVV.TIMEVALUE = ? AND \ + M.ZLOCATION >= ? AND \ + M.ZLOCATION <= ? \ + ORDER BY TVV.MEASUREMENTID, \ + TVV.TIMESERIESID, \ + TVV.TIMEVALUE, \ + TS.PARAMETERID + ############################################# ############################################# ########## Vertikalprofil Mesh ############## @@ -364,6 +692,15 @@ FEATURECODE = ? )\ ) \ order by M.NAME + +verticalprofile_mesh_with_wkt = SELECT M.OBJECTID KEY, \ + M.NAME VALUE \ + FROM MEDIAN.MESHPOINT, \ + MEDIAN.MESH M \ + WHERE M.SOURCEID IN (?) AND \ + M.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + INTERSECTS(SHAPE, "?") \ + order by M.NAME verticalprofile_mesh_point = SELECT FEATUREID, \ ST_ASTEXT(SHAPE) \ @@ -410,7 +747,8 @@ MEDIAN.MESHSCALARVALUE msc, \ MEDIAN.MESH m \ where m.OBJECTID = ? AND \ - m.PARTIDMIN = msc.PARTID AND \ + msc.PARTID >= m.PARTIDMIN AND \ + msc.PARTID <= m.PARTIDMAX AND \ msc.PARAMETERID = p.PARAMETERID \ order by p.GERMANNAME @@ -443,7 +781,9 @@ msv.PARAMETERID GROUP1, \ msv.TIMEVALUE GROUP2, \ 1 GROUP3, \ - 2 DATAID \ + 2 DATAID, \ + MP.FEATUREID, \ + MP.MESHID \ from MEDIAN.MESHLAYER ml, \ MEDIAN.MESHPOINT mp, \ MEDIAN.MESH m, \ @@ -476,10 +816,11 @@ '*' TYPE, \ ST_ASTEXT(SHAPE), \ 0 BOTDEPTH, \ - (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \ + (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)) DEPTH, \ msv.DATAVALUE, \ msv.PARAMETERID PARAMETER, \ - msv.TIMEVALUE \ + msv.TIMEVALUE , \ + '1' QF \ from MEDIAN.MESHLAYER ml, \ MEDIAN.MESHPOINT, \ MEDIAN.MESH m, \ @@ -505,10 +846,136 @@ JPOSITION = (select JPOSITION from MEDIAN.MESHPOINT where FEATUREID = ?)) AND \ MEDIAN.MESHPOINT.KPOSITION <= ? AND \ MEDIAN.MESHPOINT.KPOSITION >= ? \ - order by msv.PARAMETERID, \ - msv.TIMEVALUE, \ - ml.UPPERZLOCATION + order by msv.TIMEVALUE, \ + ml.UPPERZLOCATION, \ + msv.PARAMETERID + +############################################# +############################################# +########## Vertikalprofil Mesh ############## +########## Vektordaten ############## +############################################# +############################################# + +verticalprofile_mesh_parameter_vector=SELECT DISTINCT \ + P.PARAMETERID KEY, \ + P.GERMANNAME || ' ['|| P.UNIT ||']' VALUE, \ + P.GERMANNAME \ + FROM MEDIAN.PARAMETER P, \ + MEDIAN.MESHVECTORVALUE MVV, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX AND \ + MVV.PARAMETERID = P.PARAMETERID \ + ORDER BY P.GERMANNAME + +verticalprofile_mesh_year_vector= SELECT DISTINCT \ + to_char(MVV.TIMEVALUE,'YYYY') KEY, \ + to_char(MVV.TIMEVALUE,'YYYY') VALUE \ + FROM MEDIAN.MESHVECTORVALUE MVV, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX AND \ + MVV.PARAMETERID in (?) \ + ORDER BY to_char(MVV.TIMEVALUE, 'YYYY') + +verticalprofile_mesh_date_vector= SELECT DISTINCT \ + MVV.TIMEVALUE KEY, \ + MVV.TIMEVALUE VALUE \ + FROM MEDIAN.MESHVECTORVALUE MVV, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MVV.PARTID >= M.PARTIDMIN AND \ + MVV.PARTID <= M.PARTIDMAX AND \ + MVV.PARAMETERID in (?) AND \ + to_char(MVV.TIMEVALUE,'YYYY') in (?) \ + ORDER BY MVV.TIMEVALUE + +verticalprofile_mesh_chart_data_vector=SELECT ML.UPPERZLOCATION XORDINATE, \ + MP.KPOSITION KPOSITION, \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID GROUP1, \ + MVV.TIMEVALUE GROUP2, \ + 1 GROUP3, \ + 2 DATAID, \ + MP.FEATUREID, \ + MP.MESHID \ + from MEDIAN.MESHLAYER ML, \ + MEDIAN.MESHPOINT MP, \ + MEDIAN.MESH M, \ + MEDIAN.MESHCURRENTVALUE MVV \ + where MVV.FEATUREID = MP. FEATUREID AND \ + ML.KPOSITION = MP.KPOSITION AND \ + ML.MESHID = MP.MESHID AND \ + M.MESHID = MP.MESHID AND \ + M.PARTIDMIN <= MVV.PARTID AND \ + M.PARTIDMAX >= MVV.PARTID AND \ + MVV.PARAMETERID IN (?) AND \ + MVV.TIMEVALUE IN (?) AND \ + M.OBJECTID = ? AND \ + MP.FEATUREID IN \ + ( SELECT FEATUREID \ + FROM MEDIAN.MESHPOINT MP, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MP.MESHID = M.MESHID AND \ + IPOSITION = (SELECT IPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?) AND \ + JPOSITION = (SELECT JPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) AND \ + MP.KPOSITION <= ? AND \ + MP.KPOSITION >= ? \ + ORDER BY MVV.PARAMETERID, \ + MVV.TIMEVALUE, \ + ML.UPPERZLOCATION +verticalprofile_mesh_odv_data_vector=SELECT SI.NAME CRUISE, \ + M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \ + '*' TYPE, \ + ST_ASTEXT(SHAPE), \ + 0 BOTDEPTH, \ + (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)) DEPTH, \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID PARAMETER, \ + MVV.TIMEVALUE , \ + '1' QF \ + FROM MEDIAN.MESHLAYER ML, \ + MEDIAN.MESHPOINT, \ + MEDIAN.MESH M, \ + MEDIAN.MESHCURRENTVALUE MVV, \ + MEDIAN.SOURCEINFO SI \ + WHERE M.SOURCEID = SI.SOURCEID AND \ + MVV.FEATUREID = MEDIAN.MESHPOINT. FEATUREID AND \ + ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \ + ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.PARTIDMIN <= MVV.PARTID AND \ + M.PARTIDMAX >= MVV.PARTID AND \ + MVV.PARAMETERID IN (?) AND \ + MVV.TIMEVALUE IN (?) AND \ + M.OBJECTID = ? AND \ + MEDIAN.MESHPOINT.FEATUREID IN \ + ( SELECT FEATUREID \ + FROM MEDIAN.MESHPOINT MP, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MP.MESHID = M.MESHID AND \ + IPOSITION = (SELECT IPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?) AND \ + JPOSITION = (SELECT JPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) AND \ + MEDIAN.MESHPOINT.KPOSITION <= ? AND \ + MEDIAN.MESHPOINT.KPOSITION >= ? \ + ORDER BY MVV.TIMEVALUE, \ + ML.UPPERZLOCATION, \ + MVV.PARAMETERID + ############################################# ############################################# ##### Vertikalprofil InstantaneousPoint ##### @@ -538,12 +1005,24 @@ MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \ M.SOURCEID= ? AND \ INTERSECTS(SHAPE, \ - (SELECT st_astext(SHAPE) \ - FROM MEDIAN.FEATUREAREA \ - WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \ - FEATURECODE = ? )\ + (SELECT st_astext(SHAPE) \ + FROM MEDIAN.FEATUREAREA \ + WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \ + FEATURECODE = ? )\ ) \ ORDER BY S.DESCRIPTION +verticalprofile_instantaneouspoint_series_with_wkt = SELECT \ + S.SERIESID KEY, \ + S.DESCRIPTION VALUE \ + FROM MEDIAN.INSTANTANEOUSPOINT, \ + MEDIAN.SERIES S, \ + MEDIAN.MEASUREMENT M \ + WHERE S.SERIESID = MEDIAN.INSTANTANEOUSPOINT.SERIESID AND \ + MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \ + MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \ + M.SOURCEID= ? AND \ + INTERSECTS(SHAPE, "?") \ + ORDER BY S.DESCRIPTION verticalprofile_instantaneouspoint_point = SELECT \ MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ @@ -559,6 +1038,41 @@ ORDER BY MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE +verticalprofile_instantaneouspoint_point_with_aera = SELECT \ + MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ + to_char(MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE,'DD.MM.YYYY HH24:MI') VALUE, \ + MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \ + ST_ASTEXT(SHAPE) \ + FROM MEDIAN.INSTANTANEOUSPOINT, \ + MEDIAN.MEASUREMENT M \ + WHERE MEDIAN.INSTANTANEOUSPOINT.SERIESID = ? AND \ + MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \ + MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \ + M.SOURCEID = ? AND \ + INTERSECTS(SHAPE, \ + (SELECT st_astext(SHAPE) \ + FROM MEDIAN.FEATUREAREA \ + WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \ + FEATURECODE = ? )\ + ) \ + ORDER BY MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ + MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE + +verticalprofile_instantaneouspoint_point_with_wkt = SELECT \ + MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ + to_char(MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE,'DD.MM.YYYY HH24:MI') VALUE, \ + MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \ + ST_ASTEXT(SHAPE) \ + FROM MEDIAN.INSTANTANEOUSPOINT, \ + MEDIAN.MEASUREMENT M \ + WHERE MEDIAN.INSTANTANEOUSPOINT.SERIESID = ? AND \ + MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \ + MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \ + M.SOURCEID = ? AND \ + INTERSECTS(SHAPE,"?") \ + ORDER BY MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ + MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE + verticalprofile_instantaneouspoint_parameter = SELECT DISTINCT \ P.PARAMETERID KEY, \ p.GERMANNAME || ' ['|| p.UNIT ||']' VALUE, \ @@ -588,7 +1102,9 @@ MSV.PARAMETERID GROUP1, \ IP.TIMEVALUE GROUP2, \ 1 GROUP3, \ - 3 DATAID \ + 3 DATAID, \ + IP.FEATUREID, \ + IP.SERIESID \ FROM MEDIAN.INSTANTANEOUSPOINT IP, \ MEDIAN.MEASUREMENT M, \ MEDIAN.MEASUREDSCALARVALUE MSV \ @@ -607,10 +1123,11 @@ '*' TYPE, \ ST_ASTEXT(SHAPE), \ 0 BOTDEPTH, \ - (M.ZLOCATION * -1) DEPTH, \ + (M.ZLOCATION) DEPTH, \ MSV.DATAVALUE, \ MSV.PARAMETERID PARAMETER, \ - MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE \ + MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE , \ + '1' QF \ FROM MEDIAN.SERIES S, \ MEDIAN.INSTANTANEOUSPOINT, \ MEDIAN.MEASUREMENT M, \ @@ -623,8 +1140,8 @@ M.ZLOCATION >= ? AND \ M.ZLOCATION <= ? \ ORDER BY MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \ - MSV.PARAMETERID, \ - M.ZLOCATION + M.ZLOCATION, \ + MSV.PARAMETERID ############################################# ############################################# @@ -670,6 +1187,25 @@ FEATURECODE = ? )\ ) \ ORDER BY V.NAME + +horizontalprofile_instantaneouspoint_vehicle_with_wkt = SELECT V.VEHICLEID KEY, \ + V.NAME VALUE \ + FROM MEDIAN.TRACK, \ + MEDIAN.VEHICLE V, \ + MEDIAN.CRUISE C \ + WHERE V.VEHICLEID = C.VEHICLEID AND \ + C.CRUISEID = MEDIAN.TRACK.CRUISEID AND \ + MEDIAN.TRACK.TRACKID IN \ + (SELECT DISTINCT S.TRACKID \ + FROM MEDIAN.MEASUREMENT M ,\ + MEDIAN.INSTANTANEOUSPOINT I, \ + MEDIAN.SURVEYINFO S \ + WHERE M.SOURCEID = ? AND \ + I.FEATUREID = M.FEATUREID AND \ + S.SURVEYID = I.SURVEYID)AND \ + INTERSECTS(SHAPE,"?") \ + ORDER BY V.NAME + horizontalprofile_instantaneouspoint_cruise = SELECT DISTINCT \ C.CRUISEID KEY, \ V.NAME || ' ' || \ @@ -721,6 +1257,31 @@ FEATURECODE = ? )\ ) \ ORDER BY V.NAME + +horizontalprofile_instantaneouspoint_cruise_with_wkt = SELECT C.CRUISEID KEY, \ + V.NAME || ' ' || \ + C.NAME || ' ' || \ + TO_CHAR(C.STARTDATE,'DD.MM.YYYY') || ' - ' || \ + TO_CHAR(C.ENDDATE,'DD.MM.YYYY') VALUE, \ + V.NAME, \ + C.NAME \ + FROM MEDIAN.TRACK, \ + MEDIAN.VEHICLE V, \ + MEDIAN.CRUISE C \ + WHERE V.VEHICLEID = C.VEHICLEID AND \ + C.CRUISEID = MEDIAN.TRACK.CRUISEID AND \ + MEDIAN.TRACK.TRACKID IN \ + (SELECT DISTINCT S.TRACKID \ + FROM MEDIAN.MEASUREMENT M ,\ + MEDIAN.INSTANTANEOUSPOINT I, \ + MEDIAN.SURVEYINFO S \ + WHERE M.SOURCEID = ? AND \ + C.VEHICLEID = ? AND \ + I.FEATUREID = M.FEATUREID AND \ + S.SURVEYID = I.SURVEYID)AND \ + INTERSECTS(SHAPE,"?") \ + ORDER BY V.NAME + horizontalprofile_instantaneouspoint_track= SELECT \ T.TRACKID KEY, \ to_char(T.STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(T.ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| T.NAME VALUE \ @@ -732,7 +1293,7 @@ horizontalprofile_instantaneouspoint_track_with_area = SELECT \ MEDIAN.TRACK.TRACKID KEY, \ - to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| NAME VALUE, \ + to_char(STARTDATE,'DD-MM-YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD-MM-YYYY HH24:MI') || ' - '|| NAME VALUE, \ NAME \ FROM MEDIAN.TRACK \ WHERE MEDIAN.TRACK.CRUISEID = ? AND \ @@ -745,6 +1306,18 @@ ORDER BY STARTDATE, \ ENDDATE, \ NAME + +horizontalprofile_instantaneouspoint_track_with_wkt = SELECT \ + MEDIAN.TRACK.TRACKID KEY, \ + to_char(STARTDATE,'DD-MM-YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD-MM-YYYY HH24:MI') || ' - '|| NAME VALUE, \ + NAME \ + FROM MEDIAN.TRACK \ + WHERE MEDIAN.TRACK.CRUISEID = ? AND \ + INTERSECTS(SHAPE, "?") \ + ORDER BY STARTDATE, \ + ENDDATE, \ + NAME + horizontalprofile_instantaneouspoint_surveyinfo = SELECT \ SURVEYID KEY, \ to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| DESCRIPTION VALUE \ @@ -780,7 +1353,8 @@ MSV.PARAMETERID GROUP1, \ ZLOCATION GROUP2, \ 1 GROUP3, \ - 3 DATAID \ + 3 DATAID, \ + MEDIAN.INSTANTANEOUSPOINT.SURVEYID \ FROM MEDIAN.INSTANTANEOUSPOINT, \ MEDIAN.MEASUREMENT M, \ MEDIAN.MEASUREDSCALARVALUE MSV \ @@ -800,7 +1374,8 @@ ST_ASTEXT(SHAPE), \ MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \ MSV.DATAVALUE, \ - MSV.PARAMETERID PARAMETER \ + MSV.PARAMETERID PARAMETER , \ + '1' QF \ FROM MEDIAN.INSTANTANEOUSPOINT, \ MEDIAN.VEHICLE V, \ MEDIAN.CRUISE C, \ @@ -850,7 +1425,8 @@ msv.TIMEVALUE GROUP3, \ MEDIAN.MESHPOINT.JPOSITION, \ MEDIAN.MESHPOINT.IPOSITION, \ - 2 DATAID \ + 2 DATAID, \ + MEDIAN.MESHPOINT.MESHID \ from MEDIAN.MESHLAYER ml, \ MEDIAN.MESHPOINT, \ MEDIAN.MESH m, \ @@ -888,7 +1464,8 @@ msv.PARAMETERID PARAMETER, \ msv.TIMEVALUE, \ MEDIAN.MESHPOINT.JPOSITION, \ - MEDIAN.MESHPOINT.IPOSITION \ + MEDIAN.MESHPOINT.IPOSITION , \ + '1' QF \ from MEDIAN.MESHLAYER ml, \ MEDIAN.MESHPOINT, \ MEDIAN.MESH m, \ @@ -914,10 +1491,102 @@ ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \ order by msv.TIMEVALUE, \ MEDIAN.MESHPOINT.KPOSITION, \ - msv.PARAMETERID, \ + MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION, \ + msv.PARAMETERID + +############################################# +############################################# +########### Horizontalprofil MESH ########### +########### Vektordaten ########### +############################################# +############################################# + +horizontalprofile_mesh_chart_data_vector= SELECT ST_ASTEXT(SHAPE), \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID GROUP1, \ + MEDIAN.MESHPOINT.KPOSITION GROUP2, \ + MVV.TIMEVALUE GROUP3, \ + MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION, \ + 2 DATAID, \ + MEDIAN.MESHPOINT.MESHID \ + FROM MEDIAN.MESHLAYER ML, \ + MEDIAN.MESHPOINT, \ + MEDIAN.MESH M, \ + MEDIAN.MESHCURRENTVALUE MVV \ + WHERE MVV.FEATUREID = MEDIAN.MESHPOINT. FEATUREID AND \ + ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \ + ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.PARTIDMIN <= MVV.PARTID AND \ + M.PARTIDMAX >= MVV.PARTID AND \ + MVV.PARAMETERID = ? AND \ + MVV.TIMEVALUE = ? AND \ + M.OBJECTID = ? AND \ + MEDIAN.MESHPOINT.FEATUREID IN \ + ( SELECT FEATUREID \ + from MEDIAN.MESHPOINT MP, \ + MEDIAN.MESH M \ + where M.OBJECTID = ? AND \ + MP.MESHID = M.MESHID AND \ + KPOSITION IN ( ? ) AND \ + ? = (SELECT ? FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) \ + ORDER BY MVV.TIMEVALUE, \ + MEDIAN.MESHPOINT.KPOSITION, \ + MVV.PARAMETERID, \ MEDIAN.MESHPOINT.JPOSITION, \ MEDIAN.MESHPOINT.IPOSITION - + +horizontalprofile_mesh_odv_data_vector= SELECT SI.NAME CRUISE, \ + M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \ + '*' TYPE, \ + ST_ASTEXT(SHAPE), \ + 0 BOTDEPTH, \ + (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID PARAMETER, \ + MVV.TIMEVALUE, \ + MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION , \ + '1' QF \ + from MEDIAN.MESHLAYER ML, \ + MEDIAN.MESHPOINT, \ + MEDIAN.MESH M, \ + MEDIAN.MESHCURRENTVALUE MVV, \ + MEDIAN.SOURCEINFO SI \ + where MVV.FEATUREID = MEDIAN.MESHPOINT. FEATUREID AND \ + ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION and \ + ML.MESHID = MEDIAN.MESHPOINT.MESHID and \ + M.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.SOURCEID = SI.SOURCEID AND \ + M.PARTIDMIN <= MVV.PARTID AND \ + M.PARTIDMAX >= MVV.PARTID AND \ + MVV.PARAMETERID = ? AND \ + MVV.TIMEVALUE = ? AND \ + M.OBJECTID = ? AND \ + MEDIAN.MESHPOINT.FEATUREID IN \ + ( SELECT FEATUREID \ + FROM MEDIAN.MESHPOINT MP, \ + MEDIAN.MESH M \ + WHERE M.OBJECTID = ? AND \ + MP.MESHID = M.MESHID AND \ + KPOSITION IN ( ? ) AND \ + ? = (SELECT ? FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) \ + ORDER BY MVV.TIMEVALUE, \ + MEDIAN.MESHPOINT.KPOSITION, \ + MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION, \ + MVV.PARAMETERID + ############################################# ############################################# ########### Horizontalprofil MESH ########### @@ -954,6 +1623,7 @@ msv.TIMEVALUE GROUP3, \ MEDIAN.MESHPOINT.JPOSITION, \ MEDIAN.MESHPOINT.IPOSITION, \ + MEDIAN.MESHPOINT.MESHID MESHID, \ 2 DATAID \ from MEDIAN.MESHLAYER ml, \ MEDIAN.MESHPOINT, \ @@ -980,6 +1650,53 @@ msv.PARAMETERID, \ MEDIAN.MESHPOINT.JPOSITION, \ MEDIAN.MESHPOINT.IPOSITION + +############################################# +############################################# +########### Horizontalprofil MESH ########### +########### Schnittprofil ########### +########### Vektordaten ########### +############################################# +############################################# + +horizontalprofile_mesh_cross_chart_data_vector = SELECT ST_ASTEXT(SHAPE), \ + MVV.XCOMPONENT, \ + MVV.YCOMPONENT, \ + MVV.ZCOMPONENT, \ + MVV.SPEED, \ + MVV.DIRECTION, \ + MVV.PARAMETERID GROUP1, \ + MEDIAN.MESHPOINT.KPOSITION GROUP2, \ + MVV.TIMEVALUE GROUP3, \ + MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION, \ + 2 DATAID \ + FROM MEDIAN.MESHLAYER ML, \ + MEDIAN.MESHPOINT, \ + MEDIAN.MESH M, \ + MEDIAN.MESHCURRENTVALUE MVV \ + WHERE MVV.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \ + ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \ + ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + M.PARTIDMIN <= MVV.PARTID AND \ + M.PARTIDMAX >= MVV.PARTID AND \ + MVV.PARAMETERID = ? AND \ + MVV.TIMEVALUE = ? AND \ + M.OBJECTID = ? AND \ + ML.KPOSITION in (?) AND \ + MEDIAN.MESHPOINT.FEATUREID in \ + ( \ + SELECT DISTINCT FEATUREID \ + FROM MEDIAN.MESHPOINT \ + WHERE ? \ + ) \ + ORDER BY MVV.TIMEVALUE, \ + MEDIAN.MESHPOINT.KPOSITION, \ + MVV.PARAMETERID, \ + MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION + ############################################# ############################################# ############# Profilschnitt MESH ############ @@ -1051,7 +1768,8 @@ MEDIAN.MESHPOINT.JPOSITION, \ MEDIAN.MESHPOINT.IPOSITION, \ MEDIAN.MESHPOINT.KPOSITION, \ - 2 DATAID \ + 2 DATAID , \ + '1' QF \ from MEDIAN.MESHLAYER ml, \ MEDIAN.MESHPOINT, \ MEDIAN.MESH m, \ @@ -1075,11 +1793,41 @@ mp.MESHID = m.MESHID AND \ ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \ order by msv.TIMEVALUE, \ - msv.PARAMETERID, \ MEDIAN.MESHPOINT.JPOSITION, \ MEDIAN.MESHPOINT.IPOSITION, \ - MEDIAN.MESHPOINT.KPOSITION - + MEDIAN.MESHPOINT.KPOSITION, \ + msv.PARAMETERID + +############################################## +#### Special case of VerticalCrossSection #### +############################################## +verticalcrosssection_mesh_parallel_linestring = SELECT ST_ASTEXT(SHAPE), \ + IPOSITION, \ + JPOSITION \ + from MEDIAN.MESHLAYER ml, \ + MEDIAN.MESHPOINT, \ + MEDIAN.MESH m, \ + MEDIAN.MESHSCALARVALUE msv \ + where msv.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \ + ml.KPOSITION = MEDIAN.MESHPOINT.KPOSITION and \ + ml.MESHID = MEDIAN.MESHPOINT.MESHID and \ + m.MESHID = MEDIAN.MESHPOINT.MESHID AND \ + m.PARTIDMIN <= msv.PARTID AND \ + m.PARTIDMAX >= msv.PARTID AND \ + msv.PARAMETERID in (?) AND \ + msv.TIMEVALUE in (?) AND \ + m.OBJECTID = ? AND \ + MEDIAN.MESHPOINT.FEATUREID in \ + ( select FEATUREID \ + from MEDIAN.MESHPOINT mp, \ + MEDIAN.MESH m \ + where m.OBJECTID = ? AND \ + mp.MESHID = m.MESHID AND \ + KPOSITION in ( 1 ) and \ + ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \ + order by MEDIAN.MESHPOINT.JPOSITION, \ + MEDIAN.MESHPOINT.IPOSITION + ############################################# ############################################# ########## Horizontalschnitt MESH ########### @@ -1171,7 +1919,8 @@ M.OBJECTID = ? AND \ MEDIAN.MESHPOINT.KPOSITION = ? \ order by MEDIAN.MESHPOINT.JPOSITION, \ - MEDIAN.MESHPOINT.IPOSITION + MEDIAN.MESHPOINT.IPOSITION, \ + MSV.PARAMETERID area_filter = SELECT DISTINCT \ FEATUREID KEY ,\ @@ -1217,28 +1966,29 @@ ############################################# ############################################# -######### Layer Contis und Nauthis ########## +# Layer Contis, Nauthis and Marinefeatures # ############################################# ############################################# layer = SELECT ROW_ID KEY, \ - TITLE || '-' || LAYER_NAME VALUE \ + TITLE || '-' || LAYER_NAME || '-' || BAND VALUE \ FROM MEDIAN.LAYER_HAS_SUBTYPES \ - WHERE ID_FEATURECLASS LIKE ? \ + WHERE ID_FEATURECLASS LIKE ? AND \ + ITEMS > 0 \ ORDER BY LAYER_NAME layer_request_data = SELECT ID_FEATURECLASS, \ QUERY_STRING, \ - TITLE, \ - LAYER_NAME \ + ID_MAPSERVICE || '_' ||ID_LAYER, \ + TITLE || '-' || LAYER_NAME || '-' || BAND VALUE \ FROM MEDIAN.LAYER_HAS_SUBTYPES \ - WHERE ROW_ID = ? + WHERE ROW_ID IN (?) -layer_data = SELECT ST_ASTEXT(SHAPE) \ +layer_data = SELECT ST_ASTEXT(SHAPE), ? \ FROM ? \ WHERE ? -layer_data_with_geom = SELECT ST_ASTEXT(SHAPE) \ +layer_data_with_geom = SELECT ST_ASTEXT(SHAPE), ? \ FROM ? \ WHERE ? AND \ INTERSECTS(SHAPE,"?") @@ -1247,3 +1997,25 @@ FROM MEDIAN.FEATUREAREA \ WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \ FEATURECODE = ? + +layer_colums= SELECT OWNER || '.' || TABLE_NAME || '.' || COLUMN_NAME \ + FROM SDE.COLUMN_REGISTRY \ + WHERE COLUMN_NAME NOT LIKE 'SHAPE' AND \ + OWNER = '?' AND \ + TABLE_NAME = '?' + +geometry_type = select geometry_type \ + from sde.geometry_columns \ + where f_table_schema = '?' and \ + f_table_name = '?' and \ + f_geometry_column='SHAPE' + + +############################################# +############################################# +###### Sync of cache after DB updates ####### +############################################# +############################################# +updated_tables = SELECT FULLTABLENAME \ + FROM MEDIAN.LASTUPDATED \ + WHERE LASTUPDATE >= to_date('?', 'YYYY.MM.DD HH24:MI:SS')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/doc/conf/sql-cache.xml Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ehcache> + <defaultCache + maxElementsInMemory="10000" + eternal="false" + memoryStoreEvictionPolicy="LFU" + timeToIdleSeconds="10800" + timeToLiveSeconds="14400" + /> +</ehcache> +
--- a/gnv-artifacts/doc/schema/externalinterface_schema.sql Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/schema/externalinterface_schema.sql Fri Sep 28 12:15:21 2012 +0200 @@ -1,4 +1,12 @@ -/* +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/* * Lookup-Tabelle für das FIS anhand eines Gebietes. * Diese Tabelle ist in der ArcSDE als Layer zu integrieren. * Die Inhalte der Spalte id_fis müssen mit den vergebenen IDs @@ -69,4 +77,4 @@ ALTER TABLE mapservice_has_parameter ADD - PRIMARY KEY (id_mapservice,id_parameter); \ No newline at end of file + PRIMARY KEY (id_mapservice,id_parameter);
--- a/gnv-artifacts/doc/schema/externalinterface_testdata.sql Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/doc/schema/externalinterface_testdata.sql Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + *Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + INSERT INTO fis_has_mapservice (id_fis,id_mapservice) VALUES ('modeldata','BSH_IMS_Prediction_Model_Salinity'); INSERT INTO fis_has_mapservice (id_fis,id_mapservice) VALUES ('marnet','BSH_IMS_Marine_Environment_Monitoring_Network'); @@ -7,4 +15,4 @@ INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 2, 'Temperature', null, 1); INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 3, 'Salinity', null, 2); INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 4, 'OxygenSaturation', null, 31); -INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 5, 'Current', null, ?); \ No newline at end of file +INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 5, 'Current', null, ?);
--- a/gnv-artifacts/pom.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/pom.xml Fri Sep 28 12:15:21 2012 +0200 @@ -7,12 +7,33 @@ <version>1.0-SNAPSHOT</version> <name>gnv-artifacts</name> <url>http://maven.apache.org</url> + <scm> + <connection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv-artifacts</connection> + <developerConnection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv-artifacts</developerConnection> + <url>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv-artifacts</url> + </scm> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>buildnumber-maven-plugin</artifactId> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>create</goal> + </goals> + </execution> + </executions> + <configuration> + <doCheck>false</doCheck> + <doUpdate>false</doUpdate> + </configuration> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.5.1</version> @@ -26,6 +47,20 @@ <target>1.5</target> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + </manifest> + <manifestEntries> + <SCM-Revision>${buildNumber}</SCM-Revision> + </manifestEntries> + </archive> + </configuration> + </plugin> </plugins> </build> <dependencies>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/APP.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/APP.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; import de.intevation.artifactdatabase.App; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class APP {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.common.utils.Config; import de.intevation.artifactdatabase.ProxyArtifact; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactDatabase; @@ -13,6 +18,7 @@ import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.GlobalContext; import de.intevation.gnv.artifacts.context.GNVArtifactContext; @@ -20,6 +26,7 @@ import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.state.AutoResumeState; import de.intevation.gnv.state.DefaultInputData; import de.intevation.gnv.state.ExportMode; import de.intevation.gnv.state.InputData; @@ -44,6 +51,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.xml.xpath.XPathConstants; @@ -56,11 +64,14 @@ import org.w3c.dom.NodeList; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This is the major gnv artifact and handles the requests specified in + * <code>de.intevation.artifactdatabase.Artifact</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ -public abstract class GNVArtifactBase extends GNVDefaultArtifact +public abstract class GNVArtifactBase extends GNVDefaultArtifact implements PreSettingArtifact { /** @@ -92,9 +103,9 @@ public static final String XPATH_TARGET_NAME = "/art:action/art:target/@name"; - public static final String XPATH_OUTPUT_NAME = "/art:action/art:out/@name"; + public static final String XPATH_OUTPUT_NAME = "/art:action/art:out/@name"; - public static final String XPATH_OUTPUT_PARAMS = "/art:action/art:out/art:params/art:input"; + public static final String XPATH_OUTPUT_PARAMS = "/art:action/art:out/art:params/art:input"; public static final String INITIAL_STATE = "product"; @@ -107,7 +118,7 @@ * The States that can be used */ protected Map<String, State> states = null; - + /** * The Transitions which can switch between the different States. */ @@ -138,6 +149,11 @@ } + /** + * This method handles request for changing the current state of an + * artifact. It is possible to step forward, backward, or to the initial + * state for choosing a fis. + */ @Override public Document advance(Document target, CallContext context) { log.debug("GNVArtifactBase.advance()"); @@ -170,28 +186,23 @@ next = states.get(targetState); - // 2. Transfer Results - next.putInputData(current.getInputData(), identifier); - next.setParent(current); - next.setPreSettings(this.preSettings); - - if (current != null) { - current.endOfLife(context.globalContext()); - } + boolean success = go2NextState(context, result, next); - // 3. Switch to next State - current = next; - - // 4. Initialize next Step - current.initialize(identifier, context); - - result = createReport( - result, "result", "success", "Advance success" - ); + if (success){ + result = createReport( + result, "result", "success", "Advance success" + ); + }else{ + result = ArtifactXMLUtilities. + createExceptionReport("Error while going to next State.", + XMLUtils.newDocument()); + } } // step backward - else if((next = getPreviousState(current, targetState)) != null) { + else if((next = getPreviousState(current, targetState, context)) + != null) + { if (current != null) { current.endOfLife(context.globalContext()); @@ -215,7 +226,12 @@ GNVProductArtifactFactory fac = (GNVProductArtifactFactory) db.getInternalArtifactFactory(fis); - Artifact select = fac.createArtifact(identifier, context, null); + Artifact select = fac.createArtifact( + identifier, + (GlobalContext) context.globalContext(), + context.getMeta(), + null); + context.putContextValue(ProxyArtifact.REPLACE_PROXY, select); result = createReport( @@ -248,6 +264,23 @@ } + private boolean go2NextState(CallContext context, Document result, + State next) throws StateException { + // 2. Transfer Results + next.putInputData(current.getInputData(), identifier); + next.setParent(current); + next.setPreSettings(this.preSettings); + + // 3. Switch to next State + current = next; + + // 4. Initialize next Step + current.initialize(identifier, context); + + return true; + } + + protected Document createReport( Document document, String nodeName, @@ -272,7 +305,12 @@ } - protected State getPreviousState(State current, String name) { + /** + * Step back to the previous state specified by <code>name</code>. + */ + protected State getPreviousState( + State current, String name, CallContext context) + { if (current == null) { return null; } @@ -281,7 +319,8 @@ return current; } else { - return getPreviousState(current.getParent(), name); + current.endOfLife(context); + return getPreviousState(current.getParent(), name, context); } } @@ -299,52 +338,103 @@ } return false; } - - public Document initialize (CallContext context) { + + + public Document initialize(CallContext context) { Document result = XMLUtils.newDocument(); try { this.current.initialize(super.identifier, context); - result = new ArtifactXMLUtilities() - .createSuccessReport("Initialize success", - XMLUtils.newDocument()); + + if (this.current instanceof AutoResumeState){ + // Jump to next State using the Transitions. + State next = this.getNextReachableState(this.current); + if (next != null){ + boolean success = go2NextState(context, result, next); + if (success){ + result = ArtifactXMLUtilities + .createSuccessReport("Initialize success", + XMLUtils.newDocument()); + }else{ + result = ArtifactXMLUtilities. + createExceptionReport( + "Error while going to next State.", + XMLUtils.newDocument()); + } + }else{ + result = ArtifactXMLUtilities. + createExceptionReport("No propper State found.", + XMLUtils.newDocument()); + } + }else{ + result = ArtifactXMLUtilities + .createSuccessReport("Initialize success", + XMLUtils.newDocument()); + } } catch (StateException e) { log.error(e,e); - result = new ArtifactXMLUtilities().createExceptionReport(e + result = ArtifactXMLUtilities.createExceptionReport(e .getLocalizedMessage(), XMLUtils.newDocument()); } return result; } + /** + * Step forward to the next reachable state. + * @param current Current state. + * @return Reachable state. + */ + protected State getNextReachableState(State current){ + Iterator<Transition> it = this.transitions.iterator(); + String from = current.getID(); + while (it.hasNext()){ + Transition transition = it.next(); + if (transition.getFrom().equals(from)){ + if (transition.isValid(current)){ + return this.states.get(transition.getTo()); + } + } + } + return null; + } + + protected String readStateName(Document document) { String returnValue = XMLUtils.xpathString( document, XPATH_TARGET_NAME, ArtifactNamespaceContext.INSTANCE); return returnValue; } + protected Node getConfigurationFragment(Document document) { log.debug("GNVArtifactBase.getConfigurationFragment"); String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll( XPATH_IDENTIFIER_REPLACE, this.name); - + Element configurationNode = (Element)Config.getNodeXPath(document, xpathQuery); - + String link = configurationNode.getAttribute("xlink:href"); if (link != null ){ String absolutFileName = Config.replaceConfigDir(link); configurationNode = (Element)new ArtifactXMLUtilities().readConfiguration(absolutFileName); } - + return configurationNode; } /** - * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document, - * de.intevation.artifacts.CallContext) + * Insert new data included in <code>target</code> into the current state. + * @param target XML document which contains data. + * @param context CallContext + * @return XML document with success or error message. */ @Override public Document feed(Document target, CallContext context) { log.debug("GNVArtifactBase.feed"); - Document result = XMLUtils.newDocument(); + RessourceFactory fac = RessourceFactory.getInstance(); + Locale[] locales = fac.getLocales(); + Locale locale = context.getMeta().getPreferredLocale(locales); + Document result = XMLUtils.newDocument(); + try { if (this.current != null) { Collection<InputData> inputData = this.parseInputData( @@ -352,24 +442,28 @@ XPATH_INPUT_DATA); if (!inputData.isEmpty()){ - current.feed(inputData, super.identifier); - result = new ArtifactXMLUtilities().createSuccessReport( - "Feed success", XMLUtils.newDocument()); + result = current.feed(context, inputData, super.identifier); }else{ - String msg = "No Inputdata given. Please select at least one Entry."; + //String msg = "No Inputdata given. Please select at least one Entry."; + String msg = fac.getRessource( + locale, + EXCEPTION_NO_INPUT, + EXCEPTION_NO_INPUT); + log.warn(msg); - result = new ArtifactXMLUtilities().createExceptionReport(msg, - XMLUtils.newDocument()); + result = ArtifactXMLUtilities.createInputExceptionReport( + msg, + XMLUtils.newDocument()); } } else { String msg = "No State instantiated"; log.warn(msg); - result = new ArtifactXMLUtilities().createExceptionReport(msg, + result = ArtifactXMLUtilities.createExceptionReport(msg, XMLUtils.newDocument()); } } catch (StateException e) { log.error(e, e); - result = new ArtifactXMLUtilities().createExceptionReport(e + result = ArtifactXMLUtilities.createExceptionReport(e .getLocalizedMessage(), XMLUtils.newDocument()); } return result; @@ -377,7 +471,8 @@ /** - * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext) + * Describe the current artifact. + * @return The description of the current artifact. */ @Override public Document describe(Document data, CallContext context) { @@ -393,13 +488,19 @@ } /** - * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String, de.intevation.artifacts.ArtifactFactory, java.lang.Object, org.w3c.dom.Document) + * Initialse this artifact and insert some data if <code>data</code> + * contains necessary information for this artifact. */ @Override - public void setup(String identifier, ArtifactFactory factory, - Object context,Document data) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("GNVArtifactBase.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); Object localContext = context; if (context instanceof CallContext) { @@ -411,7 +512,7 @@ GNVArtifactContext gnvContext = (GNVArtifactContext) localContext; Document doc = gnvContext.getConfig(); Node artifactNode = this.getConfigurationFragment(doc); - + NodeList stateList = Config.getNodeSetXPath(artifactNode, "states/state"); this.states = new HashMap<String, State>(stateList @@ -427,7 +528,7 @@ } } } - + NodeList transitionList = Config.getNodeSetXPath(artifactNode, "states/transition"); this.transitions = new ArrayList<Transition>(transitionList.getLength()); @@ -443,6 +544,10 @@ } + /** + * Create the xml document returned in {@link #describe(org.w3c.dom.Document, + * de.intevation.artifacts.CallContext)} + */ protected Document createDescibeOutput( CallContext context, String uuid, @@ -468,7 +573,14 @@ return document; } - + + /** + * Determine the wish to append the user interface description to the + * describe document. + * + * @return True, if the user interface description should be appended, + * otherwise false. + */ protected boolean getIncludeUIFromDocument(Document document){ String value = XMLUtils.xpathString( document, XPATH_INCLUDE_UI, ArtifactNamespaceContext.INSTANCE); @@ -480,6 +592,7 @@ return includeUI; } + protected Element createRootNode( XMLUtils.ElementCreator creator, Document document @@ -489,6 +602,9 @@ return rootNode; } + /** + * Append information about the current artifact (uuid, hash). + */ protected void createHeader( XMLUtils.ElementCreator creator, Element parent, @@ -508,6 +624,9 @@ parent.appendChild(hashNode); } + /** + * Create the fis select box. + */ protected Element createSelectBox( XMLUtils.ElementCreator artCreator, XMLUtils.ElementCreator creator, @@ -554,6 +673,10 @@ } + /** + * Insert all reachable states into the describe document returned by + * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)} + */ protected void createReachableStates( XMLUtils.ElementCreator creator, Element parent, @@ -586,6 +709,11 @@ } + /** + * Insert states which have been visited by this artifact into the xml + * document returned by {@link #describe(org.w3c.dom.Document, + * de.intevation.artifacts.CallContext)} + */ protected void appendOldReachableStates( XMLUtils.ElementCreator creator, Element parent, @@ -605,6 +733,10 @@ } + /** + * Insert the current state into the xml document returned by + * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)} + */ protected void createCurrentState( XMLUtils.ElementCreator creator, Element parent, @@ -616,6 +748,7 @@ parent.appendChild(stateNode); } + protected void createModel( XMLUtils.ElementCreator creator, Element parent, @@ -639,6 +772,15 @@ parent.appendChild(modelNode); } + /** + * Append the user interface description to the document returned by + * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)} + * @param creator XML element creator. + * @param parent New elements are appended to this node. + * @param document Current document. + * @param context CallContext + * @param uuid The uuid of the artifact. + */ protected void createUserInterface( XMLUtils.ElementCreator creator, Element parent, @@ -677,6 +819,13 @@ } + /** + * Append possible output targets to the document returned by + * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)} + * @param creator Used to create xml elements. + * @param parent New elements are appended to this node. + * @param document The current document. + */ protected void createOutputs( XMLUtils.ElementCreator creator, Element parent, @@ -747,6 +896,12 @@ parent.appendChild(outputsNode); } + /** + * Parse input data from feed-document. + * @param document Feed-document + * @param xPath Path to input data. + * @return A collection with InputData objects. + */ protected Collection<InputData> parseInputData(Document document, String xPath) { HashMap<String, InputData> returnValue = null; @@ -777,8 +932,13 @@ } /** - * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document, - * java.io.OutputStream, de.intevation.artifacts.CallContext) + * Call an output target (e.g. chart, wms, etc.) + * @param format XML document which contains some further information about + * the desired output. + * @param outputStream Stream used for writing the output. + * @param context CallContext + * @throws IOException If an error occured while writing the result to the + * output stream. */ @Override public void out(Document format, OutputStream outputStream, @@ -798,6 +958,7 @@ } } + protected static String readOutputType(Document document) { String value = XMLUtils.xpathString( document, XPATH_OUTPUT_NAME, ArtifactNamespaceContext.INSTANCE); @@ -805,10 +966,18 @@ } + /** + * The the current product. + * @param product New product. + */ public void setProduct(Product product) { this.product = product; } + /** + * Call endOfLife of parent class and the current state. + */ + @Override public void endOfLife(Object globalContext) { super.endOfLife(globalContext); @@ -816,16 +985,17 @@ current.endOfLife(globalContext); } } - + /** - * @see de.intevation.gnv.artifacts.PreSettingArtifact#getPreSettings() + * Retrieves a map with given InputData which have been inserted into the + * current artifact before the parameterization began. */ public Map<String, InputData> getPreSettings() { return this.preSettings; } - + /** - * @see de.intevation.gnv.artifacts.PreSettingArtifact#setPreSettings(java.util.Map) + * Set InputData which are used in later states. */ public void setPreSettings(Map<String, InputData> preSettings) { this.preSettings = preSettings; @@ -834,4 +1004,4 @@ } } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,28 +1,50 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts; +import de.intevation.artifactdatabase.DefaultArtifactFactory; + +import org.apache.log4j.Logger; + import org.w3c.dom.Document; import org.w3c.dom.Node; -import org.apache.log4j.Logger; - -import de.intevation.artifactdatabase.DefaultArtifactFactory; - /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * The GNV default implementation of <code>DefaultArtifactFactory</code>. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class GNVArtifactFactory extends DefaultArtifactFactory { + /** + * + */ public static final String XPATH_PRODUCT_FACTORY = "artifact-factory"; private static Logger logger = Logger.getLogger(GNVArtifactFactory.class); + /** + * Constructor. + */ public GNVArtifactFactory() { } + /** + * + * @param document + * @param factoryNode Contains necessary information about the desired + * factory. + */ @Override public void setup(Document document, Node factoryNode) { super.setup(document, factoryNode); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,15 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts; import de.intevation.artifactdatabase.DefaultArtifact; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; @@ -15,18 +23,37 @@ import org.w3c.dom.Element; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * The default gnv artifact. The only thing defined here is a method to append + * the selected fis to the describe document. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class GNVDefaultArtifact extends DefaultArtifact { private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class); + /** + * + */ + public static final String EXCEPTION_NO_INPUT = "no.input.data"; + + /** + * Constructor. + */ public GNVDefaultArtifact() { super(); } + /** + * Append the selected fis to the describe document. + * + * @param document + * @param staticNode + * @param context + * @param fisName + */ protected void appendFis( Document document, Element staticNode, @@ -81,3 +108,4 @@ staticNode.appendChild(selectNode); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts; import java.util.ArrayList; @@ -14,15 +22,21 @@ import de.intevation.artifactdatabase.DefaultArtifactFactory; import de.intevation.artifactdatabase.ProxyArtifact; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.GlobalContext; import de.intevation.gnv.artifacts.fis.SelectProductArtifact; import de.intevation.gnv.artifacts.fis.product.DefaultProduct; import de.intevation.gnv.state.DefaultInputData; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This factory is called to create a {@link + * de.intevation.gnv.artifacts.fis.SelectProductArtifact} which lets the user + * select a product supported by the selected fis. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class GNVProductArtifactFactory extends DefaultArtifactFactory { @@ -45,20 +59,36 @@ private Map products; + /** + * Constructor. + */ public GNVProductArtifactFactory() { } + /** + * Method to create an artifact. If the created artifact is from type + * <code>ProxyArtifact</code>, a further ProductSelectArtifact is created + * which becomes embedded into the <code>ProxyArtifact</code>. + * @param identifier UUID. + * @param context CallContext. + * @param data Some data. + * @return The created artifact. + */ @Override - public Artifact createArtifact(String identifier, Object context, Document data) { - + public Artifact createArtifact( + String identifier, + GlobalContext context, + CallMeta meta, + Document data + ) { // create a SelectProductArtifact for initial product selection - Artifact artifact = super.createArtifact(identifier, context, data); + Artifact artifact = super.createArtifact(identifier, context, meta, data); if (artifact instanceof ProxyArtifact) { SelectProductArtifact select = new SelectProductArtifact(); select.setProducts(products); - select.setup(identifier, this, context, data); + select.setup(identifier, this, context, meta, data); ((ProxyArtifact) artifact).setProxied(select); } @@ -66,6 +96,7 @@ return artifact; } + @Override public void setup(Document document, Node factoryNode) { super.setup(document, factoryNode); @@ -112,7 +143,7 @@ Node factoryNode = (Node) XMLUtils.xpath( product, XPATH_PRODUCT_FACTORY, XPathConstants.NODE); - String factoryClass = factoryNode.getTextContent(); + String factoryClass = factoryNode.getTextContent().trim(); if (factoryClass == null || factoryClass.equals("")) { logger.warn("No artifact factory class found for " + name); @@ -139,6 +170,9 @@ } + /** + * Initialize all products supported by the current fis. + */ protected void initializeProducts(Node productNode) { String productName = (String) XMLUtils.xpath( productNode, "@name", XPathConstants.STRING); @@ -168,3 +202,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,20 +1,37 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; +import de.intevation.gnv.state.InputData; + import java.util.Map; -import de.intevation.gnv.state.InputData; - /** - * @author Tim Englich <tim.englich@intevation.de> + * This artifact is used to be fed before the parameterization has started. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface PreSettingArtifact { - + + /** + * + * @return the InputData which have been inserted before parameterization + * has started. + */ Map<String,InputData> getPreSettings(); - + + /** + * + * @param preSettings + */ void setPreSettings(Map<String,InputData> preSettings); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.cache; +import java.lang.management.ManagementFactory; + +import javax.management.MBeanServer; + import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; +import net.sf.ehcache.management.ManagementService; + import org.apache.log4j.Logger; +import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner; +import de.intevation.gnv.state.cache.ThematicDataCacheCleaner; + /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The <code>CacheFactory</code> is used to initialize and retrieve Cache. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class CacheFactory { @@ -27,11 +42,16 @@ private static CacheFactory instance = null; /** - * + * The manager of the Cache */ private CacheManager cacheManager = null; /** + * The Cleaner of the Cache + */ + private CacheCleaner cacheCleaner = null; + + /** * Basic-Constructor of this Class */ private CacheFactory() { @@ -40,7 +60,7 @@ /** * This Method provides an singleton Instance of this Class. - * + * * @return an singleton Instance of this Class */ public static CacheFactory getInstance() { @@ -52,7 +72,7 @@ /** * Getting the ConnectionPool - * + * * @return the ConnectionPool */ public Cache getCache() { @@ -62,21 +82,26 @@ /** * Initializes the ConnectionPool. Should only be called once on system * startup - * - * @param properties - * the Properties for the Individual Configuration of the - * ConnectionPool + * + * @param configurationFileName */ public void initializeCache(String configurationFileName) { if (cacheManager == null) { cacheManager = new CacheManager(configurationFileName); cacheManager.addCache(CACHENAME); + + MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); + ManagementService.registerMBeans( + cacheManager, beanServer, false, false, false, true); + + this.cacheCleaner = new ThematicDataCacheCleaner(); + this.cacheCleaner.start(); } } /** * Checks if the ConnectionPool has already been initialized. - * + * * @return true if the ConnectionPool is initialized. */ public boolean isInitialized() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes used for data caching. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,14 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.context; -import org.apache.log4j.Logger; - -import org.w3c.dom.Document; +import de.intevation.artifactdatabase.DefaultArtifactContext; import java.awt.Color; import java.awt.Dimension; @@ -13,13 +16,21 @@ import java.io.File; -import de.intevation.artifactdatabase.DefaultArtifactContext; +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This class defines some final fields used to store some meta information + * required during the work with an artifact into a context object which is + * available in each request specified in + * <code>de.intevation.gnv.artifacts.Artifacts</code> and further methods called + * by those. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ -public class GNVArtifactContext +public class GNVArtifactContext extends DefaultArtifactContext { /** @@ -32,7 +43,7 @@ public static final String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY = "gnv.horizontal.cross.section.profile.samples"; - + public static final String HORIZONTAL_CROSS_SECTION_SAMPLES_KEY = "gnv.horizontal.cross.section.samples"; @@ -44,16 +55,16 @@ "gnv.horizontal.cross.section.result.shapefile"; public static final File - DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH = + DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH = new File(System.getProperty("java.io.tmpdir")); - public static final Integer + public static final Integer DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = Integer.valueOf(250); - - public static final Integer + + public static final Integer DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES = Integer.valueOf(1024); - public static final Integer + public static final Integer DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS = Integer.valueOf(0); public static final String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY = @@ -101,5 +112,5 @@ super(config); log.debug("GNVArtifactContext.Constructor(config)"); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,20 +1,45 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts.context; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; + +import de.intevation.artifacts.ArtifactContextFactory; +import de.intevation.artifacts.GlobalContext; + +import de.intevation.gnv.artifacts.cache.CacheFactory; + +import de.intevation.gnv.chart.XMLChartTheme; + +import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; + +import de.intevation.gnv.geobackend.config.Configuration; + +import de.intevation.gnv.raster.Filter; +import de.intevation.gnv.raster.Palette; +import de.intevation.gnv.raster.PaletteManager; + import java.awt.Color; +import java.awt.Dimension; import java.awt.Paint; +import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.io.File; -import java.util.Properties; -import java.util.HashMap; import java.util.ArrayList; import java.util.Collections; - -import java.awt.Dimension; +import java.util.HashMap; +import java.util.Properties; import org.apache.log4j.Logger; @@ -22,28 +47,14 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; - -import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; -import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; - -import de.intevation.gnv.chart.XMLChartTheme; - -import de.intevation.gnv.artifacts.cache.CacheFactory; - -import de.intevation.gnv.raster.Palette; -import de.intevation.gnv.raster.Filter; -import de.intevation.gnv.raster.PaletteManager; - -import de.intevation.artifacts.ArtifactContextFactory; - -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; - /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (iweinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This factory class is used to create new GNVArtfactContext objects, + * initialize required components and put them into the created context object + * for being available in the application. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:iweinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class GNVArtifactContextFactory implements ArtifactContextFactory { /** @@ -51,56 +62,101 @@ */ private static Logger log = Logger.getLogger(GNVArtifactContext.class); - public static final String XPATH_GEOBACKEND_CONFIGURATION = - "artifact-database/geo-backend/backend-configuration"; + /** + * + */ + public static final String XPATH_GEOBACKEND_CONFIGURATION = + "artifact-database/geo-backend"; - public static final String XPATH_GEOBACKEND_QUERYCONFIGURATION = + /** + * + */ + public static final String XPATH_GEOBACKEND_QUERYCONFIGURATION = "artifact-database/geo-backend/query-configuration"; - private final static String CACHECONFIGNODEPATH = + private final static String CACHECONFIGNODEPATH = "/artifact-database/ehcache/configuration"; - private final static String CHARTCONFIGNODEPATH = + private final static String CHARTCONFIGNODEPATH = "/artifact-database/gnv/charttemplate/configuration"; + /** + * + */ public final static String PALETTES_PATH = "/artifact-database/gnv/palettes"; + /** + * + */ public final static String PALETTE_ITEMS = "palette"; + /** + * + */ public final static String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = "/artifact-database/gnv/horizontal-cross-section-profile/samples/@number"; + /** + * + */ public final static String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION = "/artifact-database/gnv/horizontal-cross-section/ground/@interpolation"; + /** + * + */ public final static String HORIZONTAL_CROSS_SECTION_SAMPLES = "/artifact-database/gnv/horizontal-cross-section/samples/@number"; - + + /** + * + */ public final static String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS = "/artifact-database/gnv/horizontal-cross-section/extrapolation/@rounds"; - + + /** + * + */ public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH = "/artifact-database/gnv/shapefile-directory/@path"; - + + /** + * + */ public final static String VERTICAL_CROSS_SECTION_SAMPLES = "/artifact-database/gnv/vertical-cross-section/samples"; + /** + * + */ public final static String VERTICAL_CROSS_SECTION_FILTERS = "/artifact-database/gnv/vertical-cross-section/filters/filter"; + /** + * + */ public final static String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION = "/artifact-database/gnv/vertical-cross-section/ground/@interpolation"; + /** + * + */ public final static String VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR = "/artifact-database/gnv/vertical-cross-section/ground/@fill-color"; + /** + * + */ public final static String XPATH_MAPSERVER_PATH = "/artifact-database/mapserver/server/@path"; + /** + * + */ public final static String XPATH_MAP_PATH = - "/artifact-database/mapserver/map/@path"; + "/artifact-database/gnv/map-generator/mapfile/@path"; /** * Constructor @@ -111,31 +167,19 @@ } /** + * Create a new {@link GNVArtifactContext} object and initialize all + * components required by the application. + * + * @param config + * @return GNVArtifactContext * @see de.intevation.artifacts.ArtifactContextFactory#createArtifactContext(org.w3c.dom.Document) */ - public Object createArtifactContext(Document config) { + public GlobalContext createArtifactContext(Document config) { GNVArtifactContext returnValue = null; try { log.debug("GNVArtifactContextFactory.createArtifactContext"); - log.info("Initialisation of the Geo-BackendConnectionPool"); - String backendConfigurationFile = Config.getStringXPath(config, - XPATH_GEOBACKEND_CONFIGURATION); - backendConfigurationFile = Config.replaceConfigDir( - backendConfigurationFile); - Properties properties = getProperties(backendConfigurationFile); - ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); - cpf.initializeConnectionPool(properties); - - log.info("Initialisation of the QueryContainer"); - String queryConfigurationFile = Config.getStringXPath(config, - XPATH_GEOBACKEND_QUERYCONFIGURATION); - queryConfigurationFile = Config.replaceConfigDir( - queryConfigurationFile); - - Properties queryProperties = getProperties(queryConfigurationFile); - QueryContainerFactory qcf = QueryContainerFactory.getInstance(); - qcf.initializeQueryContainer(queryProperties); + configureGeoBackend(config); configureCache(config); @@ -163,6 +207,19 @@ return returnValue; } + protected void configureGeoBackend(Document config) + throws FileNotFoundException, IOException, QueryContainerException + { + Configuration geoConf = Configuration.getInstance(); + String configDir = Config.getConfigDirectory().getAbsolutePath(); + geoConf.init(config, configDir, Config.CONFIG_DIR_PLACEHOLDER); + } + + /** + * + * @param config + * @param context + */ protected void configureVerticalCrossSection( Document config, GNVArtifactContext context @@ -175,6 +232,10 @@ } + /** + * + * @param config + */ protected void configureCache(Document config) { String cacheConfigurationFile = Config.getStringXPath( config, CACHECONFIGNODEPATH); @@ -191,6 +252,11 @@ } } + /** + * + * @param config + * @param context + */ protected void configureVerticalCrossSectionGroundFillColor( Document config, GNVArtifactContext context @@ -223,6 +289,11 @@ fill); } + /** + * + * @param config + * @param context + */ protected void configureVerticalCrossSectionGroundInterpolation( Document config, GNVArtifactContext context @@ -232,7 +303,7 @@ config, VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION); - if (interpolation == null + if (interpolation == null || (interpolation = interpolation.trim()).length() == 0) { interpolation = GNVArtifactContext .DEFAULT_VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION; @@ -246,6 +317,11 @@ interpolation); } + /** + * + * @param config + * @param context + */ protected void configureVerticalCrossSectionFilters( Document config, GNVArtifactContext context @@ -298,6 +374,11 @@ Collections.unmodifiableList(filterFactories)); } + /** + * + * @param config + * @param context + */ protected void configureVerticalCrossSectionSamples( Document config, GNVArtifactContext context @@ -333,7 +414,7 @@ } } } - log.info("samples (width x height): " + + log.info("samples (width x height): " + sampleSize.width + " x " + sampleSize.height); context.put( @@ -342,6 +423,11 @@ } + /** + * + * @param config + * @param context + */ protected void configureHorizontalCrossSectionProfile( Document config, GNVArtifactContext context @@ -374,7 +460,12 @@ GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY, samples); } - + + /** + * + * @param config + * @param context + */ protected void configureHorizontalCrossSection( Document config, GNVArtifactContext context @@ -387,6 +478,11 @@ configureHorizontalCrossSectionGroundInterpolation(config, context); } + /** + * + * @param config + * @param context + */ protected void configureHorizontalCrossSectionExtrapolation( Document config, GNVArtifactContext context @@ -423,6 +519,11 @@ extrapolationRounds); } + /** + * + * @param config + * @param context + */ protected void configureHorizontalCrossSectionGroundInterpolation( Document config, GNVArtifactContext context @@ -435,7 +536,7 @@ config, HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION); - if (interpolation == null + if (interpolation == null || (interpolation = interpolation.trim()).length() == 0) { interpolation = GNVArtifactContext .DEFAULT_HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION; @@ -449,6 +550,11 @@ interpolation); } + /** + * + * @param config + * @param context + */ protected void configureHorizontalCrossSectionResultShapeFilePath( Document config, GNVArtifactContext context @@ -457,7 +563,7 @@ log.info( "configuration of horizontal cross section result shape file path"); - File dir = + File dir = GNVArtifactContext. DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH; @@ -472,7 +578,7 @@ log.warn("No 'result-shapefile-directory' given"); } - log.info("writing shape files to '" + log.info("writing shape files to '" + dir.getAbsolutePath() + "'"); context.put( @@ -481,6 +587,11 @@ dir); } + /** + * + * @param config + * @param context + */ protected void configureHorizontalCrossSectionSamples( Document config, GNVArtifactContext context @@ -514,6 +625,11 @@ } + /** + * + * @param config + * @param context + */ protected void configureChartTemplate( Document config, GNVArtifactContext context @@ -546,6 +662,11 @@ context.put(GNVArtifactContext.CHART_TEMPLATE_KEY, theme); } + /** + * + * @param config + * @param context + */ protected void configurePalettes( Document config, GNVArtifactContext context @@ -575,7 +696,7 @@ || (filename = filename.trim()).length() == 0) { log.error("Palette '" + name + "' has no 'file' attribute."); } - else if (parameterIds == null + else if (parameterIds == null || (parameterIds = parameterIds.trim()).length() == 0) { log.error("no parameter ids given for '" + name + "'"); } @@ -614,6 +735,11 @@ } + /** + * + * @param config + * @param context + */ protected void configureMapserver( Document config, GNVArtifactContext context @@ -625,6 +751,7 @@ String mapPath = (String) Config.getStringXPath( config, XPATH_MAP_PATH); + mapPath = Config.replaceConfigDir(mapPath); if (serverPath != null && mapPath != null) { context.put(GNVArtifactContext.MAPSERVER_SERVER_PATH_KEY,serverPath); @@ -633,10 +760,13 @@ } /** - * @param filePath - * @return - * @throws FileNotFoundException - * @throws IOException + * Read some properties from config file specified by <code>filePath</code>. + * + * @param filePath Path to a cofig file. + * @return Properties contained in <code>filePath</code>. + * @throws FileNotFoundException if file specified by filePath is not + * existing. + * @throws IOException if an error occured while reading from file. */ private Properties getProperties(String filePath) throws FileNotFoundException, IOException @@ -656,3 +786,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Support for context objects that store data items used in the GNV in different +places across the whole application. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts.fis; import java.io.IOException; @@ -16,12 +24,13 @@ import org.w3c.dom.NodeList; import de.intevation.artifactdatabase.ProxyArtifact; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.GlobalContext; import de.intevation.gnv.artifacts.GNVArtifactBase; import de.intevation.gnv.artifacts.GNVDefaultArtifact; import de.intevation.gnv.artifacts.GNVProductArtifactFactory; @@ -31,9 +40,13 @@ import de.intevation.gnv.state.DefaultInputData; import de.intevation.gnv.state.InputData; - /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This artifact is used to handle to input/output at the beginning of a + * parameterization when no product has been selected so far. After the user + * having selected a product, this artifact is replaced by a concrete product + * artifact. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class SelectProductArtifact extends GNVDefaultArtifact { @@ -42,17 +55,34 @@ */ private static final long serialVersionUID = -7952357683127758677L; + /** + * Path to uuid. + */ public static final String XPATH_UUID = "art:action/art:uuid/@value"; + /** + * Path to hash. + */ public static final String XPATH_HASH = "art:action/art:hash/@value"; + /** + * Path to selected product. + */ public static final String XPATH_INPUT_DATA_VALUE = "art:action/art:data/art:input[@name='product']/@value"; - - public static final String XPATH_SETUP_PARAMETER_NODES = + + /** + * Path to parameters required by the factory. + */ + public static final String XPATH_SETUP_PARAMETER_NODES = "/art:action/art:factory/art:parameter"; public static final String XFORM_URL = "http://www.w3.org/2002/xforms"; + + /** + * Prefix used in the user interface description part of the describe + * document. + */ public static final String XFORM_PREFIX = "xform"; private static Logger log = Logger.getLogger(SelectProductArtifact.class); @@ -61,27 +91,41 @@ private Product current; private Artifact artifact; private String name; - + private Map<String, InputData> preSettings = null; + /** + * Constructor. + */ public SelectProductArtifact() { super(); } + /** + * Initialize this artifact and parse all required information from <code> + * data</code> document. + * + * @param identifier + * @param factory + * @param context + * @param data + */ @Override public void setup( String identifier, ArtifactFactory factory, Object context, - Document data) { + CallMeta meta, + Document data + ) { log.debug("SelectProductArtifact.setup()"); - super.setup(identifier, factory, context,data); + super.setup(identifier, factory, context, meta, data); this.name = factory.getName(); - + // Read the Parameters that should be used for the setup from the // Data-XML.Document. - NodeList parameterNodes = (NodeList) XMLUtils.xpath(data, + NodeList parameterNodes = (NodeList) XMLUtils.xpath(data, XPATH_SETUP_PARAMETER_NODES, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE); @@ -102,15 +146,27 @@ } } } - + } + /** + * + * @param products Insert a bunch of products. + */ public void setProducts(Map products) { this.products = products; } + /** + * Search for a selected product and create a new concrecte product artifact + * with this information. + * + * @param target Document which contains the selected product. + * @param context CallContext. + * @return Error or success message. + */ @Override public Document feed(Document target, CallContext context) { log.debug("SelectProductArtifact.feed()"); @@ -160,6 +216,15 @@ } + /** + * If {@link #feed(org.w3c.dom.Document, de.intevation.artifacts.CallContext)} + * was sucessfully called before, this artifact is replaced with a concrete + * product artifact. + * + * @param target The advance document. + * @param context The CallContext. + * @return a document with an error or success message. + */ @Override public Document advance(Document target, CallContext context) { log.debug("SelectProductArtifact.advance()"); @@ -204,13 +269,17 @@ .getInternalArtifactFactory(this.name); factory = ((GNVProductArtifactFactory)factory) .getArtifactFactoryByName(current.getName()); - artifact = factory.createArtifact(uuid, context, null); + artifact = factory.createArtifact( + uuid, + (GlobalContext) context.globalContext(), + context.getMeta(), + null); - + if (this.preSettings != null && artifact instanceof PreSettingArtifact){ ((PreSettingArtifact)artifact).setPreSettings(this.preSettings); } - + artifact.feed(feedDocument(uuid, hash), context); result = ((GNVArtifactBase) artifact).initialize(context); @@ -222,6 +291,14 @@ } + /** + * Create a describe document including the user interface description. The + * user gets the choice to select a product supported by the current fis. + * + * @param data The describe document. + * @param context The CallContext. + * @return A document with an error or success message. + */ @Override public Document describe(Document data, CallContext context) { log.debug("SelectProductArtifact.describe()"); @@ -287,6 +364,13 @@ } + /** + * + * @param document + * @param out + * @param context + * @throws IOException + */ @Override public void out(Document document, OutputStream out, CallContext context) throws IOException @@ -298,31 +382,48 @@ } + /** + * Append products to the describe document. + * + * @param document The describe document. + * @param parent The node the products should be appended to. + * @param context The CallContext object. + */ protected void appendProducts( Document document, Node parent, Object context ) { - Iterator iter = products.values().iterator(); - - XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( - document, - ArtifactNamespaceContext.NAMESPACE_URI, - ArtifactNamespaceContext.NAMESPACE_PREFIX - ); + if (products != null && !products.isEmpty()){ + Iterator iter = products.values().iterator(); - while(iter.hasNext()) { - Product prod = (Product) iter.next(); - String name = prod.getName(); + XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( + document, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX + ); - Element current = creator.create("state"); - creator.addAttr(current, "name", name); - creator.addAttr(current, "description", name); - parent.appendChild(current); + while(iter.hasNext()) { + Product prod = (Product) iter.next(); + String name = prod.getName(); + + Element current = creator.create("state"); + creator.addAttr(current, "name", name); + creator.addAttr(current, "description", name); + parent.appendChild(current); + } } } + /** + * Append the product select box to the user interface description of the + * describe document. + * + * @param document The describe document. + * @param node The node the products should be appended to. + * @param callMeta The CallMeta object. + */ protected void appendSelectProducts( Document document, Node node, @@ -350,29 +451,37 @@ Element choiceNode = creator.create("choices"); selectNode.appendChild(lableNode); selectNode.appendChild(choiceNode); + if (products != null && !products.isEmpty()){ + Iterator it = products.values().iterator(); + while (it.hasNext()) { + Product p = (Product) it.next(); + Element itemNode = creator.create("item"); + Element choiceLableNode = creator.create("label"); + choiceLableNode.setTextContent(ressource.getRessource( + callMeta.getLanguages(), + p.getName(), + p.getName() + )); + itemNode.appendChild(choiceLableNode); - Iterator it = products.values().iterator(); - while (it.hasNext()) { - Product p = (Product) it.next(); - Element itemNode = creator.create("item"); - Element choiceLableNode = creator.create("label"); - choiceLableNode.setTextContent(ressource.getRessource( - callMeta.getLanguages(), - p.getName(), - p.getName() - )); - itemNode.appendChild(choiceLableNode); - - Element choiceValueNode = creator.create("value"); - choiceValueNode.setTextContent(p.getName()); - itemNode.appendChild(choiceValueNode); - choiceNode.appendChild(itemNode); + Element choiceValueNode = creator.create("value"); + choiceValueNode.setTextContent(p.getName()); + itemNode.appendChild(choiceValueNode); + choiceNode.appendChild(itemNode); + } } node.appendChild(selectNode); } + /** + * Create a feed document. + * + * @param uuid The UUID of the current artifact. + * @param hash The hash of the current artifact. + * @return the feed document. + */ protected Document feedDocument(String uuid, String hash) { Document document = XMLUtils.newDocument(); @@ -415,4 +524,4 @@ return document; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes providing a special artifact used after a fis is +selected and the user needs to choose a concrete product. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.fis.product; import de.intevation.gnv.state.InputData; @@ -8,8 +13,10 @@ import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the default implementation of <code>Product</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class DefaultProduct implements Product { @@ -26,10 +33,10 @@ /** * Constructor - * - * @param name - * @param parameter - * @param artifactFactory + * + * @param name The name of this product. + * @param parameter Required parameters for this product. + * @param artifactFactory The artifact factory. */ public DefaultProduct( String name, @@ -43,24 +50,25 @@ } /** - * @see de.intevation.gnv.artifacts.fis.product.Product#getName() + * @return the name if this product. */ public String getName() { return this.name; } /** - * @see de.intevation.gnv.artifacts.fis.product.Product#getParameter() + * @return the input data. */ public Collection<InputData> getParameter() { return this.parameter; } /** - * @see de.intevation.gnv.artifacts.fis.product.Product#getArtifactFactory() + * @return the artifact factory. */ public String getArtifactFactory() { return this.artifactFactory; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.fis.product; import de.intevation.gnv.state.InputData; @@ -10,14 +15,34 @@ import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the interface description of <code>Product</code>. Currently, there + * are three methods defined:<br> + * <ol> + * <li>getName(): retrieves the name of the <code>Product</code></li> + * <li>getParameter(): retrieves a collection of required parameters.</li> + * <li>getArtifactFactory(): retrieves the factory used to create this artifact. + * </li> + * </ol> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface Product extends Serializable { + /** + * + * @return The name of this product. + */ public String getName(); + /** + * + * @return All required parameters for parameterization. + */ public Collection<InputData> getParameter(); + /** + * + * @return The artifact factory used to create the current artifact. + */ public String getArtifactFactory(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes and interfaces representing a product (eg 'Horizontalschnitt', +'Horizontalprofil', 'Vertikalprofil', 'Profilschnitt', 'Zeitserien'). +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Map user workflows to software components using classes and interfaces in this +package. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,27 +1,32 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.ressource; +import de.intevation.artifacts.PreferredLocale; + import java.io.BufferedReader; -import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.IOException; + import java.util.ArrayList; +import java.util.List; import java.util.Locale; -import java.util.List; import java.util.MissingResourceException; import java.util.ResourceBundle; import org.apache.log4j.Logger; -import de.intevation.artifacts.PreferredLocale; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class RessourceFactory { @@ -55,7 +60,7 @@ /** * This Method provides an singleton Instance of this Class. - * + * * @return an singleton Instance of this Class */ public static synchronized RessourceFactory getInstance() { @@ -132,13 +137,10 @@ /** * Deliveres the translated Value for an Key to an given Language - * - * @param locale - * The choosen locale - * @param key - * the key - * @param defaultValue - * the Value that should be returned. + * + * @param preferredLocales + * @param key the key + * @param defaultValue the Value that should be returned. * @return the translated Value */ public String getRessource(PreferredLocale[] preferredLocales, String key, @@ -151,6 +153,14 @@ } + /** + * Deliveres the language specific value for the given <code>key</code> + * + * @param locale + * @param key + * @param defaultVal + * @return language specific string. + */ public String getRessource(Locale locale, String key, String defaultVal) { if (key == null || locale == null) return defaultVal; @@ -169,3 +179,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes to handle working with resources. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services; import java.util.ArrayList; @@ -20,9 +25,10 @@ import com.vividsolutions.jts.io.WKTReader; import de.intevation.artifactdatabase.DefaultService; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.GlobalContext; import de.intevation.artifacts.ServiceFactory; import de.intevation.gnv.artifacts.services.requestobjects.DefaultFIS; import de.intevation.gnv.artifacts.services.requestobjects.DefaultLayer; @@ -39,7 +45,14 @@ import de.intevation.gnv.utils.ArtifactXMLUtilities; /** - * @author Tim Englich <tim.englich@intevation.de> + * This Class Provides the Functionality to return only those + * Artifacfactories which fulfill the conditions of the Request. + * + * This Service is used to implement the Functionality of the MV-GNV-Interface + * by looking if an Region of an FIS is intersecting the Area which is send + * during the Request or which FIS belongs to the requested MapServices. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MetaDataService extends DefaultService { @@ -49,17 +62,17 @@ */ private static Logger log = Logger.getLogger(MetaDataService.class); - - private final static String FIS_REGION_QUERY_ID = + + private final static String FIS_REGION_QUERY_ID = "mapviewer_interface_fis_region"; - private final static String MAPSERVICES_HAS_FIS_QUERY_ID = + private final static String MAPSERVICES_HAS_FIS_QUERY_ID = "mapviewer_interface_mapservices_has_fis"; - private final static String MAPSERVICES_HAS_PARAMETER_QUERY_ID = + private final static String MAPSERVICES_HAS_PARAMETER_QUERY_ID = "mapviewer_interface_mapservices_has_parameter"; - - private final static String MAPSERVICES_HAS_PARAMETER_USING_LAYER_QUERY_ID = + + private final static String MAPSERVICES_HAS_PARAMETER_USING_LAYER_QUERY_ID = "mapviewer_interface_mapservices_has_parameter_using_layer"; - + private static String ATTRIBUTE_ID = "id"; private static String ATTRIBUTE_NAME = "name"; private static String ATTRIBUTE_TYPE = "type"; @@ -67,14 +80,14 @@ private static String ATTRIBUTE_GROUPLAYER = "isgrouplayer"; private static String ATTRIBUTE_PARENTID = "parentid"; private static String ATTRIBUTE_SRS = "srs"; - - + + private static String XPATH_LOACTION_NODE = "art:GetMetaData/art:location"; private static String XPATH_MAPSERVICES_NODESET = "art:GetMetaData/" + "art:mapservices/" + "art:mapservice"; private static String XPATH_LAYER_NODESET = "art:layer"; - + /** * The UID of this Class. */ @@ -87,34 +100,34 @@ super(); } - /** - * @see de.intevation.artifactdatabase.DefaultService#process(org.w3c.dom.Document, java.lang.Object, de.intevation.artifacts.CallMeta) - */ @Override - public Document process(Document data, Object globalContext, - CallMeta callMeta) { + public Document process( + Document data, + GlobalContext globalContext, + CallMeta callMeta + ) { log.debug("MetaDataService.process"); Document document = null; try { Geometry g = this.parseGeometry(data); Collection<MapService> mapServices = this.parseMapServices(data); - Collection<FIS> resultFIS = this.unionFIS(this.getFIS(g), + Collection<FIS> resultFIS = this.unionFIS(this.getFIS(g), this.getFIS(mapServices)); document = XMLUtils.newDocument(); this.writeFIS2Document(document, resultFIS); - log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); + log.debug(ArtifactXMLUtilities.writeDocument2String(document)); } catch (MetaDataServiceException e) { log.error(e,e); - document = new ArtifactXMLUtilities() + document = ArtifactXMLUtilities .createExceptionReport(e.getMessage(), document); } return document; } - - private Geometry parseGeometry(Document data) + + private Geometry parseGeometry(Document data) throws MetaDataServiceException{ log.debug("MetaDataService.parseGeometry"); - + Element locationNode = (Element) XMLUtils.xpath( data, XPATH_LOACTION_NODE, @@ -139,11 +152,11 @@ } return returnValue; } - + private Collection<MapService> parseMapServices(Document data){ log.debug("MetaDataService.parseMapServices"); - - NodeList mapServices = (NodeList) XMLUtils.xpath(data, + + NodeList mapServices = (NodeList) XMLUtils.xpath(data, XPATH_MAPSERVICES_NODESET, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE); @@ -156,8 +169,8 @@ String type = mapServiceNode.getAttribute(ATTRIBUTE_TYPE); String url = mapServiceNode.getAttribute(ATTRIBUTE_URL); Collection<Layer> layer = null; - - NodeList layerNodes = (NodeList) XMLUtils.xpath(mapServiceNode, + + NodeList layerNodes = (NodeList) XMLUtils.xpath(mapServiceNode, XPATH_LAYER_NODESET, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE); @@ -167,29 +180,29 @@ Element layerNode = (Element)layerNodes.item(j); String layerId = layerNode.getAttribute(ATTRIBUTE_ID); String layerName = layerNode.getAttribute(ATTRIBUTE_NAME); - boolean isGroupLayer = + boolean isGroupLayer = Boolean.parseBoolean(layerNode .getAttribute( ATTRIBUTE_GROUPLAYER)); String parentId = layerNode .getAttribute(ATTRIBUTE_PARENTID); - + layer.add(new DefaultLayer(layerId, layerName, isGroupLayer, parentId)); } } - MapService mapService = new DefaultMapService(id, layer, + MapService mapService = new DefaultMapService(id, layer, type, url); returnValue.add(mapService); - + } } return returnValue; } - - private Collection<FIS> unionFIS(Collection<FIS> fromGeometry, + + private Collection<FIS> unionFIS(Collection<FIS> fromGeometry, Collection<FIS> fromMapservices){ log.debug("MetaDataService.unionFIS"); Collection<FIS> returnValue = null; @@ -198,7 +211,7 @@ }else if (fromMapservices == null || fromMapservices.isEmpty()){ returnValue = fromGeometry; }else{ - + returnValue = new ArrayList<FIS>(); Iterator<FIS> it = fromMapservices.iterator(); while (it.hasNext()){ @@ -210,15 +223,15 @@ } return returnValue; } - + /** * Puts the retrieved FIS into the given XML-Document. * @param document the Document where the FIS should be put in. - * @param fis the retrieved FIS which should be written into + * @param fis the retrieved FIS which should be written into * the XML-Document. */ private void writeFIS2Document(Document document, Collection<FIS> fis){ - + if (fis != null){ Iterator<FIS> it = fis.iterator(); XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( @@ -228,16 +241,16 @@ ); Node rootNode = creator.create("result"); document.appendChild(rootNode); - + Node factoriesNode = creator.create("factories"); rootNode.appendChild(factoriesNode); while (it.hasNext()){ FIS tmpFIS = it.next(); Element fisNode = creator.create("factory"); fisNode.setAttribute("art:name",tmpFIS.getID()); - + Collection<Parameter> parameter = tmpFIS.getParameter(); - + if(parameter != null){ Iterator<Parameter> pit = parameter.iterator(); while (pit.hasNext()){ @@ -252,13 +265,14 @@ } } } - + /** * Returns all FIS which Areas is intersected by this given Geometry * @param g the Geometry which should be used to determine the FIS. * @return all FIS which Areas is intersected by this given Geometry + * @throws MetaDataServiceException */ - protected Collection<FIS> getFIS(Geometry g) + protected Collection<FIS> getFIS(Geometry g) throws MetaDataServiceException{ log.debug("MetaDataService.getFIS ==> Geometry"); Collection<FIS> resultValue = null; @@ -269,7 +283,7 @@ .getQueryExecutor(); Collection<Result> result = queryExecutor.executeQuery(FIS_REGION_QUERY_ID, new String[]{g.toString()}); - + if (result != null){ resultValue = new ArrayList<FIS>(result.size()); Iterator<Result> it = result.iterator(); @@ -286,11 +300,12 @@ } return resultValue; } - + /** * Returns all FIS which were represented by the given Mapservices * @param mapServices the Mapservices which should determine the FIS. * @return all FIS which where represented my the given Mapservices. + * @throws MetaDataServiceException */ protected Collection<FIS> getFIS(Collection<MapService> mapServices) throws MetaDataServiceException{ @@ -298,16 +313,16 @@ Collection<FIS> resultValue = null; if (mapServices != null && !mapServices.isEmpty()){ try { - + String mapServiceNames = ""; - Iterator<MapService> mit = mapServices.iterator(); + Iterator<MapService> mit = mapServices.iterator(); while(mit.hasNext()){ if (mapServiceNames.length() > 0){ mapServiceNames += " , "; } mapServiceNames += "'"+mit.next().getID()+"'"; } - + QueryExecutor queryExecutor = QueryExecutorFactory .getInstance() .getQueryExecutor(); @@ -321,7 +336,7 @@ Result value = it.next(); String fisId = value.getString(0).trim(); String mapServiceID = value.getString(1).trim(); - + // FIRST LOOK IF ONE MAPSERVICE REPRESENTS ONLY ONE PARAM Collection<Result> result2 = queryExecutor.executeQuery( MAPSERVICES_HAS_PARAMETER_QUERY_ID, @@ -334,7 +349,7 @@ Result parameterValue = it2.next(); String parameterID = parameterValue.getString(0) .trim(); - parameter.add(new DefaultParameter(parameterID, + parameter.add(new DefaultParameter(parameterID, parameterID)); } }else{ @@ -344,14 +359,14 @@ mapServiceID); Collection<Layer> layer = service.getLayer(); if (layer != null && !layer.isEmpty()){ - String layerQueryString = + String layerQueryString = this.createLayerQueryString(layer); - Collection<Result> parameterResult = + Collection<Result> parameterResult = queryExecutor.executeQuery( MAPSERVICES_HAS_PARAMETER_USING_LAYER_QUERY_ID, new String[]{"'"+mapServiceID+"'", layerQueryString}); - if (parameterResult != null && + if (parameterResult != null && !parameterResult.isEmpty()){ Iterator<Result> it2 = parameterResult.iterator(); parameter = new ArrayList<Parameter>(parameterResult.size()); @@ -359,14 +374,14 @@ Result parameterValue = it2.next(); String parameterID = parameterValue.getString(0) .trim(); - parameter.add(new DefaultParameter(parameterID, + parameter.add(new DefaultParameter(parameterID, parameterID)); } } } - + } - + FIS fis = this.getFIS(resultValue, fisId); if (fis != null){ if (parameter != null){ @@ -381,14 +396,14 @@ log.error(e,e); throw new MetaDataServiceException("Cannot Query FIS from DB."); } - + } return resultValue; } - - + + private FIS getFIS (Collection<FIS> fis, String fisId){ - + Iterator<FIS> it = fis.iterator(); while(it.hasNext()){ FIS tmpFIS = it.next(); @@ -398,7 +413,7 @@ } return null; } - + private MapService getMapService(Collection<MapService> mapServices, String mapServiceID){ log.debug("MetaDataService.getMapService"); @@ -411,7 +426,7 @@ } return null; } - + private String createLayerQueryString(Collection<Layer> layer){ log.debug("MetaDataService.createLayerQueryString"); StringBuffer sb = new StringBuffer();; @@ -425,7 +440,7 @@ sb.append(" , "); } } - + } } String returnValue = sb.toString(); @@ -437,11 +452,8 @@ return returnValue; } - /** - * @see de.intevation.artifactdatabase.DefaultService#setup(de.intevation.artifacts.ServiceFactory, java.lang.Object) - */ @Override - public void setup(ServiceFactory factory, Object globalContext) { + public void setup(ServiceFactory factory, GlobalContext globalContext) { log.debug("MetaDataService.setup"); super.setup(factory, globalContext); // TODO: Perhaps it is necessary to init the QueryIds here.
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services; + /** - * @author Tim Englich <tim.englich@intevation.de> + * ExceprionClass for MetaDataServices. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MetaDataServiceException extends Exception { @@ -46,3 +53,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,10 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides Classes which Implements the Interface +de.intevation.artifactdatabase.Service +to provide different Services offered by the ArtifactDatabase. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,50 +1,68 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; import java.util.Collection; import java.util.Iterator; /** - * @author Tim Englich <tim.englich@intevation.de> + * The default implementation of <code>Fis</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultFIS implements FIS { - + /** + * The ID of the FIS + */ private String id = null; - + + /** + * The Parameter which belongs to the FIS. + */ private Collection<Parameter> parameter = null; + /** + * Constructor + * + * @param id The id for this fis. + */ public DefaultFIS(String id){ super(); this.id = id; } /** * Constructor - * @param id - * @param parameter + * @param id The id for this fis. + * @param parameter A collection of parameters. */ public DefaultFIS(String id, Collection<Parameter> parameter) { this(id); this.parameter = parameter; } - /** - * @see de.intevation.gnv.artifacts.services.requestobjects.FIS#getID() - */ + public String getID() { return this.id; } - /** - * @see de.intevation.gnv.artifacts.services.requestobjects.FIS#getParameter() - */ public Collection<Parameter> getParameter() { return this.parameter; } + /** + * Two objects are equal if they have the same id. + * + * @param arg0 Object which is checked for equality. + * @return True, if both objects are equal, otherwise false. + */ @Override public boolean equals(Object arg0) { boolean returnValue = false; @@ -53,8 +71,22 @@ } return returnValue; } + /** - * @see de.intevation.gnv.artifacts.services.requestobjects.FIS#addParameter(java.util.Collection) + * Creates a hash code using the id and the given parameters. + * + * @return A hash code. + */ + @Override + public int hashCode() { + int hash = 7; + hash = 47 * hash + (this.id != null ? this.id.hashCode() : 0); + hash = 47 * hash + (this.parameter != null ? this.parameter.hashCode() : 0); + return hash; + } + + /** + * @param parameter Collection of parameters. */ public void addParameter(Collection<Parameter> parameter) { if (this.parameter != null){ @@ -69,7 +101,5 @@ this.parameter = parameter; } } - - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,23 +1,47 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; + /** - * @author Tim Englich <tim.englich@intevation.de> + * The default Implementation of <code>Layer</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultLayer implements Layer { - + /** + * The id of the Layer + */ private String id = null; - + + /** + * The name of the Layer + */ private String name = null; - + + /** + * Flag which defines if the Layer is a GroupLayer + */ private boolean groupLayer = false; - + + /** + * The ID of the Parentlayer or null if the Layer is a Rootlayer + */ private String parentId = null; + /** * Constructor + * @param id The id of this layer. + * @param name The name of this layer. + * @param groupLayer A boolean property to define this layer as group layer. + * @param parentId The id of the parent layer. */ public DefaultLayer(String id,String name, boolean groupLayer,String parentId) { @@ -27,36 +51,27 @@ this.parentId = parentId; } - - - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#getID() - */ public String getID() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#getName() - */ public String getName() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#isGroupLayer() - */ public boolean isGroupLayer() { return this.groupLayer; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#parentID() - */ public String parentID() { return this.parentId; } - + + /** + * This methods returns this layer as string. + * + * @return this layer as string. + */ @Override public String toString() { return "ID: "+ this.id + " Name: "+this.name+ @@ -65,3 +80,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,29 +1,51 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * The default Implementation of <code>MapService</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultMapService implements MapService { + /** + * The id of the Mapservice + */ private String id = null; - - + /** + * The Layer which belongs to the Mapservice + */ private Collection<Layer> layer = null; - + + /** + * The Type of the Mapservice + */ private String type = null; - + + /** + * The Url under which the Mapservice could be accessed. + */ private String url = null; + /** * Constructor + * @param id The id of this service. + * @param type The type of this service. + * @param layer The layers available in this service. + * @param url The url used to call this service. */ - public DefaultMapService(String id, Collection<Layer> layer, + public DefaultMapService(String id, Collection<Layer> layer, String type, String url) { super(); this.id = id; @@ -32,32 +54,20 @@ this.url = url; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getID() - */ public String getID() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getLayer() - */ public Collection<Layer> getLayer() { return this.layer; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getType() - */ public String getType() { return this.type; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getURL() - */ public String getURL() { return this.url; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,35 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; + /** - * @author Tim Englich <tim.englich@intevation.de> + * The default Implementation of <code>Parameter</code>. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultParameter implements Parameter { - + + /** + * The id of the Parameter + */ private String id = null; - + + /** + * The name of the Parameter + */ private String name = null; - + /** * Constructor - * @param id - * @param name + * @param id The id of this parameter. + * @param name The name of this parameter. */ public DefaultParameter(String id, String name) { super(); @@ -24,18 +37,12 @@ this.name = name; } - /** - * @see de.intevation.gnv.artifacts.services.requestobjects.Parameter#getID() - */ public String getID() { return this.id; } - /** - * @see de.intevation.gnv.artifacts.services.requestobjects.Parameter#getName() - */ public String getName() { return this.name; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,48 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * This is the interface description for a fis. Currently, there are three + * methods defined which need to be implemented by concrete classes:<br> + * <ol> + * <li>getID(): Returns the id of this fis.</li> + * <li>getParameter(): Returns a collection of parameter.</li> + * <li>addParameter(Collection<Parameter>): Adds a parameter collection to this + * fis.</li> + * </ol> + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface FIS { - + + /** + * Returns the id of this FIS + * @return the id of this fis. + */ String getID(); + + /** + * Returns a collection of Parameters which belongs to the FIS. + * @return a collection of parameters. + */ Collection<Parameter> getParameter(); + + /** + * Add a collection of parameters to this fis. + * + * @param parameter Some parameters. + */ void addParameter(Collection<Parameter> parameter); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,53 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; + /** - * @author Tim Englich <tim.englich@intevation.de> + * This is the inteface description of a <code>Layer</code>. Currently, there + * are four methods defined here:<br> + * <ol> + * <li>getName(): Returns the name of this layer.</li> + * <li>getID(): Returns the id of this layer.</li> + * <li>isGroupLayer(): Returns true, if this layer contains child layers.</li> + * <li>parentID(): Returns the id of the parent layer if this layer is a + * group layer.</li> + * </ol> + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface Layer { - + + /** + * Returns the name of this layer. + * @return the name of this layer. + */ String getName(); + + /** + * Returns the id of this layer. + * @return the id of this layer. + */ String getID(); + + /** + * Returns true if the Layer is an GroupLayer + * @return true, if this layer is a group layer - otherwise false. + */ boolean isGroupLayer(); + + /** + * Returned the ID of the Parent Layer. + * Only if the Layer is a Child-Layer. + * If this Layer is an Root-Layer null will be returned. + * @return the id of the parent. + */ String parentID(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,23 +1,55 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * This is the interface description of <code>MapService</code>. Currently, + * there are four methods defined:<br> + * <ol> + * <li>getID(): Returns the id of this service.</li> + * <li>getURL(): Returns the url used to call this service.</li> + * <li>getType(): Returns the service type.</li> + * <li>getLayer(): Returns a collection of layers contained in this service. + * </li> + * </ol> + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface MapService { - - + + + /** + * Returns the id of this Service. + * @return the id of this service. + */ String getID(); - + + /** + * Returns the Url under which this service is available. + * @return the url under which this service is available. + */ String getURL(); - + + /** + * Returns the service type + * @return the service type. + */ String getType(); - + + /** + * Returns the Layer which belongs to this Service. + * @return a collection of layers contained in this service. + */ Collection<Layer> getLayer(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,35 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.services.requestobjects; + /** - * @author Tim Englich <tim.englich@intevation.de> + * This is the interface description of <code>Parameter</code>. Currently, there + * are two methods defined:<br> + * <ol> + * <li>getName(): Returns the name of this parameter.</li> + * <li>getID(): Returns the id of this parameter.</li> + * </ol> * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface Parameter { - + + /** + * The Name of this Parameter + * @return the name of this parameter. + */ String getName(); - String getID (); + /** + * The ID of this Parameter + * @return the id of this parameter. + */ + String getID(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,10 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides Interfaces and Classes which are required to represent the +Objects which are required to handle all Servicerequests which are defined in the +Parentpackage. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,31 +1,90 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; import java.util.Collection; import java.util.Locale; +import org.jfree.chart.ChartTheme; import org.jfree.chart.JFreeChart; -import org.jfree.chart.ChartTheme; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * Abstract chart class to define the basic fields used for chart creation. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public abstract class AbstractChart implements Chart { + /** + * JFreeChart object. Created after {@link #generateChart()} is called. + */ protected JFreeChart chart; + + /** + * Field storing the visibility of lines in the chart plot. + */ protected boolean linesVisible; + + /** + * Field storing the visibility of points in the chart plot. + */ protected boolean shapesVisible; + /** + * Locale object used for i18n support. + */ protected Locale locale; + /** + * ChartLabels + */ protected ChartLabels labels; + + /** + * ChartTheme + */ protected ChartTheme theme; + + /** + * Collection which contains a bunch of parameters. + */ protected Collection parameters; + + /** + * Collection which contains a bunch of measurements. + */ protected Collection measurements; + + /** + * Collection which contains all data objects used to be displayed in the + * chart. It contains different series and different datasets which is not + * very elegant. + */ protected Collection resultSet; + + /** + * Collection which contains a bunch of date objects. + */ protected Collection dates; + + /** + * Collection which contains a bunch of time gap definitions used to + * detect gaps in timeseries charts. + */ protected Collection timeGaps; + /** + * Abstract method which needs to be implemented by concrete subclasses. + * This method triggers the JFreeChart creation process. After calling this + * method {@link #chart} should be a valid <code>JFreeChart</code> object. + */ public abstract JFreeChart generateChart(); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractHistogram.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractHistogram.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; import java.util.Locale; @@ -8,27 +16,61 @@ import org.jfree.chart.ChartTheme; import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.TickUnitSource; + import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYBarRenderer; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This abstract class defines some methods to adjust chart settings after its + * creation. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public abstract class AbstractHistogram implements Chart { + /** + * Logger used for logging with Apache log4j. + */ private Logger logger = Logger.getLogger(AbstractHistogram.class); + /** + * JFreeChart chart stored at this place after chart creation. + */ protected JFreeChart chart; + + /** + * Labels used for chart title, subtitle, axis description. + */ protected ChartLabels labels; + + /** + * Theme which is used to adjust the styling of this chart. + */ protected ChartTheme theme; + + /** + * Raw data which should be displayed in the chart. + */ protected Object[] data; + /** + * Locale object used for i18n support. + */ protected Locale locale; + /** + * Constructor for creating histogram charts. + * + * @param labels See {@link #labels} + * @param data See {@link #data} + * @param theme See {@link #theme} + */ public AbstractHistogram( ChartLabels labels, Object[] data, ChartTheme theme ) { @@ -38,6 +80,9 @@ } + /** + * @see de.intevation.gnv.chart.Chart#generateChart() + */ public JFreeChart generateChart() { if (chart != null) @@ -57,11 +102,16 @@ theme.apply(chart); adjustPlot(); + adjustDomainAxis(chart); + adjustRangeAxis(chart); return chart; } + /** + * Method to do some changes in plot settings. + */ protected void adjustPlot() { XYPlot plot = (XYPlot) chart.getPlot(); XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer(); @@ -71,6 +121,31 @@ } + protected void adjustDomainAxis(JFreeChart chart) { + XYPlot plot = (XYPlot) chart.getPlot(); + NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); + + TickUnitSource tus = domainAxis.createStandardTickUnits(locale); + domainAxis.setStandardTickUnits(tus); + } + + + protected void adjustRangeAxis(JFreeChart chart) { + XYPlot plot = (XYPlot) chart.getPlot(); + NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); + + TickUnitSource tus = rangeAxis.createStandardTickUnits(locale); + rangeAxis.setStandardTickUnits(tus); + } + + + + + /** + * This method needs to be implemented by subclasses and should add valid + * <code>HistogramDataset</code> objects to the created chart. It is called + * by {@link #generateChart} after chart creation. + */ protected abstract void applyDatasets(); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,23 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + import java.awt.Color; + import java.awt.geom.Ellipse2D; + import java.text.NumberFormat; + import java.util.Collection; import java.util.Iterator; import java.util.Locale; @@ -10,55 +25,130 @@ import org.apache.log4j.Logger; +import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; -import org.jfree.chart.ChartFactory; + import org.jfree.chart.axis.Axis; +import org.jfree.chart.axis.AxisLocation; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.NumberTickUnit; -import org.jfree.chart.axis.AxisLocation; + import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; + import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; + import org.jfree.chart.title.TextTitle; -import org.jfree.data.xy.XYDataset; + import org.jfree.data.Range; + import org.jfree.data.general.Series; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import org.jfree.data.xy.XYDataset; +import org.jfree.ui.RectangleInsets; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This abstract class defines some methods to adjust chart settings after its + * creation. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public abstract class AbstractXYLineChart extends AbstractChart { + /** + * Constant field used to expand the area between data and chart border. Its + * value is {@value}.<br> + * A value of 0.05 equals 5 percent. + */ public static final double LOWER_MARGIN = 0.05D; + + /** + * Constant field used to expand the area between data and chart border. Its + * value is {@value}.<br> + * A value of 0.05 equals 5 percent. + */ public static final double UPPER_MARGIN = 0.05D; + /** + * Logger used to log with log4j. + */ private static Logger log = Logger.getLogger(AbstractXYLineChart.class); + /** + * Field of supported colors used for lines and data points in charts. + */ protected static Color[] COLOR = { Color.black, Color.red, Color.green, Color.blue, Color.yellow, Color.gray, Color.orange, Color.pink, Color.cyan }; + /** + * Static field to remember the index of the previously used color. + */ protected static int nextColor = 0; + /** + * Default <code>PlotOrientation</code>. + */ protected PlotOrientation PLOT_ORIENTATION = PlotOrientation.VERTICAL; - /** Map to store datasets for each parameter */ + /** + * Map to store datasets for each parameter. + */ protected Map datasets; - /** Map to store max ranges of each parameter (axis.setAutoRange(true) + /** + * Map to store max ranges of each parameter (axis.setAutoRange(true) * doesn't seem to work */ protected Map ranges; + /** + * This method is called by <code>Chart</code> to bring the data into the + * right form fitting to JFreeChart objects. + */ protected abstract void initData(); + + /** + * Add a value of <code>row</code> to <code>series</code>. + * + * @param row <code>Result</code> Object returned from database. Contains + * a value used to add to <code>series</code> + * @param series A JFreeChart Series object. + */ protected abstract void addValue(Result row, Series series); + + /** + * Add <code>series</code> to JFreeChart's Dataset object currently which is + * processing. + * + * @param series Series to add. + * @param label Label used show in legend. + * @param idx Currently not used. + */ protected abstract void addSeries(Series series, String label, int idx); + + /** + * Abstract method which is called by <code>Chart</code> interface after + * chart creation. It turns an axis' label into a locale specific format. + * + * @param axis Axis to adjust. + * @param locale java.util.Locale object used specify the format. + */ protected abstract void localizeDomainAxis(Axis axis, Locale locale); + + /** + * Abstract method to create a label for a series of parameters. + * + * @param breakPoint1 Identifier returned from database. These identifier + * are used to identify the results from database which are all stored in + * one big java.util.Collection. + * @param breakPoint2 Identifier returned from database. + * @param breakPoint3 Identifier returned from database. + * + * @return Concatinated string of parameter name and measurement. + */ protected abstract String createSeriesName( String breakPoint1, String breakPoint2, @@ -66,6 +156,9 @@ ); + /** + * @see de.intevation.gnv.chart.Chart#generateChart() + */ public JFreeChart generateChart() { log.debug("generate XYLineChart"); nextColor = 0; @@ -100,6 +193,15 @@ } + /** + * Method used to adjust the axes after chart generation. Methods for i18n + * support ({@link #localizeDomainAxis} and {@link #localizeRangeAxis}) are + * called and axes of this series are expanded. + * + * @param seriesKey Identifier of an axis which have to be adjusted. + * @param idx Set the axis identified by <code>seriesKey</code> to position + * <code>idx</code>. + */ protected void prepareAxis(String seriesKey, int idx) { log.debug("prepare axis of xychart"); @@ -113,7 +215,18 @@ // litte workarround to adjust the max range of axes. // NumberAxis.setAutoRange(true) doesn't seem to work properly. Range yRange = (Range) ranges.get(seriesKey); - yAxis.setRange(Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN)); + double lo = yRange.getLowerBound(); + double hi = yRange.getUpperBound(); + + if (lo == hi) { + yRange = new Range( + lo - (lo / 100 * LOWER_MARGIN), + hi + (hi / 100 * UPPER_MARGIN)); + } + else { + yRange = Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN); + } + yAxis.setRange(yRange); log.debug("Max Range of dataset is: " + yRange.toString()); if (seriesKey.contains("richtung")) { @@ -138,6 +251,16 @@ } + /** + * Method to adjust the rendering of a series in a chart. Line color and + * symbols of vertices are configured here. + * + * @param idx Position of the renderer. + * @param seriesCount Maximum number of series in this chart. + * @param renderLines Lines are displayed if true, otherwise they are not. + * @param renderShapes Vertices are displayed if true, otherwise they are + * not. + */ protected void adjustRenderer( int idx, int seriesCount, @@ -160,21 +283,44 @@ for (int i = 0; i < seriesCount; i++) { renderer.setSeriesShape(i, renderer.getSeriesShape(0)); - renderer.setSeriesPaint(i, COLOR[nextColor%COLOR.length]); + renderer.setSeriesPaint(i, COLOR[nextColor() % COLOR.length]); renderer.setSeriesShapesVisible(i, renderShapes); renderer.setSeriesLinesVisible(i, renderLines); - nextColor++; } plot.setRenderer(idx, renderer); } + /** + * @return Index of the next color + */ + protected static synchronized int nextColor() { + return nextColor++; + } + + + /** + * Method to adjust the plot rendering. Disable horizontal grid lines if + * <code>plot</code> contains only a single y-axis. + * + * @param plot JFreeChart Plot object to be adjusted. + */ protected void adjustPlot(XYPlot plot) { if (plot.getRangeAxisCount() > 1) plot.setRangeGridlinesVisible(false); + + plot.setAxisOffset(new RectangleInsets(0, 0, 0, 15)); } + /** + * Abstract method which is called after chart creation. It turns an + * axis' label into a locale specific format. + * + * @param axis Axis to adjust. + * @param locale java.util.Locale object used specify the format. + * + */ protected void localizeRangeAxis(Axis axis, Locale locale) { if (locale == null) return; @@ -189,6 +335,13 @@ } + /** + * Return the maximum y-range of <code>dataset</code>. + * + * @param dataset Dataset to be scaned. + * + * @return JFreeChart Range object containing min and max y-value. + */ public Range getMaxRangeOfDataset(XYDataset dataset) { int seriesCount = dataset.getSeriesCount(); double upper = Double.NEGATIVE_INFINITY; @@ -212,6 +365,15 @@ } + /** + * Return the maximum y-range of <code>dataset</code> with a margin of + * <code>percent</code> percent. + * + * @param dataset Dataset to be scaned. + * @param percent Percent used to expand the range. + * @return JFreeChart Range object containing min and max y-value with a + * margin. + */ public Range getMaxRangeOfDatasetWithMargin( XYDataset dataset, double percent @@ -225,6 +387,13 @@ } + /** + * Method to find a parameter specified by its value. + * + * @param label Search string. + * + * @return Value of a parameter with the given label. + */ protected String findParameter(String label) { Iterator iter = parameters.iterator(); @@ -240,6 +409,14 @@ } + /** + * Method to find a description of a given collection of values. + * + * @param values Collection to be scaned. + * @param id Identifier and search string of the searched value. + * + * @return title + */ protected String findValueTitle(Collection values, String id) { log.debug("find description of dataset"); @@ -256,6 +433,15 @@ } + /** + * Method to store the maximum range. Since we need to adjust the range of + * each range axis, we have to memorize its range - each parameter uses an + * own range axis. + * + * @param ranges Map where ranges of each axis will be stored in. + * @param value A given value on an axis. + * @param parameter Parameter name which belongs to <code>value</code>. + */ protected void storeMaxRange(Map ranges, double value, String parameter) { Range range = null;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,516 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.chart; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import org.jfree.data.general.DatasetChangeEvent; +import org.jfree.data.xy.AbstractIntervalXYDataset; +import org.jfree.data.xy.IntervalXYDataset; + +import org.jfree.data.statistics.HistogramType; +import org.jfree.data.statistics.HistogramBin; + +import org.jfree.util.ObjectUtilities; +import org.jfree.util.PublicCloneable; + +/** + * This class extends the functionality of the internal JFreeChart class + * <code>HistogramDataset</code>. <code>AdvancedHistogramDataset</code> takes + * the number of bins OR a bin width. It is mainly a copy of this class. The + * reason why there is no inheritance from JFreeChart's internal class is, + * that basic attributes have private access there. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class AdvancedHistogramDataset +extends AbstractIntervalXYDataset +implements IntervalXYDataset, Cloneable, PublicCloneable, Serializable +{ + /** A list of maps. */ + protected List list; + + /** The histogram type. */ + protected HistogramType type; + + /** The width of a single bin. */ + protected double binWidth = -1; + + /** The number of bins. */ + protected int bins = -1; + + /** The logger */ + private static Logger logger = + Logger.getLogger(AdvancedHistogramDataset.class); + + + /** + * Creates a new (empty) dataset with a default type of + * {@link HistogramType}.FREQUENCY. + */ + public AdvancedHistogramDataset() { + this.list = new ArrayList(); + this.type = HistogramType.FREQUENCY; + } + + /** + * Creates a new (empty) dataset with a default type of + * {@link HistogramType}.FREQUENCY. + */ + public AdvancedHistogramDataset(int bins, double binWidth) { + this.list = new ArrayList(); + this.type = HistogramType.FREQUENCY; + this.bins = bins; + this.binWidth = binWidth; + } + + /** + * Returns the histogram type. + * + * @return The type (never <code>null</code>). + */ + public HistogramType getType() { + return this.type; + } + + /** + * Sets the histogram type and sends a {@link DatasetChangeEvent} to all + * registered listeners. + * + * @param type the type (<code>null</code> not permitted). + */ + public void setType(HistogramType type) { + if (type == null) { + throw new IllegalArgumentException("Null 'type' argument"); + } + this.type = type; + notifyListeners(new DatasetChangeEvent(this, this)); + } + + /** + * Adds a series to the dataset, using the specified number of bins. + * + * @param key the series key (<code>null</code> not permitted). + * @param values the values (<code>null</code> not permitted). + */ + public void addSeries(Comparable key, double[] values) { + double minimum = getMinimum(values); + double maximum = getMaximum(values); + addSeries(key, values, minimum, maximum); + } + + /** + * Adds a series to the dataset. Any data value less than minimum will be + * assigned to the first bin, and any data value greater than maximum will + * be assigned to the last bin. Values falling on the boundary of + * adjacent bins will be assigned to the higher indexed bin. + * + * @param key the series key (<code>null</code> not permitted). + * @param values the raw observations. + * @param bins the number of bins (must be at least 1). + * @param minimum the lower bound of the bin range. + * @param maximum the upper bound of the bin range. + */ + public void addSeries(Comparable key, + double[] values, + double minimum, + double maximum) { + + if (key == null) { + throw new IllegalArgumentException("Null 'key' argument."); + } + if (values == null) { + throw new IllegalArgumentException("Null 'values' argument."); + } + if (bins <= 0 && binWidth <= 0) { + throw new IllegalArgumentException( + "We need at least a bin width or the number of bins."); + } + + // There is a binWidth given to calculate the number of bins in this + // case + if (bins <= 0) { + double tmp = (maximum - minimum) / binWidth; + bins = (int) tmp; + bins = tmp % 1 > 0 ? bins + 1 : bins; + + double overlap = minimum + bins * binWidth - maximum; + tmp = minimum; + minimum -= overlap / 2; + + logger.debug("There is an overlap of " + overlap); + logger.info("The lower bound is moved left from " + + tmp + " to " + minimum); + + tmp = maximum; + maximum += overlap / 2; + logger.info("The upper bound is moved right from " + + tmp + " to " + maximum); + } + + if (bins <= 0) { + bins = 1; + } + + // in this case, there is a number of bins given, so we need to + // calculate the width of a single bin + if (binWidth <= 0) + binWidth = (maximum - minimum) / bins; + + logger.info("bin width: " + binWidth); + logger.info("number of bins: " + bins); + + double lower = minimum; + double upper; + List binList = new ArrayList(bins); + for (int i = 0; i < bins; i++) { + HistogramBin bin; + // make sure bins[bins.length]'s upper boundary ends at maximum + // to avoid the rounding issue. the bins[0] lower boundary is + // guaranteed start from min + if (i == bins - 1) { + bin = new HistogramBin(lower, maximum); + } + else { + upper = minimum + (i + 1) * binWidth; + bin = new HistogramBin(lower, upper); + lower = upper; + } + binList.add(bin); + } + // fill the bins + for (int i = 0; i < values.length; i++) { + int binIndex = bins - 1; + if (values[i] < maximum) { + double fraction = (values[i] - minimum) / (maximum - minimum); + if (fraction < 0.0) { + fraction = 0.0; + } + binIndex = (int) (fraction * bins); + // rounding could result in binIndex being equal to bins + // which will cause an IndexOutOfBoundsException - see bug + // report 1553088 + if (binIndex >= bins) { + binIndex = bins - 1; + } + } + HistogramBin bin = (HistogramBin) binList.get(binIndex); + bin.incrementCount(); + } + // generic map for each series + Map map = new HashMap(); + map.put("key", key); + map.put("bins", binList); + map.put("values.length", new Integer(values.length)); + map.put("bin width", new Double(binWidth)); + this.list.add(map); + } + + /** + * Returns the minimum value in an array of values. + * + * @param values the values (<code>null</code> not permitted and + * zero-length array not permitted). + * + * @return The minimum value. + */ + private double getMinimum(double[] values) { + if (values == null || values.length < 1) { + throw new IllegalArgumentException( + "Null or zero length 'values' argument."); + } + double min = Double.MAX_VALUE; + for (int i = 0; i < values.length; i++) { + if (values[i] < min) { + min = values[i]; + } + } + return min; + } + + /** + * Returns the maximum value in an array of values. + * + * @param values the values (<code>null</code> not permitted and + * zero-length array not permitted). + * + * @return The maximum value. + */ + private double getMaximum(double[] values) { + if (values == null || values.length < 1) { + throw new IllegalArgumentException( + "Null or zero length 'values' argument."); + } + double max = -Double.MAX_VALUE; + for (int i = 0; i < values.length; i++) { + if (values[i] > max) { + max = values[i]; + } + } + return max; + } + + /** + * Returns the bins for a series. + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * + * @return A list of bins. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + List getBins(int series) { + Map map = (Map) this.list.get(series); + return (List) map.get("bins"); + } + + /** + * Returns the total number of observations for a series. + * + * @param series the series index. + * + * @return The total. + */ + private int getTotal(int series) { + Map map = (Map) this.list.get(series); + return ((Integer) map.get("values.length")).intValue(); + } + + /** + * Returns the bin width for a series. + * + * @param series the series index (zero based). + * + * @return The bin width. + */ + private double getBinWidth(int series) { + if (binWidth > 0) + return binWidth; + + Map map = (Map) this.list.get(series); + return ((Double) map.get("bin width")).doubleValue(); + } + + /** + * Returns the number of series in the dataset. + * + * @return The series count. + */ + public int getSeriesCount() { + return this.list.size(); + } + + /** + * Returns the key for a series. + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * + * @return The series key. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Comparable getSeriesKey(int series) { + Map map = (Map) this.list.get(series); + return (Comparable) map.get("key"); + } + + /** + * Returns the number of data items for a series. + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * + * @return The item count. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public int getItemCount(int series) { + return getBins(series).size(); + } + + /** + * Returns the X value for a bin. This value won't be used for plotting + * histograms, since the renderer will ignore it. But other renderers can + * use it (for example, you could use the dataset to create a line + * chart). + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * @param item the item index (zero based). + * + * @return The start value. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Number getX(int series, int item) { + List bins = getBins(series); + HistogramBin bin = (HistogramBin) bins.get(item); + double x = (bin.getStartBoundary() + bin.getEndBoundary()) / 2.; + return new Double(x); + } + + /** + * Returns the y-value for a bin (calculated to take into account the + * histogram type). + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * @param item the item index (zero based). + * + * @return The y-value. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Number getY(int series, int item) { + List bins = getBins(series); + HistogramBin bin = (HistogramBin) bins.get(item); + double total = getTotal(series); + double binWidth = getBinWidth(series); + + if (this.type == HistogramType.FREQUENCY) { + return new Double(bin.getCount()); + } + else if (this.type == HistogramType.RELATIVE_FREQUENCY) { + return new Double(bin.getCount() / total); + } + else if (this.type == HistogramType.SCALE_AREA_TO_1) { + return new Double(bin.getCount() / (binWidth * total)); + } + else { // pretty sure this shouldn't ever happen + throw new IllegalStateException(); + } + } + + /** + * Returns the start value for a bin. + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * @param item the item index (zero based). + * + * @return The start value. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Number getStartX(int series, int item) { + List bins = getBins(series); + HistogramBin bin = (HistogramBin) bins.get(item); + return new Double(bin.getStartBoundary()); + } + + /** + * Returns the end value for a bin. + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * @param item the item index (zero based). + * + * @return The end value. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Number getEndX(int series, int item) { + List bins = getBins(series); + HistogramBin bin = (HistogramBin) bins.get(item); + return new Double(bin.getEndBoundary()); + } + + /** + * Returns the start y-value for a bin (which is the same as the y-value, + * this method exists only to support the general form of the + * {@link IntervalXYDataset} interface). + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * @param item the item index (zero based). + * + * @return The y-value. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Number getStartY(int series, int item) { + return getY(series, item); + } + + /** + * Returns the end y-value for a bin (which is the same as the y-value, + * this method exists only to support the general form of the + * {@link IntervalXYDataset} interface). + * + * @param series the series index (in the range <code>0</code> to + * <code>getSeriesCount() - 1</code>). + * @param item the item index (zero based). + * + * @return The Y value. + * + * @throws IndexOutOfBoundsException if <code>series</code> is outside the + * specified range. + */ + public Number getEndY(int series, int item) { + return getY(series, item); + } + + /** + * Tests this dataset for equality with an arbitrary object. + * + * @param obj the object to test against (<code>null</code> permitted). + * + * @return A boolean. + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof AdvancedHistogramDataset)) { + return false; + } + AdvancedHistogramDataset that = (AdvancedHistogramDataset) obj; + if (!ObjectUtilities.equal(this.type, that.type)) { + return false; + } + if (!ObjectUtilities.equal(this.list, that.list)) { + return false; + } + return true; + } + + /** + * Returns a clone of the dataset. + * + * @return A clone of the dataset. + * + * @throws CloneNotSupportedException if the object cannot be cloned. + */ + public Object clone() throws CloneNotSupportedException { + AdvancedHistogramDataset clone = (AdvancedHistogramDataset) super.clone(); + int seriesCount = getSeriesCount(); + clone.list = new java.util.ArrayList(seriesCount); + for (int i = 0; i < seriesCount; i++) { + clone.list.add(new HashMap((Map) this.list.get(i))); + } + return clone; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Chart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Chart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,15 +1,32 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; +import java.io.Serializable; + import org.jfree.chart.JFreeChart; -import java.io.Serializable; - - /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * The <code>Chart</code> interface should be implemented by each type of chart. + * The class must implement a method <code>generateChart</code> which returns a + * JFreeChart object. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public interface Chart extends Serializable { + /** + * This method is used to create a JFreeChart of this object. + * + * @return JFreeChart object. + */ public JFreeChart generateChart(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartLabels.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartLabels.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,113 +1,148 @@ -/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) - * All rights reserved - * - * $Id: ChartLabels.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $ - * - * created by: drewnak - * created at : 10.12.2007 - * created at : 11:48:39 - * - * modified by: $Author: drewnak $ - * modified at: $Date: 2007/12/10 13:57:13 $ - */ -package de.intevation.gnv.chart; - -/** - * @author drewnak - * @author Tim Englich <tim.englich@intevation.de> Changes and codecleanup - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> - */ -public class ChartLabels { - /** - * - */ - private String title; - - /** - * - */ - private String subtitle; - - /** - * - */ - private String domainAxisLabel; - - /** - * - */ - private String rangeAxisLabel; - - /** - * - */ - private String parameterName; - - - /** - * Constructor - * - * @param title - * @param domainAxisLabel - */ - public ChartLabels(String title, String subtitle, String domainAxisLabel) { - this(title, subtitle, domainAxisLabel, null); - } - - public ChartLabels( - String title, - String subtitle, - String domainAxisLabel, - String rangeAxisLabel - ) { - this(title, subtitle, domainAxisLabel, rangeAxisLabel, null); - } - - - public ChartLabels( - String title, - String subtitle, - String domainAxisLabel, - String rangeAxisLabel, - String parameterName - ) { - this.title = title; - this.subtitle = subtitle; - this.domainAxisLabel = domainAxisLabel; - this.rangeAxisLabel = rangeAxisLabel; - this.parameterName = parameterName; - } - - /** - * @return the title - */ - public String getTitle() { - return this.title; - } - - - /** - * @return the subtitle - */ - public String getSubtitle() { - return subtitle; - } - - /** - * @return the timeAxisLabel - */ - public String getDomainAxisLabel() { - return this.domainAxisLabel; - } - - - public String getRangeAxisLabel() { - return this.rangeAxisLabel; - } - - - public String getParameterName() { - return this.parameterName; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) + * All rights reserved + * + * $Id: ChartLabels.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $ + * + * created by: drewnak + * created at : 10.12.2007 + * created at : 11:48:39 + * + * modified by: $Author: drewnak $ + * modified at: $Date: 2007/12/10 13:57:13 $ + */ +package de.intevation.gnv.chart; + +/** + * This class stores some strings used for decorating charts (e.g. title, + * subtitle, etc). + * + * @author drewnak + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> Changes and codecleanup + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ChartLabels { + /** + * + */ + private String title; + + /** + * + */ + private String subtitle; + + /** + * + */ + private String domainAxisLabel; + + /** + * + */ + private String rangeAxisLabel; + + /** + * + */ + private String parameterName; + + + /** + * Constructor + * + * @param title Title + * @param subtitle Subtitle + * @param domainAxisLabel X-axis label + */ + public ChartLabels(String title, String subtitle, String domainAxisLabel) { + this(title, subtitle, domainAxisLabel, null); + } + + /** + * Constructor + * + * @param title Title + * @param subtitle Subtitle + * @param domainAxisLabel X-axis label + * @param rangeAxisLabel Y-axis label + */ + public ChartLabels( + String title, + String subtitle, + String domainAxisLabel, + String rangeAxisLabel + ) { + this(title, subtitle, domainAxisLabel, rangeAxisLabel, null); + } + + + /** + * Constructor + * + * @param title Title + * @param subtitle Subtitle + * @param domainAxisLabel X-axis label + * @param rangeAxisLabel Y-axis label + * @param parameterName Name of a given parameter in the chart. + */ + public ChartLabels( + String title, + String subtitle, + String domainAxisLabel, + String rangeAxisLabel, + String parameterName + ) { + this.title = title; + this.subtitle = subtitle; + this.domainAxisLabel = domainAxisLabel; + this.rangeAxisLabel = rangeAxisLabel; + this.parameterName = parameterName; + } + + /** + * @return the title + */ + public String getTitle() { + return this.title; + } + + + /** + * @return the subtitle + */ + public String getSubtitle() { + return subtitle; + } + + /** + * @return the timeAxisLabel + */ + public String getDomainAxisLabel() { + return this.domainAxisLabel; + } + + + /** + * @return the y-axis label + */ + public String getRangeAxisLabel() { + return this.rangeAxisLabel; + } + + + /** + * @return the parameter name + */ + public String getParameterName() { + return this.parameterName; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartStyle.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) - * All rights reserved - * - * $Id: ChartStyle.java,v 1.2 2007/12/21 12:31:15 blume Exp $ - * - * created by: drewnak - * created at : 10.12.2007 - * created at : 13:07:44 - * - * modified by: $Author: blume $ - * modified at: $Date: 2007/12/21 12:31:15 $ - */ -package de.intevation.gnv.chart; - -import java.awt.Color; -import java.awt.Dimension; - -/** - * @author drewnak - */ -public class ChartStyle { - - private Color mCanvasColor; - private Color mPlotBackgroundColor; - private Color mDomainGridlineColor; - private Color mRangeGridlineColor; - private boolean mDomainCrosshairVisible; - private boolean mRangeCrosshairVisible; - private Insets mAxisOffset; - private boolean mOverrideDefaultChartWidth = false; - private Dimension mChartSize; - - private boolean mUseUpperDataLevel = false; - private boolean mUseLowerDataLevel = false; - private int mUpperLevel; - private int mLowerLevel; - - /** - * @param pCanvasColor - * @param pPlotBackgroundColor - * @param pDomainGridlineColor - * @param pRangeGridlineColor - * @param pDomainCrosshairVisible - * @param pRangeCrosshairVisible - * @param pAxisOffset - */ - public ChartStyle(Color pCanvasColor, Color pPlotBackgroundColor, - Color pDomainGridlineColor, Color pRangeGridlineColor, - boolean pDomainCrosshairVisible, - boolean pRangeCrosshairVisible, Insets pAxisOffset, - Dimension pChartSize) { - super(); - mCanvasColor = pCanvasColor; - mPlotBackgroundColor = pPlotBackgroundColor; - mDomainGridlineColor = pDomainGridlineColor; - mRangeGridlineColor = pRangeGridlineColor; - mDomainCrosshairVisible = pDomainCrosshairVisible; - mRangeCrosshairVisible = pRangeCrosshairVisible; - mAxisOffset = pAxisOffset; - mChartSize = pChartSize; - } - - public Color getCanvasColor() { - return mCanvasColor; - } - - public void setCanvasColor(Color pCanvasColor) { - mCanvasColor = pCanvasColor; - } - - public Color getDomainGridlineColor() { - return mDomainGridlineColor; - } - - public void setDomainGridlineColor(Color pDomainGridlineColor) { - mDomainGridlineColor = pDomainGridlineColor; - } - - public Color getRangeGridlineColor() { - return mRangeGridlineColor; - } - - public void setRangeGridlineColor(Color pRangeGridlineColor) { - mRangeGridlineColor = pRangeGridlineColor; - } - - public boolean isDomainCrosshairVisible() { - return mDomainCrosshairVisible; - } - - public void setDomainCrosshairVisible(boolean pDomainCrosshairVisible) { - mDomainCrosshairVisible = pDomainCrosshairVisible; - } - - public boolean isRangeCrosshairVisible() { - return mRangeCrosshairVisible; - } - - public void setRangeCrosshairVisible(boolean pRangeCrosshairVisible) { - mRangeCrosshairVisible = pRangeCrosshairVisible; - } - - public Insets getAxisOffset() { - return mAxisOffset; - } - - public void setAxisOffset(Insets pAxisOffset) { - mAxisOffset = pAxisOffset; - } - - public Color getPlotBackgroundColor() { - return mPlotBackgroundColor; - } - - public void setPlotBackgroundColor(Color pPlotBackgroundColor) { - mPlotBackgroundColor = pPlotBackgroundColor; - } - - public Dimension getChartSize() { - return mChartSize; - } - - public void setChartSize(Dimension pChartSize) { - mChartSize = pChartSize; - } - - public boolean isOverrideDefaultChartWidth() { - return mOverrideDefaultChartWidth; - } - - public void setOverrideDefaultChartWidth(boolean pOverrideDefaultChartWidth) { - mOverrideDefaultChartWidth = pOverrideDefaultChartWidth; - } - - public void setNewChartWidth(int pNewChartWidth) { - mChartSize.setSize(pNewChartWidth, mChartSize.getHeight()); - } - - public boolean isUseUpperDataLevel() { - return mUseUpperDataLevel; - } - - public void setUseUpperDataLevel(boolean pUseUpperDataLevel) { - mUseUpperDataLevel = pUseUpperDataLevel; - } - - public boolean isUseLowerDataLevel() { - return mUseLowerDataLevel; - } - - public void setUseLowerDataLevel(boolean pUseLowerDataLevel) { - mUseLowerDataLevel = pUseLowerDataLevel; - } - - public int getUpperLevel() { - return mUpperLevel; - } - - public void setUpperLevel(int pUpperLevel) { - mUpperLevel = pUpperLevel; - } - - public int getLowerLevel() { - return mLowerLevel; - } - - public void setLowerLevel(int pLowerLevel) { - mLowerLevel = pLowerLevel; - } -}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/DefaultHistogram.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/DefaultHistogram.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,13 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; -import java.text.NumberFormat; -import java.text.ParseException; import java.util.Locale; import java.util.Map; @@ -11,52 +17,111 @@ import org.jfree.chart.plot.XYPlot; -import org.jfree.data.statistics.HistogramDataset; - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * Default implementation of {@link de.intevation.gnv.chart.AbstractHistogram}. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultHistogram extends AbstractHistogram { - // TODO take a better default value + /** + * Default bin count. + * TODO find a better default value + */ public static final int DEFAULT_BINS = 15; + + /** + * Constant field for limitating the number of bin in a single histogram. + */ public static final int MAXIMAL_BINS = 20; + + /** + * Default key to retrieve the number of bins from {@link + * #requestParameter}. + */ public static final String REQUEST_KEY_BIN_COUNT = "bincount"; + + /** + * Default key to retrieve the width of a single bin from {@link + * #requestParameter}. + */ public static final String REQUEST_KEY_BIN_WIDTH = "binwidth"; + + /** + * Default key to retrieve the chart width from {@link #requestParameter}. + */ public static final String REQUEST_KEY_CHART_WIDTH = "width"; - public static final String REQUEST_KEY_LOCALE = "locale"; + + /** + * Default key to retrieve the object from {@link #requestParameter}. It + * defines which value this chart has to be used for bin calculation. You + * can either adjust the number of bins or the width of a single bin. + */ public static final String REQUEST_KEY_BIN_CHOICE = "bintype"; + /** + * Logger used for logging with log4j. + */ private static Logger logger = Logger.getLogger(DefaultHistogram.class); + /** + * Object storing some further parameter used for chart settings. + */ protected Map requestParameter; + protected double[] minmax = null; + + /** + * Constructor to create DefaultHistogram objects. + * + * @param labels Labels to decorate this chart. + * @param data Raw data to be displayed in histogram. + * @param theme Theme used to adjust the chart look. + * @param requestParameter Object which serves some further settings. + */ public DefaultHistogram( ChartLabels labels, Object[] data, ChartTheme theme, Map requestParameter ) { super(labels, data, theme); this.requestParameter = requestParameter; + this.locale = (Locale) requestParameter.get("locale"); } + @Override protected void applyDatasets() { XYPlot plot = (XYPlot) chart.getPlot(); // prepare data and create add them to histogram dataset String name = (String) data[0]; double[] values = toDouble((Double[]) data[1]); - int bins = getBinCount(values); - HistogramDataset dataset = new HistogramDataset(); - dataset.addSeries(name, values, bins); + double binWidth = getBinWidth(values); + int binCount = getBinCount(); + + AdvancedHistogramDataset dataset = + new AdvancedHistogramDataset(binCount, binWidth); + dataset.addSeries(name, values); plot.setDataset(0, dataset); } + /** + * Method which scans the hole bunch of values and returns an array with + * contains min and max value. Min value is stored at position 0, max value + * is stored at position 1 in that array. + * + * @param values Array which contains all values + * + * @return Array which contains min and max value + */ protected double[] getMinMax(double[] values) { + if (minmax != null) + return minmax; + double[] minmax = new double[2]; minmax[0] = Double.MAX_VALUE; minmax[1] = Double.MIN_VALUE; @@ -67,10 +132,19 @@ minmax[1] = values[i] > minmax[1] ? values[i] : minmax[1]; } + this.minmax = minmax; + return minmax; } + /** + * Turn a Double[] into a double[]. + * + * @param array Doube[] + * + * @return double[] + */ protected double[] toDouble(Double[] array) { int length = array.length; double[] values = new double[length]; @@ -83,19 +157,22 @@ } - protected int getBinCount(double[] values) { - String param = (String) requestParameter.get(REQUEST_KEY_BIN_CHOICE); - - if (param != null && param.equalsIgnoreCase(REQUEST_KEY_BIN_WIDTH)) { - return getBinCountByWidth(values); + /** + * Method to retrieve the number of bins. + * + * @return the number of bins that is specified in <i>requestParameter</i> + * or -1 if the number of bins is not the dominant value to calculate the + * width of a single bin. + */ + protected int getBinCount() { + // Return -1 to trigger a calculation of the number of bins in + // AdvancedHistogramDataset if the user chose the bin width as dominant + // value. + String choice = (String) requestParameter.get(REQUEST_KEY_BIN_CHOICE); + if (choice != null && choice.equalsIgnoreCase(REQUEST_KEY_BIN_WIDTH)) { + return -1; } - else { - return getBinCountByNumber(); - } - } - - protected int getBinCountByNumber() { int bins = -1; String param = (String) requestParameter.get(REQUEST_KEY_BIN_COUNT); @@ -115,54 +192,43 @@ } - protected int getBinCountByWidth(double[] values) { - int bins = -1; - String param = (String) requestParameter.get(REQUEST_KEY_BIN_WIDTH); - Locale locale = (Locale) requestParameter.get(REQUEST_KEY_LOCALE); - NumberFormat format = NumberFormat.getInstance(locale); - - try { - double[] minmax = getMinMax(values); - double totalWidth = minmax[1] - minmax[0]; - Number number = format.parse(param); - double binWidth = -1d; + /** + * Serves width of a single bin. + * + * @param values All values in this histogram + * + * @return The bin width that is given in <i>requestParameter</i> or -1 if + * the bin width is not the dominant value for calculating the number of + * bins in the histogram. + */ + protected double getBinWidth(double[] values) { + // Return -1 to trigger a calculation of the bin width in + // AdvancedHistogramDataset if the user chose the number of bins as + // dominant value. + String choice = (String) requestParameter.get(REQUEST_KEY_BIN_CHOICE); + if (choice == null || !choice.equalsIgnoreCase(REQUEST_KEY_BIN_WIDTH)) { + return -1; + } - if (number instanceof Double) { - binWidth = ((Double) number).doubleValue(); - } - else if (number instanceof Long) { - binWidth = ((Long) number).doubleValue(); - } - else if (number instanceof Integer) { - binWidth = ((Integer) number).doubleValue(); - } - else { - logger.warn("Invalid bin width for histogram chart: " + param); - logger.warn("Return default bins: " + DEFAULT_BINS); - - return DEFAULT_BINS; - } - - double tmpBins = totalWidth / binWidth; + int bins = -1; + String param = (String) requestParameter.get(REQUEST_KEY_BIN_WIDTH); - bins = (int) Math.round(tmpBins); - bins = bins <= 0 ? DEFAULT_BINS : bins; - bins = bins > MAXIMAL_BINS ? MAXIMAL_BINS : bins; + double[] minmax = getMinMax(values); + double totalWidth = minmax[1] - minmax[0]; + double binWidth = Double.parseDouble(param); - return bins; + double tmpBins = totalWidth / binWidth; + + bins = (int) Math.round(tmpBins); + bins = bins <= 0 ? DEFAULT_BINS : bins; + + // the calculated number of bins with the given width exceed the maximum + // number of bins. + if (bins > MAXIMAL_BINS) { + return totalWidth / (MAXIMAL_BINS); } - catch (ParseException pe) { - logger.warn("Invalid bin width for histogram chart: " + param); - logger.warn("Return default bins: " + DEFAULT_BINS); - return DEFAULT_BINS; - } - catch (NumberFormatException nfe) { - logger.warn("Invalid bin width for histogram chart: " + param); - logger.warn("Return default bins: " + DEFAULT_BINS); - - return DEFAULT_BINS; - } + return binWidth; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,53 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; +import de.intevation.gnv.geobackend.base.Result; + import java.util.Collection; import java.util.Locale; -import de.intevation.gnv.chart.ChartLabels; -import de.intevation.gnv.geobackend.base.Result; - import org.apache.log4j.Logger; import org.jfree.chart.ChartTheme; + import org.jfree.data.general.Series; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * Implementation to create a special type of horizontal profile charts. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HorizontalCrossProfileChart extends HorizontalProfileChart { + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(HorizontalCrossProfileChart.class); + /** + * Constructor to create HorizontalCrossProfileChart objects. + * + * @param labels Labels used to be displayed in title, subtitle and so on. + * @param theme ChartTheme used to adjust the rendering of this chart. + * @param parameters Collection containing a bunch of parameters. + * @param measurements Collection containing a bunch of measurements. + * @param dates Collection containing a bunch of date objects. + * @param result Collection containing a bunch of <code>Result</code> + * objects which contain the actual data items to be displayed. + * @param timeGaps Collection with timegap definitions. + * @param locale Locale used to specify the format of labels, numbers, ... + * @param linesVisible Render lines between data points if true, otherwise + * not. + * @param shapesVisible Render vertices as points if true, otherwise not. + */ public HorizontalCrossProfileChart( ChartLabels labels, ChartTheme theme, @@ -46,6 +75,13 @@ } + /** + * Method for gap detection. Nothing is done here, because in this type of + * chart no gap detection takes place. + * + * @see de.intevation.gnv.chart.HorizontalProfileChart#gapDetection(Result[], + * Series, int, int) + */ @Override protected void gapDetection( Result[] results,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,35 +1,86 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; +import com.vividsolutions.jts.geom.Point; + +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKTReader; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.utils.DistanceCalculator; + import java.util.Collection; import java.util.Locale; import java.util.Map; -import com.vividsolutions.jts.geom.Point; -import com.vividsolutions.jts.io.WKTReader; -import com.vividsolutions.jts.io.ParseException; - import org.apache.log4j.Logger; import org.jfree.chart.ChartTheme; + +import org.jfree.chart.axis.Axis; +import org.jfree.chart.axis.AxisLocation; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.NumberTickUnit; + import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; + +import org.jfree.data.Range; + import org.jfree.data.general.Series; + import org.jfree.data.xy.XYSeries; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.utils.DistanceCalculator; - - /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This class is used to create xy-charts of horizontal profiles. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HorizontalProfileChart extends VerticalProfileChart { + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(HorizontalProfileChart.class); + /** + * <code>WKTReader</code> used to turn wkt strings into geometries. + */ private static WKTReader wktReader = new WKTReader(); - private Point firstPoint; + /** + * The first point in a HorizontalProfileChart. It is used to calculate the + * distance between the currently processed point an the start. + */ + protected Point lastPoint; + + protected double distance = 0d; + + /** + * Constructor used to create horizontal profile charts. + * + * @param labels Labels used to be displayed in title, subtitle and so on. + * @param theme ChartTheme used to adjust the rendering of this chart. + * @param parameters Collection containing a bunch of parameters. + * @param measurements Collection containing a bunch of measurements. + * @param dates Collection containing a bunch of date objects. + * @param result Collection containing a bunch of <code>Result</code> + * objects which contain the actual data items to be displayed. + * @param timeGaps Collection with timegap definitions. + * @param locale Locale used to specify the format of labels, numbers, ... + * @param linesVisible Render lines between data points if true, otherwise + * not. + * @param shapesVisible Render vertices as points if true, otherwise not. + */ public HorizontalProfileChart( ChartLabels labels, ChartTheme theme, @@ -70,6 +121,7 @@ } + @Override protected void gapDetection( Result[] results, Series series, @@ -103,24 +155,22 @@ } + @Override protected void addValue(Result row, Series series) { - double distance = 0; - try { Point point = (Point) wktReader.read(row.getString("SHAPE")); - if (firstPoint != null) { - distance = DistanceCalculator.calculateDistance( - firstPoint, point + if (lastPoint != null) { + distance += DistanceCalculator.calculateDistance( + lastPoint, point ); } - else { - firstPoint = point; - } ((XYSeries) series).add( distance, row.getDouble("YORDINATE") ); + + lastPoint = point; } catch(ParseException pe) { log.warn("No data found while parsing."); @@ -128,11 +178,66 @@ } + @Override protected void addSeries(Series series, String label, int idx) { super.addSeries(series, label, idx); - // reset firstPoint for next series - firstPoint = null; + // reset lastPoint and distance of the last series + lastPoint = null; + distance = 0; + } + + + @Override + protected void prepareAxis(String seriesKey,int idx) { + log.debug("prepare axis of xychart"); + + XYPlot plot = chart.getXYPlot(); + Axis xAxis = plot.getDomainAxis(); + NumberAxis yAxis = new NumberAxis(seriesKey); + + localizeDomainAxis(xAxis, locale); + localizeRangeAxis(yAxis, locale); + + // litte workarround to adjust the max range of axes. + // NumberAxis.setAutoRange(true) doesn't seem to work properly. + Range yRange = (Range) ranges.get(seriesKey); + double lo = yRange.getLowerBound(); + double hi = yRange.getUpperBound(); + + // XXX Special case: only a single value in this chart. + // JFreeChart doesn't expand this range, because its length is 0. + if (lo == hi) { + yRange = new Range( + lo - (lo / 100 * LOWER_MARGIN), + hi + (hi / 100 * UPPER_MARGIN)); + } + else { + yRange = Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN); + } + + yAxis.setRange(yRange); + log.debug("Max Range of dataset is: " + yRange.toString()); + + if (seriesKey.contains("richtung")) { + yAxis.setTickUnit(new NumberTickUnit(30.0)); + yAxis.setUpperBound(360.0); + yAxis.setLowerBound(0.0); + } + else { + yAxis.setFixedDimension(10.0); + yAxis.setAutoRangeIncludesZero(false); + } + + plot.setRangeAxis(idx, yAxis); + yAxis.configure(); + + if (idx % 2 != 0) + plot.setRangeAxisLocation(idx, AxisLocation.BOTTOM_OR_RIGHT); + else + plot.setRangeAxisLocation(idx, AxisLocation.BOTTOM_OR_LEFT); + + plot.mapDatasetToRangeAxis(idx, idx); } @@ -150,6 +255,7 @@ } + @Override protected String createSeriesName( String breakPoint1, String breakPoint2, @@ -165,6 +271,7 @@ } + @Override protected void addGapsOnGrid( Result[] results, Series series, @@ -181,26 +288,19 @@ Point lastPoint = null; Point currentPoint = null; - try { - firstPoint = getPoint(results[0]); - } - catch (ParseException pe) { - log.error("Unable to parse start point for gap detection."); - return; - } - + double distance = 0; + double distanceOld = 0; for (int i = startPos+1; i < endPos; i++) { try { last = results[i-1].getInteger(axis); lastPoint = getPoint(results[i-1]); current = results[i].getInteger(axis); currentPoint = getPoint(results[i]); - double distance = DistanceCalculator.calculateDistance( - firstPoint, + + distanceOld = distance; + distance += DistanceCalculator.calculateDistance( + lastPoint, currentPoint); - double distanceOld = DistanceCalculator.calculateDistance( - firstPoint, - lastPoint); boolean detected = gridDetection(last, current); @@ -226,6 +326,17 @@ } + /** + * Method to add gaps between two data points. The real detection is done by + * {@link #simpleDetection} and {@link #specialDetection}. + * + * @param results All data points in this dataset. + * @param series Series to be processed. + * @param startValue <code>Point</code> where the scan for gaps should begin. + * @param endValue <code>Point</code> where the scan should end. + * @param startPos Start position of this series in <code>results</code>. + * @param endPos End position of a series in <code>results</code> + */ protected void addGaps( Result[] results, Series series, @@ -276,6 +387,21 @@ } + /** + * Simple method to detect gaps. A gap is detected if the delta between two + * data points (current, last) is bigger than <code>PERCENTAGE</code> percent + * of delta of start and end. + * <br> + * (smallDelta > delta / 100 * PERCENTAGE) + * + * @param start First data point in a series + * @param end Last data point in a series + * @param last Left point + * @param current Right point + * + * @return true, if a gap is detected between last and current - otherwise + * false. + */ protected boolean simpleDetection( Point start, Point end, @@ -289,6 +415,22 @@ } + /** + * Method to detect gaps between two data points. Following formula is used + * for detection:<br> + * smallDelta > (3.0 / (count - 1) * delta)<br> + * smallDelta = distance between <code>current</code> and <code>last</code> + * <br> + * delta = distance between <code>start</code> and <code>end</code> + * + * @param start First data point in a series + * @param end Last data point in a series + * @param last Left point + * @param current Right point + * @param count Number of datapoints + * @return true, if a gap is detected between last and current - otherwise + * false. + */ protected boolean specialDetection( Point start, Point end, @@ -306,6 +448,7 @@ return (smallDelta > (3.0 / (count - 1) * delta)); } + @Override protected String getDependendAxisName(Result first, Result second) { if (first.getInteger("IPOSITION") == second.getInteger("IPOSITION")) @@ -314,6 +457,15 @@ return "IPOSITION"; } + /** + * This method returns a point from a given wkt string stored in + * <code>result</code>. + * + * @param result <code>Result</code> object which contains the wkt string. + * The wkt string needs to be available under the key SHAPE. + * + * @return Point representation of wkt string. + */ private Point getPoint(Result result) throws ParseException {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileVectorChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.chart; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Locale; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; + +import org.jfree.chart.plot.XYPlot; + +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; + +/** + * This class is used to create xy charts of vertical profiles. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class HorizontalProfileVectorChart +extends HorizontalProfileChart +{ + private static Logger logger = + Logger.getLogger(HorizontalProfileVectorChart.class); + + + public HorizontalProfileVectorChart( + ChartLabels labels, + ChartTheme theme, + Collection parameters, + Collection measurements, + Collection dates, + Collection result, + Collection timeGaps, + Locale locale, + boolean linesVisible, + boolean shapesVisible + ) { + super(labels, theme, parameters, measurements, dates, result, + timeGaps, locale, linesVisible, shapesVisible); + } + + + @Override + protected void initData() { + Iterator iter = resultSet.iterator(); + Result row = null; + String seriesName = null; + XYSeries series = null; + + int idx = 0; + int startPos = 0; + int endPos = 0; + + double startValue = 0; + double endValue = 0; + + ResultDescriptor rd = null; + int idxSeries = -1; + int idxX = -1; + int idxY = -1; + + Result[] results = + (Result[]) resultSet.toArray(new Result[resultSet.size()]); + + while (iter.hasNext()) { + row = (Result) iter.next(); + + if (rd == null) { + rd = row.getResultDescriptor(); + idxSeries = rd.getColumnIndex("SERIES"); + idxX = rd.getColumnIndex("XORDINATE"); + idxY = rd.getColumnIndex("YORDINATE"); + } + + if (!row.getString(idxSeries).equals(seriesName)) { + logger.debug("prepare data/plot for next dataset."); + + if (series != null) { + gapDetection(results, series, startPos, endPos); + addSeries(series, seriesName, idx); + + startPos = endPos + 1; + } + + seriesName = row.getString(idxSeries); + + logger.debug("next data is '" + seriesName + "'"); + series = new XYSeries(seriesName); + } + + addValue(row, series); + Object x = getValue(row); + Double y = row.getDouble(idxY); + if (x != null && y != null) { + storeMaxRange(ranges, y, seriesName); + storeMaxValue(values, x, seriesName); + } + + endPos++; + } + + if (results.length == 0) + return; + + gapDetection(results, series, startPos, endPos); + addSeries(series, seriesName, idx); + + addDatasets(); + } + + + @Override + protected void addDatasets() { + XYPlot plot = chart.getXYPlot(); + int idx = 0; + + XYSeriesCollection sc = null; + Iterator iter = datasets.keySet().iterator(); + + while (iter.hasNext()) { + String key = (String) iter.next(); + sc = (XYSeriesCollection)datasets.get(key); + plot.setDataset(idx, sc ); + logger.debug("Added " + key + " parameter to plot."); + prepareAxis(key, idx); + adjustRenderer( + idx++, + sc.getSeriesCount(), + linesVisible, + shapesVisible + ); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Insets.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) - * All rights reserved - * - * $Id: Insets.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $ - * - * created by: drewnak - * created at : 10.12.2007 - * created at : 13:31:12 - * - * modified by: $Author: drewnak $ - * modified at: $Date: 2007/12/10 13:57:13 $ - */ -package de.intevation.gnv.chart; - -public class Insets { - public double mUpper; - public double mLower; - public double mLeft; - public double mRight; - - /** - * @param pUpper - * @param pLower - * @param pLeft - * @param pRight - */ - public Insets(double pUpper, double pLeft, double pLower, double pRight) { - super(); - mUpper = pUpper; - mLower = pLower; - mLeft = pLeft; - mRight = pRight; - } -} \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; import de.intevation.gnv.artifacts.ressource.RessourceFactory; @@ -27,8 +35,8 @@ import org.jfree.chart.axis.DateAxis; import org.jfree.chart.axis.DateTickUnit; import org.jfree.chart.axis.DateTickUnitType; +import org.jfree.chart.axis.TickUnitSource; import org.jfree.chart.axis.TickUnits; -import org.jfree.chart.axis.TickUnitSource; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.PlotOrientation; @@ -41,22 +49,60 @@ import org.jfree.data.time.TimeSeriesCollection; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class is used to create timeseries charts. The domain axis contains + * multiple date/time objects. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class TimeSeriesChart extends AbstractXYLineChart { - private static final String DATE_FORMAT = "chart.timeseries.date.format"; - + /** + * Constant format which can be useful to format date items. Value is + * {@value}. + */ public static final String DEFAULT_DATE_FORMAT = "dd-MMM-yyyy"; + /** + * Constant field used if no gap detection should be done here. This field + * is used in @see #getTimeGapValue. Value is {@value}. + */ public static final long NO_TIME_GAP = Long.MAX_VALUE - 1000; - public static final int GAP_SIZE = 5; // in percent + /** + * Percentage used for gap detection. Its value is {@value}. + */ + public static int GAP_SIZE = 5; // in percent + + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(TimeSeriesChart.class); + static { + /* The percentage defining the width of a gap should be configured in + * conf.xml instead of being configured in a system property */ + GAP_SIZE = Integer.getInteger("chart.gap.percentage", GAP_SIZE); + } + + /** + * Constructor used to create <code>TimeSeries</code> charts. + * + * @param labels Labels used to be displayed in title, subtitle and so on. + * @param theme ChartTheme used to adjust the rendering of this chart. + * @param parameters Collection containing a bunch of parameters. + * @param measurements Collection containing a bunch of measurements. + * @param dates Collection containing a bunch of date objects. + * @param result Collection containing a bunch of <code>Result</code> + * objects which contain the actual data items to be displayed. + * @param timeGaps Collection with timegap definitions. + * @param locale Locale used to specify the format of labels, numbers, ... + * @param linesVisible Render lines between data points if true, otherwise + * not. + * @param shapesVisible Render vertices as points if true, otherwise not. + */ public TimeSeriesChart( ChartLabels labels, ChartTheme theme, @@ -85,6 +131,10 @@ } + /** + * see de.intevation.gnv.chart.AbstractXYLineChart#initChart() + */ + @Override protected void initChart() { chart = ChartFactory.createTimeSeriesChart( labels.getTitle(), @@ -102,6 +152,9 @@ } + /** + * @see de.intevation.gnv.chart.AbstractXYLineChart#initData() + */ protected void initData() { log.debug("init data for timeseries chart"); @@ -177,6 +230,9 @@ } + /** + * @see de.intevation.gnv.chart.AbstractXYLineChart#addValue(Result, Series) + */ protected void addValue(Result row, Series series) { ((TimeSeries) series).addOrUpdate( new Minute(row.getDate("XORDINATE")), @@ -185,6 +241,11 @@ } + /** + * @param parameter + * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series, + * String, int) + */ protected void addSeries(Series series, String parameter, int idx) { log.debug("add series (" + parameter + ")to timeseries chart"); @@ -205,6 +266,10 @@ } + /** + * Method to add processed datasets to plot. Each dataset is adjusted using + * <code>prepareAxis</code> and <code>adjustRenderer</code> methods. + */ protected void addDatasets() { Iterator iter = parameters.iterator(); XYPlot plot = chart.getXYPlot(); @@ -233,6 +298,11 @@ } + /** + * @param locale + * @see de.intevation.gnv.chart.AbstractXYLineChart#localizeDomainAxis(Axis, + * Locale) + */ protected void localizeDomainAxis(Axis axis, Locale locale) { ((ValueAxis)axis).setStandardTickUnits(createStandardDateTickUnits( TimeZone.getDefault(), @@ -240,11 +310,18 @@ } + /** + * @param zone + * @param locale + * @return TickUnitSource + * @see org.jfree.chart.axis.DateAxis#createStandardDateTickUnits(TimeZone, + * Locale) + */ public static TickUnitSource createStandardDateTickUnits( TimeZone zone, Locale locale) { - /* + /* * This method have been copied from JFreeChart's DateAxis class. * DateFormat objects are hard coded in DateAxis and cannot be adjusted. */ @@ -370,11 +447,24 @@ } + /** + * Method to get a message from resource bundle. + * + * @param locale Locale used to specify the resource bundle. + * @param key Key to specify the required message. + * @param def Default string if resource is not existing. + * + * @return Message + */ protected String getMessage(Locale locale, String key, String def) { return RessourceFactory.getInstance().getRessource(locale, key, def); } + /** + * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String, + * String, String) + */ protected String createSeriesName( String breakPoint1, String breakPoint2, @@ -388,6 +478,17 @@ } + /** + * Method to add gaps between two data points. The max valid space between + * two data points is calculated by <code>calculateGapSize</code>. + * + * @param results All data points in this dataset. + * @param series Series to be processed. + * @param startDate Date item where the scan for gaps should begin. + * @param endDate Date item where the scan should end. + * @param startPos Start position of this series in <code>results</code>. + * @param endPos End position of a series in <code>results</code> + */ protected void addGaps( Result[] results, Series series, @@ -435,6 +536,19 @@ } + /** + * Method to calculate the max space between two data points. + * + * @param start First date + * @param end Last date + * @param startPos Start position of the current series in the collection + * containing the bunch of series. + * @param endPos End position of the current series in the collection + * containing the bunch of series. + * @param gapID Gap id used to specify the time intervals. + * + * @return Min size of a gap. + */ protected long calculateGapSize( Date start, Date end, @@ -452,6 +566,19 @@ } + /** + * Determine the interval size between two data points. + * + * @param dStart Start date + * @param dEnd End date + * @param pStart Index of start point in series used to specify the total + * amount of date items. + * @param pEnd Index of end point in series used to specify the total amount + * of date items. + * @param gapID Gap id used to determine gaps configured in a xml document. + * + * @return Interval size between two data points. + */ protected long getTimeGapValue( Date dStart, Date dEnd,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.chart; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.Locale; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; +import org.jfree.chart.plot.XYPlot; + +import org.jfree.data.time.Minute; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; + + +/** + * This class is used to create timeseries charts that contain components of a + * vector parameter. The domain axis contains multiple date/time objects. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class TimeSeriesVectorChart extends TimeSeriesChart { + + private static Logger logger =Logger.getLogger(TimeSeriesVectorChart.class); + + public TimeSeriesVectorChart( + ChartLabels labels, + ChartTheme theme, + Collection parameters, + Collection measurements, + Collection dates, + Collection result, + Collection timeGaps, + Locale locale, + boolean linesVisible, + boolean shapesVisible + ) { + super(labels, theme, parameters, measurements, dates, result, + timeGaps, locale, linesVisible, shapesVisible); + } + + + @Override + protected void initData() { + logger.debug("init data for timeseries vector chart"); + + Iterator iter = resultSet.iterator(); + Result row = null; + String seriesName = null; + TimeSeries series = null; + + int idx = 0; + int startPos = 0; + int endPos = 0; + Date startDate = null; + Date endDate = null; + + ResultDescriptor rd = null; + int idxSeries = -1; + int idxX = -1; + int idxY = -1; + + Result[] results = + (Result[]) resultSet.toArray(new Result[resultSet.size()]); + + while (iter.hasNext()) { + row = (Result) iter.next(); + + if (rd == null) { + rd = row.getResultDescriptor(); + idxSeries = rd.getColumnIndex("SERIES"); + idxX = rd.getColumnIndex("XORDINATE"); + idxY = rd.getColumnIndex("YORDINATE"); + } + + // add current data to plot and prepare for next one + if (!row.getString(idxSeries).equals(seriesName)) { + logger.debug("prepare data/plot for next dataset"); + + if(series != null) { + // add gaps before adding series to chart + startDate = results[startPos].getDate(idxX); + endDate = results[endPos-1].getDate(idxX); + addGaps(results,series,startDate,endDate,startPos,endPos); + addSeries(series, seriesName, idx); + + startPos = endPos + 1; + } + + // prepare variables for next plot + seriesName = row.getString(idxSeries); + + logger.debug("next dataset is '" + seriesName + "'"); + series = new TimeSeries(seriesName, Minute.class); + } + + addValue(row, series); + storeMaxRange(ranges, row.getDouble(idxY), seriesName); + endPos++; + } + + if (startPos < results.length && endPos-1 < results.length) { + // add the last dataset if existing to plot and prepare its axis + startDate = results[startPos].getDate(idxX); + endDate = results[endPos-1].getDate(idxX); + addGaps(results, series, startDate, endDate, startPos, endPos); + addSeries(series, seriesName, idx); + } + + addDatasets(); + } + + + @Override + protected void addDatasets() { + XYPlot plot = chart.getXYPlot(); + int idx = 0; + + TimeSeriesCollection tsc = null; + Iterator iter = datasets.keySet().iterator(); + + while (iter.hasNext()) { + String key = (String) iter.next(); + tsc = (TimeSeriesCollection)datasets.get(key); + plot.setDataset(idx, tsc ); + logger.debug("Added " + key + " parameter to plot."); + prepareAxis(key, idx); + adjustRenderer( + idx++, + tsc.getSeriesCount(), + linesVisible, + shapesVisible + ); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; import de.intevation.gnv.jfreechart.PolygonDataset; @@ -31,34 +39,66 @@ import org.jfree.chart.title.PaintScaleLegend; import org.jfree.chart.title.TextTitle; +import org.jfree.data.Range; + import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This class represents a 2D chart containing polygon data. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class VerticalCrossSectionChart implements Chart { + /** + * Lookup class for retrieving a color which corresponds to a specific + * integer value. + */ public static final class PalettePaintLookup implements PolygonRenderer.PaintLookup { + /** + * Object storing information about value ranges and its coresponding + * colors and descriptions. + */ private Palette palette; + + /** + * Map containing some special <code>Paint</code> like ground fillcolor. + */ private Map<Integer, Paint> special; + /** + * Constructor + * + * @param palette See {@link #palette} + */ public PalettePaintLookup(Palette palette) { this(palette, null); } + /** + * Constructor + * + * @param palette See {@link #palette} + * @param special See {@link #special} + */ public PalettePaintLookup( - Palette palette, + Palette palette, Map<Integer, Paint> special ) { this.palette = palette; this.special = special; } + /** + * @param index Index of a <code>Paint</code> + * + * @return <code>Paint</code> object for a given index. + */ public Paint getPaint(int index) { if (special != null) { Paint paint = special.get(index); @@ -72,18 +112,43 @@ } } // class PalettePaintLookup + /** + * This class is used to turn labels which represent a number into a + * specific format. + */ public static class LocalizedLabelGenerator extends PolygonRenderer.DefaultLabelGenerator { + /** + * <code>NumberFormat</code> which is used to turn a number into a + * specific format. + */ protected NumberFormat format; + /** + * Constructor + */ public LocalizedLabelGenerator() { } + /** + * Constructor + * + * @param format See {@link #format} + */ public LocalizedLabelGenerator(NumberFormat format) { this.format = format; } + /** + * If label is a <code>Number</code>, it is turned into a format + * specified by {@link #format}. + * + * @param label Label to format. + * + * @return String representation of label. + */ + @Override protected String toString(Object label) { return label instanceof Number ? format.format(((Number)label).doubleValue()) @@ -91,17 +156,56 @@ } } // class LocalizedLabelGenerator + public static double MARGIN_TOP = 0.05d; + public static double MARGIN_BOTTOM = 0.00d; + public static double MARGIN_LEFT = 0.00d; + public static double MARGIN_RIGHT = 0.05d; + + /** + * JFreeChart object stored at this place after chart creation. + */ protected JFreeChart chart; + /** + * Stores {@link de.intevation.gnv.jfreechart.PolygonDataset} which is used + * to create a vertical cross chart. + */ protected AttributedXYColumns columns; + + /** + * Map which contains colors to fill polygons draw by this chart. + */ protected Map<Integer, Paint> special; + + /** + * Object used to map value intervals to specific colors and descriptions. + */ protected Palette palette; + + /** + * Locale object used for i18n support. + */ protected Locale locale; + + /** + * Labels for decorating the chart. + */ protected ChartLabels labels; + /** + * Default Constructor + */ public VerticalCrossSectionChart() { } + /** + * Constructor for VerticalCrossSectionChart creation. + * + * @param columns See {@link #columns} + * @param palette See {@link #palette} + * @param locale See {@link #locale} + * @param labels See {@link #labels} + */ public VerticalCrossSectionChart( AttributedXYColumns columns, Palette palette, @@ -111,6 +215,15 @@ this(columns, palette, null, locale, labels); } + /** + * Constructor for VerticalCrossSectionChart creation. + * + * @param columns See {@link #columns} + * @param palette See {@link #palette} + * @param special See {@link #special} + * @param locale See {@link #locale} + * @param labels See {@link #labels} + */ public VerticalCrossSectionChart( AttributedXYColumns columns, Palette palette, @@ -125,6 +238,12 @@ this.labels = labels; } + /** + * This method is used to create a JFreeChart from this object. A 2D plot is + * drawn and a legend panel is created containing each value range. + * + * @return JFreeChart object + */ protected JFreeChart createChart() { boolean legendB = false; @@ -205,9 +324,30 @@ chart.addSubtitle(legend); + // XXX Workaround, because Axes labels are cut at the + // left/right/top/bottom edge. The following lines add a white border + // between data area and plot border. + // see http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=22177&start=0&hilit=axis+labels+cut + ValueAxis xAxis = plot.getDomainAxis(); + Range xRange = xAxis.getRange(); + xRange = Range.expand(xRange, MARGIN_LEFT, MARGIN_RIGHT); + xAxis.setRange(xRange); + plot.setDomainAxis(xAxis); + + ValueAxis yAxis = plot.getRangeAxis(); + Range yRange = yAxis.getRange(); + yRange = Range.expand(yRange, MARGIN_BOTTOM, MARGIN_TOP); + yAxis.setRange(yRange); + plot.setRangeAxis(yAxis); + + chart.setPadding(new RectangleInsets(10d, 10d, 10d, 10d)); + return chart; } + /** + * @see de.intevation.gnv.chart.Chart#generateChart() + */ public JFreeChart generateChart() { if (chart == null) { chart = createChart(); @@ -216,6 +356,10 @@ return chart; } + /** + * Set the background paint of {@link #chart}. + * @param paint + */ public void setBackgroundPaint(Paint paint) { chart.setBackgroundPaint(paint); }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,46 +1,104 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + import java.util.Collection; import java.util.HashMap; -import java.util.Map; import java.util.Iterator; import java.util.Locale; +import java.util.Map; import org.apache.log4j.Logger; import org.jfree.chart.ChartTheme; + import org.jfree.chart.axis.Axis; import org.jfree.chart.axis.NumberAxis; -import org.jfree.chart.plot.XYPlot; + import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; + import org.jfree.data.Range; + import org.jfree.data.general.Series; + import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.describedata.KeyValueDescibeData; - - /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This class is used to create xy charts of vertical profiles. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class VerticalProfileChart extends AbstractXYLineChart { + /** + * Default axis identifier which is used if @see #getDependendAxisName does + * not return a value. The value of this field is {@value}. + */ public static final String DEFAULT_AXIS = "KPOSITION"; + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(VerticalProfileChart.class); - protected final double PERCENTAGE = 5.0; + /** + * Constant used for gap detection. Its value is {@value}. + */ + protected static int PERCENTAGE = 5; + + /** + * Constnat used for gap detection in @see #gridDetection. + */ protected final double GAP_MAX_LEVEL = Math.sqrt(2.0); + + /** + * Constant used for gap detection in @see #addGaps. Its value is {@value}. + */ protected final int GAP_MAX_VALUES = 60; - /** Map to store max ranges of each parameter (axis.setAutoRange(true) - * doesn't seem to work properly. */ + /** + * Map to store max ranges of each parameter + * (org.jfree.chart.axis.Axis.setAutoRange(true) doesn't seem to work + * properly. + */ protected Map values; + static { + /* The percentage defining the width of a gap should be configured in + * conf.xml instead of being configured in a system property */ + PERCENTAGE = Integer.getInteger("chart.gap.percentage", PERCENTAGE); + } + + /** + * Constructor used to create xy-charts. + * + * @param labels Labels used to be displayed in title, subtitle and so on. + * @param theme ChartTheme used to adjust the rendering of this chart. + * @param parameters Collection containing a bunch of parameters. + * @param measurements Collection containing a bunch of measurements. + * @param dates Collection containing a bunch of date objects. + * @param result Collection containing a bunch of <code>Result</code> + * objects which contain the actual data items to be displayed. + * @param timeGaps Collection with timegap definitions. + * @param locale Locale used to specify the format of labels, numbers, ... + * @param linesVisible Render lines between data points if true, otherwise + * not. + * @param shapesVisible Render vertices as points if true, otherwise not. + */ public VerticalProfileChart( ChartLabels labels, ChartTheme theme, @@ -70,9 +128,16 @@ } + /** + * @see de.intevation.gnv.chart.AbstractXYLineChart#initData() + */ + @Override protected void initData() { log.debug("init data for VerticalProfileChart"); + int items = resultSet.size(); + log.debug("Found " + items + " items for this chart."); + String breakPoint1 = null; String breakPoint2 = null; String breakPoint3 = null; @@ -103,7 +168,9 @@ log.debug("prepare data/plot for next dataset"); if(series != null) { - gapDetection(results, series, startPos, endPos); + if (startPos >= 0 && endPos < items) { + gapDetection(results, series, startPos, endPos); + } addSeries(series, parameter, idx); startPos = endPos +1; @@ -135,21 +202,44 @@ endPos++; } - if (results.length == 0) + if (items == 0) return; - gapDetection(results, series, startPos, endPos); + if (startPos >= 0 && endPos < items) { + gapDetection(results, series, startPos, endPos); + } addSeries(series, parameter, idx); addDatasets(); } + /** + * Extract the important value from <code>Result</code> object. + * + * @param row <code>Result</code> object which contains a required value. + * + * @return X-ordinate + */ protected Object getValue(Result row) { return row.getDouble("XORDINATE"); } + /** + * General method to start a gap detection. The switch between standard gap + * detection method <code>addGaps</code> and a specialized method + * <code>addGapsOnGrid</code> is done by a parameter <code>DATEID</code> + * which is stored a each <code>Result</code> object. Specialized method is + * used if <code>DATEID</code> equals 2, otherwise the standard method is + * used. + * + * @param results Array of <code>Result</code> objects storing data of + * this chart. + * @param series Series used to add gaps. + * @param startPos Index of first element of series in results. + * @param endPos Index of last element of series in results. + */ protected void gapDetection( Result[] results, Series series, @@ -164,17 +254,71 @@ addGaps(results, series, startValue, endValue, startPos, endPos); } + @Override + protected void prepareAxis(String seriesKey, int idx) { + super.prepareAxis(seriesKey, idx); - protected void prepareRangeAxis(String seriesKey, int idx) { - XYPlot plot = chart.getXYPlot(); - NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); + XYPlot plot = chart.getXYPlot(); + NumberAxis domainAxis = (NumberAxis) plot.getRangeAxis(idx); - Range xRange = (Range) values.get(seriesKey); - xAxis.setRange(Range.expand(xRange, LOWER_MARGIN, UPPER_MARGIN)); - log.debug("Max X-Range of dataset is: " + xRange.toString()); + Range domainRange = domainAxis.getRange(); + log.debug("Domain axis range before: " + domainRange.toString()); + + domainRange = Range.expand(domainRange, LOWER_MARGIN, UPPER_MARGIN); + + double lower = domainRange.getLowerBound(); + double upper = domainRange.getUpperBound(); + + if (lower == upper) { + double lo = lower > 0 ? lower - lower*0.05d : lower + lower*0.05d; + double up = upper > 0 ? upper + upper*0.05d : upper - upper*0.05d; + + domainRange = new Range(lo, up); + } + + log.debug("Range axis range after: " + domainRange.toString()); + domainAxis.setRange(domainRange); + plot.setRangeAxis(idx, domainAxis); } + /** + * Method to expand max range of a range axis. + * <code>LOWER_MARGIN</code> and <code>UPPER_MARGIN</code> are used to + * expand the range. + */ + protected void prepareRangeAxis(String seriesKey, int idx) { + log.debug("Adjust domain range now..."); + XYPlot plot = chart.getXYPlot(); + NumberAxis yAxis = (NumberAxis) plot.getDomainAxis(); + + Range yRange = yAxis.getRange(); + double lo = yRange.getLowerBound(); + double hi = yRange.getUpperBound(); + + Iterator iter = values.values().iterator(); + while (iter.hasNext()) { + Range tmp = (Range) iter.next(); + log.debug("Series range: " + tmp.toString()); + + lo = lo < tmp.getLowerBound() ? lo : tmp.getLowerBound(); + hi = hi > tmp.getUpperBound() ? hi : tmp.getUpperBound(); + } + + Range merged = Range.expand( + new Range(lo, hi), + LOWER_MARGIN, UPPER_MARGIN); + log.debug("Calculated range for all series = " + merged.toString()); + + yAxis.setRange(merged); + plot.setDomainAxis(yAxis); + } + + + /** + * @see de.intevation.gnv.chart.AbstractXYLineChart#addValue(Result, Series) + */ + @Override protected void addValue(Result row, Series series) { ((XYSeries) series).add( row.getDouble("XORDINATE"), @@ -183,6 +327,12 @@ } + /** + * @param parameter + * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series, String, + * int) + */ + @Override protected void addSeries(Series series, String parameter, int idx) { log.debug("add series (" + parameter + ")to chart"); @@ -203,6 +353,10 @@ } + /** + * Method to add processed datasets to plot. Each dataset is adjusted using + * <code>prepareAxis</code> and <code>adjustRenderer</code> methods. + */ protected void addDatasets() { Iterator iter = parameters.iterator(); XYPlot plot = chart.getXYPlot(); @@ -220,7 +374,6 @@ plot.setDataset(idx, xysc ); log.debug("Added " + key + " parameter to plot."); prepareAxis(key, idx); - prepareRangeAxis(key, idx); adjustRenderer( idx++, xysc.getSeriesCount(), @@ -229,9 +382,18 @@ ); } } + + prepareRangeAxis(null, -1); } + /** + * Method used to store the max y-range of each parameter in this chart. + * + * @param values Map to store max values for each parameter. + * @param val Value used to be a Double. + * @param parameter Title used to identify a range object stored in values. + */ protected void storeMaxValue(Map values, Object val, String parameter) { double value = ((Double) val).doubleValue(); Range range = null; @@ -250,12 +412,23 @@ } + /** + * @param locale + * @see de.intevation.gnv.chart.AbstractXYLineChart#localizeDomainAxis(Axis, + * Locale) + */ + @Override protected void localizeDomainAxis(Axis axis, Locale locale) { // call localizeRangeAxis from superclass which formats NumberAxis super.localizeRangeAxis(axis, locale); } + /** + * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String, + * String, String) + */ + @Override protected String createSeriesName( String breakPoint1, String breakPoint2, @@ -269,6 +442,18 @@ } + /** + * Method used to add gaps between data points on grids. The real detection + * is done in <code>gridDetection</code>. + * + * @param results Array of <code>Result</code> objects storing the relevant + * values. + * @param series Series object where the gaps are added to. + * @param startPos Index of first element which should be used in gap + * detection. Other series are stored in results as well. + * @param endPos Index of last element which should be used in gap + * detection. + */ protected void addGapsOnGrid( Result[] results, Series series, @@ -276,7 +461,7 @@ int endPos ) { String axis = null; - + if (results.length > (startPos+1)) { axis = getDependendAxisName( results[startPos], @@ -307,6 +492,24 @@ } + /** + * Standarad method to add gaps. There are two different methods to detect + * gaps. <code>simpleDetection</code> is used if the number of data points + * in this chart is lower than <code>GAP_MAX_VALUES</code>. Otherwise + * <code>specialDetection</code> is used. A data point with + * <code>null</code> value is added where a gap should be. This lets + * JFreeChart break the current graph. + * + * @param results Array of <code>Result</code> objects storing the relevant + * values. + * @param series Series object where the gaps are added to. + * @param startValue First data point value in series. + * @param endValue Last data point value in series. + * @param startPos Index of first data point in results which contains all + * data points of all series. + * @param endPos Index of last data point in results which contains all data + * points of all series. + */ protected void addGaps( Result[] results, Series series, @@ -347,6 +550,21 @@ } + /** + * Simple method to detect gaps. A gap is detected if the delta between two + * data points (current, last) is bigger than <code>PERCENTAGE</code> percent + * of delta of start and end. + * <br> + * (smallDelta > delta / 100 * PERCENTAGE) + * + * @param start First data point value in a series. + * @param end Last data point value in a series. + * @param last Left value + * @param current Right value + * + * @return true, if a gap is detected between last and current - otherwise + * false. + */ protected boolean simpleDetection( double start, double end, @@ -360,6 +578,22 @@ } + /** + * Method to detect gaps between two data points. Following formula is used + * for detection:<br> + * smallDelta > (3.0 / (count - 1) * delta)<br> + * smallDelta = current - last<br> + * delta = end - start + * + * @param start First data point value in a series. + * @param end Last data point value in a series. + * @param last Left value + * @param current Right value + * + * @param count + * @return true, if a gap is detected between last and current - otherwise + * false. + */ protected boolean specialDetection( double start, double end, @@ -373,7 +607,17 @@ return (smallDelta > (3.0 / (count - 1) * delta)); } - + + /** + * Method used to detect gaps between two data points grids. If the delta + * between current and last is bigger than <code>GAP_MAX_LEVEL</code>, a gap + * is detected. + * + * @param last Left value + * @param current Right value + * + * @return True, if a gap was detected - otherwise false. + */ protected boolean gridDetection(double last, double current) { if (log.isDebugEnabled()) { log.debug("######################################################"); @@ -387,6 +631,15 @@ } + /** + * This method returns the key which is used to retrieve the y-value served + * by a <code>Result</code> object. + * + * @param first <code>Result</code> object - not used in this class. + * @param second <code>Result</code> object - not used in this class. + * + * @return the string "KPOSITION" + */ protected String getDependendAxisName(Result first, Result second) { return "KPOSITION"; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.chart; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Locale; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; + +import org.jfree.chart.plot.XYPlot; + +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; + +/** + * This class is used to create xy charts of vertical profiles. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class VerticalProfileVectorChart +extends VerticalProfileChart +{ + private static Logger logger = + Logger.getLogger(VerticalProfileVectorChart.class); + + public VerticalProfileVectorChart( + ChartLabels labels, + ChartTheme theme, + Collection parameters, + Collection measurements, + Collection dates, + Collection result, + Collection timeGaps, + Locale locale, + boolean linesVisible, + boolean shapesVisible + ) { + super(labels, theme, parameters, measurements, dates, result, + timeGaps, locale, linesVisible, shapesVisible); + } + + + @Override + protected void initData() { + logger.debug("init data for verticalprofile chart with vector data."); + + int items = resultSet.size(); + logger.debug("Found " + items + " items for this chart."); + + Iterator iter = resultSet.iterator(); + Result row = null; + String seriesName = null; + XYSeries series = null; + + int idx = 0; + int startPos = 0; + int endPos = 0; + + double startValue = 0; + double endValue = 0; + + ResultDescriptor rd = null; + int idxSeries = -1; + int idxX = -1; + int idxY = -1; + + Result[] results = + (Result[]) resultSet.toArray(new Result[resultSet.size()]); + + while (iter.hasNext()) { + row = (Result) iter.next(); + + if (rd == null) { + rd = row.getResultDescriptor(); + idxSeries = rd.getColumnIndex("SERIES"); + idxX = rd.getColumnIndex("XORDINATE"); + idxY = rd.getColumnIndex("YORDINATE"); + } + + if (!row.getString(idxSeries).equals(seriesName)) { + logger.debug("prepare data/plot for next dataset."); + + if (series != null) { + if (startPos >= 0 && endPos < items) { + gapDetection(results, series, startPos, endPos); + } + + addSeries(series, seriesName, idx); + + startPos = endPos + 1; + } + + seriesName = row.getString(idxSeries); + + logger.debug("next data is '" + seriesName + "'"); + series = new XYSeries(seriesName); + } + + addValue(row, series); + Object x = getValue(row); + Double y = row.getDouble(idxY); + if (x != null && y != null) { + storeMaxRange(ranges, y, seriesName); + storeMaxValue(values, x, seriesName); + } + + endPos++; + } + + if (results.length == 0) + return; + + if (startPos >= 0 && endPos < items) { + gapDetection(results, series, startPos, endPos); + } + addSeries(series, seriesName, idx); + + addDatasets(); + } + + + @Override + protected void addDatasets() { + XYPlot plot = chart.getXYPlot(); + int idx = 0; + + XYSeriesCollection sc = null; + Iterator iter = datasets.keySet().iterator(); + + while (iter.hasNext()) { + String key = (String) iter.next(); + sc = (XYSeriesCollection)datasets.get(key); + plot.setDataset(idx, sc ); + logger.debug("Added " + key + " parameter to plot."); + prepareAxis(key, idx); + adjustRenderer( + idx++, + sc.getSeriesCount(), + linesVisible, + shapesVisible + ); + } + + prepareRangeAxis(null, -1); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/XMLChartTheme.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/XMLChartTheme.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,82 +1,170 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.chart; -import java.awt.Font; +import de.intevation.artifacts.common.utils.Config; + import java.awt.Color; +import java.awt.Font; import java.awt.Paint; + import java.awt.geom.Ellipse2D; -import java.lang.NumberFormatException; import org.apache.log4j.Logger; import org.jfree.chart.StandardChartTheme; + import org.jfree.chart.plot.XYPlot; + import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; import org.jfree.chart.renderer.xy.XYBarRenderer; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; + import org.jfree.ui.RectangleInsets; + import org.jfree.util.UnitType; - import org.w3c.dom.Document; -import de.intevation.artifactdatabase.Config; - /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * Implementation of JFreeChart's default implementation + * <code>StandardChartTheme</code>. This class takes an xml document with a + * bunch of parameters and turns it into a <code>ChartTheme</code> to change + * the appearance of charts. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class XMLChartTheme extends StandardChartTheme { + /** + * Default color. + */ private static final Color DEFAULT_COLOR = Color.BLACK; + /** + * Logger used for logging with log4j. + */ private Logger log = Logger.getLogger(XMLChartTheme.class); + /** + * Field storing the visibility of the domain crosshair + */ protected boolean domainCrosshairVisible; + + /** + * Field storing the visibility of the range crosshair + */ protected boolean rangeCrosshairVisible; + + /** + * Field storing the visiblity of lines. + */ protected boolean renderLines; + + /** + * Field storing the visibility of data points + */ protected boolean renderShapes; + /** + * Field storing the width of a data point + */ protected int pointWidth; + + /** + * Field storing the height of a data point. + */ protected int pointHeight; + /** + * Field storing the base color of a bin in a histogram chart + */ protected Paint histogramBasePaint; + /** + * Constructor + * + * @param name Name for this theme. + */ public XMLChartTheme(String name) { super(name); } + /** + * Setter method for the visibility of the domain crosshair. + * + * @param visible True, if domain crosshair should be visible + */ public void setDomainCrosshairVisible(boolean visible) { this.domainCrosshairVisible = visible; } + /** + * Getter method for retrieving the visibility of the domain crosshair. + * + * @return Visibility of the domain crosshair. + */ public boolean getDomainCrosshairVisible() { return domainCrosshairVisible; } + /** + * Getter method for retrieving the visibility of the range crosshair. + * + * @return Visibility of the range crosshair. + */ public boolean getRangeCrosshairVisible() { return rangeCrosshairVisible; } + /** + * Setter method for the visibility of the range crosshair. + * + * @param visible True, if range crosshair should be visible + */ public void setRangeCrosshairVisible(boolean visible) { this.rangeCrosshairVisible = visible; } + /** + * Method to set the bin color of histograms. + * + * @param c Bin color + */ public void setHistogramBasePaint(Color c) { this.histogramBasePaint = c; } + /** + * Getter method for retrieving the bin color. + * + * @return Bin color + */ public Paint getHistogramBasePaint() { return histogramBasePaint; } + /** + * Take a given xml document and read the configuration of a chart + * appearance. + * + * @param document XML document + */ public void applyXMLConfiguration(Document document) { log.debug("create XMLChartTheme"); @@ -84,6 +172,11 @@ } + /** + * Start parsing the different settings from <code>document</code>. + * + * @param document XML document + */ private void init(Document document) { log.debug("init XMLChartTheme parameters"); @@ -98,6 +191,11 @@ } + /** + * Read parameters configuring the title of a chart. + * + * @param document XML document + */ private void initTitleParameters(Document document) { log.debug("init title parameters."); @@ -114,6 +212,11 @@ } + /** + * Read parameters configuring the subtitle of a chart. + * + * @param document XML document + */ private void initSubtitleParameters(Document document) { log.debug("init title parameters."); @@ -128,6 +231,11 @@ } + /** + * Read parameters configuring the background color of a chart. + * + * @param document XML document + */ private void initChartParameters(Document document) { log.debug("init chart parameters."); @@ -138,6 +246,11 @@ } + /** + * Read parameters configuring the plot of a chart. + * + * @param document XML document + */ private void initPlotParameters(Document document) { log.debug("init plot parameters."); @@ -181,6 +294,11 @@ } + /** + * Read parameters configuring the axes of a plot. + * + * @param document XML document + */ private void initAxisParameters(Document document) { log.debug("init axis parameters."); @@ -197,6 +315,11 @@ } + /** + * Read parameters configuring the legend of a chart. + * + * @param document XML document + */ private void initLegendParameters(Document document) { log.debug("init legend parameters."); @@ -213,6 +336,11 @@ } + /** + * Read parameters configuring the renderer of a plot. + * + * @param document XML document + */ private void initRenderer(Document document) { log.debug("init renderer parameters."); @@ -229,6 +357,11 @@ } + /** + * Read base color of bins in histogram charts. + * + * @param document XML document + */ private void initHistogramColor(Document document) { log.debug("init histogram color"); String tmp = getString(document, "theme/histogram/bar/color/@value"); @@ -239,11 +372,28 @@ } + /** + * Read a xpath expression and return the matched string. + * + * @param document Document + * @param xpath XPath expression + * + * @return Matched string + */ private static String getString(Document document, String xpath) { return Config.getStringXPath(document, xpath); } + /** + * Read a xpath and turn it into an integer. + * + * @param document Document + * @param xpath XPath expression + * + * @return Matched string as integer representation. Return 0 if no integer + * have been found at <code>xpath</code>. + */ private static int getInt(Document document, String xpath) { String tmp = getString(document, xpath); @@ -254,6 +404,15 @@ } + /** + * Read a xpath and turn it into a boolean. + * + * @param document Document + * @param xpath XPath expression + * + * @return Matched string as boolean representation. Return false if no + * boolean have been found at <code>xpath</code>. + */ private static boolean getBool(Document document, String xpath) { String tmp = getString(document, xpath); @@ -264,6 +423,13 @@ } + /** + * Turns a string into a color using {@link java.awt.Color}. + * + * @param color as string + * + * @return Color + */ protected Color decodeColor(String color) { try { if (color == null) @@ -279,6 +445,15 @@ } + /** + * Create a font with the given parameters. + * + * @param type Font type + * @param size Font size + * @param bold Font weight + * + * @return Font + */ protected Font createFont(String type, int size, boolean bold) { Font font = null; if (bold) @@ -290,6 +465,13 @@ } + /** + * Apply settings of this <code>ChartTheme</code> to the given + * <code>XYPlot</code>. + * + * @param plot XYPlot + */ + @Override protected void applyToXYPlot(XYPlot plot) { log.debug("apply theme parameter to XYPlot"); @@ -297,7 +479,7 @@ plot.setDomainCrosshairVisible(this.domainCrosshairVisible); plot.setRangeCrosshairVisible(this.rangeCrosshairVisible); - AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) + AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) plot.getRenderer(); if (renderer instanceof XYLineAndShapeRenderer) @@ -308,6 +490,12 @@ } + /** + * Apply settings of this <code>ChartTheme</code> to the + * <code>XYLineAndShapeRenderer</code> of the given <code>XYPlot</code>. + * + * @param plot XYPlot + */ protected void applyToXYLineAndShapeRenderer(XYPlot plot) { if (plot == null) return; @@ -327,6 +515,12 @@ } + /** + * Apply settings of this <code>ChartTheme</code> to the + * <code>XYBarRenderer</code> of the given <code>XYPlot</code>. + * + * @param plot XYPlot + */ protected void applyToXYBarRenderer(XYPlot plot) { if (plot == null) return; @@ -336,3 +530,4 @@ renderer.setSeriesPaint(0, histogramBasePaint); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.chart.exception; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class TechnicalChartException extends Exception { @@ -22,7 +27,7 @@ /** * Constructor - * + * * @param message */ public TechnicalChartException(String message) { @@ -31,7 +36,7 @@ /** * Constructor - * + * * @param cause */ public TechnicalChartException(Throwable cause) { @@ -40,7 +45,7 @@ /** * Constructor - * + * * @param message * @param cause */ @@ -49,3 +54,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Exceptions that are used to be thrown if an error occured while chart generation. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes and interfaces to support creation of different chart types. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; import com.lowagie.text.Document; @@ -9,7 +17,9 @@ import com.lowagie.text.pdf.PdfTemplate; import com.lowagie.text.pdf.PdfWriter; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.CallContext; + +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.gnv.chart.Chart; @@ -37,15 +47,41 @@ import org.jfree.chart.JFreeChart; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This class is a helper class which supports some methods to export charts + * into specific formats. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class ChartExportHelper { + /** + * Constant field to define A4 as default page size. + */ private static final String DEFAULT_PAGE_SIZE = "A4"; + + /** + * Constant field to define UTF-8 as default encoding. + */ private static final String DEFAULT_ENCODING = "UTF-8"; + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(ChartExportHelper.class); + + /** + * A method to export a <code>JFreeChart</code> as image to an + * <code>OutputStream</code> with a given format, width and height. + * + * @param out OutputStream + * @param chart JFreeChart object to be exported. + * @param format Format (e.g. png, gif, jpg) + * @param width Width, the image used to be + * @param height Height, the image used to be + * + * @throws IOException if writing image to OutputStream failed. + */ public static void exportImage( OutputStream out, JFreeChart chart, @@ -67,6 +103,18 @@ } + /** + * A method to export a <code>JFreeChart</code> histogram as image to an + * <code>OutputStream</code> with a given format, width and height. + * + * @param out OutputStream + * @param histograms Array of {@link de.intevation.gnv.chart.Chart} objects + * @param format A format (e.g. png, gif, jpg) + * @param width Width the image used to be + * @param height Height the image used to be + * + * @throws IOException if writing image to OutputStream failed. + */ public static void exportHistograms( OutputStream out, Chart[] histograms, @@ -92,6 +140,16 @@ } + /** + * A method to export a <code>JFreeChart</code> histogram as SVG to an + * <code>OutputStream</code>. + * + * @param out OutputStream + * @param histograms Array of {@link de.intevation.gnv.chart.Chart} + * @param encoding Encoding, defaults to {@link #DEFAULT_ENCODING} if null + * @param width Width the svg used to be + * @param height Height the svg used to be + */ public static void exportHistogramsAsSVG( OutputStream out, Chart[] histograms, @@ -127,6 +185,16 @@ } + /** + * A method to export a <code>JFreeChart</code> as SVG to an + * <code>OutputStream</code>. + * + * @param out OutputStream + * @param chart JFreeChart to be exported + * @param encoding Encoding, defaults to {@link #DEFAULT_ENCODING} if null + * @param width Width the svg used to be + * @param height Height the svg used to be + */ public static void exportSVG( OutputStream out, JFreeChart chart, @@ -156,24 +224,75 @@ } + /** + * A method to export a <code>JFreeChart</code> as PDF to an + * <code>OutputStream</code>. + * + * @param out OutputStream + * @param chart JFreeChart + * @param pageFormat String to specify a page format, {@link + * #DEFAULT_PAGE_SIZE} is used if no pageFormat is given + * @param landscape If this is true, the pdf is delivered in landscape + * format + * @param marginLeft Space to left border + * @param marginRight Space to right border + * @param marginTop Space to upper border + * @param marginBottom Space to lower border + */ public static void exportPDF( OutputStream out, JFreeChart chart, String pageFormat, - boolean landscape, float marginLeft, float marginRight, float marginTop, - float marginBottom + float marginBottom, + CallContext context ) { log.info("export chart as pdf."); if (pageFormat == null) pageFormat = DEFAULT_PAGE_SIZE; + // max size of the chart Rectangle page = PageSize.getRectangle(pageFormat); - int pageWidth = (int) (page.getRight(marginRight) - page.getLeft(marginLeft)); - int pageHeight = (int) (page.getTop(marginTop) - page.getBottom(marginBottom)); + float pageWidth = page.getWidth(); + float pageHeight = page.getHeight(); + + // the chart width + int chartWidth = (Integer) context.getContextValue("chart.width"); + int chartHeight = (Integer) context.getContextValue("chart.height"); + + boolean landscape = chartWidth > chartHeight ? true : false; + + float width = 0; + float height = 0; + if (landscape) { + width = pageHeight; + height = pageWidth; + } + else { + width = pageWidth; + height = pageHeight; + } + + float spaceX = width - marginLeft - marginRight; + if (chartWidth > spaceX) { + log.warn("Width of the chart is too big for pdf -> resize it now."); + double ratio = ((double)spaceX) / chartWidth; + chartWidth *= ratio; + chartHeight *= ratio; + log.debug("Resized chart to " + chartWidth + "x" + chartHeight); + } + + float spaceY = height - marginTop - marginBottom; + if (chartHeight > spaceY) { + log.warn("Height of the chart is too big for pdf -> resize it now."); + double ratio = ((double)spaceY) / chartHeight; + chartWidth *= ratio; + chartHeight *= ratio; + log.debug("Resized chart to " + chartWidth + "x" + chartHeight); + } Document document = null; if (landscape) { @@ -192,24 +311,20 @@ PdfContentByte content = writer.getDirectContent(); - int width = 0; - int height = 0; - if (landscape) { - width = pageHeight; - height = pageWidth; - } - else { - width = pageWidth; - height = pageHeight; - } - PdfTemplate template = content.createTemplate(width, height); Graphics2D graphics = template.createGraphics(width, height); - Rectangle2D area = new Rectangle2D.Double(0.0D, 0.0D,width,height); + + double[] origin = getCenteredAnchor( + marginLeft, marginRight, marginBottom, marginTop, + width, height, + chartWidth, chartHeight); + + Rectangle2D area = new Rectangle2D.Double( + origin[0], origin[1], chartWidth, chartHeight); chart.draw(graphics, area); graphics.dispose(); - content.addTemplate(template, marginLeft, marginBottom); + content.addTemplate(template, 0f, 0f); } catch (DocumentException de) { log.error("Error while exporting chart to pdf.", de); @@ -220,15 +335,31 @@ } + /** + * A method to export <code>JFreeChart</code> histograms as PDF to an + * <code>OutputStream</code>. Each histogram contained in histograms is + * drawn to an own page in the resulting pdf. + * + * @param out OutputStream + * @param histograms JFreeChart histograms + * @param pageFormat String to specify a page format, {@link + * #DEFAULT_PAGE_SIZE} is used if no pageFormat is given + * @param landscape If this is true, the pdf is delivered in landscape + * format + * @param marginLeft Space to left border + * @param marginRight Space to right border + * @param marginTop Space to upper border + * @param marginBottom Space to lower border + */ public static void exportHistogramsAsPDF( OutputStream out, Chart[] histograms, String pageFormat, - boolean landscape, float marginLeft, float marginRight, float marginTop, - float marginBottom + float marginBottom, + CallContext context ) { log.info("export histogram as pdf."); @@ -236,10 +367,43 @@ pageFormat = DEFAULT_PAGE_SIZE; Rectangle page = PageSize.getRectangle(pageFormat); - int pageWidth = - (int) (page.getRight(marginRight) - page.getLeft(marginLeft)); - int pageHeight = - (int) (page.getTop(marginTop) - page.getBottom(marginBottom)); + float pageWidth = page.getWidth(); + float pageHeight = page.getHeight(); + + // the chart width + int chartWidth = (Integer) context.getContextValue("chart.width"); + int chartHeight = (Integer) context.getContextValue("chart.height"); + + boolean landscape = chartWidth > chartHeight ? true : false; + + float width = 0; + float height = 0; + if (landscape) { + width = pageHeight; + height = pageWidth; + } + else { + width = pageWidth; + height = pageHeight; + } + + float spaceX = width - marginLeft - marginRight; + if (chartWidth > spaceX) { + log.warn("Histogram width is too big for pdf -> resize it now."); + double ratio = ((double)spaceX) / chartWidth; + chartWidth *= ratio; + chartHeight *= ratio; + log.debug("Resized chart to " + chartWidth + "x" + chartHeight); + } + + float spaceY = height - marginTop - marginBottom; + if (chartHeight > spaceY) { + log.warn("Histogram height is too big for pdf -> resize it now."); + double ratio = ((double)spaceY) / chartHeight; + chartWidth *= ratio; + chartHeight *= ratio; + log.debug("Resized chart to " + chartWidth + "x" + chartHeight); + } Document document = null; if (landscape) { @@ -257,17 +421,6 @@ PdfContentByte content = writer.getDirectContent(); - int width = 0; - int height = 0; - if (landscape) { - width = pageHeight; - height = pageWidth; - } - else { - width = pageWidth; - height = pageHeight; - } - int size = histograms.length; for (int i = 0; i < size; i++) { if (i > 0) { @@ -277,20 +430,80 @@ JFreeChart chart = histograms[i].generateChart(); PdfTemplate template = content.createTemplate(width, height); Graphics2D graphics = template.createGraphics(width, height); + + double[] origin = getCenteredAnchor( + marginLeft, marginRight, marginBottom, marginTop, + width, height, + chartWidth, chartHeight); + Rectangle2D area = new Rectangle2D.Double( - 0.0D, 0.0D,width,height); + origin[0], origin[1], chartWidth, chartHeight); chart.draw(graphics, area); graphics.dispose(); - content.addTemplate(template, marginLeft, marginBottom); + content.addTemplate(template, 0f, 0f); } } catch (DocumentException de) { - log.error("Error while exporting chart to pdf.", de); + log.error("Error while exporting histogram to pdf.", de); } finally { document.close(); } } + + + /** + * This method returns the anchor of the chart so that the chart is centered + * according to the given parameters. + * + * @param mLeft Left margin + * @param mRight Right margin + * @param mBottom Bottom margin + * @param mTop Top margin + * @param width The complete width of the drawing area. + * @param height The complete height of the drawing area. + * @param chartWidth The width of the chart. + * @param chartHeight The height of the chart. + * + * @return an array that contains the anchor for a chart with the given + * parameters. The first value is the x point, the second value is the y + * point. + */ + public static double[] getCenteredAnchor( + double mLeft, double mRight, double mBottom, double mTop, + double width, double height, + double chartWidth, double chartHeight + ) { + if (log.isDebugEnabled()) { + log.debug("Calculate centered origin..."); + log.debug("-> PDF width : " + width); + log.debug("-> PDF height : " + height); + log.debug("-> Chart width : " + chartWidth); + log.debug("-> Chart height : " + chartHeight); + log.debug("-> margin left : " + mLeft); + log.debug("-> margin right : " + mRight); + log.debug("-> margin bottom: " + mBottom); + log.debug("-> margin top : " + mTop); + } + + double[] origin = new double[2]; + + double centerX = width / 2; + double centerY = height / 2; + + origin[0] = centerX - chartWidth / 2; + origin[1] = centerY - chartHeight / 2; + + origin[0] = origin[0] >= mLeft ? origin[0] : mLeft; + origin[1] = origin[1] >= mTop ? origin[1] : mTop; + + if (log.isDebugEnabled()) { + log.debug("==> centered left origin: " + origin[0]); + log.debug("==> centered top origin: " + origin[1]); + } + + return origin; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,35 +1,78 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import de.intevation.gnv.state.exception.StateException; + +import java.util.ArrayList; import java.util.List; -import java.util.ArrayList; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.geobackend.base.ResultDescriptor; -import de.intevation.gnv.state.exception.StateException; - - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This is the default implementation of {@link Export.DataCollector}. This + * class serves a method to extract required data from <code>Result</code> + * objects. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultDataCollector implements Export.DataCollector { + /** + * Logger used to log via log4j. + */ private Logger log = Logger.getLogger(DefaultDataCollector.class); + /** + * ResultDescriptor used to extract specific attributes from + * <code>Result</code> object. + */ protected ResultDescriptor rd; + + /** + * Atrribute names in <code>Result</code> object which should be used for + * data extraction. + */ protected String [] names; + /** + * Constructor + * + * @param names See {@link #names} + */ public DefaultDataCollector(String[] names) { this.names = names; } + /** + * This method initializes the <code>ResultDescriptor</code> rd for a faster + * data extraction. + * + * @param res A <code>Result</code> object used to get its description. + */ public void init(Result res) { rd = res.getResultDescriptor(); } + /** + * This method is used to extract the required data specified by {@link + * #names}. + * + * @param result <code>Result</code> object. + * + * @return Extracted data. + */ public String[] getData(Result result) throws StateException { @@ -46,3 +89,4 @@ return (String[]) entries.toArray((new String[entries.size()])); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultExport.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultExport.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,38 +1,69 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; -import org.apache.log4j.Logger; - import au.com.bytecode.opencsv.CSVWriter; -import java.util.Iterator; -import java.util.Collection; - -import java.io.UnsupportedEncodingException; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.OutputStream; - import de.intevation.gnv.geobackend.base.Result; import de.intevation.gnv.state.exception.StateException; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +import java.util.Collection; +import java.util.Iterator; + +import org.apache.log4j.Logger; + /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class is the default implementation of {@link Export}. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultExport implements Export { + /** + * Logger used for logging via log4j. + */ private static Logger log = Logger.getLogger(DefaultExport.class); - private Export.DataCollector collector; + /** + * DataCollector used to extract data from <code>Result</code> objects. + */ + protected Export.DataCollector collector; + /** + * Constructor + * + * @param collector See {@link #collector} + */ public DefaultExport(Export.DataCollector collector) { this.collector = collector; } + /** + * This method writes data stored in <code>result</code> into a CSV document + * using <code>writer</code>. + * + * @param profile <code>Profile</code> used to specify the format and columns. + * @param result Collection storing the required data. + * @param writer CSVWriter to write the csv document. + * + * @throws StateException + */ protected void writeData( - Profile profile, + Profile profile, Collection result, CSVWriter writer ) @@ -51,15 +82,29 @@ } } + /** + * This method takes a data Collection and writes it to + * <code>outputStream</code> using the the format specified by + * <code>profile</code>. + * + * @param profile used to specify the format and columns. + * @param outputStream OutputStream which is used for writing the export + * document to. + * @param result Collection storing the data. + * + * @throws IOException if writing to OutputStream failed. + * @throws UnsupportedEncodingException if the encoding was not accepted. + * @throws StateException if result is null. + */ public void create( Profile profile, - OutputStream outputStream, + OutputStream outputStream, Collection result ) throws IOException, UnsupportedEncodingException, - StateException + StateException { if (result == null) { String msg = "No data given for generation of " + @@ -71,13 +116,14 @@ CSVWriter writer = new CSVWriter( new OutputStreamWriter( outputStream, - profile.getEncoding()), + profile.getEncoding()), profile.getSeparator(), profile.getQuoteCharacter(), - profile.getEscapeCharacter()); + profile.getEscapeCharacter()); writeData(profile, result, writer); writer.close(); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultProfile.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultProfile.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,79 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class is the default implementation of {@link Export.Profile} and + * serves information about the format used to create an export document. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultProfile implements Export.Profile { + /** + * Used to collect the required data from <code>Result</code> object. + */ protected Export.DataCollector collector; + + /** + * Column headers. + */ protected String [] header; + + /** + * + */ protected String [] names; + + /** + * Character used to separate columns. + */ protected char separator; + + /** + * Escape character. + */ protected char escapeCharacter; + + /** + * Quote character. + */ protected char quoteCharacter; + + /** + * Format type. + */ protected String type; + + /** + * Encoding used for export. + */ protected String encoding; - public DefaultProfile() { + /** + * Constructor + */ + private DefaultProfile() { } + /** + * Constructor + * + * @param header See {@link #header} + * @param separator See {@link #separator} + * @param escapeCharacter See {@link #escapeCharacter} + * @param quoteCharacter See {@link #quoteCharacter} + * @param type See {@link #type} + * @param encoding See {@link #encoding} + */ public DefaultProfile( String [] header, char separator, @@ -36,31 +90,70 @@ this.encoding = encoding; } + /** + * Returns the given value. + * + * @param index Index + * @param value Value + * + * @return value + */ public String toString(int index, String value) { return value; } + /** + * Returns the separator. + * + * @return Separator + */ public char getSeparator() { return separator; } + /** + * Returns the escape character. + * + * @return Escape character + */ public char getEscapeCharacter() { return escapeCharacter; } + /** + * Returns the quote character. + * + * @return Quote character. + */ public char getQuoteCharacter() { return quoteCharacter; } + /** + * Returns the format type. + * + * @return Type. + */ public String getType() { return type; } + /** + * Returns the encoding. + * + * @return Encoding + */ public String getEncoding() { return encoding; } + /** + * Returns the column headers. + * + * @return header + */ public String[] getHeader() { return header; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/Export.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/Export.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,40 +1,136 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.exception.StateException; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; + import java.util.Collection; -import java.io.OutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.exception.StateException; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This interface should be implemented by a class whose instances are intended + * to export a <code>Collection</code> of <code>Result</code>s into a specific + * format (e.g. CSV or ODV). + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public interface Export { + /** + * This interface provides some methods which describe the format used by an + * <code>Export</code>. + */ public interface Profile { + /** + * + * @param column Column index. + * @param value A default value. + * @return A specific column as string. + */ String toString(int column, String value); + + /** + * This method serves information about the character used to separate + * columns. + * + * @return Character used to separate + */ char getSeparator(); + + /** + * This method serves information about the character used as escape + * character. + * + * @return Escape character + */ char getEscapeCharacter(); + + /** + * This method serves informatin about the character used as quote + * character. + * + * @return Quote character + */ char getQuoteCharacter(); + + /** + * This method serves information about the format. + * + * @return Format as string. + */ String getType(); + + /** + * This method serves information about the encoding to be used. + * + * @return Encoding + */ String getEncoding(); + + /** + * This method returns the header as array. + * + * @return Header as string array. + */ String [] getHeader(); } + /** + * This interface should be implemeted to collect the required data from + * <code>Result</code> object. + */ public interface DataCollector { + + /** + * This method serves the required data stored in a <code>Result</code> + * object. + * + * @param result <code>Result</code> object which contains the required + * data. + * @return String[] which contains all required data. + * + * @throws StateException + */ String[] getData(Result result) throws StateException; } + /** + * This method creates an export document specified by {@link Profile} which + * contains the data stored in <code>result</code> and writes it to + * <code>outputStream</code>. + * + * @param profile Profile used to specify the format of the resulting export + * document. + * @param outputStream Resulting export document is written to this + * OutputStream. + * @param result Collection which contains the data used to be written into + * the export document. + * + * @throws IOException if an error occured while writing the export document + * to OutputStream + * @throws UnsupportedEncodingException if the given encoding is not + * accepted + * @throws StateException if <code>result</code> is null + */ public void create( Profile profile, - OutputStream outputStream, + OutputStream outputStream, Collection result ) throws IOException, UnsupportedEncodingException, StateException; } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ODVExport.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.exports; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.log4j.Logger; + +import au.com.bytecode.opencsv.CSVWriter; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; + +/** + * This class is used to create a specific export document which is similar to + * an CSV document. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class ODVExport extends DefaultExport { + + /** + * Logger used for logging via log4j. + */ + private static Logger log = Logger.getLogger(ODVExport.class); + + /** + * Collection of parameters. + */ + private Collection parameters = null; + + /** + * The TimeStime which should be integrated in the Export to mark a + * TimeSeries. + */ + private String startTime = null; + + /** + * Constructor + * @param collector DataCollector used to extract the required data. + * @param parameters A collection of parameters to be displayed in the + * export. + * @param startTime The TimeStamp which should ne integrated in the export + * to mark a TimeSeries. If it should not be a TimeSeries this Value must + * be null. + */ + public ODVExport(DataCollector collector, Collection parameters, String startTime) { + super(collector); + this.parameters = parameters; + this.startTime = startTime; + } + + + @Override + protected void writeData( + Profile profile, Collection result, CSVWriter writer + )throws StateException + { + Iterator<Result> it = result.iterator(); + log.debug("Put " + result.size() + " elements into odv export."); + + String[] header = profile.getHeader(); + ArrayList<String> headerList = new ArrayList<String>(); + for (int i= 0; i < header.length; i++){ + headerList.add(header[i]); + } + + if (this.startTime != null){ + headerList.add("time_ISO8601"); + } + ArrayList<String> paramids = new ArrayList<String>(); + + Map<StringArrayKey, Map<String,String>> aggregatedRows = + new HashMap<StringArrayKey, Map<String,String>>(); + + while (it.hasNext()) { + Result res = it.next(); + + String[] value = collector.getData(res); + StringArrayKey key = new StringArrayKey(value); + String parameterValue = res.getString("DATAVALUE"); + String parameterID = res.getString("PARAMETER"); + + if (!paramids.contains(parameterID)){ + paramids.add(parameterID); + headerList.add(findParamTitle(parameters, parameterID)); + headerList.add("QF"); + } + + Map<String,String> aggregatedRow = aggregatedRows.get(key); + if (aggregatedRow!= null){ + aggregatedRow.put(parameterID, parameterValue); + } + else{ + Map<String,String> params = new HashMap<String, String>(); + params.put(parameterID, parameterValue); + aggregatedRows.put(key, params); + } + } + + if (header != null){ + writer.writeNext(headerList.toArray(header)); + } + + Iterator<StringArrayKey> rows = aggregatedRows.keySet().iterator(); + while (rows.hasNext()){ + StringArrayKey row = rows.next(); + Map<String,String> params = aggregatedRows.get(row); + ArrayList<String> rowList = new ArrayList<String>(); + String[] rowArray = row.getValue(); + for (int i= 0; i < rowArray.length; i++){ + rowList.add(rowArray[i]); + } + if (this.startTime != null){ + String measurementtime = rowList.get(3).replace(' ','T'); + rowList.set(3, this.startTime.replace('.','-')); + rowList.add(measurementtime+":00.0"); + } + for (int i = 0; i < paramids.size();i++){ + String key = paramids.get(i); + String value = params.get(key); + if (value == null){ + value = ""; + } + rowList.add(value); + rowList.add("1"); + } + writer.writeNext(rowList.toArray(rowArray)); + } + } + + /** + * This method is used to search specific value coresponding to its key + * <code>id</code> and return its description. + * + * @param values Collection of parameters. + * @param id Key used to find the value. + * + * @return Description of searched value. + */ + protected String findParamTitle(Collection values, String id) { + log.debug("find description of dataset"); + + if (values != null){ + Iterator it = values.iterator(); + while (it.hasNext()) { + KeyValueDescibeData data = (KeyValueDescibeData) it.next(); + + if (id.equals(data.getKey())) + return data.getValue(); + } + } + return ""; + } + + +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,30 +1,60 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; +import com.vividsolutions.jts.geom.Point; + +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKTReader; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.exception.StateException; + import org.apache.log4j.Logger; -import com.vividsolutions.jts.io.WKTReader; -import com.vividsolutions.jts.io.ParseException; -import com.vividsolutions.jts.geom.Point; - -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.exception.StateException; - - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class is a specialization of <code>DefaultDataCollector</code>. The + * difference between these classes is, that this class extracts points served + * by a wkt string. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class ShapeDataCollector extends DefaultDataCollector { + /** + * Logger used for logging with log4j. + */ private Logger log = Logger.getLogger(ShapeDataCollector.class); + /** + * WKTReader to parse points from wkt strings. + */ protected WKTReader wktReader = new WKTReader(); + /** + * Constructor + * + * @param names Attributes used to be extracted. + */ public ShapeDataCollector(String[] names) { super(names); } - public String[] getData(Result result) + /** + * This method takes point from wkt strings as well and split them into x + * and y coordinate. + * + * @see de.intevation.gnv.exports.Export.DataCollector#getData(Result) + */ + public String[] getData(Result result) throws StateException { if (rd == null) @@ -34,7 +64,7 @@ String [] entries = new String[names.length+1]; int j = 0; for (int i = 0; i < names.length; i++) { - + if (names[i].equals("SHAPE")) { Point p = (Point)wktReader.read(result.getString("SHAPE")); @@ -55,3 +85,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,35 +1,77 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.exports; -import java.util.Date; +import com.vividsolutions.jts.geom.Point; + +import com.vividsolutions.jts.io.ParseException; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.exception.StateException; + import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.Date; + import org.apache.log4j.Logger; -import com.vividsolutions.jts.io.ParseException; -import com.vividsolutions.jts.geom.Point; - -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.exception.StateException; - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class is a specialization of {@link ShapeDataCollector} and turns + * furthermore a given datetime string into a specific format. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class SimpleOdvDataCollector extends ShapeDataCollector { + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(SimpleOdvDataCollector.class); + /** + * Constant field which defines the source format of a given datetime. + */ public static final String SRC_FORMAT = "yyyy.MM.dd HH:mm:ss"; + + /** + * Constant field which defines the target format of a given datetime. + */ public static final String DEST_FORMAT = "yyyy-MM-dd HH:mm"; + /** + * Source format. + */ public static DateFormat srcFormat = new SimpleDateFormat(SRC_FORMAT); + + /** + * Target format. + */ public static DateFormat destFormat = new SimpleDateFormat(DEST_FORMAT); + /** + * Constructor + * + * @param names See {@link #names} + */ public SimpleOdvDataCollector(String[] names) { super(names); } + /** + * Given datetime values which corresponds to the attribute key 'TIMEVALUE' + * are transformed from {@link #SRC_FORMAT} into {@link #DEST_FORMAT}. + * + * @see de.intevation.gnv.exports.Export.DataCollector#getData(Result) + */ public String[] getData(Result result) throws StateException { @@ -40,14 +82,14 @@ String [] entries = new String[names.length+1]; int j = 0; for (int i = 0; i < names.length; i++) { - + if (names[i].equals("SHAPE")) { Point p = (Point)wktReader.read(result.getString("SHAPE")); entries[j++] = ""+p.getX(); entries[j++] = ""+p.getY(); } - // Change the datetime format from yyyy.MM.dd HH:mm:ss to + // Change the datetime format from yyyy.MM.dd HH:mm:ss to // yyyy-MM-dd HH:mm else if (names[i].equals("TIMEVALUE")) { Date source = srcFormat.parse(result.getString(names[i])); @@ -72,3 +114,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/StringArrayKey.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.exports; +/** + * A simple Key Class for generating an syntetic key using the + * values of the given Stringarray and not the Hash of the Stringarray + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * + */ +public class StringArrayKey { + + /** + * The Stringarray which contains the Values. + */ + private String[] value = null; + + /** + * The Key which should be used to compare the Stringarrays. + */ + private String key = null; + + /** + * Constructor + * @param value the Value which should be used to generate the key + */ + public StringArrayKey(String[] value) { + this.value = value; + if (value != null){ + key = ""; + for (int i = 0; i < value.length; i++){ + key += value[i]; + } + } + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (obj instanceof StringArrayKey){ + return (((StringArrayKey)obj).key).equals(this.key); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return this.key.hashCode(); + } + + /** + * Returns the stored origin Values of the Key + * @return the stored origin Values of the Key + */ + public String[] getValue() { + return value; + } + + public String getKey() { + return key; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.exports; + +import com.vividsolutions.jts.geom.Coordinate; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; + +import java.util.Collection; +import java.util.Date; + +import org.apache.log4j.Logger; + +import au.com.bytecode.opencsv.CSVWriter; +import de.intevation.gnv.state.exception.StateException; + + +public class VerticalCrossODVExport implements Export { + + /** + * Constant field which defines the source format of a given datetime. + */ + public static final String SRC_FORMAT = "yyyy.MM.dd HH:mm:ss"; + + /** + * Constant field which defines the target format of a given datetime. + */ + public static final String DEST_FORMAT = "yyyy-MM-dd HH:mm"; + + /** + * Source format. + */ + public static DateFormat srcFormat = new SimpleDateFormat(SRC_FORMAT); + + /** + * Target format. + */ + public static DateFormat destFormat = new SimpleDateFormat(DEST_FORMAT); + + /** + * Logger used for logging via log4j. + */ + private static Logger logger = + Logger.getLogger(VerticalCrossODVExport.class); + + /** + * The path in coordinates. + */ + protected Coordinate[] coordinates; + + /** + * + */ + protected double cellHeight; + + /** + * + */ + protected double cellWidth; + + /** + * The raster array storing the values for a specific coordinate in a + * specific depth. + */ + protected double[] raster; + + /** + * The raster width. + */ + protected int width; + + /** + * The raster height. + */ + protected int height; + + /** + * The date of this export. + */ + protected String time; + + /** + * The constructor used to create a new export helper object. + */ + public VerticalCrossODVExport( + Coordinate[] coordinates, + double cellHeight, + double cellWidth, + double[] raster, + String time, + int width, + int height) + { + this.coordinates = coordinates; + this.cellHeight = cellHeight; + this.cellWidth = cellWidth; + this.raster = raster; + this.width = width; + this.height = height; + this.time = time; + } + + + /** + * + * @param profile The Profile used to create column headers. + * @param outputStream The stream where the odv data are written to. + * @param result Not used here, might be null. + */ + public void create( + Profile profile, + OutputStream outputStream, + Collection result) + throws + IOException, + UnsupportedEncodingException, + StateException + { + CSVWriter writer = new CSVWriter( + new OutputStreamWriter(outputStream, profile.getEncoding()), + profile.getSeparator(), + profile.getQuoteCharacter(), + profile.getEscapeCharacter()); + + writer.writeNext(profile.getHeader()); + + writeData(writer, time, coordinates, cellHeight, cellWidth, raster); + + writer.close(); + } + + protected void writeData( + CSVWriter writer, + String time, + Coordinate[] coordinates, + double cellHeight, + double cellWidth, + double[] raster) + { + if (logger.isDebugEnabled()) { + logger.debug("+++++++ ODV Export information ++++++++++"); + logger.debug("+ raster width: " + width); + logger.debug("+ raster height: " + height); + logger.debug("+ cell height: " + cellHeight); + logger.debug("+ cell width: " + cellWidth); + logger.debug("+ items in raster: " + raster.length); + logger.debug("+ number of coordinates: " + coordinates.length); + logger.debug("+++++++++++++++++++++++++++++++++++++++++"); + } + + String datetime = null; + try { + Date tmp = srcFormat.parse(time); + datetime = destFormat.format(tmp); + } + catch (ParseException pe) { + logger.error(pe, pe); + } + + double maxDepth = 0; + String[] row = new String[10]; + for (int i = 0; i < width; i++) { + row[0] = "GNVExport"; + row[1] = "Station_" + i; + row[2] = "*"; + row[3] = datetime; + row[4] = Double.toString(coordinates[i].x); + row[5] = Double.toString(coordinates[i].y); + row[6] = "0"; + + double depth = cellHeight * 0.5d; + for (int j = i; j < raster.length; j += width, depth += cellHeight) { + if (j == (i+width)) { + row[0] = ""; + row[1] = ""; + row[2] = ""; + row[3] = ""; + row[4] = ""; + row[5] = ""; + row[6] = ""; + } + + double value = raster[j]; + + row[7] = Double.toString(depth); + row[8] = "1"; + row[9] = Double.toString(value); + + maxDepth = maxDepth >= depth ? maxDepth : depth; + + if (Double.isNaN(value)) { + break; + } + + writer.writeNext(row); + } + } + + logger.info("Detected max depth: " + maxDepth); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Handle different types of data exports (e.g. chart, csv, odv). +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/histogram/HistogramHelper.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/histogram/HistogramHelper.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,19 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.histogram; +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.artifacts.ressource.RessourceFactory; + +import de.intevation.gnv.chart.ChartLabels; + import de.intevation.gnv.geobackend.base.Result; import de.intevation.gnv.geobackend.base.ResultDescriptor; @@ -9,60 +23,44 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.apache.log4j.Logger; - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class supports some helper methods for histogram charts. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HistogramHelper { + /** + * Logger used for logging with log4j. + */ private static Logger logger = Logger.getLogger(HistogramHelper.class); + /** + * Disabled HistogramHelper constructor. This is a helper class and no + * instance should be instantiated from this class. + */ private HistogramHelper() { } -/* - public static Object[][] prepareHistogramData( - Collection input, - Collection parameters, - Collection measurements, - Collection dates - ) { - List<Double> values = new ArrayList<Double>(); - - ResultDescriptor rd; - int b1Idx, b2Idx, b3Idx, yIdx; - - Iterator it = parameters.iterator(); - KeyValueDescibeData param = (KeyValueDescibeData) it.hasNext(); - int parameter = param.getValue(); - - Iterator iter = input.iterator(); - while (iter.hasNext()) { - Result row = (Result) iter.next(); - - if (rd == null) { - rd = row.getResultDescriptor(); - b1Idx = rd.getColumnIndex("GROUP1"); - b2Idx = rd.getColumnIndex("GROUP2"); - b3Idx = rd.getColumnIndex("GROUP3"); - } - - if (row.getInteger(b1Idx) == parameter - && row.getInteger(b2Idx) == measurement) - { - - } - } - - return null; - } - */ - + /** + * This function prepare some input data and turns it into an array which is + * taken by {@link de.intevation.gnv.chart.DefaultHistogram}. + * + * @param input A collection with the data used to be displayed in a + * histogram + * @param parameters A collection with a bunch of parameters + * @param measurements A collection with a bunch of measurements + * @param dates A collection with a bunch of dates + * + * @return Object[][] containing raw data which can be used to create + * histograms + */ public static Object[][] prepareHistogramData( Collection input, Collection parameters, @@ -187,6 +185,19 @@ } + /** + * This method generates a string made up of parameter name and a + * measurement. + * + * @param break1 Id of a parameter. + * @param break2 Id of a measurement. + * @param break3 Id of a date. + * @param parameters A collection with a bunch of parameters. + * @param measurements A collection with a bunch of measurements. + * @param dates A collection with a bunch of dates. + * + * @return Concatenated string (${parametername} + ${measurement} + m). + */ protected static String generateName( String break1, String break2, String break3, Collection parameters, Collection measurements, Collection dates) @@ -196,6 +207,15 @@ } + /** + * Find a value with the given <code>id</code> and return its description. + * + * @param values A collection which contains the value we are searching for + * @param id Id of the value + * + * @return String representation of the value. An empty string is returned + * if no value have been found with the given id. + */ protected static String findValueTitle(Collection values, String id) { if (values != null) { Iterator it = values.iterator(); @@ -210,5 +230,113 @@ } return ""; } + + + /** + * Creates and returns labels to decorate histograms. + * + * @param uuid The UUID of the current artifact. + * @param context The CallContext object. + * @param data An array storing strings. + * @return A ChartLabels object with the 1st string in <i>data</i> as title. + */ + public static ChartLabels createHistogramLabels( + String uuid, CallContext context, Locale locale, Object[] data) + { + RessourceFactory fac = RessourceFactory.getInstance(); + + return new ChartLabels( + (String) data[0], + "", + "", + fac.getRessource(locale, "histogram.axis.range.title", "")); + } + + + public static Object[][] prepareVectorialHistogramData(Collection input) { + List names = new ArrayList<String>(); + List data = new ArrayList<Double[]>(); + + if (logger.isDebugEnabled()) { + logger.debug("######### prepare vectorial histogram data #######"); + logger.debug("Input data size: " + input.size()); + } + + if (input == null) { + return new Object[0][0]; + } + + int sIdx = -1; + int yIdx = -1; + + String series = null; + + try { + Iterator iter = input.iterator(); + + if (iter.hasNext()) { + Result row = (Result) iter.next(); + Result previousRow = row; + + if (sIdx == -1 || yIdx == -1) { + ResultDescriptor rd = row.getResultDescriptor(); + sIdx = rd.getColumnIndex("SERIES"); + yIdx = rd.getColumnIndex("YORDINATE"); + + if (sIdx == -1 || yIdx == -1) { + return new Object[0][0]; + } + } + + List values = new ArrayList<Double>(); + while (iter.hasNext()) { + row = (Result) iter.next(); + + // found new series + if (series != null && !series.equals(row.getString(sIdx))) { + + // add values and parameter name + data.add((Double[]) + values.toArray(new Double[values.size()])); + names.add(series); + + if (logger.isDebugEnabled()) { + logger.debug(" --- series name: " + series); + logger.debug(" --- series items: " + values.size()); + } + + values.clear(); + } + + Double value = row.getDouble(yIdx); + if (value != null) + values.add(value); + + series = row.getString(sIdx); + } + + if (logger.isDebugEnabled()) { + logger.debug(" --- series name: " + series); + logger.debug(" --- series items: " + values.size()); + } + + data.add((Double[]) values.toArray(new Double[values.size()])); + names.add(series); + } + } + catch (Exception e) { + logger.error(e.getMessage(), e); + } + + int count = data.size(); + logger.debug(" === Found total: " + count); + Object[][] obj = new Object[count][2]; + for (int i = 0; i < count; i++) { + obj[i][0] = names.get(i); + obj[i][1] = (Double[]) data.get(i); + } + + return obj; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/histogram/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Helper classes used while histogram creation. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,45 +1,103 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; import java.io.Serializable; /** - * @author Sascha Teichmann <sascha.teichmann@intevation.de> - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This class is used to represent geometries (e.g. point, line, polygon). Each + * geometry is made up of multiple xy points stored in a single array. A line + * composed by start- and endpoint is stored in the following order in that + * array: [x1, y1, x2, y2]. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class CompactXYItems implements Serializable { + /** + * Array storing the xy items. + */ protected double [] data; + /** + * Constructs a new CompactXYItems object with the given data. + * + * @param data An array with xy values. + */ public CompactXYItems(double [] data) { this.data = data; } + /** + * Retrieves the x coordinate of the point with the given index. + * + * @param index Index + * @return X coordinate. + */ public double getX(int index) { return data[index << 1]; } + /** + * Retrieves the y coordinate of the point with the given index. + * + * @param index Index + * @return Y coordinate. + */ public double getY(int index) { return data[(index << 1)+1]; } + /** + * Write the tupel of xy-values at a specific index into the given array. + * + * @param index Index used to specify the xy-value. + * @param xy the xy coordinate is written into this array with the following + * order: [x,y] + */ public void get(int index, double [] xy) { xy[0] = data[index = (index << 1) + 1]; xy[1] = data[index + 1]; } + /** + * + * @return the data array. + */ public double [] getData() { return data; } + /** + * + * @param data + */ public void setData(double [] data) { this.data = data; } + /** + * + * @return the number of data points. + */ public int size() { return data.length >> 1; } + /** + * Retrieves the bounding box spaned by the coordinates in the data array. + * + * @param bbox + * @return the calculated bounding box. + */ public double [] calculateBoundingBox(double [] bbox) { for (int i = 0; i < data.length;) { double x = data[i++]; @@ -52,6 +110,11 @@ return bbox; } + /** + * + * @return the coordinates as string. + */ + @Override public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.length;) { @@ -66,6 +129,10 @@ } + /** + * + * @return the lowest x value. + */ public double getMinX() { double lower = Double.POSITIVE_INFINITY; @@ -81,6 +148,10 @@ } + /** + * + * @return the highest x value. + */ public double getMaxX() { double upper = Double.NEGATIVE_INFINITY; @@ -96,6 +167,10 @@ } + /** + * + * @return the lowest y value. + */ public double getMinY() { double lower = Double.POSITIVE_INFINITY; @@ -111,6 +186,10 @@ } + /** + * + * @return the highest y value. + */ public double getMaxY() { double upper = Double.NEGATIVE_INFINITY;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,31 +1,46 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; import java.util.LinkedList; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class LevelOrderIndices { public interface Visitor { + Object visit(int index); } + protected int from; + protected int to; + public LevelOrderIndices() { } + public LevelOrderIndices(int to) { this(0, to); } + public LevelOrderIndices(int from, int to) { this.from = Math.min(from, to); this.to = Math.max(from, to); } + public Object visit(Visitor visitor) { LinkedList<int[]> queue = new LinkedList<int[]>();
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,30 +1,58 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import java.util.Collection; -import java.util.ArrayList; import org.jfree.data.Range; + import org.jfree.data.general.AbstractSeriesDataset; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * An implementation of {@link org.jfree.data.xy.XYDataset} to create 2D charts. + * This dataset contains several <code>PolygonSeries</code> and is used by + * <code>PolygonRenderer</code> to draw its items into a 2D chart. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class PolygonDataset extends AbstractSeriesDataset { - /** PolygonSeries included in this Dataset */ + /** + * PolygonSeries included in this Dataset + */ private List data; + /** + * Constructor. + */ public PolygonDataset() { data = new ArrayList(); } + /** + * Constructs a new PolygonDataset containing multiple PolygonSeries. + * + * @param series A collection containing some PolygonSeries. + */ public PolygonDataset(Collection series) { data = new ArrayList(series); } + /** + * Constructs a PolygonDataset with a single PolygonSeries. + * + * @param series A PolygonSeries. + */ public PolygonDataset(PolygonSeries series) { this(); @@ -34,6 +62,10 @@ } + /** + * + * @param series + */ public void addSeries(PolygonSeries series) { if (series == null) throw new IllegalArgumentException("Null 'series' argument."); @@ -41,10 +73,19 @@ data.add(series); } + /** + * + * @param series + */ public void addAllSeries(Collection<PolygonSeries> series) { data.addAll(series); } + /** + * Retrieves the x-axis range of all PolygonSeries in this dataset. + * + * @return range of the x-axis. + */ public Range getDomainBounds() { double lower = Double.POSITIVE_INFINITY; double upper = Double.NEGATIVE_INFINITY; @@ -69,6 +110,11 @@ } + /** + * Retrieves the y-axis range of all PolygonSeries in this dataset. + * + * @return the y-axis range. + */ public Range getRangeBounds() { double lower = Double.POSITIVE_INFINITY; double upper = Double.NEGATIVE_INFINITY; @@ -93,16 +139,32 @@ } + /** + * Returns the number of series in this dataset. + * + * @return the number of series in this dataset. + */ public int getSeriesCount() { return data.size(); } - public Comparable getSeriesKey(int series) { - return ((PolygonSeries)data.get(series)).getKey(); + /** + * Returns the key for a series. + * + * @param index Index of a specific series. + * @return the series key of the series with the given index. + */ + public Comparable getSeriesKey(int index) { + return ((PolygonSeries)data.get(index)).getKey(); } + /** + * + * @param idx Index. + * @return the series with the given index. + */ public PolygonSeries getSeries(int idx) { return (PolygonSeries)data.get(idx); }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; import java.awt.AlphaComposite; @@ -20,9 +28,9 @@ import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.Plot; +import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.PlotState; -import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.Range; @@ -32,7 +40,10 @@ import org.jfree.util.ObjectList; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * A class for plotting polygons into a 2D chart. This plot makes use of <code> + * PolygonRenderer</code>. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ // TODO implement cloneable public class PolygonPlot @@ -56,11 +67,22 @@ private ObjectList rangeAxes; + /** + * Constructs a new PolygonPlot with a dataset and a renderer. + * + * @param dataset Dataset containing polygons. + * @param renderer The renderer used to draw polygons. + */ public PolygonPlot(PolygonDataset dataset, PolygonRenderer renderer) { this(dataset, renderer, null, null, PlotOrientation.HORIZONTAL); } + /** + * @param dataset Dataset containing polygons. + * @param renderer The renderer used to draw polygons. + * @param orientation The orientation used for this plot. + */ public PolygonPlot( PolygonDataset dataset, PolygonRenderer renderer, @@ -70,6 +92,13 @@ } + /** + * @param dataset Dataset containing polygons. + * @param renderer The renderer used to draw polygons. + * @param domainAxis The x axis. + * @param rangeAxis The y axis. + * @param orientation The orientation used for this plot. + */ public PolygonPlot( PolygonDataset dataset, PolygonRenderer renderer, @@ -127,6 +156,10 @@ return getDomainAxis(0); } + public void setDomainAxis(ValueAxis axis) { + domainAxes.set(0, axis); + } + public ValueAxis getDomainAxis(int index) { return index < domainAxes.size() ? (ValueAxis)domainAxes.get(index) @@ -137,6 +170,10 @@ return getRangeAxis(0); } + public void setRangeAxis(ValueAxis axis) { + rangeAxes.set(0, axis); + } + public ValueAxis getRangeAxis(int index) { return index < rangeAxes.size() ? (ValueAxis)rangeAxes.get(index) @@ -157,22 +194,28 @@ } } - public PolygonDataset getDataset(){ return this.dataset; } - public String getPlotType() { return PLOT_TYPE; } - public void setDataset(PolygonDataset dataset) { this.dataset = dataset; } + /** + * This is the major method to draw the into a given Graphic2D object. + * + * @param g2 Graphics object where the plot is drawn into. + * @param area The bounds for drawing this plot. + * @param anchor An anchor point. + * @param parentState The plot state. + * @param info + */ public void draw( Graphics2D g2, Rectangle2D area, @@ -203,7 +246,7 @@ AlphaComposite.SRC_OVER, getForegroundAlpha() )); - + // draw axis drawAxes(g2, area, dataArea, info); @@ -218,6 +261,14 @@ } + /** + * Method to draw the axis for this plot. + * + * @param g2 + * @param plotArea + * @param dataArea + * @param plotState + */ private void drawAxes( Graphics2D g2, Rectangle2D plotArea, @@ -290,6 +341,14 @@ } + /** + * Put some labels at data items into the plot. Uses PolygonRenderer to do + * this job. + * + * @param g2 + * @param area + * @param info + */ private void drawLabels( Graphics2D g2, Rectangle2D area, @@ -298,6 +357,14 @@ renderer.drawLabels(g2, this, area, dataset); } + + /** + * Plot the polygons. Uses PolygonRenderer to do this job. + * + * @param g2 + * @param area + * @param info + */ private void drawPolygons( Graphics2D g2, Rectangle2D area, @@ -358,6 +425,7 @@ return space; } + public RectangleEdge getDomainAxisEdge() { return Plot.resolveDomainAxisLocation( getDomainAxisLocation(), orientation @@ -425,6 +493,10 @@ } + /** + * @return true, if dataset is null or if it does not contain any + * PolygonSeries, otherwise false. + */ private boolean isEmptyOrNull(PolygonDataset dataset) { if (dataset != null) { int seriesCount = dataset.getSeriesCount(); @@ -438,3 +510,4 @@ return true; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,81 +1,129 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; -import java.util.ArrayList; - +import java.awt.BasicStroke; import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Shape; -import java.awt.BasicStroke; -import java.awt.FontMetrics; -import java.awt.Font; import java.awt.geom.GeneralPath; + +import java.awt.geom.Rectangle2D.Double; + import java.awt.geom.Rectangle2D; -import java.awt.geom.Rectangle2D.Double; + +import java.util.ArrayList; + +import org.apache.log4j.Logger; + +import org.jfree.chart.axis.ValueAxis; import org.jfree.data.Range; -import org.jfree.chart.axis.ValueAxis; +import org.jfree.text.TextUtilities; import org.jfree.ui.RectangleEdge; -import org.apache.log4j.Logger; - -import org.jfree.text.TextUtilities; - - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This renderer is used to draw polygons into a Graphics object. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class PolygonRenderer { private static Logger log = Logger.getLogger( PolygonRenderer.class); - public interface PaintLookup { + /** + * This interfaces describes a single method to retrieve a Paint object + * for a given index. + */ + public interface PaintLookup { - Paint getPaint(int index); + /** + * + * @param index Index. + * @return Paint + */ + Paint getPaint(int index); } // interface PaintLookup - public static class DefaultLabelGenerator + /** + * This class is used to generate labels for a given series. + */ + public static class DefaultLabelGenerator implements PolygonSeriesLabelGenerator { - public DefaultLabelGenerator() { + /** + * Construts an empty DefaultLabelGenerator. + */ + public DefaultLabelGenerator() { } - public String generateLabel(PolygonSeries series) { + /** + * + * @param series A PolygonSeries. + * @return The label of series. + */ + public String generateLabel(PolygonSeries series) { Object label = series.getAttribute("label"); return label != null ? toString(label) : null; } - protected String toString(Object label) { + /** + * + * @param label Object + * @return String representaton of label. + */ + protected String toString(Object label) { return label.toString(); } } // class DefaultLabelGenerator - public static final PolygonSeriesLabelGenerator + /** + * Constructor. + */ + public static final PolygonSeriesLabelGenerator DEFAULT_LABEL_GENERATOR_INSTANCE = new DefaultLabelGenerator(); - protected PaintLookup lookup; + protected PaintLookup lookup; + protected PolygonSeriesLabelGenerator labelGenerator; + public PolygonRenderer(PaintLookup lookup) { this(lookup, null); } + public PolygonRenderer( - PaintLookup lookup, + PaintLookup lookup, PolygonSeriesLabelGenerator labelGenerator ) { this.lookup = lookup; this.labelGenerator = labelGenerator; } + /** + * This method draws polygons of each series in <code>dataset</code> into + * the given graphics object. If a polygon has no attribute 'fill', we + * expect that it is a line, otherwise the polygon is filled. + * + */ public void drawPolygons( Graphics2D graphics, PolygonPlot plot, @@ -103,6 +151,11 @@ } } + /** + * Draw labels at each item of a series in the given dataset. If the series + * has no label attritue, no label is drawn. + * + */ public void drawLabels( final Graphics2D graphics, final PolygonPlot plot, @@ -135,7 +188,7 @@ final CompactXYItems ring = series.getItem(j); LevelOrderIndices loi = new LevelOrderIndices(ring.size()-1); Rectangle2D r = (Rectangle2D)loi.visit( - new LevelOrderIndices.Visitor() + new LevelOrderIndices.Visitor() { ValueAxis da = plot.getDomainAxis(); ValueAxis ra = plot.getRangeAxis(); @@ -145,7 +198,7 @@ 0d, 0d, box.getWidth(), box.getHeight()); public Object visit(int index) { - r.x = da.valueToJava2D(ring.getX(index), area, de) + r.x = da.valueToJava2D(ring.getX(index), area, de) - 0.5*box.getWidth(); r.y = ra.valueToJava2D(ring.getY(index), area, re) + 0.5*box.getHeight(); @@ -168,10 +221,20 @@ } // for all series } + /** + * Creates a shape made up of the CompactXYItems object stored in the given + * series. + * + * @param plot The plot. + * @param area The boundary. + * @param series The series storing the items. + * @param close Specifies if the polygon should be closed or not. + * @return the constructed shape. + */ protected Shape constructShape( PolygonPlot plot, Rectangle2D area, - PolygonSeries series, + PolygonSeries series, boolean close ) { ValueAxis da = plot.getDomainAxis(); @@ -205,6 +268,9 @@ return path; } + /** + * Retrieves the bounding box of a dataset. + */ public Rectangle2D getBoundingBox(PolygonDataset dataset) { Rectangle2D bbox = null; @@ -228,6 +294,10 @@ return bbox; } + /** + * + * @return the bounds of a series. + */ public Rectangle2D getBounds(PolygonSeries series) { Range domain = series.getDomainBounds();
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,35 +1,74 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; +import java.util.HashMap; import java.util.Map; -import java.util.HashMap; import org.jfree.data.Range; + import org.jfree.data.general.Series; /** - * @author Sascha Teichmann <sascha.teichmann@intevation.de> - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This class represents a series of polygon items. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class PolygonSeries extends Series { + /** + * Polygons. + */ protected CompactXYItems [] rings; + + /** + * A map containing attribues. + */ protected Map attributes; + /** + * The unique key of this series. + */ private static long uniqueKey; + /** + * + * @return a unique key. + */ protected synchronized static Long createUniqueKey() { return new Long(uniqueKey++); } + /** + * Constructor to create an empty PolygonSeries with a unique key. + */ public PolygonSeries() { this(createUniqueKey(), null); } + /** + * + * @param key The key used for this series. + * @param rings Polygons. + */ public PolygonSeries(Comparable key, CompactXYItems [] rings) { this(key, null, rings, new HashMap()); } + /** + * + * @param key The key used for this series. + * @param description A description of this series. + * @param rings Polygons. + */ public PolygonSeries( Comparable key, String description, @@ -38,6 +77,13 @@ this(key, description, rings, new HashMap()); } + /** + * + * @param key The key used for this series. + * @param description A description of this series. + * @param rings Polygons. + * @param attributes Some attribues. + */ public PolygonSeries( Comparable key, String description, @@ -54,10 +100,12 @@ this.rings = rings; } + public CompactXYItems [] getRings() { return rings; } + public void addRing(CompactXYItems newRing) { if (rings == null) { rings = new CompactXYItems [] { newRing }; @@ -70,6 +118,7 @@ } } + public void addRings(CompactXYItems [] newRings) { if (newRings == null || newRings.length == 0) { return; @@ -86,6 +135,7 @@ } } + public Object getAttribute(Object key) { return attributes.get(key); } @@ -116,6 +166,10 @@ } + /** + * + * @return the range of the x axis. + */ public Range getDomainBounds() { double upper = Double.NEGATIVE_INFINITY; double lower = Double.POSITIVE_INFINITY; @@ -143,6 +197,10 @@ } + /** + * + * @return the range of the y axis. + */ public Range getRangeBounds() { double upper = Double.NEGATIVE_INFINITY; double lower = Double.POSITIVE_INFINITY;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,10 +1,25 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.jfreechart; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This interface describes a single method generating labels by given Series. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public interface PolygonSeriesLabelGenerator { + /** + * + * @param series The given series. + * @return A label for this series. + */ String generateLabel(PolygonSeries series); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes and interfaces used to create 2D charts. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/layer/LayerArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/layer/LayerArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,23 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.layer; import org.apache.log4j.Logger; import org.w3c.dom.Document; import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; import de.intevation.gnv.artifacts.GNVArtifactBase; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Artifact used for Product Layer. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class LayerArtifact extends GNVArtifactBase{ @@ -19,7 +25,7 @@ * the logger, used to log exceptions and additionally information */ private static Logger log = Logger.getLogger(LayerArtifact.class); - + /** * The UID of this Class */ @@ -34,17 +40,17 @@ 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) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("LayerArtifact.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/layer/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes providing specific artifacts representing +Layer. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; @@ -15,36 +23,75 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Does an area interpolation for "Horizontalschnitte". + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class AreaInterpolation implements Serializable { private static Logger log = Logger.getLogger(AreaInterpolation.class); + /** + * The generated raster. + */ protected double [] raster; + /** + * The width of the raster. + */ protected int width; + /** + * The height of the raster. + */ protected int height; + /** + * Default constructor. + */ public AreaInterpolation() { } + /** + * Returns the width of the generated raster. + * @return the width of the raster. + */ public int getWidth() { return width; } + /** + * Returns the height of the raster. + * @return The height of the raster. + */ public int getHeight() { return height; } + /** + * The generated raster. + * @return the raster. + */ public double [] getRaster() { return raster; } + /** + * Epsilon for numerical stability. + */ public static final double EPS = 1e-6d; + /** + * Fills a raster by interpolating the input values. + * @param points The attributed input values. + * @param boundingBox The world area where to interpolate. + * @param samples The width and height of the raster. + * @param depth The callback to query the depth at a given point. + * @param extrapolationRounds Number of extrapolation point layers + * to generate before doing the interpolation. + * @return true if the interpolation succeeds else false. + */ public boolean interpolate( List<? extends Point2d> points, Envelope boundingBox, @@ -149,7 +196,8 @@ long stopTime = System.currentTimeMillis(); if (debug) { - log.debug("interpolation took: " + (stopTime - startTime)/1000f + " secs"); + log.debug("interpolation took: " + + (stopTime - startTime)/1000f + " secs"); } this.raster = raster;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.MultiLineString; @@ -12,30 +20,73 @@ import java.util.Map; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Stores the results of an area interpolation. + * Used to generate the final products. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class AttributedPoint2ds implements Serializable { + /** + * The list of input points. + */ protected List<? extends Point2d> points; + + /** + * The map of input attributes that are need to generate + * the products. + */ protected Map attributes; + + /** + * The interpolation result. + */ protected AreaInterpolation interpolation; + + /** + * The JTS multi line strings to be written by GeoTools later. + */ protected List<Pair<Object, MultiLineString>> lineStrings; + + /** + * The JTS multi polygons to be written by GeoTools later. + */ protected Map<Integer, MultiPolygon> polygons; + /** + * Default constructor. + */ public AttributedPoint2ds() { } + /** + * Constructor to create a AttributedPoint2ds with a list + * of input points. + * + * @param points The input points. + */ public AttributedPoint2ds(List<? extends Point2d> points) { this.points = points; } + /** + * Returns an attribute from the map of external attributes. + * @param key The key of the attribute. + * @return The attribute or null if the attribute was not found. + */ public Object getAttribute(Object key) { return attributes != null ? attributes.get(key) : null; } + /** + * Stores an attribute under a given key in + * the map of external attributes. + * @param key The key of the attribute. + * @param value The attribute value. + */ public void setAttribute(Object key, Object value) { if (attributes == null) { attributes = new HashMap(); @@ -43,36 +94,68 @@ attributes.put(key, value); } + /** + * Returns the input points. + * @return The input points. + */ public List<? extends Point2d> getPoints() { return points; } + /** + * Sets the input points. + * @param points The input points. + */ public void setPoints(List<? extends Point2d> points) { this.points = points; } + /** + * Sets the area interpolation result. + * @param interpolation The new interpolation result. + */ public void setInterpolation(AreaInterpolation interpolation) { this.interpolation = interpolation; } + /** + * Returns the area interpolation result. + * @return The interpolation result. + */ public AreaInterpolation getInterpolation() { return interpolation; } + /** + * Sets the produced JTS multi polygons. + * @param polygons The multi polygons. + */ public void setPolygons(Map<Integer, MultiPolygon> polygons) { this.polygons = polygons; } + /** + * Returns the JTS multi polygons. + * @return The polygons. + */ public Map<Integer, MultiPolygon> getPolygons() { return polygons; } + /** + * Set the produced JTS multi line strings. + * @param lineStrings The line strings. + */ public void setLineStrings( List<Pair<Object, MultiLineString>> lineStrings ) { this.lineStrings = lineStrings; } + /** + * Returns the produced JTS multi line strings. + * @return The line strings. + */ public List<Pair<Object, MultiLineString>> getLineStrings() { return lineStrings; }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,43 +1,98 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; -import java.util.Map; -import java.util.HashMap; -import java.util.List; +import de.intevation.gnv.jfreechart.PolygonDataset; import java.io.Serializable; -import de.intevation.gnv.jfreechart.PolygonDataset; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Stores the results of a 3D interpolation. Used to generate the final + * products. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class AttributedXYColumns implements Serializable { + /** + * The list of height value column. + */ protected List<? extends XYColumn> columns; + + /** + * The extra input attributes which are not relevant + * for the interpolation but for generating the results. + */ protected Map attributes; + + /** + * The interpolation result. + */ protected Interpolation3D interpolation; + + /** + * Dataset to be used in a {@link de.intevation.gnv.jfreechart.PolygonPlot}. + */ protected PolygonDataset dataset; + /** + * Default constructor. + */ public AttributedXYColumns() { } + /** + * Constructor to create a AttributedXYColumns instance only + * with the height value columns. + * @param columns The height value columns. + */ public AttributedXYColumns(List<? extends XYColumn> columns) { this(columns, null); } - public AttributedXYColumns(List<? extends XYColumn> columns, Map attributes) { + /** + * Constructor to create a AttributedXYColumns with + * height value columns and the attributes to be used to + * generate the results. + * @param columns The height value columns. + * @param attributes The external attributes. + */ + public AttributedXYColumns( + List<? extends XYColumn> columns, + Map attributes + ) { this.columns = columns; this.attributes = attributes; } + /** + * Gets an attribute. + * @param key The key of the attribute. + * @return The attribute or null if no such attribue is found. + */ public Object getAttribute(Object key) { return attributes != null ? attributes.get(key) : null; } + /** + * Puts an attribute to the map of external attributes. + * @param key The key of the attribute. + * @param value The value of the attribute. + */ public void setAttribute(Object key, Object value) { if (attributes == null) { attributes = new HashMap(); @@ -45,28 +100,53 @@ attributes.put(key, value); } + /** + * Returns the list of height value columns. + * @return The list of height value columns. + */ public List<? extends XYColumn> getXYColumns() { return columns; } + /** + * Sets the list of height value columns. + * @param columns The new list of height value columns. + */ public void setXYColumns(List<? extends XYColumn> columns) { this.columns = columns; } + /** + * Sets the interpolation result. + * @param interpolation The new interpolation result. + */ public void setInterpolation(Interpolation3D interpolation) { this.interpolation = interpolation; } + /** + * Gets the interpolation results. + * @return The interpolation results. + */ public Interpolation3D getInterpolation() { return interpolation; } + /** + * Sets the generated polygon data set to be used in a + * {@link de.intevation.gnv.jfreechart.PolygonPlot}. + * @param dataset The polygon data set. + */ public void setPolygonDataset(PolygonDataset dataset) { this.dataset = dataset; } + /** + * Returns the polygon data set. + * @return The polygon data set. + */ public PolygonDataset getPolygonDataset() { return dataset; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/ConstantFunction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/ConstantFunction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,39 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import org.apache.commons.math.analysis.UnivariateRealFunction; /** - * @author Sascha L. Teichmann <sascha.teichmann@intevation.de> + * Models a constant function to be used in function evaluation. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class ConstantFunction implements UnivariateRealFunction { + /** + * The constant value. + */ protected double value; - + + /** + * Defaut constructor. + */ public ConstantFunction() { } + /** + * Constructor to create a ConstantFunction with + * a given constant value. + * @param value The constant value. + */ public ConstantFunction(double value) { this.value = value; } @@ -21,4 +42,4 @@ return value; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/ConstantXYDepth.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/ConstantXYDepth.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,38 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Instances of the implementation return a constant value. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class ConstantXYDepth implements XYDepth { + /** + * The constant depth. + */ protected double depth; + /** + * Default constructor. The constant depth = 0. + */ public ConstantXYDepth() { } + /** + * Construtor to create a ConstantXYDepth with a given depth. + * @param depth The constant depth. + */ public ConstantXYDepth(double depth) { this.depth = depth; } @@ -21,4 +41,4 @@ return depth; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/GridCell.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/GridCell.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.algorithm.CGAlgorithms; @@ -21,28 +29,51 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Spans a rectangle of points to be used in spatial indexing. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class GridCell implements Serializable { private static Logger log = Logger.getLogger(GridCell.class); + /** + * Callback for {@link com.vividsolutions.jts.index.SpatialIndex} + * to find a GridCell which contains a given point. + */ public static final class CellFinder implements ItemVisitor { + /** + * Stores the found GridCell. + */ public GridCell found; + /** + * The query point. + */ protected Point point; + /** + * Default constructor. + */ public CellFinder() { } + /** + * Prepares a spatial index lookup. + * @param center The query point. + */ public void prepare(Coordinate center) { found = null; point = GEOMETRY_FACTORY.createPoint(center); } + /** + * Called by the spatial index as a 2nd order filter. + * @param item The GridCell to test. + */ public void visitItem(Object item) { if (found == null) { GridCell cell = (GridCell)item; @@ -53,19 +84,47 @@ } } // class CellFinder + /** + * The first point. + */ public Point2d p1; + /** + * The second point. + */ public Point2d p2; + /** + * The third point. + */ public Point2d p3; + /** + * The fourth point. + */ public Point2d p4; + /** + * Polygon created from the four points. + */ protected Polygon polygon; + /** + * Geometry factory to create the query points and the polygons. + */ public static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory(); + /** + * Default constructor. + */ public GridCell() { } + /** + * Constructor to create a GridCell out of four given points.. + * @param p1 The first point. + * @param p2 The second point. + * @param p3 The thrid point. + * @param p4 The fourth point. + */ public GridCell(Point2d p1, Point2d p2, Point2d p3, Point2d p4) { this.p1 = p1; this.p2 = p2; @@ -74,6 +133,9 @@ createPolygon(); } + /** + * Creates the polygon from the four points. + */ protected void createPolygon() { Coordinate [] coords = new Coordinate [] { p1, p2, p3, p4, p1 }; if (!CGAlgorithms.isCCW(coords)) { @@ -93,20 +155,42 @@ polygon = GEOMETRY_FACTORY.createPolygon(shell, null); } + /** + * Returns the envelope of the four point polygon. + * @return the envelope. + */ public Envelope getEnvelope() { return polygon.getEnvelopeInternal(); } + /** + * Test if a given point is inside this grid cell. + * @param coord + * @return true, if this grid cell contains the given point - otherwise + * false. + */ public boolean contains(Geometry coord) { return polygon.contains(coord); } + /** + * Converts a list of points to a list of grid cells. + * @param points This list of points. + * @return This list of grid cells. + */ public static List<GridCell> pointsToGridCells( List<? extends Point2d> points ) { return pointsToGridCells(points, null); } + /** + * Converts a list of points to a list of grid cells. + * Points that are not in a relevant area are ignored. + * @param points The list of points. + * @param relevantArea The relevant area. + * @return The list of grid cells. + */ public static List<GridCell> pointsToGridCells( List<? extends Point2d> points, Envelope relevantArea @@ -125,6 +209,17 @@ { 0, -1 } // 7 }; + /** + * Generate points by extrapolating border points. + * @param rows (i, j) indexed map of points. + * @param minI min known i. + * @param maxI max known i. + * @param minJ min known j. + * @param maxJ max known j. + * @param rounds Deternine how many extra rings should be generated. + * @param relevantArea The relevant area. + * @return number of newly generated points. + */ public static int extrapolate( HashMap<Integer, HashMap<Integer, Point2d>> rows, int minI, int maxI, @@ -191,7 +286,8 @@ Point2d avg = Point2d.average(positions); if (avg != null && avg.near(positions) - && (relevantArea == null || relevantArea.contains(avg.x, avg.y))) { + && (relevantArea == null + || relevantArea.contains(avg.x, avg.y))) { avg.i = i; avg.j = j; avg.inverseDistanceWeighting(neighbors); @@ -211,6 +307,15 @@ return total; } + /** + * Converts a list of points to a list of grid cells. + * @param points The list of points. + * @param relevantArea The relevant area. If a point is + * not inside this area it is ignored during the build process. + * @param extrapolationRounds Number of extra point rings. + * 0 = no extrpolation. + * @return The list of grid cells. + */ public static List<GridCell> pointsToGridCells( List<? extends Point2d> points, Envelope relevantArea,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import java.io.Serializable; @@ -5,12 +13,19 @@ import java.util.Comparator; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> - * @author Sascha L. Teichmann <sascha.teichmann@intevation.de> + * An attributed height value. It holds a z value, a parameter value + * and a layer index. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class HeightValue implements Serializable { + /** + * Comparator to sort <code>HeightValue</code>s by their z value + * in reversed order. + */ public static final Comparator INV_Z_COMPARATOR = new Comparator() { public int compare(Object a, Object b) { HeightValue ha = (HeightValue)a; @@ -21,26 +36,56 @@ } }; + /** + * The height value. + */ public double z; + + /** + * The parameter value. + */ public double v; + + /** + * The layer index; + */ public int k; + /** + * Constructor to create a HeightValue with a given height, + * parameter value and layer index. + * @param z The height. + * @param v The parameter value. + * @param k The layer index. + */ public HeightValue(double z, double v, int k) { this.z = z; this.v = v; this.k = k; } + /** + * Return the height of this HeightValue. + * @return the height. + */ public double getZ() { return z; } + /** + * Return the parameter value of this HeightValue. + * @return The parameter value. + */ public double getV() { return v; } + /** + * Returns the layer index of this HeightValue. + * @return The layer index. + */ public double getK() { return k; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/IJKey.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/IJKey.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,51 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import java.io.Serializable; /** - * @author Sascha L. Teichmann <sascha.teichmann@intevation.de> + * Tuple (i, j) to model a pair of integers. Useful to store index pairs + * in maps. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class IJKey implements Serializable { + /** + * i component of the tuple. + */ public int i; + /** + * j component of the tuple. + */ public int j; + /** + * Default constructor. + */ public IJKey() { } + /** + * Constructor to set i and j. + * @param i The i component. + * @param j The j component. + */ public IJKey(int i, int j) { this.i = i; this.j = j; } + /** + * Orders i and j by their values. + */ public void sort() { if (i > j) { int t = i; @@ -27,13 +54,28 @@ } } + /** + * Hashes i and j into a common value. + * @return the hash code. + */ + @Override public int hashCode() { return (i << 16) | j; } + /** + * IJKeys are considered equal if the i and j components + * are equal. + * @param obj The other IJKey + * @return true if the IJKeys are equal else false. + */ + @Override public boolean equals(Object obj) { + if (!(obj instanceof IJKey)) { + return false; + } IJKey other = (IJKey)obj; return i == other.i && j == other.j; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; @@ -10,24 +18,51 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Interpolates along a given line string. This used to generate + * "horizontale Schnittprofile". + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public final class Interpolation2D { private static Logger log = Logger.getLogger(Interpolation2D.class); + /** + * If the number of input points are over this threshold + * some culling strategies are applied to reduce the amount of points. + */ public static final int CULL_POINT_THRESHOLD = Integer.getInteger( "gnv.interpolation2d.cull.point.threshold", 1000); + /** + * Numerical stability epsilon. + */ public static final double EPS = 1e-6d; + /** + * Callback to send the interpolated values back to the + * caller without building large temporary strcutures. + */ public interface Consumer { + /** + * Sends an interpolated point back to the called. + * The interpolated parameter is stored in the z component. + * @param point The interpolated point. + * @param success true if interpolation at the point + * succeed, else false. + */ void interpolated(Coordinate point, boolean success); } // interface Consumer private Interpolation2D() { } + /** + * Calculates the relevant area for a given line string. + * @param path The line string. + * @param points The sample points. + * @return The relevant area. + */ public static final Envelope relevantArea( List<? extends Coordinate> path, List<? extends Coordinate> points @@ -35,6 +70,12 @@ return relevantArea(path, points, CULL_POINT_THRESHOLD); } + /** + * Calculates the relevant area for a given bounding box. + * @param pathBBox The bounding box. + * @param points The sample points. + * @return The relevant area. + */ public static final Envelope relevantArea( Envelope pathBBox, List<? extends Coordinate> points @@ -42,6 +83,14 @@ return relevantArea(pathBBox, points, CULL_POINT_THRESHOLD); } + /** + * Calculates the relevant area for a given bounding box. + * @param pathBBox The bounding box. + * @param points The sample points. + * @param threshold If the number of sample points + * are below this threshold no relevant area is calculated. + * @return The relevant area. + */ public static final Envelope relevantArea( Envelope pathBBox, List<? extends Coordinate> points, @@ -54,6 +103,14 @@ pointsBoundingBox(points)); } + /** + * Calculates the relevant area for a given line string. + * @param path The line string. + * @param points The sample points. + * @param threshold If the number of sample points + * are below this threshold no relevant area is calculated. + * @return The relevant area. + */ public static final Envelope relevantArea( List<? extends Coordinate> path, List<? extends Coordinate> points, @@ -66,6 +123,12 @@ pointsBoundingBox(points)); } + /** + * Heuristic function to define a 'relevant area'. + * @param pathBBox The bounding box of the line line string. + * @param pointsBBox The bounding box of the sample points. + * @return The relevant area. + */ public static final Envelope relevantArea( Envelope pathBBox, Envelope pointsBBox @@ -90,6 +153,13 @@ return pathBBox; } + /** + * Solves quadratic equation a*x*x + b*x + c = 0. + * @param a a-coefficent. + * @param b b-coefficent + * @param c c-coefficent. + * @return the solution of the equation, or null if not solvable. + */ public static final double [] solveQuadratic( double a, double b, double c ) { @@ -103,11 +173,22 @@ return new double [] { a*(b + d), a*(b - d) }; } + /** + * Return the element of a two element array which + * is greater or equal zero. + * @param x The two values. + * @return The value which is greater or equal zero. + */ public static final double pos(double [] x) { return x[0] >= 0 ? x[0] : x[1]; } + /** + * Calculates the bounding box of a given line string. + * @param path The line string. + * @return The bounding box. + */ public static Envelope pointsBoundingBox( List<? extends Coordinate> path ) { @@ -121,6 +202,19 @@ return area; } + /** + * Interpolates linearly a number of coordinates and parameter values along + * a given line string path. The results are issued to a consumer. + * @param path The line string path. + * @param points The sample points. + * @param from Start point as a scalar value linear + * referenced on the line string. + * @param to End point of as a scalar value linear + * referenced on the line string. + * @param steps Number of points to be interpolated. + * @param metrics The used metric. + * @param consumer The callback to retrieve the result points. + */ public static void interpolate( List<? extends Coordinate> path, List<? extends Point2d> points, @@ -176,7 +270,7 @@ continue; } queryBuffer.init( - center.x - EPS, center.x + EPS, + center.x - EPS, center.x + EPS, center.y - EPS, center.y + EPS); finder.prepare(center); @@ -220,11 +314,21 @@ } if (debug) { - log.debug("interpolations: " + + log.debug("interpolations: " + interpolations + " / " + missedInterpolations); } } + /** + * Linear interpolate a value between (x1, y1) and (x2, y2) at + * a given x-value. + * @param x1 x component of first point. + * @param y1 y component of first point. + * @param x2 x component of second point. + * @param y2 y component of second point. + * @param x The x value. + * @return The intepolated result. + */ public static final double interpolate( double x1, double y1, double x2, double y2, @@ -238,4 +342,4 @@ return m*x + b; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; @@ -15,64 +23,151 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Interpolates parameter values along a given line string from surface + * to the sea ground to generate "Profilschnitte". + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class Interpolation3D implements Serializable { private static Logger log = Logger.getLogger(Interpolation3D.class); + /** + * The default width of the interpolation: {@value} + */ public static final int DEFAULT_WIDTH = 1024; + + /** + * The default height of the interpolation: {@value} + */ public static final int DEFAULT_HEIGHT = 768; + /** + * Epsilon for numerical stability. + */ public static final double EPS = 1e-6d; + /** + * The width of the interpolation. + */ protected int width; + + /** + * The height of the interpolation. + */ protected int height; + /** + * The cell width of the interpolation in world units. + */ protected double cellWidth; + + /** + * The cell height of the interpolation in world units. + */ protected double cellHeight; + /** + * The coordinates of the interpolation. + */ + protected Coordinate[] coordinates; + + /** + * The generated raster. + */ protected double [] raster; + + /** + * The sea ground depth along the line string. + */ protected double [] depths; + /** + * Default constructor. + */ public Interpolation3D() { this(DEFAULT_WIDTH, DEFAULT_HEIGHT); } + /** + * Constructor to create a Interpolation3D with a given size. + * @param size The size of the interpolation. + */ public Interpolation3D(Dimension size) { this(size.width, size.height); } + /** + * Constructor to create a Interpolation3D with a given size. + * @param width The width of the interpolation. + * @param height the height of the interpolation. + */ public Interpolation3D(int width, int height) { this.width = width; this.height = height; } + /** + * Returns the raster height of the interpolation. + * @return The raster height of the interpolation. + */ public int getHeight() { return height; } + /** + * Returns the raster width of the interpolation. + * @return The raster width of the interpolation. + */ public int getWidth() { return width; } + /** + * Returns the cell width of the interpolation in world units. + * @return The cell width of the interpolation in world units. + */ public double getCellWidth() { return cellWidth; } + /** + * Returns the cell height of the interpolation in world units. + * @return The cell height of the interpolation in world units. + */ public double getCellHeight() { return cellHeight; } + /** + * Returns the coordinates used for the interpolation. + * @return the coordinates used for the interpolation. + */ + public Coordinate[] getCoordinates() { + return coordinates; + } + + /** + * Returns the generated raster. + * @return The generated raster. + */ public double [] getRaster() { return raster; } + /** + * Returns the depths along the line string path. + * @return The depth along the line string path. + */ public double [] getDepths() { return depths; } + /** + * Returns the deepest depth along the line string path. + * @return The deepest depth along the line string path. + */ public double getMaxDepth() { double maxDepth = Double.MAX_VALUE; for (int i = depths!=null?depths.length-1:0; i >= 0; --i) { @@ -84,6 +179,17 @@ return maxDepth; } + /** + * Interpolates parameters along a given line string path from the surface + * to the sea ground. + * @param path The line string path. + * @param points The sample points. + * @param from Start point in scalar terms of the line string. + * @param to End point in scalar terms of the line string. + * @param metrics The used metric. + * @param xyDepth The callback to query the depth at a given point. + * @return true if the interpolation succeeds, else false. + */ public boolean interpolate( List<? extends Coordinate> path, List<? extends XYColumn> points, @@ -127,6 +233,8 @@ double [] depths = new double[width]; Arrays.fill(depths, Double.NaN); + Coordinate[] coordinates = new Coordinate[width]; + double cellWidth = (to - from)/width; double maxDepth = Double.MAX_VALUE; @@ -135,6 +243,7 @@ Coordinate center = new Coordinate(); for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) { if (linearToMap.locate(p, center)) { + coordinates[i] = (Coordinate) center.clone(); double depth = xyDepth.depth(center); depths[i] = depth; if (depth < maxDepth) { @@ -170,7 +279,7 @@ linearToMap.locate(p, center); queryBuffer.init( - center.x - EPS, center.x + EPS, + center.x - EPS, center.x + EPS, center.y - EPS, center.y + EPS); finder.prepare(center); @@ -224,18 +333,19 @@ center.y); raster[j] = value; } - // XXX: Adjusted depth to create no gap + // XXX: Adjusted depth to create no gap // between last value and ground. - depths[i] = z+0.5d*cellHeight; + depths[i] = z+0.5d*cellHeight; } // down the x/y column } // all along the track - this.depths = depths; - this.raster = raster; - this.cellWidth = cellWidth; - this.cellHeight = cellHeight; + this.coordinates = coordinates; + this.depths = depths; + this.raster = raster; + this.cellWidth = cellWidth; + this.cellHeight = cellHeight; return true; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,12 +1,29 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; /** - * @author Sascha L. Teichmann + * Implementations of this interface interpolate coordinates + * a line at a given point determined by a factor t (0 <= t <= 1).<br> + * If t = 0 the start point of the line is used.<br> + * If t = 1 the start point of the line is used. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public interface Interpolator { + /** + * Interpolates a point along a line with a given factor between 0 and 1. + * @param t The factor. + * @param v The result of the interpolation is stored in this coordinate. + */ void interpolate(double t, Coordinate v); } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,37 +1,78 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; +import com.vividsolutions.jts.geom.Coordinate; + import java.util.Comparator; -import com.vividsolutions.jts.geom.Coordinate; - /** - * @author Sascha L. Teichmann + * Compares two coordinates a and b by their L1(Manhattan) distance + * relative to a reference point r. + * da = L1(a, r)<br> + * db = L1(b, r)<br> + * -1 if da < db, +1 if da > db, 0 else. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class L1Comparator implements Comparator { private Coordinate ref; + /** + * Default constructor. + */ public L1Comparator() { } + /** + * Constructor to create a L1Comparator with a given reference point. + * @param ref The reference point. + */ public L1Comparator(Coordinate ref) { this.ref = ref; } + /** + * Explicitly sets the reference point. + * @param ref The reference point. + */ public void setReference(Coordinate ref) { this.ref = ref; } + /** + * Compares to coordinate by their L1 distance to the reference point. + * @param a The first coordinate. + * @param b The second coordinate. + * @return -1 if L1(a, ref) < L1(b, ref), + * +1 if L1(a, ref) > L1(b, ref), 0 else. + */ public int compare(Object a, Object b) { Coordinate pa = (Coordinate)a; Coordinate pb = (Coordinate)b; - double da = Point2d.L1(ref, pa); - double db = Point2d.L1(ref, pb); + double da = L1(ref, pa); + double db = L1(ref, pb); if (da < db) return -1; if (da > db) return +1; return 0; } + + /** + * Computes the L1 distance between two points a and b:<br> + * L1(a, b) = abs(a.x - b.x) + abs(a.y - b.y) + * @param a The first point. + * @param b The second point. + * @return The L1 distance. + */ + public static double L1(Coordinate a, Coordinate b) { + return Math.abs(a.x - b.x) + Math.abs(a.y - b.y); + } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: - +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearFunction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearFunction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,28 +1,63 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; -import org.apache.commons.math.optimization.fitting.ParametricRealFunction; - import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.analysis.UnivariateRealFunction; +import org.apache.commons.math.optimization.fitting.ParametricRealFunction; + /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Models a linear function to be usable in the fitting framework of + * the Apache Commons Mathematics Library. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class LinearFunction implements ParametricRealFunction { + /** + * Instance to prevent needless creations of instances. + */ public static final LinearFunction INSTANCE = new LinearFunction(); - public static class Univariate + /** + * Specialized class to be useful in function evaluating + * in the Apache Commons Mathematics Library. + */ + public static class Univariate implements UnivariateRealFunction { + /** + * The linear scaling factor. + */ protected double m; + /** + * The linear offset. + */ protected double b; + /** + * Default constructor. + */ public Univariate() { } + /** + * Constructor to create a Univariate with the linear parameters + * of the line between (x1, y1) and (x2, y2). + * @param x1 The x coordinate of the first point. + * @param y1 The y coordinate of the first point. + * @param x2 The x coordinate of the second point. + * @param y2 The y coordinate of the second point. + */ public Univariate(double x1, double y1, double x2, double y2) { if (y1 == y2) { m = 0d; @@ -39,17 +74,20 @@ } } // class Univariate + /** + * Default constructor. + */ public LinearFunction() { } public double value(double x, double [] parameters) - throws FunctionEvaluationException + throws FunctionEvaluationException { return x*parameters[0] + parameters[1]; } - public double [] gradient(double x, double [] parameters) - throws FunctionEvaluationException + public double [] gradient(double x, double [] parameters) + throws FunctionEvaluationException { return new double [] { x, 1f }; }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearMetrics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearMetrics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,32 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; /** - * @author Sascha L. Teichmann + * Implements {@link de.intevation.gnv.math.Metrics} + * for linear interpolations and distance measurements. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public final class LinearMetrics implements Metrics { + /** + * Instance to prevent needless creations of instances. + */ public static final Metrics INSTANCE = new LinearMetrics(); + /** + * Implements the corresponding linear interpolator. + */ public static final class LinearInterpolator implements Interpolator { @@ -19,6 +35,12 @@ private double my; private double by; + /** + * Constructor to create a linear interpolator between two + * given points. + * @param p1 The first point. + * @param p2 The second point. + */ public LinearInterpolator(Coordinate p1, Coordinate p2) { /* @@ -56,4 +78,4 @@ return new LinearInterpolator(p1, p2); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearToMap.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearToMap.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,32 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; +import java.util.Iterator; import java.util.List; -import java.util.Iterator; import java.util.NoSuchElementException; /** - * @author Sascha L. Teichmann + * Given a list of line segments instances of this class are able + * to span a metric system between a start and an end point + * represented as scalar values to 2D coordinate on the + * course of the segments. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class LinearToMap { + /** + * Represents a segment of the line string. + */ public static final class Range { private Range next; @@ -23,11 +39,25 @@ private Interpolator interpolator; + /** + * Default constructor. + */ public Range() { } + /** + * Constructor to create a segment that maps + * a coordinate pair to two scalar values. + * Interpolations inside this segment are done with + * a given interpolator. + * @param from Start point of the segment. + * @param to End point of the segment. + * @param interpolator The interpolator. + * @param p1 The scalar value mapped to the start point. + * @param p2 The scalar value mappend to the end point. + */ public Range( - double from, + double from, double to, Interpolator interpolator, Coordinate p1, @@ -44,32 +74,73 @@ : 1.0d/(to - from); } + /** + * Interpolated a coordinate on the segment given a scalar value + * between the start and end point of the range. + * @param x The scalar value. + * @param v The interpolated value is stored here. + */ public void eval(double x, Coordinate v) { interpolator.interpolate((x - from)*b, v); } + /** + * Checks if a given value is inside this segment. + * @param x The value to test + * @return true if inside, else false. + */ public boolean inside(double x) { return x >= from && x <= to; } + /** + * Returns the start point of this segment. + * @return The start point. + */ public Coordinate startPoint() { return p1; } + /** + * Return the end point of this segment. + * @return The end point. + */ public Coordinate endPoint() { return p2; } } // class Range + /** + * The head of the internal range list. + */ protected Range head; + + /** + * The last accessed segment. Used to accelerate + * the access of the right segment. + */ protected Range last; + /** + * Default constructor. + */ public LinearToMap() { } + /** + * Constructor to create a LinearToMap that maps + * given scalar values to coordinates of a given + * list of line segments. + * @param path The list of line segments. + * @param from The start value mapped to the start point + * of the first line segment. + * @param to The end value mapped to the end point of + * the last line segment. + * @param metrics The metric used to span the 2D space. + */ public LinearToMap( - List<? extends Coordinate> path, - double from, + List<? extends Coordinate> path, + double from, double to, Metrics metrics ) { @@ -108,6 +179,11 @@ } } + /** + * Returns a segment on which a given value is found. + * @param diagramX The value. + * @return The segment or null if no matching segment was found. + */ protected Range locateRange(double diagramX) { if (last != null && last.inside(diagramX)) { @@ -125,6 +201,13 @@ return null; } + /** + * Interpolates a coordinate at a given scalar position. + * @param diagramX The scalar position. + * @param v The interpolated coordinate is stored here. + * @return true if the scalar position is inside the + * spanned range of the line string, else false. + */ public boolean locate(double diagramX, Coordinate v) { Range range = locateRange(diagramX); if (range == null) { @@ -134,8 +217,15 @@ return true; } + /** + * Returns the length of a given line string using + * a given metric. + * @param path The line string. + * @param metrics The used metric. + * @return The length of the line string. + */ public static double length( - List<? extends Coordinate> path, + List<? extends Coordinate> path, Metrics metrics ) { double sum = 0d; @@ -147,6 +237,10 @@ return sum; } + /** + * Return the number of segments in this map. + * @return the number of segments. + */ public int numRanges() { int count = 0; Range current = head; @@ -157,6 +251,10 @@ return count; } + /** + * Returns an iterator over all segments of this map. + * @return The iterator. + */ public Iterator ranges() { return new Iterator() { @@ -181,4 +279,4 @@ }; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Metrics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Metrics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,38 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; /** - * @author Sascha L. Teichmann + * Implementations provides the ability to calculate the distance between + * two points ans support for interpolating points between two points. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public interface Metrics { + /** + * Calculates the distance between two given points. + * @param p1 The first point. + * @param p2 The second point. + * @return The distance. + */ double distance(Coordinate p1, Coordinate p2); + /** + * Return an interpolator which allows interpolations between + * two given points. + * @param p1 The first point. + * @param p2 The second point. + * @return The interpolator. + */ Interpolator getInterpolator(Coordinate p1, Coordinate p2); } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Point2d.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Point2d.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; @@ -8,15 +16,23 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Point which besides the x, y, z coodinates has an index i, j pair + * to model neighborhood. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class Point2d extends Coordinate { private static Logger log = Logger.getLogger(Point2d.class); + /** + * Numerical tolerance epsilon: {@value} + */ public static final double EPSILON = 1e-3d; + /** + * Compares two Point2ds by their x coordinates + */ public static final Comparator X_COMPARATOR = new Comparator() { public int compare(Object a, Object b) { double xa = ((Coordinate)a).x; @@ -27,6 +43,9 @@ } }; + /** + * Compares two Point2ds by their y coordinates. + */ public static final Comparator Y_COMPARATOR = new Comparator() { public int compare(Object a, Object b) { double ya = ((Coordinate)a).y; @@ -37,75 +56,116 @@ } }; - public static class InverseL1Comparator - implements Comparator - { - private Point2d ref; - - public InverseL1Comparator(Point2d ref) { - this.ref = ref; - } - - public int compare(Object a, Object b) { - Point2d pa = (Point2d)a; - Point2d pb = (Point2d)b; - double da = ref.L1(pa); - double db = ref.L1(pb); - if (da < db) return -1; - if (da > db) return +1; - return 0; - } - } // class InverseL1Comparator - + /** + * The i index of this Point2d. + */ public int i; + /** + * The j index of this Point2d. + */ public int j; + /** + * Default constructor. + */ public Point2d() { } + /** + * Constructor setting x and y coordinate. + * @param x The x coordinate. + * @param y The y coordinate. + */ public Point2d(double x, double y) { super(x, y); } + /** + * Constructor setting x, y and i, j. + * @param x The x coordinate. + * @param y The y coordinate. + * @param i The i index. + * @param j The j index. + */ public Point2d(double x, double y, int i, int j) { super(x, y); this.i = i; this.j = j; } + /** + * Constructor setting x, y, z and i, j. + * @param x The x coordinate. + * @param y The y coordinate. + * @param z The z coordinate. + * @param i The i index. + * @param j The j index. + */ public Point2d(double x, double y, double z, int i, int j) { super(x, y, z); this.i = i; this.j = j; } - + /** + * Calculates the L1 distance to another Point2d. + * @param other The other Point2d. + * @return The L1 distance. + */ public double L1(Point2d other) { - return L1(this, other); + return L1Comparator.L1(this, other); } - public static double L1(Coordinate a, Coordinate b) { - return Math.abs(a.x - b.x) + Math.abs(a.y - b.y); - } - + /** + * Creates an envelope around this Point2d with + * the numerical tolerance of {@link #EPSILON}. + * @return The envelope. + */ public Envelope envelope() { return envelope(EPSILON); } + /** + *Creates an envelope around this Point2d with + * a given tolerance. + * @param epsilon The tolerance in all directions. + * @return The envelope. + */ public Envelope envelope(double epsilon) { return new Envelope( x-epsilon, x+epsilon, y-epsilon, y+epsilon); } + /** + * Given this and another Point2d it looks if there is + * a gap between the in points in i index direction. + * @param other The other Point2d. + * @return true if there is is a gap, else false. + */ public boolean hasIGap(Point2d other) { return Math.abs(i - other.i) > 1; } + /** + * Given this and another Point2d it looks if there is + * a gap between the in points in j index direction. + * @param other The other Point2d. + * @return true if there is is a gap, else false. + */ public boolean hasJGap(Point2d other) { return Math.abs(j - other.j) > 1; } + /** + * Given this and another Point2d a new Point2d is + * created via {@link #newPoint() }. The x, y coordinate + * of the new point is on the line of this and the other + * given point at a given scaling point. + * @param t The scaling factor. + * @param other The other point. + * @return The new Point2d. + */ public Point2d extrapolate(double t, Point2d other) { if (other == null) { return null; @@ -116,14 +176,33 @@ return p; } + /** + * Creates a new Point2d or an instance of a subclass. + * Override this in subclasses. + * @return The new Point2d. + */ public Point2d newPoint() { return new Point2d(0d, 0d); } + /** + * Creates a new Point2d or an instance of a subclass + * at a given coordinate. + * Override this in subclasses. + * @param x The x coordinate. + * @param y The y coordinate. + * @return The new point. + */ public Point2d newPoint(double x, double y) { return new Point2d(x, y); } + /** + * Sets the z value to the inverse distance weighting (IDW) value + * of the z values of a set of given points. + * @param ps The points from wich the z values are taken + * to calculate the IDW. + */ public void inverseDistanceWeighting(Point2d [] ps) { double sum = 0d; @@ -156,6 +235,14 @@ z = v/sum; } + /** + * Creates a new point via {@link #newPoint() } with the + * x,y coordinates of the center of a given set of + * coordinates. + * @param ps The points from which the x,y coordinates are + * taken to calculate the center. + * @return The new center point. + */ public static Point2d average(Point2d [] ps) { Point2d p = null; @@ -184,6 +271,14 @@ return p; } + /** + * Checks if this Point2d is near to at least one point + * out of a given set of points. Near is defined by an + * euclidian distance small than {@link #EPSILON}. + * @param ps The set of points to be tested. + * @return true if this Point2d is near to one of the given + * points, else false. + */ public boolean near(Point2d [] ps) { for (int i = 0; i < ps.length; ++i) { @@ -196,4 +291,4 @@ return true; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/QueriedXYDepth.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/QueriedXYDepth.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,71 +1,88 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ -package de.intevation.gnv.math; -import java.util.ArrayList; -import java.util.Collection; - -import java.lang.ref.SoftReference; - -import org.apache.log4j.Logger; +package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; 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.geobackend.sde.datasources.RasterObject; import de.intevation.gnv.utils.WKTUtils; -/** - * @author Tim Englich (tim.englich@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) - */ -public class QueriedXYDepth implements XYDepth { +import java.lang.ref.SoftReference; - /** - * the logger, used to log exceptions and additonaly information - */ +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.log4j.Logger; + +/** + * This implementation uses the geo backend to query a depth via + * a raster layer stored in the database. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + */ +public class QueriedXYDepth +implements XYDepth +{ private static Logger log = Logger.getLogger(QueriedXYDepth.class); - + private static final String queryID = "rasterQuery"; - + private QueryExecutor queryExecutor; - + private ArrayList<SoftReference<RasterObject>> rasterData; private RasterObject last; private int interpolation; - + + /** + * Default construtor. Interpolation method is bilinear. + */ public QueriedXYDepth() { this(RasterObject.BILINEAR); } + /** + * Constructor to create a QueriedXYDepth with a given interpolation + * method. + * @param interpolation The interpolation method. + */ public QueriedXYDepth(int interpolation) { this.interpolation = interpolation; rasterData = new ArrayList<SoftReference<RasterObject>>(); queryExecutor = QueryExecutorFactory.getInstance().getQueryExecutor(); } - /** - * @see de.intevation.gnv.math.XYDepth#depth(com.vividsolutions.jts.geom.Coordinate) - */ public double depth(Coordinate coordinate) { double resultValue = Double.NaN; - + RasterObject ro = getRasterObject(coordinate); - + if (ro == null) { try { - String[] filterValues = new String[] { WKTUtils.toWKT(coordinate) }; - Collection<Result> result = queryExecutor.executeQuery(this.queryID,filterValues); + String[] filterValues = + new String[] { WKTUtils.toWKT(coordinate) }; + Collection<Result> result = queryExecutor.executeQuery( + queryID, filterValues); for (Result row: result) { if ((ro = (RasterObject)row.getObject(0)) != null) { - rasterData.add(new SoftReference<RasterObject>(last = ro)); + rasterData.add( + new SoftReference<RasterObject>(last = ro)); } break; } @@ -75,9 +92,9 @@ } return ro != null ? ro.getValue(coordinate, interpolation) - : Double.NaN; + : Double.NaN; } - + private RasterObject getRasterObject(Coordinate coordinate) { if (last != null && last.contains(coordinate)) { return last;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,33 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import java.util.ArrayList; +import java.util.Collections; import java.util.List; -import java.util.Collections; + +import org.apache.commons.math.FunctionEvaluationException; +import org.apache.commons.math.MathException; + +import org.apache.commons.math.analysis.UnivariateRealFunction; import org.apache.commons.math.analysis.interpolation.SplineInterpolator; import org.apache.commons.math.analysis.interpolation.UnivariateRealInterpolator; -import org.apache.commons.math.analysis.UnivariateRealFunction; - -import org.apache.commons.math.MathException; -import org.apache.commons.math.FunctionEvaluationException; - import org.apache.log4j.Logger; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> - * @author Sascha L. Teichmann <sascha.teichmann@intevation.de> + * A column of discrete attributed height values located at a point. + * Values between the discrete height values are interpolated. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class XYColumn extends Point2d @@ -24,23 +35,49 @@ { private static Logger log = Logger.getLogger(XYColumn.class); + /** + * The list of discrete height values. + */ protected List<HeightValue> values; + /** + * The curve used to interpolate the points between the + * discrete height values. + */ protected transient UnivariateRealFunction curve; + /** + * Default constructor. + */ public XYColumn() { values = new ArrayList<HeightValue>(); } + /** + * Constructor to create an XYColumn with a given (x, y) coordinate + * and an (i, j) index tuple. + * @param x The x coordinate. + * @param y The y coordinate. + * @param i The i component. + * @param j The j component. + */ public XYColumn(double x, double y, int i, int j) { super(x, y, i, j); values = new ArrayList<HeightValue>(); } + /** + * Adds a given height value to the list of height values. + * @param value The height value. + */ public void add(HeightValue value) { values.add(value); } + /** + * Returns the list of height values. + * @return The list of height values. + */ public List<HeightValue> getValues() { return values; } @@ -63,6 +100,12 @@ return Double.NaN; } + /** + * Prepares this XYColumn to be queried. A given XYDepth + * object is used to fill the values to a certain depth. + * @param xyDepth To figure out the depth a the cordinate. + * @return true if preparation succeeds else false. + */ public boolean prepare(XYDepth xyDepth) { if (curve == null) { int N = values.size(); @@ -120,8 +163,15 @@ return true; } + /** + * Returns the interpolator used to interpolate the values between + * the discrete height values. This class returns an instance of + * {@link org.apache.commons.math.analysis.interpolation.SplineInterpolator}. + * Override this if you want to use another kind of interpolation. + * @return The interpolator to be used. + */ protected UnivariateRealInterpolator getInterpolator() { return new SplineInterpolator(); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYDepth.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYDepth.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,12 +1,28 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.math; import com.vividsolutions.jts.geom.Coordinate; /** - * @author Sascha L. Teichmann + * Interface to encapsulate the query of the depth at a given point. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public interface XYDepth { + /** + * Returns the depth at a given coordinate. Negative + * values are below the water surface. + * @param coordinate The coordinate where to take the depth. + * @return The depth at the queried coordinate. NaN is no + * depth is available at the given point. + */ double depth(Coordinate coordinate); } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes and interface to do the different kinds of cross sections. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.horizontal; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.GNVArtifactBase; + 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> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class HorizontalProfileArtifact extends GNVArtifactBase { @@ -36,14 +44,19 @@ /** - * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String, - * de.intevation.artifacts.ArtifactFactory, java.lang.Object, + * @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) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("HorizontalProfileArtifact.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); } }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileInstantaneousPointArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileInstantaneousPointArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.horizontal; import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class HorizontalProfileInstantaneousPointArtifact extends HorizontalProfileArtifact {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.horizontal; import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class HorizontalProfileMeshArtifact extends HorizontalProfileArtifact { /**
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshCrossArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshCrossArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,12 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.horizontal; import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class HorizontalProfileMeshCrossArtifact extends @@ -21,7 +26,7 @@ */ private static Logger log = Logger .getLogger(HorizontalProfileMeshCrossArtifact.class); - + /** * Constructor */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes providing specific artifacts representing +'Horizontalprofile'. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.horizontalcrosssection; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.GNVArtifactBase; + 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> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HorizontalCrossSectionMeshArtifact extends GNVArtifactBase { /** @@ -33,17 +41,38 @@ log.debug("HorizontalCrossSectionMeshArtifact.Constructor"); this.name = "horizontalCrossSectionMesh"; } - + /** - * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String, - * de.intevation.artifacts.ArtifactFactory, java.lang.Object, + * @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) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("HorizontalCrossSectionMeshArtifact.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); + } + + + /** + * This method is called just before an artifact is exported. It removes all + * data which should not serialized into an export. + * + * @param context CallContext object. + */ + @Override + public void cleanup(Object context) { + if (current != null) + current.cleanup(context); + + super.cleanup(context); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes providing specific artifacts representing +'Horizontalschnitte'. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +DOCUMENT ME! +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.vertical; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.GNVArtifactBase; + 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> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class VerticalProfileArtifact extends GNVArtifactBase { /** @@ -36,13 +44,19 @@ /** * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String, - * de.intevation.artifacts.ArtifactFactory, java.lang.Object, + * de.intevation.artifacts.ArtifactFactory, java.lang.Object, * org.w3c.dom.Document) */ @Override - public void setup(String identifier, ArtifactFactory factory, - Object context, Document data) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("VerticalProfileArtifact.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileInstantaneousPointArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileInstantaneousPointArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.vertical; import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class VerticalProfileInstantaneousPointArtifact extends VerticalProfileArtifact { @@ -31,3 +36,4 @@ super.name = super.name + "InstantaneousPoint"; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileMeshArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileMeshArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.vertical; import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class VerticalProfileMeshArtifact extends VerticalProfileArtifact { /** @@ -30,3 +35,4 @@ super.name = super.name + "Mesh"; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes that provide specific artifacts representing +'Vertikalprofile'. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.profile.verticalcrosssection; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.GNVArtifactBase; + 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> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class VerticalCrossSectionMeshArtifact extends GNVArtifactBase { /** @@ -33,17 +41,23 @@ log.debug("VerticalCrossSectionMeshArtifact.Constructor"); this.name = "verticalCrossSectionMesh"; } - + /** * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String, - * de.intevation.artifacts.ArtifactFactory, java.lang.Object, + * de.intevation.artifacts.ArtifactFactory, java.lang.Object, * org.w3c.dom.Document) */ @Override - public void setup(String identifier, ArtifactFactory factory, - Object context, Document data) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("VerticalCrossSectionMeshArtifact.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.profile.verticalcrosssection; + +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.GNVArtifactBase; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * + */ +public class VerticalCrossSectionMeshParallelArtifact extends GNVArtifactBase { + + private static Logger logger = + Logger.getLogger(VerticalCrossSectionMeshParallelArtifact.class); + + + public VerticalCrossSectionMeshParallelArtifact() { + super(); + this.name = "verticalCrossSectionMeshParallel"; + } + + + @Override + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ){ + super.setup(identifier, factory, context, meta, data); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes that provide specific artifacts representing +'Profilschnitte'. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/AbstractProducer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/AbstractProducer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,60 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; import de.intevation.gnv.raster.Vectorizer.RingsHandler; +/** + * Abstract base class for producing multi polygons and + * multi line strings. This base class stores a bounding box + * of world coordinates which helps to transform the index + * spaced egde data into real world coordinates. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + */ public abstract class AbstractProducer implements RingsHandler { + /** + * min x coord of the world. + */ protected double minX; + + /** + * min y coord of the world. + */ protected double minY; + + /** + * max x coord of the world. + */ protected double maxX; + + /** + * max y coord of the world. + */ protected double maxY; + /** + * Default constructor. + */ public AbstractProducer() { } + /** + * Constructor to create an Abstract producer with a + * given world bounding box. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public AbstractProducer( double minX, double minY, double maxX, double maxY
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,30 +1,52 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; +import de.intevation.gnv.raster.Vectorizer.Edge; +import de.intevation.gnv.raster.Vectorizer.RingsHandler; + import java.util.ArrayList; import java.util.List; -import de.intevation.gnv.raster.Vectorizer.RingsHandler; -import de.intevation.gnv.raster.Vectorizer.Edge; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Ring Handler that demultiplexes to a list of other ring handlers. + * Handy if you want to pipe the polygons and line strings produced + * by the Vectorize to more than one handler at once. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class DemuxRingsHandler implements RingsHandler { + /** + * The list of internal ring handlers. + */ protected ArrayList<RingsHandler> handlers; + /** + * Default constructor. + */ public DemuxRingsHandler() { handlers = new ArrayList<RingsHandler>(); } + /** + * Add a ring handler to the list of handlers. + * @param handler The handler to add to the internal list. + */ public void addHandler(RingsHandler handler) { handlers.add(handler); } public void handleRings( - List<Edge> rings, - int value, + List<Edge> rings, + int value, int width, int height ) { @@ -33,6 +55,9 @@ } } + /** + * Empties the internal list of ring handlers. + */ public void clear() { handlers.clear(); }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,20 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Converts the interal color index of a polygon to the external index + * defined by the corresponding palette entry. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class ExternalIndexConverter implements JTSMultiPolygonProducer.ValueConverter @@ -11,15 +22,33 @@ private static Logger log = Logger.getLogger( ExternalIndexConverter.class); + /** + * The palette where to find the color indices. + */ protected Palette palette; + /** + * Default constructor. + */ public ExternalIndexConverter() { } + /** + * Constrcutor to create an ExternalIndexConverter with + * a given palette. + * @param palette The palette where to find the color indices. + */ public ExternalIndexConverter(Palette palette) { this.palette = palette; } + /** + * Maps the color index of a polygon to the external index + * defined by the corresponing palette entry. + * @param value The value to convert + * @return The mapped value or the original value if + * no corresponing palette entry was found. + */ public Integer convert(Integer value) { if (value == null) { return value;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Filter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Filter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,20 +1,46 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; import org.w3c.dom.Element; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Interface to model transformations of rasters. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public interface Filter { + /** + * Allows the creation of filters parameterized from XML elements. + */ public interface Factory { + /** + * Setup the factory with a given XML element. + * @param element + */ void init(Element element); + /** + * Created a new Filter with this factory. + * @return The new created Filter. + */ Filter create(); } // interface Factory + /** + * Apply this filter to a given raster. The original raster is + * unmodified and a new raster is created. + * @param raster The original raster. + * @return The new raster. + */ Raster filter(Raster raster); } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,38 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Generates label attributes for iso lines. It takes the + * neighboring palette ranges and calculates the mid point + * between these two ranges. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class IsoAttributeGenerator implements IsoProducer.AttributeGenerator { + /** + * The palette where to look for the ranges. + */ protected Palette palette; + /** + * Default constructor. + */ public IsoAttributeGenerator() { } + /** + * Constructor to create an IsoAttributeGenerator with + * a given lookup palette. + * @param palette The palette. + */ public IsoAttributeGenerator(Palette palette) { this.palette = palette; } @@ -31,4 +53,4 @@ : 0.5d*(e2.getTo()+e1.getFrom())); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,34 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; +import de.intevation.gnv.jfreechart.CompactXYItems; +import de.intevation.gnv.jfreechart.PolygonSeries; + +import de.intevation.gnv.math.IJKey; + +import de.intevation.gnv.raster.Vectorizer.Edge; + +import gnu.trove.TDoubleArrayList; +import gnu.trove.TIntObjectHashMap; + import java.util.ArrayList; import java.util.Collection; import org.apache.log4j.Logger; -import gnu.trove.TIntObjectHashMap; -import gnu.trove.TDoubleArrayList; - -import de.intevation.gnv.raster.Vectorizer.Edge; - -import de.intevation.gnv.math.IJKey; - -import de.intevation.gnv.jfreechart.PolygonSeries; -import de.intevation.gnv.jfreechart.CompactXYItems; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Vectorizer backend to generate iso lines which are able to be visualized + * via {@link de.intevation.gnv.jfreechart.PolygonPlot} as line strings + * and custom labels on the chart. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class IsoPolygonSeriesProducer extends IsoProducer @@ -24,8 +36,19 @@ private static Logger log = Logger.getLogger( IsoPolygonSeriesProducer.class); - public static final Float LINE_WIDTH = Float.valueOf(0.1f); + /** + * The line width of the line string used in the chart. + */ + public static final Float LINE_WIDTH = Float.valueOf(0.1f); + /** + * Constructor to create an IsoPolygonSeriesProducer with a + * given world bounding box. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public IsoPolygonSeriesProducer( double minX, double minY, double maxX, double maxY @@ -33,10 +56,22 @@ super(minX, minY, maxX, maxY); } + /** + * Returns a collection of series with line strings + * with no AttributeGenerator. + * @return The collection with line strings. + */ public Collection<PolygonSeries> getSeries() { return getSeries(null); } + /** + * Returns a collection of series with line strings. + * The label attributes are generated with a given generator. + * @param attributeGenerator The attribute generator. Maybe null + * if no attributes should be generated. + * @return The collection with the line strings. + */ public Collection<PolygonSeries> getSeries( AttributeGenerator attributeGenerator ) { @@ -97,21 +132,21 @@ } // for all in common open } // if map defined for key - if (ps.getItemCount() > 0) { - series.add(ps); - if (attributeGenerator != null) { + if (ps.getItemCount() > 0) { + series.add(ps); + if (attributeGenerator != null) { Object attribute = attributeGenerator .generateAttribute(key.i, key.j); if (attribute != null) { ps.setAttribute("label", attribute); - } - } - ps.setAttribute("line.width", LINE_WIDTH); - } + } + } + ps.setAttribute("line.width", LINE_WIDTH); + } } // for all pairs return series; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoProducer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoProducer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,37 +1,80 @@ -package de.intevation.gnv.raster; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import java.util.List; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - -import gnu.trove.TIntObjectHashMap; -import gnu.trove.TIntHashSet; -import gnu.trove.TObjectProcedure; +package de.intevation.gnv.raster; import de.intevation.gnv.math.IJKey; import de.intevation.gnv.raster.Vectorizer.Edge; +import gnu.trove.TIntHashSet; +import gnu.trove.TIntObjectHashMap; +import gnu.trove.TObjectProcedure; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Vectorizer backend to generate iso lines as line strings + * and custom labels on the chart. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class IsoProducer extends AbstractProducer { + /** + * Iso lines separate two neighbors. This interface decouples + * the generation of a suitable label for these to neighbors. + */ public interface AttributeGenerator { + /** + * Generate attribute show as label for two given neighbors. + * @param neighbor1 The first neighbor. + * @param neighbor2 The second neighbor. + * @return The label attribute. + */ Object generateAttribute(int neighbor1, int neighbor2); } // interface AttributeGenerator + /** + * Internal map of open edge to neighbor attributes. + */ protected HashMap<Edge, Integer> open; + /** + * Internal map to associate neighbors with open edges. + */ protected HashMap<IJKey, TIntObjectHashMap> commonOpen; + /** + * Internal map to associate neighbors with complete rings. + */ protected HashMap<IJKey, ArrayList<Edge>> complete; + /** + * Width of the index space. + */ protected int width; + /** + * Height of the index space. + */ protected int height; + /** + * Constructor with a given world bounding box. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public IsoProducer( double minX, double minY, double maxX, double maxY @@ -44,8 +87,8 @@ } public void handleRings( - List<Edge> rings, - int value, + List<Edge> rings, + int value, int width, int height ) { @@ -112,6 +155,10 @@ } // handleRings + /** + * Join the pairs of neighbors i,j to have a distinct set. + * @return The distinct pairs of neighbors. + */ protected HashSet<IJKey> joinPairs() { HashSet<IJKey> pairs = new HashSet<IJKey>(); pairs.addAll(complete .keySet()); @@ -119,6 +166,11 @@ return pairs; } + /** + * Filter out the head list from the open edge lists. + * @param map Map of end and head lists. + * @return list of only head lists. + */ protected static ArrayList<Edge> headList(TIntObjectHashMap map) { final ArrayList<Edge> headList = new ArrayList<Edge>(); map.forEachValue(new TObjectProcedure() { @@ -134,6 +186,9 @@ return headList; } + /** + * Reset internal data structures to save some memory. + */ public void clear() { open.clear(); complete.clear();
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; import com.vividsolutions.jts.geom.Coordinate; @@ -20,8 +28,12 @@ import java.util.List; import org.apache.log4j.Logger; + /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Vectorizer backend to generated iso lines in form of + * JTS multi linestrings. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class JTSMultiLineStringProducer extends IsoProducer @@ -29,10 +41,25 @@ private static Logger log = Logger.getLogger( JTSMultiLineStringProducer.class); + /** + * The JTS geometry factory of this producer. + */ protected GeometryFactory geometryFactory; + /** + * The polygon used to clip the produced multe line strings. + */ protected Polygon clip; + /** + * Constructor to create a JTSMultiLineStringProducer with + * a given clipping polygon and a world bounding box. + * @param clip The clipping polygon. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public JTSMultiLineStringProducer( Polygon clip, double minX, double minY, @@ -46,6 +73,17 @@ maxX, maxY); } + /** + * Constructor to create a JTSMultiLineStringProducer with + * a given clipping polygon, a geometry factory + * and a world bounding box. + * @param clip The clipping polygon. + * @param geometryFactory The geometry factory. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public JTSMultiLineStringProducer( Polygon clip, GeometryFactory geometryFactory, @@ -57,6 +95,12 @@ this.geometryFactory = geometryFactory; } + /** + * Clips a given line string against the clippin polygon. The + * result is stored in the given list of line strings. + * @param lineString The line string to be clipped. + * @param lineStrings The result line string list. + */ protected void clipLineString( LineString lineString, ArrayList<LineString> lineStrings @@ -98,6 +142,13 @@ } } + /** + * Returns a list of pairs attribute -> multi line string. + * All line strings produced are grouped by there attribute + * which is generated with the given attribute generator. + * @param attributeGenerator The attribute generator. + * @return The list of attribute/multi line strings. + */ public List<Pair<Object, MultiLineString>> getMultiLineStrings( AttributeGenerator attributeGenerator ) {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; import com.vividsolutions.jts.algorithm.CGAlgorithms; @@ -24,7 +32,10 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Vectorizer backend to generated polygons in form of + * JTS multi multi polygons. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class JTSMultiPolygonProducer extends AbstractProducer @@ -32,23 +43,57 @@ private static Logger log = Logger.getLogger( JTSMultiPolygonProducer.class); + /** + * The reference system of used coordinates: {@value} + */ public static final int SRID_WGS84 = 4326; + /** + * Interface to decouple the conversion of the internal + * index scheme of the polygons to an external one. + */ public interface ValueConverter { + /** + * Maps integer index schemes. + * @param value The input value. + * @return The resulting index. + */ Integer convert(Integer value); } // interface ValueConverter + /** + * The JTS geometry factory. + */ protected GeometryFactory geometryFactory; + /** + * The clipping polygon. + */ protected Polygon clip; + /** + * Internal map to map the internal polygons indices to a + * list of generated polygons. + */ protected HashMap<Integer, ArrayList<Polygon>> valueToPolygons; + /** + * Default constructor. + */ public JTSMultiPolygonProducer() { } + /** + * Constructor to create a JTSMultiPolygonProducer with a + * given clipping polygon and a world bounding box. + * @param clip The clipping polygon. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public JTSMultiPolygonProducer( Polygon clip, double minX, double minY, @@ -61,6 +106,16 @@ maxX, maxY); } + /** + * Constructor to create a JTSMultiPolygonProducer with a + * given clipping polygon, a geometry factory and a world bounding box. + * @param clip The clipping polygon. + * @param geometryFactory The geometry factory. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public JTSMultiPolygonProducer( Polygon clip, GeometryFactory geometryFactory, @@ -73,10 +128,20 @@ valueToPolygons = new HashMap<Integer, ArrayList<Polygon>>(); } + /** + * Creates a 3D geometry factory via + * {@link #createDefaultGeometryFactory(int)}. + * @return The new geometry factory. + */ public static GeometryFactory createDefaultGeometryFactory() { return createDefaultGeometryFactory(3); } + /** + * Creates a geometry factory with a given dimension. + * @param dim The dimension. + * @return The new geometry factory. + */ public static GeometryFactory createDefaultGeometryFactory(int dim) { return new GeometryFactory( new PrecisionModel( @@ -88,8 +153,8 @@ } public void handleRings( - List<Edge> rings, - int value, + List<Edge> rings, + int value, int width, int height ) { @@ -162,10 +227,21 @@ } } + /** + * Returns a index -> multi polyon map. The internal index scheme + * is retained. + * {@link #getMultiPolygons(de.intevation.gnv.raster.JTSMultiPolygonProducer.ValueConverter)} + * @return The new map. + */ public Map<Integer, MultiPolygon> getMultiPolygons() { return getMultiPolygons(null); } + /** + * Flattend a JTS geometry to a multi polygon if possible + * @param result The geometry to be flattend + * @return The resulting multi polygon. + */ protected MultiPolygon flattenCollection(Geometry result) { if (result instanceof MultiPolygon) { @@ -182,6 +258,13 @@ return null; } + /** + * Returns a index -> multi polyon map. The internal index scheme + * is remapped with the given value converter. + * @param valueConverter Converter to remap the index scheme. Maybe null + * if no remapping is required. + * @return The new map. + */ public Map<Integer, MultiPolygon> getMultiPolygons( ValueConverter valueConverter ) { @@ -218,6 +301,9 @@ return multiPolygons; } + /** + * Empties internal temporary data structures to save some memory. + */ public void clear() { valueToPolygons.clear(); }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/KernelFilter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/KernelFilter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,53 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; +import org.apache.log4j.Logger; + import org.w3c.dom.Element; -import org.apache.log4j.Logger; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * An implemenation of raster filters based on given kernels. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class KernelFilter implements Filter { private static Logger log = Logger.getLogger(KernelFilter.class); + /** + * Implemens a factory which produces KernelFilters with Gauss kernels. + */ public static class GaussFactory implements Filter.Factory { + /** + * Default sigma of Gauss kernel: {@value} + */ public static final double DEFAULT_SIGMA = 1.0d; + /** + * Default radius of Gauss kernel: {@value} + */ public static final int DEFAULT_RADIUS = 5; + /** + * Configured sigma. + */ protected double sigma; + /** + * Configured radius. + */ protected int radius; + /** + * Default constructor. + */ public GaussFactory() { sigma = DEFAULT_SIGMA; radius = DEFAULT_RADIUS; @@ -54,11 +81,21 @@ } } // class GaussFactory + /** + * The kernel used by this filter. + */ protected Raster.Kernel kernel; + /** + * Default constructor. + */ public KernelFilter() { } + /** + * Constructor to create a filter with a given kernel. + * @param kernel The kernel to be used. + */ public KernelFilter(Raster.Kernel kernel) { this.kernel = kernel; } @@ -67,4 +104,4 @@ return raster.create(kernel); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,39 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; +import de.intevation.gnv.raster.Raster.ValueToIndex; + +import java.awt.Color; + +import java.util.Arrays; + +import org.apache.log4j.Logger; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import java.util.Arrays; - -import java.awt.Color; - -import org.apache.log4j.Logger; - -import de.intevation.gnv.raster.Raster.ValueToIndex; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Lookup mechanism to map double values from a list of + * ranges onto a set of colors and vice versa. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class Palette implements ValueToIndex -{ - private static Logger log = Logger.getLogger(Palette.class); +{ + private static Logger log = Logger.getLogger(Palette.class); - public static final class Entry + /** + * An entry in the lookup table. + */ + public static final class Entry implements Comparable { private Entry left; @@ -37,9 +50,16 @@ private Color color; + /** + * Default constructor + */ public Entry() { } + /** + * Copy constructor + * @param other The entry to copy. + */ public Entry(Entry other) { index = other.index; externalIndex = other.externalIndex; @@ -49,11 +69,21 @@ color = other.color; } + /** + * Constructor to set the palette index, the exteral index, + * the value range, the color and the description. + * @param index The pallette index + * @param externalIndex The external index + * @param from Start of the interval + * @param to End of the interval + * @param color The color belonging to this interval. + * @param description The description of this range. + */ public Entry( - int index, + int index, int externalIndex, - double from, - double to, + double from, + double to, Color color, String description ) { @@ -65,6 +95,12 @@ this.description = description; } + /** + * Compares two entries by the start point of the interval. + * @param other + * @return -1 if this start point is before other. +1 if this + * start point is after, else 0. + */ public int compareTo(Object other) { Entry e = (Entry)other; if (from < e.from) return -1; @@ -72,22 +108,46 @@ return 0; } + /** + * The starting point of the interval. + * @return The starting point. + */ public double getFrom() { return from; } + /** + * The end point of the interval. + * @return The end point. + */ public double getTo() { return to; } + /** + * The color of the entry. + * @return The color. + */ public Color getColor() { return color; } + /** + * The external index of this entry. Useful to model + * external joins. + * @return The external index. + */ public int getExternalIndex() { return externalIndex; } + /** + * Searches for an entry which has a range that contains + * the given value. + * @param value The value to be searched. + * @return The entry containing the value or null if no such + * entry exists. + */ public Entry locateEntry(double value) { Entry current = this; while (current != null) { @@ -102,6 +162,12 @@ return null; } + /** + * Returns the palette index for a given value. + * @param value The value to search. + * @return The index of the palette entry or -1 if + * no such entry exists. + */ public int locate(double value) { Entry entry = locateEntry(value); return entry != null @@ -109,6 +175,12 @@ : -1; } + /** + * Searches for an interval with a given index. + * @param index The index to be searched. + * @return The entry with the given index or null if no + * such entry exists. + */ public Entry findByIndex(int index) { Entry current = this; while (current != null) { @@ -122,18 +194,39 @@ return current; } + /** + * The description of this entry. + * @return The description. + */ public String getDescription() { return description; } + /** + * Determines if the range of this entry has + * infinitive length. + * @return true if the range of this entry has infinitive + * length else false. + */ public boolean isInfinity() { return from == -Double.MAX_VALUE || to == Double.MAX_VALUE; } } // class Entry + /** + * Internal table of the entrys. + */ protected Entry [] entries; + + /** + * Root of the entry tree used to map values to entries. + */ protected Entry lookup; + + /** + * The list of colors used by this palette. + */ protected Color [] rgbs; private Entry buildLookup(Entry [] entries, int lo, int hi) { @@ -147,9 +240,16 @@ return entry; } + /** + * Default constructor. + */ public Palette() { } + /** + * Constructor to create the palette from an XML document. + * @param document The document with palette information. + */ public Palette(Document document) { NodeList rangeNodes = document.getElementsByTagName("range"); @@ -172,6 +272,13 @@ buildLookup(); } + /** + * Constructor to split a given palette into a given number of + * equal sized sub entries. Ranges of infinitive length are not + * splitted. + * @param original The source palette. + * @param N The number of chunks to split single ranges into. + */ public Palette(Palette original, int N) { if (N < 2) { throw new IllegalArgumentException("N < 2"); @@ -253,37 +360,77 @@ } + /** + * Internal method to build the lookup tree. + */ protected void buildLookup() { Arrays.sort(entries); lookup = buildLookup(entries, 0, entries.length-1); } + /** + * Creates a new palette which has ranges that are subdivided + * into a given number of sub ranges each. + * @param N The number od sub divisions of each range. + * @return The new created palette. + */ public Palette subdivide(int N) { return new Palette(this, N); } + /** + * Return the number of entries in this palette. + * @return The number of entries. + */ public int getSize() { return rgbs.length; } + /** + * Return the color of an entry for a given index. + * @param index The index. + * @return The color. + */ public Color getColor(int index) { return rgbs[index]; } + /** + * Return the RGB value + * @param index of an entry for a given index. + * @return rgb value + */ public int indexToRGB(int index) { return rgbs[index].getRGB(); } + /** + * Searches for the index of an entry which contains the + * given value. + * @param value The value to be searched. + * @return The index of the entry or -1 if no entry is found. + */ public int toIndex(double value) { return lookup.locate(value); } + /** + * Searches for the an entry which contains the given value. + * @param value The value to be searched. + * @return The entry which contains the value or null if + * no such entry is found. + */ public Entry getEntry(double value) { return lookup.locateEntry(value); } + /** + * Searches the entry for a given index. + * @param index The index of the entry. + * @return The entry or null if no such entry is found. + */ public Entry getEntryByIndex(int index) { return lookup.findByIndex(index); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PaletteManager.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PaletteManager.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,57 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; -import java.util.HashMap; - import java.lang.ref.SoftReference; +import java.util.HashMap; + /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Manages palettes by their name. Provides different levels of + * subdivisions. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class PaletteManager { + /** + * The base palette. + */ protected Palette base; + /** + * The description of the palette. + */ protected String description; + + /** + * The name of the palette. + */ protected String name; + /** + * Already created subdivisions of the palette. + */ protected HashMap<Integer, SoftReference<Palette>> levels; + /** + * Default constructor. + */ public PaletteManager() { } + /** + * Constructor to create a palette manager with a given name, + * description and base palette. + * @param name The name. + * @param description The description. + * @param base The base palette. + */ public PaletteManager( String name, String description, @@ -30,18 +63,35 @@ levels = new HashMap<Integer, SoftReference<Palette>>(); } + /** + * Returns the description of the palette. + * @return The description. + */ public String getDescription() { return description; } + /** + * The name of the palette. + * @return The name. + */ public String getName() { return name; } + /** + * Returns the base palette. + * @return The base palette. + */ public Palette getBase() { return base; } + /** + * Returns the subdivided palette of a given level. + * @param n The level of subdivision. + * @return The subdivided palette. + */ public Palette getLevel(int n) { if (n < 2) { return base; @@ -68,4 +118,4 @@ return palette; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,27 +1,53 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; -import java.util.List; -import java.util.HashMap; +import de.intevation.gnv.jfreechart.CompactXYItems; +import de.intevation.gnv.jfreechart.PolygonDataset; +import de.intevation.gnv.jfreechart.PolygonSeries; + +import de.intevation.gnv.raster.Vectorizer.Edge; import gnu.trove.TDoubleArrayList; -import de.intevation.gnv.raster.Vectorizer.Edge; - -import de.intevation.gnv.jfreechart.PolygonSeries; -import de.intevation.gnv.jfreechart.PolygonDataset; -import de.intevation.gnv.jfreechart.CompactXYItems; +import java.util.HashMap; +import java.util.List; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Vectorizer backend to produce polygon datasets suitable to being + * displayed with {@link de.intevation.gnv.jfreechart.PolygonPlot}. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class PolygonDatasetProducer extends AbstractProducer { + /** + * Maps value integers to series of polygons to group + * them by value. + */ protected HashMap<Integer, PolygonSeries> polygonSeries; + /** + * Default constructor. + */ protected PolygonDatasetProducer() { } + /** + * Constructor to create a PolygonDatasetProducer with + * a given world bound box. + * @param minX Min x coord of the world. + * @param minY Min y coord of the world. + * @param maxX Max x coord of the world. + * @param maxY Max y coord of the world. + */ public PolygonDatasetProducer( double minX, double minY, double maxX, double maxY @@ -32,8 +58,8 @@ } public void handleRings( - List<Edge> rings, - int value, + List<Edge> rings, + int value, int width, int height ) { @@ -79,8 +105,13 @@ } } + /** + * Creates a new PolygonDataset from the polygons build by this + * backend. + * @return the new PolygonDataset + */ public PolygonDataset getPolygonDataset() { return new PolygonDataset(polygonSeries.values()); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Raster.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Raster.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,52 +1,124 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * A 2D double valued representation of a raster array. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class Raster { + /** + * A kernel can be applied to a raster to fold its values. + */ public static class Kernel { + /** + * The coefficients of the folding matrix. + */ public static final class Coeff { + /** + * i delta index of this coefficient. + */ public int di; + /** + * i delta index of this coefficient. + */ public int dj; + /** + * The weight of this coefficient. + */ public double c; + /** + * Default constructor + */ public Coeff() { } + /** + * Constructor to set the delta position and the weight of + * the coefficient. + * @param di The i delta index. + * @param dj The j delta index. + * @param c The weight of the index. + */ public Coeff(int di, int dj, double c) { this.di = di; this.dj = dj; this.c = c; } + /** + * Returns a string representation of this coefficient. + * @return The string representation. + */ + @Override public String toString() { return String.valueOf(c); } } // class Coeff + /** + * The coefficients of the folding matrix. + */ protected Coeff [] coeffs; + /** + * The width of the kernel. + */ protected int width; + /** + * Default constrcutor. + */ public Kernel() { } + /** + * Constructor for a kernel with a given coefficient matrix + * with a given width. + * @param coeffs The coefficients. + * @param width The width of the kernel. + */ public Kernel(Coeff [] coeffs, int width) { this.coeffs = coeffs; this.width = width; } + /** + * Evaluates the 2D Gauss normal distribution a given x, y + * and a given sigma. + * @param x The x location. + * @param y The y location. + * @param sigma The sigma of the distribution. + * @return The value at point x, y. + */ public static double gauss(double x, double y, double sigma) { double s2 = sigma*sigma; return 1.0d/(2.0d*Math.PI*s2)*Math.exp(-(x*x + y*y)/(2.0d*s2)); } + /** + * Creates a Gauss kernel with sigma = 1 and width 5. + * @return The new kernel. + */ public static Kernel createGauss() { return createGauss(1.0d, 5); } + /** + * Creates a Gauss kernel with a given sigma and width. + * @param sigma The sigma value + * @param width The width of the kernel. + * @return The new kernel. + */ public static Kernel createGauss(double sigma, int width) { Coeff [] coeffs = new Coeff[width*width]; double sum = 0d; @@ -66,6 +138,13 @@ return new Kernel(coeffs, width); } + /** + * Evaluates this Kernel at the raster at raster index i, j. + * @param access The accessor to the raster. + * @param i The i raster index. + * @param j The j raster index. + * @return The folded value at index i, j. + */ public double fold(Access access, int i, int j) { double s = 0.0d; @@ -86,6 +165,11 @@ return s*(1.0d - unused); } + /** + * Returns a string representation of this kernel. + * @return The string representation. + */ + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -107,25 +191,63 @@ } } // class Kernel + /** + * Interface of allow special access patterns to the raster, + * especially at the border. + */ public interface Access { + /** + * Returns the raster value at a given index point. + * @param i The i index + * @param j The j index + * @return The value of the raster. + */ double get(int i, int j); } // interface Access + /** + * Interface to decouple the lookup which is needed + * to map double values to integers. + */ public interface ValueToIndex { + /** + * Returns the corresponding integer to a given value. + * @param value The value to be queried. + * @return The integer value or -1 if no such value was found. + */ int toIndex(double value); } // interface ValueToIndex; + /** + * Brings raster to an integer representation with equal sized bins + * of integer vaules. + */ public static class IsoClasses implements ValueToIndex { + /** + * Linear scaling factor. + */ protected double m; + /** + * Linear offset. + */ protected double b; + /** + * Number of classes. + */ protected int numClasses; + /** + * Constructor to build a lookup to transform + * an raster into an equals sized bin integer array. + * @param raster The original raster + * @param numClasses The number of classes. + */ public IsoClasses(Raster raster, int numClasses) { this.numClasses = numClasses; @@ -165,6 +287,11 @@ } } + /** + * Implements the double to integer lookup. + * @param value The value to map. + * @return The mapped value. + */ public int toIndex(double value) { return Double.isNaN(value) ? -1 @@ -172,30 +299,62 @@ } } // class IsoClasses + /** + * Internal representation of the raster. + */ protected double [] raster; + /** + * The width of the raster. + */ protected int width; + /** + * Default constructor. Creates an 0x0 raster. + */ public Raster() { this(new double[0], 0); } + /** + * Creates a raster with given values and width. + * @param raster + * @param width + */ public Raster(double [] raster, int width) { this.raster = raster; this.width = width; } + /** + * The width of the raster. + * @return The width. + */ public int getWidth() { return width; } + /** + * The height of the raster. + * @return The height. + */ public int getHeight() { return raster.length / width; } + /** + * The values of the raster. + * @return The values. + */ public double [] getValues() { return raster; } + /** + * Creates an integer representation of this raster using a + * given value to index transformer. + * @param valueToIndex The transformer to map double to integer values. + * @return The new created integer representation. + */ public int [] toIndexed(ValueToIndex valueToIndex) { int [] dst = new int[raster.length]; for (int i = 0; i < raster.length; ++i) { @@ -204,6 +363,13 @@ return dst; } + /** + * Creates a new raster by applying a kernel to this raster. + * Access to the raster is continuous at the border. + * The original raster is not modified. + * @param kernel The kernel to be applied. + * @return The new raster. + */ public Raster create(Kernel kernel) { double [] dst = new double[raster.length]; Raster r = new Raster(dst, width); @@ -211,6 +377,12 @@ return r; } + /** + * Creates a new raster by applying a kernel to this raster. + * Access to the raster is given. + * @param kernel The kernel to be applied. + * @param access The access method to the raster. + */ public void apply(Kernel kernel, Access access) { int height = getHeight(); for (int j = 0; j < height; ++j) { @@ -221,6 +393,12 @@ } } + /** + * Returns a continuous access to the raster. Values + * at the border are repeated til infinity if indices + * are accessed outside the defined area. + * @return The accessor. + */ public Access continueBorder() { return new Access() { int height = getHeight()-1; @@ -234,4 +412,4 @@ }; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/RasterToPPM.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/RasterToPPM.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,19 +1,41 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; +import java.awt.Color; + import java.io.IOException; import java.io.OutputStream; -import java.awt.Color; - /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Little helper class to write a Raster into an output stream + * as a Netpbm PPM file. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class RasterToPPM { private RasterToPPM() { } - public static void writeToPPM(Raster raster, Palette palette, OutputStream out) + /** + * Writes a Raster to a given stream as PPM. + * @param raster The raster to be written. + * @param palette The palette used to figure out the rgb values. + * @param out The stream to write into. + * @throws IOException Thrown if some error occurred during writing + * data to the output stream. + */ + public static void writeToPPM( + Raster raster, + Palette palette, + OutputStream out + ) throws IOException { int W = raster.getWidth();
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Vectorizer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Vectorizer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,52 +1,114 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.raster; +import gnu.trove.TIntObjectHashMap; +import gnu.trove.TIntStack; + +import java.util.ArrayList; import java.util.BitSet; import java.util.List; -import java.util.ArrayList; - -import gnu.trove.TIntStack; -import gnu.trove.TIntObjectHashMap; import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * Instances of this class are able to vectorize 2D integer arrays + * with a kind of flood filling regions detection mechanism to + * a set of line strings and polygons. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class Vectorizer { private static Logger log = Logger.getLogger(Vectorizer.class); + /** + * Callback to process the found line strings and polygons. + */ public interface RingsHandler { + /** + * Called from {@link #process(de.intevation.gnv.raster.Vectorizer.RingsHandler) } + * to give the found features to the postprocessing backend. + * @param rings The found line strings and polygons. + * @param value The integer value of the raster surrounded by + * the features. + * @param width The width of the index space of the vectorized data. + * @param height The height of the index space of the vectorized data. + */ void handleRings( List<Edge> rings, - int value, + int value, int width, int height); } // interface RingsHandler + /** + * Doubly link list representing a line string or a polygon. + */ public static final class Edge { + /** + * The predecessor. + */ public Edge prev; + /** + * The successor. + */ public Edge next; + /** + * Index of first vertex. To separate x and y values + * you have to divide the value by the width of the + * index space. + */ public int a; + /** + * Index of second vertex. To separate x and y values + * you have to divide the value by the width of the + * index space. + */ public int b; + /** + * Default constructor. + */ public Edge() { } + /** + * Constructor to create Edge with two vertices. + * @param a The first vertex. + * @param b The second vertex. + */ public Edge(int a, int b) { this.a = a; this.b = b; } + /** + * Copy constructor + * @param other The edge to clone. + */ public Edge(Edge other) { a = other.a; b = other.b; } + /** + * Chain a given edge segment to this segment. The + * side of the chaining is determined by a given + * parameter. + * @param other The segment to chain. + * @param found The side to chain. + */ public void chain(Edge other, int found) { if (found == a) { @@ -64,6 +126,11 @@ throw new IllegalStateException("cannot chain"); } + /** + * Tells if the list is complete which means that this + * edge list is a closed polygon. + * @return true if edge list is closed else false. + */ public boolean isComplete() { Edge current = this; do { @@ -76,32 +143,60 @@ return true; } + /** + * Returns the length of this edge list in next direction. + * Segments in prev direction are ignored. + * @return The length of this edge list. + */ public int length() { int length = 0; Edge current = this; - do { ++length; } + do { ++length; } while ((current = current.next) != null && current != this); return length; } - public Edge head() { - Edge current = this; - while (current.prev != null) { - current = current.prev; - } - return current; - } + /** + * Returns the head node of this edge list. + * @return The head node. + */ + public Edge head() { + Edge current = this; + while (current.prev != null) { + current = current.prev; + } + return current; + } + /** + * Hashes the two vertex indices to a common value. + * @return The hash value. + */ + @Override public int hashCode() { return (a << 16) | b; } + /** + * Two edges are considered equal if they have the same + * a and b vertices. + * @param other The other edge. + * @return true if the edges are equal else false. + */ + @Override public boolean equals(Object other) { Edge e = (Edge)other; return a == e.a && b == e.b; } } // class Edge + /** + * Simplifies a given edge list by removing collinear vertices. + * Attention: The original list is modified. + * @param edge The edge list to simplify. + * @param width The width of the vertex index space. + * @return The simplified list. + */ protected static Edge simplify(Edge edge, int width) { Edge e1 = edge, start = edge; @@ -150,55 +245,127 @@ return start; } + /** + * The raster to be traced. + */ protected int [] raster; + /** + * The width of the raster. + */ protected int width; + /** + * Map of the currently open edges. + */ protected TIntObjectHashMap openEdges; + /** + * List of rings already found. + */ protected List<Edge> rings; + /** + * Flag to signal if a simplification should be performed + * after a ring is completed. + */ protected boolean simplify; + /** + * Default constructor. Simplification is turned on. + */ public Vectorizer() { this(true); } + /** + * Constructor to create a vectorized with an explicit + * simplification policy. + * @param simplify Indicates if simplification should be + * used on ring completion. + */ public Vectorizer(boolean simplify) { openEdges = new TIntObjectHashMap(); rings = new ArrayList<Edge>(); this.simplify = simplify; } + /** + * Constructor to create a vectorizer with a given raster and width. + * Simplification is turn on. + * @param raster The raster to be vectorized. + * @param width The width of the raster. + */ public Vectorizer(int [] raster, int width) { this(true, raster, width); } + /** + * Constructor to create a vectorizer with a given raster, width + * and an explicit simplification policy. + * @param simplify Indicates if simplification should be + * used on ring completion. + * @param raster The raster to be vectorized. + * @param width The width of the raster. + */ public Vectorizer(boolean simplify, int [] raster, int width) { this(simplify); this.raster = raster; this.width = width; } + /** + * Returns (x, y+1) for given vertex in index space. + * @param i vertex in index space. + * @param w width of raster. + * @return (x, y+1) in index space. + */ public static final int tl(int i, int w) { int x = i % w; int y = i / w; return x + (w + 1)*y; } + /** + * Returns tl(i, w) + 1. + * @param i vertex in index space. + * @param w width of raster. + * @return tl(i, w) + 1. + */ public static final int tr(int i, int w) { return tl(i, w) + 1; } + /** + * Returns tl(i, w) + w + 1. + * @param i vertex in index space. + * @param w width of raster. + * @return tl(i, w) + w + 1. + */ public static final int bl(int i, int w) { return tl(i, w) + w + 1; } + /** + * Returns bl(i, w) + 1. + * @param i vertex in index space. + * @param w width of raster. + * @return bl(i, w) + 1. + */ public static final int br(int i, int w) { return bl(i, w) + 1; } + /** + * Resets open resources after a set of features were found. + */ protected void resetRegion() { openEdges.clear(); rings.clear(); } + /** + * Adds an edge to the map of open edges, joins it + * with its direct neighbors of if complete add the + * list to the complete features. + * @param edge + */ protected void emit(Edge edge) { Edge otherA = (Edge)openEdges.remove(edge.a); @@ -224,6 +391,12 @@ } } + /** + * Vectorize the raster. The found features are fed into + * the given ring handler. + * @param handler The RingHandler to postprocess the found features. + * @return The number of regions found. + */ public int process(RingsHandler handler) { BitSet visited = new BitSet(raster.length); @@ -329,8 +502,8 @@ } handler.handleRings( - rings, - currentValue, + rings, + currentValue, width + 1, height + 1); @@ -340,4 +513,4 @@ return regions; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,10 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes and interfaces to handle 2D double valued +raster arrays. Additional palette support and vectorization these rasters into +simple feature vector representations are supplied. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/AutoResumeState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state; + +/** + * + * Markerinterface for states which should be used for + * automatically resume and jump to the next <code>State</code> using + * the conditions of the transitions which are linked to it. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public interface AutoResumeState extends State{ + +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; import java.util.ArrayList; @@ -16,7 +21,7 @@ import com.vividsolutions.jts.geom.Point; -import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.common.utils.Config; import de.intevation.gnv.geobackend.base.Result; import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; import de.intevation.gnv.state.describedata.KeyValueDescibeData; @@ -28,7 +33,10 @@ import de.intevation.gnv.utils.exception.ValidationException; /** - * @author Tim Englich <tim.englich@intevation.de> + * This state handles coordinate input by the user. It searches database results + * for coordinates and turns them into a human readable form. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class CoordinateSelectionState extends StateBase { @@ -37,22 +45,22 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(CoordinateSelectionState.class); - + /** * The UID of this Class */ private static final long serialVersionUID = 6318923553625195063L; - + /** * XPATH Expressions for the setup. */ - + private final static String MESH_WIDTH_XPATH = "mesh-width"; private final static String XLINK_XPATH = "xlink:href"; private final static String MESH_LIST_XPATH = "/mesh-widths/mesh"; private final static String ID_XPATH = "id"; private final static String WIDTH_VALUE_XPATH = "width"; - + /** * Holds all given Widths between two MeshPoints for different Meshes. */ @@ -77,16 +85,14 @@ return describeData; } - /** - * @see de.intevation.gnv.state.StateBase#prepareInputData4RegionDBQuery(java.lang.String) - */ + @Override protected String prepareInputData4RegionDBQuery(String value) { log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery"); double distance=0.; String returnValue = null; try { - Point center = new InputValidator().getPointValue(value); + Point center = InputValidator.getPointValue(value); String meshId = super.inputData.get("meshid").getValue(); int segments = 97; if (meshWidths != null){ @@ -107,12 +113,10 @@ log.error(e,e); } return returnValue; - + } - - /** - * @see de.intevation.gnv.state.StateBase#extractKVP(java.util.Collection, java.lang.String, java.lang.String) - */ + + @Override protected NamedCollection<KeyValueDescibeData> extractKVP( Collection<Result> result, @@ -127,32 +131,36 @@ Result resultValue = rit.next(); String key = resultValue.getString(keyid); if(prevKey == null || !prevKey.equals(key)){ // TODO: FIXME: We have to do that because the arcsde does not support a distinct Query on Layers - String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid)); + String geomString = CoordinateSelectionState.convert2DisplayCoordinate(resultValue.getString(valueid)); String value = geomString; if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){ value = resultValue.getString("VALUE") + " - "+value; } - - + + keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value )); } prevKey = key; } return keyValueDescibeData; } - + + /** + * Turn coordinate into a human readable format. + * + * @param wkt Coordinate as wkt string. + * @return formatted coordinate. + */ protected static String convert2DisplayCoordinate(String wkt){ return WKTUtils.toText(wkt); } - /** - * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node) - */ + @Override public void setup(Node configuration) { super.setup(configuration); Element widthElement = (Element)Config.getNodeXPath(configuration, MESH_WIDTH_XPATH); - + if (widthElement != null){ String fileName = widthElement.getAttribute(XLINK_XPATH); fileName = Config.replaceConfigDir(fileName); @@ -172,3 +180,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.geobackend.base.Result; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + + +/** + * Default implementation of <code>AutoResumeState</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class DefaultAutoResumeState extends StateBase implements AutoResumeState +{ + /** + * The UID of this Class. + */ + private static final long serialVersionUID = -4470531390092041577L; + + /** + * Constructor + */ + public DefaultAutoResumeState() { + super(); + } + + + @Override + protected List<Object> purifyResult(Collection<Result> result, String uuid) { + return new ArrayList<Object>(0); + } + + + @Override + protected String[] getDescriptionForInputData( + InputData data, CallContext context, String uuid) { + return new String[0]; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultExportMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultExportMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,31 +1,59 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This is the default implementation of <code>ExportMode</code>. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultExportMode implements ExportMode { + /** + * The name of the export (e.g. pdf, svg, image). + */ protected String name; + + /** + * A description for this export. + */ protected String description; + + /** + * The mimetype used to do execute this export. + */ protected String mimeType; + /** + * Constructor. + * + */ public DefaultExportMode(String name, String description, String mimeType){ this.name = name; this.description = description; this.mimeType = mimeType; } + public String getName() { return name; } + public String getDescription() { return description; } + public String getMimeType() { return mimeType; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state; import java.util.HashMap; @@ -6,8 +14,11 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * The default implementation of <code>InputData</code>. This object stores + * multiple values separated by {@link #VALUE_SEPARATOR} for a specific key. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultInputData implements InputData { @@ -18,11 +29,30 @@ private static final Logger logger = Logger.getLogger(DefaultInputData.class); - private final static String VALUE_SEPARATOR = " , "; + /** + * The character used to separate the different values. + */ + public final static String VALUE_SEPARATOR = " , "; + /** + * The key/name of this object. + */ protected String name; + + /** + * Values separated by {@link #VALUE_SEPARATOR}. + */ protected String value; + + /** + * Descriptions for values used for user interface creation. Each value + * should have an own description in this map. + */ protected Map description; + + /** + * An extra object. Might be everything. + */ protected Object object; @@ -34,33 +64,48 @@ this.value = value; } + public DefaultInputData(String name, Object object) { this.name = name; this.object = object; } - /** - * @see de.intevation.gnv.state.InputData#getName() - */ + + public DefaultInputData( + String name, + String value, + Object object) + { + this.name = name; + this.object = object; + this.value = value; + } + + public String getName() { return this.name; } - /** - * @see de.intevation.gnv.state.InputData#getValue() - */ + public String getValue() { return this.value; } + public void setObject(Object object) { this.object = object; } + public Object getObject() { return object; } + /** + * + * @param key Key needs to be a single value of {@link #value}. + * @return the description. + */ public String getDescription(String key) { if (description == null) return null; @@ -68,6 +113,11 @@ return (String) description.get(key); } + /** + * Return all descriptions as array. + * + * @return descriptions as array. + */ public String[] getDescription() { String[] values = splitValue(); int length = values.length; @@ -80,6 +130,7 @@ return description; } + public void setDescription(String[] description) { if (this.description == null) this.description = new HashMap(); @@ -99,24 +150,18 @@ } } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { return this.name + "==> " + this.value; } - /** - * @see de.intevation.gnv.state.InputData#concartValue(java.lang.String) - */ + public void concartValue(String value) { this.value = this.value + VALUE_SEPARATOR + value; } - /** - * @see de.intevation.gnv.state.InputData#splitValue() - */ + public String[] splitValue() { if (this.value != null){ return this.value.split(VALUE_SEPARATOR); @@ -124,4 +169,53 @@ return null; } + @Override + public int hashCode() { + logger.debug("*************************************"); + logger.debug("HashCode name: " + name); + + int hash = 0; + + hash ^= name.hashCode(); + + if (value != null) { + hash ^= value.hashCode() << 2; + } + + if (object != null) { + hash ^= object.hashCode() << 4; + } + + logger.debug("HashCode value: " + hash); + logger.debug("*************************************"); + + return hash; + } + + + @Override + public boolean equals(Object o) { + if (!(o instanceof DefaultInputData)) + return false; + + DefaultInputData other = (DefaultInputData) o; + + if (!name.equals(other.name)) + return false; + + if ((value == null) && (other.value == null)) + return false; + + if (!value.equals(other.value)) + return false; + + if (!(object == null) && (other.object == null)) + return false; + + if (!(object == other.object)) + return false; + + return true; + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputValue.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputValue.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The default implementation of <code>InputValue</code>. InputValue objects are + * used to store meta information about <code>InputData</code> objects. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultInputValue implements InputValue { @@ -19,6 +26,7 @@ private int usedInQueries = 1; private String defaultValue = "N/N"; + public DefaultInputValue(String name, String type, String defaultValue, boolean multiselect) { this(name, type, multiselect, 1); @@ -26,9 +34,7 @@ } - /** - * Constructor - */ + public DefaultInputValue(String name, String type, boolean multiselect, int usedInQueries) { this.name = name; @@ -37,22 +43,20 @@ this.usedInQueries = usedInQueries; } - /** - * @see de.intevation.gnv.state.InputValue#getName() - */ + public String getName() { return this.name; } - /** - * @see de.intevation.gnv.state.InputValue#getType() - */ + public String getType() { return this.type; } /** - * @see java.lang.Object#toString() + * Returns the information as string. + * + * @return information as string. */ @Override public String toString() { @@ -60,19 +64,20 @@ + "==> multiselect: " + this.multiselect; } - /** - * @see de.intevation.gnv.state.InputValue#isMultiselect() - */ + public boolean isMultiselect() { return this.multiselect; } + public int usedInQueries() { return this.usedInQueries; } + public String getDefaultValue() { return this.defaultValue; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultOutputMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultOutputMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,21 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state; import java.util.Collection; import java.util.List; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * The default implementation of <code>OutputMode</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultOutputMode implements OutputMode { @@ -21,10 +31,12 @@ /** * Constructor - * - * @param name - * @param description - * @param mimeType + * + * @param name The name of the output mode. + * @param description The description of this output mode. + * @param mimeType The mime type used by this output mode. + * @param inputParameters The input parameters required by this output mode. + * @param exportModes The export modes for this output mode. */ public DefaultOutputMode( String name, @@ -42,28 +54,28 @@ } /** - * @see de.intevation.gnv.state.OutputMode#getDescription() + * @return the description. */ public String getDescription() { return this.description; } /** - * @see de.intevation.gnv.state.OutputMode#getMimeType() + * @return the mime type. */ public String getMimeType() { return this.mimeType; } /** - * @see de.intevation.gnv.state.OutputMode#getName() + * @return the name. */ public String getName() { return this.name; } /** - * @see java.lang.Object#toString() + * @return this output mode as string. */ @Override public String toString() { @@ -72,15 +84,19 @@ } /** - * @see de.intevation.gnv.state.OutputMode#getInputParameters() + * @return the input parameters. */ public Collection<InputValue> getInputParameters() { return this.inputParameters; } + /** + * + * @return the export modes. + */ public List<ExportMode> getExportModes() { return exportModes; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the default implementation of <code>StateBase</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class DefaultState extends StateBase { @@ -21,3 +28,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/ExportMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/ExportMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,15 +1,42 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state; import java.io.Serializable; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This interface defines basic methods which are necessary for exports. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public interface ExportMode extends Serializable { + /** + * Return the export name (e.g. pdf, svg, image). + * + * @return the export name. + */ public String getName(); + + /** + * Return the description for this export. + * + * @return the export description. + */ public String getDescription(); + + /** + * Returns the mime type used by this export. + * + * @return export's mimetype. + */ public String getMimeType(); } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/ExtendedInputData.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state; + +/** + * This class is used to save the relation between two attributes. Mainly used + * to save the relation between a measurement and the parameter it belongs to. + * + * @see MeasurementState + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ExtendedInputData extends DefaultInputData { + + /** + * The separater used to separate measurement ids and parameter ids. + */ + public static final String SEPARATOR = ";"; + + /** + * The parameter this object belongs to. + */ + protected String parameterid; + + /** + * Constructcor. + * + * @param name + * @param value + * @param object + * @param parameterid + */ + public ExtendedInputData( + String name, + String value, + Object object, + String parameterid) + { + super(name, value, object); + this.parameterid = parameterid; + } + + /** + * Return the parameter ids this object belongs to. + * + * @return the parameter id. + */ + public String getParameterID() { + return parameterid; + } + + /** + * Set the parameter ids. + * + * @param parameterid Parameter ids. + */ + public void setParameter(String parameterid) { + this.parameterid = parameterid; + } + + /** + * Return all parameter ids as array. + * + * @return Array of parameter ids. + */ + public String[] splitParameter() { + if (parameterid != null) + return parameterid.split(SEPARATOR); + + return null; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,31 +1,88 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface defines the basic methods used to store multiple values with + * a specific key and name. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface InputData extends Serializable { + /** + * Method to Retrieve the name of this input data item. + * + * @return the name + */ public String getName(); + /** + * Method to retrieve the value of this input data item. A value might be a + * list of values separated by a specific character. + * + * @return the value + */ public String getValue(); + /** + * Method to store a further object at this input data item. + * + * @param o A further object. + */ public void setObject(Object o); + /** + * Method to retrieve the extra object. + * + * @return the extra object. + */ public Object getObject(); + /** + * Method to store descriptions for this input data item. + * + * @param description Array of descriptions. + */ public void setDescription(String[] description); + /** + * Method to retrieve a description specified by a given key. + * + * @param key Key. + * @return the description for this key. + */ public String getDescription(String key); + /** + * Method to retrieve all descriptions of this input data item. + * + * @return descriptions. + */ public String[] getDescription(); + /** + * Append a further string value to the value field devided by a separater + * character. + * + * @param value Value to append. + */ public void concartValue(String value); - + + /** + * Method to retrieve the character separated values split into an array. + * + * @return values as array. + */ String[] splitValue(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputValue.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputValue.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,58 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface defines some basic methods to retrieve information about the + * type of an user input. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface InputValue extends Serializable { + /** + * Retrieve the name of the inserted data. + * + * @return the input data name. + */ public String getName(); + /** + * Retrieve the type of the input. + * + * @return the input data type. + */ public String getType(); + /** + * Retrieve the default value used when no input is done. + * + * @return the input data default value. + */ public String getDefaultValue(); + /** + * Retrieve information about mutliselect fields. + * + * @return true, if the input data is a multiselect, otherwise false. + */ public boolean isMultiselect(); + /** + * Retrieve information about the occurance of this input in an sql + * statement. + * + * @return the number of times, this data is used in a sql query. + */ public int usedInQueries(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/MeasurementState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/MeasurementState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,16 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; import de.intevation.gnv.artifacts.ressource.RessourceFactory; @@ -14,11 +23,17 @@ import de.intevation.gnv.state.describedata.NamedArrayList; import de.intevation.gnv.state.describedata.NamedCollection; +import de.intevation.gnv.state.exception.StateException; + +import de.intevation.gnv.utils.InputValidator; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.Locale; +import java.util.TreeMap; import org.apache.log4j.Logger; @@ -27,7 +42,13 @@ import org.w3c.dom.Node; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This state handles input of measurements relating to a parameter. The user + * interface description created by this class represents a matrix - each + * parameter in a single row, each measurement in a column. An invalid + * measurement column for a specific parameter is marked as disabled and should + * not be selected. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class MeasurementState extends DefaultState @@ -36,7 +57,16 @@ public static final String SQL_KEY_PARAMETERID = "PARAMETERID"; + public static final String SEPARATOR = ";"; + + /** + * This class is used to generate the Matrix in <code>MinMaxDateState</code>. + * Parameter and Measurements are stored in separate lists and can be + * requested via different methods. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ private class ParameterMatrix { private final Logger logger = Logger.getLogger(ParameterMatrix.class); @@ -46,6 +76,12 @@ private List parameters; private boolean[][] values; + /** + * Constructs a new matrix. + * + * @param data A collection containing the measurements. + * @param parameter An array of parameters. + */ public ParameterMatrix(Collection data, String[] parameter) { measurements = new ArrayList(data.size()); mDescriptions = new ArrayList(data.size()); @@ -60,6 +96,11 @@ initMeasurements(data); } + /** + * Initialize the measurements used in this matrix. + * + * @param data The measurements. + */ private void initMeasurements(Collection data) { Iterator iter = data.iterator(); while (iter.hasNext()) { @@ -75,17 +116,15 @@ if (i < 0) { measurements.add(key); i = measurements.indexOf(key); + + mDescriptions.add(val); + tmp = mDescriptions.indexOf(val); } if (j < 0) { logger.warn("Not a valid parameter: " + parameter); } - if (tmp < 0) { - mDescriptions.add(val); - tmp = mDescriptions.indexOf(val); - } - if (i >= 0 && i < measurements.size() && j >= 0 && j < parameters.size()) { @@ -94,13 +133,22 @@ } } + /** + * Initialize the parameters used in this matrix. + * + * @param parameter Parameters. + */ private void initParameters(String[] parameter) { - int count = parameter.length; - for (int i = 0; i < count; i++) { - parameters.add(parameter[i]); + for (String param: parameter) { + parameters.add(param); } } + /** + * Returns the number of measurements. + * + * @return the number of measurements. + */ public int measurementSize() { if (measurements != null) return measurements.size(); @@ -108,6 +156,11 @@ return 0; } + /** + * Returns the number of parameters. + * + * @return number of parameters. + */ public int parameterSize() { if (parameters != null) return parameters.size(); @@ -115,6 +168,12 @@ return 0; } + /** + * Returns the measurement at idx. + * + * @param idx Index. + * @return the measurement. + */ public String getMeasurement(int idx) { if (idx >= 0 && idx < measurements.size()) return (String) measurements.get(idx); @@ -123,6 +182,12 @@ return ""; } + /** + * Returns the parameter at idx. + * + * @param idx Index + * @return the parameter. + */ public String getParameter(int idx) { if (idx >= 0 && idx < parameters.size()) { return (String) parameters.get(idx); @@ -132,6 +197,12 @@ return ""; } + /** + * Returns a description text for a specific measurement. + * + * @param idx Index of a measurement. + * @return measurement's description. + */ public String getMDescription(int idx) { if (mDescriptions != null) { return (String) mDescriptions.get(idx); @@ -140,6 +211,14 @@ return null; } + /** + * This method returns true, if a measurement is valid for a specific + * parameter - otherwise false. + * + * @param i Index of a measurement column. + * @param j Index of a parameter row. + * @return true, if valid, else false. + */ public boolean isValid(int i, int j) { if (i < 0 || i > measurements.size() || j < 0 || j > parameters.size()) @@ -192,6 +271,11 @@ } + /** + * This method create the user interface description for measurement and + * parameters as matrix. A row for each parameter, a column for each + * measurement. + */ @Override protected void appendToDynamicNode( XMLUtils.ElementCreator artCreator, @@ -218,12 +302,13 @@ int measurements = matrix.measurementSize(); int parameters = matrix.parameterSize(); - for (int i = 0; i < measurements; i++) { + for (int i = 0; i < parameters; i++) { Element select = creator.create("select"); - creator.addAttr(select, "label", matrix.getMDescription(i)); + String param = matrix.getParameter(i); + creator.addAttr(select, "label", inputParam.getDescription(param)); creator.addAttr(select, "ref", name); - for (int j = 0; j < parameters; j++) { + for (int j = 0; j < measurements; j++) { Element item = creator.create("item"); Element label = creator.create("label"); Element value = creator.create("value"); @@ -232,17 +317,18 @@ creator.addAttr( item, "parameter", - inputParam.getDescription(matrix.getParameter(j))); + matrix.getMDescription(j)); - if (!matrix.isValid(i, j)) { + if (!matrix.isValid(j, i)) { creator.addAttr(item, "disabled", "true"); } else { creator.addAttr(item, "disabled", "false"); } - label.setTextContent(matrix.getMDescription(i)); - value.setTextContent(matrix.getMeasurement(i)); + String tmpValue = matrix.getMeasurement(j) + ";" + param; + label.setTextContent(matrix.getMDescription(j)); + value.setTextContent(tmpValue); item.appendChild(label); item.appendChild(value); @@ -254,5 +340,118 @@ dynamicNode.appendChild(matrixNode); } + + + /** + * This feed takes some input data storing measurement ids and parameter ids + * and put them into ExtendedInputData objects to save the relation between + * a measurement and the parameter it belongs to. + */ + @Override + public Document feed( + CallContext context, + Collection<InputData> input, + String uuid) + throws StateException + { + RessourceFactory resFactory = RessourceFactory.getInstance(); + Locale[] serverLocales = resFactory.getLocales(); + Locale locale = context.getMeta().getPreferredLocale( + serverLocales); + + if (input == null) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_NO_INPUT, + EXCEPTION_NO_INPUT); + logger.warn(msg); + return feedFailure(msg); + } + + for(InputData item: input) { + String name = item.getName(); + InputValue inputValue = inputValues.get(name); + + String[] tupel = extractValuesAndParams(item.getValue()); + String type = inputValue.getType(); + + if (inputValue == null) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_INVALID_INPUT, + EXCEPTION_INVALID_INPUT); + logger.warn(msg); + return feedFailure(msg); + } + + if (!InputValidator.isInputValid(tupel[0], type)) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_INVALID_INPUT, + EXCEPTION_INVALID_INPUT); + logger.warn(msg); + return feedFailure(msg); + } + + if (inputData == null) { + inputData = new TreeMap<String, InputData>(); + } + + ExtendedInputData extended = new ExtendedInputData( + name, + tupel[0], + item.getObject(), + tupel[1]); + + if (name.equals(dataName)) { + String[] desc = getDescriptionForInputData( + extended, context, uuid); + extended.setDescription(desc); + } + + inputData.put(name, extended); + } + + return feedSuccess(); + } + + + /** + * Extract parameter ids and measurement ids from DefaultInputData objects + * and return an array. In the first position of this array, the measurement + * ids are placed, in the second position the parameter ids - all separated + * by a character. + * + * @param tmp String containing measurement ids and parameter ids. + * @return An array with separated measurements and parameters. + */ + protected String[] extractValuesAndParams(String tmp) { + String[] array = tmp.split(DefaultInputData.VALUE_SEPARATOR); + + String[] extracted = new String[2]; + for (String item: array) { + String[] tupel = item.split(ExtendedInputData.SEPARATOR); + + if (extracted[0] == null) { + extracted[0] = tupel[0]; + } + else { + extracted[0] += + DefaultInputData.VALUE_SEPARATOR + tupel[0]; + } + + if (extracted[1] == null) { + extracted[1] = tupel[1]; + } + else { + extracted[1] += DefaultInputData.VALUE_SEPARATOR + tupel[1]; + } + } + + logger.debug("VALUES RESULT: " + extracted[0]); + logger.debug("PARAMS RESULT: " + extracted[1]); + + return extracted; + } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxDateState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state; + +import java.util.Collection; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Iterator; +import java.util.Locale; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.CallContext; +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.geobackend.util.DateUtils; +import de.intevation.gnv.state.describedata.DefaultMinMaxDescribeData; +import de.intevation.gnv.state.describedata.DescribeData; +import de.intevation.gnv.state.describedata.MinMaxDescribeData; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.utils.InputValidator; + +/** + * This state handles date input. The resulting describe document of this state + * contains two fields in the user interface description to define a time range. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class MinMaxDateState extends MinMaxState { + + + /** + * + */ + public static final String EXCEPTION_DATE_REQUIRED = + "input.is.not.valid.date.required"; + + /** + * + */ + public static final String EXCEPTION_START_AFTER_END = + "start.date.after.end.date"; + + /** + * + */ + public static final String EXCEPTION_DATE_OUT_OF_RANGE = + "date.out.of.range"; + + /** + * + */ + public static final String EXCEPTION_MISSING_DATE = + "missing.data.field"; + + private static Logger logger = Logger.getLogger(MinMaxDateState.class); + + + /** + * + */ + public MinMaxDateState() { + super(); + } + + + /** + * This feed method needs a collection of two InputData objects. These + * objects' values need to be a datetime string which is turned into a Date + * object. Afterwards, the given dates are validated. Min and max date need + * to be in range of the min and max date retrieved by + * {@link #getDescibeData(java.lang.String)}. + */ + @Override + public Document feed( + CallContext context, + Collection<InputData> inputData, + String uuid) + throws StateException { + RessourceFactory resFactory = RessourceFactory.getInstance(); + Locale[] serverLocales = resFactory.getLocales(); + Locale locale = context.getMeta().getPreferredLocale( + serverLocales); + + if (inputData == null) { + String msg = "No input data given."; + logger.warn(msg); + return feedFailure(msg); + } + + Iterator iter = inputData.iterator(); + + MinMaxDescribeData data = + (MinMaxDescribeData) getDescibeData(uuid).get(0); + Object min = data.getMinValue(); + Object max = data.getMaxValue(); + + Object tmpMin = null; + Object tmpMax = null; + + while (iter.hasNext()) { + InputData tmp = (InputData) iter.next(); + InputValue meta = inputValues.get(tmp.getName()); + String type = meta.getType(); + String value = tmp.getValue(); + String name = tmp.getName(); + + if (meta == null) { + String msg = "Input data not expected here. Data will be ignored."; + logger.warn(msg); + return feedFailure(msg); + } + + if (!InputValidator.isInputValid(value, type)) { + String msg = resFactory.getRessource( + locale, EXCEPTION_DATE_REQUIRED, EXCEPTION_DATE_REQUIRED); + logger.error(msg); + return feedFailure(msg); + } + + Date lower = null; + if (min instanceof GregorianCalendar) { + lower = ((GregorianCalendar)min).getTime(); + } + + Date upper = null; + if (max instanceof GregorianCalendar) { + upper = ((GregorianCalendar)max).getTime(); + } + + Date d = null; + try { + d = DateUtils.getDateFromString(value,DateUtils.DATE_PATTERN); + } + catch (Exception e) { + logger.warn(e, e); + } + + if (d == null || lower == null || upper == null) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_MISSING_DATE, + EXCEPTION_MISSING_DATE); + logger.warn(msg); + } + else { + if (logger.isDebugEnabled()) { + logger.debug("Date to validate: " + d.toString()); + logger.debug("Lower date bound: " + lower.toString()); + logger.debug("Upper date bound: " + upper.toString()); + } + + if (!InputValidator.isDateValid(d, lower, upper)) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_DATE_OUT_OF_RANGE, + EXCEPTION_DATE_OUT_OF_RANGE); + logger.error(msg); + return feedFailure(msg); + } + } + + if (name.equals(MINVALUEFIELDNAME)) { + tmpMin = value; + } + + if (name.equals(MAXVALUEFIELDNAME)) { + tmpMax = value; + } + + if (tmpMin != null && tmpMax != null) { + if (!InputValidator.isInputValid((String) tmpMin, (String) tmpMax, type)) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_START_AFTER_END, + EXCEPTION_START_AFTER_END); + logger.error(msg); + return feedFailure(msg); + } + } + } + + DescribeData values = new DefaultMinMaxDescribeData( + dataName, tmpMin, tmpMax, getID()); + + this.inputData.put(dataName, new DefaultInputData(dataName, values)); + + return feedSuccess(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,12 @@ -package de.intevation.gnv.state; - -import de.intevation.artifactdatabase.XMLUtils; - -import de.intevation.artifacts.CallMeta; - -import de.intevation.gnv.artifacts.ressource.RessourceFactory; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import de.intevation.gnv.geobackend.base.Result; - -import de.intevation.gnv.geobackend.util.DateUtils; - -import de.intevation.gnv.state.describedata.DefaultMinMaxDescribeData; -import de.intevation.gnv.state.describedata.DescribeData; -import de.intevation.gnv.state.describedata.MinMaxDescribeData; - -import de.intevation.gnv.state.exception.StateException; - -import de.intevation.gnv.utils.InputValidator; +package de.intevation.gnv.state; import java.util.ArrayList; import java.util.Collection; @@ -24,29 +14,47 @@ import java.util.GregorianCalendar; import java.util.Iterator; import java.util.List; +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 de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.util.DateUtils; +import de.intevation.gnv.state.describedata.DefaultMinMaxDescribeData; +import de.intevation.gnv.state.describedata.DescribeData; +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) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This state handles input of a min and max value and validates the user input. + * The min value needs to be equal or smaller than the max value, otherwise the + * input results in an error. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class MinMaxState extends StateBase { /** - * The UID of this Class - */ - private static final long serialVersionUID = -3525903792105187408L; - /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(MinMaxState.class); - /** + /** + * Key to lookup the localized exceptionmessage in the ResourceFiles. + */ + public static final String EXCEPTION_INVALID_MIN_MAX_INPUT = + "input.is.not.valid.minmax"; + + /** * Constructor */ public MinMaxState() { @@ -54,8 +62,10 @@ } /** - * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection, - * java.lang.String) + * The objects returned by the database are searched for two fields with + * 'MIN' and 'MAX' as names. These objects are stored and used to be + * displayed in the gui to give the user an orientation of the range he is + * able to insert. */ @Override protected List<Object> purifyResult( @@ -79,16 +89,19 @@ } - /** - * @see de.intevation.gnv.state.StateBase#feed(java.util.Collection, - * java.lang.String) - */ @Override - public void feed(Collection<InputData> inputData, String uuid) - throws StateException - { - if (inputData == null) - return; + public Document feed( + CallContext context, + Collection<InputData> inputData, + String uuid) + throws StateException { + RessourceFactory resFactory = RessourceFactory.getInstance(); + + if (inputData == null) { + String msg = "No input data given."; + log.warn(msg); + return feedFailure(msg); + } InputValidator iv = new InputValidator(); Iterator iter = inputData.iterator(); @@ -99,19 +112,21 @@ while (iter.hasNext()) { InputData tmp = (InputData) iter.next(); InputValue meta = inputValues.get(tmp.getName()); + String type = meta.getType(); String value = tmp.getValue(); String name = tmp.getName(); if (meta == null) { - log.warn("Input data not expected here. Data will be ignored."); - return; + String msg = "Input data not expected here. Data will be ignored."; + log.warn(msg); + return feedFailure(msg); } - boolean valid = iv.isInputValid(value, meta.getType()); + boolean valid = InputValidator.isInputValid(value, type); if (!valid) { String msg = "Input is not valid for this state."; log.error(msg); - throw new StateException(msg); + return feedFailure(msg); } if (name.equals(MINVALUEFIELDNAME)) { @@ -121,14 +136,32 @@ if (name.equals(MAXVALUEFIELDNAME)) { max = value; } + + if (min != null && max != null) { + if (!InputValidator.isInputValid((String) min, + (String) max, + type)) { + Locale[] serverLocales = resFactory.getLocales(); + Locale locale = context.getMeta() + .getPreferredLocale( + serverLocales); + String msg = resFactory.getRessource(locale, + EXCEPTION_INVALID_MIN_MAX_INPUT, + EXCEPTION_INVALID_MIN_MAX_INPUT); + log.error(msg); + return feedFailure(msg); + } + } } - if (min != null && max != null) { - DescribeData values = new DefaultMinMaxDescribeData( - dataName, min, max, getID()); - this.inputData.put(dataName, new DefaultInputData(dataName, values)); - } + + DescribeData values = new DefaultMinMaxDescribeData( + dataName, min, max, getID()); + + this.inputData.put(dataName, new DefaultInputData(dataName, values)); + + return feedSuccess(); } @@ -204,4 +237,4 @@ staticNode.appendChild(groupNode); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,62 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; import java.io.Serializable; + import java.util.Collection; import java.util.List; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the interface description of an <code>OutputMode</code>. The + * methods defined here retrieve some basic information for an output. An output + * can be chart, histogram, statistic, csv, odv and so on. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public interface OutputMode extends Serializable { + /** + * Retrieve the name of this output mode. + * + * @return the name of this output mode. + */ public String getName(); + /** + * Retrieve the description of an output. + * + * @return the description. + */ public String getDescription(); + /** + * Retrieve the mimetype used for the output. + * + * @return the mimetype. + */ public String getMimeType(); + /** + * Retrieve a list of optional InputValue objects the user is able to + * adjust. + * + * @return optional input parameters. + */ public Collection<InputValue> getInputParameters(); + /** + * Retrieve a list of export modes this output can be exported to. + * + * @return some export modes. + */ public List<ExportMode> getExportModes(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; import de.intevation.artifacts.CallContext; @@ -14,19 +19,27 @@ import org.w3c.dom.Document; /** - * @author Tim Englich (tim.englich@intevation.de) - * + * This is the interface description of an output state. Currently, there are + * two methods defined:<br> + * <ol> + * <li>out(): To start an output of the current state.</li> + * <li>getOutputModes(): To retrieve a list of possible output modes.</li> + * </ol> + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ -public interface OutputState +public interface OutputState extends State { /** * Returns the Rendered Result of an State. - * - * @param outputMode - * The Mode that should be produces (Chart, Map, ...) - * @return The Bytecode of the Result + * + * @param format + * @param inputData + * @param outputStream + * @param uuid + * @param callContext * @throws StateException */ public void out( @@ -39,8 +52,9 @@ /** * Delivers the provided OutputModes of an State - * + * * @return the provided OutputModes of an State */ public Collection<OutputMode> getOutputModes(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; import java.io.OutputStream; @@ -21,8 +26,8 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; import de.intevation.gnv.artifacts.cache.CacheFactory; @@ -36,11 +41,16 @@ import de.intevation.gnv.utils.InputValidator; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the default implementation of <code>OutputState</code>. Artifacts + * having reached this state or a subclass of this state are able to produce + * some output (e.g. chart, histograms, statistic, etc). + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * */ -public abstract class OutputStateBase -extends StateBase +public abstract class OutputStateBase +extends StateBase implements OutputState { public static final String XPATH_OUTPUT_MODE = @@ -69,7 +79,7 @@ * The different Outputmodes which are provided by an OutputState */ protected Collection<OutputMode> outputModes = null; - + protected String queryODVID = null; /** @@ -79,24 +89,19 @@ super(); } - /** - * @see de.intevation.gnv.state.OutputState#getOutputModes() - */ public Collection<OutputMode> getOutputModes() { log.debug("OutputStateBase.getOutputModes"); return this.outputModes; } - /** - * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node) - */ + @Override public void setup(Node configuration) { log.debug("OutputStateBase.setup"); super.setup(configuration); - + this.queryODVID = Config.getStringXPath(configuration,"queryID-odv"); - + NodeList outputModeList = Config.getNodeSetXPath(configuration, "outputsModes/outputsMode"); if (outputModeList != null) { @@ -156,42 +161,53 @@ } } - /** - * @see de.intevation.gnv.state.StateBase#advance() - */ + @Override public void advance(String uuid, CallContext context) throws StateException { } + @Override public void initialize(String uuid, CallContext context) throws StateException { } + /** + * This method needs to be defined by concrete subclasses. Nothing is done + * here. + */ public void out( - Document format, + Document format, Collection<InputData> inputData, - OutputStream outputStream, - String uuid, + OutputStream outputStream, + String uuid, CallMeta callMeta ) - throws StateException + throws StateException { } /** - * @see de.intevation.gnv.state.OutputState#out(java.lang.String, - * java.util.Collection, java.io.OutputStream) + * This method needs to be defined by concrete subclasses. Nothing is done + * here. */ public void out(String outputMode, Collection<InputData> inputData, OutputStream outputStream) throws StateException { } /** - * @return + * Returns the data used to create charts. If a cache is configured, try to + * fetch the data from cache. The database is queried if the data is not in + * cache yet, or if no cache is configured. If the cache is configured, but + * the data is not in cache yet, put it into cache for a faster access + * in a later time. + * + * @param uuid The uuid of an artifact. + * @param callContext The CallContext. + * @return the chart data. */ protected Object getChartResult(String uuid, CallContext callContext) { log.debug("OutputStateBase.getChartResult"); @@ -224,6 +240,12 @@ } } + /** + * This method should no longer be used, because it is not good to put a + * chart into cache. Parameter changes done by the user wouldn't be detected + * proper. + * @deprecated + */ protected Object getChartFromCache(String uuid, CallContext callContext) { log.debug("Fetch chart [" + uuid + "] from cache"); CacheFactory cacheFactory = CacheFactory.getInstance(); @@ -237,7 +259,13 @@ } return null; } - + + /** + * Retrieves the data used to create an ODV export. + * + * @param uuid + * @return odv data. + */ protected Collection<Result> getODVResult(String uuid) { log.debug("OutputStateBase.getODVResult"); // TODO add Caching? I think it's not nessessary @@ -251,8 +279,10 @@ } /** - * @param returnValue - * @return + * Retrieve data from database with help of queryID. + * + * @param queryID A query id defined in sql statements properties file. + * @return some data. */ protected Collection<Result> getData(String queryID) { log.debug("OutputStateBase.getData"); @@ -272,7 +302,11 @@ } return returnValue; } - + + /** + * This method removes the data used for creating charts from cache. + * + */ protected void removeChartResult(String uuid) { log.debug("OutputStateBase.getChartResult"); if (CacheFactory.getInstance().isInitialized()) { @@ -285,6 +319,11 @@ } } + /** + * This method should no longer be used. It removes a chart from cache. + * + * @deprecated + */ protected void removeChart(String uuid) { log.debug("OutputStateBase.removeChart from cache"); @@ -297,6 +336,9 @@ } } + /** + * This is an internal method used while database query. + */ protected void purifyChart(Object chart, String uuid) { log.debug("Prufify chart [" + uuid + "]"); CacheFactory cacheFactory = CacheFactory.getInstance(); @@ -307,18 +349,29 @@ } + /** + * Use this method to feed a state with new data. + */ @Override - public void feed(Collection<InputData> inputData, String uuid) + public Document feed( + CallContext context, + Collection<InputData> inputData, + String uuid) throws StateException { putInputData(inputData, uuid); + + return feedSuccess(); } /** - * @see de.intevation.gnv.state.StateBase#putInputData(java.util.Collection, java.lang.String) + * This method is used to put new data into a next state. The difference + * between this method and feed is, that this method should be used to + * transfer some old input data required by this state. New data need to be + * inserted via feed! */ @Override - public void putInputData(Collection<InputData> inputData, + public void putInputData(Collection<InputData> inputData, String uuid) throws StateException { log.debug("OutputStateBase.putInputData"); @@ -338,13 +391,13 @@ inputData.size()); } - boolean valid = iv.isInputValid(tmpItem.getValue(), + boolean valid = InputValidator.isInputValid(tmpItem.getValue(), inputValue.getType()); if (valid) { if (tmpItem.getName().equals(MINVALUEFIELDNAME)){ String minValue = tmpItem.getValue(); String maxValue = getInputValue4ID(inputData, MAXVALUEFIELDNAME); - valid = iv.isInputValid(maxValue,inputValue.getType()); + valid = InputValidator.isInputValid(maxValue,inputValue.getType()); if (!valid){ String errMsg = "Wrong input for " + tmpItem.getValue() + " is not an " + inputValue.getType() @@ -353,7 +406,7 @@ throw new StateException(errMsg); } - valid = iv.isInputValid(minValue, + valid = InputValidator.isInputValid(minValue, maxValue, inputValue.getType()); if (!valid){ @@ -364,7 +417,7 @@ }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){ String minValue = getInputValue4ID(inputData, MINVALUEFIELDNAME); String maxValue = tmpItem.getValue(); - valid = iv.isInputValid(minValue,inputValue.getType()); + valid = InputValidator.isInputValid(minValue,inputValue.getType()); if (!valid){ String errMsg = "Wrong input for " + tmpItem.getValue() + " is not an " + inputValue.getType() @@ -373,7 +426,7 @@ throw new StateException(errMsg); } - valid = iv.isInputValid(minValue, + valid = InputValidator.isInputValid(minValue, maxValue, inputValue.getType()); if (!valid){ @@ -391,7 +444,7 @@ throw new StateException(errMsg); } - } + } else if (tmpObj != null && tmpObj instanceof MinMaxDescribeData) { MinMaxDescribeData data = (MinMaxDescribeData) tmpObj; if (this.inputData == null) { @@ -402,7 +455,7 @@ this.inputData.put("maxvalue", new DefaultInputData("maxvalue", (String) data.getMaxValue())); } else { - + String errMsg = "No Inputvalue given for Inputdata " + tmpItem.getName(); log.warn(errMsg + "Value will be ignored"); @@ -412,14 +465,27 @@ } else { log.warn("No Inputdata given"); } - } - - public void out(String outputMode, Collection<InputData> inputData, - OutputStream outputStream, String uuid, CallMeta callMeta) - throws StateException { + setHash(uuid); } + public void out( + String outputMode, + Collection<InputData> inputData, + OutputStream outputStream, + String uuid, + CallMeta callMeta) + throws StateException { } + + + /** + * Retrieves a message from resource bundle specified by locale. + * + * @param locale Locale to use. + * @param key The key of the message. + * @param value The default value. + * @return The value. + */ protected String getMessage(Locale locale, String key, String value) { return RessourceFactory.getInstance().getRessource( locale, @@ -428,4 +494,4 @@ ); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state; + +import de.intevation.artifacts.common.utils.Config; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.state.exception.StateException; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * This method looks for former inserted coordinates before initialization. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState { + + + /** + * The UID of this Class. + */ + private static final long serialVersionUID = -3972304838976884048L; + + private String transferPreSettingsName = null; + + private String transferInputDataname = null; + /** + * Constructor + */ + public PreSettingsTransferCoordinateSelectionState() { + super(); + } + + + /** + * Lookup mechanism for former inserted data before intialization begins. + * + * @param uuid + * @param context + * @throws StateException + */ + @Override + public void initialize(String uuid, CallContext context) + throws StateException { + Map<String, InputData> preSettings = this.getPreSettings(); + if (preSettings != null){ + InputData ip = preSettings.get(transferPreSettingsName); + if (ip != null){ + Collection<InputData> localInputdata = new ArrayList<InputData>(1); + localInputdata.add(new DefaultInputData(transferInputDataname, + ip.getValue())); + this.putInputData(localInputdata, uuid); + } + } + + super.initialize(uuid, context); + } + + + /** + * + * @param configuration + */ + @Override + public void setup(Node configuration) { + + Element preSettingsNode = (Element)Config.getNodeXPath(configuration, + "presettings-transfer"); + if (preSettingsNode != null){ + this.transferPreSettingsName = preSettingsNode.getAttribute("presetting"); + this.transferInputDataname = preSettingsNode.getAttribute("inputvalue"); + } + super.setup(configuration); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,19 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; +import de.intevation.artifacts.common.utils.Config; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.state.exception.StateException; + import java.util.ArrayList; import java.util.Collection; import java.util.Map; @@ -10,13 +21,12 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifacts.CallContext; -import de.intevation.gnv.state.exception.StateException; - /** - * @author Tim Englich <tim.englich@intevation.de> + * This special state does a lookup for already inserted data while + * initializing. If there are some data for this state, take them for further + * work. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class PreSettingsTransferState extends DefaultState { @@ -26,7 +36,7 @@ private static final long serialVersionUID = 573381812690806922L; private String transferPreSettingsName = null; - + private String transferInputDataname = null; /** * Constructor @@ -35,8 +45,14 @@ super(); } + /** - * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallContext) + * This method does a lookup for already inserted data before initializing + * it. + * + * @param uuid + * @param context + * @throws StateException */ @Override public void initialize(String uuid, CallContext context) @@ -51,25 +67,25 @@ this.putInputData(localInputdata, uuid); } } - + super.initialize(uuid, context); } + /** - * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node) + * + * @param configuration */ @Override public void setup(Node configuration) { - + Element preSettingsNode = (Element)Config.getNodeXPath(configuration, "presettings-transfer"); if (preSettingsNode != null){ this.transferPreSettingsName = preSettingsNode.getAttribute("presetting"); - this.transferPreSettingsName = preSettingsNode.getAttribute("inputvalue"); + this.transferInputDataname = preSettingsNode.getAttribute("inputvalue"); } super.setup(configuration); } - - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/SingleInputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/SingleInputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,20 +1,37 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.state.describedata.DefaultSingleValueDescribeData; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.utils.InputValidator; + import java.util.ArrayList; import java.util.Collection; +import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.apache.log4j.Logger; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.describedata.DefaultSingleValueDescribeData; +import org.w3c.dom.Document; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This state handles single user input. The user is allowed to select just one + * value. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class SingleInputState extends StateBase { @@ -23,9 +40,6 @@ */ private static Logger log = Logger.getLogger(SingleInputState.class); - /** - * - */ private static final long serialVersionUID = -6169497306324917318L; /** @@ -34,10 +48,7 @@ public SingleInputState() { } - /** - * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection, - * java.lang.String) - */ + @Override protected List<Object> purifyResult(Collection<Result> result, String uuid) { log.debug("SingleInputState.purifyResult"); @@ -57,4 +68,62 @@ return describeData; } + /** + * This feed method needs a collection of two InputData objects. These + * objects' values need to be a datetime string which is turned into a Date + * object. Afterwards, the given dates are validated. Min and max date need + * to be in range of the min and max date retrieved by + * {@link #getDescibeData(java.lang.String)}. + */ + @Override + public Document feed( + CallContext context, + Collection<InputData> inputData, + String uuid) + throws StateException { + RessourceFactory resFactory = RessourceFactory.getInstance(); + Locale[] serverLocales = resFactory.getLocales(); + Locale locale = context.getMeta().getPreferredLocale( + serverLocales); + + if (inputData == null) { + String msg = "No input data given."; + log.warn(msg); + return feedFailure(msg); + } + + Iterator<InputData> it = inputData.iterator(); + InputData tmpItem = it.next(); + InputValue inputValue = inputValues.get(tmpItem.getName()); + + if (inputValue == null) { + String msg = resFactory.getRessource( + locale, + EXCEPTION_INVALID_INPUT, + EXCEPTION_INVALID_INPUT); + log.warn(msg); + return feedFailure(msg); + } + + boolean valid = InputValidator.isInputValid( + tmpItem.getValue(), inputValue.getType()); + + if (valid) { + String[] desc = getDescriptionForInputData(tmpItem, context, uuid); + tmpItem.setDescription(desc); + + this.inputData.put(tmpItem.getName(), tmpItem); + return feedSuccess(); + } + + else { + String msg = resFactory.getRessource( + locale, + EXCEPTION_INVALID_INPUT, + EXCEPTION_INVALID_INPUT); + log.warn(msg); + return feedFailure(msg); + } + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,31 +1,65 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state; +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.state.exception.StateException; + import java.io.Serializable; + import java.util.Collection; import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Node; -import de.intevation.artifacts.CallContext; -import de.intevation.gnv.state.exception.StateException; - /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This interface describes the basic method a concrete state class needs to + * implement. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public interface State extends Serializable { + /** + * Setup the state. + * + * @param configuration State configuration. + */ public void setup(Node configuration); + /** + * Return the id of the state. + * + * @return the id. + */ public String getID(); + /** + * Return the description of the state. + * + * @return the description of the state. + */ public String getDescription(); + /** + * This method is called when an artifacts retrieves a describe request. It + * creates the user interface description of the current state. + * + * @param document Describe doucment. + * @param rootNode Parent node for all new xml elements. + * @param context The CallContext. + * @param uuid The uuid of an artifact. + */ public void describe( Document document, Node rootNode, @@ -33,33 +67,124 @@ String uuid ); - public void feed(Collection<InputData> inputData, String uuid) + /** + * This method is used to insert new data into this state. Concrete + * subclasses should valide the input before saving it. + * + * @param context The CallContext. + * @param inputData New InputData items. + * @param uuid The uuid of an artifact. + * @return a document with an error or sucess message. + * @throws StateException + */ + public Document feed( + CallContext context, Collection<InputData> inputData, String uuid) throws StateException; + /** + * Set the previous state. + * + * @param state The previous state. + */ public void setParent(State state); + /** + * Returns the previous state. + * + * @return the previous state. + */ public State getParent(); + /** + * Retrieve a collection of required input values. + * + * @return required input values. + */ public Collection<InputValue> getRequiredInputValues(); + /** + * Retrieves a map with InputData items. + * + * @return a map with InputData items. + */ public Map<String, InputData> inputData(); + /** + * Use this method to feed a state with some data. + * + * @param inputData InputData collection. + * @param uuid UUID of an artifact. + * @throws StateException + */ public void putInputData(Collection<InputData> inputData, String uuid) throws StateException; + /** + * Retrieves a collection with the InputData stored in this state. + * + * @return An InputData collection. + * @throws StateException + */ public Collection<InputData> getInputData() throws StateException; + /** + * This method is called to advance to a next or previous state. + * + * @param uuid The uuid of an artifact. + * @param context The CallContext object. + * @throws StateException + */ public void advance(String uuid, CallContext context) throws StateException; + /** + * This method is called when the state is created. + * + * @param uuid The uuid of an artifact. + * @param context The CallContext object. + * @throws StateException + */ public void initialize(String uuid, CallContext context) throws StateException; + /** + * This method can be used to reset the state. + * + * @param uuid The uuid of an artifact. + */ public void reset(String uuid); + /** + * This method is called when the lifetime of an artifact ends or if the + * user decides to step back to a previous state. + * + * @param globalContext The CallContext. + */ public void endOfLife(Object globalContext); + /** + * This method is used to put some InputData objects into an artifact before + * the parameterization begins. + * + * @param preSettings + */ public void setPreSettings(Map<String,InputData> preSettings); + /** + * This method retrieves a map with InputData objects which have been + * inserted into this state before the parameterization has started. The key + * used to store the objects is the name of the state. + * + * @return map with InputData objects. + */ public Map<String,InputData> getPreSettings(); + + /** + * Method to remove the data stored at a state which should not be + * serialized while an artifact is exported. + * + * @param context The CallContext + */ + public void cleanup(Object context); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,35 +1,15 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; - -import de.intevation.artifacts.ArtifactNamespaceContext; -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.geobackend.util.DateUtils; - -import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; -import de.intevation.gnv.state.describedata.KeyValueDescibeData; -import de.intevation.gnv.state.describedata.MinMaxDescribeData; -import de.intevation.gnv.state.describedata.NamedArrayList; -import de.intevation.gnv.state.describedata.NamedCollection; -import de.intevation.gnv.state.describedata.SingleValueDescribeData; - -import de.intevation.gnv.state.exception.StateException; - -import de.intevation.gnv.utils.InputValidator; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -39,23 +19,50 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.Set; +import java.util.TreeMap; import javax.xml.xpath.XPathConstants; import net.sf.ehcache.Cache; 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.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.artifacts.ArtifactNamespaceContext; +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.geobackend.util.DateUtils; +import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.describedata.MinMaxDescribeData; +import de.intevation.gnv.state.describedata.NamedArrayList; +import de.intevation.gnv.state.describedata.NamedCollection; +import de.intevation.gnv.state.describedata.SingleValueDescribeData; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.utils.ArtifactXMLUtilities; +import de.intevation.gnv.utils.InputValidator; + /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This is the major implementation of <code>State</code>. Nearly every other + * state is derived by this class. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public abstract class StateBase implements State { @@ -70,6 +77,7 @@ private static Logger log = Logger.getLogger(StateBase.class); protected final static String MINVALUEFIELDNAME = "minvalue"; + protected final static String MAXVALUEFIELDNAME = "maxvalue"; private final static String NODATASELECTIONKEY = "n/n"; @@ -77,8 +85,16 @@ public final static String DESCRIBEDATAKEY = "_DESCRIBEDATA"; public final static String XPATH_STATIC_UI = "art:static"; + public final static String XPATH_DYNAMIC_UI = "art:dynamic"; + public static final String EXCEPTION_NO_INPUT = "no.input.data"; + + public static final String EXCEPTION_INVALID_INPUT = + "input.is.not.valid"; + + public final static String HASH_ID_SEPARATOR = "#"; + /** input value names which should not be rendered from State itself */ public final static String[] BLACKLIST = {"sourceid", "fisname"}; @@ -108,6 +124,24 @@ protected Map<String, InputData> preSettings = null; + + /** + * The source date format as string. + */ + public static String srcDateFormat = "yyyy.MM.dd hh:mm:ss"; + + + /** + * The source date format used to read string represented strings. + */ + public static DateFormat srcFormat; + + + static { + srcFormat = new SimpleDateFormat(srcDateFormat); + } + + /** * Constructor */ @@ -115,25 +149,17 @@ super(); } - /** - * @see de.intevation.gnv.state.State#getID() - */ + public String getID() { return this.id; } - /** - * @see de.intevation.gnv.state.State#getDescription() - */ + public String getDescription() { return this.description; } - - /** - * @see de.intevation.gnv.state.State#getRequiredInputValues() - */ public Collection<InputValue> getRequiredInputValues() { return this.inputValues.values(); } @@ -144,15 +170,12 @@ } - /** - * @see de.intevation.gnv.state.State#setup(org.w3c.dom.Node) - */ public void setup(Node configuration) { this.id = ((Element)configuration).getAttribute("id"); this.description = ((Element)configuration).getAttribute("description"); log.info("State-ID = " + this.id); - + NodeList inputValuesNodes = Config.getNodeSetXPath(configuration, "inputvalues/inputvalue"); this.inputValues = new HashMap<String, InputValue>(inputValuesNodes @@ -171,8 +194,8 @@ .warn("Used in Query Value cannot be transformed into a Number"); } } - InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"), - inputValueNode.getAttribute("type"), + InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"), + inputValueNode.getAttribute("type"), Boolean.parseBoolean(inputValueNode. getAttribute("multiselect")), usedinQuery); this.inputValues.put(inputValue.getName(), inputValue); @@ -189,35 +212,39 @@ if (dataMultiSelectValue != null) { this.dataMultiSelect = Boolean.parseBoolean(dataMultiSelectValue); } - + String dataNoSelectValue =Config.getStringXPath(configuration, "data-noselect"); if (dataNoSelectValue != null) { this. dataNoSelect = Boolean.parseBoolean(dataNoSelectValue); } - - this.preSettingsName = Config.getStringXPath(configuration, "presettings-name"); - + + this.preSettingsName = Config.getStringXPath(configuration, "presettings-name"); + } - /** - * @see de.intevation.gnv.state.State#getParent() - */ + public State getParent() { return this.parent; } - /** - * @see de.intevation.gnv.state.State#setParent(de.intevation.gnv.state.State) - */ + public void setParent(State state) { this.parent = state; } - public void feed(Collection<InputData> inputData, String uuid) + public Document feed( + CallContext context, + Collection<InputData> inputData, + String uuid) throws StateException { + RessourceFactory resFactory = RessourceFactory.getInstance(); + Locale[] serverLocales = resFactory.getLocales(); + Locale locale = context.getMeta().getPreferredLocale( + serverLocales); + if (inputData != null) { Iterator<InputData> it = inputData.iterator(); InputValidator iv = new InputValidator(); @@ -226,38 +253,66 @@ InputValue inputValue = this.inputValues.get(tmpItem.getName()); if (inputValue != null) { if (this.inputData == null) { - this.inputData = new HashMap<String, InputData>( - inputData.size()); + this.inputData = new TreeMap<String, InputData>(); } - boolean valid = iv.isInputValid(tmpItem.getValue(), + boolean valid = InputValidator.isInputValid(tmpItem.getValue(), inputValue.getType()); if (valid) { - String[] desc = getDescriptionForInputData(tmpItem, uuid); - tmpItem.setDescription(desc); + + if (tmpItem.getName().equals(this.dataName)){ + String[] desc = getDescriptionForInputData( + tmpItem, context, uuid); + tmpItem.setDescription(desc); + } this.inputData.put(tmpItem.getName(), tmpItem); } else { - String errMsg = "Wrong input for " + tmpItem.getValue() - + " is not an " + inputValue.getType() - + " Value."; - log.warn(errMsg); - throw new StateException(errMsg); + String msg = resFactory.getRessource( + locale, + EXCEPTION_INVALID_INPUT, + EXCEPTION_INVALID_INPUT); + log.warn(msg); + return feedFailure(msg); } } else { - String errMsg = "No Inputvalue given for Inputdata " - + tmpItem.getName(); - log.warn(errMsg + "Value will be ignored"); + String msg = resFactory.getRessource( + locale, + EXCEPTION_INVALID_INPUT, + EXCEPTION_INVALID_INPUT); + log.warn(msg); + return feedFailure(msg); } } + + return feedSuccess(); } else { - log.warn("No Inputdata given"); + String msg = resFactory.getRessource( + locale, + EXCEPTION_NO_INPUT, + EXCEPTION_NO_INPUT); + log.warn(msg); + return feedFailure(msg); } } - private String[] getDescriptionForInputData(InputData data, String uuid) { + protected Document feedSuccess() { + return ArtifactXMLUtilities.createSuccessReport( + "Initialize success", XMLUtils.newDocument()); + } + + + protected Document feedFailure(String msg) { + return ArtifactXMLUtilities.createInputExceptionReport( + msg, XMLUtils.newDocument()); + } + + + protected String[] getDescriptionForInputData( + InputData data, CallContext context, String uuid) + { // there is only one element in the list, so take the first Object obj = getDescibeData(uuid).get(0); List descs = new ArrayList(); @@ -295,9 +350,6 @@ } - /** - * @see de.intevation.gnv.state.State#putInputData(java.util.Collection) - */ public void putInputData(Collection<InputData> inputData, String uuid) throws StateException { if (inputData != null) { @@ -308,17 +360,16 @@ InputValue inputValue = this.inputValues.get(tmpItem.getName()); if (inputValue != null) { if (this.inputData == null) { - this.inputData = new HashMap<String, InputData>( - inputData.size()); + this.inputData = new TreeMap<String, InputData>(); } - boolean valid = iv.isInputValid(tmpItem.getValue(), + boolean valid = InputValidator.isInputValid(tmpItem.getValue(), inputValue.getType()); if (valid) { if (tmpItem.getName().equals(MINVALUEFIELDNAME)){ String minValue = tmpItem.getValue(); String maxValue = this.getInputValue4ID(inputData, MAXVALUEFIELDNAME); - valid = iv.isInputValid(maxValue,inputValue.getType()); + valid = InputValidator.isInputValid(maxValue,inputValue.getType()); if (!valid){ String errMsg = "Wrong input for " + tmpItem.getValue() + " is not an " + inputValue.getType() @@ -327,7 +378,7 @@ throw new StateException(errMsg); } - valid = iv.isInputValid(minValue, + valid = InputValidator.isInputValid(minValue, maxValue, inputValue.getType()); if (!valid){ @@ -338,7 +389,7 @@ }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){ String minValue = this.getInputValue4ID(inputData, MINVALUEFIELDNAME); String maxValue = tmpItem.getValue(); - valid = iv.isInputValid(minValue,inputValue.getType()); + valid = InputValidator.isInputValid(minValue,inputValue.getType()); if (!valid){ String errMsg = "Wrong input for " + tmpItem.getValue() + " is not an " + inputValue.getType() @@ -347,7 +398,7 @@ throw new StateException(errMsg); } - valid = iv.isInputValid(minValue, + valid = InputValidator.isInputValid(minValue, maxValue, inputValue.getType()); if (!valid){ @@ -380,20 +431,16 @@ } - /** - * - * @see de.intevation.gnv.state.State#setPreSettings(java.util.Map) - */ public void setPreSettings(Map<String, InputData> preSettings) { this.preSettings = preSettings; } - - + public Map<String, InputData> getPreSettings() { return this.preSettings; } + protected String getInputValue4ID(Collection<InputData> inputData, String inputName){ Iterator<InputData> it = inputData.iterator(); while (it.hasNext()) { @@ -406,23 +453,18 @@ } - /** - * @see de.intevation.gnv.state.State#advance(java.lang.String, - * de.intevation.artifacts.CallMeta) - */ public void advance(String uuid, CallContext context) throws StateException { } + public void initialize(String uuid, CallContext context) throws StateException { } - /** - * @return - */ + protected String[] generateFilterValuesFromInputData() { List<String> list = new ArrayList<String>(); Iterator<String> it = this.inputValueNames.iterator(); @@ -431,6 +473,7 @@ InputData data = this.inputData.get(value); if (data != null && this.inputValues.containsKey(data.getName())) { + int size = this.inputValues.get(data.getName()) .usedInQueries(); String type = this.inputValues.get(data.getName()) @@ -442,7 +485,7 @@ } else if (type.equalsIgnoreCase("date")) { requestValue = this .prepareInputData4DateDBQuery(requestValue); - } else if (type.equalsIgnoreCase("coordinate")){ + } else if (type.equalsIgnoreCase("coordinate") || (type.equalsIgnoreCase("geometry") && requestValue.toLowerCase().startsWith("point"))){ requestValue = this .prepareInputData4RegionDBQuery(requestValue); } @@ -454,7 +497,8 @@ String[] filterValues = list.toArray(new String[list.size()]); return filterValues; } - + + protected String prepareInputData4RegionDBQuery(String value){ return value; } @@ -494,9 +538,7 @@ } - /** - * @param result - */ + protected List<Object> purifyResult(Collection<Result> result, String uuid) { List<Object> describeData = new ArrayList<Object>(); @@ -508,10 +550,7 @@ return describeData; } - /** - * @param result - * @return - */ + protected NamedCollection<KeyValueDescibeData> extractKVP(Collection<Result> result, String keyid, String valueid) { @@ -556,14 +595,14 @@ } String tmpKey = resultValue.getString(keyPos); - // TODO: FIXME: We have to do that because the arcsde does not + // TODO: FIXME: We have to do that because the arcsde does not // support a distinct Query on Layers. if (previousKey == null || !tmpKey.equals(previousKey)){ previousKey = tmpKey; if (!filterWithPresettings || preSettingValues.contains(tmpKey)){ keyValueDescibeData.add( new DefaultKeyValueDescribeData( - tmpKey, + tmpKey, resultValue.getString(valuePos), getID()) ); @@ -585,11 +624,7 @@ return false; } - /** - * @see de.intevation.gnv.state.State#describe(org.w3c.dom.Document, - * org.w3c.dom.Node, de.intevation.artifacts.CallMeta, - * java.lang.String) - */ + public void describe( Document document, Node rootNode, @@ -672,7 +707,7 @@ String uuid) { State parent = getParent(); - if (parent != null && parent instanceof StateBase) { + if (parent instanceof StateBase) { ((StateBase) parent).describeStatic( artCreator, creator, document, staticNode, context, uuid); } @@ -689,7 +724,7 @@ Node staticNode, CallMeta callMeta ) { - InputData data = inputData.get(dataName); + InputData data = dataName!= null ? inputData.get(dataName) : null; if (data == null) { return; @@ -914,7 +949,21 @@ protected void setHash(String uuid) { - this.hash = uuid + id + inputData.hashCode(); + String newHash = uuid + HASH_ID_SEPARATOR + id + HASH_ID_SEPARATOR; + Set keys = inputData.keySet(); + + int nhash = 0; + int shift = 0; + + for (Object o: keys) { + nhash ^= inputData.get(o).hashCode() << shift; + shift += 2; + } + + log.info("### OLD HASH: " + hash); + log.info("### NEW HASH: " + (newHash + nhash)); + + this.hash = newHash + nhash; } @@ -923,17 +972,15 @@ } - /** - * @see de.intevation.gnv.state.State#getDescibeData() - */ public List<Object> getDescibeData(String uuid) { CacheFactory factory = CacheFactory.getInstance(); if (factory.isInitialized()) { // we use a cache - log.debug("Using cache."); Cache cache = factory.getCache(); String key = getHash(); + log.debug("Using cache - key: " + key); + net.sf.ehcache.Element value = cache.get(key); if (value != null) { // element already in cache, so return it. @@ -949,6 +996,7 @@ List<Object> data = queryDatabase(filterValues, uuid); cache.put(new net.sf.ehcache.Element(key, data)); + return data; } catch (QueryException qe) { @@ -976,6 +1024,7 @@ return null; } + protected List<Object> queryDatabase(String[] filterValues, String uuid) throws QueryException { Collection<Result> result = null; @@ -990,18 +1039,49 @@ } + public Map<String, InputData> inputData() { return inputData; } - /** - * @see de.intevation.gnv.state.State#getInputData() - */ + public Collection<InputData> getInputData() throws StateException { return this.inputData != null ? this.inputData.values() : null; } + + public InputData getInputDataByName(String name) { + State state = this; + + while (state != null) { + InputData data = state.inputData().get(name); + if (data != null) { + return data; + } + + state = state.getParent(); + } + + return null; + } + + public void endOfLife(Object globalContext) { + log.debug("end of life of the current state."); + + CacheFactory factory = CacheFactory.getInstance(); + if (factory.isInitialized()) { + Cache cache = factory.getCache(); + String key = getHash(); + + if (key != null && cache.remove(key)) { + log.info("Removed element from cache - key: " + key); + } + } + } + + + public void cleanup(Object context) { } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ -package de.intevation.gnv.state; -import org.apache.log4j.Logger; -import org.w3c.dom.Node; +package de.intevation.gnv.state; import de.intevation.gnv.artifacts.GNVArtifactBase; +import org.apache.log4j.Logger; + +import org.w3c.dom.Node; + /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This factory should be used to create new state objects with help of a + * configuration segment. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class StateFactory { @@ -28,6 +37,9 @@ super(); } + /** + * Return the instance of this class. + */ public static StateFactory getInstance() { if (instance == null) { instance = new StateFactory(); @@ -35,6 +47,12 @@ return instance; } + /** + * This method creates a new state with help of the information in <i> + * configuration</i> and calls its setup method after creation. + * + * @return the new state. + */ public State createState(Node configuration) { log.debug("StateFactory.createState"); State state = null; @@ -51,5 +69,5 @@ } return state; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/SwitchModeState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state; + +import de.intevation.artifacts.common.utils.XMLUtils; + +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.PreferredLocale; + +import de.intevation.gnv.artifacts.ressource.RessourceFactory; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + + +/** + * This task of this <code>State</code> implementation is to switch between + * working with vector or scalar data. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class SwitchModeState extends StateBase { + + public static final String VECTOR_VALUE = "vector"; + public static final String SCALAR_VALUE = "scalar"; + + public static final String RESSOURCE_VECTOR = "vectorvalues"; + public static final String RESSOURCE_SCALAR = "scalarvalues"; + + private static Logger logger = Logger.getLogger(SwitchModeState.class); + + public SwitchModeState() { + } + + + @Override + protected void describeDynamic( + XMLUtils.ElementCreator artCreator, + XMLUtils.ElementCreator creator, + Document document, + Node dynamic, + CallContext context, + String uuid) + { + RessourceFactory ressource = RessourceFactory.getInstance(); + CallMeta callMeta = context.getMeta(); + PreferredLocale[] locales = callMeta.getLanguages(); + + Element selectNode = creator.create("select1"); + creator.addAttr(selectNode, "ref", dataName); + + Element labelNode = creator.create("label"); + labelNode.setTextContent(ressource.getRessource( + locales, dataName, dataName)); + selectNode.appendChild(labelNode); + + selectNode.appendChild(createChoices(creator, context)); + dynamic.appendChild(selectNode); + logger.debug("creating dynamic ui elements finished"); + } + + + protected Node createChoices( + XMLUtils.ElementCreator creator, + CallContext context) + { + RessourceFactory ressource = RessourceFactory.getInstance(); + CallMeta callMeta = context.getMeta(); + PreferredLocale[] locales = callMeta.getLanguages(); + + Element choiceNodes = creator.create("choices"); + + // add choice for scalar values + logger.debug("create choice for scalar values"); + Element scalar = creator.create("item"); + Element label = creator.create("label"); + label.setTextContent(ressource.getRessource( + locales, RESSOURCE_SCALAR, RESSOURCE_SCALAR)); + scalar.appendChild(label); + + Element value = creator.create("value"); + value.setTextContent(SCALAR_VALUE); + scalar.appendChild(value); + + // add choice for vector values + logger.debug("create choice for vector values"); + Element vector = creator.create("item"); + label = creator.create("label"); + label.setTextContent(ressource.getRessource( + locales, RESSOURCE_VECTOR, RESSOURCE_VECTOR)); + vector.appendChild(label); + + value = creator.create("value"); + value.setTextContent(VECTOR_VALUE); + vector.appendChild(value); + + choiceNodes.appendChild(scalar); + choiceNodes.appendChild(vector); + + return choiceNodes; + } + + + @Override + protected String[] getDescriptionForInputData( + InputData data, CallContext context, String uuid) + { + RessourceFactory ressource = RessourceFactory.getInstance(); + CallMeta callMeta = context.getMeta(); + PreferredLocale[] locales = callMeta.getLanguages(); + + String value = data.getValue(); + + if (value != null && value.equals(SCALAR_VALUE)) { + return new String[] { ressource.getRessource( + locales, RESSOURCE_SCALAR, RESSOURCE_SCALAR) }; + } + else if (value != null && value.equals(VECTOR_VALUE)) { + return new String[] { ressource.getRessource( + locales, RESSOURCE_VECTOR, RESSOURCE_VECTOR) }; + } + + return null; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/QueryObject.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.cache; +/** + * This Class is a Container which carries the + * databasequery which belongs to an state. + * It is also possible to look up if the query contains a specific + * TableName. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * + */ +public class QueryObject { + + /** + * The Id of the State the Query belongs to + */ + private String stateId = null; + + /** + * The Query which belongs to the State + */ + private String query = null; + + /** + * Constructor + * @param stateId the Id of the State the Query belongs to + * @param query the Query which belongs to the State + */ + public QueryObject(String stateId, String query) { + this.stateId = stateId; + this.query = query.toUpperCase(); + } + + /** + * Returns the StateId + * @return the Stateid + */ + public String getStateId() { + return stateId; + } + + /** + * Returns the Querystring + * @return the QueryString + */ + public String getQuery() { + return query; + } + + /** + * Returns true if the given Name of the Table is Contained in the Query + * @param tableName the Name of the Table + * @return true if the Name of the Table is contained in the Query + */ + public boolean queryContainsTableName(String tableName){ + return this.query.contains(tableName); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * + */ +package de.intevation.gnv.state.cache; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import net.sf.ehcache.Cache; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import de.intevation.artifacts.common.utils.Config; +import de.intevation.gnv.artifacts.cache.CacheFactory; +import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner; +import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; +import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; +import de.intevation.gnv.geobackend.base.query.exception.QueryException; +import de.intevation.gnv.state.StateBase; +import de.intevation.gnv.utils.ArtifactXMLUtilities; + + +/** + * Extended Class of the CacheCleaner. + * This Cleaner has the job to cleanup the ThematicData-Cache if it + * is necessary. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * + */ +public class ThematicDataCacheCleaner extends CacheCleaner { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = Logger.getLogger(ThematicDataCacheCleaner.class); + + private final static String XPATH_ARTIFACTS = + "/artifact-database/artifacts/artifact"; + private final static String XPATH_STATES = "states/state"; + private final static String XPATH_STATEID = "id"; + private final static String XPATH_QUERYID = "queryID"; + + /** + * The Queries that should be Cleaned with its links to the + * StateIds. + */ + private Collection<QueryObject> queryObjects = null; + + /** + * Constructor + */ + public ThematicDataCacheCleaner() { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + */ + public ThematicDataCacheCleaner(Runnable arg0) { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + */ + public ThematicDataCacheCleaner(String arg0) { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + */ + public ThematicDataCacheCleaner(ThreadGroup arg0, Runnable arg1) { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + */ + public ThematicDataCacheCleaner(ThreadGroup arg0, String arg1) { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + */ + public ThematicDataCacheCleaner(Runnable arg0, String arg1) { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + * @param arg2 + */ + public ThematicDataCacheCleaner(ThreadGroup arg0, Runnable arg1, String arg2) { + this.setUp(); + } + + /** + * Constructor + * @param arg0 + * @param arg1 + * @param arg2 + * @param arg3 + */ + public ThematicDataCacheCleaner(ThreadGroup arg0, Runnable arg1, + String arg2, long arg3) { + this.setUp(); + } + + /** + * Initializes the QueryObjects. + * The Queryobjects will be read from the Configuration. + * Only Queries which are defined in <code>queryID</code>-Elements + * are used. + * The other Queries are currently not put into the Cache. + */ + @Override + protected void setUp(){ + super.setUp(); + this.queryObjects = new ArrayList<QueryObject>(); + Document configuration = Config.getConfig(); + NodeList artifactList = Config.getNodeSetXPath(configuration, + XPATH_ARTIFACTS); + log.debug("ThematicDataCacheCleaner.setUp()"); + if (artifactList != null && artifactList.getLength() > 0){ + for (int i = 0; i < artifactList.getLength(); i++){ + Element currentArtifactNode = (Element)artifactList.item(i); + + String link = currentArtifactNode.getAttribute("xlink:href"); + if (link != null && link.length() > 0){ + String absolutFileName = Config.replaceConfigDir(link); + currentArtifactNode = (Element)new ArtifactXMLUtilities() + .readConfiguration(absolutFileName); + } + NodeList stateList = Config.getNodeSetXPath(currentArtifactNode, + XPATH_STATES); + if (stateList != null && stateList.getLength() > 0){ + for (int j = 0; j < stateList.getLength() ; j++){ + Element currentStateNode = (Element)stateList.item(j); + String stateId = currentStateNode + .getAttribute(XPATH_STATEID); + String queryID = Config.getStringXPath(currentStateNode, + XPATH_QUERYID); + try { + if (queryID != null){ + String query = QueryContainerFactory + .getInstance() + .getQueryContainer() + .getQuery(queryID); + QueryObject qo = new QueryObject(stateId, query); + queryObjects.add(qo); + } + } catch (QueryContainerException e) { + log.error(e,e); + } + } + } + } + } + } + + @Override + protected void cleanup() { + log.debug("ThematicDataCacheCleaner.cleanup"); + try { + if (queryObjects != null && queryObjects.size() > 0){ + String[] tableNames = this.getUpdatedTableNames(); + if (tableNames != null && tableNames.length > 0){ + Iterator<QueryObject> it = queryObjects.iterator(); + while (it.hasNext()){ + QueryObject qo = it.next(); + for (int i = 0; i < tableNames.length; i++){ + if (qo.queryContainsTableName(tableNames[i])){ + String stateId = qo.getStateId(); + this.cleanUpCache(stateId); + break; + } + } + } + }else{ + log.debug("No Tables found to cleanup."); + } + }else{ + log.warn("No Queries to clean"); + } + } catch (QueryException e) { + log.error(e,e); + } + } + + /** + * Removes the Entries which Keys matches to the <code>stateId</code> + * from the Cache. + * @param stateId The Id of the State which Entries has to be removed. + */ + private void cleanUpCache(String stateId){ + log.debug("ThematicDataCacheCleaner.cleanUpCache "+stateId); + CacheFactory factory = CacheFactory.getInstance(); + Cache cache = factory.getCache(); + List<String> keys = cache.getKeys(); + String keySample = StateBase.HASH_ID_SEPARATOR + + stateId + + StateBase.HASH_ID_SEPARATOR; + if (keys != null && keys.size() > 0){ + Iterator<String> it = keys.iterator(); + while (it.hasNext()){ + String key = it.next(); + if (key != null && key.contains(keySample)){ + boolean removed = cache.remove(key); + if (!removed){ + log.warn("Object with Key " + + key + "could not be removed from Cache"); + }else{ + log.debug("Object with Key " + + key + "has been removed from Cache"); + } + } + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes in this package provide the cleanup mechanism for the +Thematic-Data-Cache of the Application. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,21 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the default implementation of <code>KeyValueDescibeData</code>. This + * class just implements the necessary methods and two constructors. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultKeyValueDescribeData implements KeyValueDescibeData { - /** - * - */ private static final long serialVersionUID = -924469415242703108L; private String key; @@ -22,10 +26,25 @@ private boolean selected = false; + /** + * Creates a new instance of this class with a key-value pair, but no state + * and no selection. + * + * @param key The key. + * @param value A value. + */ public DefaultKeyValueDescribeData(String key, String value) { this(key, value, null); } + /** + * Creates a new instance of this class with a key-value pair and the state + * this object belongs to. + * + * @param key The key. + * @param value A value. + * @param state A state. + */ public DefaultKeyValueDescribeData(String key, String value, String state) { super(); this.key = key; @@ -33,37 +52,24 @@ this.state = state; } - /** - * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#getKey() - */ public String getKey() { return this.key; } - /** - * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#getValue() - */ public String getValue() { return this.value; } - /** - * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#isSelected() - */ public boolean isSelected() { return this.selected; } - /** - * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#setSelected(boolean) - */ public void setSelected(boolean selected) { this.selected = selected; } - public String getState() { return this.state; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultMinMaxDescribeData implements MinMaxDescribeData { - /** - * - */ private static final long serialVersionUID = -2917176219029052295L; private Object minValue = null; private Object maxValue = null; - - private String name = null; + + private String name = null; private String state = null; @@ -27,7 +28,12 @@ private final static String maxName = "maxvalue"; /** - * Constructor + * The default constructor. + * + * @param name A general name for this object. + * @param minValue The min value. + * @param maxValue The max value. + * @param state The state. */ public DefaultMinMaxDescribeData( String name, @@ -42,22 +48,18 @@ this.state = state; } - /** - * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getMaxValue() - */ public Object getMaxValue() { return this.maxValue; } - /** - * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getMinValue() - */ public Object getMinValue() { return this.minValue; } /** - * @see java.lang.Object#toString() + * Returns the string representation of this object. + * + * @return this object as string. */ @Override public String toString() { @@ -65,30 +67,18 @@ + this.maxValue.toString(); } - /** - * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getName() - */ public String getMinName() { return minName; } - /** - * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getMaxName() - */ public String getMaxName() { return maxName; } - /** - * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#setMaxValue(java.lang.Object) - */ public void setMaxValue(Object maxValue) { this.maxValue = maxValue; } - /** - * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#setMinValue(java.lang.Object) - */ public void setMinValue(Object minValue) { this.minValue = minValue; } @@ -100,5 +90,5 @@ public String getState() { return this.state; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,21 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the default implementation of <code>SingleValueDescribeData</code>. + * This object is used to store a single value for a specific name. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultSingleValueDescribeData implements SingleValueDescribeData { - /** - * - */ private static final long serialVersionUID = 3580176842483316917L; private String name = null; @@ -20,15 +24,22 @@ private String state = null; + /** + * Constructor to create new objects without a specific state. + * + * @param name The name of this object. + * @param value The value of this object. + */ public DefaultSingleValueDescribeData(String name, String value) { this(name, value, null); } /** - * Constructor - * - * @param name - * @param value + * Constructor to create new objects with a specific state. + * + * @param name The name of this object. + * @param value The value of this object. + * @param state The state this object belongs to. */ public DefaultSingleValueDescribeData( String name, @@ -41,16 +52,10 @@ this.state = state; } - /** - * @see de.intevation.gnv.state.describedata.SingleValueDescribeData#getName() - */ public String getName() { return this.name; } - /** - * @see de.intevation.gnv.state.describedata.SingleValueDescribeData#getValue() - */ public String getValue() { return this.value; } @@ -63,3 +68,4 @@ return this.state; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DescribeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DescribeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,22 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; import java.io.Serializable; /** * Markerinterface - * - * @author Tim Englich <tim.englich@intevation.de> - * + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface DescribeData extends Serializable { } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,39 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state.describedata; import org.apache.log4j.Logger; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This implementation improves the <code>DefaultKeyValueDescribeData</code> and + * establishes another field to store a further parameter. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class ExtendedKeyValueData extends DefaultKeyValueDescribeData { private static Logger logger = Logger.getLogger(ExtendedKeyValueData.class); + /** + * A further parameter to be stored at this object. + */ protected String parameter; - + /** + * Default constructor to initialize new objects. + * + * @param key The key. + * @param value The value. + * @param state The state - null permitted. + * @param parameter A further value. + */ public ExtendedKeyValueData( String key, String value, String state, String parameter) { @@ -20,8 +41,13 @@ this.parameter = parameter; } + /** + * Returns the parameter. + * + * @return the parameter. + */ public String getParameter() { return parameter; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,58 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface defines some methods to retrieve a key-value pair, a state + * this data belongs to and a boolean property, if this data have been selected. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface KeyValueDescibeData extends Serializable { + /** + * Returns the key of this data object. + * + * @return the key. + */ public String getKey(); + /** + * Returns the value of this data object. + * + * @return the value. + */ public String getValue(); + /** + * Returns the state of this data object. + * + * @return the state. + */ public String getState(); + /** + * Returns a boolean which defines, if this data pair has been selected or + * not. + * + * @return true, if this pair has been selected - otherwise false. + */ public boolean isSelected(); + /** + * Method to change the selection of this data object. + * + * @param selected Set this value to true, if you want to select this data + * object - set it to false, if you want to unselect it. + */ public void setSelected(boolean selected); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,27 +1,75 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface describes some methods to set and retrieve a min-max value + * pair with a specific name. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface MinMaxDescribeData extends DescribeData { + /** + * Returns the min value stored in this object. + * + * @return the min value. + */ public Object getMinValue(); + /** + * Returns the max value stored in this object. + * + * @return the max value. + */ public Object getMaxValue(); + /** + * Sets the min value in this object. + * + * @param minValue A new min value. + */ public void setMinValue(Object minValue); + /** + * Sets the max value in this object. + * + * @param maxValue A new max value. + */ public void setMaxValue(Object maxValue); + /** + * Returns the general name of this object. + * + * @return the name. + */ public String getName(); - + + /** + * Returns the name of the min value. + * + * @return the name of the min value. + */ public String getMinName(); + /** + * Returns the name of this max value. + * + * @return the name of the max value. + */ public String getMaxName(); + /** + * Returns the state this object belongs to. + * + * @return the state. + */ public String getState(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,21 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; import java.util.ArrayList; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the default implementation of <code>NamedCollection</code>. + * + * @param <E> The type which the objects stored in this object are from. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class NamedArrayList<E> extends ArrayList<E> implements NamedCollection<E> { @@ -23,6 +30,8 @@ /** * Constructor + * + * @param name The name of this collection. */ public NamedArrayList(String name) { this.name = name; @@ -30,8 +39,9 @@ /** * Constructor - * - * @param initialCapacity + * + * @param name The name of this collection. + * @param initialCapacity The initial capacity of this collection. */ public NamedArrayList(String name, int initialCapacity) { super(initialCapacity); @@ -40,32 +50,25 @@ /** * Constructor - * - * @param c + * + * @param name The name of this collection. + * @param c the collection whose elements are to be placed into this list. */ public NamedArrayList(String name, Collection<E> c) { super(c); this.name = name; } - /** - * @see de.intevation.gnv.state.describedata.NamedCollection#getName() - */ public String getName() { return this.name; } - /** - * @see de.intevation.gnv.state.describedata.NamedCollection#isMultiSelect() - */ public boolean isMultiSelect() { return multiSelect; } - /** - * @see de.intevation.gnv.state.describedata.NamedCollection#setMultiSelect(boolean) - */ public void setMultiSelect(boolean multiSelect) { this.multiSelect = multiSelect; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,19 +1,46 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface describes some methods to retrieve the name of this <code> + * Collection</code> and to determine if this <code>Collection</code> is a + * single or multiselect object. + * + * @param <E> The objects in this class need to be of this type. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface NamedCollection<E> extends Collection<E> { + /** + * Returns the name of this <code>Collection</code>. + * + * @return the name. + */ public String getName(); + /** + * Determines if this <code>Collection</code> is a multi select object. + * + * @return true, if it is multi select, otherwise false. + */ public boolean isMultiSelect(); + /** + * Change between single and multiselect. + * + * @param multiSelect true, if this object should be a multiselect, + * otherwise false. + */ public void setMultiSelect(boolean multiSelect); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,19 +1,46 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.describedata; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface defines some methods to store and retrieve key-value pairs. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface SingleValueDescribeData extends DescribeData { + /** + * Returns the name of this object. + * + * @return the name. + */ public String getName(); + /** + * Returns the value stored in this object. + * + * @return the value. + */ public String getValue(); - + + /** + * Sets the value of this object to <i>value</i>. + * + * @param value A new value. + */ public void setValue(String value); + /** + * Returns the state this objects belongs to. + * + * @return the state. + */ public String getState(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes and interfaces to handle user input. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.exception; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class StateException extends Exception { @@ -23,7 +28,7 @@ /** * Constructor - * + * * @param message */ public StateException(String message) { @@ -32,7 +37,7 @@ /** * Constructor - * + * * @param cause */ public StateException(Throwable cause) { @@ -41,7 +46,7 @@ /** * Constructor - * + * * @param message * @param cause */ @@ -50,3 +55,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Exception classes to be thrown if error occur in state objects. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * + */ +package de.intevation.gnv.state.layer; +/** + * Beanclass for storing Metainformation to create Shapefiles or Layer + * in an WMS-Output. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * + */ +public class LayerMetaData { + + private String table = null; + private String geometryType = null; + private String where = null; + private String columns = null; + private String templateID = null; + private String[] queryValues = null; + private String geometryWKT = null; + private String layertitle = null; + + /** + * Constructor + * @param table the Name of the Databasetable the Data should be fetched from. + * @param geometryType the Geometrytype of the Layer + * @param where the Query-Statement which should be used to fetch the Data. + * @param columns the Columnnames which should be fetched to generate the + * Shapefile + * @param templateID the Id of the Template which should be used to create + * the Mapfileentry. + * @param queryValues the Values that should be used to Query the data + * @param geometryWKT The Geometry represented by as an WKT to Query the Data. + */ + public LayerMetaData(String table, String geometryType, String where, + String columns, String templateID, + String[] queryValues,String geometryWKT, + String layertitle) { + super(); + this.table = table; + this.geometryType = geometryType; + this.where = where; + this.columns = columns; + this.templateID = templateID; + this.queryValues = queryValues; + this.geometryWKT = geometryWKT; + this.layertitle = layertitle; + } + + /** + * Returns the Geometry WKT + * @return the Geometry WKT + */ + public String getGeometryWKT() { + return geometryWKT; + } + + /** + * Returns the Name of the Databasetable the Data should be fetched from. + * @return the Name of the Databasetable the Data should be fetched from. + */ + public String getTable() { + return table; + } + + /** + * Returns the Geometrytype of the Layer. + * @return the Geometrytype of the Layer. + */ + public String getGeometryType() { + return geometryType; + } + + /** + * Returns the Query-Statement which should be used to fetch the Data. + * @return the Query-Statement which should be used to fetch the Data. + */ + public String getWhere() { + return where; + } + + /** + * Returns the Columnnames which should be fetched to generate the + * Shapefile + * @return the Columnnames which should be fetched to generate the + * Shapefile + */ + public String getColumns() { + return columns; + } + + /** + * Returns the Id of the Template which should be used to create + * the Mapfileentry. + * @return the Id of the Template which should be used to create + * the Mapfileentry. + */ + public String getTemplateID() { + return templateID; + } + + /** + * Returns the Values that should be used to Query the data. + * @return the Values that should be used to Query the data. + */ + public String[] getQueryValues() { + return queryValues; + } + + /** + * Returns the layer title. + * @return the layer title. + */ + public String getLayertitle() { + return layertitle; + } + +}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,27 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.layer; import java.io.File; import java.io.IOException; import java.io.OutputStream; +import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; -import java.util.Map; import org.apache.log4j.Logger; import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.Node; +import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.io.ParseException; import com.vividsolutions.jts.io.WKTReader; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.gnv.artifacts.context.GNVArtifactContext; @@ -29,17 +33,19 @@ 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.raster.PaletteManager; import de.intevation.gnv.state.InputData; import de.intevation.gnv.state.OutputStateBase; import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.utils.ArtifactXMLUtilities; +import de.intevation.gnv.utils.ExclusiveExec; import de.intevation.gnv.utils.FileUtils; import de.intevation.gnv.utils.MapfileGenerator; import de.intevation.gnv.utils.MetaWriter; import de.intevation.gnv.utils.ShapeFileWriter; /** - * @author Tim Englich <tim.englich@intevation.de> + * This <code>OutputState</code> is used for Layer-Products. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class LayerOutputState extends OutputStateBase { @@ -48,39 +54,60 @@ * 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; - - // TODO: Replace + + /** + * The Basename of the Templates for the WMS-Exports + */ public static final String LAYER_MODEL = "layer"; /** + * The Name of the Shapefile which will be generated. + */ + public static final String SHAPEFILE_NAME = "data"; + + /** * The ID for the Query fetching the Layer from the DB */ - private String dataQueryID = null; - + private String dataQueryID = null; + /** * The ID for the Query fetching the Geometry from the DB * which should be used to Clip the Layerdata */ private String geometryQueryID = null; - + /** - * The ID for the Value which will hold the Geometrie-Value + * The ID of the Query for fetching the Columnnames of the Table which + * should put into the Shapefile. + */ + private String columnQueryID = null; + + /** + * The ID of the Query for fetching the Information which kind of Geometry + * should be put into the Shapefile. + */ + private String geometryTypeQueryID = null; + + /** + * The ID for the Value which will hold the Geometry-Value */ private String geometryID = null; - + + /** + * Flag for synchronized Access of the Shapefile. + */ private Boolean shapeFileLock = new Boolean(true); - + + /** + * The Path where the Shapefile is stored. + */ private String shapeFilePath; - - private String geometryType = null; - - public static final String SHAPEFILE_NAME = "data.shp"; - + /** * Constructor */ @@ -88,53 +115,79 @@ 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(); - XMLUtils.toStream(this.getWMS(uuid, callContext, data),outputStream); + + Collection<LayerMetaData> layerMetaData = + this.getRequestedLayerMetadata(); + if (layerMetaData != null && !layerMetaData.isEmpty()){ + XMLUtils.toStream(this.getWMS(uuid, callContext, + layerMetaData,inputData), + outputStream); + }else{ + this.writeExceptionReport2Stream(outputStream); + } }else if (outputMode.equalsIgnoreCase("zip")){ - Collection<Result> data = this.fetchData(); - this.writeZip(uuid, callContext, outputStream, data); + Collection<LayerMetaData> layerMetaData = + this.getRequestedLayerMetadata(); + + if (layerMetaData != null && !layerMetaData.isEmpty()){ + this.writeZip(uuid, callContext, + outputStream, layerMetaData); + }else{ + this.writeExceptionReport2Stream(outputStream); + } + } } - - + /** - * Fetches the Data from the Databasebackend - * @return + * Writes an exception to an output stream. + * + * @param outputStream The output stream used to write the exception to. */ - protected Collection<Result> fetchData(){ - log.debug("LayerOutputState.fetchData"); - // TODO PUT ALL in CACHE + private void writeExceptionReport2Stream(OutputStream outputStream) { + Document document = XMLUtils.newDocument(); + ArtifactXMLUtilities. + createExceptionReport("No Data to Export", document); + XMLUtils.toStream(document,outputStream); + } + + /** + * Returns the Metadata for the requested Layers for fetching the data + * of the Layer and generating the Layer and WMS. + * @return the Metadata for the requested Layers + */ + private Collection<LayerMetaData> getRequestedLayerMetadata(){ + log.debug("LayerOutputState.getRequestedLayerMetadata"); Collection<Result> result = this.getData(this.queryID); - Collection<Result> data = null; - String geometryWKT = null; + Collection<LayerMetaData> returnValue = null; if (result != null){ QueryExecutor queryExecutor = QueryExecutorFactory.getInstance() .getQueryExecutor(); Iterator<Result> it = result.iterator(); - String[] queryValues = null; - if (it.hasNext()){ + returnValue = new ArrayList<LayerMetaData>(result.size()); + while (it.hasNext()){ Result resultValue = it.next(); String table = resultValue.getString(0); + String geometryType = this.getGeometryType(table, queryExecutor); String where = resultValue.getString(1); + String columns = this.fetchColumns(table); + String templateID = resultValue.getString(2); + String layername = resultValue.getString(3); + String[] queryValues = null; + String geometryWKT = null; if (this.geometryID != null){ - InputData geometryInputData = + InputData geometryInputData = this.inputData.get(this.geometryID); if (geometryInputData != null){ - try { + Collection<Result> geometryData = queryExecutor .executeQuery(this.geometryQueryID, new String[]{geometryInputData.getValue()}); @@ -145,58 +198,187 @@ } } catch (QueryException e) { log.error(e,e); - // TODO: what should happen?? } - queryValues = new String[]{table, + queryValues = new String[]{columns, + table, where, geometryWKT}; }else{ - // TODO: Look into the presetting for an WKT - queryValues = new String[]{table,where}; + //Look into the presetting for an WKT + InputData geometryWKTData = this.preSettings != null ? + this.preSettings.get("geometry") : + null ; + if (geometryWKTData != null){ + queryValues = new String[]{columns, + table, + where, + geometryWKTData.getValue()}; + geometryWKT = geometryWKTData.getValue(); + }else{ + queryValues = new String[]{columns,table,where}; + } } }else{ - // TODO: Look into the presetting for an WKT - queryValues = new String[]{table,where}; - + //Look into the presetting for an WKT + InputData geometryWKTData = this.preSettings != null ? + this.preSettings.get("geometry") : + null ; + if (geometryWKTData != null){ + queryValues = new String[]{columns, + table, + where, + geometryWKTData.getValue()}; + }else{ + queryValues = new String[]{columns,table,where}; + } } + returnValue.add(new LayerMetaData( + table, geometryType, where, columns, + templateID, queryValues, geometryWKT, layername)); } - - try { - data = queryExecutor.executeQuery(dataQueryID, - queryValues); - if (data != null && geometryWKT != null){ - WKTReader wktReader = new WKTReader(); - Geometry border = wktReader.read(geometryWKT); - - Iterator<Result> dataIt = data.iterator(); - while (dataIt.hasNext()){ - // Trim the Geometries using the - // Geometry if on is available. - Result current = dataIt.next(); - String currentWKT = current.getString(0); - Geometry currentGeometry = null; - try { - currentGeometry = wktReader.read(currentWKT); - } catch (Exception e) { - log.error("Error parsing Geometry "+ currentWKT); - log.error(e,e); + } + return returnValue; + } + + /** + * Fetches the Data from the Databasebackend. + * + * @return the resultdata. + */ + protected Collection<Result> fetchData(LayerMetaData layerMetaData, Envelope mbr){ + log.debug("LayerOutputState.fetchData"); + Collection<Result> data = null; + QueryExecutor queryExecutor = QueryExecutorFactory.getInstance() + .getQueryExecutor(); + try { + data = queryExecutor.executeQuery(dataQueryID, + layerMetaData.getQueryValues()); + if (data != null){ + WKTReader wktReader = new WKTReader(); + Geometry border = null; + if (layerMetaData.getGeometryWKT() != null){ + border = wktReader.read(layerMetaData.getGeometryWKT()); + } + Iterator<Result> dataIt = data.iterator(); + while (dataIt.hasNext()){ + // Trim the Geometries using the + // Geometry if one is available. + Result current = dataIt.next(); + String currentWKT = current.getString(0); + Geometry currentGeometry = null; + try { + currentGeometry = wktReader.read(currentWKT); + } catch (Exception e) { + log.error("Error parsing Geometry "+ currentWKT); + log.error(e,e); + } + if (currentGeometry != null){ + if (border != null){ + currentGeometry = currentGeometry.intersection(border); + current.addColumnValue(0, currentGeometry.toText()); } - - if (currentGeometry != null){ - Geometry newGeometry = currentGeometry.intersection(border); - current.addColumnValue(0, newGeometry.toText()); + if (mbr.isNull()){ + mbr.init(currentGeometry.getEnvelopeInternal()); + }else{ + mbr.expandToInclude(currentGeometry.getEnvelopeInternal()); } } } - } catch (QueryException e) { - log.error(e,e); - } catch (ParseException e){ - log.error(e,e); } + } catch (QueryException e) { + log.error(e,e); + } catch (ParseException e){ + log.error(e,e); } return data; } + + /** + * This method determines the geometry type on basis of a table name. + * + * @param tableName Name of the table in the database. + * @param queryExecutor The QueryExecutor. + * @return the geometry type as string (e.g. MultiPolygon, Polygon, etc). + */ + private String getGeometryType(String tableName, + QueryExecutor queryExecutor){ + String returnValue = null; + String[] tables = tableName.toUpperCase().split(","); + String[] filter = tables[0].split("\\."); + try { + Collection<Result> result = + queryExecutor.executeQuery(this.geometryTypeQueryID, filter); + if (result != null && !result.isEmpty()) + { + int geometryCode = result.iterator().next().getInteger(0); + if (geometryCode == 11 || + geometryCode == 10){ + returnValue = "MultiPolygon"; + }else if (geometryCode == 9 || + geometryCode == 8){ + returnValue = "MultiLineString"; + }else if (geometryCode == 7){ + returnValue = "MultiPoint"; + }else if (geometryCode == 6){ + returnValue = "GeometryCollection"; + }else if (geometryCode == 5 || + geometryCode == 4){ + returnValue = "Polygon"; + }else if (geometryCode == 3 || + geometryCode == 2){ + returnValue = "LineString"; + }else if (geometryCode == 1){ + returnValue = "Point"; + }else if (geometryCode == 0){ + returnValue = "Geometry"; + } + } + } catch (QueryException e) { + log.error(e,e); + } + return returnValue; + } + + + /** + * Fetch the columns of a specific table. + * + * @param tableName The name of the table. + * @return the columns as string. + */ + private String fetchColumns(String tableName){ + String returnValue = null; + try { + String[] tables = tableName.toUpperCase().split(","); + String[] filter = tables[0].split("\\."); + // Only use the first Table the second one will be ignored. + QueryExecutor queryExecutor = QueryExecutorFactory.getInstance() + .getQueryExecutor(); + Collection<Result> columnData = queryExecutor. + executeQuery(this.columnQueryID, + filter); + if (columnData != null && !columnData.isEmpty()){ + StringBuffer sb = new StringBuffer(); + synchronized (sb) { + Iterator<Result> it = columnData.iterator(); + while(it.hasNext()){ + Result current = it.next(); + sb.append(current.getString(0)); + if (it.hasNext()){ + sb.append(" , "); + } + } + } + returnValue = sb.toString(); + } + } catch (QueryException e) { + log.error(e,e); + } + return returnValue; + } + + @Override public void setup(Node configuration) { log.debug("LayerOutputState.setup"); @@ -207,61 +389,95 @@ "inputvalue-geometry"); this.geometryQueryID = Config.getStringXPath(configuration, "queryID-geometry"); + + this.columnQueryID = "layer_colums"; //Config.getStringXPath(configuration, + // "queryID-columns"); + this.geometryTypeQueryID = "geometry_type"; } - + + + /** + * Write the resultdata to shapefiles. + * + * @param uuid The UUID of the current artifact. + * @param data The finalized data used for shapefile creation. + * @param callContext The CallContext object. + * @param geometryType The geometry type. + * @return the shapefile path. + */ protected String writeToShapeFile( String uuid, Collection<Result> data, - CallContext callContext + CallContext callContext, + String geometryType, + int layerNumber ) { - File baseDir = shapefileDirectory(callContext); - - File shapeDir = new File(baseDir, uuid); boolean success = false; - boolean createdDir = false; - - try { - synchronized (shapeFileLock) { - int count = 0; - while (shapeDir.exists()) { - shapeDir = new File(baseDir, uuid + "-" + count); - ++count; - } - - if (!shapeDir.mkdirs()) { - log.error("cannot create directory '" - + shapeDir.getAbsolutePath() + "'"); + if (data != null && !data.isEmpty()){ + File shapeDir = new File(shapeFilePath); + try { + File shapeFile = new File(shapeDir, createShapeFileName(layerNumber)); + if (!ShapeFileWriter.writeDataToFile(shapeFile, "data", data,geometryType)){ + log.error("writing data into shapefile failed"); return null; } - createdDir = true; - } - - File shapeFile = new File(shapeDir, SHAPEFILE_NAME); - if ((geometryType = ShapeFileWriter.writeDataToFile(shapeFile, "data", data)) == null){ - log.error("writing data into shapefile failed"); - return null; + success = true; + callContext.afterCall(CallContext.STORE); + return shapeFilePath; } - - shapeFilePath = shapeDir.getAbsolutePath(); - success = true; - - callContext.afterCall(CallContext.STORE); - - return shapeFilePath; - } - finally { - if (!success && createdDir) { - FileUtils.deleteRecursive(shapeDir); + finally { + if (!success) { + FileUtils.deleteRecursive(shapeDir); + } } + }else{ + return null; } } - + + /** + * Check if the ShapeDir exists and if it exists delete all Contents + * in it. If it not exists the Director will be created. + * @param baseDir the BaseDirectory for all ShapeDirs + * @param uuid the UUID which is used to create the Directory + * @return true if the directory exists or could be created. + * false if the directory could not be created. + */ + private boolean createShapeDir(File baseDir, String uuid){ + File shapeDir = new File(baseDir, uuid); + boolean createdDir = false; + synchronized (shapeFileLock) { + if (shapeDir.exists()) { + FileUtils.deleteContent(shapeDir); // TODO Place on getZip and getWMS + } + else if (!shapeDir.mkdirs()) { + log.error("cannot create directory '" + + shapeDir.getAbsolutePath() + "'"); + return false; + } + createdDir = true; + } + shapeFilePath = shapeDir.getAbsolutePath(); + return createdDir; + } + + /** + * Create a zip archive with the shapefiles of the given shapefiles path and + * write it to <code>output</code>. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param output The output stream. + * @param data The data to be written to shapefile. + * @param geometryType The geometry type. + * @throws StateException if an error occured while zipfile creation. + */ protected void writeZip( String uuid, CallContext callContext, OutputStream output, - Collection<Result> data - ) + Collection<LayerMetaData> layerMetaData + ) throws StateException { try { @@ -273,8 +489,19 @@ } } else { - - if ((p = writeToShapeFile(uuid, data, callContext)) != null) { + File baseDir = shapefileDirectory(callContext); + if (!this.createShapeDir(baseDir, uuid)){ + return; + } + Iterator<LayerMetaData> it = layerMetaData.iterator(); + int i = 1; + Envelope mbr = new Envelope(); + while(it.hasNext()){ + LayerMetaData lmd = it.next(); + Collection<Result> data = this.fetchData(lmd, mbr); + p = writeToShapeFile(uuid, data, callContext,lmd.getGeometryType(),i++); + } + if (p != null) { FileUtils.createZipArchive(new File(p), output); } } @@ -283,16 +510,37 @@ log.error(ioe.getLocalizedMessage(), ioe); } } - + + /** + * Returns the shapefile path. + * + * @return the shapefile path. + */ public String getShapeFilePath() { synchronized (shapeFileLock) { return shapeFilePath; } } - + + + /** + * Set the shapefile path. + */ + public void setShapeFilePath(String shapeFilePath) { + synchronized (shapeFileLock) { + this.shapeFilePath = shapeFilePath; + } + } + + /** + * Returns the basic-directory where the Shapefiles should be placed in. + * @param callContext the Context of this Call + * @return the Directory where the Shapefiles could be placed in. + * (Please create an own directory in this dir and not put the + * Files directly in it) + */ private static File shapefileDirectory(CallContext callContext) { - // TODO: Refactoring nessessary it should be used only one Shapefilepath - // for alle Modes. Code was taken from HorizontalCrossSectionMeshOutputState + // Code was taken from HorizontalCrossSectionMeshOutputState GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); File dir = (File)context.get( @@ -301,32 +549,25 @@ ? dir : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH; } - - /** - * @see de.intevation.gnv.state.StateBase#endOfLife(java.lang.Object) - */ + + @Override public void endOfLife(Object globalContext) { super.endOfLife(globalContext); - // do it in background new Thread() { + @Override public void run() { - // TODO: Do the un-publishing WMS stuff. String path = resetShapeFilePath(); - if (path == null) { return; } - File dir = new File(path); - for (int i = 0; i < 10; ++i) { if (!dir.exists() || FileUtils.deleteRecursive(dir)) { MapfileGenerator.getInstance().update(); return; } - try { Thread.sleep(10000L); } @@ -338,75 +579,227 @@ } // run }.start(); } - - public String resetShapeFilePath() { + + /** + * Resets the Settings e.g shapeFilePath and templateID + * @return + */ + private String resetShapeFilePath() { synchronized (shapeFileLock) { String path = shapeFilePath; shapeFilePath = null; - geometryType = null; return path; } } - protected Document getWMS(String uuid, - CallContext callContext, - Collection<Result> data) + + + /** + * Write data to shapefiles and feed a map service with information about + * these shapefiles. The map service can be queried for displaying + * corresponding layers as WMS. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param layerMetaData The Metadata which is required to create the + * different Layers. + * @param inputData the Parameters which are send by the out-Call. + * @return a document with some meta information (shapefile path, geometry + * type, time to live of the current artifact, etc). + * @throws StateException if an error occured while shapefile writing. + */ + protected Document getWMS( + String uuid, + CallContext callContext, + Collection<LayerMetaData> layerMetaData, + Collection<InputData> inputData) throws StateException { - // TODO: Do the real WMS publishing here! Document document = XMLUtils.newDocument(); - Element pathElement = document.createElement("path"); - document.appendChild(pathElement); + File baseDir = shapefileDirectory(callContext); + File shapeDir = new File(baseDir, uuid); - String path = getShapeFilePath(); + boolean success = false; + boolean createdDir = false; - if (path != null && new File(path).isDirectory()) { - pathElement.setTextContent(path); - } - else { + try { + // create shapefile directory or delete content if it already exists + synchronized (shapeFileLock) { + if (shapeDir.exists()) { + FileUtils.deleteContent(shapeDir); + } + else if (!shapeDir.mkdirs()) { + log.error("cannot create directory '" + + shapeDir.getAbsolutePath() + "'"); + return null; + } + setShapeFilePath(shapeDir.getAbsolutePath()); + createdDir = true; + } + + // process data + Iterator<LayerMetaData> it = layerMetaData.iterator(); - if (data != null && - (path = writeToShapeFile(uuid, data, callContext)) != null) { + // create meta file + Document meta = MetaWriter.initMeta(); + MetaWriter.insertAbstractMeta(callContext, meta); - String paramType = LAYER_MODEL+"_"+this.geometryType.toLowerCase(); - - Document meta = MetaWriter.writeLayerMeta(callContext, uuid, - path, paramType, - this.determineGeometryType()); - if (meta != null) { - MapfileGenerator.getInstance().update(); - return meta; + String path = getShapeFilePath(); + String prefix = getLayerPrefix(inputData); + + if (prefix == null) { + prefix = uuid; + } + + int layerNumber = 0; + Envelope mbr = new Envelope(); + while (it.hasNext()){ + LayerMetaData lmd = it.next(); + layerNumber ++; + + String geometryType = lmd.getGeometryType(); + String templateId = lmd.getTemplateID(); + + ExclusiveExec.UniqueKey key = ExclusiveExec.INSTANCE.acquire(uuid); + try{ + Collection<Result> results = this.fetchData(lmd,mbr); + if (results != null && writeToShapeFile(uuid, results, + callContext, + geometryType, + layerNumber) != null) { + String name = getLayerName(uuid, layerNumber); + String base = lmd.getLayertitle(); + String title = getLayerTitle(prefix, base); + String data = getLayerData( + uuid, createShapeFileName(layerNumber)); + String type = determineGeometryType(geometryType); + String status = "OFF"; + String model = findParameterTitle( + geometryType, templateId); + + MetaWriter.insertLayer( + callContext, meta, name, title, + data, model, type, status); + } + + success = true; + + if (meta != null && !it.hasNext()) { + MetaWriter.insertMbr(mbr, "EPSG:4326",meta); + MetaWriter.writeMetaFile(path, meta); + MapfileGenerator.getInstance().update(); + return meta; + } + }finally{ + ExclusiveExec.INSTANCE.release(key); } - - pathElement.setTextContent(path); + } + + return document; + } + finally { + if (!success && createdDir) { + FileUtils.deleteRecursive(shapeDir); } } - - return document; } - - private String determineGeometryType(){ - - String returnValue = this.geometryType.toLowerCase(); - + + /** + * Creates the name of the Shapefile + * @param layerNumber the Number of the Layer + * @return the create name of the Shapefile. + */ + private String createShapeFileName(int layerNumber) { + return SHAPEFILE_NAME+"_"+layerNumber+".shp"; + } + + + protected String getLayerName(String uuid, int idx) { + return "GNV_" + uuid + "_" + idx; + } + + + protected String getLayerTitle(String prefix, String base) { + return "GNV_" + prefix + "_" + base; + } + + + protected String getLayerData(String shapeDir, String filename) { + File path = new File(shapeDir, filename); + + return path.toString(); + } + + + /** + * Returns the parameterType for the Layer. + * @param geometryType + * @return + */ + private String findParameterTitle(String geometryType, String templateID) { + String paramType = LAYER_MODEL+"_"+templateID; + if (!MapfileGenerator.getInstance().templateExists(paramType)){ + // If the template doesn't exist the Defaulttemplates will be used. + paramType = LAYER_MODEL+"_"+ + this.determineDefaultTemplateName(geometryType); + } + return paramType; + } + + /** + * Find the title for a wms layer specified by the user. + * + * @param inputData A collection with InputData objects. + * @return the title. + */ + protected String getLayerPrefix(Collection<InputData> inputData) { + for (InputData data: inputData) { + String name = data.getName(); + if (name != null && name.equals("title")) { + return (String) data.getValue(); + } + } + return null; + } + + + /** + * Turns the geometry type into a form used for the templating mechanism + * while mapfile generation. + * + * @param geometryType The original geometry type. + * @return a valid geometry type fpr the template mechanism. + */ + private String determineGeometryType(String geometryType){ + String returnValue = geometryType.toLowerCase(); if (returnValue.equalsIgnoreCase("linestring")){ returnValue = "Line"; + }else if (returnValue.equalsIgnoreCase("multilinestring")){ + returnValue ="Line"; + }else if (returnValue.equalsIgnoreCase("multipolygon")){ + returnValue = "Polygon"; } return returnValue; } - - private static Map<Integer, PaletteManager> getPalettes( - CallContext callContext - ) { - //TODO: customize for product Layer - GNVArtifactContext context = - (GNVArtifactContext)callContext.globalContext(); - Map<Integer, PaletteManager> palettes = - (Map<Integer, PaletteManager>)context.get( - GNVArtifactContext.PALETTES_KEY); - return palettes != null - ? palettes - : new HashMap<Integer, PaletteManager>(); + + + /** + * Determine the default template name if no special template is existing + * for this layer. + * + * @param geometryType The geometry type. + * @return a default geometry fitting to the original geometry type. + */ + private String determineDefaultTemplateName(String geometryType){ + String returnValue = geometryType.toLowerCase(); + if (returnValue.equalsIgnoreCase("multilinestring")){ + returnValue ="linestring"; + }else if (returnValue.equalsIgnoreCase("multipolygon")){ + returnValue = "polygon"; + }else if (returnValue.equalsIgnoreCase("multipoint")){ + returnValue = "point"; } - + return returnValue; + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +State classes used by artifacts representing Layer to handle input and +output. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes in this package handle specific input/output of artifacts and even play a +decisive role for creating describe-documents of the current artifact's state. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,18 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state.profile.horizontal; +import au.com.bytecode.opencsv.CSVWriter; + import com.vividsolutions.jts.geom.Coordinate; -import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.common.utils.Config; import de.intevation.artifacts.CallContext; @@ -14,6 +24,10 @@ import de.intevation.gnv.chart.ChartLabels; import de.intevation.gnv.chart.HorizontalCrossProfileChart; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.StringArrayKey; + import de.intevation.gnv.geobackend.base.DefaultResult; import de.intevation.gnv.geobackend.base.DefaultResultDescriptor; import de.intevation.gnv.geobackend.base.Result; @@ -29,16 +43,31 @@ import de.intevation.gnv.math.Point2d; import de.intevation.gnv.state.InputData; +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; import de.intevation.gnv.utils.DistanceCalculator; import de.intevation.gnv.utils.StringUtils; import de.intevation.gnv.utils.WKTUtils; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.Map; import org.apache.log4j.Logger; @@ -47,19 +76,222 @@ import org.w3c.dom.Node; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (iweinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This <code>OutputState</code> is used for 'Horizontalschnitt' products. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:iweinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class HorizontalProfileMeshCrossOutputState -extends HorizontalProfileOutputState +extends HorizontalProfileMeshOutputState { + /** + * Constant field which defines the source format of a given datetime. + */ + public static final String SRC_FORMAT = "yyyy.MM.dd HH:mm:ss"; + + /** + * Constant field which defines the target format of a given datetime. + */ + public static final String DEST_FORMAT = "yyyy-MM-dd HH:mm"; + + /** + * Source format. + */ + public static DateFormat srcFormat = new SimpleDateFormat(SRC_FORMAT); + + /** + * Target format. + */ + public static DateFormat destFormat = new SimpleDateFormat(DEST_FORMAT); + + + /** + * This class represents an exporter used for exporting 'Horizontale + * Schnittprofile' as odv. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ + public class HorizontalProfileMeshCrossODVExporter + implements Export + { + private ResultDescriptor rd; + + private Collection parameters; + + private int dateIdx; + private int paramIdx; + private int depthIdx; + private int valueIdx; + private int shpIdx; + + public HorizontalProfileMeshCrossODVExporter(Collection parameters) { + this.parameters = parameters; + } + + public void create( + Profile profile, + OutputStream outputStream, + Collection result) + throws + IOException, + UnsupportedEncodingException, + StateException + { + CSVWriter writer = new CSVWriter( + new OutputStreamWriter(outputStream, profile.getEncoding()), + profile.getSeparator(), + profile.getQuoteCharacter(), + profile.getEscapeCharacter()); + + writeData(profile, writer, result); + + writer.close(); + } + + protected void writeData( + Profile profile, + CSVWriter writer, + Collection<Result> results) + { + log.debug("Put " + results.size() + " elements into odv export."); + + // just write header into odv export + String[] header = profile.getHeader(); + ArrayList<String> headerList = new ArrayList<String>(); + for (int i= 0; i < header.length; i++){ + headerList.add(header[i]); + } + + ArrayList<String> paramids = new ArrayList<String>(); + + Map<StringArrayKey, Map<String,String>> aggregatedRows = + new HashMap<StringArrayKey, Map<String,String>>(); + + for (Result res: results) { + if (rd == null) { + rd = res.getResultDescriptor(); + paramIdx = rd.getColumnIndex("GROUP1"); + depthIdx = rd.getColumnIndex("GROUP2"); + dateIdx = rd.getColumnIndex("GROUP3"); + shpIdx = rd.getColumnIndex("SHAPE"); + valueIdx = rd.getColumnIndex("YORDINATE"); + } + + String[] row = generateRow(res); + StringArrayKey key = new StringArrayKey(row); + String parameterValue = res.getString(valueIdx); + String parameterID = res.getString(paramIdx); + + if (!paramids.contains(parameterID)) { + paramids.add(parameterID); + headerList.add(findParamTitle(parameters, parameterID)); + headerList.add("QF"); + } + + Map<String,String> aggregatedRow = aggregatedRows.get(key); + if (aggregatedRow != null) { + aggregatedRow.put(parameterID, parameterValue); + } + else{ + Map<String,String> params = new HashMap<String, String>(); + params.put(parameterID, parameterValue); + aggregatedRows.put(key, params); + } + } + + if (header != null){ + writer.writeNext(headerList.toArray(header)); + } + + Iterator<StringArrayKey> rows = aggregatedRows.keySet().iterator(); + int idx = 1; + while (rows.hasNext()){ + StringArrayKey row = rows.next(); + Map<String,String> params = aggregatedRows.get(row); + + ArrayList<String> rowList = new ArrayList<String>(); + String[] rowArray = row.getValue(); + for (int i= 0; i < rowArray.length; i++){ + String value = rowArray[i]; + if (value != null && value.equals("GNV_STATION")) { + value += "_" + idx++; + } + rowList.add(value); + } + for (int i = 0; i < paramids.size();i++){ + String key = paramids.get(i); + String value = params.get(key); + if (value == null){ + value = ""; + } + rowList.add(value); + rowList.add("1"); + } + log.debug("Write new line into odv export."); + writer.writeNext(rowList.toArray(rowArray)); + } + } + + protected String[] generateRow(Result res) { + Date tmpDate = null; + String dateTmp = res.getString(dateIdx); + try { + tmpDate = srcFormat.parse(dateTmp); + } + catch (ParseException pe) { + log.warn(pe,pe); + } + + String shapeTmp = res.getString(shpIdx); + Coordinate p = WKTUtils.toCoordinate(shapeTmp); + + String cruise = "GNV_EXPORT"; + String station = "GNV_STATION"; + String type = "*"; + String date = tmpDate != null + ? destFormat.format(tmpDate) + : dateTmp; + String lon = "" + p.x; + String lat = "" + p.y; + String botDepth = "0"; + String depth = res.getString(depthIdx); + + return new String[] { + cruise, station, type, date, lon, lat, botDepth, depth + }; + } + + /** + * This method is used to search specific value coresponding to its key + * <code>id</code> and return its description. + * + * @param values Collection of parameters. + * @param id Key used to find the value. + * + * @return Description of searched value. + */ + protected String findParamTitle(Collection values, String id) { + if (values != null){ + Iterator it = values.iterator(); + while (it.hasNext()) { + KeyValueDescibeData data = (KeyValueDescibeData) it.next(); + + if (id.equals(data.getKey())) + return data.getValue(); + } + } + return ""; + } + } // HorizontalProfileMeshCrossODVExporter + + public static final boolean USE_INDEX_BUFFER = Boolean.getBoolean("gnv.horizontal.profile.mesh.cross.index.buffer"); private static final long serialVersionUID = 2205958041745637263L; - + /** * the logger, used to log exceptions and additonaly information */ @@ -67,25 +299,41 @@ HorizontalProfileMeshCrossOutputState.class); private String ijkQueryID = null; - + /** * Constructor */ public HorizontalProfileMeshCrossOutputState() { super(); } - - /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#setup(org.w3c.dom.Node) - */ + + @Override public void setup(Node configuration) { super.setup(configuration); this.ijkQueryID = Config.getStringXPath(configuration,"queryID-ijk"); - + } + /** + * This method creates a chart and returns it. + * + * @param chartLables Labels used to decorate the chart. + * @param theme The theme used to adjust the look of the chart. + * @param parameters A collection with parameters this chart contains. + * @param measurements A collection with measurement this chart contains. + * @param dates A collection with dates this chart contains. + * @param result The data collection used to be displayed in this chart. + * @param locale The Locale used to determine the language. + * @param uuid The uuid of the current artifact. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two points in a chart (not used in this chart type). + * @param shapesVisible A boolean property to determine the visiblity of + * datapoints in this chart (not used in this chart type). + * @param callContext The CallContext object. + * @return a <code>HorizontalCrossProfileChart</code>. + */ @Override protected Chart getChart( ChartLabels chartLables, @@ -132,6 +380,46 @@ return chart; } + + @Override + protected void createODV( + OutputStream outputStream, String uuid, CallContext callContext) + throws IOException, StateException { + + String [] COLUMN_HEADER = { + "Cruise", + "Station", + "Type", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", + "Bot. Depth [m]", + "Depth [m]" + }; + + Export.Profile ODV_PROFILE = new DefaultProfile( + COLUMN_HEADER, + '\t', + CSVWriter.NO_QUOTE_CHARACTER, + CSVWriter.NO_ESCAPE_CHARACTER, + "ODV", + "ISO-8859-1"); + + Collection<Result> result = (Collection<Result>) getChartResult( + uuid, callContext); + + if (result == null) { + log.error("No data for export found."); + return; + } + + Export export = new HorizontalProfileMeshCrossODVExporter( + getParameters(uuid)); + + export.create(ODV_PROFILE, outputStream, result); + } + + private static int numSamples(CallContext callContext) { GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); @@ -145,82 +433,86 @@ @Override protected Object getChartResult(String uuid, CallContext callContext) { log.debug("HorizontalProfileMeshCrossOutputState.getChartResult"); - Collection<Result> result = null; - if (CacheFactory.getInstance().isInitialized()) { - String key = uuid + super.getID(); - log.debug("Hash for Queryelements: " + key); - net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); - if (value != null) { - result = (Collection<Result>) (value.getObjectValue()); - }else{ - - InputData meshLine = inputData.get("mesh_linestring"); - InputData meshId = inputData.get("meshid"); - - if (meshLine == null) { - log.error("mesh_linestring is not defined"); - throw new IllegalStateException("missing mesh_linestring"); - } - - if (meshId == null) { - log.error("meshid is not defined"); - throw new IllegalStateException("missing meshid"); - } - - Coordinate [] coords = WKTUtils.toCoordinates( - meshLine.getValue()); - - if (coords == null) { - throw new IllegalStateException("cannot read coordinates"); - } - try { - String additionWhere = USE_INDEX_BUFFER - ? WKTUtils.worldCoordinatesToIndex( - coords, - result, - meshId.getValue(), - ijkQueryID) - : WKTUtils.TRUE_EXPRESSION; - - String[] addedFilterValues = StringUtils.append( - generateFilterValuesFromInputData(), - additionWhere); + String key = getHash(); + if (CacheFactory.getInstance().isInitialized()) { + log.debug("Using cache - key: " + key); + net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); - QueryExecutor queryExecutor = QueryExecutorFactory - .getInstance() - .getQueryExecutor(); - - result = process( - Arrays.asList(coords), - numSamples(callContext), - queryExecutor.executeQuery( - queryID, - addedFilterValues)); - } - catch (QueryException e) { - log.error(e,e); - } - - if (CacheFactory.getInstance().isInitialized()) { - CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); - } - + if (value != null) { + log.debug("Found element in cache."); + return (Collection<Result>) (value.getObjectValue()); } } + + log.debug("Not using cache or element not found."); + Collection<Result> result = null; + + InputData meshLine = inputData.get("mesh_linestring"); + InputData meshId = inputData.get("meshid"); + + if (meshLine == null) { + log.error("mesh_linestring is not defined"); + throw new IllegalStateException("missing mesh_linestring"); + } + + if (meshId == null) { + log.error("meshid is not defined"); + throw new IllegalStateException("missing meshid"); + } + + Coordinate [] coords = WKTUtils.toCoordinates( + meshLine.getValue()); + + if (coords == null) { + throw new IllegalStateException("cannot read coordinates"); + } + + try { + String additionWhere = USE_INDEX_BUFFER + ? WKTUtils.worldCoordinatesToIndex( + coords, + result, + meshId.getValue(), + ijkQueryID) + : WKTUtils.TRUE_EXPRESSION; + + String[] addedFilterValues = StringUtils.append( + generateFilterValuesFromInputData(), + additionWhere); + + QueryExecutor queryExecutor = QueryExecutorFactory + .getInstance() + .getQueryExecutor(); + + result = process( + Arrays.asList(coords), + numSamples(callContext), + queryExecutor.executeQuery( + queryID, + addedFilterValues)); + } + catch (QueryException e) { + log.error(e,e); + } + + if (CacheFactory.getInstance().isInitialized()) { + CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); + } + return result; } - @Override - protected String createChartSubtitle(Locale locale, String uuid) { - log.debug("create chart subtitle for horizontal crossprofile charts."); - String subtitle = createTimePeriod(locale, uuid); - - return subtitle; - } - - + /** + * Prepares the input data for chart creation. + * + * @param path The coordinates describing the path the data is processed + * for. + * @param numSamples Number of samples. + * @param input The input data. + * @return finalized data ready for chart creation. + */ public static Collection<Result> process( List<Coordinate> path, int numSamples, @@ -252,9 +544,11 @@ DefaultResultDescriptor resultDescriptor = new DefaultResultDescriptor(); + log.debug("------------------------------------------------------"); for (int j = 0; j < columns; ++j) { String columnName = rd.getColumnName(j); if (!StringUtils.contains(COLUMN_BLACKLIST, columnName)) { + log.debug("!!! COLUMN NAME: " + columnName); resultDescriptor.addColumn( columnName, rd.getColumnClassName(j)); @@ -409,3 +703,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.profile.horizontal; + +import java.util.Locale; + +import org.apache.log4j.Logger; + +public class HorizontalProfileMeshOutputState +extends HorizontalProfileOutputState +{ + private static Logger logger = + Logger.getLogger(HorizontalProfileMeshOutputState.class); + + + public HorizontalProfileMeshOutputState() { + super(); + } + + + /** + * Creates and returns the subtitle of a chart. + * + * @param locale The Locale used to adjust the language of the subtitle. + * @param uuid The UUID of the current artifact. + * @return the timeperiod of this chart and the start coordinate. + */ + @Override + protected String createChartSubtitle(Locale locale, String uuid) { + logger.debug("create chart subtitle."); + + StringBuilder sb = new StringBuilder(); + String time = getData(locale, "dateid"); + if (time != null) { + sb.append(time); + } + + String coordinate = getData(locale, "mesh_point"); + if (coordinate != null) { + sb.append("\n"); + sb.append(coordinate); + } + + String depth = getData(locale, "depthid"); + if (depth != null) { + sb.append("\n"); + sb.append(depth); + } + + return sb.toString(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.profile.horizontal; + +import au.com.bytecode.opencsv.CSVWriter; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.artifacts.cache.CacheFactory; + +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.HorizontalProfileVectorChart; + +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.Export.Profile; +import de.intevation.gnv.exports.SimpleOdvDataCollector; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.utils.VectorDataProcessor; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; + +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.statistics.HorizontalProfileVectorStatistics; + +import java.io.IOException; +import java.io.OutputStream; + +import java.util.Collection; +import java.util.Locale; +import java.util.Map; + +import net.sf.ehcache.Cache; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class HorizontalProfileMeshVectorOutputState +extends HorizontalProfileMeshOutputState +{ + private static Logger logger = + Logger.getLogger(HorizontalProfileMeshVectorOutputState.class); + + public static final String[] RESULT_COLUMNS = { + "YORDINATE", "SHAPE", + "GROUP1", "GROUP2", "GROUP3", + "IPOSITION", "JPOSITION", + "DATAID", "MESHID", + "SERIES" + }; + + + public static final String[] ODV_COLUMN_HEADERS = { + "Cruise", + "Station", + "Type", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", + "Bot. Depth [m]", + "Depth [m]", + "QF", + "XComponent", + "QF", + "YComponent", + "QF", + "ZComponent", + "QF", + "Speed", + "QF", + "Direction", + "QF" + }; + + + public static final String[] ODV_PROFILE_NAMES = { + "CRUISE", + "STATION", + "TYPE", + "TIMEVALUE", + "SHAPE", + "BOTDEPTH", + "DEPTH", + "QF", + "XCOMPONENT", + "QF", + "YCOMPONENT", + "QF", + "ZCOMPONENT", + "QF", + "SPEED", + "QF", + "DIRECTION", + "QF"}; + + + @Override + protected Object getChartResult(String uuid, CallContext callContext) { + logger.debug("Fetch data for horizontalprofile chart with vector data"); + CacheFactory factory = CacheFactory.getInstance(); + + if (factory.isInitialized()) { + // we use a cache + logger.info("Using cache."); + Cache cache = factory.getCache(); + String key = "chart_" + getHash(); + + net.sf.ehcache.Element value = cache.get(key); + if (value != null) { + logger.debug("Found element in cache."); + return value.getObjectValue(); + } + else { + logger.debug("Element not in cache, we ask the database"); + Collection<Result> res = (Collection<Result>)getData(queryID); + res = VectorDataProcessor.process(res, RESULT_COLUMNS); + logger.debug("Got " + res.size() + " elements from database."); + + cache.put(new net.sf.ehcache.Element(key, res)); + + return res; + } + } + else { + // we don't use a cache, so we have to query the database every + // single time + logger.info("Not using a cache."); + return VectorDataProcessor.process( + getData(queryID), RESULT_COLUMNS); + } + } + + + @Override + protected Chart getChart( + ChartLabels chartLables, + ChartTheme theme, + Collection parameters, + Collection measurements, + Collection dates, + Object result, + Locale locale, + String uuid, + boolean linesVisible, + boolean shapesVisible, + CallContext callContext + ) { + Chart chart = new HorizontalProfileVectorChart( + chartLables, + theme, + parameters, + measurements, + dates, + (Collection)result, + timeGapDefinitions, + locale, + linesVisible, + shapesVisible + ); + chart.generateChart(); + + return chart; + } + + + @Override + protected Chart[] getHistograms( + String uuid, + CallContext callContext, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates, + Map requestParameter + ) { + Collection results = (Collection) getChartResult(uuid, callContext); + ChartTheme theme = createStyle(callContext); + + return VectorDataProcessor.getHistograms( + uuid, callContext, results, theme, requestParameter); + } + + + @Override + protected void createODV( + OutputStream outputStream, Collection result, String uuid) + throws IOException, StateException + { + logger.info("Start exporting " + result.size() + " items to odv."); + Export export = new DefaultExport( + new SimpleOdvDataCollector(ODV_PROFILE_NAMES)); + + Profile profile = new DefaultProfile( + ODV_COLUMN_HEADERS, + '\t', + CSVWriter.NO_QUOTE_CHARACTER, + CSVWriter.NO_ESCAPE_CHARACTER, + "ODV", + "ISO-8859-1"); + + export.create(profile, outputStream, result); + } + + + protected Statistics getStatisticsGenerator() { + return new HorizontalProfileVectorStatistics(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,63 +1,65 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ -package de.intevation.gnv.state.profile.horizontal; - -import com.vividsolutions.jts.io.ParseException; -import com.vividsolutions.jts.io.WKTReader; - -import de.intevation.artifacts.CallContext; - -import de.intevation.gnv.chart.Chart; -import de.intevation.gnv.chart.ChartLabels; -import de.intevation.gnv.chart.HorizontalProfileChart; -import de.intevation.gnv.exports.DefaultExport; -import de.intevation.gnv.exports.DefaultProfile; - -import de.intevation.gnv.exports.Export.Profile; - -import de.intevation.gnv.exports.ShapeDataCollector; - -import de.intevation.gnv.geobackend.base.Result; - -import de.intevation.gnv.state.describedata.KeyValueDescibeData; - -import de.intevation.gnv.state.exception.StateException; - -import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; - -import de.intevation.gnv.statistics.HorizontalProfileStatistics; -import de.intevation.gnv.statistics.Statistics; - -import de.intevation.gnv.utils.WKTUtils; +package de.intevation.gnv.state.profile.horizontal; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; - +import java.text.ParseException; import java.text.SimpleDateFormat; - import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.Locale; import org.apache.log4j.Logger; - import org.jfree.chart.ChartTheme; +import de.intevation.artifacts.CallContext; +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.HorizontalProfileChart; +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.ShapeDataCollector; +import de.intevation.gnv.exports.Export.Profile; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.state.InputData; +import de.intevation.gnv.state.State; +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; +import de.intevation.gnv.statistics.HorizontalProfileStatistics; +import de.intevation.gnv.statistics.Statistics; + /** - * @author Tim Englich (tim.englich@intevation.de) + * This <code>OutputState</code> is used for 'Horizontalprofile' products. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HorizontalProfileOutputState extends TimeSeriesOutputState -{ - public static final String [] HORIZONTAL_PROFILE_COLUMNS = { +{ + public static final String [] HORIZONTAL_PROFILE_MESH_COLUMNS = { "SHAPE", "YORDINATE", - "GROUP1" - // "GROUP2", + "GROUP1", + "MESHID" + }; + + public static final String [] HORIZONTAL_PROFILE_MEASUREMENT_COLUMNS = { + "SHAPE", + "YORDINATE", + "GROUP1", + "SURVEYID" }; @@ -66,7 +68,7 @@ "Latitude", "Value", "ParameterID", - //"MeshID" + "MeshID" }; @@ -75,8 +77,9 @@ "Latitude", "Value", "ParameterID", - //"SurveyID" + "SurveyID" }; + /** * The UID of this class */ @@ -126,6 +129,24 @@ } + /** + * This method creates a chart and returns it. + * + * @param chartLables Labels used to decorate the chart. + * @param theme The theme used to adjust the look of the chart. + * @param parameters A collection with parameters this chart contains. + * @param measurements A collection with measurement this chart contains. + * @param dates A collection with dates this chart contains. + * @param result The data collection used to be displayed in this chart. + * @param locale The Locale used to determine the language. + * @param uuid The uuid of the current artifact. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two points in a chart (not used in this chart type). + * @param shapesVisible A boolean property to determine the visiblity of + * datapoints in this chart (not used in this chart type). + * @param callContext The CallContext object. + * @return a <code>HorizontalProfileChart</code>. + */ @Override protected Chart getChart( ChartLabels chartLables, @@ -174,9 +195,6 @@ } - /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator() - */ @Override protected Statistics getStatisticsGenerator() { return new HorizontalProfileStatistics(); @@ -196,7 +214,7 @@ Profile profile = null; int dataid = res.getInteger("DATAID").intValue(); - + DefaultExport export = null; // on meshes if (dataid == 2) { profile = new DefaultProfile( @@ -206,6 +224,8 @@ '"', "CSV", "ISO-8859-1"); + export = new DefaultExport( + new ShapeDataCollector(HORIZONTAL_PROFILE_MESH_COLUMNS)); } // on measurements @@ -217,14 +237,23 @@ '"', "CSV", "ISO-8859-1"); + export = new DefaultExport( + new ShapeDataCollector(HORIZONTAL_PROFILE_MEASUREMENT_COLUMNS)); } - DefaultExport export = new DefaultExport( - new ShapeDataCollector(HORIZONTAL_PROFILE_COLUMNS)); + export.create(profile, out, results); } + /** + * Creates and returns the chart title. + * + * @param locale The Locale used to adjust the language of the title. + * @param uuid The UUID of the current artifact. + * @return the name of the selected fis. + */ + @Override protected String createChartTitle(Locale locale, String uuid) { String fisName = getFisName(locale); log.debug("created title for horizontal profile chart: " + fisName); @@ -233,66 +262,68 @@ } + @Override protected String createChartSubtitle(Locale locale, String uuid) { - log.debug("create chart subtitle."); - String subtitle = createTimePeriod(locale, uuid); + log.debug("Create subtitle for horizontalprofile chart on meshes."); - // ODV results contain meta information about cruise, station and so on - Collection results = getODVResult(uuid); - if (results != null) { - Iterator iter = results.iterator(); - Result result = iter.hasNext() ? (Result) iter.next() : null; - - subtitle += subtitle.length() != 0 ? "\n" : ""; - subtitle += createMetaChartSubtitle(locale, result); + StringBuilder sb = new StringBuilder(); + String ship = getData(locale, "vehicleid"); + if (ship != null) { + sb.append(ship); } - return subtitle; + String cruise = getData(locale, "cruiseid"); + if (cruise != null) { + if (ship != null) + sb.append("\n"); + + sb.append(cruise); + } + + String track = getData(locale, "trackid"); + if (track != null) { + if (cruise != null) + sb.append("\n"); + + sb.append(track); + } + + return sb.toString(); } - protected String createMetaChartSubtitle(Locale locale, Result result) { - log.debug("Fetch meta information and put it into subtitle."); - if (result == null) - return ""; - - StringBuilder meta = new StringBuilder(); - WKTReader wktReader = new WKTReader(); - - - for (int i = 0; i < CHART_TITLE_META.length; i++) { - String qry = CHART_TITLE_META[i]; - - if (qry.equals("SHAPE")) { - String wktPoint = result.getString(qry); + protected String getData(Locale locale, String data) { + InputData input = null; - meta.append(getMessage(locale,"coordinate","coordinate")); - meta.append(": "); - meta.append(WKTUtils.toText(wktPoint)); - } - else { - log.debug( - "Add " + qry + " to meta information of subtitle: " - + result.getString(qry) - ); - meta.append(getMessage( - locale, - CHART_TITLE_META_RESSOURCES[i], - CHART_TITLE_META_RESSOURCES[i] - )); - meta.append(": "); - meta.append(result.getString(qry)); - } + State parent = this; + do { + input = inputData.get(data); - if (i != CHART_TITLE_META.length-1) - meta.append("\n"); + if (input != null) + break; + } + while ((parent = parent.getParent()) != null); + + if (input == null) { + log.warn("No data found for: " + data); + return null; } - log.debug("Meta title for chart: " + meta.toString()); - return meta.toString(); + String value = input.getDescription(input.getValue()); + String title = RessourceFactory.getInstance().getRessource( + locale, data, data); + + return (title + ": " + value); } + /** + * Creates a timeperiod taking account for all data items used in charts. + * + * @param locale The Locale used to adjust the language of the subtitle. + * @param uuid The UUID of the current artifact. + * @return a human readable timeperiod. + */ protected String createTimePeriod(Locale locale, String uuid) { log.debug("create time period for chart subtitle."); String subTitle = null; @@ -330,7 +361,7 @@ endDate = current; } } - catch (java.text.ParseException pe) { + catch (ParseException pe) { log.warn("Error while parsing date: " + data.getValue(), pe); } } @@ -345,3 +376,4 @@ return subTitle; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.profile.horizontal; import de.intevation.artifacts.CallContext; @@ -24,12 +29,13 @@ import java.util.List; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This states handles coordinate inputs. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class NorthSouthEastWestState extends StateBase { - + /** * The UID of this Class */ @@ -44,9 +50,7 @@ public NorthSouthEastWestState() { } - /** - * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection, java.lang.String) - */ + @Override protected List<Object> purifyResult(Collection<Result> result, String uuid) { List<Object> describeData = new ArrayList<Object>(); @@ -64,9 +68,7 @@ return describeData; } - /** - * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallMeta) - */ + @Override public void initialize(String uuid, CallContext context) throws StateException @@ -75,14 +77,13 @@ RessourceFactory factory = RessourceFactory.getInstance(); // XXX Workarround - we need these strings in purifyResult, but have no - // CallMeta object there which is necessary to get resources from - // RessourceFactory. Storing the strings here is not nice, because the + // CallMeta object there which is necessary to get resources from + // RessourceFactory. Storing the strings here is not nice, because the // Locale object could change! ipos = factory.getRessource( callMeta.getLanguages(), "iposition", "iposition"); jpos = factory.getRessource( callMeta.getLanguages(), "jposition", "jposition"); } - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +State classes used by artifacts representing 'Horizontalprofile' to handle input +and output. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,36 +1,51 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state.profile.horizontalcrosssection; +import java.awt.Dimension; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.MultiLineString; import com.vividsolutions.jts.geom.MultiPolygon; import com.vividsolutions.jts.geom.Polygon; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; - +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; - import de.intevation.gnv.artifacts.cache.CacheFactory; - import de.intevation.gnv.artifacts.context.GNVArtifactContext; - import de.intevation.gnv.geobackend.base.Result; import de.intevation.gnv.geobackend.base.ResultDescriptor; - 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.geobackend.sde.datasources.RasterObject; - import de.intevation.gnv.math.AreaInterpolation; import de.intevation.gnv.math.AttributedPoint2ds; import de.intevation.gnv.math.Point2d; import de.intevation.gnv.math.QueriedXYDepth; - import de.intevation.gnv.raster.ExternalIndexConverter; import de.intevation.gnv.raster.IsoAttributeGenerator; import de.intevation.gnv.raster.JTSMultiLineStringProducer; @@ -39,12 +54,10 @@ import de.intevation.gnv.raster.PaletteManager; import de.intevation.gnv.raster.Raster; import de.intevation.gnv.raster.Vectorizer; - import de.intevation.gnv.state.InputData; import de.intevation.gnv.state.OutputStateBase; - import de.intevation.gnv.state.exception.StateException; - +import de.intevation.gnv.utils.ExclusiveExec; import de.intevation.gnv.utils.FileUtils; import de.intevation.gnv.utils.MapfileGenerator; import de.intevation.gnv.utils.MetaWriter; @@ -53,29 +66,10 @@ import de.intevation.gnv.utils.StringUtils; import de.intevation.gnv.utils.WKTUtils; -import java.awt.Dimension; - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HorizontalCrossSectionMeshOutputState extends OutputStateBase @@ -91,8 +85,16 @@ public static final boolean USE_INDEX_BUFFER = Boolean.getBoolean("gnv.horizontal.cross.section.mesh.index.buffer"); + /** + * Shapefile name for isolines. + */ public static final String ISOLINES_NAME = "isolines.shp"; + + /** + * Shapefile name for polygons. + */ public static final String POLYGON_NAME = "polygons.shp"; + public static final String LAYER_MODEL = "horizontalcrosssection"; private String ijkQueryID; @@ -100,6 +102,8 @@ private Boolean shapeFileLock = new Boolean(true); private String shapeFilePath; + + private Envelope bbox = null; /** * Constructor @@ -107,8 +111,9 @@ public HorizontalCrossSectionMeshOutputState() { } + @Override public void initialize(String uuid, CallContext callContext) - throws StateException { + throws StateException { super.initialize(uuid, callContext); if (log.isDebugEnabled()) { log.debug("initialize output state " + uuid); @@ -117,18 +122,33 @@ getResult(uuid, callContext); } + /** + * Returns the shapefile directory path. + * + * @return the shapefile path. + */ public String getShapeFilePath() { synchronized (shapeFileLock) { return shapeFilePath; } } + /** + * Set the shapefile path. + * + * @param shapeFilePath Destination path to write shapefiles. + */ public void setShapeFilePath(String shapeFilePath) { synchronized (shapeFileLock) { this.shapeFilePath = shapeFilePath; } } + /** + * Method to reset the shapefile path. + * + * @return the old path. + */ public String resetShapeFilePath() { synchronized (shapeFileLock) { String path = shapeFilePath; @@ -137,13 +157,21 @@ } } + + /** + * This method removes all shapefiles which might have been written by this + * artifact and resets the shapefile path. + * + * @param globalContext CallContext + */ + @Override public void endOfLife(Object globalContext) { super.endOfLife(globalContext); // do it in background new Thread() { + @Override public void run() { - // TODO: Do the un-publishing WMS stuff. String path = resetShapeFilePath(); if (path == null) { @@ -170,14 +198,31 @@ }.start(); } + + /** + * This out target has two options:<br> + * <ol> + * <li>zip: Write the resulting data to shapefiles and export them as + * zip-archive.</li> + * <li>wms: Write the resulting data to shapefiles and feed a map service + * with a layer displaying these shapefiles.</li> + * </ol> + * + * @param format + * @param inputData + * @param outputStream + * @param uuid + * @param callContext + * @throws StateException + */ public void out( - Document format, + Document format, Collection<InputData> inputData, OutputStream outputStream, String uuid, CallContext callContext ) - throws StateException + throws StateException { String outputMode = XMLUtils.xpathString( format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); @@ -197,7 +242,7 @@ } else if ("wms".equals(outputMode)) { XMLUtils.toStream( - getWMS(uuid, callContext), + getWMS(uuid, callContext, inputData), outputStream); } else { @@ -205,11 +250,20 @@ } } + /** + * Create a zip archive with the shapefiles of the given shapefiles path and + * write it to <code>output</code>. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param output The output stream. + * @throws StateException if an error occured while zipfile creation. + */ protected void writeZip( String uuid, CallContext callContext, OutputStream output - ) + ) throws StateException { try { @@ -222,9 +276,11 @@ } else { AttributedPoint2ds result = getResult(uuid, callContext); + ExclusiveExec.UniqueKey k = ExclusiveExec.INSTANCE.acquire(uuid); if (result != null && (p = writeToShapeFile(uuid, result, callContext)) != null) { FileUtils.createZipArchive(new File(p), output); + ExclusiveExec.INSTANCE.release(k); } } } @@ -233,55 +289,207 @@ } } - protected Document getWMS(String uuid, CallContext callContext) + /** + * Write data to shapefiles and feed a map service with information about + * these shapefiles. The map service can be queried for displaying + * corresponding layers as WMS. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param inputData A collection with some input data. + * @return a document with some meta information (shapefile path, geometry + * type, time to live of the current artifact, etc). + * @throws StateException if an error occured while shapefile writing. + */ + protected Document getWMS( + String uuid, + CallContext callContext, + Collection<InputData> inputData + ) throws StateException { - // TODO: Do the real WMS publishing here! Document document = XMLUtils.newDocument(); Element pathElement = document.createElement("path"); document.appendChild(pathElement); - String path = getShapeFilePath(); + String path = getShapeFilePath(); if (path != null && new File(path).isDirectory()) { + Document meta = MetaWriter.initMeta(); + MetaWriter.insertAbstractMeta(callContext, meta); + + String prefix = getLayerPrefix(inputData); + if (prefix == null) { + prefix = uuid; + } + + // append polygon meta + String model = findParameterType(callContext); + String type = "POLYGON"; + String name = getLayerName(uuid, type); + String title = getLayerTitle(prefix, type); + String data = getLayerData(uuid, POLYGON_NAME); + String status = "OFF"; + MetaWriter.insertLayer( + callContext, meta, name, title, data, model, type, status); + + // append isoline meta + model += "_isolines"; + type = "LINE"; + name = getLayerName(uuid, type); + title = getLayerTitle(prefix, type); + data = getLayerData(uuid, ISOLINES_NAME); + MetaWriter.insertLayer( + callContext, meta, name, title, data, model, type, status); + + if (meta != null) { + MetaWriter.insertMbr(this.bbox, "EPSG:4326", meta); + MetaWriter.writeMetaFile(path, meta); + MapfileGenerator.getInstance().update(); + return meta; + } + pathElement.setTextContent(path); } else { AttributedPoint2ds result = getResult(uuid, callContext); + ExclusiveExec.UniqueKey key = ExclusiveExec.INSTANCE.acquire(uuid); + try{ if (result != null && (path = writeToShapeFile(uuid, result, callContext)) != null) { - - InputData inputParam = inputData.get("parameterid"); - Map<Integer, PaletteManager> paletteManagers = - getPalettes(callContext); - String paramType = null; + Document meta = MetaWriter.initMeta(); + MetaWriter.insertAbstractMeta(callContext, meta); - if (inputParam == null || paletteManagers == null) { - log.warn("Parameter-id not found."); - paramType = LAYER_MODEL; - } - else { - Integer parameterId = Integer.parseInt(inputParam.getValue()); - PaletteManager paletteManager = paletteManagers.get(parameterId); - - paramType = LAYER_MODEL + "_" + paletteManager.getName(); + String prefix = getLayerPrefix(inputData); + if (prefix == null) { + prefix = uuid; } - Document meta = MetaWriter.writeHorizontalcrosssectionMeta( - callContext, uuid, path, paramType); + // append polygon meta + String model = findParameterType(callContext); + String type = "POLYGON"; + String name = getLayerName(uuid, type); + String title = getLayerTitle(prefix, type); + String data = getLayerData(uuid, POLYGON_NAME); + String status = "OFF"; + MetaWriter.insertLayer( + callContext, meta, name, title, data, model, type, status); + + // append isoline meta + model += "_isolines"; + type = "LINE"; + name = getLayerName(uuid, type); + title = getLayerTitle(prefix, type); + data = getLayerData(uuid, ISOLINES_NAME); + MetaWriter.insertLayer( + callContext, meta, name, title, data, model, type, status); + if (meta != null) { + MetaWriter.insertMbr(this.bbox, "EPSG:4326", meta); + MetaWriter.writeMetaFile(path, meta); MapfileGenerator.getInstance().update(); return meta; } pathElement.setTextContent(path); } + }finally{ + ExclusiveExec.INSTANCE.release(key); + } } return document; } + /** + * Find the parameter name which is used during mapfile creation in + * MapfileGenerator. + * + * @param callContext The CallContext object. + * @return the parameter name of the current parameterization. + */ + protected String findParameterType(CallContext callContext) { + InputData inputParam = inputData.get("parameterid"); + + Map<Integer, PaletteManager> paletteManagers = getPalettes(callContext); + + if (inputParam == null || paletteManagers == null) { + log.warn("Parameter-id not found."); + return LAYER_MODEL; + } + else { + Integer parameterId = Integer.parseInt(inputParam.getValue()); + PaletteManager paletteManager = paletteManagers.get(parameterId); + + return LAYER_MODEL + "_" + paletteManager.getName(); + } + } + + + /** + * Find the title for a wms layer specified by the user. + * + * @param inputData A collection with InputData objects. + * @return the title. + */ + protected String getLayerPrefix(Collection<InputData> inputData) { + for (InputData data: inputData) { + String name = data.getName(); + if (name != null && name.equals("title")) { + return (String) data.getValue(); + } + } + + return null; + } + + + /** + * Returns the name of the layer. + * + * @param uuid The uuid the the current session. It is the base part of the + * layername. + * @param type The type of the layer ('POLYGON' or 'LINE'). + * @return the name of the layer. + */ + protected String getLayerName(String uuid, String type) { + return "GNV_" + uuid + "-" + type; + } + + /** + * Returns the layer title. + * + * @param prefix A prefix (null not permitted). + * @param type The layer type. + * @return the title of the layer. + */ + protected String getLayerTitle(String prefix, String type) { + return "GNV_" + prefix + "-" + type; + } + + + /** + * Returns the path to the shapefile that serves the layer data. + * + * @param shapeDir The shapefile directory. + * @param filename The name of the shapefile. + * @return the relative path to the shapefile. + */ + protected String getLayerData(String shapeDir, String filename) { + File path = new File(shapeDir, filename); + + return path.toString(); + } + + /** + * Write the resulting data to shapefiles. + * + * @param uuid The UUID of the current artifact. + * @param result The finalized data used for shapefile creation. + * @param callContext The CallContext object. + * @return the shapefile path. + */ protected String writeToShapeFile( String uuid, AttributedPoint2ds result, @@ -296,14 +504,11 @@ try { synchronized (shapeFileLock) { - int count = 0; - while (shapeDir.exists()) { - shapeDir = new File(baseDir, uuid + "-" + count); - ++count; + if (shapeDir.exists()) { + FileUtils.deleteContent(shapeDir); } - - if (!shapeDir.mkdirs()) { - log.error("cannot create directory '" + else if (!shapeDir.mkdirs()) { + log.error("cannot create directory '" + shapeDir.getAbsolutePath() + "'"); return null; } @@ -352,22 +557,33 @@ FileUtils.deleteRecursive(shapeDir); } } - } + } + /** + * Return the processed results ready for being written to shapefile. + * + * @param uuid The UUID of the current artifacts. + * @param callContext The CallContext object. + * @return the processed data. + * @throws StateException if an error occured while processing data. + */ protected AttributedPoint2ds getResult(String uuid, CallContext callContext) throws StateException { CacheFactory cf = CacheFactory.getInstance(); - String key = uuid + super.getID(); + String key = getHash(); if (cf.isInitialized()) { + log.debug("Using cache - key: " + key); net.sf.ehcache.Element value = cf.getCache().get(key); if (value != null) { - return (AttributedPoint2ds)value.getObjectValue(); + log.debug("Found element in cache."); + return (AttributedPoint2ds)value.getObjectValue(); } } + log.debug("Not using cache or element not found."); AttributedPoint2ds result = produceResult(callContext); if (result != null && cf.isInitialized()) { @@ -376,8 +592,16 @@ return result; } - - protected AttributedPoint2ds produceResult(CallContext callContext) + + /** + * Query the database for result data and turn it into a useful format to + * write this data into shapefiles. + * + * @param callContext The CallContext object. + * @return the processed data. + * @throws StateException if an error occured while processing data. + */ + protected AttributedPoint2ds produceResult(CallContext callContext) throws StateException { InputData meshPolygon = inputData.get("mesh_polygon"); @@ -403,6 +627,7 @@ try { Envelope env = p.getEnvelopeInternal(); + this.bbox = env; String additionWhere; if (USE_INDEX_BUFFER) { @@ -446,6 +671,13 @@ throw new StateException("no result produced"); } + /** + * First step of finalizing the data returned from database. + * + * @param results Resulting data from database. + * @return the pre-processed data which is still not useful for being + * written to shapefiles. + */ public AttributedPoint2ds preProcess(Collection<Result> results) { boolean debug = log.isDebugEnabled(); @@ -478,7 +710,7 @@ int pIdx = rd.getColumnIndex("PARAMETERID"); if (sIdx == -1 || iIdx == -1 - || jIdx == -1 || kIdx == -1 + || jIdx == -1 || kIdx == -1 || vIdx == -1 || tIdx == -1 || pIdx == -1 ) { @@ -504,13 +736,23 @@ Point2d p2d = new Point2d(coord.x, coord.y, v, i, j); points.add(p2d); - + } ap2ds.setPoints(points); return ap2ds; } + /** + * The last step of finalizing the data. The returned data is useful for + * shapefile creation. + * + * @param boundingBox The bounding box. + * @param polygon A polygon. + * @param callContext CallContext. + * @param input The pre-processed data. + * @return the finalized data ready for shapefile creation. + */ public AttributedPoint2ds process( Envelope boundingBox, Polygon polygon, @@ -554,7 +796,7 @@ int extrapolationRounds = extrapolationRounds(callContext); if (!interpolation.interpolate( - input.getPoints(), + input.getPoints(), boundingBox, new Dimension(numSamples, numSamples), new QueriedXYDepth(groundInterpolation), @@ -592,7 +834,7 @@ polygon, boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMaxX(), boundingBox.getMaxY()); - + int numRegions = new Vectorizer(intRaster, numSamples) .process(jtsmpp); @@ -649,14 +891,14 @@ return input; } - + @Override public void setup(Node configuration) { super.setup(configuration); this.ijkQueryID = Config.getStringXPath(configuration,"queryID-ijk"); - + } - + private static int numSamples(CallContext callContext) { GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); @@ -688,7 +930,7 @@ } private static int getGroundInterpolation(CallContext callContext) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); String interpolation = (String)context.get( @@ -700,7 +942,7 @@ private static Map<Integer, PaletteManager> getPalettes( CallContext callContext ) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); Map<Integer, PaletteManager> palettes = (Map<Integer, PaletteManager>)context.get( @@ -709,5 +951,11 @@ ? palettes : new HashMap<Integer, PaletteManager>(); } + + + @Override + public void cleanup(Object context) { + resetShapeFilePath(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +State classes used by artifacts representing 'Horizontalschnitte' to handle input +and output. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +DOCUMENT ME! +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileMeshVectorOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.profile.vertical; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.artifacts.cache.CacheFactory; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.utils.VectorDataProcessor; + +import java.util.Collection; + +import net.sf.ehcache.Cache; + +import org.apache.log4j.Logger; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class VerticalProfileMeshVectorOutputState +extends VerticalProfileVectorOutputState +{ + public static final String[] RESULT_COLUMNS = { + "YORDINATE", "XORDINATE", "KPOSITION", + "GROUP1", "GROUP2", "GROUP3", + "DATAID", "FEATUREID", "MESHID", + "SERIES" + }; + + private static Logger logger = + Logger.getLogger(VerticalProfileMeshVectorOutputState.class); + + + @Override + protected Object getChartResult(String uuid, CallContext callContext) { + logger.debug("Fetch chart data for vertical profile with vector data."); + CacheFactory factory = CacheFactory.getInstance(); + + if (factory.isInitialized()) { + // we use a cache + logger.info("Using cache."); + Cache cache = factory.getCache(); + String key = "chart_" + getHash(); + + net.sf.ehcache.Element value = cache.get(key); + if (value != null) { + logger.debug("Found element in cache."); + return value.getObjectValue(); + } + else { + logger.debug("Element not in cache, we ask the database"); + Collection<Result> res = (Collection<Result>)getData(queryID); + logger.debug("Got " + res.size() + " elements from db."); + + res = VectorDataProcessor.process(res, RESULT_COLUMNS); + cache.put(new net.sf.ehcache.Element(key, res)); + + return res; + } + } + else { + // we don't use a cache, so we have to query the database every + // single time + logger.info("Not using a cache."); + return VectorDataProcessor.process( + getData(queryID), RESULT_COLUMNS); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,38 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.state.profile.vertical; +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.VerticalProfileChart; + +import de.intevation.gnv.exports.DefaultDataCollector; +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; + +import de.intevation.gnv.exports.Export.Profile; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.exception.StateException; + +import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; + +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.statistics.VerticalProfileStatistics; + import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; + import java.util.Collection; import java.util.Iterator; import java.util.Locale; @@ -14,60 +41,61 @@ import org.jfree.chart.ChartTheme; -import de.intevation.gnv.chart.Chart; -import de.intevation.gnv.chart.ChartLabels; -import de.intevation.gnv.chart.VerticalProfileChart; -import de.intevation.gnv.exports.DefaultExport; -import de.intevation.gnv.exports.DefaultDataCollector; -import de.intevation.gnv.exports.DefaultProfile; -import de.intevation.gnv.exports.Export.Profile; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.exception.StateException; -import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; -import de.intevation.gnv.statistics.Statistics; -import de.intevation.gnv.statistics.VerticalProfileStatistics; - -import de.intevation.artifacts.CallContext; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class VerticalProfileOutputState extends TimeSeriesOutputState { public static final String [] VERTICAL_PROFILE_COLUMNS = { "XORDINATE", // not quite sure if this is depth "YORDINATE", - "GROUP1" - // "GROUP2", - // "GROUP3" + "GROUP1", + "FEATUREID", + "TIMESERIESID" + }; + + public static final String [] VERTICAL_PROFILE_MESH_COLUMNS = { + "XORDINATE", // not quite sure if this is depth + "YORDINATE", + "GROUP1", + "FEATUREID", + "MESHID" + }; + + public static final String [] VERTICAL_PROFILE_MEASUREMENT_COLUMNS = { + "XORDINATE", // not quite sure if this is depth + "YORDINATE", + "GROUP1", + "FEATUREID", + "SERIESID" }; public static final String [] VERTICAL_MESH_CSV_COLUMN_LABEL = { "CentralDepth", "Value", - "ParameterID" - // TODO "FeatureID", - // TODO "MeshID" + "ParameterID", + "FeatureID", + "MeshID" }; public static final String [] VERTICAL_TIMESERIES_CSV_COLUMN_LABEL = { "Depth", "Value", - "ParameterID" - // TODO FeatureID missing - // TODO TimeseriesID missing + "ParameterID", + "FeatureID", + "TimeseriesID" }; public static final String [] VERTICAL_MEASUREMENT_CSV_COLUMN_LABEL = { "Depth", "Value", - "ParameterID" - // TODO FeatureID missing - // TODO SeriesID missing + "ParameterID", + "FeatureID", + "SeriesID" }; @@ -80,7 +108,7 @@ .getLogger(TimeSeriesOutputState.class); /** - * Constructor + * Creates a new VerticalProfileOutputState object. */ public VerticalProfileOutputState() { super(); @@ -136,19 +164,28 @@ } + /** + * Creates a csv file of the resulting data and writes it to output stream. + * + * @param out The output stream. + * @param results The data used to create the csv file. + * @throws UnsupportedEncodingException if the encoding is not supported. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while creating the csv file. + */ @Override protected void createCSV(OutputStream out, Collection<Result> results) throws UnsupportedEncodingException, IOException, StateException { - Iterator iter = results.iterator(); - Result res = iter.hasNext() ? (Result) iter.next() : null; + Iterator<Result> iter = results.iterator(); + Result res = iter.hasNext() ? iter.next() : null; if (res == null) return; Profile profile = null; int dataid = res.getInteger("DATAID").intValue(); - + DefaultExport export = null; // on meshes if (dataid == 2) { profile = new DefaultProfile( @@ -158,6 +195,8 @@ '"', "CSV", "ISO-8859-1"); + export = new DefaultExport( + new DefaultDataCollector(VERTICAL_PROFILE_MESH_COLUMNS)); } // on timeseries @@ -169,6 +208,8 @@ '"', "CSV", "ISO-8859-1"); + export = new DefaultExport( + new DefaultDataCollector(VERTICAL_PROFILE_COLUMNS)); } // on measurements @@ -180,26 +221,23 @@ '"', "CSV", "ISO-8859-1"); + export = new DefaultExport( + new DefaultDataCollector(VERTICAL_PROFILE_MEASUREMENT_COLUMNS)); } - - DefaultExport export = new DefaultExport( - new DefaultDataCollector(VERTICAL_PROFILE_COLUMNS)); export.create(profile, out, results); } + @Override protected String createChartSubtitle(Locale locale, String uuid) { return getSelectedFeatureName(uuid); } - - /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator() - */ @Override protected Statistics getStatisticsGenerator() { return new VerticalProfileStatistics(); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.profile.vertical; + +import au.com.bytecode.opencsv.CSVWriter; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.artifacts.cache.CacheFactory; + +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.VerticalProfileVectorChart; + +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.Export.Profile; +import de.intevation.gnv.exports.SimpleOdvDataCollector; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.utils.VectorDataProcessor; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; + +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.statistics.VerticalProfileVectorStatistics; + +import java.io.IOException; +import java.io.OutputStream; + +import java.util.Collection; +import java.util.Locale; +import java.util.Map; + +import net.sf.ehcache.Cache; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class VerticalProfileVectorOutputState +extends VerticalProfileOutputState +{ + private static Logger logger = + Logger.getLogger(VerticalProfileVectorOutputState.class); + + public static final String[] RESULT_COLUMNS = { + "YORDINATE", "XORDINATE", + "GROUP1", "GROUP2", "GROUP3", + "DATAID", "FEATUREID", "TIMESERIESID", + "SERIES" + }; + + + public static final String[] ODV_COLUMN_HEADERS = { + "Cruise", + "Station", + "Type", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", + "Bot. Depth [m]", + "Depth [m]", + "QF", + "XComponent", + "QF", + "YComponent", + "QF", + "ZComponent", + "QF", + "Speed", + "QF", + "Direction", + "QF" + }; + + public static final String[] ODV_PROFILE_NAMES = { + "CRUISE", + "STATION", + "TYPE", + "TIMEVALUE", + "SHAPE", + "BOTDEPTH", + "DEPTH", + "QF", + "XCOMPONENT", + "QF", + "YCOMPONENT", + "QF", + "ZCOMPONENT", + "QF", + "SPEED", + "QF", + "DIRECTION", + "QF"}; + + + @Override + protected Object getChartResult(String uuid, CallContext callContext) { + logger.debug("Fetch chart data for vertical profile with vector data."); + CacheFactory factory = CacheFactory.getInstance(); + + if (factory.isInitialized()) { + // we use a cache + logger.info("Using cache."); + Cache cache = factory.getCache(); + String key = "chart_" + getHash(); + + net.sf.ehcache.Element value = cache.get(key); + if (value != null) { + logger.debug("Found element in cache."); + return value.getObjectValue(); + } + else { + logger.debug("Element not in cache, we ask the database"); + Collection<Result> res = (Collection<Result>)getData(queryID); + logger.debug("Got " + res.size() + " elements from db."); + + res = VectorDataProcessor.process(res, RESULT_COLUMNS); + cache.put(new net.sf.ehcache.Element(key, res)); + + return res; + } + } + else { + // we don't use a cache, so we have to query the database every + // single time + logger.info("Not using a cache."); + return VectorDataProcessor.process( + getData(queryID), RESULT_COLUMNS); + } + } + + + @Override + protected Chart getChart( + ChartLabels chartLables, + ChartTheme theme, + Collection parameters, + Collection measurements, + Collection dates, + Object result, + Locale locale, + String uuid, + boolean linesVisible, + boolean shapesVisible, + CallContext callContext + ) { + Chart chart = new VerticalProfileVectorChart( + chartLables, + theme, + parameters, + measurements, + dates, + (Collection)result, + timeGapDefinitions, + locale, + linesVisible, + shapesVisible + ); + chart.generateChart(); + + return chart; + } + + + @Override + protected Chart[] getHistograms( + String uuid, + CallContext callContext, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates, + Map requestParameter + ) { + Collection results = (Collection) getChartResult(uuid, callContext); + ChartTheme theme = createStyle(callContext); + + return VectorDataProcessor.getHistograms( + uuid, callContext, results, theme, requestParameter); + } + + + @Override + protected void createODV( + OutputStream outputStream, Collection result, String uuid) + throws IOException, StateException + { + logger.info("Start exporting " + result.size() + " items to odv."); + Export export = new DefaultExport( + new SimpleOdvDataCollector(ODV_PROFILE_NAMES)); + + Profile profile = new DefaultProfile( + ODV_COLUMN_HEADERS, + '\t', + CSVWriter.NO_QUOTE_CHARACTER, + CSVWriter.NO_ESCAPE_CHARACTER, + "ODV", + "ISO-8859-1"); + + export.create(profile, outputStream, result); + } + + + protected Statistics getStatisticsGenerator() { + return new VerticalProfileVectorStatistics(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +State classes used by artifacts representing 'Vertikalprofile' to handle input +and output. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state.profile.verticalcrosssection; import de.intevation.gnv.jfreechart.CompactXYItems; @@ -10,7 +18,7 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class OutputHelper { @@ -21,6 +29,16 @@ private OutputHelper() { } + + /** + * Creates a PolygonSeries representing the seabed used to be displayed in a + * 2D-chart. + * + * @param interpolation The interpolation which supports information about + * the max depth, the cell width and height. + * @param fill The fill color as integer. + * @return a PolygonSeries representing the seabed. + */ public static PolygonSeries createSeabedPolygon( Interpolation3D interpolation, Integer fill
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,72 +1,21 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state.profile.verticalcrosssection; -import com.vividsolutions.jts.geom.Coordinate; - -import de.intevation.artifacts.CallContext; - -import de.intevation.gnv.artifacts.cache.CacheFactory; - -import de.intevation.gnv.artifacts.context.GNVArtifactContext; - -import de.intevation.gnv.artifacts.ressource.RessourceFactory; - -import de.intevation.gnv.chart.Chart; -import de.intevation.gnv.chart.ChartLabels; -import de.intevation.gnv.chart.VerticalCrossSectionChart; - -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.geobackend.base.ResultDescriptor; - -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.geobackend.sde.datasources.RasterObject; - -import de.intevation.gnv.jfreechart.PolygonDataset; -import de.intevation.gnv.jfreechart.PolygonSeries; - -import de.intevation.gnv.math.AttributedXYColumns; -import de.intevation.gnv.math.HeightValue; -import de.intevation.gnv.math.IJKey; -import de.intevation.gnv.math.Interpolation3D; -import de.intevation.gnv.math.LinearMetrics; -import de.intevation.gnv.math.QueriedXYDepth; -import de.intevation.gnv.math.XYColumn; - -import de.intevation.gnv.raster.Filter; -import de.intevation.gnv.raster.IsoAttributeGenerator; -import de.intevation.gnv.raster.IsoPolygonSeriesProducer; -import de.intevation.gnv.raster.Palette; -import de.intevation.gnv.raster.PaletteManager; -import de.intevation.gnv.raster.PolygonDatasetProducer; -import de.intevation.gnv.raster.Raster; -import de.intevation.gnv.raster.Vectorizer; - -import de.intevation.gnv.state.InputData; - -import de.intevation.gnv.state.describedata.KeyValueDescibeData; - -import de.intevation.gnv.state.exception.StateException; - -import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; - -import de.intevation.gnv.statistics.Statistics; -import de.intevation.gnv.statistics.VerticalCrossSectionStatistics; - -import de.intevation.gnv.utils.DistanceCalculator; -import de.intevation.gnv.utils.StringUtils; -import de.intevation.gnv.utils.WKTUtils; +import au.com.bytecode.opencsv.CSVWriter; import java.awt.Color; import java.awt.Dimension; import java.awt.Paint; - import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -80,13 +29,57 @@ import net.sf.ehcache.Element; import org.apache.log4j.Logger; - import org.jfree.chart.ChartTheme; +import com.vividsolutions.jts.geom.Coordinate; + +import de.intevation.artifacts.CallContext; +import de.intevation.gnv.artifacts.cache.CacheFactory; +import de.intevation.gnv.artifacts.context.GNVArtifactContext; +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.VerticalCrossSectionChart; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.VerticalCrossODVExport; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; +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.geobackend.sde.datasources.RasterObject; +import de.intevation.gnv.jfreechart.PolygonDataset; +import de.intevation.gnv.jfreechart.PolygonSeries; +import de.intevation.gnv.math.AttributedXYColumns; +import de.intevation.gnv.math.HeightValue; +import de.intevation.gnv.math.IJKey; +import de.intevation.gnv.math.Interpolation3D; +import de.intevation.gnv.math.LinearMetrics; +import de.intevation.gnv.math.QueriedXYDepth; +import de.intevation.gnv.math.XYColumn; +import de.intevation.gnv.raster.Filter; +import de.intevation.gnv.raster.IsoAttributeGenerator; +import de.intevation.gnv.raster.IsoPolygonSeriesProducer; +import de.intevation.gnv.raster.Palette; +import de.intevation.gnv.raster.PaletteManager; +import de.intevation.gnv.raster.PolygonDatasetProducer; +import de.intevation.gnv.raster.Raster; +import de.intevation.gnv.raster.Vectorizer; +import de.intevation.gnv.state.InputData; +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.statistics.VerticalCrossSectionStatistics; +import de.intevation.gnv.utils.DistanceCalculator; +import de.intevation.gnv.utils.StringUtils; +import de.intevation.gnv.utils.WKTUtils; + /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class VerticalCrossSectionOutputState extends TimeSeriesOutputState { @@ -131,7 +124,7 @@ public void initialize(String uuid, CallContext callContext) throws StateException { super.initialize(uuid, callContext); - + getChartResult(uuid, callContext); } @@ -177,7 +170,7 @@ CacheFactory factory = CacheFactory.getInstance(); if (factory.isInitialized()) { - log.info("Using a cachce."); + log.info("Using a cachce - key: " + key); Cache cache = factory.getCache(); Element element = cache.get(key); @@ -197,10 +190,17 @@ } + /** + * Retrieves the data used to create a VerticalCrossProfileChart. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @return the data used to create a VerticalCrossProfileChart. + */ protected Object getData(String uuid, CallContext callContext) { Collection<Result> result = null; - InputData meshLine = inputData.get("mesh_linestring"); InputData meshId = inputData.get("meshid"); + String meshLine = getLineString(); if (meshLine == null) { log.error("mesh_linestring is not defined"); @@ -213,7 +213,7 @@ } Coordinate [] coords = WKTUtils.toCoordinates( - meshLine.getValue()); + meshLine); if (coords == null) { throw new IllegalStateException("cannot read coordinates"); @@ -251,6 +251,14 @@ } + protected String getLineString() { + InputData meshLine = inputData.get("mesh_linestring"); + + return meshLine != null ? meshLine.getValue() : null; + } + + + @Override protected String getSelectedInputDataName(String uuid, String id) { Collection values = getCollection(id, uuid); @@ -269,7 +277,7 @@ } private static int getGroundInterpolation(CallContext callContext) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); String interpolation = (String)context.get( @@ -279,7 +287,7 @@ } private static Dimension getRasterSize(CallContext callContext) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); Dimension size = (Dimension)context.get( GNVArtifactContext.VERTICAL_CROSS_SECTION_SAMPLES_KEY); @@ -291,7 +299,7 @@ private static List<Filter.Factory> getFilterFactories( CallContext callContext ) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); List<Filter.Factory> factories = (List<Filter.Factory>)context.get( GNVArtifactContext.VERTICAL_CROSS_SECTION_FILTER_FACTORIES_KEY); @@ -303,7 +311,7 @@ private static Map<Integer, PaletteManager> getPalettes( CallContext callContext ) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); Map<Integer, PaletteManager> palettes = (Map<Integer, PaletteManager>)context.get( @@ -314,7 +322,7 @@ } private static Paint getGroundFill(CallContext callContext) { - GNVArtifactContext context = + GNVArtifactContext context = (GNVArtifactContext)callContext.globalContext(); Paint fill = (Paint)context.get( GNVArtifactContext.VERTICAL_CROSS_SECTION_GROUND_FILL_KEY); @@ -325,6 +333,16 @@ public static final double EPSILON = 1e-5d; + + /** + * Finalize the data used for chart generation. Isolines are added, colors + * are assigned to polygons and the seabed is added. + * + * @param path The path which have been inserted while parameterization. + * @param columns The data used to be displayed in a 2D chart. + * @param callContext The CallContext object. + * @return the finalized data ready for chart generation. + */ protected Object process( List<Coordinate> path, AttributedXYColumns columns, @@ -460,7 +478,7 @@ .process(ipsp); IsoAttributeGenerator iag = new IsoAttributeGenerator(isoPalette); - Collection<PolygonSeries> ps = ipsp.getSeries(iag); + Collection<PolygonSeries> ps = ipsp.getSeries(iag); ipsp.clear(); if (debug) { @@ -477,6 +495,13 @@ } + /** + * Pre-process the data returned by database query. The resulting data is + * not ready for chart creation! + * + * @param results Data returned by database. + * @return Pre-processed data which is not ready for chart creation yet. + */ protected AttributedXYColumns preProcess(Collection results) { AttributedXYColumns attColumns = new AttributedXYColumns(); @@ -542,6 +567,26 @@ } + /** + * This <code>getChart</code> method returns a 2D VerticalCrossSectionChart + * displaying polygon data with isolines and a legend describing the colors + * used in that chart. + * + * @param chartLables Labels used to decorate the chart. + * @param theme The theme used to adjust the look of the chart. + * @param parameters A collection with parameters this chart contains. + * @param measurements A collection with measurement this chart contains. + * @param dates A collection with dates this chart contains. + * @param result The data collection used to be displayed in this chart. + * @param locale The Locale used to determine the language. + * @param uuid The uuid of the current artifact. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two points in a chart (not used in this chart type). + * @param shapesVisible A boolean property to determine the visiblity of + * datapoints in this chart (not used in this chart type). + * @param callContext The CallContext object. + * @return a 2D chart representing the data as polygons. + */ @Override protected Chart getChart( ChartLabels chartLables, @@ -614,25 +659,95 @@ return chart; } - /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator() - */ + @Override protected Statistics getStatisticsGenerator() { return new VerticalCrossSectionStatistics(); } /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#createCSV(java.io.OutputStream, java.util.Collection) + * Nothing happens here. <b>This method should never be called</b> until + * there is a wise implementation of a csv representation of the polygon + * data. + * + * @param outputStream The output stream used to write the csv file to. + * @param chartResult The data used to be written to csv file. + * @throws UnsupportedEncodingException if the encoding is not supported. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while csv file creation. */ @Override protected void createCSV( OutputStream outputStream, Collection<Result> chartResult ) - throws UnsupportedEncodingException, IOException, StateException + throws UnsupportedEncodingException, IOException, StateException { // TODO: Implement a substitution which makes sense. } + + @Override + protected void createODV( + OutputStream outputStream, + String uuid, + CallContext callContext) + throws IOException, StateException + { + // 'Profilschnitte' contain one parameter only + Collection tmp = getParameters(uuid); + KeyValueDescibeData param = (KeyValueDescibeData) tmp.toArray()[0]; + + String [] COLUMN_HEADER = { + "Cruise", + "Station", + "Type", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", + "Bot. Depth [m]", + "Depth [m]", + "QF", + param.getValue() + }; + + Export.Profile ODV_PROFILE = new DefaultProfile( + COLUMN_HEADER, + '\t', + CSVWriter.NO_QUOTE_CHARACTER, + CSVWriter.NO_ESCAPE_CHARACTER, + "ODV", + "ISO-8859-1"); + + Object chartResult = getChartResult(uuid, callContext); + + if (chartResult == null) { + log.error("No data for export found."); + return; + } + + List result = new ArrayList(1); + result.add(chartResult); + + InputData data = inputData.get(dateValueName); + String date = data.getDescription()[0]; + + Interpolation3D interpol = ((AttributedXYColumns) + chartResult).getInterpolation(); + + Coordinate[] coords = interpol.getCoordinates(); + double[] depth = interpol.getDepths(); + double[] raster = interpol.getRaster(); + + Export export = new VerticalCrossODVExport( + interpol.getCoordinates(), + interpol.getCellHeight(), + interpol.getCellWidth(), + interpol.getRaster(), + date, + interpol.getWidth(), + interpol.getHeight()); + + export.create(ODV_PROFILE, outputStream, null); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.profile.verticalcrosssection; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.impl.CoordinateArraySequenceFactory; + +import com.vividsolutions.jts.io.WKTWriter; + +import de.intevation.gnv.artifacts.ressource.RessourceFactory; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +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.InputData; + +import de.intevation.gnv.utils.WKTUtils; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Locale; + +import org.apache.log4j.Logger; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class VerticalCrossSectionParallelOutputState +extends VerticalCrossSectionOutputState +{ + public static final String QUERY_LINESTRING = + "verticalcrosssection_mesh_parallel_linestring"; + + private static Logger logger = + Logger.getLogger(VerticalCrossSectionParallelOutputState.class); + + @Override + protected String getLineString() { + Coordinate[] coordinates = null; + + try { + String[] filters = generateFilterValues(); + + QueryExecutor exec = QueryExecutorFactory + .getInstance() + .getQueryExecutor(); + + Collection results = exec.executeQuery(QUERY_LINESTRING, filters); + Iterator iter = results.iterator(); + + coordinates = new Coordinate[results.size()]; + int sIdx = -1; + int idx = 0; + + while (iter.hasNext()) { + Result result = (Result) iter.next(); + + if (sIdx == -1) { + ResultDescriptor rd = result.getResultDescriptor(); + sIdx = rd.getColumnIndex("SHAPE"); + } + + logger.debug(result.getString(sIdx)); + Coordinate c = WKTUtils.toCoordinate(result.getString(sIdx)); + + coordinates[idx++] = c; + } + } + catch (QueryException qe) { + logger.error(qe, qe); + } + + CoordinateArraySequenceFactory factory = + CoordinateArraySequenceFactory.instance(); + + if (coordinates == null) + return null; + + CoordinateSequence seq = factory.create(coordinates); + return seq != null ? WKTWriter.toLineString(seq) : null; + } + + + protected String[] generateFilterValues() { + String[] filters = new String[7]; + + InputData parameterid = inputData.get("parameterid"); + InputData timevalue = inputData.get("dateid"); + InputData meshid = inputData.get("meshid"); + InputData axisid = inputData.get("axisid"); + InputData meshpoint = inputData.get("mesh_point"); + + filters[0] = parameterid.getValue(); + filters[1] = "to_date('" + timevalue.getValue() + "', 'YYYY.MM.DD HH24:MI:SS')"; + filters[2] = meshid.getValue(); + filters[3] = meshid.getValue(); + filters[4] = axisid.getValue(); + filters[5] = axisid.getValue(); + filters[6] = meshpoint.getValue(); + + return filters; + } + + + @Override + protected String createChartSubtitle(Locale locale, String uuid) { + String subtitle = super.createChartSubtitle(locale, uuid); + + InputData data = inputData.get("mesh_point"); + if (data == null) + return subtitle; + + RessourceFactory factory = RessourceFactory.getInstance(); + String coordinate = factory.getRessource( + locale, "coordinate", "coordinate"); + + subtitle += "\n" + coordinate + ": "; + subtitle += data.getDescription(data.getValue()); + + return subtitle; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +State classes used by artifacts representing 'Profilschnitte' to handle input and +output. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,68 +1,24 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.state.timeseries; -import au.com.bytecode.opencsv.CSVWriter; - -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; - -import de.intevation.artifacts.ArtifactNamespaceContext; -import de.intevation.artifacts.CallContext; -import de.intevation.artifacts.CallMeta; - -import de.intevation.gnv.artifacts.context.GNVArtifactContext; - -import de.intevation.gnv.artifacts.ressource.RessourceFactory; - -import de.intevation.gnv.chart.Chart; -import de.intevation.gnv.chart.ChartLabels; -import de.intevation.gnv.chart.DefaultHistogram; -import de.intevation.gnv.chart.TimeSeriesChart; -import de.intevation.gnv.chart.XMLChartTheme; - -import de.intevation.gnv.chart.exception.TechnicalChartException; - -import de.intevation.gnv.exports.ChartExportHelper; -import de.intevation.gnv.exports.DefaultDataCollector; -import de.intevation.gnv.exports.DefaultExport; -import de.intevation.gnv.exports.DefaultProfile; - -import de.intevation.gnv.exports.Export.Profile; - -import de.intevation.gnv.exports.SimpleOdvDataCollector; - -import de.intevation.gnv.geobackend.base.Result; - -import de.intevation.gnv.histogram.HistogramHelper; - -import de.intevation.gnv.state.InputData; -import de.intevation.gnv.state.OutputStateBase; - -import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; -import de.intevation.gnv.state.describedata.KeyValueDescibeData; -import de.intevation.gnv.state.describedata.NamedArrayList; -import de.intevation.gnv.state.describedata.NamedCollection; - -import de.intevation.gnv.state.exception.StateException; - -import de.intevation.gnv.statistics.Statistic; -import de.intevation.gnv.statistics.StatisticSet; -import de.intevation.gnv.statistics.Statistics; -import de.intevation.gnv.statistics.TimeseriesStatistics; - -import de.intevation.gnv.statistics.exception.StatisticsException; - -import de.intevation.gnv.timeseries.gap.DefaultTimeGap; -import de.intevation.gnv.timeseries.gap.TimeGap; - -import de.intevation.gnv.utils.ArtifactXMLUtilities; - -import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.text.DateFormat; +import java.text.NumberFormat; +import java.text.ParseException; + import java.util.ArrayList; import java.util.Collection; +import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -71,26 +27,74 @@ import java.util.Vector; import org.apache.log4j.Logger; - import org.jfree.chart.ChartTheme; - import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import au.com.bytecode.opencsv.CSVWriter; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.artifacts.ArtifactNamespaceContext; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.gnv.artifacts.context.GNVArtifactContext; +import de.intevation.gnv.artifacts.ressource.RessourceFactory; +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.DefaultHistogram; +import de.intevation.gnv.chart.TimeSeriesChart; +import de.intevation.gnv.chart.XMLChartTheme; +import de.intevation.gnv.chart.exception.TechnicalChartException; +import de.intevation.gnv.exports.ChartExportHelper; +import de.intevation.gnv.exports.DefaultDataCollector; +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.ODVExport; +import de.intevation.gnv.exports.SimpleOdvDataCollector; +import de.intevation.gnv.exports.Export.Profile; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.histogram.HistogramHelper; +import de.intevation.gnv.state.InputData; +import de.intevation.gnv.state.OutputStateBase; +import de.intevation.gnv.state.State; +import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.describedata.MinMaxDescribeData; +import de.intevation.gnv.state.describedata.NamedArrayList; +import de.intevation.gnv.state.describedata.NamedCollection; +import de.intevation.gnv.state.exception.StateException; +import de.intevation.gnv.statistics.Statistic; +import de.intevation.gnv.statistics.StatisticSet; +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.statistics.TimeseriesStatistics; +import de.intevation.gnv.statistics.exception.StatisticsException; +import de.intevation.gnv.timeseries.gap.DefaultTimeGap; +import de.intevation.gnv.timeseries.gap.TimeGap; +import de.intevation.gnv.utils.ArtifactXMLUtilities; + /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class TimeSeriesOutputState extends OutputStateBase { + /** + * A boolean property to enable caching of charts after they have been + * created. This property can be adjusted via system property 'cache.chart'. + * 'true' of 'false' are valid options - defaults to 'false'.<br> + * <b>NOTE:</b> If chart caching is enabled, charts aren't sensible to + * changes in the parameterization anymore, after a first chart has been + * created for an artifact. + */ protected static final boolean CACHE_CHART = Boolean.parseBoolean(System.getProperty("cache.chart", "false")); - protected static final boolean PDF_FORMAT_LANDSCAPE = - Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true")); - + /** + * Supported image export formats. + */ protected static final String[] IMG_EXPORT_FORMAT = { "PNG", "JPEG", "GIF" }; @@ -106,15 +110,23 @@ private static Logger log = Logger .getLogger(TimeSeriesOutputState.class); - private static List<TimeGap> timeGapDefinitions = null; + protected List<TimeGap> timeGapDefinitions = null; + /** + * Key in resource bundle the x-axis title is stored. + */ protected String domainLable = "chart.timeseries.title.xaxis"; protected String featureValuesName = "featureid"; protected String parameterValuesName = "parameterid"; protected String measuremenValueName = "measurementid"; protected String dateValueName = "dateid"; + protected String timeIntervalValueName = "timeinterval"; + + /** + * Array used to specify the columns used in csv exports. + */ public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = { "XORDINATE", "YORDINATE", @@ -124,6 +136,9 @@ }; + /** + * Column labels used in csv exports. + */ public static final String [] TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL = { "Date/Time", "Value", @@ -132,6 +147,10 @@ "TimeseriesID" }; + + /** + * Array used to specify the column in csv exports on meshes. + */ public static final String [] TIMESERIES_MESH_CSV_COLUMN_LABEL = { "Date/Time", "Value", @@ -140,35 +159,40 @@ "MeshID" }; + + /** + * Array used to specify the columns in odv exports. + */ public static final String [] TIMESERIES_ODV_PROFILE_NAMES = { "CRUISE", "STATION", "TYPE", + "TIMEVALUE", "SHAPE", "BOTDEPTH", "DEPTH", - "TIMEVALUE", - "DATAVALUE", - "PARAMETER" + "QF" }; + /** + * Column labels used in odv exports. + */ public static final String [] ODV_COLUMN_HEADER = { "Cruise", "Station", "Type", - "Longitude [deegrees_east]", - "Latitude [deegrees_north]", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", "Bot. Depth [m]", "Depth [m]", - "Date/Time", - "Value", - "Parameterid" + "QF" }; + /** * Profile for exporting data to odv - * TODO Change TIMESERIES_PROFILE_NAMES, which belong to CSV exports */ public static final Profile TIMESERIES_ODV_PROFILE = new DefaultProfile( @@ -179,6 +203,7 @@ "ODV", "ISO-8859-1"); + /** * Constructor */ @@ -187,6 +212,16 @@ } + /** + * Calls <code>getChartResult</code> which puts the data used for chart + * creation into cache. This redruces waiting periods after selecting an + * output type. + * + * @param uuid The UUID of the current artifact. + * @param context The CallContext object. + * @throws StateException if an error occured while fetching the data used + * for chart creation. + */ @Override public void initialize(String uuid, CallContext context) throws StateException @@ -196,9 +231,39 @@ /** - * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, - * java.util.Collection, java.io.OutputStream, java.lang.String, - * de.intevation.artifacts.CallMeta) + * This out target has following modes:<br> + * <ol> + * <li>chart: Creates a chart displaying the data corresponding to the + * current parameterization. A chart has following export modes:<br> + * <ol> + * <li>img: Image representation of a chart.</li> + * <li>pdf: PDF representation of a chart.</li> + * <li>svg: SVG representation of a chart.</li> + * </ol> + * All selected parameters are drawn into a single chart.<br> + * </li> + * <li>histogram: Creates a histogram displaying the data corresponding to + * the current parameterization. A histogram has following export modes:<br> + * <ol> + * <li>img: Image representation of a histogram.</li> + * <li>pdf: PDF representation of a histogram.</li> + * <li>svg: SVG representation of a histogram.</li> + * </ol> + * A single histogram is created for each selected parameter.<br> + * </li> + * <li>statistic: Creates a statistic with important figures.</li> + * <li>csv: Creates a csv file.</li> + * <li>odv: Creates a odv file.</li> + * </ol> + * + * @param format Document which contains some export specific information. + * @param inputData Contains some meta information to adjust the export + * (e.g. width and height of a chart). + * @param outputStream The output stream used to return the export. + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @throws StateException if an error occured while creating the export + * object. */ public void out( Document format, @@ -257,8 +322,11 @@ } } } catch (NumberFormatException e) { - log.error(e, e); - throw new StateException(e); + log.warn(e, e); + XMLUtils.toStream( + feedFailure("not.a.number"), + outputStream); + return; } try { @@ -306,6 +374,12 @@ ); } else if (mode.equalsIgnoreCase("pdf")) { + callContext.putContextValue("chart.width", chartWidth); + callContext.putContextValue("chart.height", chartHeight); + callContext.putContextValue("shapes.visible", sVisible); + callContext.putContextValue("lines.visible", lVisible); + callContext.putContextValue("locale", locale); + createPDF( outputStream, parameters, @@ -314,10 +388,6 @@ chartLables, uuid, "A4", - true, - lVisible, - sVisible, - locale, callContext ); } @@ -340,24 +410,15 @@ } // HISTOGRAM else if (outputMode.equalsIgnoreCase("histogram")) { - Collection results = (Collection) getChartResult(uuid, callContext); requestParameter.put("locale", locale); - Object[][] data = HistogramHelper.prepareHistogramData( - results, parameters, measurements, dates); - - int size = data.length; - Chart[] histograms = new Chart[size]; - - for (int i = 0; i < size; i++) { - ChartLabels labels = createHistogramLabels( - uuid, callContext, data[i]); - - ChartTheme theme = createStyle(callContext); - - histograms[i] = new DefaultHistogram( - labels, data[i], theme, requestParameter); - } + Chart[] histograms = getHistograms( + uuid, + callContext, + parameters, + measurements, + dates, + requestParameter); if (mode.equalsIgnoreCase("img")) { ChartExportHelper.exportHistograms( @@ -369,12 +430,15 @@ ); } else if (mode.equalsIgnoreCase("pdf")) { + callContext.putContextValue("chart.width", chartWidth); + callContext.putContextValue("chart.height", chartHeight); + ChartExportHelper.exportHistogramsAsPDF( outputStream, histograms, "A4", - PDF_FORMAT_LANDSCAPE, - 50F, 50F, 50F, 50F + 50F, 50F, 50F, 50F, + callContext ); } else if (mode.equalsIgnoreCase("svg")) { @@ -414,14 +478,13 @@ statistics = new ArrayList<StatisticSet>(); } - Document doc = writeStatistics2XML(statistics); + Document doc = writeStatistics2XML(statistics, locale); XMLUtils.toStream(doc, outputStream); } else if (outputMode.equalsIgnoreCase("odv")) { - Collection<Result> odvResult = this.getODVResult(uuid); - this.createODV(outputStream, odvResult); + createODV(outputStream, uuid, callContext); } } catch (IOException e) { log.error(e, e); @@ -436,6 +499,59 @@ } + protected Chart[] getHistograms( + String uuid, + CallContext callContext, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates, + Map requestParameter + ) { + Locale locale = (Locale) requestParameter.get("locale"); + + Collection results = (Collection) getChartResult(uuid, callContext); + ChartTheme theme = createStyle(callContext); + + Object[][] data = HistogramHelper.prepareHistogramData( + results, parameters, measurements, dates); + + int size = data.length; + Chart[] histograms = new Chart[size]; + + for (int i = 0; i < size; i++) { + ChartLabels labels = HistogramHelper.createHistogramLabels( + uuid, callContext, locale, data[i]); + + histograms[i] = new DefaultHistogram( + labels, data[i], theme, requestParameter); + } + + return histograms; + } + + /** + * @param outputStream + * @param uuid + * @throws IOException + * @throws StateException + */ + protected void createODV(OutputStream outputStream, + String uuid, + CallContext callContext) + throws IOException, + StateException { + Collection<Result> odvResult = this.getODVResult(uuid); + this.createODV(outputStream, odvResult,uuid); + } + + + /** + * Retrieves the export format (e.g. png, gif, jpeg). + * + * @param mime Export format specified by the incoming request. + * @return <i>mime</i> if it is supported - otherwise the first format in + * {@link #IMG_EXPORT_FORMAT}. + */ protected String getExportFormat(String mime) { for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) { if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0) @@ -447,6 +563,14 @@ } + /** + * Returns a collection containing all selected KeyValueDescibeData objects + * of <i>parameters</i>. + * + * @param parameters A collection with KeyValueDescibeData objects. + * @return a collection cleaned from unselected objects. + * @deprecated + */ protected Collection getCleanedParameters(Collection parameters) { Iterator iter = parameters.iterator(); Collection parameter = new Vector(parameters); @@ -460,11 +584,28 @@ } + /** + * Calls {@link #getCleanedParameters(java.util.Collection)} with the + * collection returned by {@link #getParameters(java.lang.String)}. + * + * @param uuid The UUID of the current artifact. + * @return a cleaned collection. + */ protected Collection getCleanedParameters(String uuid) { return getCleanedParameters(getParameters(uuid)); } + /** + * Create a csv file representing the data corresponding to the current + * parameterization. + * + * @param out The output stream used to export the csv file. + * @param results The data used for csv file creation. + * @throws UnsupportedEncodingException if the encoding is not supported. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while creating the csv file. + */ protected void createCSV(OutputStream out, Collection<Result> results) throws UnsupportedEncodingException, IOException, StateException { @@ -506,13 +647,24 @@ /** - * TODO Result is not used at the moment. Change result with correct data. + * Create an odv file representing the data corresponding to the current + * parameterization. + * + * @param outputStream The output stream used to export the odv file. + * @param result The data used for odv file creation. + * @param uuid The UUID of the current artifact. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while creating the odv file. */ - protected void createODV(OutputStream outputStream, Collection result) + protected void createODV(OutputStream outputStream, + Collection result, + String uuid) throws IOException, StateException { - DefaultExport export = new DefaultExport(new SimpleOdvDataCollector( - TIMESERIES_ODV_PROFILE_NAMES)); + Export export = new ODVExport(new SimpleOdvDataCollector( + TIMESERIES_ODV_PROFILE_NAMES), + this.getParameters(uuid), + this.getStartTime()); if (result == null) log.error("#################### RESULT == NULL #################"); @@ -520,34 +672,69 @@ } /** - * @return + * Method that returns the Starttime of an TimeSeries or + * null if it is not a TimeSeries. + * @return the Starttime of an TimeSeries or null if it is not a TimeSeries. + */ + protected String getStartTime(){ + InputData data = inputData.get(this.timeIntervalValueName); + if (data != null){ + Object describeData = data.getObject(); + if (describeData instanceof MinMaxDescribeData){ + String value = ((MinMaxDescribeData)describeData) + .getMinValue().toString(); + return value.substring(0,value.lastIndexOf(':')); + } + return null; + }else{ + return null; + } + + } + + /** + * Returns the statistic generator. + * + * @return the statistic generator. */ protected Statistics getStatisticsGenerator() { Statistics s = new TimeseriesStatistics(); return s; } - protected Document writeStatistics2XML( Collection<StatisticSet> statistic) { + + /** + * Writes the statistic into an xml document. + * + * @param statistic Statistic to be written to xml document. + * @return the xml document containing the statistic. + */ + protected Document writeStatistics2XML( + Collection<StatisticSet> statistic, Locale locale) + { ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); Document doc = XMLUtils.newDocument(); + + NumberFormat format = NumberFormat.getInstance(locale); + if (statistic != null) { - Node statisticResults = xmlUtilities.createArtifactElement(doc, + Node statisticResults = ArtifactXMLUtilities.createArtifactElement(doc, "statistics"); doc.appendChild(statisticResults); Iterator<StatisticSet> it = statistic.iterator(); while (it.hasNext()) { StatisticSet set = it.next(); - Element setElement = xmlUtilities.createArtifactElement(doc, + Element setElement = ArtifactXMLUtilities.createArtifactElement(doc, "statistic"); setElement.setAttribute("name", set.getName()); - + Iterator<Statistic> sit = set.getStatistics().iterator(); while (sit.hasNext()){ Statistic s = sit.next(); - Element result = xmlUtilities.createArtifactElement(doc, + Element result = ArtifactXMLUtilities.createArtifactElement(doc, "statistic-value"); result.setAttribute("name", s.getKey()); - result.setAttribute("value", s.getStringValue()); + result.setAttribute("value", format.format(s.getValue())); setElement.appendChild(result); } statisticResults.appendChild(setElement); @@ -558,6 +745,12 @@ } + /** + * Returns the name of the selected feature. + * + * @param uuid The UUID of the current artifact. + * @return the name of the selectef feature. + */ protected String getSelectedFeatureName(String uuid) { Collection values = getCollection(featureValuesName, uuid); @@ -576,14 +769,26 @@ /** - * @param outputStream - * @param parameters - * @param measurements - * @param timeSeriesName - * @param chartStyle - * @param chartLables - * @throws IOException - * @throws TechnicalChartException + * Creates a chart and writes it to <i>outputStream</i>. + * + * @param outputStream The stream used to write the chart to. + * @param parameters A collection with parameters. + * @param measurements A collection with measurements. + * @param dates A collection with dates. + * @param chartLables The labels used to decorate the chart. + * @param context The CallContext. + * @param uuid The UUID of the current artifact. + * @param exportFormat The format the chart used to be exported as. + * @param locale The Locale to specify the language. + * @param width The width of the chart. + * @param height The height of the chart. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two datapoins. + * @param shapesVisible A boolean property to determine the visibility of + * datapoints. + * @param callContext The CallContext object. + * @throws IOException if an error occured while writing to output stream. + * @throws TechnicalChartException if an error occured while chart creation. */ protected void createChart( OutputStream outputStream, @@ -638,6 +843,25 @@ } + /** + * Creates a chart and writes it as pdf to <i>outputStream</i>. + * + * @param outputStream The stream used to write the chart to. + * @param parameters A collection with parameters. + * @param measurements A collection with measurements. + * @param dates A collection with dates. + * @param chartLables The labels used to decorate the chart. + * @param uuid The UUID of the current artifact. + * @param exportFormat The format the chart used to be exported as. + * @param landscape A boolean property to determine the alignment of the + * chart. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two datapoins. + * @param shapesVisible A boolean property to determine the visibility of + * datapoints. + * @param locale The Locale to specify the language. + * @param context The CallContext object. + */ protected void createPDF( OutputStream outputStream, Collection parameters, @@ -646,10 +870,6 @@ ChartLabels chartLables, String uuid, String exportFormat, - boolean landscape, - boolean linesVisible, - boolean shapesVisible, - Locale locale, CallContext context ) { Chart chart = getChart( @@ -659,10 +879,10 @@ measurements, dates, getChartResult(uuid, context), - locale, + (Locale) context.getContextValue("locale"), uuid, - linesVisible, - shapesVisible, + Boolean.TRUE.equals(context.getContextValue("lines.visible")), + Boolean.TRUE.equals(context.getContextValue("shapes.visible")), context ); @@ -675,12 +895,30 @@ outputStream, chart.generateChart(), "A4", - PDF_FORMAT_LANDSCAPE, - 50F, 50F, 50F, 50F + 50F, 50F, 50F, 50F, + context ); } + /** + * Creates a chart and writes it as svg to <i>outputStream</i>. + * + * @param outputStream The stream used to write the chart to. + * @param parameters A collection with parameters. + * @param measurements A collection with measurements. + * @param dates A collection with dates. + * @param chartLables The labels used to decorate the chart. + * @param uuid The UUID of the current artifact. + * @param locale The Locale to specify the language. + * @param width The width of the chart. + * @param height The height of the chart. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two datapoins. + * @param shapesVisible A boolean property to determine the visibility of + * datapoints. + * @param callContext The CallContext object. + */ protected void createSVG( OutputStream outputStream, Collection parameters, @@ -718,13 +956,33 @@ outputStream, chart.generateChart(), null, - 600, 400 + width, height ); log.debug("svg export finished."); } + /** + * This method creates a chart and returns it. In normal case, this is the + * only method to be overriden by subclasses to create other types of + * charts. + * + * @param chartLables Labels used to decorate the chart. + * @param theme The theme used to adjust the look of the chart. + * @param parameters A collection with parameters this chart contains. + * @param measurements A collection with measurement this chart contains. + * @param dates A collection with dates this chart contains. + * @param result The data collection used to be displayed in this chart. + * @param locale The Locale used to determine the language. + * @param uuid The uuid of the current artifact. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two points in a chart (not used in this chart type). + * @param shapesVisible A boolean property to determine the visiblity of + * datapoints in this chart (not used in this chart type). + * @param callContext The CallContext object. + * @return a timeseries chart. + */ protected Chart getChart( ChartLabels chartLables, ChartTheme theme, @@ -771,6 +1029,13 @@ return chart; } + + /** + * Fetches the ChartTheme from <i>callContext</i> and returns it. + * + * @param callContext CallContext objects storing a chart theme. + * @return a chart theme. + */ protected ChartTheme createStyle(CallContext callContext) { log.debug("Fetch chart theme from global context"); @@ -783,6 +1048,14 @@ return theme; } + /** + * Creates a ChartLabels object storing different labels used to decorate a + * chart. + * + * @param locale The Locale object to adjust the language of labels. + * @param uuid The UUID of the current artifact. + * @return the chart labels. + */ protected ChartLabels createChartLabels(Locale locale, String uuid) { return new ChartLabels( createChartTitle(locale, uuid), @@ -796,24 +1069,72 @@ } + /** + * Creates and returns the chart title. + * + * @param locale The Locale used to adjust the language of the title. + * @param uuid The UUID of the current artifact. + * @return the name of the selected fis. + */ protected String createChartTitle(Locale locale, String uuid) { return getFisName(locale); } + /** + * Creates and returns the subtitle of a chart. The subtitle in this class + * contains the station and the time interval. + * + * @param locale The Locale used to adjust the language of the subtitle. + * @param uuid The UUID of the current artifact. + * @return the selected feature. + */ protected String createChartSubtitle(Locale locale, String uuid) { - return getSelectedFeatureName(uuid); + String subtitle = ""; + subtitle += getSelectedFeatureName(uuid); + + InputData data = inputData.get(timeIntervalValueName); + if (data != null){ + Object describeData = data.getObject(); + if (describeData instanceof MinMaxDescribeData) { + MinMaxDescribeData tmp = (MinMaxDescribeData) describeData; + + DateFormat format = DateFormat.getDateTimeInstance( + DateFormat.MEDIUM, DateFormat.SHORT, locale); + + String lDateStr = (String) tmp.getMinValue(); + String rDateStr = (String) tmp.getMaxValue(); + + try { + Date lDate = srcFormat.parse(lDateStr); + Date rDate = srcFormat.parse(rDateStr); + + String interval = format.format(lDate); + interval += " - "; + interval += format.format(rDate); + + if (subtitle != null && subtitle.length() > 0) + subtitle += ", "; + + subtitle += interval; + } + catch (ParseException pe) { + log.error(pe, pe); + } + } + } + + return subtitle; } - protected ChartLabels createHistogramLabels( - String uuid, CallContext context, Object[] data) - { - return new ChartLabels((String) data[0], "", ""); - } - - + /** + * Returns the selected fis name. + * + * @param locale The Locale object used to adjust the language. + * @return the name of the fis. + */ protected String getFisName(Locale locale) { String returnValue = ""; InputData input = inputData.get("fisname"); @@ -831,6 +1152,14 @@ } + /** + * Returns the name of the selected object in the collection specified by + * <i>key</i>. + * + * @param uuid The UUID of the current artifat. + * @param key A key to specify a collection. + * @return the name of the selected item. + */ protected String getSelectedInputDataName(String uuid, String key) { Collection values = getCollection(key, uuid); @@ -849,13 +1178,32 @@ } + /** + * Returns a collection of selected parameters. + * + * @param uuid The UUID of the current artifact. + * @return selected parameters. + */ protected Collection<KeyValueDescibeData> getParameters(String uuid) { return this.getCollection(parameterValuesName, uuid); } + /** + * Returns a collection of selected measurements. + * + * @param uuid The UUID of the current artifact. + * @return selected measurements. + */ protected Collection<KeyValueDescibeData> getMeasurements(String uuid) { return this.getCollection(measuremenValueName, uuid); } + + /** + * Returns a collection of selected dates. + * + * @param uuid The UUID of the current artifact. + * @return selected dates. + */ protected Collection<KeyValueDescibeData> getDates(String uuid) { return this.getCollection(dateValueName,uuid); } @@ -878,7 +1226,12 @@ if (measurementNameValue != null) { this.measuremenValueName = measurementNameValue; } - + String timeIntervalValue = Config.getStringXPath(configuration, + "value-names/value-name[@name='timeinterval']/@value"); + if (timeIntervalValue != null){ + this.timeIntervalValueName = timeIntervalValue; + } + String dateNameValue = Config.getStringXPath(configuration, "value-names/value-name[@name='date']/@value"); if (dateNameValue != null) { @@ -895,8 +1248,8 @@ gapDefinition = (Element)new ArtifactXMLUtilities(). readConfiguration(absolutFileName); } - - NodeList gapDefinitions = Config.getNodeSetXPath(gapDefinition, + + NodeList gapDefinitions = Config.getNodeSetXPath(gapDefinition, "/time-gaps/time-gap"); if (gapDefinition != null){ timeGapDefinitions = new ArrayList<TimeGap>(gapDefinitions. @@ -907,8 +1260,8 @@ int key = Integer.parseInt(gapNode.getAttribute("key")); int value = Integer.parseInt(gapNode.getAttribute("gap")); log.info("Add new Timegap: "+key+" "+value+" "+ unit); - timeGapDefinitions.add(new DefaultTimeGap(unit, - key, + timeGapDefinitions.add(new DefaultTimeGap(unit, + key, value)); } } @@ -917,17 +1270,34 @@ } } + /** - * @param collectionName - * @return + * Creates a <code>NamedArrayList</code> storing some <code> + * KeyValueDescibeData</code> objects found in the input data with the key + * <i>collectionName</i>. + * + * @param collectionName String to specify the input data. + * @param uuid The UUID of the current artifact. + * @return a collection with values from input data. */ protected Collection<KeyValueDescibeData> getCollection( String collectionName, String uuid) { + log.debug("Search for input data: " + collectionName); NamedCollection<KeyValueDescibeData> c = new NamedArrayList<KeyValueDescibeData>(collectionName); - InputData data = inputData.get(collectionName); + InputData data = null; + State parent = this; + do { + data = parent.inputData().get(collectionName); + + if (data != null) { + break; + } + } + while ((parent = parent.getParent()) != null); + if (data == null) { log.warn("No collection found with name: " + collectionName); return c;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.state.timeseries; + +import au.com.bytecode.opencsv.CSVWriter; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.artifacts.cache.CacheFactory; + +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.TimeSeriesVectorChart; + +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.Export.Profile; +import de.intevation.gnv.exports.SimpleOdvDataCollector; + +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.utils.VectorDataProcessor; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; +import de.intevation.gnv.state.exception.StateException; + +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.statistics.TimeseriesVectorStatistics; + +import java.io.IOException; +import java.io.OutputStream; + +import java.util.Collection; +import java.util.Locale; +import java.util.Map; + +import net.sf.ehcache.Cache; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class TimeSeriesVectorOutputState extends TimeSeriesOutputState { + + private static Logger logger = + Logger.getLogger(TimeSeriesVectorOutputState.class); + + public static final String[] RESULT_COLUMNS = { + "YORDINATE", "XORDINATE", "GROUP1", "GROUP2", "GROUP3", "GAPID", "SERIES" + }; + + public static final String[] ODV_COLUMN_HEADERS = { + "Cruise", + "Station", + "Type", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", + "Bot. Depth [m]", + "Depth [m]", + "QF", + "XComponent", + "QF", + "YComponent", + "QF", + "ZComponent", + "QF", + "Speed", + "QF", + "Direction", + "QF" + }; + + public static final String[] ODV_PROFILE_NAMES = { + "CRUISE", + "STATION", + "TYPE", + "TIMEVALUE", + "SHAPE", + "BOTDEPTH", + "DEPTH", + "QF", + "XCOMPONENT", + "QF", + "YCOMPONENT", + "QF", + "ZCOMPONENT", + "QF", + "SPEED", + "QF", + "DIRECTION", + "QF"}; + + public TimeSeriesVectorOutputState() { + } + + + @Override + protected Object getChartResult(String uuid, CallContext callContext) { + logger.debug("OutputStateBase.getChartResult"); + CacheFactory factory = CacheFactory.getInstance(); + + if (factory.isInitialized()) { + // we use a cache + logger.info("Using cache."); + Cache cache = factory.getCache(); + String key = "chart_" + getHash(); + + net.sf.ehcache.Element value = cache.get(key); + if (value != null) { + logger.debug("Found element in cache."); + return value.getObjectValue(); + } + else { + logger.debug("Element not in cache, we ask the database"); + Collection<Result> res = (Collection<Result>)getData(queryID); + res = VectorDataProcessor.process(res, RESULT_COLUMNS); + cache.put(new net.sf.ehcache.Element(key, res)); + + return res; + } + } + else { + // we don't use a cache, so we have to query the database every + // single time + logger.info("Not using a cache."); + return VectorDataProcessor.process( + getData(queryID), RESULT_COLUMNS); + } + } + + + @Override + protected Chart getChart( + ChartLabels chartLables, + ChartTheme theme, + Collection parameters, + Collection measurements, + Collection dates, + Object result, + Locale locale, + String uuid, + boolean linesVisible, + boolean shapesVisible, + CallContext callContext + ) { + Chart chart = new TimeSeriesVectorChart( + chartLables, + theme, + parameters, + measurements, + dates, + (Collection)result, + timeGapDefinitions, + locale, + linesVisible, + shapesVisible + ); + chart.generateChart(); + + return chart; + } + + + @Override + protected Chart[] getHistograms( + String uuid, + CallContext callContext, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates, + Map requestParameter + ) { + Collection results = (Collection) getChartResult(uuid, callContext); + ChartTheme theme = createStyle(callContext); + + return VectorDataProcessor.getHistograms( + uuid, callContext, results, theme, requestParameter); + } + + + @Override + protected void createODV( + OutputStream outputStream, Collection result, String uuid) + throws IOException, StateException + { + logger.info("Start exporting " + result.size() + " items to odv."); + Export export = new DefaultExport( + new SimpleOdvDataCollector(ODV_PROFILE_NAMES)); + + Profile profile = new DefaultProfile( + ODV_COLUMN_HEADERS, + '\t', + CSVWriter.NO_QUOTE_CHARACTER, + CSVWriter.NO_ESCAPE_CHARACTER, + "ODV", + "ISO-8859-1"); + + export.create(profile, outputStream, result); + } + + + protected Statistics getStatisticsGenerator() { + return new TimeseriesVectorStatistics(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +State classes used by artifacts representing 'Zeitserien' to handle input and +output. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.statistics; import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; @@ -7,7 +15,11 @@ import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * An abstract implementation of <code>Statistics</code> with a default + * implementation of the {@link #generateStatisticsValues(org.apache.commons.math.stat.descriptive.DescriptiveStatistics, org.apache.commons.math.stat.regression.SimpleRegression, java.lang.String)} + * method. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public abstract class AbstractStatistics implements Statistics @@ -18,13 +30,22 @@ public AbstractStatistics() { } + /** + * This method takes a statistics object and puts relevant values into a + * <code>StatisticSet</code>. + * + * @param lStatistics A statistics object. + * @param lRegression A simple regression. + * @param statisticName Name for the resulting statistic. + * @return a set of statistics. + */ protected StatisticSet generateStatisticsValues( DescriptiveStatistics lStatistics, - SimpleRegression lRegression, + SimpleRegression lRegression, String statisticName ) { StatisticSet statisticSet = new StatisticSet(statisticName); - + statisticSet.addStatistic( new Statistic( "gnviewer.statistics.descriptive.arithmeticMean", @@ -32,7 +53,7 @@ statisticSet.addStatistic( new Statistic( - "gnviewer.statistics.descriptive.kurtosis", + "gnviewer.statistics.descriptive.kurtosis", lStatistics.getKurtosis())); statisticSet.addStatistic( @@ -82,7 +103,7 @@ statisticSet.addStatistic( new Statistic( - "gnviewer.statistics.descriptive.intercept", + "gnviewer.statistics.descriptive.intercept", lRegression.getIntercept())); statisticSet.addStatistic(
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.statistics; import java.sql.SQLException; @@ -17,19 +22,21 @@ import de.intevation.gnv.utils.DistanceCalculator; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This class is used to create a statistic for 'Horizontalprofil' products. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class HorizontalProfileStatistics extends TimeseriesStatistics { - + private static Logger log = Logger.getLogger(HorizontalProfileStatistics.class); private WKTReader wktReader = new WKTReader(); - + private DistanceCalculator dc = new DistanceCalculator(); - + private double distance = 0; - + /** * Constructor */ @@ -37,17 +44,15 @@ super(); } - /** - * @see de.intevation.gnv.statistics.TimeseriesStatistics#calculateXOrdinateValue(de.intevation.gnv.geobackend.base.Result, de.intevation.gnv.geobackend.base.Result) - */ + @Override protected double calculateXOrdinateValue(Result previousRow,Result row) throws SQLException { try { Point start = (Point)this.wktReader.read(previousRow.getString("SHAPE")); Point current = (Point)this.wktReader.read(row.getString("SHAPE")); - double delta = this.dc.calculateDistance(start, current); - + double delta = DistanceCalculator.calculateDistance(start, current); + if (!Double.isNaN(delta)){ this.distance = this.distance + delta; } @@ -57,9 +62,7 @@ return this.distance; } - /** - * @see de.intevation.gnv.statistics.TimeseriesStatistics#generateStatisticsName(java.lang.String, java.lang.String, java.lang.String, java.util.Collection, java.util.Collection, java.util.Collection) - */ + @Override protected String generateStatisticsName( String break1, @@ -68,14 +71,12 @@ Collection<KeyValueDescibeData> parameters, Collection<KeyValueDescibeData> measurements, Collection<KeyValueDescibeData> dates) { - return (this.findValueTitle(parameters, break1)+ " "+ + return (this.findValueTitle(parameters, break1)+ " "+ this.findValueTitle(measurements,break2)).trim()+" "+ this.findValueTitle(dates,break3); } - - /** - * @see de.intevation.gnv.statistics.TimeseriesStatistics#clearStatistics() - */ + + @Override protected void clearStatistics() { log.debug("HorizontalProfileStatistics.clearStatistics");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileVectorStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.statistics; + +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKTReader; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import de.intevation.gnv.utils.DistanceCalculator; + +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class HorizontalProfileVectorStatistics +extends VectorStatistics +{ + + private static Logger logger = + Logger.getLogger(HorizontalProfileVectorStatistics.class); + + private WKTReader wktReader = new WKTReader(); + + private double distance; + + + public HorizontalProfileVectorStatistics() { + distance = 0; + } + + + protected void clear() { + distance = 0; + } + + + protected int getValueIdx(ResultDescriptor rd) { + return rd.getColumnIndex("YORDINATE"); + } + + + protected double calculateXOrdinateValue(Result prev, Result row) + throws SQLException + { + try { + Point start = (Point) wktReader.read(prev.getString("SHAPE")); + Point current = (Point) wktReader.read(row.getString("SHAPE")); + + double delta = DistanceCalculator.calculateDistance(start, current); + + distance = !Double.isNaN(delta) ? distance + delta : distance; + } + catch (ParseException e) { + logger.error(e,e); + } + return distance; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,61 +1,81 @@ -/** - * Title: Statistic, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v 1.2 2007/12/21 12:31:15 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 14.12.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2007/12/21 12:31:15 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.statistics; - -import org.apache.log4j.Logger; - -/** - * The class <code>Statistic</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 14.12.2007 09:38:18 - */ -public class Statistic { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(Statistic.class); - private static boolean sDebug = sLogger.isDebugEnabled(); - - private double mValue; - private String mKey; - - public Statistic(String pKey, double pValue) { - mKey = pKey; - mValue = pValue; - } - - public double getValue() { - return mValue; - } - - public String getKey() { - return mKey; - } - - public String getStringValue() { - java.text.DecimalFormat df = new java.text.DecimalFormat("#.##"); - return df.format(mValue); - } - -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * Title: Statistic, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v 1.2 2007/12/21 12:31:15 blume Exp $ + * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v $ + * created by: Stefan Blume (blume) + * erstellt am: 14.12.2007 + * Copyright: con terra GmbH, 2005 + * + * modified by: $Author: blume $ + * modified on: $Date: 2007/12/21 12:31:15 $ + * Version: $Revision: 1.2 $ + * TAG: $Name: $ + * locked from: $Locker: $ + * CVS State: $State: Exp $ + * Project: $ProjectName$ + */ +package de.intevation.gnv.statistics; + +import org.apache.log4j.Logger; + +/** + * This class stores a double value with a specific key. + * + * @author blume + */ +public class Statistic { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(Statistic.class); + private static boolean sDebug = sLogger.isDebugEnabled(); + + private double mValue; + private String mKey; + + /** + * Creates a new Statistic with a given key and a value. + * @param pKey The key. + * @param pValue The value. + */ + public Statistic(String pKey, double pValue) { + mKey = pKey; + mValue = pValue; + } + + /** + * Returns the value. + * @return the value. + */ + public double getValue() { + return mValue; + } + + /** + * Returns the key. + * @return the key. + */ + public String getKey() { + return mKey; + } + + /** + * Turns the value into string representation and returns it.<br> + * <b>Attention:</b> This method doesn't take a locale into account. + * + * @return the value as string. + */ + public String getStringValue() { + java.text.DecimalFormat df = new java.text.DecimalFormat("#.##"); + return df.format(mValue); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,40 +1,60 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.statistics; import java.util.ArrayList; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * A container to store several statistics. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class StatisticSet { - + private String name = null; - + private Collection<Statistic> statistics = new ArrayList<Statistic>(); - + /** * Constructor + * @param name Name of this container. */ public StatisticSet(String name) { this.name = name; } - - + + + /** + * Add a further statistic to this container. + * + * @param statistic A statistic. + */ public void addStatistic(Statistic statistic){ this.statistics.add(statistic); } - + + /** + * Returns all statistics in this container. + * @return all statistics. + */ public Collection<Statistic> getStatistics(){ return this.statistics; } - + + /** + * Returns the name of this container. + * @return the name. + */ public String getName(){ return this.name; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,54 +1,59 @@ -/** - * Title: Statistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 14.12.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.statistics; - -import java.util.Collection; - -import de.intevation.gnv.state.describedata.KeyValueDescibeData; - -import de.intevation.gnv.statistics.exception.StatisticsException; - -/** - * The interface <code>Statistics</code> fulfills the following purposes: - * <ol> - * <li>Providng a marker interface for statistics.</li> - * </ol> - * - * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 14.12.2007 09:34:32 - */ -public interface Statistics { - - /** - * - * @param resultSet - * @param parameters - * @param measurements - * @param dates - * @return - * @throws StatisticsException - */ - public Collection<StatisticSet> calculateStatistics( - Object resultSet, - Collection<KeyValueDescibeData> parameters, - Collection<KeyValueDescibeData> measurements, - Collection<KeyValueDescibeData> dates - ) - throws StatisticsException; -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * Title: Statistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v 1.2 2008/01/30 12:38:34 blume Exp $ + * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v $ + * created by: Stefan Blume (blume) + * erstellt am: 14.12.2007 + * Copyright: con terra GmbH, 2005 + * + * modified by: $Author: blume $ + * modified on: $Date: 2008/01/30 12:38:34 $ + * Version: $Revision: 1.2 $ + * TAG: $Name: $ + * locked from: $Locker: $ + * CVS State: $State: Exp $ + * Project: $ProjectName$ + */ +package de.intevation.gnv.statistics; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + +import de.intevation.gnv.statistics.exception.StatisticsException; + +import java.util.Collection; + +/** + * This interface defines one single method to calculate a statistic for a + * given data set. + * + * @author blume + */ +public interface Statistics { + + /** + * This method takes a data set and creates a statistic from it. + * + * @param resultSet The resulting statistic is about this data set. + * @param parameters A collection of parameters. + * @param measurements A collection of measurements. + * @param dates A collection of dates. + * @return a collection of statistics. + * @throws StatisticsException if an error occured while creating the + * statistic. + */ + public Collection<StatisticSet> calculateStatistics( + Object resultSet, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates + ) + throws StatisticsException; +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,235 +1,234 @@ -/** - * Title: TimeseriesStatistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v 1.3 2008/08/18 14:50:33 drewnak Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 06.12.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: drewnak $ - * modified on: $Date: 2008/08/18 14:50:33 $ - * Version: $Revision: 1.3 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ - */ -package de.intevation.gnv.statistics; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; -import org.apache.commons.math.stat.regression.SimpleRegression; -import org.apache.log4j.Logger; - -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.geobackend.base.ResultDescriptor; -import de.intevation.gnv.state.describedata.KeyValueDescibeData; -import de.intevation.gnv.statistics.exception.StatisticsException; - -/** - * The class <code>TimeseriesStatistics</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> - * - * @author blume - * @author Tim Englich <tim.englich@intevation.de> - * @version 1.0 - * @serial 1.0 - * @see - * @since 06.12.2007 18:02:27 - */ -public class TimeseriesStatistics -extends AbstractStatistics -{ - - /** - * Default Logging instance - */ - private static Logger log = Logger.getLogger(TimeseriesStatistics.class); - - /** - * Constructor - */ - public TimeseriesStatistics() { - } - - /** - * @see de.intevation.gnv.statistics.Statistics#calculateStatistics(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection) - */ - public Collection<StatisticSet> calculateStatistics( - Object result, - Collection<KeyValueDescibeData> parameters, - Collection<KeyValueDescibeData> measurements, - Collection<KeyValueDescibeData> dates - ) - throws StatisticsException { - - if (!(result instanceof Collection)) { - return new ArrayList<StatisticSet>(); - } - - Collection<Result> resultSet = (Collection<Result>)result; - - clearStatistics(); - - DescriptiveStatistics lStatistics = null; - SimpleRegression lRegression = null; - Collection<StatisticSet> statisticSets = new ArrayList<StatisticSet>(); - String break1, break2, break3; - int lSeries = 1; - - if (resultSet == null) { - return statisticSets; - } - - int b1Idx = -1; - int b2Idx = -1; - int b3Idx = -1; - int yIdx = -1; - try { - - Iterator<Result> resultIterator = resultSet.iterator(); - if (resultIterator.hasNext()) { - Result row = resultIterator.next(); - Result previousRow = row; - - if (b1Idx == -1) { - ResultDescriptor rd = row.getResultDescriptor(); - b1Idx = rd.getColumnIndex("GROUP1"); - b2Idx = rd.getColumnIndex("GROUP2"); - b3Idx = rd.getColumnIndex("GROUP3"); - yIdx = rd.getColumnIndex("YORDINATE"); - - if (b1Idx == -1 || b2Idx == -1 || b3Idx == -1 || yIdx == -1) { - return statisticSets; - } - } - break1 = row.getString(b1Idx); - break2 = row.getString(b2Idx); - break3 = row.getString(b3Idx); - lRegression = new SimpleRegression(); - lStatistics = new DescriptiveStatistics(); - while (resultIterator.hasNext()) { - - if (!break1.equals(row.getString(b1Idx)) - || !break2.equals(row.getString(b2Idx)) - || !break3.equals(row.getString(b3Idx)) - ) { - String statisticsName = generateStatisticsName( - break1, break2, - break3, parameters, - measurements, dates); - - statisticSets.add( - generateStatisticsValues( - lStatistics, - lRegression, - statisticsName)); - - lStatistics.clear(); - lRegression.clear(); - - clearStatistics(); - - Double yValue = row.getDouble(yIdx); - - if (yValue != null) { - lStatistics.addValue(yValue); - Double x = calculateXOrdinateValue(previousRow,row); - lRegression.addData(x, yValue); - } - - break1 = row.getString(b1Idx); - break2 = row.getString(b2Idx); - break3 = row.getString(b3Idx); - previousRow = row; - row = resultIterator.next(); - lSeries++; - } else { - - Double value = row.getDouble(yIdx); - if (value != null) { - lStatistics.addValue(value.doubleValue()); - Double x = calculateXOrdinateValue(previousRow,row); - lRegression.addData(x, value.doubleValue()); - } - previousRow = row; - row = resultIterator.next(); - } - - } - - Double yValue = row.getDouble(yIdx); - - if (yValue != null) { - lStatistics.addValue(yValue); - Double x = calculateXOrdinateValue(previousRow, row); - lRegression.addData(x, yValue); - } - - String statisticsName = generateStatisticsName( - break1, break2, - break3, parameters, - measurements, dates); - - statisticSets.add(generateStatisticsValues( - lStatistics, - lRegression, - statisticsName)); - lStatistics.clear(); - lRegression.clear(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - - return statisticSets; - } - - protected void clearStatistics(){} - - /** - * - * @param break1 - * @param break2 - * @param break3 - * @param parameters - * @param measurements - * @param dates - * @return - */ - protected String generateStatisticsName(String break1, - String break2, - String break3, - Collection<KeyValueDescibeData> parameters, - Collection<KeyValueDescibeData> measurements, - Collection<KeyValueDescibeData> dates){ - log.debug("TimeseriesStatistics.generateStatisticsName"); - return this.findValueTitle(parameters,break1)+ " "+ - this.findValueTitle(measurements,break2) + "m"; - } - - - protected String findValueTitle(Collection<KeyValueDescibeData> values, - String id) { - log.debug("TimeseriesStatistics.findValueTitle "+ id); - if (values != null) { - Iterator<KeyValueDescibeData> it = values.iterator(); - while (it.hasNext()) { - KeyValueDescibeData data = it.next(); - if (id.equals(data.getKey())) { - return data.getValue(); - } - } - } - return ""; - } - protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException { - return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600); - } - -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * Title: TimeseriesStatistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v 1.3 2008/08/18 14:50:33 drewnak Exp $ + * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v $ + * created by: Stefan Blume (blume) + * erstellt am: 06.12.2007 + * Copyright: con terra GmbH, 2005 + * + * modified by: $Author: drewnak $ + * modified on: $Date: 2008/08/18 14:50:33 $ + * Version: $Revision: 1.3 $ + * TAG: $Name: $ + * locked from: $Locker: $ + * CVS State: $State: Exp $ + * Project: $ProjectName$ + */ +package de.intevation.gnv.statistics; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + +import de.intevation.gnv.statistics.exception.StatisticsException; + +import java.sql.SQLException; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; + +import org.apache.commons.math.stat.regression.SimpleRegression; + +import org.apache.log4j.Logger; + +/** + * This class is used to create a statistic in timeseries products. + * + * @author blume + */ +public class TimeseriesStatistics +extends AbstractStatistics +{ + + /** + * Default Logging instance + */ + private static Logger log = Logger.getLogger(TimeseriesStatistics.class); + + /** + * Constructor + */ + public TimeseriesStatistics() { + } + + + public Collection<StatisticSet> calculateStatistics( + Object result, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates + ) + throws StatisticsException { + + if (!(result instanceof Collection)) { + return new ArrayList<StatisticSet>(); + } + + Collection<Result> resultSet = (Collection<Result>)result; + + clearStatistics(); + + DescriptiveStatistics lStatistics = null; + SimpleRegression lRegression = null; + Collection<StatisticSet> statisticSets = new ArrayList<StatisticSet>(); + String break1, break2, break3; + int lSeries = 1; + + if (resultSet == null) { + return statisticSets; + } + + int b1Idx = -1; + int b2Idx = -1; + int b3Idx = -1; + int yIdx = -1; + try { + + Iterator<Result> resultIterator = resultSet.iterator(); + if (resultIterator.hasNext()) { + Result row = resultIterator.next(); + Result previousRow = row; + + if (b1Idx == -1) { + ResultDescriptor rd = row.getResultDescriptor(); + b1Idx = rd.getColumnIndex("GROUP1"); + b2Idx = rd.getColumnIndex("GROUP2"); + b3Idx = rd.getColumnIndex("GROUP3"); + yIdx = rd.getColumnIndex("YORDINATE"); + + if (b1Idx == -1 || b2Idx == -1 || b3Idx == -1 || yIdx == -1) { + return statisticSets; + } + } + break1 = row.getString(b1Idx); + break2 = row.getString(b2Idx); + break3 = row.getString(b3Idx); + lRegression = new SimpleRegression(); + lStatistics = new DescriptiveStatistics(); + while (resultIterator.hasNext()) { + + if (!break1.equals(row.getString(b1Idx)) + || !break2.equals(row.getString(b2Idx)) + || !break3.equals(row.getString(b3Idx)) + ) { + String statisticsName = generateStatisticsName( + break1, break2, + break3, parameters, + measurements, dates); + + statisticSets.add( + generateStatisticsValues( + lStatistics, + lRegression, + statisticsName)); + + lStatistics.clear(); + lRegression.clear(); + + clearStatistics(); + + Double yValue = row.getDouble(yIdx); + + if (yValue != null) { + lStatistics.addValue(yValue); + Double x = calculateXOrdinateValue(previousRow,row); + lRegression.addData(x, yValue); + } + + break1 = row.getString(b1Idx); + break2 = row.getString(b2Idx); + break3 = row.getString(b3Idx); + previousRow = row; + row = resultIterator.next(); + lSeries++; + } else { + + Double value = row.getDouble(yIdx); + if (value != null) { + lStatistics.addValue(value.doubleValue()); + Double x = calculateXOrdinateValue(previousRow,row); + lRegression.addData(x, value.doubleValue()); + } + previousRow = row; + row = resultIterator.next(); + } + + } + + Double yValue = row.getDouble(yIdx); + + if (yValue != null) { + lStatistics.addValue(yValue); + Double x = calculateXOrdinateValue(previousRow, row); + lRegression.addData(x, yValue); + } + + String statisticsName = generateStatisticsName( + break1, break2, + break3, parameters, + measurements, dates); + + statisticSets.add(generateStatisticsValues( + lStatistics, + lRegression, + statisticsName)); + lStatistics.clear(); + lRegression.clear(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return statisticSets; + } + + /** + * Nothing is done here. + */ + protected void clearStatistics(){} + + + protected String generateStatisticsName(String break1, + String break2, + String break3, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates){ + log.debug("TimeseriesStatistics.generateStatisticsName"); + return this.findValueTitle(parameters,break1)+ " "+ + this.findValueTitle(measurements,break2) + "m"; + } + + + protected String findValueTitle(Collection<KeyValueDescibeData> values, + String id) { + log.debug("TimeseriesStatistics.findValueTitle "+ id); + if (values != null) { + Iterator<KeyValueDescibeData> it = values.iterator(); + while (it.hasNext()) { + KeyValueDescibeData data = it.next(); + if (id.equals(data.getKey())) { + return data.getValue(); + } + } + } + return ""; + } + + + protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException { + return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.statistics; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import java.sql.SQLException; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class TimeseriesVectorStatistics +extends VectorStatistics +{ + public TimeseriesVectorStatistics() { + } + + + protected void clear() { + // nothing to clear + } + + + protected int getValueIdx(ResultDescriptor rd) { + return rd.getColumnIndex("YORDINATE"); + } + + + protected double calculateXOrdinateValue(Result prev, Result row) + throws SQLException + { + return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VectorStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.statistics; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + +import de.intevation.gnv.statistics.exception.StatisticsException; + +import java.sql.SQLException; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; + +import org.apache.commons.math.stat.regression.SimpleRegression; + +import org.apache.log4j.Logger; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public abstract class VectorStatistics +extends AbstractStatistics +{ + private static Logger logger = + Logger.getLogger(VectorStatistics.class); + + private ResultDescriptor rd; + + + public VectorStatistics() { + } + + + public Collection<StatisticSet> calculateStatistics( + Object result, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates + ) throws StatisticsException { + if (!(result instanceof Collection)) + return new ArrayList<StatisticSet>(); + + Collection<Result> results = (Collection<Result>) result; + Collection<StatisticSet> stats = new ArrayList<StatisticSet>(); + + SimpleRegression lRegression = new SimpleRegression(); + DescriptiveStatistics lStatistics = new DescriptiveStatistics(); + + Result previous = null; + Result row = null; + String seriesName = null; + int valueIdx = -1; + int seriesIdx = -1; + + Iterator<Result> iter = results.iterator(); + + while (iter.hasNext()) { + row = iter.next(); + previous = previous == null ? row : previous; + + if (rd == null || seriesIdx == -1) { + rd = row.getResultDescriptor(); + valueIdx = getValueIdx(rd); + seriesIdx = rd.getColumnIndex("SERIES"); + } + + if (seriesName != null + && !row.getString(seriesIdx).equals(seriesName)) + { + stats.add(generateStatisticsValues( + lStatistics, lRegression, seriesName)); + + lStatistics.clear(); + lRegression.clear(); + + clear(); + } + + Double yValue = getValue(row, valueIdx); + + if (yValue != null) { + lStatistics.addValue(yValue); + + try { + double x = calculateXOrdinateValue(previous, row); + lRegression.addData(x, yValue); + } + catch (SQLException sqle) { + logger.warn(sqle, sqle); + } + } + + seriesName = row.getString(seriesIdx); + previous = row; + } + + if (seriesName != null && row != null) { + stats.add(generateStatisticsValues( + lStatistics, lRegression, seriesName)); + + lStatistics.clear(); + lRegression.clear(); + } + + return stats; + } + + + protected Double getValue(Result row, int idx) { + return row.getDouble(idx); + } + + + abstract protected void clear(); + + abstract protected int getValueIdx(ResultDescriptor rd); + + abstract protected double calculateXOrdinateValue(Result prev, Result now) + throws SQLException; +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,28 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.statistics; -import java.util.Collection; -import java.util.ArrayList; - -import org.apache.log4j.Logger; +import de.intevation.gnv.math.AttributedXYColumns; import de.intevation.gnv.state.describedata.KeyValueDescibeData; import de.intevation.gnv.statistics.exception.StatisticsException; -import de.intevation.gnv.math.AttributedXYColumns; +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.log4j.Logger; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * This class is used to create a statistic in 'Profilschnitt' products. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class VerticalCrossSectionStatistics extends AbstractStatistics @@ -23,6 +33,7 @@ public VerticalCrossSectionStatistics() { } + public Collection<StatisticSet> calculateStatistics( Object result, Collection<KeyValueDescibeData> parameters,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,25 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.statistics; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + import java.sql.SQLException; + import java.util.Collection; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.state.describedata.KeyValueDescibeData; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This class is used to create a statistic in 'Vertikalprofil' products. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class VerticalProfileStatistics extends TimeseriesStatistics { @@ -35,11 +43,9 @@ Collection<KeyValueDescibeData> parameters, Collection<KeyValueDescibeData> measurements, Collection<KeyValueDescibeData> dates) { - - return (this.findValueTitle(parameters, break1)+ " "+ + + return (this.findValueTitle(parameters, break1)+ " "+ this.findValueTitle(measurements,break2)).trim(); } - - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileVectorStatistics.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.statistics; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import java.sql.SQLException; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class VerticalProfileVectorStatistics +extends VectorStatistics +{ + public VerticalProfileVectorStatistics() { + } + + + protected void clear() { + // nothing to clear + } + + + protected int getValueIdx(ResultDescriptor rd) { + return rd.getColumnIndex("YORDINATE"); + } + + + protected double calculateXOrdinateValue(Result prev, Result row) + throws SQLException + { + return row.getDouble("XORDINATE"); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/exception/StatisticsException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/exception/StatisticsException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.statistics.exception; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class StatisticsException extends Exception { @@ -22,7 +27,7 @@ /** * Constructor - * + * * @param arg0 */ public StatisticsException(String arg0) { @@ -31,7 +36,7 @@ /** * Constructor - * + * * @param arg0 */ public StatisticsException(Throwable arg0) { @@ -40,7 +45,7 @@ /** * Constructor - * + * * @param arg0 * @param arg1 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains exception classes used to be thrown if error occur while +generating statistics. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes and interfaces used to create statistics for the +different types of artifacts. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,27 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.timeseries; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.GNVArtifactBase; + 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> - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * Artifact used for product timeseries product. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> * */ public class TimeSeriesArtifact extends GNVArtifactBase { @@ -36,16 +46,16 @@ } - /** - * @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) { + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta meta, + Document data + ) { log.debug("TimeSeriesArtifact.setup"); - super.setup(identifier, factory, context, data); + super.setup(identifier, factory, context, meta, data); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,19 +1,28 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.timeseries; +/** + * Artifact used for timeseries on meshes. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ public class TimeSeriesMeshArtifact extends TimeSeriesArtifact { - /** - * - */ private static final long serialVersionUID = 5680432486700275986L; /** - * * Constructor */ public TimeSeriesMeshArtifact() { super(); super.name = super.name + "Mesh"; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,37 +1,45 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.timeseries.gap; + /** - * @author Tim Englich <tim.englich@intevation.de> + * The default implementation of <code>TimeGap</code>. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ -public class DefaultTimeGap implements TimeGap{ +public class DefaultTimeGap implements TimeGap { /** * The UNIT of the TimeGap * See the Constants in de.intevation.gnv.timeseries.gap.TimeGap */ private String unit; - + /** * The Key of the TimeGap which must be equivalent to the * Key used in the DWH */ private int key; - + /** * The Value of the Gap. * Use the Unit and the Time Constants to Calculate the * value in Milliseconds */ private int value; - + /** * Constructor - * @param unit - * @param key - * @param value + * + * @param unit Unit of this value. + * @param key The key of this time gap. + * @param value The value of this gap. */ public DefaultTimeGap(String unit, int key, int value) { super(); @@ -40,25 +48,20 @@ this.value = value; } - /** - * @see de.intevation.gnv.timeseries.gap.TimeGap#getUnit() - */ + public String getUnit() { return this.unit; } - /** - * @see de.intevation.gnv.timeseries.gap.TimeGap#getKey() - */ + public int getKey() { return this.key; } - /** - * @see de.intevation.gnv.timeseries.gap.TimeGap#getValue() - */ + public int getValue() { return this.value; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,35 +1,57 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.timeseries.gap; -public interface TimeGap { - + +import java.io.Serializable; + +/** + * A class representing a timegap. <code>TimeGap</code>s are used in timeseries + * charts to identify gaps taking account for the resolution of the x-axis + * range. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public interface TimeGap extends Serializable { + public final static String TIME_UNIT_MINUTE = "m"; public final static String TIME_UNIT_HOUR = "h"; public final static String TIME_UNIT_DAY = "D"; public final static String TIME_UNIT_WEEK = "W"; public final static String TIME_UNIT_MONTH = "M"; public final static String TIME_UNIT_YEAR = "Y"; - + public final static long MINUTE_IN_MILLIS = 60 * 1000; public final static long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS; public final static long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS; public final static long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS; - - + + /** * Returns the Lookup-Key for the TimeGap - * @return + * + * @return the timegap key. */ int getKey(); - + /** * Returns the Value of the TimeValue in the Unit which is also given. - * @return + * + * @return the timegap value. */ int getValue(); - + /** * Returns the Unit of the Timegap (e.g. Minutes, Hours, Days, Weeks, Months, Years) - * @return + * + * @return the timegap unit. */ String getUnit(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides classes and interfaces representing time gaps used in +timerseries charts. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains classes providing specific artifacts representing +'Zeitserien'. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,12 +1,19 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.transition; import de.intevation.gnv.state.State; /** - * @author Tim Englich <tim.englich@intevation.de> + * The default implementation of a <code>Transition</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultTransition extends TransitionBase { @@ -23,11 +30,10 @@ super(); } - /** - * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State) - */ + public boolean isValid(State state) { return true; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.transition; import java.util.Map; @@ -8,12 +13,17 @@ import org.apache.log4j.Logger; import org.w3c.dom.Node; -import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.common.utils.Config; import de.intevation.gnv.state.InputData; import de.intevation.gnv.state.State; /** - * @author Tim Englich <tim.englich@intevation.de> + * Class which supports the possibility to validate if a + * Transition could be done using simple Valuecompare Operations. + * The Compareoperations will use the preSettings of an Artifact. + * At this Time equal and notequal-operations are supported. + * The Comparation is casesensitive. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class PresettingsValueCompareTransition extends TransitionBase { @@ -22,11 +32,21 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(PresettingsValueCompareTransition.class); - + + /** + * The Name of the Datafield the Value that should be compared + * should be fetched from. + */ private String dataName = null; + /** + * The Value that should be set to the State. + */ private String dataValue = null; + /** + * The Operation that should be used (equal notequal) + */ private String operator = null; - + /** * The UID of this Class. */ @@ -39,9 +59,7 @@ super(); } - /** - * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State) - */ + public boolean isValid(State state) { Map<String, InputData> preSettings = state.getPreSettings(); if (preSettings != null){ @@ -60,6 +78,7 @@ return false; } + @Override public void setup(Node configuration) { super.setup(configuration); @@ -67,6 +86,5 @@ this.dataValue = Config.getStringXPath(configuration,"condition/@value"); this.operator = Config.getStringXPath(configuration,"condition/@operator"); } - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,37 +1,47 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.transition; +import de.intevation.gnv.state.State; + import java.io.Serializable; import org.w3c.dom.Node; -import de.intevation.gnv.state.State; - /** - * - * @author Tim Englich <tim.englich@intevation.de> + * This interface describes basic methods necessary for a transition model. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public interface Transition extends Serializable{ - + /** * Returns the ID of the State from which the Transition could be used * @return the ID of the State from which the Transition could be used */ public String getFrom(); - + /** * Returns the ID of the State where it is possible to go as next. * @return the ID of the State where it is possible to go as next. */ public String getTo(); - + /** * Determines if it is possible to go along this Transition or not. * @param state the current State - * @return + * @return true, if this transition is valid for the given state - otherwise + * false. */ public boolean isValid(State state); - + /** * Configures the Transition. * @param configuration @@ -39,3 +49,4 @@ public void setup(Node configuration); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,21 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.transition; +import de.intevation.artifacts.common.utils.Config; + import org.w3c.dom.Node; -import de.intevation.artifactdatabase.Config; - /** - * @author Tim Englich <tim.englich@intevation.de> + * An abstract implementation of <code>Transition</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public abstract class TransitionBase implements Transition { @@ -19,7 +26,7 @@ private static final long serialVersionUID = -8542097519466477977L; private String from = null; - + private String to = null; /** * Constructor @@ -27,26 +34,20 @@ public TransitionBase() { } - /** - * @see de.intevation.gnv.transition.Transition#getFrom() - */ + public String getFrom() { return this.from; } - /** - * @see de.intevation.gnv.transition.Transition#getTo() - */ + public String getTo() { return this.to; } - - /** - * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node) - */ + + public void setup(Node configuration) { this.from = Config.getStringXPath(configuration,"from/@state"); this.to = Config.getStringXPath(configuration,"to/@state"); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.transition; import org.apache.log4j.Logger; @@ -9,8 +14,9 @@ import de.intevation.gnv.artifacts.GNVArtifactBase; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This Factoryclass instantiates Objects of Type Transition. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class TransitionFactory { @@ -19,6 +25,9 @@ */ private static Logger log = Logger.getLogger(GNVArtifactBase.class); + /** + * The Singleton instance of the Transitionfactory. + */ private static TransitionFactory instance = null; /** @@ -28,6 +37,10 @@ super(); } + /** + * Returns the Instance of this Class. + * @return the Instance of this Class. + */ public static TransitionFactory getInstance() { if (instance == null) { instance = new TransitionFactory(); @@ -35,6 +48,13 @@ return instance; } + /** + * Creates a new Transition using the Configuration that is provided by the + * XML-Node. + * @param configuration The configuration that should be used to initialize + * the new Transition + * @return a new Transition. + */ public Transition createTransition(Node configuration) { log.debug("TransitionFactory.createTransition"); Transition state = null; @@ -51,5 +71,5 @@ } return state; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.transition; import java.util.Iterator; @@ -8,13 +13,17 @@ import org.apache.log4j.Logger; import org.w3c.dom.Node; -import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.common.utils.Config; import de.intevation.gnv.state.InputData; import de.intevation.gnv.state.State; import de.intevation.gnv.state.exception.StateException; /** - * @author Tim Englich <tim.englich@intevation.de> + * Class which supports the possibility to validate if a + * Transition could be done using simple Valuecompare Operations. + * At this Time equal and notequal-operations are supported. + * The Comparation is casesensitive. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ValueCompareTransition extends TransitionBase { @@ -23,17 +32,27 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ValueCompareTransition.class); - - private String dataName = null; - private String dataValue = null; - private String operator = null; - /** * The UID of this Class. */ private static final long serialVersionUID = -7846722158776823205L; /** + * The Name of the Datafield the Value that should be compared + * should be fetched from. + */ + private String dataName = null; + /** + * The Value that should be set to the State. + */ + private String dataValue = null; + /** + * The Operation that should be used (equal notequal) + */ + private String operator = null; + + + /** * Constructor */ public ValueCompareTransition() { @@ -41,10 +60,12 @@ } /** + * validates if a Transition is valid and could be used using simple + * Comparevalue-Operations. * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State) */ public boolean isValid(State state) { - + try { Iterator<InputData> it = state.getInputData().iterator(); while (it.hasNext()){ @@ -70,6 +91,7 @@ return false; } + @Override public void setup(Node configuration) { super.setup(configuration); @@ -77,6 +99,5 @@ this.dataValue = Config.getStringXPath(configuration,"condition/@value"); this.operator = Config.getStringXPath(configuration,"condition/@operator"); } - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,10 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package contains interfaces and classes providing the Transitionlogic to +switch between different States and validate if the Transition to an State is +possible or not. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactFactoryUtilities.java Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/** - * - */ -package de.intevation.gnv.utils; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -import de.intevation.artifacts.ArtifactFactory; - -/** - * @author Tim Englich <tim.englich@intevation.de> - * - */ -public class ArtifactFactoryUtilities { - /** - * the logger, used to log exceptions and additonaly information - */ - private static Logger log = Logger - .getLogger(ArtifactFactoryUtilities.class); - - /** - * Constructor - */ - public ArtifactFactoryUtilities() { - } - - public ArtifactFactory createArtitfactFactor(Document config, - Node artifactFactoryNode) { - String className = artifactFactoryNode.getTextContent(); - - ArtifactFactory factory = null; - - try { - Class clazz = Class.forName(className); - factory = (ArtifactFactory) clazz.newInstance(); - } catch (ClassNotFoundException cnfe) { - log.error(cnfe.getLocalizedMessage(), cnfe); - } catch (InstantiationException ie) { - log.error(ie.getLocalizedMessage(), ie); - } catch (ClassCastException cce) { - log.error(cce.getLocalizedMessage(), cce); - } catch (IllegalAccessException iae) { - log.error(iae.getLocalizedMessage(), iae); - } - - if (factory != null) { - factory.setup(config, artifactFactoryNode); - log.info("Registering '" + factory.getName() - + "' as artifact factory."); - } - return factory; - } -}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.utils; import java.io.ByteArrayInputStream; @@ -30,8 +35,10 @@ import de.intevation.artifacts.ArtifactNamespaceContext; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This class provides some methods for creating and working with xml documents. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ArtifactXMLUtilities implements Serializable { /** @@ -49,23 +56,35 @@ public static final String XFORM_PREFIX = "xform"; /** - * Constructor + * Constructor.<br> + * <b>Note:</b> It should not be necessary to create an object of this + * class - which is a helper class. Call static methods instead. */ public ArtifactXMLUtilities() { } /** - * @param document - * @return + * Creates an <code>Element</code> and returns it. + * + * @param document A document + * @param name Name of a node. + * @return an Element. */ - public Element createArtifactElement(Document document, String name) { + public static Element createArtifactElement(Document document, String name) { Element node = document.createElementNS( ArtifactNamespaceContext.NAMESPACE_URI, name); node.setPrefix(ArtifactNamespaceContext.NAMESPACE_PREFIX); return node; } - public String writeDocument2String(Document document) { + + /** + * Turns an xml document into a string. + * + * @param document An xml document. + * @return String representation of <i>document</i>. + */ + public static String writeDocument2String(Document document) { try { TransformerFactory transformerFactory = TransformerFactory .newInstance(); @@ -85,6 +104,12 @@ return null; } + /** + * Read a document from input stream. + * + * @param inputStream The input stream. + * @return the document read from stream. + */ public static Document readDocument(InputStream inputStream) { Document returnValue = null; try { @@ -102,50 +127,101 @@ return returnValue; } + public Document reInitDocument(Document document) { try { - byte[] barray = this.writeDocument2String(document).getBytes( + byte[] barray = ArtifactXMLUtilities.writeDocument2String(document).getBytes( "UTF-8"); InputStream inputStream = new ByteArrayInputStream(barray); - return this.readDocument(inputStream); + return ArtifactXMLUtilities.readDocument(inputStream); } catch (UnsupportedEncodingException e) { log.error(e, e); } return document; } + + /** + * Creates an <code>Element</code> with {@link #XFORM_PREFIX} and <i>name + * </i>. + * + * @param document A document. + * @param name The node name. + * @return the created element. + */ public static Element createXFormElement(Document document, String name) { Element node = document.createElementNS(XFORM_URL, name); node.setPrefix(XFORM_PREFIX); return node; } - public Document createExceptionReport(String message, Document document) { + /** + * Creates an exception node. + * + * @param message The message in the node. + * @param document A document. + * @return the document containing the exception node. + */ + public static Document createExceptionReport(String message, Document document) { log.debug("ArtifactXMLUtilities.createExceptionReport"); - Element exceptionReportNode = this.createArtifactElement(document, + Element exceptionReportNode = createArtifactElement(document, "exceptionreport"); document.appendChild(exceptionReportNode); - Element exceptionNode = this.createArtifactElement(document, + Element exceptionNode = createArtifactElement(document, "exception"); exceptionNode.setTextContent(message); exceptionReportNode.appendChild(exceptionNode); return document; } - public Document createSuccessReport(String message, Document document) { + /** + * Creates an input exception node. + * + * @param msg The message in the node. + * @param doc A document. + * @return the document containing the exception node. + */ + public static Document createInputExceptionReport(String msg, Document doc) { + Element exceptionReportNode = createArtifactElement( + doc,"exceptionreport"); + Element exceptionNode = createArtifactElement( + doc,"exception"); + Element inputNode = createArtifactElement( + doc, "input"); + inputNode.setTextContent(msg); + exceptionNode.appendChild(inputNode); + exceptionReportNode.appendChild(exceptionNode); + doc.appendChild(exceptionReportNode); + return doc; + } + + /** + * Creates a success node. + * + * @param message The message. + * @param document A document. + * @return the document containing the success node. + */ + public static Document createSuccessReport(String message, Document document) { log.debug("ArtifactXMLUtilities.creatSuccessReport"); - Element reportNode = this.createArtifactElement(document, "result"); + Element reportNode = createArtifactElement(document, "result"); document.appendChild(reportNode); - Element successNode = this.createArtifactElement(document, "success"); + Element successNode = createArtifactElement(document, "success"); successNode.setTextContent(message); reportNode.appendChild(successNode); return document; } - + + /** + * Read <i>fileName</i> and return the first child node. + * + * @param fileName An xml document. + * @return the first child node in this document. + */ public Node readConfiguration(String fileName){ try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setValidating(false); + factory.setValidating(false); return factory.newDocumentBuilder().parse(fileName).getChildNodes().item(0); } catch (SAXException e) { log.error(e,e); @@ -158,5 +234,5 @@ return null; } } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/DistanceCalculator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/DistanceCalculator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,74 +1,103 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.utils; +import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Point; -import com.vividsolutions.jts.geom.Coordinate; import java.util.List; /** - * @author Tim Englich <tim.englich@intevation.de> + * A helper class to calculate distances between points and coordinates. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DistanceCalculator { private final static double flattening = 1.0 / 298.257233563; - + private final static double earthRadius = 6378137.0 / 1000.0 ; - + /** * Constructor */ public DistanceCalculator() { } - + + + /** + * Calculates the distance between two points. + * + * @param p1 First point. + * @param p2 Second point. + * @return the distance. + */ public static double calculateDistance(Point p1, Point p2){ return calculateDistance(p1.getCoordinate(), p2.getCoordinate()); } + + /** + * Calculates the distance between two coordinates. + * + * @param p1 First coordinate. + * @param p2 Second coordinate. + * @return the distance. + */ public static double calculateDistance(Coordinate p1, Coordinate p2){ double resultValue = 0.0; - + double b1 = p1.y; double b2 = p2.y; - + double l1 = p1.x; double l2 = p2.x; - - + + double F = (b1 + b2) / 2.0; double G = (b1 - b2) / 2.0; double l = (l1 - l2) / 2.0; - + F = (Math.PI / 180.0) * F; G = (Math.PI / 180.0) * G; l = (Math.PI / 180.0) * l; - + double S = ((Math.sin(G) * Math.sin(G)) * ((Math.cos(l) * Math.cos(l))))+ ((Math.cos(F) * Math.cos(F)) * ((Math.sin(l) * Math.sin(l)))); - + double C = ((Math.cos(G) * Math.cos(G)) * ((Math.cos(l) * Math.cos(l))))+ ((Math.sin(F) * Math.sin(F)) * ((Math.sin(l) * Math.sin(l)))); - + double w = Math.atan(Math.sqrt((S/C))); - + double D = 2.0 * w * earthRadius; - + double R = Math.sqrt((S*C)) / w; - + double H1 = (3.0 * R - 1.0 ) / (2.0 * C); double H2 = (3.0 * R + 1.0 ) / (2.0 * S); - - resultValue = D * (1 + (flattening * H1 * (Math.sin(F) * Math.sin(F)) * - (Math.cos(G) * Math.cos(G))) - - (flattening * H2 * (Math.cos(F) * Math.cos(F)) * + + resultValue = D * (1 + (flattening * H1 * (Math.sin(F) * Math.sin(F)) * + (Math.cos(G) * Math.cos(G))) - + (flattening * H2 * (Math.cos(F) * Math.cos(F)) * (Math.sin(G) * Math.sin(G)))); - + return resultValue; } + /** + * Calculates the length of a path specified by coordinates in <i>path</i>. + * + * @param path A list of coordinates. + * @return the length of the given path. + */ public static final double calculateDistance(List<Coordinate> path) { int N = path.size(); if (N < 2) { @@ -82,3 +111,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ExclusiveExec.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.utils; + +import java.util.HashMap; + +/** + * This class can be used to synchronize threads with a given key. To use this + * synchronization, you first need to do call {@link #acquire(java.lang.Object)} + * to retrieve a {@link UniqueKey}. After this, you can call the code being + * synchronized. After this execution, you need to call + * {@link #release(UniqueKey)} with your token you retrieved from {@link + * #acquire(java.lang.Object)}. A thread needs to wait for another thread if their keys + * are equal. Threads with different keys don't need to wait for each other. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public final class ExclusiveExec +{ + /** + * The only instance of this singleton. + */ + public static final ExclusiveExec INSTANCE = new ExclusiveExec(); + + private HashMap tokens; + + /** + * This class represents a unique key with a reference counter. + */ + public static class UniqueKey { + Object key; + int [] refs; + + /** + * Constructs a new UniqueKey. + * + * @param key The key of this unique key. + */ + public UniqueKey(Object key) { + this.key = key; + refs = new int[1]; + } + } + + /** + * Private constructor. Use {@link #INSTANCE} instead. + */ + private ExclusiveExec() { + tokens = new HashMap(); + } + + /** + * This method serves a {@link UniqueKey} and starts a synchronized code + * block. + * + * @param key The key used to identify same threads. + * @return UniqueKey. Use this object to call {@link #release(UniqueKey)} + * at the end of your code being synchronized. + */ + public UniqueKey acquire(Object key) { + + try { + UniqueKey internalKey = null; + synchronized (tokens) { + internalKey = (UniqueKey)tokens.get(key); + + if (internalKey == null) { + tokens.put(key, internalKey = new UniqueKey(key)); + } + } + + synchronized (internalKey) { + ++internalKey.refs[0]; + while (internalKey.refs[0] > 1) { + internalKey.wait(10000L); + } + } + + return internalKey; + } + catch (InterruptedException ie) { + return null; + } + } + + /** + * This method releases a lock. Call this method at the end of your code + * being synchronized. + * + * @param internalKey Token retrieved by {@link #acquire(Object)}. + */ + public void release(UniqueKey internalKey) { + if (internalKey != null) { + synchronized (internalKey) { + if (--internalKey.refs[0] < 1) { + synchronized (tokens) { + tokens.remove(internalKey.key); + } + } + internalKey.notifyAll(); + } + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/FileUtils.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/FileUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; import java.io.BufferedInputStream; @@ -13,13 +21,43 @@ import java.util.zip.ZipOutputStream; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * A helper class to provide some methods for working with files and + * directories. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public final class FileUtils { private FileUtils() { } + /** + * Deletes everything in a directory. + * + * @param dir The directory. + */ + public final static void deleteContent(File dir) { + if (dir == null || !dir.isDirectory()) { + return; + } + + File[] files = dir.listFiles(); + if (files != null) { + for (File file: files) { + deleteRecursive(file); + } + } + + return; + } + + /** + * Delete <i>file</i> and everything in <i>file</i> if it is a directory. + * + * @param file The file or directory. + * @return true, if deletion was successful - otherwise false. + */ public final static boolean deleteRecursive(File file) { if (file == null) { @@ -40,6 +78,14 @@ return file.delete(); } + /** + * Put the given file or directory into a zip archive. + * + * @param file The file or directory. + * @param outputStream The stream to write the archive to. + * @throws IOException if an error occured while zip creation or writing to + * output stream. + */ public static void createZipArchive( File file, OutputStream outputStream @@ -82,6 +128,9 @@ out.finish(); } + /** + * A class representing a directory with a prefix. + */ private static final class PrefixDir { String prefix; @@ -94,6 +143,15 @@ } // class PrefixDir + /** + * Write a file to zip archive. + * + * @param prefix A prefix. + * @param file The file. + * @param out The output stream. + * @throws IOException if an error occured while writing to zip output + * stream. + */ private static void copyFileToZip( String prefix, File file,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/IndexBuffer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/IndexBuffer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,15 +1,23 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; +import java.awt.Point; + import java.awt.geom.Point2D; -import java.awt.Point; - import java.util.List; /** * Create buffers around integer pairs (i_1..n), j_1..n). * - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class IndexBuffer { @@ -166,4 +174,4 @@ return new Point2D.Double(p.y, -p.x); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,31 +1,42 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.utils; -import java.util.Date; - -import org.apache.commons.validator.GenericValidator; -import org.apache.log4j.Logger; - import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKTReader; + import de.intevation.gnv.geobackend.util.DateUtils; + import de.intevation.gnv.utils.exception.ValidationException; +import java.util.Date; + +import org.apache.commons.validator.GenericValidator; + +import org.apache.log4j.Logger; + /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * */ public class InputValidator { /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(InputValidator.class); - - + + public final static String NODATASELECTEDVALUE = "n/n"; /** @@ -35,7 +46,17 @@ super(); } - public boolean isInputValid(String minInput, String maxInput, String type) { + /** + * Validates the input of a range of double or date values. The input values + * need to be valid double or date values. <i>minInput</i> needs to be + * smaller or equal <i>maxInput</i>. + * + * @param minInput The lower bound. + * @param maxInput The upper bound. + * @param type One of 'Date' or 'Double'. + * @return true, if the input is valid, otherwise false. + */ + public static boolean isInputValid(String minInput, String maxInput, String type) { log.debug("InputValidator.isInputValid " + minInput + " " + maxInput + " " +type); boolean returnValue = false; if ("Date".equalsIgnoreCase(type)) { @@ -59,14 +80,44 @@ log.debug("Is valid? " + returnValue); return returnValue; } - - public boolean isInputValid(String input, String type) { + + /** + * Validates an input. + * + * @param input The input value. + * @param type The input value type. + * @return true if the input is valid, otherwise false. + */ + public static boolean isInputValid(String input, String type) { + if (input.length() == 0 || input.equals("")) { + return false; + } + log.debug("InputValidator.isInputValid " + input + " " + type); + + // Let's check polygons and linestrings first, because they might + // contain comma. A splitting at comma characters wouldn't be good here. + if ("Polygon".equalsIgnoreCase(type) || "Linestring".equalsIgnoreCase(type)) + { + try { + WKTReader reader = new WKTReader(); + reader.read(input); + + return true; + } + catch (ParseException pe) { + log.warn(pe, pe); + return false; + } + } + + // Check all the other input here boolean returnValue = false; String[] values = input.split(","); + for (int i = 0; i < values.length; i++) { boolean valid; - + if (NODATASELECTEDVALUE.equals(values[i].trim())){ valid = true; } else if ("Integer".equalsIgnoreCase(type)) { @@ -81,7 +132,7 @@ } else if ("Date".equalsIgnoreCase(type)) { valid = GenericValidator.isDate(values[i].trim(), DateUtils.DATE_PATTERN, true); - } else if ("Point".equalsIgnoreCase(type)) { + } else if ("Point".equalsIgnoreCase(type) || "Geometry".equals(type)) { valid = GenericValidator.matchRegexp(values[i], "[0-9]"); // TODO: // FIXME: // VALIDATE @@ -93,7 +144,7 @@ // REGEXP } else if ("Coordinate".equalsIgnoreCase(type)) { try { - valid = this.getPointValue(values[i]) != null; + valid = getPointValue(values[i]) != null; } catch (ValidationException e) { log.debug(e.getMessage()); valid = false; @@ -111,44 +162,94 @@ log.debug("Is valid? " + returnValue); return returnValue; } - - - public Point getPointValue(String value) throws ValidationException{ + + + /** + * Returns a point from wkt string. + * + * @param value The wkt string. + * @return a point. + * @throws ValidationException if <i>value</i> is not valid. + */ + public static Point getPointValue(String value) throws ValidationException{ log.debug("InputValidator.getPointValue " + value); - String[] s, p; - - double x=0,y=0; - log.info("Position :"+value); - s = value.split(" "); - if (s.length != 2) { - throw new ValidationException("Kein Blank separiert Breite und Länge"); + + if (value.toLowerCase().startsWith("point")){ + try { + return (Point)new WKTReader().read(value); + } catch (ParseException e) { + log.error(e,e); + throw new ValidationException(e); + } + }else{ + String[] s, p; + + double x=0,y=0; + log.info("Position :"+value); + s = value.split(" "); + if (s.length != 2) { + throw new ValidationException("Kein Blank separiert Breite und Länge"); + } + p = s[0].split("[nNsS]"); + try { + if (p.length == 1) + y = new Double(p[0]); + else + y = new Double(p[0]) + new Double(p[1]) / new Double(60.); + if (s[0].toLowerCase().contains("s")) + y = -y; + } + catch (Exception e) { + throw new ValidationException("Kein N|S oder nicht im ersten Substring, zB 56n42"); + + } + p = s[1].split("[eEwW]"); + try { + if (p.length ==1) + x = new Double(p[0]); + else + x = new Double(p[0]) + new Double(p[1]) / new Double(60.) ; + if (s[1].toLowerCase().contains("w")) + x = -x; + } + catch (Exception e) { + throw new ValidationException("Kein E|W oder nicht im zweiten Substring"); + } + return new GeometryFactory().createPoint(new Coordinate(x,y)); } - p = s[0].split("[nNsS]"); - try { - if (p.length == 1) - y = new Double(p[0]); - else - y = new Double(p[0]) + new Double(p[1]) / new Double(60.); - if (s[0].toLowerCase().contains("s")) - y = -y; - } - catch (Exception e) { - throw new ValidationException("Kein N|S oder nicht im ersten Substring, zB 56n42"); - - } - p = s[1].split("[eEwW]"); - try { - if (p.length ==1) - x = new Double(p[0]); - else - x = new Double(p[0]) + new Double(p[1]) / new Double(60.) ; - if (s[1].toLowerCase().contains("w")) - x = -x; - } - catch (Exception e) { - throw new ValidationException("Kein E|W oder nicht im zweiten Substring"); - } - return new GeometryFactory().createPoint(new Coordinate(x,y)); } + + /** + * Makes sure that <i>tmp</i> is between <i>lo</i> and <i>up</i>. + * + * @param tmp The value to validate. + * @param lo The lower range bound. + * @param up The upper range bound. + * @return true, if tmp is valid, otherwise false. + */ + public static boolean isDateValid(Date tmp, Date lo, Date up) { + // take the time in seconds to compare + long tmpTime = tmp.getTime() / 1000; + long tmpLow = lo.getTime() / 1000; + long tmpUp = up.getTime() / 1000; + + if (log.isDebugEnabled()) { + log.debug("Date validation..."); + log.debug("-> lower bound [sec]: " + tmpLow); + log.debug("-> upper bound [sec]: " + tmpUp); + log.debug("-> input data [sec]: " + tmpTime); + } + + // XXX There is a buffer of 1 second for the valid range of the time. + if (tmpTime < (tmpLow-1) || tmpTime > (tmpUp+1)) { + log.warn( + "Date [" + tmp.toString() + "] is out of range [" + + lo.toString() + " to "+ up.toString() + "]."); + return false; + } + + return true; + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,18 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.XMLUtils; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; + import de.intevation.artifacts.ArtifactNamespaceContext; + import de.intevation.gnv.wms.LayerInfo; import java.io.File; @@ -11,6 +21,7 @@ import java.io.IOException; import java.io.StringWriter; import java.io.Writer; + import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -21,38 +32,72 @@ import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; + import org.apache.velocity.app.VelocityEngine; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class iterates over a bunch of directories, searches for meta + * information coresponding to shapefiles and creates a mapfile which is used by + * a <i>MapServer</i>. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class MapfileGenerator extends Thread { + /** + * The configured template path. + */ public static final String TEMPLATE_PATH = "/artifact-database/gnv/map-generator/templates/path/text()"; + /** + * The configured template mapfile. + */ public static final String TEMPLATE_MAPFILE = "/artifact-database/gnv/map-generator/templates/maptemplate/text()"; + /** + * The configured mapfile path. + */ public static final String MAPFILE_PATH = "/artifact-database/gnv/map-generator/mapfile/@path"; + /** + * The configured shapefile base directory where the subdirectories for each + * artifact are stored. + */ public static final String SHAPEFILE_BASE_DIR = "/artifact-database/gnv/shapefile-directory/@path"; + /** + * The configured velocity logfile. + */ public static final String VELOCITY_LOGFILE = "/artifact-database/velocity/logfile/@path"; + /** + * The URL for calling the mapserver + */ + public static final String MAPSERVER_URL = + "/artifact-database/mapserver/server/@path"; + + /** + * The name of the file storing meta information coresponding to shapefiles. + */ public static final String META_FILE_NAME = "meta.xml"; + /** + * The XPath to layer nodes in the meta information xml file. + */ public static final String XPATH_LAYER = "/art:meta/art:layer"; + public static final String XPATH_LAYER_NAME = "art:name"; + public static final String XPATH_LAYER_TITLE = "art:title"; public static final String XPATH_LAYER_TYPE = "art:type"; public static final String XPATH_LAYER_DATA = "art:data"; public static final String XPATH_LAYER_STATUS = "art:status"; @@ -65,6 +110,7 @@ private static MapfileGenerator instance; private File mapfile; + private String mapServerUrl; private String shapefileDirectory; private String templatePath; private String velocityLogfile; @@ -79,11 +125,23 @@ } + /** + * A main method which can be used to create a mapfile without a running + * artifact server.<br> + * <b>NOTE:</b> This method is not implemented yet! + * + * @param args Arguments. + */ public static void main(String[] args) { // TODO IMPLEMENT ME } + /** + * Returns the instance of this generator. + * + * @return the instance. + */ public static synchronized MapfileGenerator getInstance() { if (instance == null) { instance = new MapfileGenerator(); @@ -95,6 +153,9 @@ } + /** + * Triggers the mapfile generation process. + */ public void update() { synchronized (lock) { logger.debug("update"); @@ -104,6 +165,10 @@ } + /** + * Thread to generate a mapfile. + */ + @Override public void run() { logger.debug("Start MapfileGenerator thread..."); try { @@ -127,7 +192,22 @@ } } + /** + * Method to check the existance of a template file. + * + * @param templateID The name of a template. + * @return true, of the template exists - otherwise false. + */ + public boolean templateExists(String templateID){ + Template template = getTemplateByName(templateID); + return template != null; + } + + /** + * Method which starts searching for meta information file and mapfile + * generation. + */ protected void generate() { File basedir = new File(getShapefileBaseDir()); List layers = new ArrayList(); @@ -136,6 +216,11 @@ } + /** + * Returns the VelocityEngine used for the template mechanism. + * + * @return the velocity engine. + */ protected VelocityEngine getVelocityEngine() { if (velocityEngine == null) { velocityEngine = new VelocityEngine(); @@ -151,6 +236,12 @@ } + /** + * Initialize velocity. + * + * @param engine Velocity engine. + * @throws Exception if an error occured while initializing velocity. + */ protected void setupVelocity(VelocityEngine engine) throws Exception { @@ -174,6 +265,11 @@ } + /** + * Returns the path specifying the logfile for velocity. + * + * @return Velocity logfile path. + */ protected String getVelocityLogfile() { if (velocityLogfile == null) velocityLogfile = Config.getStringXPath(VELOCITY_LOGFILE); @@ -182,6 +278,11 @@ } + /** + * Returns the base directory storing the templates. + * + * @return the template base directory. + */ protected String getTemplateBaseDir() { if (templatePath == null) { templatePath = Config.getStringXPath(TEMPLATE_PATH); @@ -192,6 +293,27 @@ } + /** + * Returns the URL for calling the MapServer. + * + * @return the url for calling the MapServer. + */ + protected String getMapServerUrl() { + if (mapServerUrl == null) { + mapServerUrl = Config.getStringXPath(MAPSERVER_URL); + mapServerUrl = Config.replaceConfigDir(mapServerUrl); + } + + return mapServerUrl; + } + + + /** + * Returns a template specified by <i>model</i>. + * + * @param model The name of the template. + * @return a template. + */ protected Template getTemplateByName(String model) { if (model.indexOf(".vm") < 0) { model = model.concat(".vm"); @@ -214,6 +336,12 @@ } + /** + * Returns the mapfile template. + * + * @return the mapfile template. + * @throws Exception if an error occured while reading the configuration. + */ protected Template getMapfileTemplate() throws Exception { @@ -222,6 +350,11 @@ } + /** + * Returns the base directory storing the shapefiles. + * + * @return the shapefile base directory. + */ protected String getShapefileBaseDir() { if (shapefileDirectory == null) { shapefileDirectory = Config.getStringXPath(SHAPEFILE_BASE_DIR); @@ -232,6 +365,11 @@ } + /** + * Returns the mapfile. + * + * @return the mapfile. + */ protected File getMapfile() { if (mapfile == null) { String tmp = Config.getStringXPath(MAPFILE_PATH); @@ -243,6 +381,13 @@ } + /** + * Search for meta information file in <i>file</i> and store the layer + * information in <i>store</i> if a meta file was found. + * + * @param file The root directory to be searched for meta files. + * @param store A list storing <code>LayerInfo</code> objects. + */ protected void searchMetaInformation(File file, List store) { if (file.isDirectory()) { File[] files = file.listFiles(); @@ -267,6 +412,13 @@ } + /** + * Parses a meta information file and returns necessary information as + * <code>LayerInfo</code> array. + * + * @param file Meta information file. + * @return Array of LayerInfo objects. + */ protected LayerInfo[] parseMeta(File file) { Document meta = XMLUtils.parseDocument(file); List layers = new ArrayList(); @@ -293,6 +445,12 @@ } + /** + * Parses a node storing layer information and returns them. + * + * @param layer Node storing information about a layer. + * @return a LayerInfo object. + */ protected LayerInfo parseLayer(Node layer) { LayerInfo info = new LayerInfo(); @@ -301,6 +459,14 @@ info.setName(name); } + String title = parseLayerAttr(layer, XPATH_LAYER_TITLE); + if (title != null && !title.equals("")) { + info.setTitle(title); + } + else { + info.setTitle(name); + } + String model = parseLayerAttr(layer, XPATH_LAYER_MODEL); if (model != null && !model.equals("")) { info.setModel(model); @@ -325,6 +491,13 @@ } + /** + * Parses attributes in layer nodes. + * + * @param node A node containing layer information. + * @param xpath XPath specifying an attribute. + * @return Attribute as string. + */ protected String parseLayerAttr(Node node, String xpath) { return (String) XMLUtils.xpath( node, @@ -334,6 +507,11 @@ } + /** + * Creates a mapfile with the layer information stored in <i>layers</i>. + * + * @param layers Layer information. + */ protected void writeMapfile(List layers) { String tmpMapName = "mapfile" + new Date().getTime(); @@ -371,6 +549,7 @@ writer = new FileWriter(tmp); VelocityContext context = new VelocityContext(); + context.put("MAPSERVERURL", getMapServerUrl()); context.put("LAYERS", sb.toString()); Template mapTemplate = getMapfileTemplate(); @@ -414,4 +593,4 @@ } } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; import java.io.File; @@ -5,19 +13,29 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.text.DecimalFormat; +import java.util.Date; + +import javax.xml.xpath.XPathConstants; import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; -import de.intevation.artifactdatabase.XMLUtils; +import com.vividsolutions.jts.geom.Envelope; + +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.gnv.artifacts.context.GNVArtifactContext; import de.intevation.gnv.wms.LayerInfo; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class provides some methods to create files storing meta information + * about wms layers and a map service which serves these layers. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class MetaWriter { @@ -26,45 +44,26 @@ public static final String NODE_MAPSERVER = "mapserver"; public static final String NODE_SERVER = "server"; public static final String NODE_MAP = "map"; + public static final String NODE_TTL = "ttl"; public static final String META_FILE_NAME = "meta.xml"; - public static final String ISOLINES_NAME = "isolines.shp"; - public static final String POLYGON_NAME = "polygons.shp"; - public static final String LAYER_DATA_NAME = "data.shp"; + public static final String XPATH_META = "/art:meta"; + public static final String XPATH_MAPSERVER = "art:meta/art:"+NODE_MAPSERVER; + + /** + * Constructor. + */ private MetaWriter() { } - - public static Document writeLayerMeta(CallContext context, - String uuid, - String path, - String paramType, - String layerType){ - Document meta = XMLUtils.newDocument(); - XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( - meta, - ArtifactNamespaceContext.NAMESPACE_URI, - ArtifactNamespaceContext.NAMESPACE_PREFIX); - Element root = creator.create("meta"); - meta.appendChild(root); - - writeAbstractMeta(context, meta, root); - writeLayerMeta(context, meta, root, uuid, paramType,layerType); - boolean success = writeMetaFile(path, meta); - - if (success){ - return meta; - }else{ - return null; - } - } - public static Document writeHorizontalcrosssectionMeta( - CallContext context, - String uuid, - String path, - String paramType) - { + + /** + * Just create a new document and insert the root node. + * + * @return the meta document with necessary root node. + */ + public static Document initMeta() { Document meta = XMLUtils.newDocument(); XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( meta, @@ -74,27 +73,123 @@ Element root = creator.create("meta"); meta.appendChild(root); - writeAbstractMeta(context, meta, root); - writePolygonMeta(context, meta, root, uuid, path, paramType); - writeIsolineMeta(context, meta, root, uuid, path, paramType); + return meta; + } - boolean success = writeMetaFile(path, meta); + public static boolean insertLayer( + CallContext context, + Document document, + String name, + String title, + String data, + String model, + String type, + String status + ) { + if (document == null) { + document = initMeta(); + } - if (success){ - return meta; - }else{ - return null; + Node meta = (Node) XMLUtils.xpath( + document, + XPATH_META, + XPathConstants.NODE, + ArtifactNamespaceContext.INSTANCE); + + if (meta == null) { + logger.error("No meta node was found in the given document. " + + "Cannot insert layer!"); + return false; } + + XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( + document, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX); + + Element layerEl = creator.create(LayerInfo.LAYER); + Element nameEl = creator.create(LayerInfo.LAYER_NAME); + Element titleEl = creator.create(LayerInfo.LAYER_TITLE); + Element dataEl = creator.create(LayerInfo.LAYER_DATA); + Element modelEl = creator.create(LayerInfo.LAYER_MODEL); + Element typeEl = creator.create(LayerInfo.LAYER_TYPE); + Element statusEl = creator.create(LayerInfo.LAYER_STATUS); + + modelEl.setTextContent(model); + nameEl.setTextContent(name); + titleEl.setTextContent(title); + typeEl.setTextContent(type); + statusEl.setTextContent(status); + dataEl.setTextContent(data); + + layerEl.appendChild(modelEl); + layerEl.appendChild(nameEl); + layerEl.appendChild(titleEl); + layerEl.appendChild(dataEl); + layerEl.appendChild(typeEl); + layerEl.appendChild(statusEl); + + if (logger.isDebugEnabled()) { + logger.debug("--------------- WMS LAYER PARAMS ---------------"); + logger.debug("Name : " + name); + logger.debug("Title : " + title); + logger.debug("Data : " + data); + logger.debug("Type : " + type); + logger.debug("Model : " + model); + logger.debug("Status: " + status); + } + + meta.appendChild(layerEl); + + return true; } /** - * @param path - * @param meta + * Method to write the <i>meta</i> document down to a file. + * + * @param path The destination of the file. + * @param meta The xml document storing the meta information. */ - private static boolean writeMetaFile(String path, Document meta) { + public static boolean insertMbr(Envelope mbr, String srs, Document meta) { + Node mapserverNode = (Node) XMLUtils.xpath( + meta, + XPATH_MAPSERVER, + XPathConstants.NODE, + ArtifactNamespaceContext.INSTANCE); + if (mapserverNode != null){ + XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( + meta, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX); + Element bboxNode = creator.create("Box"); + bboxNode.setAttribute("srsName", srs); + Element coordinateNode = creator.create("coordinates"); + + DecimalFormat formatter = new DecimalFormat("###.############"); + coordinateNode.setTextContent(formatter.format(mbr.getMinX()).replace(',', '.') +","+ + formatter.format(mbr.getMinY()).replace(',', '.')+" "+ + formatter.format(mbr.getMaxX()).replace(',', '.') +","+ + formatter.format(mbr.getMaxY()).replace(',', '.')); + mapserverNode.appendChild(bboxNode); + bboxNode.appendChild(coordinateNode); + } + return true; + } + /** + * Method to write the <i>meta</i> document down to a file. + * + * @param path The destination of the file. + * @param meta The xml document storing the meta information. + */ + public static boolean writeMetaFile(String path, Document meta) { try { File metaFile = new File(path, META_FILE_NAME); + if (metaFile.exists()) { + logger.info("Delete old meta information file."); + metaFile.delete(); + } + if (!metaFile.createNewFile() || !metaFile.canWrite()) { logger.error("Error while writing meta file: "+metaFile.toString()); return false; @@ -130,11 +225,27 @@ } - public static void writeAbstractMeta( + /** + * Append meta information about the mapservice itself. + * + * @param callContext The CallContext object. + * @param document The meta information document. + * @param meta The element where the new information need to be appended to. + */ + public static void insertAbstractMeta( CallContext callContext, - Document document, - Element meta + Document document ) { + if (document == null) { + document = initMeta(); + } + + Node meta = (Node) XMLUtils.xpath( + document, + XPATH_META, + XPathConstants.NODE, + ArtifactNamespaceContext.INSTANCE); + XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( document, ArtifactNamespaceContext.NAMESPACE_URI, @@ -149,128 +260,29 @@ String map = (String) context.get(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY); - logger.debug("MAPSERVER PATH: " + server); - logger.debug("MAP PATH: " + map); + Long time = callContext.getTimeToLive(); + time = time != null ? time + new Date().getTime() : null; + String ttl = time != null ? time.toString() : null; + + if (logger.isDebugEnabled()) { + logger.debug("MAPSERVER PATH: " + server); + logger.debug("MAP PATH: " + map); + logger.debug("TTL: " + ttl); + } Element mapserver = creator.create(NODE_MAPSERVER); Element serverPath = creator.create(NODE_SERVER); Element mapPath = creator.create(NODE_MAP); + Element timetolive = creator.create(NODE_TTL); mapPath.setTextContent(map); serverPath.setTextContent(server); + timetolive.setTextContent(ttl); mapserver.appendChild(serverPath); mapserver.appendChild(mapPath); + mapserver.appendChild(timetolive); meta.appendChild(mapserver); } - - protected static void writeLayerMeta( - CallContext context, - Document document, - Element meta, - String uuid, - String paramType, - String layerType - ) { - XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( - document, - ArtifactNamespaceContext.NAMESPACE_URI, - ArtifactNamespaceContext.NAMESPACE_PREFIX); - - Element layer = creator.create(LayerInfo.LAYER); - Element model = creator.create(LayerInfo.LAYER_MODEL); - Element name = creator.create(LayerInfo.LAYER_NAME); - Element type = creator.create(LayerInfo.LAYER_TYPE); - Element status = creator.create(LayerInfo.LAYER_STATUS); - Element data = creator.create(LayerInfo.LAYER_DATA); - - model.setTextContent(paramType); - name.setTextContent(uuid); - type.setTextContent(layerType); - status.setTextContent("OFF"); - data.setTextContent(LAYER_DATA_NAME); - - layer.appendChild(model); - layer.appendChild(name); - layer.appendChild(type); - layer.appendChild(status); - layer.appendChild(data); - - meta.appendChild(layer); - } - - - - - public static void writePolygonMeta( - CallContext context, - Document document, - Element meta, - String uuid, - String path, - String paramType - ) { - XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( - document, - ArtifactNamespaceContext.NAMESPACE_URI, - ArtifactNamespaceContext.NAMESPACE_PREFIX); - - Element layer = creator.create(LayerInfo.LAYER); - Element model = creator.create(LayerInfo.LAYER_MODEL); - Element name = creator.create(LayerInfo.LAYER_NAME); - Element type = creator.create(LayerInfo.LAYER_TYPE); - Element status = creator.create(LayerInfo.LAYER_STATUS); - Element data = creator.create(LayerInfo.LAYER_DATA); - - model.setTextContent(paramType); - name.setTextContent(uuid); - type.setTextContent("POLYGON"); - status.setTextContent("OFF"); - data.setTextContent(POLYGON_NAME); - - layer.appendChild(model); - layer.appendChild(name); - layer.appendChild(type); - layer.appendChild(status); - layer.appendChild(data); - - meta.appendChild(layer); - } - - - public static void writeIsolineMeta( - CallContext context, - Document document, - Element meta, - String uuid, - String path, - String paramType - ) { - XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( - document, - ArtifactNamespaceContext.NAMESPACE_URI, - ArtifactNamespaceContext.NAMESPACE_PREFIX); - - Element layer = creator.create(LayerInfo.LAYER); - Element model = creator.create(LayerInfo.LAYER_MODEL); - Element name = creator.create(LayerInfo.LAYER_NAME); - Element type = creator.create(LayerInfo.LAYER_TYPE); - Element status = creator.create(LayerInfo.LAYER_STATUS); - Element data = creator.create(LayerInfo.LAYER_DATA); - - model.setTextContent(paramType+"_isolines"); - name.setTextContent(uuid); - type.setTextContent("LINE"); - status.setTextContent("OFF"); - data.setTextContent(ISOLINES_NAME); - - layer.appendChild(model); - layer.appendChild(name); - layer.appendChild(type); - layer.appendChild(status); - layer.appendChild(data); - - meta.appendChild(layer); - } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/Pair.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/Pair.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,19 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; import java.io.Serializable; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @param <A> + * @param <B> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public final class Pair<A, B> implements Serializable
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,18 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.net.MalformedURLException; +import java.text.NumberFormat; import java.util.Collection; import java.util.Date; import java.util.HashMap; @@ -33,18 +42,41 @@ import com.vividsolutions.jts.io.WKTReader; import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public final class ShapeFileWriter { private static Logger log = Logger.getLogger( ShapeFileWriter.class); + private static NumberFormat format = NumberFormat.getInstance(); + + /** + * Precision used to format double values. + */ + public static final int DOUBLE_PRECISION = 3; + + static { + format.setMaximumFractionDigits(DOUBLE_PRECISION); + } + private ShapeFileWriter() { } + + /** + * Write multilinestrings to shapefile. + * + * @param shapeFile Shapefile. + * @param parameterId The parameter id. + * @param layer The layer. + * @param date The date. + * @param multiLineStrings The multilinestring. + * @return true, if shapefile writing was successful - otherwise false. + */ public static boolean writeMultiLineStringsToFile( File shapeFile, Integer parameterId, @@ -57,10 +89,22 @@ parameterId, layer, date, - multiLineStrings, + multiLineStrings, "isolines"); } + + /** + * Write multilinestrings to shapefile. + * + * @param shapeFile Shapefile. + * @param parameterId The parameter id. + * @param layer The layer. + * @param date The date. + * @param multiLineStrings The multilinestring. + * @param name A name. + * @return true, if shapefile writing was successful - otherwise false. + */ public static boolean writeMultiLineStringsToFile( File shapeFile, Integer parameterId, @@ -87,15 +131,16 @@ } SimpleFeatureType TYPE; - - try { + + try { TYPE = DataUtilities.createType( name, "geom:MultiLineString:srid=4326," + - "PARAMETER:Integer," + + "PARAMETER:Integer," + "LAYER:Integer," + "DATE:Date," + - "VALUE:Double"); + "VALUE:Double," + + "DESC:String"); } catch (SchemaException se) { log.error(se.getLocalizedMessage(), se); @@ -105,7 +150,7 @@ SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE); - FeatureCollection<SimpleFeatureType, SimpleFeature> collection = + FeatureCollection<SimpleFeatureType, SimpleFeature> collection = FeatureCollections.newCollection(); for (Pair<Object, MultiLineString> pair: multiLineStrings) { @@ -114,6 +159,7 @@ featureBuilder.add(layer); featureBuilder.add(date); featureBuilder.add(pair.getA()); + featureBuilder.add(value2description(asDouble(pair.getA()))); SimpleFeature feature = featureBuilder.buildFeature(null); collection.add(feature); } @@ -143,7 +189,7 @@ featureStore.addFeatures(collection); transaction.commit(); success = true; - } + } catch (IOException ioe) { log.error(ioe.getLocalizedMessage(), ioe); } @@ -161,6 +207,17 @@ return success; } + + /** + * Write multipolygon to file. + * + * @param shapeFile The shapefile. + * @param parameterId The parameter id. + * @param layer The layer. + * @param date The date. + * @param multiPolygons Multipolygons. + * @return true, if shapefile writing was successful - otherwise false. + */ public static boolean writeMultiPolygonsToFile( File shapeFile, Integer parameterId, @@ -169,22 +226,31 @@ Map<Integer, MultiPolygon> multiPolygons ) { return writeMultiPolygonsToFile( - shapeFile, + shapeFile, parameterId, layer, date, - multiPolygons, + multiPolygons, "polygons"); } - - public static String writeDataToFile(File shapeFile, + + /** + * Write data to shapefile. + * + * @param shapeFile The shapefile. + * @param name The name. + * @param data The data. + * @param geometryType The geometry type. + * @return true, if shapefile writing was successful - otherwise false. + */ + public static boolean writeDataToFile(File shapeFile, String name, - Collection<Result> data){ - String geomType = null; - + Collection<Result> data, + String geometryType){ + WKTReader wktReader = new WKTReader(); - + Map<String, Serializable> params = new HashMap<String, Serializable>(); try { @@ -192,7 +258,7 @@ } catch (MalformedURLException mue) { log.error(mue.getLocalizedMessage(), mue); - return null; + return false; } params.put("create spatial index", Boolean.TRUE); @@ -204,31 +270,38 @@ SimpleFeatureType type = null; SimpleFeatureBuilder featureBuilder = null; - FeatureCollection<SimpleFeatureType, SimpleFeature> collection = + FeatureCollection<SimpleFeatureType, SimpleFeature> collection = FeatureCollections.newCollection(); - + int j = 0; for (Result result: data) { + j++; try { Geometry g = wktReader.read(result.getString(0)); + ResultDescriptor rd = result.getResultDescriptor(); + int columns = rd.getColumnCount(); if (type == null){ - try { - geomType = g.getGeometryType().toUpperCase(); - type = DataUtilities.createType( - name, - "geom:"+g.getGeometryType()+":srid=4326"); - // TODO add other AttributeTypes + try { + String schema = "geom:"+geometryType+":srid=4326"; + for (int i = 1; i < columns; i++){ + schema+=","+rd.getColumnName(i)+ + ":"+rd.getColumnClassName(i); + } + type = DataUtilities.createType(name, schema); } catch (SchemaException se) { log.error(se.getLocalizedMessage(), se); - return null; + return false; } featureBuilder = new SimpleFeatureBuilder(type); } featureBuilder.add(g); + for (int i = 1; i < columns; i++){ + featureBuilder.add(result.getObject(i)); + } SimpleFeature feature = featureBuilder.buildFeature(null); collection.add(feature); } catch (ParseException e) { - log.error(e,e); + log.error("cannot create geometry "+j+" for "+result.getString(0)); } catch (java.lang.IllegalArgumentException e){ log.error("cannot create geometry for "+result.getString(0)); } @@ -259,7 +332,7 @@ featureStore.addFeatures(collection); transaction.commit(); success = true; - } + } catch (IOException ioe) { log.error(ioe.getLocalizedMessage(), ioe); } @@ -274,10 +347,21 @@ } } - return geomType; - + return true; } - + + + /** + * Write multipolygons to file. + * + * @param shapeFile The shapefile. + * @param parameterId The parameter id. + * @param layer The layer. + * @param date The date. + * @param multiPolygons Multipolygons. + * @param name A name. + * @return true, if shapefile writing was successful - otherwise false. + */ public static boolean writeMultiPolygonsToFile( File shapeFile, Integer parameterId, @@ -304,12 +388,12 @@ } SimpleFeatureType TYPE; - - try { + + try { TYPE = DataUtilities.createType( name, "geom:MultiPolygon:srid=4326," + - "PARAMETER:Integer," + + "PARAMETER:Integer," + "LAYER:Integer," + "DATE:Date," + "CLASS:Integer"); @@ -322,7 +406,7 @@ SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE); - FeatureCollection<SimpleFeatureType, SimpleFeature> collection = + FeatureCollection<SimpleFeatureType, SimpleFeature> collection = FeatureCollections.newCollection(); for (Map.Entry<Integer, MultiPolygon> entry: @@ -362,7 +446,7 @@ featureStore.addFeatures(collection); transaction.commit(); success = true; - } + } catch (IOException ioe) { log.error(ioe.getLocalizedMessage(), ioe); } @@ -380,6 +464,13 @@ return success; } + /** + * Returns an object as Double. + * + * @param a An object. + * @return Object <i>a</i> as Double. If <i>a</i> is not a double and no + * number, 0d is returned. + */ private static final Double asDouble(Object a) { if (a instanceof Double) { return (Double)a; @@ -389,5 +480,16 @@ } return 0d; } + + /** + * Turns a double value into a string representation taking account of the + * locale. + * + * @param value A double value. + * @return The double value formatted as string. + */ + private static final String value2description(Double value) { + return format.format(value); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/StringUtils.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/StringUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,30 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; /** - * @author Sascha L. Teichmann <sascha.teichmann@intevation.de> + * Helper class which supports some methods for working with strings. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public final class StringUtils { private StringUtils() { } + /** + * Append a string to a string array. + * + * @param haystack String array. + * @param straw String to append. + * @return the new string array. + */ public static final String [] append(String [] haystack, String straw) { if (haystack == null) { return new String [] { straw }; @@ -18,6 +35,13 @@ return nhaystack; } + /** + * Checks the existence of a string in a given string array. + * + * @param haystack String array. + * @param needle String for being checked. + * @return true, if the string is contained in <i>haystack</i> - else false. + */ public static final boolean contains(String [] haystack, String needle) { if (haystack == null) { return false; @@ -42,4 +66,4 @@ return false; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.utils; + +import de.intevation.artifacts.CallContext; + +import de.intevation.gnv.chart.Chart; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.DefaultHistogram; + +import de.intevation.gnv.geobackend.base.DefaultResult; +import de.intevation.gnv.geobackend.base.DefaultResultDescriptor; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.geobackend.base.ResultDescriptor; + +import de.intevation.gnv.histogram.HistogramHelper; + +import de.intevation.gnv.state.describedata.KeyValueDescibeData; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.apache.log4j.Logger; + +import org.jfree.chart.ChartTheme; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public final class VectorDataProcessor { + + private static Logger logger = Logger.getLogger(VectorDataProcessor.class); + + public static Collection<Result> process( + Collection<Result> input, String[] columnNames) + { + logger.info("Process vector data (" + input.size() + " items)"); + + ResultDescriptor outDescriptor = initResultDescriptor(columnNames); + ResultDescriptor inDescriptor = null; + int[] inIndices = null; + int columns = -1; + + Map series = new HashMap(); + + // for each result of the incoming result + for (Result result: input) { + if (inDescriptor == null || inIndices == null) { + inDescriptor = result.getResultDescriptor(); + inIndices = inDescriptor.getColumnIndices(columnNames); + columns = inDescriptor.getColumnCount(); + } + + // for each column of the incoming result object + for (int i = 0; i < columns; i++) { + String name = inDescriptor.getColumnName(i); + + if (!StringUtils.contains(columnNames, name)) { + List list = (List) series.get(name); + if (list == null) + list = new ArrayList(); + + Result out = new DefaultResult(outDescriptor); + Object value = result.getObject(i); + + // skipp results that have no data value + if (value == null) + continue; + + out.addColumnValue(0, value); + + // add meta data to result object + // TODO: Maybe we could do this one single time, because the + // TODO: meta data will not change + for (int j = 1; j < inIndices.length -1; j++) { + out.addColumnValue(j, result.getObject(inIndices[j])); + } + + // add the name of the component to distinguish between + // different series later in the chart creation + out.addColumnValue(inIndices.length-1, name); + + list.add(out); + series.put(name, list); + } + } + } + + // finally, we put all lists together + Iterator iter = series.values().iterator(); + List output = new ArrayList(); + while (iter.hasNext()) { + output.addAll((Collection)iter.next()); + } + + logger.info("Data processing created " + output.size() + " elements."); + return output; + } + + + public static ResultDescriptor initResultDescriptor(String[] columnNames) { + logger.debug("Init ResultDescriptor for outgoing results."); + + ResultDescriptor desc = new DefaultResultDescriptor(); + + for (String name: columnNames) { + desc.addColumn(name, "java.lang.String"); + } + + logger.debug("Outgoing ResultDescriptor has " + desc.getColumnCount() + + " columns"); + return desc; + } + + + public static Chart[] getHistograms( + String uuid, + CallContext callContext, + Collection<KeyValueDescibeData> results, + ChartTheme theme, + Map requestParameter + ) { + Locale locale = (Locale) requestParameter.get("locale"); + + Object[][] data = HistogramHelper.prepareVectorialHistogramData(results); + int size = data.length; + + Chart[] histograms = new Chart[size]; + + for (int i = 0; i < size; i++) { + ChartLabels labels = HistogramHelper.createHistogramLabels( + uuid, callContext, locale, data[i]); + + histograms[i] = new DefaultHistogram( + labels, data[i], theme, requestParameter); + } + + return histograms; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/WKTUtils.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/WKTUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.utils; import com.vividsolutions.jts.geom.Coordinate; @@ -37,6 +45,11 @@ import org.apache.log4j.Logger; +/** + * A helper class which supports some useful methods to work with wkt strings. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ public abstract class WKTUtils { private static Logger log = Logger.getLogger(WKTUtils.class); @@ -59,6 +72,14 @@ public static final String DEFAULT_COORDINATE_TEMPLATE = "{0}\u00b0N {1}'' {2}\u00b0E {3}''"; + /** + * Checks the difference of two <code>Result</code>s. + * + * @param a A Result. + * @param b Another Result. + * @param indices Indices to be checked. + * @return true, if <i>a</i> and <i>b</i> are different - otherwise false. + */ public static boolean different(Result a, Result b, int [] indices) { for (int i = 0; i < indices.length; ++i) { String oa = a.getString(indices[i]); @@ -79,6 +100,12 @@ return false; } + /** + * Turns a wkt string into a coordinate. + * + * @param shape A wkt string. + * @return wkt string as coordinate. + */ public static Coordinate toCoordinate(String shape) { try { return shape != null @@ -94,6 +121,12 @@ return null; } + /** + * Turns a wkt string into a polygon. + * + * @param shape A wkt string. + * @return wkt string as polygon. + */ public static Polygon toPolygon(String shape) { try { return (Polygon)new WKTReader().read(shape); @@ -107,11 +140,23 @@ return null; } + /** + * Returns a distance in km. + * + * @param distance A distance. + * @return distance in km. + */ public static final double toKM(double distance) { return (distance * NAUTICAL_MILE) / KILOMETER; } + /** + * Turns a coordinate into a wkt string. + * + * @param coordinate A coordinate. + * @return the coordinate as wkt string. + */ public static String toWKT(Coordinate coordinate) { StringBuilder sb = new StringBuilder("POINT("); sb.append(coordinate.x) @@ -121,8 +166,9 @@ return sb.toString(); } + public static final String indexBox( - java.awt.Point a, + java.awt.Point a, java.awt.Point b, String iName, String jName @@ -173,7 +219,7 @@ new ArrayList<Object []>(); createIJKPoints(coords, meshid, ijkQueryID, points, missingPoints); - + String additionWhere = null; if (missingPoints.size() == coords.length) { @@ -211,7 +257,7 @@ ArrayList<Object []> missingPoints = new ArrayList<Object []>(); createIJKPoints(coords, meshid, ijkQueryID, points, missingPoints); - + String additionWhere = TRUE_EXPRESSION; if (missingPoints.size() == coords.length) { @@ -224,8 +270,8 @@ if (!remainsMissingPoints) { // TODO: Make Tablenames and Columns Configurable IndexBuffer ib = new IndexBuffer( - points, - I_NAME, + points, + I_NAME, J_NAME ); additionWhere = ib.toWhereClause(); log.debug("Additional Where Clause = "+additionWhere); @@ -310,14 +356,14 @@ List<java.awt.Point> points, ArrayList<Object []> missingPoints ) - throws QueryException + throws QueryException { boolean debug = log.isDebugEnabled(); QueryExecutor queryExecutor = QueryExecutorFactory .getInstance() .getQueryExecutor(); - + for (int i = 0; i < coords.length; i++) { String wkt = toWKT(coords[i]); @@ -360,10 +406,46 @@ return null; } + /** + * Turns a wkt coordinate into a string format using the default locale of + * the virtual machine. + * + * @param wkt A wkt coordinate. + * @return A formatted coordinate. + */ public static String toText(String wkt) { return toText(Locale.getDefault(), wkt); } + /** + * Turns a point into a string format using the default locale of the + * virtual machine. + * + * @param p A point. + * @return A point formatted as string. + */ + public static String toText(Point p) { + return toText(Locale.getDefault(), toWKT(p.getCoordinate())); + } + + /** + * Turns a point into a string format using a given locale. + * + * @param locale A locale. + * @param p A point. + * @return a point formatted as string. + */ + public static String toText(Locale locale, Point p) { + return toText(locale, toWKT(p.getCoordinate())); + } + + /** + * Turns a wkt coordiante into a formatted text using a given locale. + * + * @param locale A locale. + * @param wkt A wkt coordinate. + * @return a formatted coordinate. + */ public static String toText(Locale locale, String wkt) { String formattedCoordinate = null; try { @@ -420,3 +502,4 @@ return null; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/exception/ValidationException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/exception/ValidationException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,15 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.utils.exception; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ValidationException extends Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Exception classes used by helper classes in the utils package. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides some helper classes used across the whole software. +</body> +</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/wms/LayerInfo.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/wms/LayerInfo.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,68 +1,209 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.wms; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This class is used to store some meta information about a layer (e.g. a WMS + * layers). + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class LayerInfo { + /** + * Constant field <code>LAYER</code> + */ public static final String LAYER = "layer"; + + /** + * Constant field <code>LAYER_MODEL</code> + */ public static final String LAYER_MODEL = "model"; + + /** + * Constant field <code>LAYER_NAME</code> + */ public static final String LAYER_NAME = "name"; + + /** + * Constant field <code>LAYER_TYPE</code> + */ public static final String LAYER_TYPE = "type"; + + /** + * Constant field <code>LAYER_DATA</code> + */ public static final String LAYER_DATA = "data"; + + /** + * Constant field <code>LAYER_STATUS</code> + */ public static final String LAYER_STATUS = "status"; + /** + * Constant field <code>LAYER_TITLE</code> + */ + public static final String LAYER_TITLE = "title"; + + /** + * Field storing the layer name. + */ private String name; + + /** + * Field storing the layer title. + */ + private String title; + + /** + * Field storing the layer type. + */ private String type; + + /** + * Field storing the layer data. + */ private String data; + + /** + * Field storing the layer status. + */ private String status; + + /** + * Field storing the layer model. + */ private String model; + /** + * Constructs an empty object. All parameters should be set via setter + * methods. + */ public LayerInfo() { } + /** + * Set {@link #data} to data. + * + * @param data + */ public void setData(String data) { this.data = data; } + /** + * Get {@link #data} + * + * @return data + */ public String getData() { return data; } + /** + * Set {@link #name} to name. + * + * @param name + */ public void setName(String name) { this.name = name; } + /** + * Get {@link #name} + * + * @return name + */ public String getName() { return name; } + /** + * Set {@link #title} to title. + * + * @param title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Get {@link #title} + * + * @return title + */ + public String getTitle() { + return title; + } + + /** + * Set {@link #model} to model. + * + * @param model + */ public void setModel(String model) { this.model = model; } + /** + * Get {@link #model} + * + * @return model + */ public String getModel() { return model; } + /** + * Set {@link #type} to type. + * + * @param type + */ public void setType(String type) { this.type = type; } + /** + * Get {@link #type} + * + * @return type + */ public String getType() { return type; } + /** + * Set {@link #status} to status. + * + * @param status + */ public void setStatus(String status) { this.status = status; } + /** + * Get {@link #status} + * + * @return status + */ public String getStatus() { return status; } + /** + * A <code>LayerInfo</code> object is emtpy if name, data, type and status + * are null. + * + * @return True, if this object is empty - otherwise false. + */ public boolean isEmpty() { if (name == null && data == null && type == null && status == null) return true; @@ -70,6 +211,11 @@ return false; } + /** + * A <code>LayerInfo</code> object is broken if name, data or type are null. + * + * @return True, if this object is broken - otherwise false. + */ public boolean isBroken() { if (name == null || data == null || type == null) return true; @@ -77,3 +223,4 @@ return false; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/wms/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Classes used while generating mapfiles. +</body> +</html>
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/resources/lang/artifactMessages.properties Fri Sep 28 12:15:21 2012 +0200 @@ -16,6 +16,7 @@ fis_icestations = Ice Station Report fis_nauthis = Nauthis fis_contis=Contis +fis_marinefeatures = Marine Features meshid= Mesh fis = Data set @@ -26,6 +27,7 @@ horizontalProfileCross = Horizontales Schnittprofil horizontalCrossSection = Horizontal cross-section verticalcrosssection = Vertical cross-section +verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt layer = Layer featureid = Station mesh_coordinate = Geographic position (e.g. 56n30 6e20) @@ -61,6 +63,9 @@ coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0E {3}'' coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}'' coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}'' +vectorscalar = Vector / Scalar values +vectorvalues = Vector values +scalarvalues = Scalar values chart.timeseries.date.format=yyyy-MMM-dd chart.timeseries.title.xaxis=Time [UTC] @@ -69,3 +74,14 @@ chart.verticalcrosssection.title.yaxis=Depth [m] chart.horizontalprofile.title.xaxis=Distance [km] chart.horizontalcrosssection.title.xaxis=Latitude [m] + +histogram.axis.range.title=Absolute Frequency + +# error messages +no.input.data= No Entry was chosen. Please select at least one entry. +input.is.not.valid=Invalid input. Please try again. +input.is.not.valid.date.required=Invalid input. A date is required. Please try again. +input.is.not.valid.minmax=Input is not valid for this state. +start.date.after.end.date=Start date lies after end date. Please try again. +date.out.of.range=Date is out of range. +missing.data.field=Can't validate selected date. Missing date, lower or upper date bound.
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties Fri Sep 28 12:15:21 2012 +0200 @@ -16,6 +16,7 @@ fis_icestations = Eismeldungen fis_nauthis = Nauthis fis_contis=Contis +fis_marinefeatures = Marine Basisdaten fis = Fachinformationssystem product= Produkt @@ -25,6 +26,7 @@ horizontalProfileCross = Horizontales Schnittprofil horizontalCrossSection = Horizontalschnitt verticalcrosssection = Profilschnitt +verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt layer = Layer featureid = Station meshid= Datengitter @@ -61,6 +63,9 @@ coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0O {3}'' coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}'' coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}'' +vectorscalar = Vektorielle / Skalare Werte +vectorvalues = Vektorielle Werte +scalarvalues = Skalare Werte chart.timeseries.date.format=dd-MMM-yyyy chart.timeseries.title.xaxis=Zeit [UTC] @@ -69,3 +74,14 @@ chart.verticalcrosssection.title.yaxis=Tiefe [m] chart.horizontalprofile.title.xaxis=Distanz [km] chart.horizontalcrosssection.title.xaxis=Ausdehnung [m] + +histogram.axis.range.title=Absolute H\u00e4ufigkeit + +# error messages +no.input.data=Es wurde kein Eintrag ausgew\u00e4hlt. Bitte w\u00e4hlen sie mindestens einen Eintrag aus. +input.is.not.valid=Ung\u00fcltige Eingabe. Bitte versuchen Sie es erneut. +input.is.not.valid.date.required=Ung\u00fcltige Eingabe. Ein Datum wird ben\u00f6tigt. Bitte versuchen Sie es erneut. +input.is.not.valid.minmax=Die get\u00e4tigte Eingabe ist ung\u00fctig. +start.date.after.end.date=Anfangsdatum liegt hinter dem Enddatum. Bitte versuchen Sie es erneut. +date.out.of.range=Das gew\u00e4hlte Datum liegt au\u00dferhalb des gültigen Wertebereiches. +missing.data.field=Validierung der Datumseingabe nicht m\u00f6glich. Datum, obere oder untere Grenze fehlt.
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties Fri Sep 28 12:15:21 2012 +0200 @@ -16,6 +16,7 @@ fis_icestations = Eismeldungen fis_nauthis = Nauthis fis_contis=Contis +fis_marinefeatures = Marine Basisdaten fis= Fachinformationssystem product= Produkt @@ -25,6 +26,7 @@ horizontalProfileCross = Horizontales Schnittprofil horizontalCrossSection = Horizontalschnitt verticalcrosssection = Profilschnitt +verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt layer = Layer featureid = Station meshid= Datengitter @@ -61,6 +63,9 @@ coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0O {3}'' coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}'' coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}'' +vectorscalar = Vektorielle / Skalare Werte +vectorvalues = Vektorielle Werte +scalarvalues = Skalare Werte chart.timeseries.date.format=dd-MMM-yyyy chart.timeseries.title.xaxis=Zeit [UTC] @@ -69,3 +74,14 @@ chart.verticalcrosssection.title.yaxis=Tiefe [m] chart.horizontalprofile.title.xaxis=Distanz [km] chart.horizontalcrosssection.title.xaxis=Ausdehnung [m] + +histogram.axis.range.title=Absolute H\u00e4ufigkeit + +# error messages +no.input.data=Es wurde kein Eintrag ausgew\u00e4hlt. Bitte w\u00e4hlen sie mindestens einen Eintrag aus. +input.is.not.valid=Ung\u00fcltige Eingabe. Bitte versuchen Sie es erneut. +input.is.not.valid.date.required=Ung\u00fcltige Eingabe. Ein Datum wird ben\u00f6tigt. Bitte versuchen Sie es erneut. +input.is.not.valid.minmax=Die get\u00e4tigte Eingabe ist ung\u00fctig. +start.date.after.end.date=Anfangsdatum liegt nach dem Enddatum. Bitte versuchen Sie es erneut. +date.out.of.range=Das gew\u00e4hlte Datum liegt au\u00dferhalb des gültigen Wertebereiches. +missing.data.field=Validierung der Datumseingabe nicht m\u00f6glich. Datum, obere oder untere Grenze fehlt.
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties Fri Sep 28 12:15:21 2012 +0200 @@ -16,6 +16,7 @@ fis_icestations = Ice Station Report fis_nauthis = Nauthis fis_contis=Contis +fis_marinefeatures = Marine Features meshid= Mesh fis = Data set @@ -26,6 +27,7 @@ horizontalProfileCross = Horizontales Schnittprofil horizontalCrossSection = Horizontal cross-section verticalcrosssection = Vertical cross-section +verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt layer = Layer featureid = Station mesh_coordinate = Geographic position (e.g. 56n30 6e20) @@ -61,6 +63,9 @@ coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0E {3}'' coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}'' coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}'' +vectorscalar = Vector / Scalar values +vectorvalues = Vector values +scalarvalues = Scalar values chart.timeseries.date.format=yyyy-MMM-dd @@ -70,3 +75,14 @@ chart.verticalcrosssection.title.yaxis=Depth [m] chart.horizontalprofile.title.xaxis=Distance [km] chart.horizontalcrosssection.title.xaxis=Latitude [m] + +histogram.axis.range.title=Absolute Frequency + +# error messages +no.input.data= No Entry was chosen. Please select at least one entry. +input.is.not.valid=Invalid input. Please try again. +input.is.not.valid.date.required=Invalid input. A date is required. Please try again. +input.is.not.valid.minmax=Input is not valid for this state. +start.date.after.end.date=Start date lies after end date. Please try again. +date.out.of.range=Date is out of range. +missing.data.field=Can't validate selected date. Missing date, lower or upper date bound.
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,26 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifactdatabase.DefaultCallMeta; +import de.intevation.artifactdatabase.DefaultPreferredLocale; +import de.intevation.artifactdatabase.FactoryBootstrap; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.PreferredLocale; + +import de.intevation.gnv.utils.ArtifactXMLUtilities; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileNotFoundException; @@ -17,22 +35,13 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; + import org.w3c.dom.Document; + import org.xml.sax.SAXException; -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.DefaultCallMeta; -import de.intevation.artifactdatabase.DefaultPreferredLocale; -import de.intevation.artifactdatabase.FactoryBootstrap; -import de.intevation.artifacts.Artifact; -import de.intevation.artifacts.ArtifactFactory; -import de.intevation.artifacts.CallContext; -import de.intevation.artifacts.CallMeta; -import de.intevation.artifacts.PreferredLocale; -import de.intevation.gnv.utils.ArtifactXMLUtilities; - /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public abstract class GNVArtifactsTestCaseBase extends TestCase { @@ -46,11 +55,11 @@ BasicConfigurator.configure(); log = Logger.getLogger(GNVArtifactsTestCaseBase.class); } - + private String configurationDir = "doc/conf"; protected FactoryBootstrap bootstrap = null; - + /** * Constructor */ @@ -64,7 +73,7 @@ public GNVArtifactsTestCaseBase(String name) { super(name); } - + public abstract void testArtifact(); /** * @see junit.framework.TestCase#setUp() @@ -78,7 +87,7 @@ bootstrap = new FactoryBootstrap(); bootstrap.boot(); } - + protected void writeDocument2Log(Document document) { log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); } @@ -109,7 +118,7 @@ throw new Exception(message); } } - + /** * @return */ @@ -139,7 +148,7 @@ this.check4ExceptionReport(outputData); } - + protected void createFile(byte[] content, String fileName) { try { FileOutputStream fos = new FileOutputStream(new File(fileName)); @@ -179,8 +188,9 @@ protected Artifact createArtifact(ArtifactFactory artifactFactory) { Document setupData = null; Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), + "" + System.currentTimeMillis(), bootstrap.getContext(), + null, setupData); assertNotNull(artifact); log.debug("Artifact is available");
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestSuite.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestSuite.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts; import junit.framework.Test;
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,32 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class InstantaneousPointHorizontalProfileTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(InstantaneousPointHorizontalProfileTestCase.class); - + /** * Constructor */ @@ -48,23 +54,23 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("VerticalProfile-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml"); - + int steps = 9; - + for (int i = 0; i < steps; i++){ - + this.doNextStep( artifact, cc, "src/test/ressources/horizontalProfile_instantaneouspoint/" + "horizontalprofile_step_0"+i+"_feed.xml", "src/test/ressources/horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_0"+i+"_advance.xml", + "horizontalprofile_step_0"+i+"_advance.xml", describeDocument); }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,32 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class InstantaneousPointVerticalProfileTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(InstantaneousPointVerticalProfileTestCase.class); - + /** * Constructor */ @@ -47,14 +53,14 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("VerticalProfile-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_describe.xml"); - + int steps = 5; - + for (int i = 1; i <= steps; i++){ this.doNextStep( artifact, @@ -62,7 +68,7 @@ "src/test/ressources/verticalprofile_instantaneouspoint/" + "verticalprofile_step_0"+i+"_feed.xml", "src/test/ressources/verticalprofile_instantaneouspoint/" + - "verticalprofile_step_0"+i+"_advance.xml", + "verticalprofile_step_0"+i+"_advance.xml", describeDocument); }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,32 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MeshHorizontalCrossSectionTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(MeshHorizontalCrossSectionTestCase.class); - + /** * Constructor */ @@ -47,13 +53,13 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_describe.xml"); int steps = 8; - + for (int i = 1; i <= steps; i++){ this.doNextStep( artifact, @@ -61,10 +67,10 @@ "src/test/ressources/horizontalcrosssection_mesh/" + "horizontalcrosssection_step_0"+i+"_feed.xml", "src/test/ressources/horizontalcrosssection_mesh/" + - "horizontalcrosssection_step_0"+i+"_advance.xml", + "horizontalcrosssection_step_0"+i+"_advance.xml", describeDocument); } - + Document outputData = artifact.describe(describeDocument,cc); FileOutputStream fos = null; FileOutputStream fos2 = null;
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MeshHorizontalProfileTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(MeshHorizontalProfileTestCase.class); - + /** * Constructor */ @@ -47,14 +53,14 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("VerticalProfile-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_describe.xml"); - + int steps = 11; - + for (int i = 1; i <= steps; i++){ String number = ""+i; if (i < 10){ @@ -66,10 +72,10 @@ "src/test/ressources/horizontalProfile_mesh/" + "horizontalprofile_step_"+number+"_feed.xml", "src/test/ressources/horizontalProfile_mesh/" + - "horizontalprofile_step_"+number+"_advance.xml", + "horizontalprofile_step_"+number+"_advance.xml", describeDocument); } - + Document outputData = artifact.describe(describeDocument,cc); FileOutputStream fos = null; FileOutputStream fos2 = null;
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MeshTimeSeriesTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(MeshTimeSeriesTestCase.class); - + /** * Constructor */ @@ -46,15 +52,15 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("TimeSeriesMesh-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/timeseries_mesh/timeseries_describe.xml"); - + int steps = 8; - + for (int i = 1; i <= steps; i++){ this.doNextStep( artifact, @@ -62,7 +68,7 @@ "src/test/ressources/timeseries_mesh/" + "timeseries_step_0"+i+"_feed.xml", "src/test/ressources/timeseries_mesh/" + - "timeseries_step_0"+i+"_advance.xml", + "timeseries_step_0"+i+"_advance.xml", describeDocument); } // Achter Schritt
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MeshVerticalCrossSectionTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(MeshVerticalCrossSectionTestCase.class); - + /** * Constructor */ @@ -47,26 +53,26 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("VerticalProfile-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_describe.xml"); - + int steps = 7; - + for (int i = 1; i <= steps; i++){ - + this.doNextStep( artifact, cc, "src/test/ressources/verticalcrosssection_mesh/" + "verticalcrosssection_step_0"+i+"_feed.xml", "src/test/ressources/verticalcrosssection_mesh/" + - "verticalcrosssection_step_0"+i+"_advance.xml", + "verticalcrosssection_step_0"+i+"_advance.xml", describeDocument); } - + Document outputData = artifact.describe(describeDocument,cc); FileOutputStream fos = null; FileOutputStream fos2 = null; @@ -75,7 +81,7 @@ fos = new FileOutputStream( "src/test/results/verticalcrosssection_mesh" + System.currentTimeMillis() + ".png"); - + fos2 = new FileOutputStream( "src/test/results/verticalcrosssection_mesh" + System.currentTimeMillis() + ".csv"); @@ -95,7 +101,7 @@ // "verticalcrosssection_mesh/" + // "verticalcrosssection_step_0"+steps+"_out_odv.xml"), // fos3,cc); - + } catch (Exception e) { log.error(e, e); fail();
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,31 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class MeshVerticalProfileTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(MeshVerticalProfileTestCase.class); - + /** * Constructor */ @@ -46,16 +52,16 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("VerticalProfile-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/" + "verticalprofile_mesh/" + "verticalprofile_describe.xml"); - + int steps = 11; - + for (int i = 1; i <= steps; i++){ String number = ""+i; if (i < 10){ @@ -67,7 +73,7 @@ "src/test/ressources/verticalprofile_mesh/" + "verticalprofile_step_"+number+"_feed.xml", "src/test/ressources/verticalprofile_mesh/" + - "verticalprofile_step_"+number+"_advance.xml", + "verticalprofile_step_"+number+"_advance.xml", describeDocument); } // 10. Schritt
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,17 +1,23 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import org.w3c.dom.Document; - +import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactDatabase; import de.intevation.artifacts.ArtifactDatabaseException; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallMeta; +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class TestArtifactDatabase implements ArtifactDatabase { @@ -44,7 +50,7 @@ /** * @see de.intevation.artifacts.ArtifactDatabase#createArtifactWithFactory(java.lang.String, de.intevation.artifacts.CallMeta, org.w3c.dom.Document) */ - public Document createArtifactWithFactory(String factory, + public Document createArtifactWithFactory(String factory, CallMeta callMeta, Document data) throws ArtifactDatabaseException { @@ -80,13 +86,26 @@ /** * @see de.intevation.artifacts.ArtifactDatabase#out(java.lang.String, org.w3c.dom.Document, de.intevation.artifacts.CallMeta) */ - public DeferredOutput out(String artifact, Document format, - CallMeta callMeta) - throws ArtifactDatabaseException { + public DeferredOutput out( + String artifact, + Document format, + CallMeta callMeta) + throws ArtifactDatabaseException { return null; } + public DeferredOutput out( + String artifact, + String type, + Document format, + CallMeta callMeta) + throws ArtifactDatabaseException + { + return null; + + } + public Document process(String service, Document input, CallMeta callMeta) { return null; } @@ -95,4 +114,267 @@ return null; } + public Document exportArtifact(String artifact, CallMeta callMeta) throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Document importArtifact(Document data, CallMeta callMeta) throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + + public void loadAllArtifacts(ArtifactLoadedCallback callback) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Artifact getRawArtifact(String identifier) + throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + + + // COLLECTION API + + public Document setCollectionTTL(String collectionId, Document doc, CallMeta meta) + throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Document setCollectionName(String collectionId, Document doc, CallMeta meta) + throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + + public DeferredOutput outCollection(String collectionId, Document format, CallMeta callMeta) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public DeferredOutput outCollection(String collectionId, String type, Document format, CallMeta callMeta) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param meta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document getCollectionsMasterArtifact( + String collectionId, + CallMeta meta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param userId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document listCollections(String userId, CallMeta callMeta) + throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param ownerId + * @param data + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document createCollection( + String ownerId, + Document data, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document deleteCollection(String collectionId, CallMeta callMeta) + throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document describeCollection(String collectionId, CallMeta callMeta) + throws ArtifactDatabaseException { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document getCollectionAttribute( + String collectionId, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Document setCollectionAttribute( + String collectionId, + CallMeta callMeta, + Document attribute) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param artifactId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document getCollectionItemAttribute( + String collectionId, + String artifactId, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param artifactId + * @param attribute + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document setCollectionItemAttribute( + String collectionId, + String artifactId, + Document attribute, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param artifactId + * @param input + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document addCollectionArtifact( + String collectionId, + String artifactId, + Document input, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param artifactId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document removeCollectionArtifact( + String collectionId, + String artifactId, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + /** + * @param collectionId + * @param callMeta + * + * @throws ArtifactDatabaseException + * + * @return + */ + public Document listCollectionArtifacts( + String collectionId, + CallMeta callMeta + ) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + + public Document listUsers(CallMeta callMeta) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Document createUser(Document data, CallMeta callMeta) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Document deleteUser(String userId, CallMeta callMeta) + throws ArtifactDatabaseException + { + throw new UnsupportedOperationException("Not supported yet."); + } }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestCallContext.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestCallContext.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,26 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; +import java.util.List; +import java.util.LinkedList; + import de.intevation.artifacts.ArtifactDatabase; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.DataProvider; +import de.intevation.artifacts.Message; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class TestCallContext implements CallContext { @@ -23,8 +33,8 @@ /** * Constructor */ - public TestCallContext(Object globalContext, - CallMeta callMeta, + public TestCallContext(Object globalContext, + CallMeta callMeta, ArtifactFactory artifactFactory) { this.globalContext = globalContext; this.callMeta = callMeta; @@ -43,6 +53,14 @@ public void afterCall(int action) { } + public boolean isInBackground() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void addBackgroundMessage(Message msg) { + throw new UnsupportedOperationException("Not supported yet."); + } + /** * @see de.intevation.artifacts.CallContext#globalContext() */ @@ -65,4 +83,20 @@ public ArtifactDatabase getDatabase() { return this.artifactDatabase; } + + public Long getTimeToLive() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Object registerDataProvider(Object key, DataProvider provider) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public List<DataProvider> getDataProvider(Object key) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public LinkedList<Message> getBackgroundMessages() { + throw new UnsupportedOperationException("Not supported yet."); + } }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,29 +1,35 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class TimeSeriesPointTimeSeriesTestCase extends GNVArtifactsTestCaseBase { - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(TimeSeriesPointTimeSeriesTestCase.class); - + /** * Constructor */ @@ -50,29 +56,29 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("TimeSeries-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); - + CallContext cc = createCallContext(artifactFactory); - + // Erster Schritt - + Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml"); - + int steps = 6; - + for (int i = 1; i <= steps; i++){ - + this.doNextStep( artifact, cc, "src/test/ressources/timeseries/" + "timeseries_step_0"+i+"_feed.xml", "src/test/ressources/timeseries/" + - "timeseries_step_0"+i+"_advance.xml", + "timeseries_step_0"+i+"_advance.xml", describeDocument); } - + Document outputData = artifact.describe(describeDocument,cc); FileOutputStream fos = null; FileOutputStream fos2 = null; @@ -91,7 +97,7 @@ fos4 = new FileOutputStream("src/test/results/timeseries" + System.currentTimeMillis() + ".odv"); - + artifact.out(this .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"), fos, cc);
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,32 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts; -import java.io.FileOutputStream; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.CallContext; +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class TimeSeriesPointVerticalProfileTestCase extends GNVArtifactsTestCaseBase { private static Logger log = Logger.getLogger(TimeSeriesPointVerticalProfileTestCase.class); - + /** * Constructor */ @@ -47,14 +53,14 @@ .getArtifactFactory(artefactName); assertNotNull(artifactFactory); log.debug("VerticalProfile-ArtifactFactory is available"); - + Artifact artifact = createArtifact(artifactFactory); CallContext cc = createCallContext(artifactFactory); Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml"); int steps = 7; - + for (int i = 1; i <= steps; i++){ this.doNextStep( artifact, @@ -62,7 +68,7 @@ "src/test/ressources/verticalprofile/" + "verticalprofile_step_0"+i+"_feed.xml", "src/test/ressources/verticalprofile/" + - "verticalprofile_step_0"+i+"_advance.xml", + "verticalprofile_step_0"+i+"_advance.xml", describeDocument); }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/ressource/RessourceFactoryTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/ressource/RessourceFactoryTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,25 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts.ressource; +import de.intevation.artifactdatabase.DefaultPreferredLocale; + +import de.intevation.artifacts.PreferredLocale; + import junit.framework.TestCase; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import de.intevation.artifactdatabase.DefaultPreferredLocale; -import de.intevation.artifacts.PreferredLocale; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class RessourceFactoryTestCase extends TestCase { /** @@ -25,7 +34,7 @@ /** * Constructor - * + * * @param name */ public RessourceFactoryTestCase(String name) {
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/DistanceCalculatorTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/DistanceCalculatorTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifacts.util; import com.vividsolutions.jts.geom.Coordinate; @@ -13,17 +21,17 @@ public DistanceCalculatorTestCase(String name) { super(name); } - + public void testDistanceCalculator(){ - + GeometryFactory gf = new GeometryFactory(); - + // Distance between Berlin and Tokio Point p1 = gf.createPoint(new Coordinate(13.4000, 52.5167)); Point p2 = gf.createPoint(new Coordinate(139.7667, 35.7000)); - + double s = new DistanceCalculator().calculateDistance(p1, p2); - + assertEquals(8941.201227763724, s); }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,10 +1,23 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifacts.util; +import com.vividsolutions.jts.geom.MultiLineString; + +import com.vividsolutions.jts.io.WKTReader; + +import de.intevation.gnv.utils.Pair; +import de.intevation.gnv.utils.ShapeFileWriter; + import java.io.File; import java.io.FileReader; + import java.util.ArrayList; import java.util.Date; @@ -13,14 +26,8 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import com.vividsolutions.jts.geom.MultiLineString; -import com.vividsolutions.jts.io.WKTReader; - -import de.intevation.gnv.utils.Pair; -import de.intevation.gnv.utils.ShapeFileWriter; - /** - * @author Tim Englich <tim.englich@intevation.de> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ShapeFileWriterTestCase extends TestCase { @@ -34,7 +41,7 @@ BasicConfigurator.configure(); log = Logger.getLogger(ShapeFileWriterTestCase.class); } - + /** * Constructor * @param name @@ -42,10 +49,10 @@ public ShapeFileWriterTestCase(String name) { super(name); } - - + + public void testMultiLineStringWriter(){ - + try { String wkt = "MULTILINESTRING ((10 10, 20 20),(15 15, 30 15))"; String wkt1 = "MULTILINESTRING ((10 5, 20 20),(15 15, 30 15))"; @@ -74,11 +81,11 @@ new Pair<Object, MultiLineString>( 1.5, multiLineString3)); - - java.io.File shapeFile = new java.io.File("/tmp/test"+System.currentTimeMillis()+".shp"); - + + java.io.File shapeFile = new java.io.File("/tmp/test"+System.currentTimeMillis()+".shp"); + ShapeFileWriter.writeMultiLineStringsToFile(shapeFile, 1, 1, new Date(), multiLineStrings); - + } catch (Exception e) { log.error(e,e); fail();
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_feed.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_feed.xml Fri Sep 28 12:15:21 2012 +0200 @@ -4,7 +4,7 @@ <art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" /> <art:hash value="29647319" /> <art:data> - <art:input name="dateid" value="2010.01.03 00:00:00" /> - <art:input name="dateid" value="2010.01.02 00:00:00" /> + <art:input name="dateid" value="2010.03.14 00:00:00" /> + <art:input name="dateid" value="2010.03.18 00:00:00" /> </art:data> </art:action> \ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml Fri Sep 28 12:15:21 2012 +0200 @@ -4,7 +4,7 @@ <art:uuid value="1e9f6583-9073-4409-aac1-432ad06d7ce1" /> <art:hash value="29913235" /> <art:data> - <art:input name="maxvalue" value="2010.01.03 00:00:00" /> - <art:input name="minvalue" value="2009.12.24 01:00:00" /> + <art:input name="maxvalue" value="2010.03.26 00:00:00" /> + <art:input name="minvalue" value="2010.03.13 01:00:00" /> </art:data> </art:action> \ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml Fri Sep 28 12:15:21 2012 +0200 @@ -4,6 +4,6 @@ <art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" /> <art:hash value="2969645" /> <art:data> - <art:input name="dateid" value="2010.01.03 00:00:00" /> + <art:input name="dateid" value="2010.03.14 00:00:00" /> </art:data> </art:action> \ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_feed.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_feed.xml Fri Sep 28 12:15:21 2012 +0200 @@ -4,7 +4,7 @@ <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" /> <art:hash value="3061481" /> <art:data> - <art:input name="dateid" value="2010.01.03 00:00:00" /> - <art:input name="dateid" value="2010.01.02 00:00:00" /> + <art:input name="dateid" value="2010.03.14 00:00:00" /> + <art:input name="dateid" value="2010.03.18 00:00:00" /> </art:data> </art:action> \ No newline at end of file
--- a/gnv/ChangeLog Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/ChangeLog Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,1766 @@ +2011-02-01 Ingo Weinzierl <ingo@intevation.de> + + * pom.xml: Upgraded the Restlet version from 2.0-SNAPSHOT to 2.0.4 which is + the current stable release. + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Renamed the packages of Request and Response that have been changed from + Restlet 2.0-SNAPSHOT to 2.0.4. + +2010-11-30 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java: + Bugfix: if debug logging was disabled for this class, a Nullpointer + exception would have been thrown. + +2010-11-29 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/gnv/util/CaptureInputStream.java: New. This + class makes it possible to capture incoming data (InputStream) in a proper + way. + + * src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java: + Improved the mechanism to print the incoming data to log by using the + CaptureInputStream class. + +2010-11-26 Ingo Weinzierl <ingo@intevation.de> + + ISSUE #323 + + * src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java: + In addition to the last revision: XML documents of HTTP Post request are + also logged to the logfile. + +2010-11-26 Ingo Weinzierl <ingo@intevation.de> + + ISSUE #323 + + * src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java: + Log the xml document of the MapViewer call (DEBUG). + + * src/main/webapp/WEB-INF/classes/log4j.properties: Enabled the DEBUG + output of the MapViewerCallAction logging, so that the MapViewer call xml + document can be found in the log file. + +2010-11-02 Ingo Weinzierl <ingo@intevation.de> + + * src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java, + src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java, + src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java, + src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java, + src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java, + src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java, + src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java, + src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java, + src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java, + src/main/java/de/intevation/gnv/action/CommunicationKeys.java, + src/main/java/de/intevation/gnv/action/DoExportAction.java, + src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java, + src/main/java/de/intevation/gnv/action/WMSAction.java, + src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java, + src/main/java/de/intevation/gnv/action/ShowStatisticAction.java, + src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java, + src/main/java/de/intevation/gnv/action/LoadAction.java, + src/main/java/de/intevation/gnv/action/SelectFisAction.java, + src/main/java/de/intevation/gnv/action/CreateHistogramAction.java, + src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java, + src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java, + src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java, + src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java, + src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java, + src/main/java/de/intevation/gnv/action/DoOutputAction.java, + src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java, + src/main/java/de/intevation/gnv/action/MapClientStandaloneAction.java, + src/main/java/de/intevation/gnv/action/CreateChartAction.java, + src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java, + src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java, + src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/StoreAction.java, + src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java, + src/main/java/de/intevation/gnv/util/XMLUtils.java, + src/main/java/de/intevation/gnv/util/XSLTransformer.java, + src/main/webapp/images/bfg-logo.gif, + src/main/webapp/WEB-INF/jsp/wmslayout.jsp, + src/main/webapp/WEB-INF/jsp/version.jsp, + src/main/webapp/WEB-INF/jsp/index.jsp, + src/main/webapp/WEB-INF/jsp/header.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp, + src/main/webapp/WEB-INF/jsp/includes/info_german.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/info_english.jsp, + src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp, + src/main/webapp/WEB-INF/jsp/info.jsp, + src/main/webapp/WEB-INF/jsp/footer.jsp, + src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp, + src/main/webapp/WEB-INF/jsp/imprint.jsp, + src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Added a license header to each + of these files. + + * LGPL.txt: Added the license text of the GNU LGPL. + +2010-07-05 Hans Plum <hans.plum@intevation.de> + + * src/main/webapp/WEB-INF/jsp/includes/info_german.jsp: + Made name more precise. + +2010-07-01 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + RELEASE 1.1 + + * src/main/webapp/styles/gnv.css: Some style adjustments for the info pages. + + * src/main/webapp/WEB-INF/jsp/info.jsp: The outer info page. It handles the + different languages (german, english) and includes the localized info page + corresponding the current locale. + + * src/main/webapp/WEB-INF/jsp/includes/info_german.jsp, + src/main/webapp/WEB-INF/jsp/includes/info_english.jsp: German and english + info pages. Currently, just the german page is filled with content. + + * pom.xml: Do not check if there are local changes before writing + buildnumber into MANIFEST. Local changes would stop the build process. + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * Changes, NEWS, ChangeLog: Summarized changes + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue311 + + * src/main/webapp/scripts/viewport.jsp: Changed OpenLayers MouseDefault + control with a Navigation control which is initially disabled. Users need + to activate the navigation control for panning expicitly before panning. + +2010-06-30 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue307 + + * src/main/webapp/scripts/viewport.jsp: Added a 'resize' listener for the + browser window. If the browser window is resized, the size of the map + panel is adapted. For example, you have a small browser window at the + beginning and resize it later to its maximal size, the map panel takes all + the place it can get. Currently, just the width is adapted, because outer + div container has a fix height that doesn't change. + +2010-06-29 Tim Englich <tim.englich@intevation.de> + + ISSU317 + + * src/main/resources/applicationMessages*.properties: + Added i18n support for the Name of the GNV Web Map Service. + + * src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: + Added variable capfile to be able to reference the combobox directly. + + * src/main/webapp/WEB-INF/config/reachable-servers.conf: + Added configurationfile to fill the combobox with WMS. + + * src/main/webapp/scripts/olutils.jsp: + Read URL to Capabilities-Document from selected Item in Combobox. + Also switched to singleTile mode for inserted Layers. + + * src/main/webapp/scripts/viewport.jsp: + Switched Inputfile for GetCapabilities URl to an Combobox. + +2010-06-29 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/images/ol/cloud-popup-relative.png: + Added missing Image for the PopupWindow of GetFeatureInforRequests. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE308 + + * src/main/webapp/styles/ol_style.css: + Removed unused CSS .title + + * src/main/webapp/images/ol/wvHeaderBG.gif: + Removed unused Image. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE311 + + * src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp: + Syncronized size of the headline of fullscreen-mode of the map-client + to the size of the headline of the web-client. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE311 + + * src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp: + Syncronized size of the headline of fullscreen-mode of the map-client + to the size of the headline of the web-client. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE311 + + * src/main/webapp/images/ol/slider.png: + Added missing Image slider.png using the colors of the BSH. + + * src/main/webapp/styles/ol_style.css: + Added CSS for Zoombox. Modified CSS for Mouseposition. The background now + is gray with opacity 0.75 + + * src/main/webapp/scripts/viewport.jsp: + Switched order of Controls to tree, legend, add layers. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE 306 + + * src/main/webapp/scripts/viewport.jsp: + Removed ScaleLine from Viewport + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE 305 + + * src/main/webapp/scripts/viewport.jsp: + Removed store.load() because calling this function without a given + url to a capabilities-file will cause that the complete page, where the + Web-Client is placed in, will be loaded using the proxy without the post- + Parameter. + +2010-06-28 Tim Englich <tim.englich@intevation.de> + + ISSUE 305 + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties, + src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp: + Removed duplicate Information about Layernames / Layertitle from GUI. + Also removed unused resources. + +2010-06-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/util/XSLTransformer.java, + src/main/webapp/styles/gnv.css, + src/main/webapp/WEB-INF/config/struts-config.xml, + src/main/webapp/WEB-INF/config/templates/describe-ui.xsl, + src/main/webapp/WEB-INF/jsp/index.jsp: Removed the changes of rev1214 and + rev1206. + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp, + src/main/webapp/WEB-INF/jsp/version.jsp, + src/main/webapp/WEB-INF/jsp/info.jsp, + src/main/webapp/WEB-INF/jsp/imprint.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp: + Fixed some more XHTML-Mistakes. + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/olutils.js: + Removed file which was commited in r1202 by mistake + +2010-06-15 Tim Englich <tim.englich@intevation.de> + + ISSUE 278: Again: Because something was wrong with r1202. + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Prevent NPE if the Mapviewer has delivered no Geometry. + +2010-06-15 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: + Render direct links as list. + +2010-06-14 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * pom.xml: The svn revision number is written to MANIFEST.MF while creating + war archive. + +2010-06-10 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + Issue 219 + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java: + Broke over long line. + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Fed + more parameters into XSL transformation to allow better form rendering. + + * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: + use explicit boolean to indicate that we are still able to advance. + + * src/main/java/de/intevation/gnv/util/XSLTransformer.java: Removed + stupid initial size of hash map. + + * src/main/webapp/styles/gnv.css: Added style to render direct + links to look like buttons. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added a few + forwards. The log is full of unresolvable forwards. TODO: This + needs to be checked and is not a problem introduced by direct + link feature. + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render + the direct links if there are less than six item in a single + select list. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Cleanup a bit. Removed + form rendering here and moved it into the dynamic XSL transformation. + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + Issue278 + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Prevent NPE if the Mapviewer has delivered no Geometry. + + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + Customize Look and Feel to styleguide of the bsh. + + * src/main/webapp/scripts/viewport.jsp: + Link OpenLayers image-folder to images/ol to get the navigation-bar in + a customize look and feel. + + * src/main/webapp/styles/ol_style.css: + Added missing styles of Openlayer that must be overriden. + + * src/main/webapp/images/ol/east-mini.png, + src/main/webapp/images/ol/feature_info_off.png, + src/main/webapp/images/ol/feature_info_on.png, + src/main/webapp/images/ol/folder-open.gif, + src/main/webapp/images/ol/folder.gif, + src/main/webapp/images/ol/leaf.gif, + src/main/webapp/images/ol/navigation_history.png, + src/main/webapp/images/ol/north-mini.png, + src/main/webapp/images/ol/pan_off.png, + src/main/webapp/images/ol/pan_on.png, + src/main/webapp/images/ol/south-mini.png, + src/main/webapp/images/ol/tool-sprites.gif, + src/main/webapp/images/ol/west-mini.png, + src/main/webapp/images/ol/wvHeaderBG.gif, + src/main/webapp/images/ol/zoom_box_off.png, + src/main/webapp/images/ol/zoom_box_on.png, + src/main/webapp/images/ol/zoom-minus-mini.png, + src/main/webapp/images/ol/zoom-plus-mini.png, + src/main/webapp/images/ol/zoom-world-mini.png, + src/main/webapp/images/ol/zoombar.png: + Added missing icons and put an blue-filter to all icons. + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/images/ol/measure_line_off.png, + src/main/webapp/images/ol/measure_line_on.png, + src/main/webapp/images/ol/measure_polygon_off.png, + src/main/webapp/images/ol/measure_polygon_on.png: + Removed unused Icons. + +2010-06-11 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/util/XSLTransformer.java, + src/main/webapp/styles/gnv.css, + src/main/webapp/WEB-INF/config/struts-config.xml, + src/main/webapp/WEB-INF/config/templates/describe-ui.xsl, + src/main/webapp/WEB-INF/jsp/index.jsp: Reverted the changes of rev1194 - + the feature implemented in rev1194 has not been finished so far. + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/viewport.jsp, + src/main/webapp/scripts/olutils.jsp: + Modified output of the GetfeatureInfo-request. + All attributes of each feature which was returned by the request will be + put in one separte Table. + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/applicationMessages*.properties: + Added localized message if no layer were created. + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/layers.jsp: + Bugfix: All Layer will only use one single Tile for displaying it. + +2010-06-11 Tim Englich <tim.englich@intevation.de> + + Added the informations about how the WMS which was published during the + Workflow to the GUI. The URL to the capablities-documenet, the names of + the layer and the ttl will be listed. + + * src/main/java/de/intevation/gnv/action/WMSAction.java (execute): + Write the TTL to the Mapservice which is published. + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java: + Added Getter for the Attribute TTL. Which shows how long the Layer of this + Service will be available. + + * src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp: + Added new JSP-File for publishing the Basic-Informations of the WMS. + The URL which will deliver the Capablities is shown. + Also the Names of the Layers are listed. + At least the Time untiöl teh Layers are available is displayed. + + * src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: + Included Informationblock for the WMS which was produced in the workflow + before and now is published in the map. + +2010-06-10 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + Issue 219 + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java: + Broke over long line. + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Fed + more parameters into XSL transformation to allow better form rendering. + + * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: + use explicit boolean to indicate that we are still able to advance. + + * src/main/java/de/intevation/gnv/util/XSLTransformer.java: Removed + stupid initial size of hash map. + + * src/main/webapp/styles/gnv.css: Added style to render direct + links to look like buttons. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added a few + forwards. The log is full of unresolvable forwards. TODO: This + needs to be checked and is not a problem introduced by direct + link feature. + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render + the direct links if there are less than six item in a single + select list. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Cleanup a bit. Removed + form rendering here and moved it into the dynamic XSL transformation. + +2010-06-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Removed some + code for testing that have been commited by mistaken. + +2010-06-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java: + New methods for session validation. Method isSessionExhausted(.) returns + true, if the session of the user is new. Another medhod returns the + ActionForward for selecting a fis - which is the start point of our + application. + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java, + src/main/java/de/intevation/gnv/action/DoExportAction.java, + src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java, + src/main/java/de/intevation/gnv/action/WMSAction.java, + src/main/java/de/intevation/gnv/action/ShowStatisticAction.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java, + src/main/java/de/intevation/gnv/action/LoadAction.java, + src/main/java/de/intevation/gnv/action/CreateHistogramAction.java, + src/main/java/de/intevation/gnv/action/DoOutputAction.java, + src/main/java/de/intevation/gnv/action/CreateChartAction.java, + src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/StoreAction.java: Validate the + session before doing some other stuff. If the session is exhausted, we + will return to the start point - the fis selection. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Renders an error message if the + session of the user is exhausted. There will be no link to return to the + last point in the parameterization. + + * src/main/java/de/intevation/gnv/action/CommunicationKeys.java: A new key + for session errors. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: An error message for + a session that timed out. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added a new forward to + the export action that makes it possible to step back to the fis + selection. + +2010-06-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue177 - Messages for Java heap size errors. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added an error + message for Java heap size errors. + +2010-06-08 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: + Added localization for the message that will be displayed if no + layer where found. + + * src/main/webapp/scripts/olutils.jsp: + Improved the workflow for inserting new layer into the client. + If no layer are found using the given url an exceptionmessage will be + displayed using an ext-window. + Now it is also possible to add more than one layer at once. + +2010-06-08 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/layers.jsp: + Switched from Untiled Layer to standard layer objects to fix a bug + in the drag and drop function of the layertree and to enable the output + of the LegendGraphicPanel. + +2010-06-08 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/olutils.jsp: + Rename olutils.js to olutils.jsp to enable possibility of i18n in this file. + Added references to resources in in Method addLayer. + + * src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: + Replace linkt to olutils.js to olutils.jsp. + + +2010-06-08 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: + Added reference to the new css-file extjs-override.css + + * src/main/webapp/images/folder-open.gif, + src/main/webapp/images/folder.gif, + src/main/webapp/images/leaf.gif, + src/main/webapp/images/tool-sprites.gif, + src/main/webapp/styles/extjs-override.css: + Customize Look and Feel to the css of this project. + +2010-06-08 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/styles/ol_style.css: + Switch color of coordinate display of mousposition and scalebar from + black to white. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/viewport.jsp: + Put the bboxx from the mapservice-object and write it to an + javascript-variable. This variable will be used to center the map to + the extend of the data which should be visualized. + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java (getBBoxValue), + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java (getBBoxValue): + Added a method for getting the bbox as a string from the mapservice-object. + + * src/main/java/de/intevation/gnv/action/WMSAction.java (execute): + Read the bbox from the retrieved meta-document and out it into the + mapservice-object which is used to represent the WMS in the client. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/viewport.jsp: + Switch the URl for the GetFeatureInfor Control to the URL of the WMS which + provide the generated Data of the GNV. + Also switch the Format of the Responsdata of the GetFeatureInfor-request to + GML. + +2010-06-07 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/config/struts-config.xml: + Added the Action "mapclient" for switching to the FullScreen-Mode of the + MapClient. + + * src/main/webapp/scripts/viewport.jsp: + Integrated the Viewport to render tne Mapclient in FullScreen-Mode. + + * src/main/java/de/intevation/gnv/action/MapClientStandaloneAction.java : + Added Action for handling the businesslogic to switch the Mapclient to the + FullScreen-Mode. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: + Added i18n for the Link-labeling for switching to the FullScreen-Mode. + + * src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp: + Added JSP-Page wich will be used to render the gui for the + FullScreen-Mode of the Mapclient. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp, + src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: + Extracted header for the html-page whcih will contain the mapclient so + that it could be used in several pages. + + * src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp: + Added JSP-Fragment which contains the gui for the FullScreen-Mode of the + Mapclient. + + * src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: + Added link for switching to the fullscreenmode + +2010-06-04 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/applicationMessages.properties: + Replaced incompatible Umlauts + +2010-06-04 Tim Englich <tim.englich@intevation.de> + + + * src/main/webapp/scripts/viewport.jsp, + src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: + Added i18n support to the mapclient. + +2010-06-04 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp, + /src/main/webapp/scripts/olutils.js: + Fixed bug that the "Add Layer"-Button was not correctly displayed if a + new WMS-Capabilities-Document was loaded. + Also improved the GUI that it is now Possible to load a WMS with a lot of + layer which could not be displayed in the GUI without uisng a scrollbar. + +2010-06-04 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue275 + + * src/main/webapp/WEB-INF/jsp/index.jsp, + src/main/webapp/WEB-INF/jsp/header.jsp, + src/main/webapp/WEB-INF/jsp/footer.jsp, + src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed (X)HTML + errors/warnings. + +2010-06-04 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue293 + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added strings for + refresh-button tooltip and png export-button. + + * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: + Changed and added some tooltips. + +2010-06-01 Tim Englich <tim.englich@intevation.de> + + + Checkin of changes which are necessary for the checkin of Revision 1139. + + * src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java (selectArtifactFactory), + src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java (selectedArtifactFactory): + Added functions for getting and setting a Mapservice to the SessionModel. + + * src/main/java/de/intevation/gnv/action/WMSAction.java : + Integrated the possibility to read all Layes from Metafile. + +2010-06-01 Tim Englich <tim.englich@intevation.de> + + Providing functionality to read an WMS-Capabilities-Documnet and list all + layers which are include. This is the first step to provide the requested + function to integrate external WMS-Layers. + + To read the XML-Documents it is required to integrate the proxy.cgi script + into the Apache Webserver. for this you have to copy the proxy.cgi script + to /usr/lib/cgi-bin. + + You might have to change the allowedHosts in this script. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: + Integrated link to JavaScript-file olutils.js + + * /src/main/webapp/scripts/olutils.js: + Integrate Utilities-javaScript-fiel from Demonstrator to provide + JavaScript-Functions for handling WMS-Capabilities-Requests. + * src/main/webapp/scripts/viewport.jsp: + Integrated JavaScript-Elements for WMS-Capabilities Request. + + * src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: + Integrated HTML-Elements for the WMS-Capabilities Request. + +2010-06-01 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: + Implemented a N-step back history. There is a back-button besides every + parameter in the static ui part now. + +2010-06-01 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/viewport.jsp: + Removed som obsolet Code. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: + Added reference to the new css-file. + + * src/main/webapp/images/ol/*.png: + Added Icons for an customized Toolbar. + + * src/main/webapp/styles/ol_style.css: + Added separat CSS-File for create own Style of the Buttons of the + OL-Buttonbar. + +2010-06-01 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/scripts/openlayers, + src/main/webapp/scripts/geoext/, + src/main/webapp/scripts/ext/: + Added subfolders of third party libraries to svn-ignore. + +2010-06-01 Tim Englich <tim.englich@intevation.de> + + Integrated the Openlayers-libraray according to the Intevation-Demonstrator + into the GUI. Now it is also possible to see all layers which are put into + the WMS by the user. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: + Removed the old JavaScript-references to the OpenLayers-Library and + put the references to the JavaScript-Files and CSS-files for + OpenLayers, ext and geoext into it. + + * src/main/webapp/WEB-INF/jsp/index.jsp: + Removed the html-elements which are required to render the MapClient and + put them into the file includes/display_map_inc.jsp. + + * src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: + Added own include-file for all html-elements which are required to render + the Mapclient. + + * src/main/webapp/scripts/viewport.jsp: + Added a JSP-file which creats an JavaScript-file which includes the + informations how to create the GUI of the WMS-Client.A JSP-file is required + because we have to insert dynamic usespecific Data into the file. + + * src/main/webapp/scripts/layers.jsp: + Added a JSP-file which creats an JavaScript-file which includes all + layers which should be displayed by OpenLayers. A JSP-file is required + because we have to insert dynamic usespecific Data into the file. + + * src/main/webapp/scripts/openlayers: + Folder for storing the JavaScript-Library Openlayers. + * src/main/webapp/scripts/openlayers/readme: + Readme-File which explains which steps must be done to provide the + required Version of the Openlayers-Library. + + * src/main/webapp/scripts/geoext/: + Folder for storing the JavaScript-Library geoext. + * src/main/webapp/scripts/geoext/readme: + Readme-File which explains which steps must be done to provide the + required Version of the GeoExt-Library. + + * src/main/webapp/scripts/ext/: + Folder for storing the JavaScript-Library Ext. + * src/main/webapp/scripts/ext/readme: + Readme-File which explains which steps must be done to provide the + required Version of the Ext-Library. + + +2010-05-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue198 + + * src/main/java/de/intevation/gnv/action/WMSAction.java: Changed the XPath + of the layer name and the time to live. Rev1134 introduced a title for wms + layers - the title has been used before to specify a wms layer. The time + to live moved from layer node to abstract meta information. + + NOTE: Just the first layer of a wms request is visible in the OL + application currently, because there is no group-layer anymore. + +2010-05-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp: Make use + of the new method of DiagrammOptions to retrieve the value of an option as + string that have been introduced in rev1129. + +2010-05-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/jsp/header.jsp: Don't use the old session id when + restarting the application - start the application without old id. + +2010-05-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue289 + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Store + chart/histogram options inserted by the user in the SessionModel. In the + case of a wrong input we are able to reuse the previous value. Options + inserted by the user are stored as native objects - no longer as string. + + * src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java: + Store options as Object instead of String to keep the information about + the type of the option (string, integer, double, etc). Furthermore there + is a new method getValue(String key, Locale locale) that returns the value + as string. Double values are formatted using the locale object. This + method is used in the gui to display a well formatted i18n string. + + * src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: + Make use of the new method in DiagrammOptions to retrieve the value as + formatted string. + +2010-05-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue272 + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Read strings + for example linestring/polygon from resource bundle and put them into the + XSL-transformator. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added labels for + links to insert example linestring/polygon. + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Don't use static + strings for example linestring/polygon links but use the parameter that + have been added in DescribeUIAction - which are i18n. + +2010-05-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue266 + + * src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java: + Switching the language in the initial state will not throw an exception + anymore, but the language is toggled. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java (getValue), + src/main/java/de/intevation/gnv/util/XMLUtils.java (getXPath): + Fixed some warnings which are displaied during the javadoc-generation. + +namespaceContext + + * src/main/java/de/intevation/gnv/action/StoreAction.java, + src/main/java/de/intevation/gnv/action/ShowStatisticAction.java, + src/main/java/de/intevation/gnv/action/SelectFisAction.java, + src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java, + src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/LoadAction.java, + src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java, + src/main/java/de/intevation/gnv/action/CreateHistogramAction.java, + src/main/java/de/intevation/gnv/action/CreateChartAction.java, + src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java: + Added more Javadocs. Did some Codeformatting. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/util/XSLTransformer.java: + * src/main/java/de/intevation/gnv/util/XMLUtils.java: + * src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java: + Added more Javadocs. Did some Codeformatting. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java, + src/main/java/de/intevation/gnv/servlet/package.html: + Added more Javadocs. Did some Codeformatting. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/propertiesreader/package.html, + src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java, + src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java: + Added more Javadocs. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java: + Added more Javadocs. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java: + Added more Javadocs. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java (doAdvance): + Added more Javadoc. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/package.html: + Added more Javadoc. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/action/sessionmodel/package.html: + Removed duplicate documentation from file. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/action/sessionmodel/package.html, + src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java, + src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java: + Added more Javadocs. + +2010-05-18 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html, + src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java, + src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java, + src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java: + Added more Javadocs. Format some Linees of code which are longer than 80 Chars. + +2010-05-17 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/action/mapviewer/package.html, + src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java, + src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java: + Added more Javadocs. + +2010-05-09 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/webapp/styles/calendar-blue.css: Deleted. Not needed any more. + +2010-05-05 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/web.xml: Removed useless log4j configuration + section. + + * src/main/webapp/WEB-INF/classes/log4j.properties: Adapted logging + configuration for a productive system. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + RELEASE 1.0 + + * Changes, NEWS, ChangeLog: Summarized changes. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java: Removed + trailing whitespace. + +2010-04-28 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Removed + duplicated and unused imports. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue225 + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added global forwards + for imprint and info. + + * src/main/webapp/WEB-INF/jsp/header.jsp, + src/main/webapp/WEB-INF/jsp/footer.jsp: Adapted links for imprint and info + pages. + + * src/main/webapp/WEB-INF/jsp/imprint.jsp, + src/main/webapp/WEB-INF/jsp/info.jsp: New pages for imprint and an info + page. + + * src/main/resources/applicationMessages_en.properties: Renamed 'about' -> + 'imprint'. + +2010-04-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue225 + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render a + parameter matrix if there is just a single parameter as well. This allows + us to render a legend for multi select boxes at another place - this fixes + the missing legend for parameter select boxes. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/images/img.gif, + src/main/webapp/images/stock_data-save.png, + src/main/webapp/images/bg_fieldset.gif, + src/main/webapp/images/list-item.gif, + src/main/webapp/images/bg_fieldset_ie6.gif, + src/main/webapp/scripts/calendar-setup.js, + src/main/webapp/scripts/calendar-en.js, + src/main/webapp/scripts/calendar.js, + src/main/webapp/scripts/calendar-de.js, + src/main/webapp/scripts/calendar-setup_stripped.js, + src/main/webapp/scripts/jquery-1.4.2.min.js, + src/main/webapp/scripts/calendar_stripped.js: Removed JavaScript files and + images that are not used anymore. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added an error + message if that should be displayed if an artifact is out of date. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue236 & Issue242 + + * src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Display + error messages if the artifact server is down - this have been broken. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue258 + + * src/main/java/de/intevation/gnv/action/LoadAction.java: An error message + is displayed if the user tried to load an existing project and the + artifact server is down. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue259 + + * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: + Added target 'chart' as url request parameter when performing the html + form to change the chart output. The reason for doing this is, that the + InternetExplorer seems no to add the value of <input type="image"...> + elements to the request object which is sent to the server. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue225 + + * src/main/webapp/styles/gnv.css: Reduced the size of links in header and + footer. + +2010-04-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue225 + + * src/main/webapp/styles/gnv.css: Adjusted the style of fieldsets - there is + a gap between the fieldset border and input elements in IE now as well. + The size of select boxes and textareas is fixed now. + +2010-04-25 Ingo Weinzierl <ingo_weinzierl@web.de> + + Issue225 + + * src/main/webapp/styles/gnv.css: A new style class. Most of this is copied + from default.css but a lot of content which is not used anymore has been + removed. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Restructuring. The parameter panel + and the content div container are placed in a table row now. Very wide + html elements in the content div container don't break the layout anymore. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Moved html elements to render + OpenLayers into index.jsp. Removed JavaScript code to adjust layout. + + * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: + Added style class to the table that contains the chart options. + + * src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed JavaScript code to + adjust layout. + + * src/main/webapp/scripts/jquery-1.4.2.min.js: Removed. Not used anymore. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue225 + + * src/main/webapp/styles/default.css: Adapted some font size in the + parameter panel. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue225 + + * src/main/webapp/WEB-INF/jsp/index.jsp: Replaced the standard html input + button with an image as the choose button. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added specific + strings that represent pathes to german and english load button images. + + * src/main/webapp/styles/default.css: New styles to adjust the upload box + and the load button. + + + * src/main/webapp/images/load.png, + src/main/webapp/images/laden.png: Images for project load button. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue237 + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Added http request parameter to + the mapserver path to simplify the GetCapabilities call for the user. + +2010-04-23 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue254 + + * src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java: New + controller to toggle between german and english language. + + * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Use the + locale stored in the artifact to create the user interface. At the + beginning, this will be the locale of the request object. If the user + chooses another language by calling the SwitchLanguageAction controller, + this locale becomes the prefered locale, and the browser settings are no + more relevant. + + * src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java: + Now, the SessionModel has two methods to set and retrieve the current + locale which is used to create a language specific user interface. + + * src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java: + Initial creation of the SessionModel gets the locale of the request + object. If this locale is changed by the user via SwitchLanguageAction + controller, changes in the browser settings won't have an effect anymore. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Add the controller to + switch between languages. + + * src/main/webapp/WEB-INF/jsp/header.jsp: The header contains a link to + toggle between german and english language - a click on it will trigger + the SwitchLanguageAction. + +2010-04-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue221 + + * src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java: + Added methods to quote html characters in strings. + + * src/main/java/de/intevation/gnv/action/WMSAction.java: Call methods to + quote html characters in strings inserted by the user. Used to be safe + from html injections. + +2010-04-19 Hans Plum <hans@intevation.de> + + Issue 241: Set Path to Tomcat Standard Logging + + * src/main/webapp/WEB-INF/classes/log4j.properties: + Adapted logging path for webclient gnv to the central tomcat mechamism + in order to resolve the dependency to the artefact-server directory + layout. + +2010-04-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue227 + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Added a new method to retrieve the current locale. + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Feed the xsl + transformer with a tooltip text for the back-button. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added a tooltip text + for the back-button. + + * src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Use the + tooltip text that is fed in DescribeUIAction. + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Removed a + PropertiesReader which isn't used there. + +2010-04-19 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/resources/applicationMessages.properties: Forgot a dot. ;-) + +2010-04-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue224 + + * src/main/resources/applicationMessages.properties: Fixed a typo in the + german text of the overlay display. + +2010-04-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Using unix line endings only. + +2010-04-17 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Removed trailing whitespace. + +2010-04-14 Hans Plum <hans@intevation.de> + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: + Adapted background layers to a global and local visibale layer (World + Relief (2 Minute Raster) + +2010-04-14 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Changed language + strings. + + * src/main/webapp/styles/default.css: Adapted css classes. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp, + src/main/webapp/WEB-INF/jsp/header.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp, + src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Adapeted design. + + * src/main/webapp/scripts/gnviewer.js: Added javascript methods to adapt the + size of the content panel. + + * src/main/webapp/scripts/jquery-1.4.2.min.js: JavaScript library doing + general javascript stuff. + +2010-04-13 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added resource + pointing to the image of the 'choose'-button. + + * src/main/webapp/images/auswaehlen.png, + src/main/webapp/images/choose.png: Selfmade 'choose'-buttons for english + and german language. + + * src/main/webapp/WEB-INF/jsp/index.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp: Removed standard + html input buttons with selfmade ones. + +2010-04-13 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/styles/default.css: Adapted style of links. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Replaced input buttons for + loading/saving projects with links. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp, + src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Added javascript function to + toggle the visibility of the file upload button/chooser. + +2010-04-13 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Fixed a display + bug in the measurement panel for one parameter. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: New strings for + header and footer links. + + * src/main/webapp/styles/default.css: Added and adapted style classes. + + * src/main/webapp/WEB-INF/jsp/header.jsp: Added links for restarting the app, + retrieving information about it and switching the current language. + + * src/main/webapp/WEB-INF/jsp/footer.jsp: Added navigation links to 'home', + a contact page and an about page. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp, + src/main/webapp/WEB-INF/jsp/mainlayout.jsp, + src/main/webapp/WEB-INF/jsp/index.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp: Changed + the design of the whole application regarding the bsh styleguide. + +2010-04-13 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java : + Added more Javadocs. + +2010-04-13 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/package.html, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/package.html, + src/main/java/de/intevation/gnv/artifactdatabase/client/exception/package.html, + src/main/java/de/intevation/gnv/artifactdatabase/client/package.html, + src/main/java/de/intevation/gnv/action/package.html, + src/main/java/de/intevation/gnv/action/sessionmodel/package.html, + src/main/java/de/intevation/gnv/util/package.html: Added first part of + package descriptions. + +2010-04-13 Hans Plum <hans@intevation.de> + + * src/main/webapp/images/svg.png, + src/main/webapp/images/delete.png, + src/main/webapp/images/map_go.png, + src/main/webapp/images/diagram_export.png, + src/main/webapp/images/chart_curve.png, + src/main/webapp/images/arrow_refresh.png, + src/main/webapp/images/pdf.png, + src/main/webapp/images/data_export.png, + src/main/webapp/images/chart_bar.png, + src/main/webapp/images/statistics.png, + src/main/webapp/images/disk.png, + src/main/webapp/images/tick.png, + src/main/webapp/images/back_button.png: + Converted relevant icons to the requirements of BSH Corporate Design, + 19.06.2009, S. 172: Hue: 172; Saturation: 34; Brightness: 28. + +2010-04-12 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java, + src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java, + src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java, + src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java, + src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java, + src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java, + src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java, + src/main/java/de/intevation/gnv/action/CommunicationKeys.java, + src/main/java/de/intevation/gnv/action/DoExportAction.java, + src/main/java/de/intevation/gnv/action/WMSAction.java, + src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java, + src/main/java/de/intevation/gnv/action/ShowStatisticAction.java, + src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java, + src/main/java/de/intevation/gnv/action/DescribeUIAction.java, + src/main/java/de/intevation/gnv/action/LoadAction.java, + src/main/java/de/intevation/gnv/action/CreateHistogramAction.java, + src/main/java/de/intevation/gnv/action/SelectFisAction.java, + src/main/java/de/intevation/gnv/action/DoOutputAction.java, + src/main/java/de/intevation/gnv/action/CreateChartAction.java, + src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java, + src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java, + src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java, + src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, + src/main/java/de/intevation/gnv/action/StoreAction.java, + src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java, + src/main/java/de/intevation/gnv/util/XSLTransformer.java: Added JavaDoc + comments. + +2010-04-12 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added label for + chart button in actions panel. + + * src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Changed the + label of the chart button in the actions panel ('Diagramm speichern' -> + 'Diagramm'). + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue210 + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Changed the + parameter-measurement matrix rendering. Its content is no more selectable + - it is just to inform the user about the existence of a measurement for a + given parameter. Instead, there is a new row with a checkbox for each + measurement in the header of the matrix. So, the user is able to select a + measurement without a relation to a specific parameter - all parameters + which are available for this measurement are effected by this choice in + future outputs. + + * src/main/webapp/styles/default.css: New classes for styling the + parameter-measurement matrix. + + * src/main/webapp/images/delete.png, + src/main/webapp/images/tick.png: New icons to inform the user about the + existence of a measurement for a given parameter. + +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue216 + + * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: + Added a missing character to the url of the image export. + +2010-03-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue13 & Issue18 + + * src/main/webapp/WEB-INF/jsp/mainlayout.jsp, + src/main/webapp/WEB-INF/jsp/header.jsp: Added a reload link. A click on + this link rebuilds the ui with the description of the current artifact. + + Note: If the artifact server ist down, nothing happens when using this + link. A click on this link triggers a controller which sends a + describe-request to the artifact server. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added a new controller + to build the current user interface. This could be used if the artifact + server is down and the ui brakes after an user interaction. After the + artifact server being restarted, this controller can be called to rebuild + the ui with the current artifact description. + + * src/main/webapp/styles/default.css: Moved exception message and reload + link a bit to avoid overlapping elements. Added a new class to adjust the + style of the reload link. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added strings for + reload-link. + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/package.html: New. + Added package description with text 'DOCUMENT ME!'. + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>' + + find -name \*.java | \ + xargs sed -i \ + -e 's/@author[ ]\+\([^(<]\+\)[<(]\([^>)]\+\)[>)]/@author <a href="mailto:\2">\1<\/a>/g' \ + -e 's@[ ]\+</a>@</a>@g' + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * rc/main/java/de/intevation/gnv/**/*.java: + Ordered imports. Removed needless imports. Removed empty headers. + +2010-03-29 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue30 + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Use the + correct locale for i18n supported by HttpServletRequest object. The + application language is switched after the next server round-trip if the + user changes the preferred browser language. + Hint: Struts' Action class has a method getLocale(HttpServletRequest) + which should return the currently selected locale. This method seems to be + buggy - returns session's initial locale. + + * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java: + Inherit from DescribeUIAction. The rendering stuff is now done by + DescribeUIAction. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forward + used for stepping back to a previous state in SelectArtifactFactory + action. + +2010-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/gnv/**/*.java: + Removed trailing whitespace. + find -name \*.java | xargs sed -i 's/[ \t]\+$//' + +2010-03-26 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue197 + + * src/main/java/de/intevation/gnv/action/WMSAction.java: Parse the time to + live of an artifact from meta document and set an attribute 'ttl' of the + request object. + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Added a new row showing + the time to live beneath the layer name and wms url. + + * src/main/resources/applicationMessages_en.properties, + src/main/resources/applicationMessages.properties: Added new label for + availability of an artifact/wms-layer. + + * src/main/webapp/styles/default.css: Moved OpenLayers map a bit south. + +2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Improved the copying of input stream to output stream a bit. + +2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/LoadAction.java: Just copy the + input stream to the output stream without parsing it and without creating + a temporary xml document. + +2010-03-22 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/jsp/wmslayout.jsp, + src/main/java/de/intevation/gnv/action/WMSAction.java (execute): + Improved ExceptionHandling during WMS-Publishing. + Now the OL-GUI will only be shown if the WMS was published succsessfull. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java (publishWMS), + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java (publishWMS), + src/main/java/de/intevation/gnv/action/WMSAction.java (execute): + Improved ExceptionHandling during WMS-Publishing. + The responsedocument will be scanned for Exceptionreports. + Also if no URL, Mapfile or Layer was retrieved from the Responsedocument + the Exceptionpage will be visualized instead an corrupt Openlayersclient. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/applicationMessages.properties: + Added new German resource for fis_marinefeatures according to msg1067 + of Issue2005. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/applicationMessages*.properties: + Added Ressources for new FIS Marine Features. + +2010-03-19 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/LoadAction.java: Use the uploaded + file to start an artifact import. Create a new Artifact object if the + import was successful and fetch the current artifact description with user + interface part to restore the gui. Display an error message if something + failed while importing. + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java: + Added a new method doImport to import artifacts from xml documents. A + describe document without ui part is returned if an import was successful. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added error messages + for the case that something failed while importing artifacts from xml + documents. + + * src/main/webapp/WEB-INF/jsp/header.jsp: Replace whitespaces from exception + request parameter with dots. Exceptions thrown by the artifact server + corresponds to a specific resource key. Failures coming from the artifact + server are displayed language specific on this way. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forwards + to import action. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java (addParameters): + Some Codecleanup done. + +2010-03-19 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp: + Integrated a Switch will be load different Geometries into the + Requestbody of an Mapviewercall. + You cann add gt=POINT , gt=LINESTRING or gt=POLYGON to the URL to switch + between the different Geometries. + The Values of the Geometries are the same as used in the GUI of the GNV. + +2010-03-17 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue208 First steps for exporting artifacts. + + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java: + New method to export an artifact. + + * pom.xml: Added Apache common-fileupload 1.2.1 lib. + + * src/main/java/de/intevation/gnv/action/CommunicationKeys.java: Further + error message key added which is displayed beneath project load/store + buttons if an error occured while these operations. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added error messages + for errors which occure while loading/storing projects. + + * src/main/webapp/styles/default.css: Added a new style class to adjust + error messages which may occur while loading/storing projects. + + * src/main/java/de/intevation/gnv/action/StoreAction.java: New controller + which triggers an artifact export. After pushing the corresponding button, + the artifact is returned as xml document and a file dialog is displayed. + + * src/main/java/de/intevation/gnv/action/LoadAction.java: New controller to + import artifacts which have former been exported. XML documents are + successfully read from fileupload. + TODO: Use these documents to create artifacts. No artifacts are loaded + yet! + + * src/main/java/de/intevation/gnv/util/XMLUtils.java: Added a method to + write documents to a stream. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added LoadAction and + StoreAction. The controller are available under /gnv/load and /gnv/store. + + * src/main/webapp/WEB-INF/jsp/header.jsp: Removed placeholder string for + storing/loading the current project state and added buttons to start + an export of the current project's state (the current artifact) or reload + an artifact from a xml document. + +2010-03-16 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Changed the + rendering of measurement/parameter matrix. The matrix will now look like + this: + + | measurement label | measurement label + ------------------------------------------------------- + parameter label | measurement value | measurement value + parameter label | measurement value | measurement value + +2010-03-15 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue198 + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Added the method signature for publishing wms layers. 'publishWMS' + requires a collection of InputParameters which are used to create the + request xml document. These input parameters can be used to adjust some + wms settings. At the moment, the only parameter which written to the + request xml document is the title for a wms layer. + + * src/main/java/de/intevation/gnv/action/WMSAction.java: Search for user + input and append given input values to request xml document. Put the layer + title into request object to be accessible in jsp files. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Render wms option panel if wms is + requested. + + * src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp: New. + Option panel for wms customization. At the moment, the user has the + possibility to adjust wms layers' title. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added some labels + for wms options. + +2010-03-12 Tim Englich <tim.englich@intevation.de> + + * src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java (testArtifactDatabaseClient): + Fixed Compilation-Error because of InterfaceChanges of the + ArtifactDatabaseClient-Interface. + +2010-03-12 Tim Englich <tim.englich@intevation.de> + + * src/main/resources/applicationMessages*.properties: + Integrated Resource for FIS Contis and Nauthis. + +2010-03-10 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java, + src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: + Throw different exceptions if an error occured in the artifact server. + On this way, we are able to distinguish between general server errors or + errors caused by an invalid user input. + + * src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java, + src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: + Catch the exceptions thrown by DefaultArtifactDatabaseClient and set an + attribute at the request object for each exception type. The attributes + will take effect on different places in the user interface. + + * src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java: + Exception used to be thrown if an invalid user input error occured. + + * src/main/java/de/intevation/gnv/action/CommunicationKeys.java: Added some + keys to store different error messages in the Http session. + + * src/main/webapp/styles/default.css: Added new style class to adjust the + style of error messages caused by invalid user input. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Display invalid input errors at + the top of the input area. + +2010-03-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/config/log4j.properties, + src/main/webapp/WEB-INF/classes/log4j.properties: Moved logging + configuration. The config file did not have any effect in config + directory. In classes directory, it has. + + * src/main/webapp/WEB-INF/web.xml: Removed logging section which is no more + necessary anymore. + +2010-03-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Parse + user input from chart/histogram options panel and check if integer and + doubles are valid - if we find a value which is not valid for the + configured type, we set an exception message which is displayed in the + chart/histogram options panel and sets the corresponding parameter to its + default value. + + * src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: + Display error message in options panel if there is one. + + * src/main/resources/applicationMessages_en.properties, + src/main/resources/applicationMessages.properties: + Added strings to display error messages when the user entered a bad + formatted number in chart/histogram options panel. + + * src/main/java/de/intevation/gnv/action/CommunicationKeys.java: Added two + further error message keys used to store error messages for + chart/histogram options. + + * src/main/webapp/styles/default.css: Added a new class 'chartException' to + adjust the style of an error message in chart/histogram options panel. + 2010-03-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
--- a/gnv/Changes Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/Changes Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,69 @@ +2010-06-30 RELEASE 1.1 + + NEW: + + * Integrated an enhanced map client for working with gnv internal and + external wms layers + * N-Step back history for parameterization + * Added JavaDoc + + FIXES: + + * Input validation corresponding the current locale (#289) + * Fixed broken XPathes while wms publishing + * Removed duplicated layernames from gui (#305) + * Missing i18n for gui elements (#227, #272, #297, #177) + * Typos (#293) + + + +2010-04-28 RELEASE 1.0 + + NEW: + + * Support for renaming wms layers (#198) + + * Added control elements for saving and loading artifacts (#208). + Apache's commons.file-updload library is used for file upload. + + * Support for changing the language between german and english via + button in the gui. The intial language is determined by browser + settings. After the user changes this settings by clicking the button + in the gui, the browser locale is ignored in future (#30, #254) + + * Improved error handling. The user is able to reload the current + parameterization with the help of a link shown in the gui if an error + occured (#13). After clicking that link, the describe document of the + current artifact is requested and the gui is created again (#13, #18, + #236). + + * Improve input validation in chart/histogram panels. + + * Improve the design of the gui according to BSH style guides. + + FIXES: + + * Adjusted file extension of image exports (#187) + * Display time to live of an artifact (#197) + * Added missing character in the link to trigger an image export of + charts (#216) + * Restructuring of parameter-measurement matrix. Just the selection of + different depths is possible (#210) + * Added tooltip text for the step-back button (#227) + * Replace html characters to avoid html injections (#221) + * Adapted the MapServer path shown in the gui (#237) + * Fixed a bug in IE that avoided exporting charts as image (#259). + * Loading an artifact without running artifact server ends with a + warning and a message to try it later again (#258) + * Display an error message if the user tries to work with an outdated + artifact (#242) + * Repaired logging with log4j + + +2010-03-08 RELEASE 0.5 + + + 2010-01-27 RELEASE 0.4 New:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/LGPL.txt Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it!
--- a/gnv/NEWS Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/NEWS Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,33 @@ +2010-06-30 RELEASE 1.1 + + * Integrated an enhanced map client for working with gnv internal and + external wms layers + + * N-Step back history for parameterization + + + +2010-04-28 RELEASE 1.0 + + NEW: + + * Support for renaming wms layers + + * Added control elements in the gui for saving and loading projects + + * Support for changing the language between german and english via + button in the gui. + + * Improved error handling. The user is able to reload the current + parameterization with the help of a link shown in the gui if an error + occured. + + * Improve the design of the gui according to BSH style guides. + + +2010-03-08 RELEASE 0.5 + + 2010-01-27 RELEASE 0.4 * Adapted GUI to new concept
--- a/gnv/pom.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/pom.xml Fri Sep 28 12:15:21 2012 +0200 @@ -7,6 +7,11 @@ <version>1.0-SNAPSHOT</version> <name>gnv</name> <url>http://maven.apache.org</url> + <scm> + <connection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv</connection> + <developerConnection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv</developerConnection> + <url>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv</url> + </scm> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -18,6 +23,11 @@ </repository> </repositories> <dependencies> + <dependency> + <groupId>commons-fileupload</groupId> + <artifactId>commons-fileupload</artifactId> + <version>1.2.1</version> + </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -25,14 +35,14 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.restlet</groupId> + <groupId>org.restlet.jse</groupId> <artifactId>org.restlet</artifactId> - <version>2.0-SNAPSHOT</version> + <version>2.0.4</version> </dependency> <dependency> - <groupId>org.restlet</groupId> + <groupId>org.restlet.jse</groupId> <artifactId>org.restlet.ext.xml</artifactId> - <version>2.0-SNAPSHOT</version> + <version>2.0.4</version> </dependency> <dependency> <groupId>tomcat</groupId> @@ -80,6 +90,14 @@ </excludes> </resource> </webResources> + <archive> + <manifest> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + </manifest> + <manifestEntries> + <SCM-Revision>${buildNumber}</SCM-Revision> + </manifestEntries> + </archive> </configuration> </plugin> <plugin> @@ -121,32 +139,21 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>buildnumber-maven-plugin</artifactId> - <version>1.0-beta-2</version> - <executions> - <execution> - <phase>initialize</phase> - <goals> - <goal>create</goal> - </goals> - </execution> - </executions> - <configuration> - <doCheck>false</doCheck> - <doUpdate>false</doUpdate> - <timestampFormat>{0, date, yyyy-MM-dd HH:mm:ss}</timestampFormat> - <format>{0,date,yyyy-MM-dd HH:mm:ss}</format> - <items> - <item>timestamp</item> - </items> - - <revisionOnScmFailure>no_revision</revisionOnScmFailure> - </configuration> - </plugin> - - - + <groupId>org.codehaus.mojo</groupId> + <artifactId>buildnumber-maven-plugin</artifactId> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>create</goal> + </goals> + </execution> + </executions> + <configuration> + <doCheck>false</doCheck> + <doUpdate>false</doUpdate> + </configuration> + </plugin> </plugins> <resources> <resource>
--- a/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,41 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; - import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Basicimplemantation for all Actions which should serv request for + * the GNV. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ArtifactDatabaseActionBase extends Action { + /** + * The id of the action which should used if the execution + * of the action was successful. + */ protected final static String SUCCSESS_FORWARD_ID = "success"; + + /** + * The id of the action which should be used if an exception has occurred + * during the execution. + */ protected final static String EXCEPTION_FORWARD_ID = "success"; /** @@ -35,31 +51,79 @@ super(); } - /** - * @see org.apache.struts.action.Action#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("ArtifactDatabaseActionBase.execute"); - ActionForward forward = mapping.findForward(SUCCSESS_FORWARD_ID); return forward; } /** - * Returns the ExceptionForward for the ArtifactDatabaseActions - * - * @param mapping - * @return + * Returns the Action that should be used if an exception has occurred. + * @param mapping the mapping which holds all available Actions + * @return the Action that should be used. */ protected ActionForward getExceptionForward(ActionMapping mapping) { log.debug("ArtifactDatabaseActionBase.getExceptionForward"); ActionForward lForward = mapping.findForward(EXCEPTION_FORWARD_ID); return lForward; } + + /** + * Encodes the <code>String</code> to prevent cross-site-scripting + * @param s the string that should be encoded + * @return the encoded string + */ + protected String encode(String s) { + log.debug("String to encode: " + s); + s = s.replaceAll("<", "<"); + s = s.replaceAll(">", ">"); + s = s.replaceAll("\"", """); + s = s.replaceAll("&", "&"); + + log.debug("Encoded string: " + s); + return s; + } + + /** + * Encodes the <code>StringArray</code> to prevent cross-site-scripting + * @param s the stringarray that should be encoded + * @return the encoded stringarray + */ + protected String[] encode(String[] s) { + if (s == null) + return null; + + String[] good = new String[s.length]; + for (int i = 0; i < good.length; i++) { + good[i] = encode(s[i]); + } + + return good; + } + + + protected boolean isSessionExhausted(HttpServletRequest request) { + HttpSession session = request.getSession(); + return session.isNew(); + } + + + protected ActionForward sessionExhaustedForward( + ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) + throws Exception + { + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID, + "SessionTimeout has occured"); + + log.warn("Session timed out."); + + return new FetchArtifactFactoriesAction().execute( + mapping, form, request, response); + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,27 +1,43 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action; +import de.intevation.gnv.action.sessionmodel.DiagrammOptions; +import de.intevation.gnv.action.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; + +import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; +import de.intevation.gnv.artifactdatabase.objects.OutputMode; +import de.intevation.gnv.artifactdatabase.objects.OutputParameter; + +import java.text.NumberFormat; +import java.text.ParseException; + import java.util.Collection; import java.util.Iterator; +import java.util.Locale; import java.util.Map; 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.sessionmodel.DiagrammOptions; -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; -import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; -import de.intevation.gnv.artifactdatabase.objects.OutputMode; -import de.intevation.gnv.artifactdatabase.objects.OutputParameter; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This controller is called to change options used in charts and histograms + * (e.g. width, height, etc). + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ChangeOptionsAction extends DescribeUIAction { /** @@ -40,6 +56,10 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + log.debug("NextArtifactStepAction.execute"); try { SessionModel sm = SessionModelFactory.getInstance() @@ -47,28 +67,85 @@ ArtifactDescription ad = sm.getArtifactDescription(); - String target = request.getParameter("target"); + String target = request.getParameter("target"); OutputMode outputMode = sm.getOutputMode(target); + Locale locale = sm.getCurrentLocale(); + if (outputMode != null) { - Collection<OutputParameter> op = outputMode .getOutputParameters(); if (op != null) { Iterator<OutputParameter> it = op.iterator(); + DiagrammOptions oldOptions = sm.getDiagrammOptions(); DiagrammOptions diagrammOptions = new DiagrammOptions(); while (it.hasNext()) { OutputParameter parameter = it.next(); - String value = request.getParameter(parameter.getName()); - if (parameter.getType().equalsIgnoreCase("boolean")){ + String name = parameter.getName(); + Object old = oldOptions != null + ? oldOptions.getValue(name) + : parameter.getValue(); + String value = request.getParameter(name); + String type = parameter.getType(); + + if (log.isDebugEnabled()) { + log.debug("Change chart options now..."); + log.debug("Parameter name: " + name); + log.debug("Parameter type: " + type); + log.debug("Parameter value: " + value); + } + + if (type.equalsIgnoreCase("boolean")){ if (value == null){ value = "false"; } else { value = "true"; } + + diagrammOptions.setValue(name,value); } - diagrammOptions.setValue(parameter.getName(),value); + else if (type.equalsIgnoreCase("integer")) { + if (validInteger(request.getLocale(), value)) { + diagrammOptions.setValue(name, value); + } + else { + log.warn("Text is not a valid integer: "+value); + diagrammOptions.setValue(name, old); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE, + "input.not.a.integer" + ); + + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_VALUE, + value + ); + } + } + else if (type.equalsIgnoreCase("double")) { + try { + double val = parseDoubleValue(locale, value); + String valStr = Double.toString(val); + log.debug("Change diagram options [" + + name +"] to " + val); + diagrammOptions.setValue(name, val); + } + catch (ParseException pe) { + log.warn("Text is not a valid double: "+value); + diagrammOptions.setValue(name, old); + + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE, + "input.not.a.double" + ); + + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_VALUE, + value + ); + } + } } sm.setDiagrammOptions(diagrammOptions); @@ -101,5 +178,34 @@ } } + protected boolean validInteger(Locale locale, String value) { + try { + if (value.split("\\.").length > 1 || value.split("\\,").length > 1){ + return false; + } + + NumberFormat format = NumberFormat.getIntegerInstance(locale); + format.setParseIntegerOnly(true); + Number number = format.parse(value); + + if (number.longValue() < 0) + return false; + + return (number instanceof Integer) || (number instanceof Long); + } + catch (ParseException pe) { + return false; + } + } + + protected double parseDoubleValue(Locale locale, String value) + throws ParseException + { + log.error("LOCALE FOR DOUBLE PARSING: " + locale.toString()); + NumberFormat format = NumberFormat.getNumberInstance(locale); + Number number = format.parse(value); + + return number.doubleValue(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/CommunicationKeys.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/CommunicationKeys.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,47 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action; /** - * - * @author Tim Englich <tim.englich@intevation.de> - * + * This class defines some keys used to store different exception types in the + * session. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class CommunicationKeys { /** * The Key which should be used for accessing ExceptionMessages */ - public final static String REQUEST_EXCEPTION_MESSAGE_ID = "request_exception_message"; + public final static String REQUEST_EXCEPTION_MESSAGE_ID = "request_exception_message_id"; + + + public final static String REQUEST_EXCEPTION_SESSION_ID = "request_exception_session_id"; + + /** + * Key used to store exceptions relating to wrong user input. + */ + public final static String REQUEST_EXCEPTION_INPUT_ID = "request_exception_input_id"; + + /** + * Key used to store exceptions relating to more general errors occured in + * the server. + */ + public final static String REQUEST_EXCEPTION_MESSAGE = "request_exception_message"; + + /** + * Key used to store exceptions relating to an invalid input format. + */ + public final static String REQUEST_EXCEPTION_VALUE = "request_exception_value"; + + /** + * Key used to store exceptions relating to a load/save project error. + */ + public final static String REQUEST_EXCEPTION_PROJECT = "request_exception_project"; } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/CreateChartAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/CreateChartAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,42 @@ -package de.intevation.gnv.action; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +package de.intevation.gnv.action; 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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This controller is called to display charts.<br> + * An attribute 'chart' on the request object is activated which inserts an + * image calling a chart output of the server. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class CreateChartAction extends DescribeUIAction { + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(CreateChartAction.class); + /** + * Constructor + */ public CreateChartAction() { super(); } @@ -33,6 +49,10 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + logger.debug("Create chart."); SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
--- a/gnv/src/main/java/de/intevation/gnv/action/CreateHistogramAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/CreateHistogramAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,42 @@ -package de.intevation.gnv.action; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +package de.intevation.gnv.action; 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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This controller is called to display histograms.<br> + * An attribute 'histogram' on the request object is activated which inserts an + * image calling a histogram output of the server. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class CreateHistogramAction extends DescribeUIAction { + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(CreateHistogramAction.class); + /** + * Constructor + */ public CreateHistogramAction() { super(); } @@ -33,6 +49,10 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + logger.debug("Create histogram."); SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
--- a/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,32 +1,46 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.xml.xpath.XPathConstants; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.w3c.dom.Node; + import de.intevation.gnv.action.sessionmodel.SessionModel; import de.intevation.gnv.action.sessionmodel.SessionModelFactory; - import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; - import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; - +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import de.intevation.gnv.util.ArtifactNamespaceContext; import de.intevation.gnv.util.XMLUtils; import de.intevation.gnv.util.XSLTransformer; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import javax.xml.xpath.XPathConstants; - -import org.apache.log4j.Logger; - -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import org.w3c.dom.Node; - /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This controller is called to fetch the current artifact description using the + * describe operation. The describe document is used to feed an XSL transformer + * that parses the xml and creats html output representing the parameter panel. + * The html code is stored as attribute on the request object which is queried + * in a jsp page later. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DescribeUIAction extends ArtifactDatabaseActionBase { @@ -39,9 +53,15 @@ public static final String XSL_SHEET_STATIC = "WEB-INF/config/templates/describe-ui-static.xsl"; + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(DescribeUIAction.class); + /** + * Constructor + */ public DescribeUIAction() { super(); } @@ -55,28 +75,60 @@ HttpServletResponse response ) throws Exception { + if (isSessionExhausted(request)) { + // session timed out before + return sessionExhaustedForward(mapping, form, request, response); + } + logger.info("describe user interface"); try { // render describe document and create user interface SessionModel sm = SessionModelFactory.getInstance().getSessionModel( request); + Locale tmp = sm.getCurrentLocale(); + Locale locale = tmp != null ? tmp : request.getLocale(); ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory - .getInstance().getArtifactDatabaseClient(getLocale(request)); + .getInstance().getArtifactDatabaseClient(locale); + request.getSession().setAttribute(Globals.LOCALE_KEY, locale); + ArtifactObject artifactFactory = sm.getSelectedArtifactFactory(); + + if (artifactFactory == null) { + logger.error("No connection to artifact server."); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + "java.io.ioexception..connection.refused"); + + return super.getExceptionForward(mapping); + } ArtifactDescription artifactDescription = adc.getCurrentStepDescription( - sm.getSelectedArtifactFactory(), + artifactFactory, sm.getCurrentArtifact(), true); Node currentUI = artifactDescription.getCurrentUI(); if (currentUI != null) { + ResourceBundle res = ResourceBundle.getBundle( + "applicationMessages", locale); + String editText = res.getString( + "gnviewer.history.back.button"); + String exampleLinestring = res.getString( + "gnviewer.example.linestring"); + String examplePolygon = res.getString( + "gnviewer.example.polygon"); + XSLTransformer transformer = new XSLTransformer(); String url = response.encodeURL( mapping.findForward("back").getPath()); transformer.addParameter("back-url", url); + transformer.addParameter("edit", editText); + transformer.addParameter("example-polygon", examplePolygon); + transformer.addParameter( + "example-linestring", + exampleLinestring); String fisUrl = response.encodeURL( mapping.findForward("selectfis").getPath()); @@ -113,7 +165,7 @@ request.getRealPath(XSL_SHEET_STATIC)); if (staticUI != null && staticUI.length() > 1) - request.setAttribute("staticui", staticUI); + request.setAttribute("staticui", staticUI); } return super.execute(mapping, form, request, response);
--- a/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action; import de.intevation.gnv.action.sessionmodel.SessionModel; @@ -31,8 +36,10 @@ import org.apache.struts.action.ActionMapping; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This controller is called to trigger an export (e.g. pdf, svg, image). A + * 'save-file' dialog is opened to save the export. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DoExportAction extends ArtifactDatabaseActionBase { @@ -48,12 +55,7 @@ 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, @@ -62,6 +64,10 @@ HttpServletResponse response) throws Exception { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + try { String target = request.getParameter("target"); String mimeType = request.getParameter("mimetype"); @@ -185,7 +191,7 @@ if (target.equals("chart")) { fileName = fileName + mimeType.substring(mimeType.indexOf("/") + 1); - } + } else if (target.equals("histogram")) { fileName = fileName + mimeType.substring(mimeType.indexOf("/") + 1); @@ -215,3 +221,4 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action; import de.intevation.gnv.action.sessionmodel.SessionModel; @@ -30,8 +35,11 @@ import org.apache.struts.action.ActionMapping; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This controller calls the out operation of the server directly. Html img-tags + * in jsp pages use this action to fetch charts and histograms. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class DoOutputAction extends ArtifactDatabaseActionBase { @@ -47,16 +55,15 @@ 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 { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + log.debug("DoOutputAction.execute"); try { String target = request.getParameter("target");
--- a/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,12 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ -package de.intevation.gnv.action; -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; - -import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; - -import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; +package de.intevation.gnv.action; import java.util.Collection; @@ -16,33 +14,39 @@ 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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; + /** - * @author Tim Englich <tim.englich@intevation.de> - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * + * This controller fetches artifact factories from artifact server and stores + * them on a <code>SessionModel</code> object. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class FetchArtifactFactoriesAction extends ArtifactDatabaseActionBase { + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger .getLogger(FetchArtifactFactoriesAction.class); + /** + * Constructor + */ public FetchArtifactFactoriesAction() { 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, @@ -61,6 +65,14 @@ return super.execute(mapping, form, request, response); } + catch (ArtifactDatabaseClientException e) { + log.error(e, e); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + e.getMessage()); + + return super.getExceptionForward(mapping); + } catch (Exception e) { log.error(e, e); request.setAttribute(
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/LoadAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.action; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.fileupload.FileItemIterator; +import org.apache.commons.fileupload.FileItemStream; +import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.w3c.dom.Document; + +import de.intevation.gnv.action.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; +import de.intevation.gnv.artifactdatabase.objects.Artifact; +import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory; +import de.intevation.gnv.util.ArtifactNamespaceContext; +import de.intevation.gnv.util.XMLUtils; + +/** + * This controller is called for reloading projects from xml files. It waits for + * an xml document named 'document' and feeds the artifact server with this + * document. After a successful feed, the artifact description is fetched and + * displayed in the gui. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class LoadAction extends ArtifactDatabaseActionBase { + + public static final String RESOURCE_UPLOAD_FAILURE = "upload.failure"; + public static final String RESOURCE_INVALID_ARTIFACT = "invalid.artifact"; + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger logger = Logger.getLogger(LoadAction.class); + + /** + * Constructor + */ + public LoadAction() { + super(); + } + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception + { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + + logger.info("Import artifact."); + + ServletFileUpload upload = new ServletFileUpload(); + Document artifactDocument = null; + + try { + FileItemIterator iter = upload.getItemIterator(request); + while (iter.hasNext()) { + FileItemStream item = (FileItemStream) iter.next(); + String name = item.getFieldName(); + + // the file input field of our form is named 'document' + if (name.equals("document")) { + InputStream stream = item.openStream(); + + if (stream.available() == 0) { + logger.error("No artifact document found."); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_PROJECT, + RESOURCE_UPLOAD_FAILURE); + + return super.getExceptionForward(mapping); + } + + artifactDocument = XMLUtils.readDocument(stream); + if (artifactDocument == null) { + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_PROJECT, + RESOURCE_INVALID_ARTIFACT); + + return super.getExceptionForward(mapping); + } + + try { + ArtifactDatabaseClientFactory adcf = + ArtifactDatabaseClientFactory.getInstance(); + ArtifactDatabaseClient adc = + adcf.getArtifactDatabaseClient(getLocale(request)); + ArtifactFactory factory = (ArtifactFactory) + (( List)adc.getArtifactFactories()).get(0); + + SessionModelFactory sf = + SessionModelFactory.getInstance(); + SessionModel sm = sf.getSessionModel(request); + sm.selectArtifactFactory(factory.getId()); + + Document describe = adc.doImport( + factory, + artifactDocument); + + String uuid = XMLUtils.xpathString( + describe, + "/art:result/art:uuid/@value", + ArtifactNamespaceContext.INSTANCE); + String hash = XMLUtils.xpathString( + describe, + "/art:result/art:hash/@value", + ArtifactNamespaceContext.INSTANCE); + + Artifact artifact = new Artifact(uuid, hash); + sm.setCurrentArtifact(artifact); + + if (logger.isDebugEnabled()) { + logger.debug( + "Imported artifact UUID: "+artifact.getId()); + logger.debug( + "Imported artifact HASH: "+artifact.getHash()); + } + } + catch (ArtifactDatabaseClientException adce) { + logger.error(adce, adce); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + adce.getMessage()); + + // XXX + return super.getExceptionForward(mapping); + } + + return new DescribeUIAction().execute( + mapping, form, request, response); + } + } + } + catch (IOException ioe) { + logger.error(ioe, ioe); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_PROJECT, + ioe.getMessage()); + + return super.getExceptionForward(mapping); + } + + // no document found or not valid + logger.error("Upload failure: No document found or invalid."); + + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_PROJECT, + RESOURCE_UPLOAD_FAILURE); + + return super.getExceptionForward(mapping); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/MapClientStandaloneAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +/** + * + */ +package de.intevation.gnv.action; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +/** + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * + */ +public class MapClientStandaloneAction extends ArtifactDatabaseActionBase { + + public final static String MAPCLIENTSTANDALONE_KEY = + "de.intevation.gnv.action.MapClientStandaloneAction"; + /** + * Constructor + */ + public MapClientStandaloneAction() { + super(); + } + + @Override + public ActionForward execute(ActionMapping mapping, ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws Exception { + + request.setAttribute(MAPCLIENTSTANDALONE_KEY, true); + return super.execute(mapping, form, request, response); + } + + +}
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,36 +1,43 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action; -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; - -import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; -import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; - -import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; -import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; -import de.intevation.gnv.artifactdatabase.objects.InputParameter; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.Locale; import java.util.Map; 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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseInputException; +import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; +import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; +import de.intevation.gnv.artifactdatabase.objects.InputParameter; /** - * @author Tim Englich <tim.englich@intevation.de> - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - * + * This controller feeds the artifact server with the current input data and + * refreshes the gui with the current artifact description after the next state + * is reached. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class NextArtifactStepAction extends DescribeUIAction { @@ -47,12 +54,6 @@ 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, @@ -61,6 +62,10 @@ SessionModel sm = SessionModelFactory.getInstance() .getSessionModel(request); ArtifactDescription ad = sm.getArtifactDescription(); + + Locale tmp = sm.getCurrentLocale(); + Locale locale = tmp != null ? tmp : request.getLocale(); + if (ad != null){ Collection<String> inputParameter = ad.getInputParameter(); Collection<InputParameter> ips = null; @@ -75,8 +80,8 @@ } } ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory - .getInstance() - .getArtifactDatabaseClient(getLocale(request)); + .getInstance().getArtifactDatabaseClient(locale); + Map outs = ad.getOutputModes(); if (outs == null || outs.isEmpty()) { // TODO: Woher kommt der zu erreichende Status; @@ -91,21 +96,28 @@ } else { target = ad.getReachableStates().iterator().next(); } - + try { adc.doNextStep( - sm.getSelectedArtifactFactory(), + sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), target, ips ); - } catch (Exception e) { + } + catch (ArtifactDatabaseInputException e) { log.error(e, e); request.setAttribute( - CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e - .getMessage()); + CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID, + e.getMessage()); } - + catch (Exception e) { + log.error(e, e); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + e.getMessage()); + } + Map tmpOuts = ad.getOutputModes(); request.setAttribute( "furthertargets", @@ -118,23 +130,28 @@ sm.getCurrentArtifact(), true ); - + request.setAttribute("diagramm", true); - - } catch (Exception e) { + + } + catch (ArtifactDatabaseInputException e) { + log.error(e, e); + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID, + e.getMessage()); + } + catch (Exception e) { log.error(e, e); request.setAttribute( CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); } - + request.setAttribute("furthertargets", false); } }else{ log.warn("SessionTimeout has occured"); - request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, - "SessionTimeout has occured"); - new FetchArtifactFactoriesAction().execute(mapping, form, request, response); + return sessionExhaustedForward(mapping, form, request, response); } return super.execute(mapping, form, request, response); }
--- a/gnv/src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,37 +1,51 @@ -package de.intevation.gnv.action; - -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; -import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; - -import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; -import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; +package de.intevation.gnv.action; 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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This controller is used to step back to a previous state of the current + * artifact. After calling the advance operation of the artifact server have + * been called successfully, the describe document of the current artifact is + * fetched and a new gui is rendered. * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class PreviousArtifactStepAction extends DescribeUIAction { public static final String URL_STATE_KEY = "target"; + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(PreviousArtifactStepAction.class); + /** + * Constructor + */ public PreviousArtifactStepAction() { super(); } @@ -45,8 +59,6 @@ HttpServletResponse response ) throws Exception { - String id = request.getSession().getId(); - SessionModel session = SessionModelFactory.getInstance().getSessionModel( request); @@ -54,12 +66,10 @@ if (ad == null) { logger.warn("Session timed out."); request.setAttribute( - CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, + CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID, "SessionTimeout has occured"); - new FetchArtifactFactoriesAction().execute( + return new FetchArtifactFactoriesAction().execute( mapping, form, request, response); - - return super.execute(mapping, form, request, response); } // TODO check if target is reachable
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action; import java.util.Collection; @@ -13,22 +18,19 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.w3c.dom.Node; - import de.intevation.gnv.action.sessionmodel.SessionModel; import de.intevation.gnv.action.sessionmodel.SessionModelFactory; import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; -import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; -import de.intevation.gnv.util.XMLUtils; -import de.intevation.gnv.util.XSLTransformer; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This controller is called to select a specific fis. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ -public class SelectArtifactFactoryAction extends ArtifactDatabaseActionBase { +public class SelectArtifactFactoryAction extends DescribeUIAction { + /** * the logger, used to log exceptions and additonaly information */ @@ -36,11 +38,12 @@ .getLogger(SelectArtifactFactoryAction.class); /** - * @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) + * Constructor */ + public SelectArtifactFactoryAction() { + super(); + } + @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -65,48 +68,13 @@ sm.selectArtifactFactory(selectedArtifactFactoryID); ArtifactObject af = sm.getSelectedArtifactFactory(); - ; + ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory .getInstance() .getArtifactDatabaseClient(getLocale(request)); ArtifactObject artifact = adc.createNewArtifact(af); sm.setCurrentArtifact(artifact); - ArtifactDescription artifactdescription = adc - .getCurrentStepDescription(af, artifact,true); - - String fisUrl = response.encodeURL( - mapping.findForward("selectfis").getPath()); - - XSLTransformer transformer = new XSLTransformer(); - transformer.addParameter("selectfis", fisUrl); - - Node dynamicUINode = new XMLUtils().getNodeXPath( - artifactdescription.getCurrentUI(), "art:dynamic" - ); - - if (dynamicUINode != null){ - String ui = transformer.transform( - dynamicUINode, - "UTF-8", - request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); - - request.setAttribute("ui", ui); - } - - Node staticUINode = new XMLUtils().getNodeXPath( - artifactdescription.getCurrentUI(), "art:static" - ); - - if (staticUINode != null) { - String staticUI = transformer.transform( - staticUINode, - "UTF-8", - request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); - request.setAttribute("staticui", staticUI); - } - - // return succsess return super.execute(mapping, form, request, response); } catch (Exception e) { log.error(e, e); @@ -116,11 +84,5 @@ return super.getExceptionForward(mapping); } } - - /** - * Constructor - */ - public SelectArtifactFactoryAction() { - } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectFisAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectFisAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,23 +1,35 @@ -package de.intevation.gnv.action; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import de.intevation.gnv.action.sessionmodel.SessionModel; -import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +package de.intevation.gnv.action; 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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This controller is used to step back to the fis selection. It is called when + * pushing the step-back button besides the currently selected fis. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class SelectFisAction extends ArtifactDatabaseActionBase { + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(SelectFisAction.class); @Override
--- a/gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action; import java.util.Collection; @@ -17,13 +25,22 @@ import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This controller is used to display to statistic of the current + * parameterization. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class ShowStatisticAction extends DescribeUIAction { + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(ShowStatisticAction.class); + /** + * Constructor + */ public ShowStatisticAction() { super(); } @@ -37,6 +54,10 @@ HttpServletResponse response ) throws Exception { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + logger.info("show statistic"); SessionModel sm = SessionModelFactory.getInstance().getSessionModel( request); @@ -60,3 +81,4 @@ return super.execute(mapping, form, request, response); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/StoreAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.action; + +import java.io.OutputStream; + +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.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; + +/** + * This controller is used to save the current artifact to an xml file. A file + * dialog is opened to save the file to the local disk. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class StoreAction extends ArtifactDatabaseActionBase { + + public static final String RESOURCE_DOWNLOAD_FAILURE = "no.artifact.chosen"; + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger logger = Logger.getLogger(StoreAction.class); + + /** + * Constructor + */ + public StoreAction() { + super(); + } + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception + { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + + SessionModelFactory sf = SessionModelFactory.getInstance(); + SessionModel sm = sf.getSessionModel(request); + + ArtifactDatabaseClientFactory adcf = + ArtifactDatabaseClientFactory.getInstance(); + ArtifactDatabaseClient adc = + adcf.getArtifactDatabaseClient(getLocale(request)); + ArtifactObject artifact = sm.getCurrentArtifact(); + + // no artifact set at the moment (which means, the user didn't select a + // fis yet. + if (artifact == null) { + logger.warn("No artifact/fis selected yet."); + + request.setAttribute( + CommunicationKeys.REQUEST_EXCEPTION_PROJECT, + RESOURCE_DOWNLOAD_FAILURE); + + return super.execute(mapping, form, request, response); + } + + logger.info("Export artifact " + artifact.getId()); + setHeaders(response, artifact.getId()); + + OutputStream out = response.getOutputStream(); + adc.doExport( + sm.getSelectedArtifactFactory(), + artifact, + out); + + out.flush(); + out.close(); + + return null; + } + + /** + * Sets the header of the response. + * @param response the response + * @param uuid the uuid of the artifact + */ + protected void setHeaders(HttpServletResponse response, String uuid) { + String filename = "GNVArtefakt_" + uuid + ".xml"; + + response.setHeader("Content-Type", "application/xml"); + response.setHeader( + "Content-Disposition", + "attachment;filename=" + filename); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.action; + +import de.intevation.gnv.action.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; + +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +/** + * Toggle the current language used to create the user interface. Two + * languages are available now - german and english. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class SwitchLanguageAction extends DescribeUIAction { + + public static Logger logger = Logger.getLogger(SwitchLanguageAction.class); + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response + ) throws Exception + { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + + SessionModelFactory factory = SessionModelFactory.getInstance(); + SessionModel sm = factory.getSessionModel(request); + Locale locale = switchLanguage(sm.getCurrentLocale()); + + sm.setCurrentLocale(locale); + ArtifactObject artifactFactory = sm.getSelectedArtifactFactory(); + + if (artifactFactory == null) { + request.getSession().setAttribute(Globals.LOCALE_KEY, locale); + return mapping.findForward(SUCCSESS_FORWARD_ID); + } + + return super.execute(mapping, form, request, response); + } + + + /** + * This method toggles between german and english language. + * + * @param currentLocale The locale which is currently used. + * @return an english locale, if the current locale is german - otherwise + * a german locale. + */ + protected Locale switchLanguage(Locale currentLocale) { + if (currentLocale.getLanguage().equals(Locale.GERMAN.getLanguage())) { + logger.info("Switch from german to english locale."); + return Locale.ENGLISH; + } + else { + logger.info("Switch from english to german locale."); + return Locale.GERMAN; + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/WMSAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/WMSAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,19 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -7,18 +21,34 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; -import org.w3c.dom.Document; - +import de.intevation.gnv.action.sessionmodel.DiagrammOptions; import de.intevation.gnv.action.sessionmodel.SessionModel; import de.intevation.gnv.action.sessionmodel.SessionModelFactory; import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; +import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; +import de.intevation.gnv.artifactdatabase.objects.InputParameter; +import de.intevation.gnv.artifactdatabase.objects.OutputMode; +import de.intevation.gnv.artifactdatabase.objects.OutputParameter; +import de.intevation.gnv.artifactdatabase.objects.map.DefaultLayer; +import de.intevation.gnv.artifactdatabase.objects.map.DefaultMapService; +import de.intevation.gnv.artifactdatabase.objects.map.Layer; +import de.intevation.gnv.artifactdatabase.objects.map.MapService; import de.intevation.gnv.util.XMLUtils; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This controller is used to publish the results of the current artifact as + * WMS. The wms export mode of the artifact server is triggered which feeds a + * MapServer with the given shapefiles (path to the shapefiles is stored in the + * artifact). After calling this controller, the shapefiles are ready to be + * queried as WMS layers. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class WMSAction extends DescribeUIAction { @@ -28,6 +58,21 @@ public static final String XPATH_MAPSERVER_MAPFILE = "/art:meta/art:mapserver/art:map/text()"; + public static final String XPATH_LAYERNODESET = + "/art:meta/art:layer"; + + public static final String XPATH_LAYER_TITLE = + "art:title/text()"; + + public static final String XPATH_LAYER_NAME = + "art:name/text()"; + + public static final String XPATH_TTL = + "/art:meta/art:mapserver/art:ttl/text()"; + + public static final String XPATH_BBOX = + "/art:meta/art:mapserver/art:Box/art:coordinates/text()"; + /** * the logger, used to log exceptions and additonaly information */ @@ -44,10 +89,47 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { + if (isSessionExhausted(request)) { + return sessionExhaustedForward(mapping, form, request, response); + } + logger.debug("WMSAction.execute"); try { SessionModel sm = SessionModelFactory.getInstance().getSessionModel( request); + + OutputMode outputMode = sm.getOutputMode("wms"); + Collection<InputParameter> ips = null; + if (outputMode != null) { + Collection<OutputParameter> inputParameter = + outputMode.getOutputParameters(); + + if (inputParameter != null) { + ips = new ArrayList<InputParameter>(inputParameter.size()); + Iterator<OutputParameter> it = inputParameter.iterator(); + DiagrammOptions diagrammOptions = new DiagrammOptions(); + + int params = 0; + while (it.hasNext()) { + String name = it.next().getName(); + String[] values = request.getParameterValues(name); + String value = request.getParameter(name); + InputParameter ip = new DefaultInputParameter(name, + encode(values)); + ips.add(ip); + + if (value != null) { + ++params; + diagrammOptions.setValue(name, encode(value)); + } + } + + if (params > 0) { + sm.setDiagrammOptions(diagrammOptions); + } + } + } + ArtifactObject artifact = sm.getCurrentArtifact(); ArtifactDatabaseClientFactory factory = @@ -57,17 +139,78 @@ ArtifactObject artifactfactory = sm.getSelectedArtifactFactory(); // do wms publishing - Document meta = adc.publishWMS(artifactfactory, artifact); + Document meta = adc.publishWMS(artifactfactory,artifact,ips); + + // read the Server-information String mapserverPath = XMLUtils.getStringXPath( meta, XPATH_MAPSERVER_PATH); String mapfilePath = XMLUtils.getStringXPath( meta, XPATH_MAPSERVER_MAPFILE); + String tmpTTL = XMLUtils.getStringXPath( + meta, XPATH_TTL); + + String bbox = XMLUtils.getStringXPath(meta, XPATH_BBOX); + String ttl = null; + if (tmpTTL != null) { + DateFormat df = DateFormat.getDateTimeInstance( + DateFormat.LONG, + DateFormat.LONG, + request.getLocale()); - request.setAttribute("mapserver", mapserverPath); - request.setAttribute("mapfile", mapfilePath); - request.setAttribute("layer", artifact.getId()); + try { + long tmp = Long.parseLong(tmpTTL); + ttl = df.format(new Date(tmp)); + } + catch (NumberFormatException nfe) { + logger.error("Error while parsing time to live."); + logger.error(nfe,nfe); - return super.execute(mapping, form, request, response); + ttl = ""; + } + } + + if (logger.isDebugEnabled()) { + logger.debug("Mapserver path: " + mapserverPath); + logger.debug("Mapfile path: " + mapfilePath); + logger.debug("Layer ttl: " + ttl); + } + // read the layer information + + NodeList layerNodes = XMLUtils.getNodeSetXPath(meta, + XPATH_LAYERNODESET); + Collection<Layer> layers = null; + if (layerNodes != null && layerNodes.getLength() > 0){ + layers = new ArrayList<Layer>(layerNodes.getLength()); + for (int i = 0 ; i < layerNodes.getLength(); i++){ + Node tmpLayerNode = layerNodes.item(i); + String layerName = XMLUtils.getStringXPath( + tmpLayerNode, XPATH_LAYER_NAME); + String layerTitle = XMLUtils.getStringXPath( + tmpLayerNode, XPATH_LAYER_TITLE); + // TODO: write layerTitle to title and not to id + Layer currentLayer = new DefaultLayer(layerTitle, layerName, + false, null); + layers.add(currentLayer); + } + } + + + + + // TODO PUT MAPFILEPATH AND TTL to MapServiceObject + + if (mapserverPath != null && + mapfilePath != null) { + request.setAttribute("wms_published", Boolean.TRUE); + + MapService mapService = new DefaultMapService("0815", layers, + "UMN", mapserverPath, + bbox,ttl); + sm.setLocalMapService(mapService); + return super.execute(mapping, form, request, response); + }else{ + return super.execute(mapping, form, request, response); + } } catch (Exception e) { logger.error(e, e); @@ -78,6 +221,5 @@ return super.getExceptionForward(mapping); } } - } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,15 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action.mapviewer; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; @@ -22,11 +31,16 @@ import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import de.intevation.gnv.artifactdatabase.objects.map.MapService; +import de.intevation.gnv.util.CaptureInputStream; /** - * - * @author Tim Englich <tim.englich@intevation.de> - * + * This class provides the businesslogic for handling an + * MV-GNV-Interface-call. + * This call can be done in two ways. + * First is to put the requestbody into the body of the http-post-request. + * Second to put the requestbody to the parameter "document" of the + * http-post-request. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class MapViewerCallAction extends ArtifactDatabaseActionBase { @@ -58,33 +72,44 @@ }else{ inputStream = request.getInputStream(); } - + if (inputStream != null){ + CaptureInputStream capture = log.isDebugEnabled() + ? new CaptureInputStream(inputStream) + : null; + try { - ExternalCallParser ecp = new XMLExternalCallParser(inputStream); + ExternalCallParser ecp = new XMLExternalCallParser( + capture != null ? capture : inputStream); ecp.parse(); + + // print incoming data to log + if (capture != null) { + log.debug("REQUEST DOCUMENT: " + capture.copyToString()); + } + String geometry = ecp.getGeometry(); String srs = ecp.getSRS(); Collection<MapService> mapServices = ecp.getMapServices(); - - Collection<ArtifactObject> availableFactories = + + Collection<ArtifactObject> availableFactories = ArtifactDatabaseClientFactory .getInstance() .getArtifactDatabaseClient(getLocale(request)) .getArtifactFactoryMetaInformation(mapServices, geometry, srs); - - Collection<ArtifactObject> providedFactories = + + Collection<ArtifactObject> providedFactories = ArtifactDatabaseClientFactory .getInstance() .getArtifactDatabaseClient(getLocale(request)) .getArtifactFactories(); - + // Sort out which ArtifactFactories should not be used. - Collection<ArtifactObject> usedFactories = + Collection<ArtifactObject> usedFactories = new ArrayList<ArtifactObject>(availableFactories.size()); - + Iterator<ArtifactObject> it = availableFactories.iterator(); while (it.hasNext()){ ArtifactObject ao = it.next(); @@ -92,7 +117,7 @@ usedFactories.add(ao); } } - + SessionModel sm = SessionModelFactory .getInstance() .getSessionModel(request);
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.mapviewer; import javax.servlet.http.HttpServletRequest; @@ -14,8 +19,9 @@ import de.intevation.gnv.action.ArtifactDatabaseActionBase; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This class provides the businesslogic to show the demo GUI for + * testing the MV-GNV-Interface. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ShowMapViewerCallBodyAction extends ArtifactDatabaseActionBase { @@ -24,7 +30,7 @@ */ private static Logger log = Logger .getLogger(ShowMapViewerCallBodyAction.class); - + /** * Constructor */ @@ -40,7 +46,4 @@ request.setAttribute("MAPVIEWERCALL", new Boolean(true)); return super.execute(mapping, form, request, response); } - - - }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides actions for handling the MV-GNV-Interface calls. +</body> +</html>
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.mapviewer.parser; import java.util.Collection; @@ -8,17 +13,33 @@ import de.intevation.gnv.artifactdatabase.objects.map.MapService; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Interfacedefinition for an XMl-parser of the MV-GNV-Interface requestdocument. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ExternalCallParser { - + + /** + * Returns the geometry which was parsed from the XML-document. + * @return the geometry. + */ String getGeometry(); - + + /** + * Returns the srid which was parsed from the XML-document. + * @return the srid. + */ String getSRS(); - + + /** + * Returns the mapservices which was parsed from the XML-document. + * @return the mapservices. + */ Collection<MapService> getMapServices(); - + + /** + * Does the parsing work. + * @throws ExternalCallParserException + */ void parse() throws ExternalCallParserException; }
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,9 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.mapviewer.parser; + /** - * @author Tim Englich <tim.englich@intevation.de> + * Exceptionclass for qualifying exception which were caused by the + * <code>ExternalCallParser.</code> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ExternalCallParserException extends Exception {
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.mapviewer.parser; import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; - import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -20,16 +24,19 @@ import de.intevation.gnv.util.XMLUtils; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This class provides an XMl-Parser which try's to create an DOM from + * an given Inputstream. Is this is possible it try to read the required + * informations e.g. Mapservices, Layer, SRID and Geometry from the + * document. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class XMLExternalCallParser implements ExternalCallParser { - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(XMLExternalCallParser.class); - + private static String XPATH_GEOMETRY = "/gnviewer/location/data"; private static String XPATH_SRS = "/gnviewer/location/srs"; private static String XPATH_MAPSERVICES_NODESET = "/gnviewer/mapservices/mapservice"; @@ -38,48 +45,55 @@ private static String ATTRIBUTE_NAME = "name"; private static String ATTRIBUTE_TYPE = "type"; private static String ATTRIBUTE_URL = "url"; + + /** + * The geometry which was parsed from the document. + */ + private String geometry = null; - private String geometry = null; + /** + * The srid which was parsed from the document. + */ private String srs = null; - + + /** + * The mapservices that were parsed from the document. + */ private Collection<MapService> mapServices = null; - + + /** + * The inputstream where the data should be read from. + */ private InputStream inputStream = null; /** * Constructor + * @param inputStream The stream where the data should be read from */ public XMLExternalCallParser(InputStream inputStream) { this.inputStream = inputStream; } - /** - * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#getGeometry() - */ public String getGeometry() { return this.geometry; } - /** - * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#getMapServices() - */ public Collection<MapService> getMapServices() { return this.mapServices; } - /** - * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#parse() - */ public void parse() throws ExternalCallParserException { if (inputStream != null){ XMLUtils xmlUtils = new XMLUtils(); Document document = xmlUtils.readDocument(this.inputStream); if (document != null){ - - this.geometry = xmlUtils.getStringXPath(document, XPATH_GEOMETRY); + + this.geometry = xmlUtils.getStringXPath(document, + XPATH_GEOMETRY); this.srs = xmlUtils.getStringXPath(document, XPATH_SRS); - NodeList mapservicesNodes = - xmlUtils.getNodeSetXPath(document, XPATH_MAPSERVICES_NODESET); + NodeList mapservicesNodes = + xmlUtils.getNodeSetXPath(document, + XPATH_MAPSERVICES_NODESET); if (mapservicesNodes != null){ this.mapServices = new ArrayList<MapService>(mapservicesNodes.getLength()); for (int i = 0; i < mapservicesNodes.getLength(); i++){ @@ -95,20 +109,22 @@ }else{ log.debug("No Layer given for this Mapservice"); } - MapService mapService = + MapService mapService = new DefaultMapService(mapserviceID, layer, mapserviceType, mapserviceUrl); this.mapServices.add(mapService); } - + }else{ - String errMsg = "XML-Document does not contain any Mapservices which are required."; + String errMsg = "XML-Document does not contain any " + + "Mapservices which are required."; log.error(errMsg); throw new ExternalCallParserException(errMsg); } - + }else{ - String errMsg = "XML-Document could not be read from InputStream."; + String errMsg = "XML-Document could not " + + "be read from InputStream."; log.error(errMsg); throw new ExternalCallParserException(errMsg); } @@ -118,24 +134,27 @@ throw new ExternalCallParserException(errMsg); } } - + /** * This Method extracts all Layers and put them into the Collection. - * @param layer - * @param groupId - * @param layerNodes - * @return + * @param layer the collection where the layer should be add to. + * @param groupId the id of the group of the layers + * @param layerNodes the Nodes which should contain the intormations + * about layers + * @return the layer */ - private Collection<Layer> extractLayer(Collection<Layer> layer, String groupId, NodeList layerNodes){ - XMLUtils xmlUtils = new XMLUtils(); + private Collection<Layer> extractLayer(Collection<Layer> layer, + String groupId, + NodeList layerNodes){ for (int i = 0; i < layerNodes.getLength(); i++){ Element layerNode = (Element)layerNodes.item(i); String id = layerNode.getAttribute(ATTRIBUTE_ID); String name = layerNode.getAttribute(ATTRIBUTE_NAME); - NodeList localLayerNodes = xmlUtils.getNodeSetXPath(layerNode, XPATH_LAYER); - Layer tmpLayer = new DefaultLayer(id, name, - (localLayerNodes != null && - localLayerNodes.getLength() > 0), + NodeList localLayerNodes = XMLUtils.getNodeSetXPath(layerNode, + XPATH_LAYER); + Layer tmpLayer = new DefaultLayer(id, name, + (localLayerNodes != null && + localLayerNodes.getLength() > 0), groupId); layer.add(tmpLayer); if (localLayerNodes != null && localLayerNodes.getLength() > 0){ @@ -145,9 +164,6 @@ return layer; } - /** - * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#getSRS() - */ public String getSRS() { return this.srs; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides the XML-parser for parsing the XML-Documents which +were send by the MapViewer to the GMV-WebClient. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Controller triggered after user interactions. +</body> +</html>
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,10 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.sessionmodel; import java.util.Collection; import java.util.Iterator; +import java.util.Locale; import org.apache.log4j.Logger; @@ -12,13 +18,19 @@ import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; import de.intevation.gnv.artifactdatabase.objects.OutputMode; +import de.intevation.gnv.artifactdatabase.objects.map.MapService; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The default implementation of <code>SessionModel</code> which stores the + * current artifact object and the digram options selected by the user. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class DefaultSessionModel implements SessionModel { + + /** * the logger, used to log exceptions and additonaly information */ @@ -29,26 +41,56 @@ */ private static final long serialVersionUID = 3431484439985158311L; + /** + * Container for <code>ArtifactFactory</code>-objects. + */ private Collection<ArtifactObject> artifactFactories = null; + /** + * The selected <code>ArtifactFactory</code> + */ private ArtifactObject selectedArtifactFactory = null; + /** + * The currently used artifact. + */ private ArtifactObject currentArtifact = null; + /** + * The Diagrammoptions. + */ private DiagrammOptions diagrammOptions = null; + /** + * The Container for statistic-values. + */ private Collection<ArtifactStatisticsSet> statistics = null; /** + * The Locale that currently should be used. + */ + private Locale currentLocale; + + /** + * The Mapservice containing all Layers that should be displayed. + */ + private MapService localMapService = null; + /** * Constructor */ public DefaultSessionModel() { - super(); + this(null); } /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#selectArtifactFactory(java.lang.String) + * Constructor + * @param currentLocale A locale used to create the user interface. */ + public DefaultSessionModel(Locale currentLocale) { + this.currentLocale = currentLocale; + } + + public void selectArtifactFactory(String artiFactFactoryId) { Collection<ArtifactObject> artifactObjects = this .getArtifactFactories(); @@ -70,59 +112,43 @@ } } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#setArtifacteFactories(java.util.Collection) - */ + public void setArtifacteFactories( - Collection<ArtifactObject> artifactFactories) { + Collection<ArtifactObject> artifactFactories) { this.artifactFactories = artifactFactories; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getAttributeFactories() - */ + public Collection<ArtifactObject> getArtifactFactories() { return this.artifactFactories; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getSelectedArtifactFactory() - */ + public ArtifactObject getSelectedArtifactFactory() { return this.selectedArtifactFactory; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getCurrentArtifact() - */ + public ArtifactObject getCurrentArtifact() { return this.currentArtifact; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#setCurrentArtifact(de.intevation.gnv.artifactdatabase.objects.ArtifactObject) - */ + public void setCurrentArtifact(ArtifactObject artifact) { this.currentArtifact = artifact; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getDiagrammOptions() - */ + public DiagrammOptions getDiagrammOptions() { return this.diagrammOptions; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#setDiagrammOptions(de.intevation.gnv.action.sessionmodel.DiagrammOptions) - */ + public void setDiagrammOptions(DiagrammOptions diagrammOptions) { this.diagrammOptions = diagrammOptions; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getArtifactDescription() - */ + public ArtifactDescription getArtifactDescription() { if (this.currentArtifact != null) { return (ArtifactDescription) this.currentArtifact; @@ -130,9 +156,7 @@ return null; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getOutputMode(java.lang.String) - */ + public OutputMode getOutputMode(String name) { ArtifactDescription ad = this.getArtifactDescription(); if (ad != null) { @@ -143,9 +167,7 @@ return null; } - /** - * @see de.intevation.gnv.action.sessionmodel.SessionModel#resetModel() - */ + public void resetModel() { log.debug("DefaultSessionModel.resetModel"); this.selectedArtifactFactory = null; @@ -155,9 +177,7 @@ } - /**b - * @see de.intevation.gnv.action.sessionmodel.SessionModel#getStatistics() - */ + public Collection<ArtifactStatisticsSet> getStatistics() { return this.statistics; } @@ -165,4 +185,21 @@ public void setStatistics(Collection<ArtifactStatisticsSet> statistics) { this.statistics = statistics; } + + public Locale getCurrentLocale() { + return currentLocale; + } + + public void setCurrentLocale(Locale currentLocale) { + this.currentLocale = currentLocale; + } + + public MapService getLocalMapService() { + return this.localMapService; + } + + public void setLocalMapService(MapService mapService) { + this.localMapService = mapService; + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,28 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.sessionmodel; +import java.text.NumberFormat; + import java.util.HashMap; +import java.util.Locale; import java.util.Map; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Stores key-value pairs used to save user input for changing diagram + * attributes. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DiagrammOptions { - private Map<String, String> values = new HashMap<String, String>(); + private Map<String, Object> values = new HashMap<String, Object>(); /** * Constructor @@ -22,17 +32,42 @@ } /** - * @return + * Returns the Value to a given Key + * @param key The key of the value that should be returned. + * @return the value. */ - public String getValue(String key) { + public Object getValue(String key) { return this.values.get(key); } + + /** + * Returns the value as string. + * @param key The key of the value that should be returned. + * @param locale A locale object used to format numbers. + * @return the value as string. + */ + public String getValue(String key, Locale locale) { + Object obj = values.get(key); + + if (obj instanceof Double && locale != null) { + Double value = (Double) obj; + NumberFormat format = NumberFormat.getNumberInstance(locale); + + return format.format(value); + } + + return (String) obj; + } + /** - * @param width + * Set a value with the given key. + * + * @param key The given key. + * @param value The value to be stored. */ - public void setValue(String key, String value) { - this.values.put(key, value); + public void setValue(String key, Object value) { + values.put(key, value); } - -} \ No newline at end of file +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,46 +1,141 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.sessionmodel; import java.io.Serializable; import java.util.Collection; +import java.util.Locale; import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; import de.intevation.gnv.artifactdatabase.objects.OutputMode; +import de.intevation.gnv.artifactdatabase.objects.map.MapService; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface describe basic methods to store artifacts and diagram options. + * The SessionModel is saved in the session, which keeps alive during the work. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface SessionModel extends Serializable { + /** + * Returns all Artifactfactories which were retrieved from the + * Artifactdatabases which are connected to the Client. + * @return the artifactfactories. + */ Collection<ArtifactObject> getArtifactFactories(); + /** + * Sets all Artifactfactories which were retieved from the Artifactdatabases + * to the SessionModel. + * @param artifactFactories the artifactfactories. + */ void setArtifacteFactories(Collection<ArtifactObject> artifactFactories); + /** + * Set the Artifactfactory which match to the given id to selected. + * @param artiFactFactoryId the id of the artifactfactory which should + * be selected. + */ void selectArtifactFactory(String artiFactFactoryId); + /** + * Returns the Artifactfactory which is selected. + * @return the artifactfactory which is selected. + */ ArtifactObject getSelectedArtifactFactory(); + /** + * Returns the currently used artifact. + * This Artifact will retrieved from the selected artifactfactory and will + * be used to do handle the special businesslogic. + * @return the artifact which is currently used. + */ ArtifactObject getCurrentArtifact(); + /** + * Sets a new Artifact as the artifact that should be used. + * @param artifact the new artifact which should be used. + */ void setCurrentArtifact(ArtifactObject artifact); + /** + * Sets the currently used diagrammoptions to the Sessionmodel. + * Diagrammoptions will be used to manipulate the look of diagramms + * and render the GUI so that the user is enabled to switch the options. + * Diagrammoptions are also used for Histogram, all Exports and WMS + * @param diagrammOptions the Options that should be used. + */ void setDiagrammOptions(DiagrammOptions diagrammOptions); + /** + * Returns the diagrammoptions that currently set to the SessionModel. + * @return the diagrammoptions that currently set to the SessionModel. + */ DiagrammOptions getDiagrammOptions(); + /** + * Returns the Outputmode that matches to the given name of an mode. + * Outputmodes are used to define which kind of modes are defined to + * generate an result for a given Artifact (chart, export, wms,...) + * @param name the name of the OutputMode that should be used + * @return the OutputMode that matches to the given name. + */ OutputMode getOutputMode(String name); + /** + * Returns the description to the currently used Artifact. + * The description can be used to retrieve the supported OutputModes, + * the parameters that could be feed, ... + * @return the description of the artifact which is currently used. + */ ArtifactDescription getArtifactDescription(); + /** + * Reset the Model. So that it will have the status as no Artifactfactory + * was selected. + */ void resetModel(); + /** + * Sets the Statistics that were retrieved from the currently used Artifact + * to the SessionModel. + * @param statistics the Statistics that should be shown in the GUI. + */ void setStatistics(Collection<ArtifactStatisticsSet> statistics); + /** + * Returns the statistics that are currently set to the SessionModel + * @return the statistics that are currently set to the SessionModel + */ Collection<ArtifactStatisticsSet> getStatistics(); + /** + * Sets the locale that should be used. + * The loacle will be used to customize the GUI for a language that matches + * to the locale or it will be used to tell the Artifactdatabase which locale + * has to be used. + * @param locale the locale that should be used. + */ + void setCurrentLocale(Locale locale); + + /** + * Returns the currently used locale. + * @return the locale that is currently used. + */ + Locale getCurrentLocale(); + + void setLocalMapService(MapService mapService); + + MapService getLocalMapService(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.action.sessionmodel; import javax.servlet.http.HttpServletRequest; @@ -8,12 +13,20 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Creates and restores <code>SessionModel</code> objects from <code> + * HttpServletRequest</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class SessionModelFactory { - public final static String SESSION_MODEL_ID = "de.intevation.gnv.action.sessionmodel.SessionModel.ID"; + /** + * The id of the <code>SessionModel</code> that must be used to lookup the + * model from the given <code>HttpSession<Code> of the request. + */ + public final static String SESSION_MODEL_ID = "de.intevation.gnv.action." + + "sessionmodel.SessionModel.ID"; + /** * the logger, used to log exceptions and additonaly information */ @@ -33,10 +46,10 @@ /** * This Method provides an singleton Instance of this Class. - * * @return an singleton Instance of this Class */ public synchronized static SessionModelFactory getInstance() { + log.debug("SessionModelFactory.getInstance"); if (instance == null) { instance = new SessionModelFactory(); } @@ -45,22 +58,23 @@ /** * Getting the ArtifactDatabaseClient - * + * @param request the tequest from which the SessionModel should be read. * @return the ArtifactDatabaseClient */ public SessionModel getSessionModel(HttpServletRequest request) { + log.debug("SessionModelFactory.getSessionModel"); synchronized (request) { SessionModel sm = null; Object obj = request.getSession().getAttribute(SESSION_MODEL_ID); if (obj instanceof SessionModel) { sm = (SessionModel) obj; } else { - sm = new DefaultSessionModel(); + sm = new DefaultSessionModel(request.getLocale()); request.getSession().setAttribute(SESSION_MODEL_ID, sm); } return sm; } } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,10 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides the classes and interface-definitions for providing an +SessionModel for storing Information which can be reused during a session. +</body> +</html> +
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifactdatabase.client; import java.io.IOException; @@ -8,15 +16,20 @@ import org.w3c.dom.Document; import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; +import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseInputException; import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; +import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; import de.intevation.gnv.artifactdatabase.objects.InputParameter; import de.intevation.gnv.artifactdatabase.objects.map.MapService; /** - * @author Tim Englich (tim.englich@intevation.de) - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This interface describes basic methods for the communication between artifact + * server and this client. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public interface ArtifactDatabaseClient { @@ -26,75 +39,106 @@ /** * Return the Artifactfactories which can be resolved. - * + * * @return the Artifactfactories which can be resolved. - * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseClientException if a general error occured in the + * artifact server. + * @throws ArtifactDatabaseInputException if the input data was valid. */ public Collection<ArtifactObject> getArtifactFactories() - throws ArtifactDatabaseClientException; + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; /** - * + * Call the create operation of the artifact server and returns a new + * artifact with the information returned by the artifact server. + * * @param artifactFactory * @return the new Artifact - * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseClientException if a general error occured in the + * artifact server. + * @throws ArtifactDatabaseInputException if the input data was valid. */ public ArtifactObject createNewArtifact(ArtifactObject artifactFactory) - throws ArtifactDatabaseClientException; + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; /** - * + * Call the describe operation of the artifact server. + * + * @param artifactFactory * @param currentArtifact + * @param includeUI * @return the Current Artifact - * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseClientException if a general error occured in the + * artifact server. + * @throws ArtifactDatabaseInputException if the input data was valid. */ public ArtifactDescription getCurrentStepDescription( - ArtifactObject artifactFactory, - ArtifactObject currentArtifact, - boolean includeUI) - throws ArtifactDatabaseClientException; + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + boolean includeUI) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; /** - * + * * @param artifactFactory * @param currentArtifact * @param target * @param inputParameter - * @return - * @throws ArtifactDatabaseClientException + * @return the artifact description. + * @throws ArtifactDatabaseClientException if a general error occured in the + * artifact server. + * @throws ArtifactDatabaseInputException if the input data was valid. */ public ArtifactDescription doNextStep( - ArtifactObject artifactFactory, - ArtifactObject currentArtifact, - String target, - Collection<InputParameter> inputParameter) - throws ArtifactDatabaseClientException; + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + String target, + Collection<InputParameter> inputParameter) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; + /** + * Calls the advancecommand for the given Artifact at the Artifactdatabase. + * Stepping to the given target using the given Artifactfactory + * @param factory the Factory which provide the information about which + * Artifactdatabase has to be called. + * @param artifact the Artifact which should be moved to the next state. + * @param target the Id of the next State which should the artifact should + * be moved to. + * @throws IOException + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException + */ public void doAdvance( ArtifactObject factory, ArtifactObject artifact, - String target - ) throws IOException, ArtifactDatabaseClientException; + String target) + throws IOException, + ArtifactDatabaseClientException, + ArtifactDatabaseInputException; /** * @param artifactFactory * @param currentArtifact * @param inputParameter - * @return - * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseClientException if a general error occured in the + * artifact server. + * @throws ArtifactDatabaseInputException if the input data was valid. */ public void doFeed(ArtifactObject artifactFactory, - ArtifactObject currentArtifact, - Collection<InputParameter> inputParameter) - throws ArtifactDatabaseClientException; + ArtifactObject currentArtifact, + Collection<InputParameter> inputParameter) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; /** - * + * Call the out operation of the artifact server. + * * @param artifactFactory * @param currentArtifact * @param stream * @param targetName + * @param exportMode * @param mimeType + * @param inputParameter * @throws ArtifactDatabaseClientException */ public void doOutput( @@ -107,30 +151,96 @@ Collection<InputParameter> inputParameter) throws ArtifactDatabaseClientException; + /** - * @param factory - * @param artifact - * @return URL to wms service as string + * Write the current artifact to an xml file. + * + * @param artifactFactory + * @param currentArtifact + * @param out + * @throws ArtifactDatabaseClientException */ - public Document publishWMS(ArtifactObject factory, ArtifactObject artifact); + public void doExport( + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + OutputStream out) + throws ArtifactDatabaseClientException; /** + * Import an artifact from xml file. + * + * @param factory + * @param document + * @return a status message. If the import was successful, it contains + * information about the imported artifact, otherwise a failure is + * contained. + * @throws ArtifactDatabaseClientException + * @throws IOException + */ + public Document doImport( + ArtifactFactory factory, + Document document) + throws ArtifactDatabaseClientException, IOException; + + /** + * Publish shapefiles of an artifact as WMS layer. + * + * @param factory + * @param artifact + * @param inputParameter + * @return URL to wms service as string + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException + */ + public Document publishWMS( + ArtifactObject factory, + ArtifactObject artifact, + Collection<InputParameter> inputParameter + )throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; + + + /** + * Start statistics calculation. + * * @param artifactFactory * @param currentArtifact - * @return + * @return the calculated statistic. * @throws ArtifactDatabaseClientException */ public Collection<ArtifactStatisticsSet> calculateStatistics( - ArtifactObject artifactFactory, - ArtifactObject currentArtifact) - throws ArtifactDatabaseClientException; - + ArtifactObject artifactFactory, + ArtifactObject currentArtifact) + throws ArtifactDatabaseClientException; + + /** + * Set the current locale. + * @param locale + */ public void setLocale(Locale locale); - - public Collection<ArtifactObject> getArtifactFactoryMetaInformation(Collection<MapService> mapServices, - String geometry, - String srs) - throws ArtifactDatabaseClientException; - + + /** + * Get the current locale. + * @return the current locale. + */ + public Locale getLocale(); + + /** + * Returns some meta information about the currently selected + * ArtifactFactory. + * + * @param mapServices + * @param geometry + * @param srs + * @return the information. + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException + */ + public Collection<ArtifactObject> getArtifactFactoryMetaInformation( + Collection<MapService> mapServices, + String geometry, + String srs) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException; + } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,15 +1,23 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.client; +import java.util.Locale; + import org.apache.log4j.Logger; -import java.util.Locale; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Used to start a session with a new artifact. A new + * <code>DefaultArtifactDatabaseClient</code> is created. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ArtifactDatabaseClientFactory { @@ -33,7 +41,7 @@ /** * This Method provides an singleton Instance of this Class. - * + * * @return an singleton Instance of this Class */ public static synchronized ArtifactDatabaseClientFactory getInstance() { @@ -52,7 +60,6 @@ DefaultArtifactDatabaseClient adc = new DefaultArtifactDatabaseClient(); adc.setLocale(locale); return adc; - } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.client; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -16,13 +23,13 @@ import org.apache.log4j.Logger; import org.restlet.Client; +import org.restlet.Request; +import org.restlet.Response; import org.restlet.data.ClientInfo; import org.restlet.data.Language; import org.restlet.data.Method; import org.restlet.data.Preference; import org.restlet.data.Protocol; -import org.restlet.data.Request; -import org.restlet.data.Response; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; import org.w3c.dom.Document; @@ -31,6 +38,7 @@ import org.w3c.dom.NodeList; import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; +import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseInputException; import de.intevation.gnv.artifactdatabase.objects.Artifact; import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory; @@ -54,8 +62,11 @@ import de.intevation.gnv.util.XMLUtils; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The default implementation of <code>ArtifactDatabaseClient</code> which + * implements methods to communicate via HTTP protocol with the artifact server. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultArtifactDatabaseClient implements ArtifactDatabaseClient { /** @@ -69,6 +80,19 @@ public final static String NAMESPACE_PREFIX = "art"; /** + * Xpath expression to get general exception messages related to server + * errors. + */ + public static final String EXCEPTION_GENERAL = + "/art:exceptionreport/art:exception/text()"; + + /** + * Xpath expression to get exception messages related to invalid user input. + */ + public static final String EXCEPTION_USER_INPUT = + "/art:exceptionreport/art:exception/art:input/text()"; + + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger @@ -94,14 +118,11 @@ * Constructor */ public DefaultArtifactDatabaseClient() { - + } - /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#getArtifactFactories() - */ public Collection<ArtifactObject> getArtifactFactories() - throws ArtifactDatabaseClientException { + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { Collection<ArtifactObject> resultValues = null; if (!initialized) { this.initialize(); @@ -127,37 +148,45 @@ return resultValues; } + + /** + * Returns a collection of artifact factories retrieved by <i>server</i>. + * + * @param document + * @param server + * @param geometry + * @return a collection of factories. + */ private Collection<ArtifactObject> getArtifactFactories(Document document, String server, String geometry) { - XMLUtils xmlUtils = new XMLUtils(); - NodeList artifactFactories = xmlUtils.getNodeSetXPath(document, + NodeList artifactFactories = XMLUtils.getNodeSetXPath(document, "/art:result/art:factories/art:factory"); Collection<ArtifactObject> resultValues = new ArrayList<ArtifactObject>( artifactFactories.getLength()); if (artifactFactories != null) { for (int i = 0; i < artifactFactories.getLength(); i++) { Node artifactFactoryNode = artifactFactories.item(i); - String name = xmlUtils.getStringXPath(artifactFactoryNode, + String name = XMLUtils.getStringXPath(artifactFactoryNode, "@art:name"); - String description = xmlUtils.getStringXPath( + String description = XMLUtils.getStringXPath( artifactFactoryNode, "@art:description"); - - NodeList parameterNodeList = xmlUtils.getNodeSetXPath( + + NodeList parameterNodeList = XMLUtils.getNodeSetXPath( artifactFactoryNode, "art:parameter"); - - if ((parameterNodeList != null && - parameterNodeList.getLength() > 0) || + + if ((parameterNodeList != null && + parameterNodeList.getLength() > 0) || geometry != null){ - Collection<String> parameters = + Collection<String> parameters = new ArrayList<String>(parameterNodeList.getLength()); for (int j = 0; j < parameterNodeList.getLength(); j++){ Element parameterNode = (Element)parameterNodeList.item(j); parameters.add(parameterNode.getAttribute("id")); } - ParametrizedArtifactObject pao = - new ParametrizedArtifactFactory(name, + ParametrizedArtifactObject pao = + new ParametrizedArtifactFactory(name, description, server); pao.addParameters("parameter", parameters); @@ -179,23 +208,18 @@ return resultValues; } - /** - * @throws IOException - */ - private Document doGetRequest(String requestUrl) throws IOException, - ArtifactDatabaseClientException { + + private Document doGetRequest(String requestUrl) + throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException { return this.doGetRequest(requestUrl, null); } - /** - * @throws IOException - */ + private Document doGetRequest(String requestUrl, Document requestBody) - throws IOException, - ArtifactDatabaseClientException { + throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException { XMLUtils xmlUtils = new XMLUtils(); Representation output = doGetRequestInternal(requestUrl, requestBody); - Document document = xmlUtils.readDocument(output.getStream()); + Document document = XMLUtils.readDocument(output.getStream()); this.check4ExceptionReport(document); return document; } @@ -204,6 +228,14 @@ return initialize(request, locale); } + /** + * Initialize the <code>ClientInfo</code> object of <i>request</i> with the + * given <i>locale</i>. + * + * @param request The request object. + * @param locale The locale. + * @return the prepared request object. + */ protected Request initialize(Request request, Locale locale) { if (locale != null) { ClientInfo clientInfo = request.getClientInfo(); @@ -218,17 +250,13 @@ return request; } - /** - * @param requestUrl - * @param requestBody - * @return - */ + private Representation doGetRequestInternal(String requestUrl, Document requestBody) throws IOException { Client client = new Client(Protocol.HTTP); Request request = initialize(new Request(Method.GET, requestUrl)); if (requestBody != null) { - String documentBody = new XMLUtils() + String documentBody = XMLUtils .writeDocument2String(requestBody); Representation representation = new StringRepresentation( documentBody); @@ -242,17 +270,17 @@ return output; } - /** - * @throws IOException - */ + private InputStream doPostRequest(String requestUrl, Document requestBody) throws IOException { - log.debug("##################################################"); - log.debug(new XMLUtils().writeDocument2String(requestBody)); - log.debug("##################################################"); + + log.debug("URL: "+ requestUrl); + log.debug("Body"); + log.debug(XMLUtils.writeDocument2String(requestBody)); + Client client = new Client(Protocol.HTTP); Request request = initialize(new Request(Method.POST, requestUrl)); - String documentBody = new XMLUtils().writeDocument2String(requestBody); + String documentBody = XMLUtils.writeDocument2String(requestBody); Representation representation = new StringRepresentation(documentBody); request.setEntity(representation); Response response = client.handle(request); @@ -279,11 +307,19 @@ } + /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#createNewArtifact(de.intevation.gnv.artifactdatabase.objects.ArtifactObject) + * Creates a new artifact with the given <i>artifactFactory</i>. A POST call + * is sent to the artifact server which creates a new artifact. + * + * @param artifactFactory The artifact factory used to create a new + * artifact. + * @return the created artifact of the artifact server. + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException */ public ArtifactObject createNewArtifact(ArtifactObject artifactFactory) - throws ArtifactDatabaseClientException { + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { try { Document request = this.createCreateRequestBody(artifactFactory); @@ -295,16 +331,24 @@ } } + /** + * Returns a new artifact defined by uuid and hash values of the document + * returned by the artifact server after creating a new artifact. + * + * @param document Contains information about the server-side created + * artifact. + * @return a new artifact object. + */ private ArtifactObject getArtifact(Document document) { XMLUtils xmlUtils = new XMLUtils(); - String uuid = xmlUtils.getStringXPath(document, "/art:result/art:uuid/@value"); - String hash = xmlUtils.getStringXPath(document, "/art:result/art:hash/@value"); + String uuid = XMLUtils.getStringXPath(document, "/art:result/art:uuid/@value"); + String hash = XMLUtils.getStringXPath(document, "/art:result/art:hash/@value"); log.info("NEW Artifact: " + uuid + " / " + hash); return new Artifact(uuid, hash); } private Document createCreateRequestBody(ArtifactObject artifactFactory) { - Document document = new XMLUtils().newDocument(); + Document document = XMLUtils.newDocument(); Node rootNode = this.createRootNode(document); Element typeNode = this.createArtifactElement(document, "type"); typeNode.setAttribute("name", "create"); @@ -313,9 +357,9 @@ Element factoryNode = this.createArtifactElement(document, "factory"); factoryNode.setAttribute("name", artifactFactory.getId()); rootNode.appendChild(factoryNode); - + if (artifactFactory instanceof ParametrizedArtifactObject){ - Map<String, Collection<String>> parameterMap = + Map<String, Collection<String>> parameterMap = ((ParametrizedArtifactObject)artifactFactory).getParameters(); if (parameterMap != null && !parameterMap.isEmpty() ){ Iterator<String> keyIt = parameterMap.keySet().iterator(); @@ -324,7 +368,7 @@ Iterator<String> valueIt = parameterMap.get(key).iterator(); while (valueIt.hasNext()){ String value = valueIt.next(); - Element parameterNode = + Element parameterNode = this.createArtifactElement(document, "parameter"); parameterNode.setAttribute("name", key); parameterNode.setAttribute("value", value); @@ -342,10 +386,7 @@ return rootNode; } - /** - * @param document - * @return - */ + private Element createArtifactElement(Document document, String name) { XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( document, @@ -356,52 +397,54 @@ return creator.create(name); } - /** - * @param artifactFactory - * @param xmlUtils - * @param request - * @throws IOException - */ + private Document doPostRequest(ArtifactObject artifactFactory, - Document request, String suburl) - throws IOException, - ArtifactDatabaseClientException { + Document request, String suburl) + throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException { XMLUtils xmlUtils = new XMLUtils(); String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl(); InputStream is = this.doPostRequest(url + "/" + suburl, request); - Document result = xmlUtils.readDocument(is); + Document result = XMLUtils.readDocument(is); this.check4ExceptionReport(result); return result; } + /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#getCurrentStepDescription(de.intevation.gnv.artifactdatabase.objects.ArtifactFactory, - * de.intevation.gnv.artifactdatabase.objects.ArtifactObject) + * Retrieve the current artifact description after calling the describe + * operation of the artifact server. + * + * @param artifactFactory + * @param currentArtifact + * @param includeUI Set this option to true, if the user interface + * description is required. + * @return the artifact description. + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException */ public ArtifactDescription getCurrentStepDescription( - ArtifactObject artifactFactory, - ArtifactObject currentArtifact, - boolean includeUI) - throws ArtifactDatabaseClientException { + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + boolean includeUI) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { try { String url = this.getArtifactUrl(artifactFactory, currentArtifact); Document request = this.createDescribeRequestBody(currentArtifact, includeUI); InputStream describeResult = this.doPostRequest(url, request); - - return this.readDescription(new XMLUtils().readDocument(describeResult), + + return this.readDescription(XMLUtils.readDocument(describeResult), currentArtifact); } catch (IOException e) { log.error(e, e); throw new ArtifactDatabaseClientException(e); } } - - + + private Document createDescribeRequestBody(ArtifactObject currentArtifact, boolean includeUI){ - - Document document = new XMLUtils().newDocument(); + Document document = XMLUtils.newDocument(); Node rootNode = this.createRootNode(document); Element typeNode = this.createArtifactElement(document, "type"); @@ -421,11 +464,7 @@ return document; } - /** - * @param artifactFactory - * @param currentArtifact - * @return - */ + private String getArtifactUrl(ArtifactObject artifactFactory, ArtifactObject currentArtifact) { String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl() @@ -434,33 +473,32 @@ } private ArtifactDescription readDescription(Document document, - ArtifactObject artifact) - throws ArtifactDatabaseClientException { + ArtifactObject artifact) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { // Check if there was an Error or Exception reported from the // ArtifactDatabase this.check4ExceptionReport(document); - XMLUtils xmlUtils = new XMLUtils(); if (artifact instanceof ArtifactDescription) { ArtifactDescription ad = (ArtifactDescription) artifact; - Node uiNode = xmlUtils.getNodeXPath(document, "/art:result/art:ui"); - Node outputNode = xmlUtils + Node uiNode = XMLUtils.getNodeXPath(document, "/art:result/art:ui"); + Node outputNode = XMLUtils .getNodeXPath(document, "/art:result/art:outputs"); Map<String, OutputMode> outputModes = null; if (outputNode != null) { - NodeList outputModesNodes = xmlUtils.getNodeSetXPath( + NodeList outputModesNodes = XMLUtils.getNodeSetXPath( outputNode, "art:output"); if (outputModesNodes != null) { outputModes = new HashMap<String, OutputMode>( outputModesNodes.getLength()); for (int i = 0; i < outputModesNodes.getLength(); i++) { Node outputModeNode = outputModesNodes.item(i); - String name = xmlUtils.getStringXPath(outputModeNode, + String name = XMLUtils.getStringXPath(outputModeNode, "@name"); - String mimeType = xmlUtils.getStringXPath( + String mimeType = XMLUtils.getStringXPath( outputModeNode, "@mime-type"); - NodeList parameterNodes = xmlUtils.getNodeSetXPath( + NodeList parameterNodes = XMLUtils.getNodeSetXPath( outputModeNode, "art:parameter/art:parameter"); Collection<OutputParameter> parameter = null; if (parameterNodes != null) { @@ -470,33 +508,33 @@ Node outputParameterNode = parameterNodes .item(j); parameter.add(new DefaultOutputParameter( - xmlUtils.getStringXPath( + XMLUtils.getStringXPath( outputParameterNode, "@name"), - xmlUtils.getStringXPath( + XMLUtils.getStringXPath( outputParameterNode, "@value"), - xmlUtils.getStringXPath( + XMLUtils.getStringXPath( outputParameterNode, "@name"), - xmlUtils.getStringXPath( + XMLUtils.getStringXPath( outputParameterNode, "@type"))); } } - NodeList exportNodes = xmlUtils.getNodeSetXPath( + NodeList exportNodes = XMLUtils.getNodeSetXPath( outputModeNode, "art:exports/art:export"); Map exports = null; - + if (exportNodes != null) { int size = exportNodes.getLength(); exports = new HashMap<String, ExportMode>(size); for (int k = 0; k < size; k++) { Node export = exportNodes.item(k); - String expName = xmlUtils.getStringXPath( + String expName = XMLUtils.getStringXPath( export, "@name"); exports.put(expName, new DefaultExportMode( expName, - xmlUtils.getStringXPath(export, "@description"), - xmlUtils.getStringXPath(export, "@mime-type"))); + XMLUtils.getStringXPath(export, "@description"), + XMLUtils.getStringXPath(export, "@mime-type"))); } } @@ -507,9 +545,9 @@ } } - String currentState = xmlUtils.getStringXPath(document, + String currentState = XMLUtils.getStringXPath(document, "/art:result/art:state/@name"); - NodeList statesList = xmlUtils.getNodeSetXPath(document, + NodeList statesList = XMLUtils.getNodeSetXPath(document, "/art:result/art:reachable-states/art:state/@name"); Collection<String> reachableStates = new ArrayList<String>( statesList.getLength()); @@ -517,14 +555,14 @@ reachableStates.add(statesList.item(i).getNodeValue()); } - NodeList inputNodes = xmlUtils.getNodeSetXPath(document, + NodeList inputNodes = XMLUtils.getNodeSetXPath(document, "/art:result/art:model/art:input"); if (inputNodes != null) { Collection<String> inputParameter = new ArrayList<String>( inputNodes.getLength()); for (int i = 0; i < inputNodes.getLength(); i++) { Node inputNode = inputNodes.item(i); - String name = xmlUtils.getStringXPath(inputNode, "@name"); + String name = XMLUtils.getStringXPath(inputNode, "@name"); inputParameter.add(name); } ad.setInputParameter(inputParameter); @@ -544,22 +582,31 @@ } + /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#doNextStep(de.intevation.gnv.artifactdatabase.objects.ArtifactObject, - * de.intevation.gnv.artifactdatabase.objects.ArtifactObject, - * java.lang.String, java.util.Collection) + * Feed, advance and describe in one single method. + * + * @param artifactFactory The factory which created the current artifact. + * @param currentArtifact The current artifact. + * @param target The target state for advance. + * @param inputParameter Input data for feed. + * @return the artifact description after calling feed and advance. + * @throws ArtifactDatabaseClientException if a general error occured in + * the artifact server. + * @throws ArtifactDatabaseInputException if the input data was invalid used + * for feed. */ public ArtifactDescription doNextStep( - ArtifactObject artifactFactory, - ArtifactObject currentArtifact, - String target, - Collection<InputParameter> inputParameter) - throws ArtifactDatabaseClientException { + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + String target, + Collection<InputParameter> inputParameter) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { try { // 1 Feed this.doFeed(artifactFactory, currentArtifact, inputParameter); - + // 2. Noch einmal Describe um das jetzt zu erreichende Ziel zu ermitteln ArtifactDescription ad = getCurrentStepDescription( artifactFactory, @@ -569,10 +616,10 @@ ); target = ad.getReachableStates().iterator().next(); - + // 3 Advance doAdvance(artifactFactory, currentArtifact, target); - + // 3 Describe return this.getCurrentStepDescription(artifactFactory, currentArtifact,true); @@ -583,21 +630,34 @@ } + /** + * Call the advance operation of the artifact server to step to the next + * step of the parameterization. + * + * @param factory The artifact factory which created the current artifact. + * @param artifact The current artifact. + * @param target The target state. + * @throws IOException if an error occured while reading/writing from/to + * stream. + * @throws ArtifactDatabaseClientException if a general error occured in + * the artifact server. + * @throws ArtifactDatabaseInputException if the input data was invalid. + */ public void doAdvance( ArtifactObject factory, ArtifactObject artifact, - String target - ) throws IOException, ArtifactDatabaseClientException { + String target) + throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException { String url = getArtifactUrl(factory, artifact); Document advanceDocument = createAdvanceRequestBody(artifact, target); InputStream advanceResult = doPostRequest(url, advanceDocument); - check4ExceptionReport(new XMLUtils().readDocument(advanceResult)); + check4ExceptionReport(XMLUtils.readDocument(advanceResult)); } private Document createFeedRequestBody( ArtifactObject currentArtifact, Collection<InputParameter> inputParameter) { - Document document = new XMLUtils().newDocument(); + Document document = XMLUtils.newDocument(); Node rootNode = this.createRootNode(document); Element typeNode = this.createArtifactElement(document, "type"); @@ -619,11 +679,7 @@ return document; } - /** - * @param inputParameter - * @param document - * @param rootNode - */ + private Node createParameterNodes( Collection<InputParameter> inputParameter, Document document, String nodeName) { @@ -650,9 +706,17 @@ return dataNode; } + + /** + * Creates the xml body for the advance request. + * + * @param currentArtifact + * @param target + * @return the advance xml document. + */ private Document createAdvanceRequestBody(ArtifactObject currentArtifact, String target) { - Document document = new XMLUtils().newDocument(); + Document document = XMLUtils.newDocument(); Node rootNode = this.createRootNode(document); Element typeNode = this.createArtifactElement(document, "type"); @@ -673,10 +737,11 @@ } /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#doOutput(de.intevation.gnv.artifactdatabase.objects.ArtifactObject, - * de.intevation.gnv.artifactdatabase.objects.ArtifactObject, - * java.io.OutputStream, java.lang.String, java.lang.String, - * java.util.Collection) + * Call the out operation of the artifact server and writes the result to + * <i>stream</i>. + * + * @param exportMode + * @param inputParameter */ public void doOutput( ArtifactObject artifactFactory, @@ -712,6 +777,93 @@ } } + + /** + * Call the out method of the artifact server with a specific export mode. + * + * @param artifactFactory + * @param currentArtifact + * @param out + * @throws ArtifactDatabaseClientException if an error occured while + * reading/writing from/to stream. + */ + public void doExport( + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + OutputStream out) + throws ArtifactDatabaseClientException + { + InputStreamReader reader = null; + OutputStreamWriter writer = null; + + try { + String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl(); + url += "/export/" + currentArtifact.getId(); + + Representation response = doGetRequestInternal(url, null); + InputStream in = response.getStream(); + + reader = new InputStreamReader(in); + writer = new OutputStreamWriter(out); + + int c; + char[] buffer = new char[512]; + while ((c = reader.read(buffer)) > 0) { + writer.write(buffer, 0, c); + } + + } + catch (Exception e) { + log.error(e, e); + throw new ArtifactDatabaseClientException(e); + } + finally { + try { + reader.close(); + } catch (IOException ioe) {} + + try { + writer.flush(); + } catch (IOException ioe) {} + + try { + writer.close(); + } catch (IOException ioe) {} + } + } + + + /** + * Start to import an artifact from xml document. + * + * @param factory + * @param document The artifact as xml document. + * @return A status description of the operation (success or failure). + * @throws ArtifactDatabaseClientException + * @throws IOException + */ + public Document doImport( + ArtifactFactory factory, + Document document) + throws ArtifactDatabaseClientException, IOException + { + String url = factory.getDataBaseUrl() + "/import"; + InputStream response = doPostRequest(url, document); + + return XMLUtils.readDocument(response); + } + + + /** + * Creates the xml request body used for an out-call of the artifact server. + * + * @param currentArtifact + * @param target + * @param exportMode + * @param mimeType + * @param inputParameter + * @return the request body. + */ private Document createOutRequestBody( ArtifactObject currentArtifact, String target, @@ -719,7 +871,7 @@ String mimeType, Collection<InputParameter> inputParameter) { - Document document = new XMLUtils().newDocument(); + Document document = XMLUtils.newDocument(); Node rootNode = this.createRootNode(document); Element typeNode = this.createArtifactElement(document, "type"); @@ -753,22 +905,29 @@ return document; } + /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#doFeed(de.intevation.gnv.artifactdatabase.objects.ArtifactObject, - * de.intevation.gnv.artifactdatabase.objects.ArtifactObject, - * java.util.Collection) + * Calls the feed operation of the artifact server. + * + * @param artifactFactory The artifact factory which created the current + * artifact. + * @param currentArtifact The current artifact. + * @param inputParameter The user input. + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException */ - public void doFeed(ArtifactObject artifactFactory, - ArtifactObject currentArtifact, - Collection<InputParameter> inputParameter) - throws ArtifactDatabaseClientException { + public void doFeed( + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + Collection<InputParameter> inputParameter) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { try { Document feedDocument = this.createFeedRequestBody(currentArtifact, inputParameter); String url = this.getArtifactUrl(artifactFactory, currentArtifact); InputStream feedResult = this.doPostRequest(url, feedDocument); - Document feedResultDocument = new XMLUtils() + Document feedResultDocument = XMLUtils .readDocument(feedResult); this.check4ExceptionReport(feedResultDocument); } catch (IOException e) { @@ -778,35 +937,56 @@ } private void check4ExceptionReport(Document document) - throws ArtifactDatabaseClientException { - - String message = new XMLUtils().getStringXPath(document, - "/art:exceptionreport/art:exception"); + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { + String message = XMLUtils.getStringXPath(document, + EXCEPTION_GENERAL); if (message != null) { throw new ArtifactDatabaseClientException(message); } + String input = XMLUtils.getStringXPath(document, EXCEPTION_USER_INPUT); + if (input != null) { + throw new ArtifactDatabaseInputException(input); + } } - public Document publishWMS(ArtifactObject factory, ArtifactObject artifact) { + + /** + * Call the specific wms export mode of the out operation of the artifact + * server. + * + * @param factory + * @param artifact + * @param inputParameter + * @return a document that contains information about the wms service and + * the created layer. + * @throws ArtifactDatabaseClientException + * @throws ArtifactDatabaseInputException + */ + public Document publishWMS( + ArtifactObject factory, + ArtifactObject artifact, + Collection<InputParameter> inputParameter + ) throws ArtifactDatabaseClientException, ArtifactDatabaseInputException{ log.debug("Start wms publishing..."); String target = "wms"; String requestURL = getArtifactUrl(factory, artifact) + "/" + target; Document request = createOutRequestBody( - artifact, target, "", "text/xml", null); + artifact, target, "", "text/xml", inputParameter); try { InputStream input = doPostRequest(requestURL, request); Document result = XMLUtils.readDocument(input); - + this.check4ExceptionReport(result); return result; } catch (IOException ioe) { log.error(ioe, ioe); - return null; + throw new ArtifactDatabaseClientException(ioe); } } + public Collection<ArtifactStatisticsSet> calculateStatistics( ArtifactObject artifactFactory, ArtifactObject currentArtifact) @@ -814,7 +994,7 @@ { log.debug("DefaultArtifactDatabaseClient.calculateStatistics"); Collection<ArtifactStatisticsSet> resultValues = null; - + try { String targetName = "statistics"; String requestUrl = this.getArtifactUrl(artifactFactory, @@ -823,19 +1003,19 @@ targetName, "", "text/xml", null); XMLUtils xmlUtils = new XMLUtils(); InputStream is = this.doPostRequest(requestUrl, requestBody); - Document resultDocument = xmlUtils.readDocument(is); + Document resultDocument = XMLUtils.readDocument(is); if (resultDocument != null) { - - NodeList statisticSetNodes = xmlUtils.getNodeSetXPath(resultDocument, + + NodeList statisticSetNodes = XMLUtils.getNodeSetXPath(resultDocument, "/art:statistics/art:statistic"); resultValues = new ArrayList<ArtifactStatisticsSet> (statisticSetNodes.getLength()); for (int i = 0; i < statisticSetNodes.getLength(); i++) { Element statisticSetNode = (Element)statisticSetNodes.item(i); String name = statisticSetNode.getAttribute("name"); - ArtifactStatisticsSet set = + ArtifactStatisticsSet set = new DefaultArtifactStatisticsSet(name); - NodeList resultNodes = xmlUtils.getNodeSetXPath(statisticSetNode, + NodeList resultNodes = XMLUtils.getNodeSetXPath(statisticSetNode, "art:statistic-value"); if (resultNodes != null) { for (int j = 0; j < resultNodes.getLength(); j++) { @@ -864,27 +1044,29 @@ this.locale = locale; } - /** - * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#getArtifactFactoryMetaInformation(java.util.Collection, java.lang.String, java.lang.String) - */ + public Locale getLocale() { + return locale; + } + + public Collection<ArtifactObject> getArtifactFactoryMetaInformation( - Collection<MapService> mapServices, - String geometry, - String srs) - throws ArtifactDatabaseClientException { + Collection<MapService> mapServices, + String geometry, + String srs) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { log.debug("DefaultArtifactDatabaseClient.getArtifactFactories"); Collection<ArtifactObject> resultValues = null; try { this.initialize(); Iterator<String> it = artifactDatabases.iterator(); - Document requestBody = this.createMetaDataRequestBody(mapServices, - geometry, + Document requestBody = this.createMetaDataRequestBody(mapServices, + geometry, srs); while (it.hasNext()) { String server = it.next(); String url = server + "/service/metadata/"; log.debug(url); - + InputStream resultStream = this.doPostRequest(url, requestBody); resultValues = this.parseMetaDataResult(resultStream, server,geometry); } @@ -893,30 +1075,32 @@ } return resultValues; } - + private Collection<ArtifactObject> parseMetaDataResult( - InputStream inputStream, - String server, - String geometry) throws ArtifactDatabaseClientException{ + InputStream inputStream, + String server, + String geometry) + throws ArtifactDatabaseClientException, ArtifactDatabaseInputException { XMLUtils xmlUtils = new XMLUtils(); - Document document = xmlUtils.readDocument(inputStream); + Document document = XMLUtils.readDocument(inputStream); this.check4ExceptionReport(document); return this.getArtifactFactories(document, server,geometry); } - + private Document createMetaDataRequestBody(Collection<MapService> mapServices, String geometry, String srs){ log.debug("DefaultArtifactDatabaseClient.createMetaDataRequestBody"); - Document document = new XMLUtils().newDocument(); + Document document = XMLUtils.newDocument(); Node rootNode = this.createArtifactElement(document, "GetMetaData"); document.appendChild(rootNode); - - Element locationNode = this.createArtifactElement(document, "location"); - locationNode.setAttribute("srs", srs); - locationNode.appendChild(document.createTextNode(geometry)); - rootNode.appendChild(locationNode); - + + if (geometry != null){ + Element locationNode = this.createArtifactElement(document, "location"); + locationNode.setAttribute("srs", srs); + locationNode.appendChild(document.createTextNode(geometry)); + rootNode.appendChild(locationNode); + } Element mapServicesNode = this.createArtifactElement(document, "mapservices"); Iterator<MapService> it = mapServices.iterator(); @@ -947,3 +1131,4 @@ return document; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.client.exception; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Exception used for general errors in the artifact server. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ArtifactDatabaseClientException extends Exception { @@ -23,7 +30,7 @@ /** * Constructor - * + * * @param arg0 */ public ArtifactDatabaseClientException(String arg0) { @@ -32,7 +39,7 @@ /** * Constructor - * + * * @param arg0 */ public ArtifactDatabaseClientException(Throwable arg0) { @@ -41,12 +48,12 @@ /** * Constructor - * + * * @param arg0 * @param arg1 */ public ArtifactDatabaseClientException(String arg0, Throwable arg1) { super(arg0, arg1); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.artifactdatabase.client.exception; + +/** + * Exception used if an error occured caused by invalid input. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ArtifactDatabaseInputException extends Exception { + + /** + * The UID of this Class + */ + private static final long serialVersionUID = -8979622024425251952L; + + /** + * Constructor + */ + public ArtifactDatabaseInputException() { + super(); + } + + /** + * Constructor + * + * @param arg0 + */ + public ArtifactDatabaseInputException(String arg0) { + super(arg0); + } + + /** + * Constructor + * + * @param arg0 + */ + public ArtifactDatabaseInputException(Throwable arg0) { + super(arg0); + } + + /** + * Constructor + * + * @param arg0 + * @param arg1 + */ + public ArtifactDatabaseInputException(String arg0, Throwable arg1) { + super(arg0, arg1); + } + +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Exceptions that are thrown if server side errors occur. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +The communication between this client and an artifact server is defined in the +classes and interfaces of this package. +</body> +</html>
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.util.Collection; @@ -9,8 +14,10 @@ import org.w3c.dom.Node; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * An <code>ArtifactObject</code> representing an artifact. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class Artifact implements ArtifactObject, ArtifactDescription { @@ -19,150 +26,149 @@ * The UID of this Class */ private static final long serialVersionUID = 8606869493141810364L; - + + /** + * The uuid of this Artifact which must be used to identify + * the artifact at the <code>ArtifactDatabase</code>. + */ private String id = null; + + /** + * The hash of the artifact which was send be the <code>ArtifactDatabase</code>. + */ private String hash = null; + + /** + * Flag which marks if the Artifact is currently selected or not. + */ private boolean selected = false; + /** + * The XML-Node of the current User-Interface + */ private Node currentUI = null; + + /** + * The XML-Nodes of the OutputModes. + */ private Node currentOut = null; + /** + * The ids of the states which could be reached. + */ private Collection<String> reachableStates; + + /** + * The parameters whcih could be feed to the artifact at the current state. + */ private Collection<String> inputParameter; + + /** + * The <code>OutputModes</code> that could be reached at the current state. + */ private Map<String, OutputMode> outputModes; + + /** + * The id of the state which is currently used. + */ private String currentState = null; /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getCurrentUI() + * Constructor + * @param uuid the uuid of this Artifact which must be used to identify + * the artifact at the <code>ArtifactDatabase</code> + * @param hash the hash of the artifact which was send be the + * <code>ArtifactDatabase</code> */ + public Artifact(String uuid, String hash) { + this.id = uuid; + this.hash = hash; + } + public Node getCurrentUI() { return currentUI; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setCurrentUI(org.w3c.dom.Node) - */ + public void setCurrentUI(Node currentUI) { this.currentUI = currentUI; } - /** - * @return the currentOut - */ + public Node getCurrentOut() { return currentOut; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setCurrentOut(org.w3c.dom.Node) - */ + public void setCurrentOut(Node currentOut) { this.currentOut = currentOut; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getReachableStates() - */ + public Collection<String> getReachableStates() { return reachableStates; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setReachableStates(java.util.Collection) - */ + public void setReachableStates(Collection<String> reachableStates) { this.reachableStates = reachableStates; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getCurrentState() - */ + public String getCurrentState() { return currentState; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setCurrentState(java.lang.String) - */ + public void setCurrentState(String currentState) { this.currentState = currentState; } - /** - * Constructor - */ - public Artifact(String uuid, String hash) { - - this.id = uuid; - this.hash = hash; - } - - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getHash() - */ public String getHash() { return this.hash; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getDescription() - */ + public String getDescription() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getId() - */ + public String getId() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getName() - */ + public String getName() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#isSelected() - */ + public boolean isSelected() { return this.selected; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#setSelected(boolean) - */ + public void setSelected(boolean selected) { this.selected = selected; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getInputParameter() - */ + public Collection<String> getInputParameter() { return this.inputParameter; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setInputParameter(java.util.Collection) - */ + public void setInputParameter(Collection<String> inputParameter) { this.inputParameter = inputParameter; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getOutputModes() - */ + public Map<String, OutputMode> getOutputModes() { return this.outputModes; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getOutputModesAsCollection() - */ + public Collection<OutputMode> getOutputModesAsCollection() { if (this.outputModes != null) { return this.outputModes.values(); @@ -170,10 +176,9 @@ return null; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setOutputModes(java.util.Map) - */ + public void setOutputModes(Map<String, OutputMode> outputModes) { this.outputModes = outputModes; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,82 +1,110 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; + import java.util.Collection; import java.util.Map; import org.w3c.dom.Node; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This interface describes basic methods to describe the user interface of an + * artifact. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ArtifactDescription extends Serializable { /** + * Retrieves the xml node of the current user interface. + * * @return the currentUI */ public Node getCurrentUI(); /** - * @param currentUI - * the currentUI to set + * Set the xml node of the current user interface. + * + * @param currentUI the currentUI to set */ public void setCurrentUI(Node currentUI); /** - * @param currentOut - * the currentOut to set + * Set the xml node of the possible output modes. + * + * @param currentOut the currentOut to set */ public void setCurrentOut(Node currentOut); /** + * Retrieves a collection of reachable states. + * * @return the reachableStates */ public Collection<String> getReachableStates(); /** - * @param reachableStates - * the reachableStates to set + * Set the reachable states. + * + * @param reachableStates the reachableStates to set */ public void setReachableStates(Collection<String> reachableStates); /** + * Retrieves the current state. + * * @return the currentState */ public String getCurrentState(); /** - * @param currentState - * the currentState to set + * Set the current state. + * + * @param currentState the currentState to set */ public void setCurrentState(String currentState); /** + * Get a collection of input parameters. + * * @return the reachableStates */ public Collection<String> getInputParameter(); /** + * Set a collection of input parameters. + * * @param inputParameter */ public void setInputParameter(Collection<String> inputParameter); /** - * @return the reachableStates + * Retrieves a map of available output modes. + * + * @return the available output modes. */ public Map<String, OutputMode> getOutputModes(); /** - * @return the reachableStates + * Retrieves a collection of available output modes. + * + * @return the available output modes. */ public Collection<OutputMode> getOutputModesAsCollection(); /** - * @param outputParameter + * Set the available output modes. + * + * @param outputModes A map that contains output modes. */ public void setOutputModes(Map<String, OutputMode> outputModes); - -} \ No newline at end of file +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,21 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Implementation of an <code>ArtifactObject> which represents an + * <code>ArtifactFactory</code> + * This Class provides the name, the description, the URL where the + * the <code>ArtifactDatabase</code> the factory belongs to could be reached + * and if the <code>ArtifacFactory</code> is currently selected or not. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class ArtifactFactory implements ArtifactObject { @@ -14,15 +24,30 @@ */ private static final long serialVersionUID = 5453748230625831527L; + /** + * The name of the factory. + */ private String name = null; + /** + * The description of the Factory. + */ private String description = null; + /** + * Flag which mark the Artifactfactory as selected if value is true + * unselected if value is false. + */ private boolean selected = false; + /** + * The URL where the Factory could be reached. + */ private String dataBaseUrl = null; /** + * Returns the url of the artifact server. + * * @return the dataBaseUrl */ public String getDataBaseUrl() { @@ -31,61 +56,57 @@ /** * Constructor - * - * @param name - * @param description - * @param dataBaseUrl + * @param name the name of the factory + * @param description the description of the Factory + * @param dataBaseUrl the URL where the Factory could be reached. */ - public ArtifactFactory(String name, String description, String dataBaseUrl) { + public ArtifactFactory(String name, + String description, + String dataBaseUrl) { super(); this.name = name; this.description = description; this.dataBaseUrl = dataBaseUrl; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getId() - */ + public String getId() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#isSelected() - */ + public boolean isSelected() { return this.selected; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#setSelected(boolean) - */ + public void setSelected(boolean selected) { this.selected = selected; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getName() - */ + public String getName() { return name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getDescription() - */ + public String getDescription() { return description; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getHash() - */ + public String getHash() { return null; } + /** + * Two ArtifactFactories are equal, if the name and the url to the artifact + * server are equal. + * + * @param obj + * @return true, if the factories are equal - otherwise false. + */ @Override public boolean equals(Object obj) { boolean returnValue = false; @@ -96,5 +117,5 @@ } return returnValue; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,26 +1,62 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The <code>ArtifactObject</code> provides some information about an artifact. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ArtifactObject extends Serializable { + /** + * Retrieves the id of this object. + * + * @return the id. + */ public String getId(); + /** + * Retrieves information about the selection state of this object. + * + * @return true, if this object is selected - otherwise false. + */ public boolean isSelected(); + /** + * Set the selection of this object. + * + * @param selected the new selection. + */ public void setSelected(boolean selected); + /** + * Retrieves the name of this object. + * + * @return the name. + */ public String getName(); + /** + * Retrieves the description of the object. + * + * @return the description. + */ public String getDescription(); + /** + * Retrieves the hash value of this object. + * + * @return the hash value. + */ public String getHash(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,33 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This is the Interfacedefinition for Statistic values that belongs + * to an Artifact. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface ArtifactStatisticValue extends Serializable { + /** + * Returns the Key of the Object + * @return the Key of the Object + */ String getKey(); + /** + * Returns the stored Value + * @return the stored Value + */ String getValue(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,43 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; + import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * An inteface description for a container storing statistics. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ArtifactStatisticsSet extends Serializable { - - + + /** + * Retrieves the name of this container. + * + * @return the name. + */ String getName(); - + + /** + * Retrieves the statistics as collection. + * + * @return the statistics. + */ Collection<ArtifactStatisticValue> getStatisticValues(); - + + /** + * Add a new statistic to this container. + * + * @param value A statistic. + */ void addStatisticValues(ArtifactStatisticValue value); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The Defaultimplementation of <code>ArtifactStatisticValue</code> + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class DefaultArtifactStatisticValue implements ArtifactStatisticValue { @@ -14,10 +20,21 @@ */ private static final long serialVersionUID = -8409111023127835398L; + /** + * The key of the new Value. + */ private String key = null; + /** + * The value of the Object. + */ private String value = null; + /** + * Constructor + * @param key the key of the new Value + * @param value the value of the Object. + */ public DefaultArtifactStatisticValue(String key, String value) { super(); this.key = key; @@ -31,5 +48,4 @@ public String getValue() { return this.value; } - }
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,20 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.util.ArrayList; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * The default implementation of <code>ArtifactStatisticsSet</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultArtifactStatisticsSet implements ArtifactStatisticsSet{ @@ -17,36 +24,37 @@ */ private static final long serialVersionUID = 6738878381515708602L; + /** + * The name of the StatisticsSet. + */ private String name = null; - - private Collection<ArtifactStatisticValue> statisticValues = + + /** + * The statisticsvalues which belong to this set. + */ + private Collection<ArtifactStatisticValue> statisticValues = new ArrayList<ArtifactStatisticValue>(); /** * Constructor + * @param name the name of the StatisticsSet */ public DefaultArtifactStatisticsSet(String name) { this.name = name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet#addStatisticValues(de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticValue) - */ + public void addStatisticValues(ArtifactStatisticValue value) { this.statisticValues.add(value); } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet#getName() - */ + public String getName() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet#getStatisticValues() - */ + public Collection<ArtifactStatisticValue> getStatisticValues() { return this.statisticValues; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,25 +1,56 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifactdatabase.objects; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * This is the default implementation of <code>ExportMode</code> which stores + * information about a specific output target (e.g. pdf, svg, image). + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultExportMode implements ExportMode { + /** + * The name of this parameter. + */ protected String name; + + /** + * The description of this mode. + */ protected String description; + + /** + * The mimetype used for this mode. + */ protected String mimeType; + /** + * Creates a new <code>ExportMode</code>. + * + * @param name The name of the mode. + * @param description A description of this mode. + * @param mimeType The mimetype used for this mode. + */ public DefaultExportMode(String name, String description, String mimeType){ this.name = name; this.description = description; this.mimeType = mimeType; } + public String getName() { return name; } + public String getDescription() { return description; } @@ -28,4 +59,4 @@ return mimeType; } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,18 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The default implementation of <code>InputParameter</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class DefaultInputParameter implements InputParameter { @@ -14,15 +21,20 @@ */ private static final long serialVersionUID = 6597439837482244211L; + /** + * The name of this parameter. + */ private String name = null; + /** + * The values of this parameter. + */ private String[] values = null; /** * Constructor - * - * @param name - * @param values + * @param name The name of this parameter. + * @param values The values of this parameter. */ public DefaultInputParameter(String name, String[] values) { super(); @@ -30,18 +42,12 @@ this.values = values; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.InputParameter#getName() - */ public String getName() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.InputParameter#getValues() - */ public String[] getValues() { return this.values; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,20 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.util.Collection; import java.util.Map; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The default implementation of an <code>OutputMode</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultOutputMode implements OutputMode { @@ -17,14 +23,33 @@ */ private static final long serialVersionUID = 7487880486604174521L; + /** + * The name of the OutputMode + */ private String name = null; + /** + * The mimetype of the OutputMode + */ private String mimeType = null; + /** + * The parameters that could be used for this OutputMode + */ private Collection<OutputParameter> outputParameter = null; + /** + * The exports that can be called using this outputMode + */ private Map<String, ExportMode> exports; + /** + * Constructor + * @param name The name of the OutputMode + * @param mimeType The mimetype of the OutputMode + * @param outputParameter The parameters that could be used for this OutputMode + * @param exports The exports that can be called using this outputMode + */ public DefaultOutputMode( String name, String mimeType, @@ -38,23 +63,14 @@ this.exports = exports; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.OutputMode#getMimeType() - */ public String getMimeType() { return this.mimeType; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.OutputMode#getName() - */ public String getName() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.OutputMode#getOutputParameters() - */ public Collection<OutputParameter> getOutputParameters() { return this.outputParameter; } @@ -63,3 +79,4 @@ return exports.get(mode); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,11 +1,17 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * The default implementation of <code>OutputParameter</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultOutputParameter implements OutputParameter { @@ -14,20 +20,33 @@ */ private static final long serialVersionUID = -8416057640116638152L; + /** + * The name of the parameter + */ private String name = null; + /** + * The value of the parameter + */ private String value = null; + /** + * The description of the parameter + */ private String description = null; + /** + * The type of the parameter + */ private String type = null; /** * Constructor - * - * @param name - * @param value - * @param description + * + * @param name The name of the parameter + * @param value The value of the parameter + * @param description The description of the parameter + * @param type The type of the parameter */ public DefaultOutputParameter(String name, String value, String description, String type) { @@ -38,16 +57,10 @@ this.type = type; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.OutputParameter#getName() - */ public String getName() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.OutputParameter#getValue() - */ public String getValue() { return this.value; } @@ -59,5 +72,5 @@ public String getType() { return this.type; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,15 +1,43 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; /** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + * An <code>ExportMode</code> describes a specific format of an output mode + * (e.g. pdf, svg, image). + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public interface ExportMode extends Serializable { + /** + * Returns the name of this export mode. + * + * @return the name. + */ public String getName(); + + /** + * Returns the description of this export mode. + * + * @return the description. + */ public String getDescription(); + + /** + * Returns the mimetype used for this export mode. + * + * @return the mimetype. + */ public String getMimeType(); } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,18 +1,35 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * <code>InputParameter</code> objects are used to store multiple values for a + * single key. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface InputParameter extends Serializable { + /** + * Returns the name of the input parameter. + * + * @return the name. + */ public String getName(); + /** + * Returns the values of this input parameter as array. + * + * @return the values as array. + */ public String[] getValues(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,54 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; + import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * <code>OutputMode</code> objects give information possible types of exports + * for an artifact (e.g. chart, histogram, csv, odv, statistic). + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public interface OutputMode extends Serializable{ + /** + * Retrieve the name of an output mode. + * + * @return the name. + */ public String getName(); + /** + * Retrieve the mimetype of an output mode. + * + * @return the mimetype. + */ public String getMimeType(); + /** + * Retrieve the output parameters available to adjust the output. + * + * @return the output parameters. + */ public Collection<OutputParameter> getOutputParameters(); + /** + * Retrieve possible export modes which describe specific output modes + * (e.g. pdf, svg, image). + * + * @param mode The export mode's name. + * @return the export mode. + */ public ExportMode getExportMode(String mode); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,22 +1,49 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.io.Serializable; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * An <code>OutputParameter</code> describes the input for an export mode and + * stores the value inserted by the user. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface OutputParameter extends Serializable{ + /** + * Retrieves the name of the parameter. + * + * @return the name. + */ String getName(); + /** + * Retrieves the value of this parameters. + * + * @return the value. + */ String getValue(); + /** + * Retrieves the description of this parameter. + * + * @return the description. + */ String getDescription(); + /** + * Retrieves the type of this parameter (e.g. String, Integer, Double, Date). + * + * @return the type. + */ String getType(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.util.Collection; @@ -8,24 +13,30 @@ import java.util.Map; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This Class is an Extention of the Class ArtifactFactory. + * Its only job is to store optional Parameters that might be + * used to instantiate a new Artifact. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ -public class ParametrizedArtifactFactory extends ArtifactFactory implements - ParametrizedArtifactObject { +public class ParametrizedArtifactFactory +extends ArtifactFactory implements ParametrizedArtifactObject { /** * The UID of this Class */ private static final long serialVersionUID = 4516368434861819032L; + /** + * The Parameters that belongs to the Artifactfactory and might be used + * during the Initializationprocess of an Artifact. + */ private Map<String, Collection<String>> parameters = null; - + /** * Constructor - * @param name - * @param description - * @param dataBaseUrl + * @param name the name of the factory + * @param description the description of the Factory + * @param dataBaseUrl the URL where the Factory could be reached. */ public ParametrizedArtifactFactory(String name, String description, String dataBaseUrl) { @@ -33,17 +44,12 @@ this.parameters = new HashMap<String, Collection<String>>(); } - /** - * @see de.intevation.gnv.artifactdatabase.objects.ParametrizedArtifactObject#getParameters() - */ - @Override public Map<String, Collection<String>> getParameters() { return parameters; } - @Override public void addParameters(String key, Collection<String> values) { this.parameters.put(key, values); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,24 +1,37 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects; import java.util.Collection; import java.util.Map; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * Interface which extends the funtionality of the Interface + * <code>ArtifactObject</code> with methods for storing and retrieving + * optional Parameters. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface ParametrizedArtifactObject extends ArtifactObject { - + /** * Returns the Parameters which could be used to manage (e.g. create) an * ArtifactObject. - * @return + * @return a map storing parameters. */ Map<String, Collection<String>> getParameters(); - + + /** + * Add a further parameter to the parameter map. + * + * @param key the Key of the Parameter (unique) + * @param values the Values of the Parameter + */ void addParameters(String key, Collection<String> values); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,23 +1,49 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects.map; + /** - * @author Tim Englich <tim.englich@intevation.de> + * The default implementation of <code>Layer</code>. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultLayer implements Layer { - + + /** + * The id of this layer. + */ private String id = null; - + + /** + * The name of this layer. + */ private String name = null; - + + /** + * Flag which defines if this layer is an grouplayer. + */ private boolean groupLayer = false; - + + /** + * The id of the parent layer or null if this layer is an rootlayer. + */ private String parentId = null; + /** * Constructor + * + * @param id the id of this layer + * @param name the name of this layer + * @param groupLayer flag which defines if this layer is an grouplayer + * @param parentId the id of the parent layer or null if this layer is an + * rootlayer */ public DefaultLayer(String id,String name, boolean groupLayer,String parentId) { @@ -28,40 +54,30 @@ } - - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#getID() - */ public String getID() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#getName() - */ + public String getName() { return this.name; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#isGroupLayer() - */ + public boolean isGroupLayer() { return this.groupLayer; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.Layer#parentID() - */ + public String parentID() { return this.parentId; } - + @Override public String toString() { return "ID: "+ this.id + " Name: "+this.name+ " IsGroupLayer: "+this.groupLayer+ " ParentID: "+this.parentId; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,29 +1,61 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects.map; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * The default implementation of <code>MapService</code>. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DefaultMapService implements MapService { + /** + * The id of this mapservice. + */ private String id = null; - - + /** + * The layer which are provided by this mapservice. + */ private Collection<Layer> layer = null; + + /** + * The type of this mapservice. + */ + private String type = null; + + /** + * The URl of this mapservice. + */ + private String url = null; - private String type = null; + /** + * The Bbox which surrounds the data of the Mapservice + */ + private String bbox = null; - private String url = null; + /** + * The time until the server will provide the data. + */ + private String ttl = null; + /** * Constructor + * + * @param id the id of this mapservice + * @param layer the layer which are provided by this mapservice + * @param type the type of this mapservice + * @param url the URl of this mapservice */ - public DefaultMapService(String id, Collection<Layer> layer, + public DefaultMapService(String id, Collection<Layer> layer, String type, String url) { super(); this.id = id; @@ -31,33 +63,49 @@ this.type = type; this.url = url; } - + /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getID() + * Constructor + * + * @param id the id of this mapservice + * @param layer the layer which are provided by this mapservice + * @param type the type of this mapservice + * @param url the URl of this mapservice + * @param bbox the Bbox which surrounds the data of the Mapservice + * @param ttl the time until the server will provide the data. */ + public DefaultMapService(String id, Collection<Layer> layer, + String type, String url, String bbox, String ttl) { + this(id,layer,type,url); + this.bbox = bbox; + this.ttl = ttl; + } + + public String getID() { return this.id; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getLayer() - */ + public Collection<Layer> getLayer() { return this.layer; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getType() - */ + public String getType() { return this.type; } - /** - * @see de.intevation.gnv.artifactdatabase.objects.map.MapService#getURL() - */ + public String getURL() { return this.url; } - + + public String getBBoxValue() { + return this.bbox; + } + public String getTtl() { + return this.ttl; } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,16 +1,47 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects.map; + /** - * @author Tim Englich <tim.englich@intevation.de> + * This interface defines some basic methods providing information about a map + * layer. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface Layer { - + + /** + * Retrieves the name of a layer. + * + * @return the name of a layer. + */ String getName(); + + /** + * Retrieves the id of a layer. + * + * @return the id of a layer. + */ String getID(); + + /** + * Retrieves true, if this layer is a group layer - otherwise false. + * + * @return true, if this layer is a group layer - otherwise false. + */ boolean isGroupLayer(); + + /** + * Retrieves the id of the parent layer. + * + * @return the id of the parent layer. + */ String parentID(); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,23 +1,63 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.objects.map; import java.util.Collection; /** - * @author Tim Englich <tim.englich@intevation.de> + * This interface defines some basic methods to provide information about a map + * service. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface MapService { - - + + /** + * Retrieves the id of a map service. + * + * @return the id of a map service. + */ String getID(); - + + + /** + * Retrieves the URL of a map service. + * + * @return the URL of a map service. + */ String getURL(); - + + + /** + * Retrieves the type of a map service. + * + * @return the type of a map service. + */ String getType(); + + /** + * Retrieves the layers served by a map service. + * + * @return the layers served by a map service. + */ + Collection<Layer> getLayer(); - Collection<Layer> getLayer(); - + /** + * Retrieves the bboxvalue served by a map service. + * @return the bboxvalue + */ + String getBBoxValue (); + + /** + * Returns the Time until the Service will provide the Data. + * @return the Time until the Service will provide the Data. + */ + String getTtl(); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Objects used to store information about map services and provided layers. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Objects used to represent an artifact in this client. +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package and it's subpackages provides the required infrastructure to +communicate with the <code>ArtifactDatabase</code>. +</body> +</html>
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.propertiesreader; import java.util.Map; @@ -8,29 +13,31 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * A <code>PropertiesReader</code> storing properties in a <code>Map</code>. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class MapPropertiesReader implements PropertiesReader { - /** - * the logger, used to log exceptions and additonaly information - */ + private static Logger log = Logger.getLogger(MapPropertiesReader.class); + /** + * The properties which are served by this <code>PropertiesReader</code>. + */ private Map<String, String> properties = null; /** - * Constructor + * Constructs a new MapPropertiesReader with an initial map. + * + * @param properties the properties which should be served by this + * <code>PropertiesReader</code>. */ public MapPropertiesReader(Map<String, String> properties) { super(); this.properties = properties; } - /** - * @see de.intevation.gnv.propertiesreader.PropertiesReader#getPropertieValue(java.lang.String, - * java.lang.String) - */ public String getPropertieValue(String key, String defaultValue) { String value = this.properties.get(key); if (value == null) { @@ -38,5 +45,5 @@ } return value; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,14 +1,29 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.propertiesreader; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * An interface that defines a single method to retrieve properties specified by + * a key. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public interface PropertiesReader { + /** + * Retrieves a property by the given <i>ke<</i>. + * + * @param key The key of a property. + * @param defaultValue The default value which is returned if no property + * is found by <i>key</i>. + * @return the value of a property. + */ public String getPropertieValue(String key, String defaultValue); - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.propertiesreader; import java.util.Map; @@ -10,8 +15,8 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class PropertiesReaderFactory { @@ -39,7 +44,7 @@ /** * This Method provides an singleton Instance of this Class. - * + * * @return an singleton Instance of this Class */ public static PropertiesReaderFactory getInstance() { @@ -51,7 +56,7 @@ /** * Getting the ConnectionPool - * + * * @return the ConnectionPool */ public PropertiesReader getPropertiesReader() { @@ -60,9 +65,8 @@ /** * Getting the ConnectionPool - * - * @param config - * The Config that should be read + * + * @param config The Config that should be read */ public void initPropertiesReader(Object config) { if (config instanceof ServletConfig) { @@ -77,5 +81,5 @@ } } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,11 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.propertiesreader; import java.util.Enumeration; @@ -12,8 +17,13 @@ import org.apache.log4j.Logger; /** - * @author Tim Englich <tim.englich@intevation.de> + * This reader fetches the properties it will provide from the + * <code>ServletConfig</code> of an <code>Context</code>. + * It will read the InitParameters which could be configured using + * the <code>web.xml</code-file of each <code>context</code>. * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ServletPropertiesReader implements PropertiesReader { @@ -22,10 +32,16 @@ */ private static Logger log = Logger.getLogger(ServletPropertiesReader.class); + /** + * The properties which are read from the <code>ServletConfig</code>. + */ private Map<String, String> properties = null; /** * Constructor + * + * @param config the <code>ServletConfig</code> where + * the properties should be read from. */ public ServletPropertiesReader(ServletConfig config) { super(); @@ -43,10 +59,7 @@ } } - /** - * @see de.intevation.gnv.propertiesreader.PropertiesReader#getPropertieValue(java.lang.String, - * java.lang.String) - */ + public String getPropertieValue(String key, String defaultValue) { String value = this.properties.get(key); if (value == null) { @@ -54,5 +67,5 @@ } return value; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides reader and factories which will provide properties which +are configured in different files (e.g. web.xml) in the whole system. +</body> +</html>
--- a/gnv/src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,55 +1,63 @@ -/* - * - */ -package de.intevation.gnv.servlet; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; - -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.struts.action.ActionServlet; - -import de.intevation.gnv.propertiesreader.PropertiesReaderFactory; - -/** - * - * @author Tim Englich <tim.englich@intevation.de> - * - */ -public class GNVActionServlet extends ActionServlet { - /** - * the logger, used to log exceptions and additonaly information - */ - private static Logger log = null; - - static { - // BasicConfigurator.configure(); - - } - - static String LOGGINIG_CONFIG_FILE_ID = "de.intevation.gnv.servlet.log4j.configuration"; - - /** - * The UID of this Class - */ - private static final long serialVersionUID = 3597396283436383943L; - - /** - * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig) - */ - @Override - public void init(ServletConfig config) throws ServletException { - super.init(config); - try { - String path = config.getServletContext().getRealPath("/") - + config.getInitParameter(LOGGINIG_CONFIG_FILE_ID); - PropertyConfigurator.configure(path); - log = Logger.getLogger(GNVActionServlet.class); - } catch (Exception e) { - log.error(e, e); - } - log.info("PropertiesReader will be configured."); - PropertiesReaderFactory.getInstance().initPropertiesReader(config); - } -} +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.servlet; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; +import org.apache.struts.action.ActionServlet; + +import de.intevation.gnv.propertiesreader.PropertiesReaderFactory; + +/** + * The GNV ActionServlet. + * This Servelt will be used to handle all requests which are + * send to the GNV-WebClient. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class GNVActionServlet extends ActionServlet { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = null; + + /** + * The id which must be used to lookup the path to the + * <code>log4j.properties</code> file which is configured + * in the <code>web.xml</code> + */ + private final static String LOGGINIG_CONFIG_FILE_ID = "de.intevation.gnv." + + "servlet.log4j.configuration"; + + /** + * The UID of this class. + */ + private static final long serialVersionUID = 3597396283436383943L; + + + @Override + public void init(ServletConfig config) throws ServletException { + super.init(config); + try { + String path = config.getServletContext().getRealPath("/") + + config.getInitParameter(LOGGINIG_CONFIG_FILE_ID); + PropertyConfigurator.configure(path); + log = Logger.getLogger(GNVActionServlet.class); + } catch (Exception e) { + log.error(e, e); + } + log.info("PropertiesReader will be configured."); + PropertiesReaderFactory.getInstance().initPropertiesReader(config); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/servlet/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +This package provides the <code>Servlet</code> which will be used to handle +all requests which are send to the GNV-WebClient. +</body> +</html>
--- a/gnv/src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,13 +1,23 @@ -package de.intevation.gnv.util; +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ -import javax.xml.XMLConstants; - -import javax.xml.namespace.NamespaceContext; +package de.intevation.gnv.util; import java.util.Iterator; +import javax.xml.XMLConstants; +import javax.xml.namespace.NamespaceContext; + /** - * @author Sascha L. Teichmann (sascha.teichmann@intevation) + * The namespacecontext object used in xml documents retrieved by the artifact + * server. + * + * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a> */ public class ArtifactNamespaceContext implements NamespaceContext @@ -22,9 +32,15 @@ */ public final static String NAMESPACE_PREFIX = "art"; + /** + * The singleton instance of this <code>NamespaceContext</code> + */ public static final ArtifactNamespaceContext INSTANCE = new ArtifactNamespaceContext(); + /** + * Constructor + */ public ArtifactNamespaceContext() { } @@ -53,4 +69,4 @@ throw new UnsupportedOperationException(); } } -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/util/CaptureInputStream.java Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.gnv.util; + +import java.io.FilterInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +/** + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha Teichmann</a> + */ +public class CaptureInputStream +extends FilterInputStream +{ + protected ByteArrayOutputStream copy; + + public CaptureInputStream(InputStream in) { + super(in); + copy = new ByteArrayOutputStream(10*1024); + } + + public int read() throws IOException { + int x = in.read(); + if (x != -1) { + copy.write(x); + } + return x; + } + + public int read(byte [] b, int off, int len) throws IOException { + int r = in.read(b, off, len); + if (r > 0) { + copy.write(b, off, r); + } + return r; + } + + public long skip(long n) throws IOException { + long m = in.skip(n); + for (long i = m; i > 0L; --i) { // simulate gab + copy.write(0); + } + return m; + } + + public String copyToString() { + return copy.toString(); + } + + public String copyToString(String charsetName) + throws UnsupportedEncodingException + { + return copy.toString(charsetName); + } + + public byte [] toByteArray() { + return copy.toByteArray(); + } + + public void clear() { + copy.reset(); + } +}
--- a/gnv/src/main/java/de/intevation/gnv/util/XMLUtils.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/util/XMLUtils.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,16 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.util; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.io.StringBufferInputStream; import java.io.StringWriter; @@ -31,31 +40,75 @@ import org.xml.sax.SAXException; /** - * @author Sascha L. Teichmann + * This class provides many helper-Methods for handling different kinds of + * XML-stuff. + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class XMLUtils { + + /** + * the logger, used to log exceptions and additonaly information + */ private static Logger logger = Logger.getLogger(XMLUtils.class); + /** + * Constructor + */ public XMLUtils() { } + /** + * Class which could be used to create XML-Elements + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + * + */ public static class ElementCreator { + + /** + * The document the elements should be placed in. + */ protected Document document; + + /** + * The namespace that should be used. + */ protected String ns; + + /** + * The prefix of the namespace that should be used. + */ protected String prefix; + /** + * Constructor + * @param document the document the elements should be placed in + * @param ns the namespace that should be used + * @param prefix the prefix of the namespace that should be used + */ public ElementCreator(Document document, String ns, String prefix) { this.document = document; this.ns = ns; this.prefix = prefix; } + /** + * Creates a new element using the given name. + * @param name the name of the new element. + * @return the new element + */ public Element create(String name) { Element element = document.createElementNS(ns, name); element.setPrefix(prefix); return element; } + /** + * Adds a new attribute to the given element. + * @param element the element where the attribute should be placed in. + * @param name the name of the attribute + * @param value the value of the attribute + */ public void addAttr(Element element, String name, String value) { Attr attr = document.createAttributeNS(ns, name); attr.setValue(value); @@ -64,6 +117,10 @@ } } // class ElementCreator + /** + * Creates a new document. + * @return the new document + */ public static Document newDocument() { try { return DocumentBuilderFactory.newInstance().newDocumentBuilder() @@ -74,10 +131,19 @@ return null; } + /** + * Creates a new <code>XPath</code>-expression + * @return the new <code>XPath</code>-expression + */ public static XPath newXPath() { return newXPath(null); } + /** + * Creates a new <code>XPath</code>-expression + * @param namespaceContext the namespacecontext that should be used. + * @return the new <code>XPath</code>-expression + */ public static XPath newXPath(NamespaceContext namespaceContext) { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); @@ -87,66 +153,127 @@ return xpath; } - public static Object xpath(Object root, String query, QName returnTyp) { - return xpath(root, query, returnTyp, null); - } - + /** + * Fetch the value of an element or attribute from the given resource + * using the query. + * @param root the source where the value should be fetch from + * @param query the query that should be used to fetch the value + * @param namespaceContext the namespacecontext that must match to + * fetch the value. + * @return the value + */ public static final String xpathString(Object root, String query, NamespaceContext namespaceContext) { return (String) xpath(root, query, XPathConstants.STRING, namespaceContext); } + /** + * Fetch the object rom the given resource using the query. + * @param root the source where the value should be fetch from + * @param query the query that should be used to fetch the object + * @param returnType the Type that must be used to return the object, + * @param namespaceContext the namespacecontext that must match to + * fetch the object. + * @return the value + */ public static final Object xpath(Object root, String query, QName returnType, NamespaceContext namespaceContext) { if (root == null) { return null; } - try { - XPath xpath = new XMLUtils().newXPath(namespaceContext); + XPath xpath = XMLUtils.newXPath(namespaceContext); if (xpath != null) { return xpath.evaluate(query, root, returnType); } } catch (XPathExpressionException xpee) { logger.error(xpee.getLocalizedMessage(), xpee); } - return null; } + /** + * Fetch the object rom the given resource using the query + * and the default <code>ArtifactNamespaceContext</code> + * @param root the source where the value should be fetch from + * @param query the query that should be used to fetch the object + * @param returnType the Type that must be used to return the object + * @return the value + */ public static Object getXPath(Object root, String query, QName returnType) { return getXPath(root,query,returnType,ArtifactNamespaceContext.INSTANCE); } + /** + * Fetch the object rom the given resource using the query + * and the default <code>ArtifactNamespaceContext</code> + * @param root the source where the value should be fetch from + * @param query the query that should be used to fetch the object + * @param returnType the Type that must be used to return the object. + * @param context the namespacecontext that must match to + * fetch the object. + * @return the value + */ public static Object getXPath( Object root, String query, QName returnType, NamespaceContext context ) { return xpath(root, query, returnType, context); } - public static String getStringXPath(String xpath) { - return getStringXPath(xpath, null); - } - + /** + * Fetch a Nodeset value from a XML-Fragment or XML-Document using the + * given query. + * @param root the source where the String should be fetched from + * @param query the query that should be used, + * @return the Nodeset fetched from the source + */ public static NodeList getNodeSetXPath(Object root, String query) { return (NodeList) getXPath(root, query, XPathConstants.NODESET); } + /** + * Fetch a Node from a XML-Fragment or XML-Document using the + * given query. + * @param root the source where the Node should be fetched from + * @param query the query that should be used, + * @return the Node fetched from the source + */ public static Node getNodeXPath(Object root, String query) { return (Node) getXPath(root, query, XPathConstants.NODE); } + /** + * Fetch a String value from a XML-Fragment or XML-Document using the + * given query. + * @param root the source where the String should be fetched from + * @param xpath the query that should be used, + * @return the String fetched from the source + */ public static String getStringXPath(Object root, String xpath) { return getStringXPath(root, xpath, null); } + /** + * Fetch a String value from a XML-Fragment or XML-Document using the + * given query. + * @param root the source where the String should be fetched from + * @param query the query that should be used, + * @param def the default-value that will be returned id no value was found + * @return the String fetched from the source + */ public static String getStringXPath(Object root, String query, String def) { String s = (String) getXPath(root, query, XPathConstants.STRING); return s == null || s.length() == 0 ? def : s; } + /** + * Reads an XML-document from a given <code>InputStream</code> + * @param inputStream the <code>InputStream</code> where the document + * should be read from + * @return the document that could be read. + */ public static Document readDocument(InputStream inputStream) { Document returnValue = null; try { @@ -165,6 +292,11 @@ return returnValue; } + /** + * Writes an single <code>XML-Node</code> to a string + * @param node the <code>XML-Node</code> that should be written + * @return the encoded <code>XML-Node</code> + */ public static String writeNode2String(Node node) { try { DOMSource source = new DOMSource(node); @@ -179,13 +311,25 @@ return null; } + /** + * Reinitialize the doument. + * This is neccessary because the namespace sometimes is invalid + * using a document which was created and used in the same step. + * @param document the document which should be reinitialize + * @return the document + */ public static Document reInitDocument(Document document) { - StringBufferInputStream inputStream = new StringBufferInputStream( writeDocument2String(document)); return readDocument(inputStream); } + /** + * Writes the given Document into a String. + * This is very helpful for debugging. + * @param document the document which should be written to the string. + * @return the encoded xml-document. + */ public static String writeDocument2String(Document document) { try { DOMSource source = new DOMSource(document); @@ -201,8 +345,9 @@ } /** - * @param source - * @return + * Writes a given <code>DOMSource</code> into a String + * @param source the source that should be written to string + * @return the encoded <code>DOMSource</code> * @throws TransformerFactoryConfigurationError * @throws TransformerConfigurationException * @throws TransformerException @@ -219,5 +364,32 @@ transformer.transform(source, result); return sw.getBuffer().toString(); } + + /** + * Writes a given Document to an <code>OutputStream</code> + * @param document the document that should be written + * @param out the stream where the document should be written to, + * @return true if it was successful, false if not. + */ + public static boolean toStream(Document document, OutputStream out) { + try { + Transformer transformer = + TransformerFactory.newInstance().newTransformer(); + DOMSource source = new DOMSource(document); + StreamResult result = new StreamResult(out); + transformer.transform(source, result); + return true; + } + catch (TransformerConfigurationException tce) { + logger.error(tce.getLocalizedMessage(), tce); + } + catch (TransformerFactoryConfigurationError tfce) { + logger.error(tfce.getLocalizedMessage(), tfce); + } + catch (TransformerException te) { + logger.error(te.getLocalizedMessage(), te); + } + return false; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,12 +1,16 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.util; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.UnsupportedEncodingException; - import java.util.HashMap; import java.util.Map; @@ -16,27 +20,29 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; - import javax.xml.transform.dom.DOMSource; - import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.log4j.Logger; - import org.w3c.dom.Node; /** - * @author Tim Englich <tim.englich@intevation.de> - * + * This xsl transformer is used to transform incoming xml documents with the + * help of templates into a html representation. + * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class XSLTransformer { + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(XSLTransformer.class); - + /** + * The parameter that is required in the XSL sheet. + */ private Map<String, String> params; /** @@ -46,11 +52,21 @@ super(); } + /** + * Turns <i>toTransform</i> into another format using the template <i> + * templateFileName</i> with the <i>encoding</i>. The parameters added in + * {@link #addParameter(java.lang.String, java.lang.String)} are available + * in the transformer. + * + * @param toTransform The node to be transformed. + * @param encoding The encoding to be used. + * @param templateFileName The template used for transformation. + * @return the transformed document as string. + */ public String transform(Node toTransform, String encoding, String templateFileName) { String resultValue = null; try { - //XMLUtils xmlUtils = new XMLUtils(); Source templateSource = new StreamSource(new File(templateFileName)); TransformerFactory xformFactory = TransformerFactory.newInstance(); Transformer transformer = xformFactory @@ -82,6 +98,12 @@ } + /** + * Add a parameter that is required in the XSL sheet. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + */ public void addParameter(String name, String value) { if (params == null) { params = new HashMap<String, String>(3); @@ -90,3 +112,4 @@ params.put(name, value); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/util/package.html Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head> +</head> +<body> +Some helper classes mainly used to work with XML documents. +</body> +</html>
--- a/gnv/src/main/resources/applicationMessages.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/resources/applicationMessages.properties Fri Sep 28 12:15:21 2012 +0200 @@ -2,14 +2,24 @@ application.name=${pom.name} application.version=${pom.version} application.releasedate=${timestamp} +application.reload=Klicken Sie hier, um es erneut zu versuchen. + +gnviewer.footer.home = Home +gnviewer.footer.contact = Kontakt +gnviewer.footer.about = Impressum + +gnviewer.header.restart = Neustart +gnviewer.header.language = Englisch +gnviewer.header.info = Info gnviewer.app.title = BSH-GDI genericViewer gnviewer.project.save = Projekt speichern gnviewer.project.load = Projekt laden -gnviewer.project.load.button = Laden +gnviewer.project.load.button.src = ./images/laden.png gnviewer.history.title=\u00dcberblick +gnviewer.history.back.button=Bearbeiten gnviewer.fis.fis_marnet = Marnet gnviewer.fis.fis_imis = IMIS @@ -27,11 +37,17 @@ gnviewer.fis.fis_seacat = SeaCat gnviewer.fis.fis_currentmeter = Strommesser gnviewer.fis.fis_icestations = Eismeldungen +gnviewer.fis.fis_nauthis = Nauthis +gnviewer.fis.fis_contis=Contis +gnviewer.fis.fis_marinefeatures = Marine Basisdaten gnviewer.select.button = Ausw\u00e4hlen +gnviewer.select.button.src = ./images/auswaehlen.png gnviewer.draw.button = Aktualisieren +gnviewer.example.linestring=Beispiel WKT-Linestring einf\u00fcgen +gnviewer.example.polygon=Beispiel WKT-Polygon einf\u00fcgen -gnviewer.productselection.overlay.title = Die Anfrage wird bearbeitet, bitte gedulden Sie sich einen Moment. +gnviewer.productselection.overlay.title = Die Anfrage wird bearbeitet. Bitte gedulden Sie sich einen Moment. gnviewer.productselection.fisselection.title = Fachinformationssystem # Statistik @@ -63,18 +79,21 @@ binwidth=Breite einer Klasse # diagram options dialog +gnviewer.diagram.button=Diagramm gnviewer.diagram.options.header.title=Diagrammoptionen # wms gnviewer.wms.server.path=URL des WMS -gnviewer.wms.server.layer=Name des Layers +gnviewer.wms.layer.ttl=Layer ist g\u00fcltig bis +gnviewer.wms.options.header.title=WMS Optionen # attachedOutputOptions gnviewer.output.options.diagramm.alt=Diagramm gnviewer.output.options.histogram.alt=Histogramm -gnviewer.output.options.save.title=Diagramm speichern +gnviewer.output.options.refresh.title=Diagramm aktualisieren gnviewer.output.options.export.csv.title=Daten als CSV exportieren gnviewer.output.options.export.odv.title=Daten als ODV exportieren +gnviewer.output.options.export.png.title=Diagramm als PNG exportieren gnviewer.output.options.export.pdf.title=Diagramm als PDF exportieren gnviewer.output.options.export.svg.title=Diagramm als SVG exportieren gnviewer.output.options.export.zip.title=ZIP-Archiv exportieren @@ -86,13 +105,46 @@ height=H\u00f6he width=Breite points=Zeichne Datenpunkte +title=Titel # Fehlermeldungen: java.io.ioexception..connection.refused=Die Verbindung zur Artifaktdatenbank ist unterbrochen. Bitte probieren Sie es zu einem sp\u00e4teren Zeitpunkt erneut. +java.io.ioexception..connection.reset=Die Verbindung zur Artifaktdatenbank ist unterbrochen. Bitte probieren Sie es zu einem sp\u00e4teren Zeitpunkt erneut. java.io.ioexception..unable.to.parse.the.response.http.version..end.of.stream.reached.too.early=Die Verbindung zur Artifaktdatenbank wurde unerwartet unterbrochen. no.inputdata.given..please.select.at.least.one.entry=Es wurde kein Eintrag ausgew\u00e4hlt. Bitte w\u00e4hlen sie mindestens einen Eintrag aus. de.intevation.gnv.geobackend.base.query.exception.queryexception..java.sql.sqlexception =Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support. java.io.ioexception..the.server.encountered.an.unexpected.condition.which.prevented.it.from.fulfilling.the.request=Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support. java.lang.illegalargumentexception..inputstream.cannot.be.null=Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support. - +input.is.not.valid.for.this.state=Der von Ihnen eingegebene Wert ist ung\u00fcltig. Bitte versuchen Sie es erneut. +input.not.a.integer= ist keine g\u00fcltige Ganzzahl. Bitte versuchen Sie es erneut. +input.not.a.double= ist keine g\u00fcltige Flie\u00dfkommazahl. Bitte versuchen Sie es erneut. +upload.failure=Beim Hochladen der Datei ist ein Fehler aufgetreten. +no.artifact.chosen=Es ist noch kein FIS gew\u00e4hlt. +invalid.artifact=Ung\u00fcltiges Artefakt Dokument gefunden. +mismatching.checksum=Ung\u00fcltiges Artefakt Dokument gefunden. +no.such.factory=Ung\u00fcltiges Artefakt Dokument gefunden. +java.io.ioexception..no.such.artifact=Ihr Artefakt ist ung\u00fcltig oder bereits abgelaufen. +java.io.ioexception..java.heap.space =Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support. +sessiontimeout.has.occured=Ihre Sitzung ist abgelaufen. + +# the map client +gnvview.mapclient.fullscreen = Vollbild +gnviewer.mapclient.layercontrol = Layerkontrolle +gnviewer.mapclient.layercontrol.baselayer = Hintergrundlayer +gnviewer.mapclient.layercontrol.overlay = Generierte Layer +gnviewer.mapclient.legend = Legende +gnviewer.mapclient.wms.load.title = Weitere Layer hinzuf\u00fcgen +gnviewer.mapclient.wms.load.addlayer = Layer hinzuf\u00fcgen +gnviewer.mapclient.wms.load.grid.name = Name +gnviewer.mapclient.wms.load.grid.title = Titel +gnviewer.mapclient.wms.load.bt.text = Laden +gnviewer.mapclient.wms.load.bt.tooltip = L\u00e4d das Capabilities Dokument vom angegebenen Server +gnviewer.mapclient.wms.load.grid.error.title = Fehler +gnviewer.mapclient.wms.load.grid.error.message = Unter der angegebenen Url konnten keine Layer ermittelt werden. +gnviewer.mapclient.controls.nav.previous.title = Springt zum letzten Kartenausschnitt +gnviewer.mapclient.controls.nav.next.title = Springt zum vorherigen Kartenausschnitt +gnviewer.mapclient.controls.navigate.title = Verschieben der Karte +gnviewer.mapclient.controls.zoombox.title = Zum Zoomen ziehen Sie eine Box auf, indem Sie klicken und ziehen +gnviewer.mapclient.controls.info.title = Detailinformationen zu Objekten durch Klicken in die Karte +gnviewer.mapclient.wms.local.service.name = GNV Web Map Service
--- a/gnv/src/main/resources/applicationMessages_en.properties Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/resources/applicationMessages_en.properties Fri Sep 28 12:15:21 2012 +0200 @@ -2,14 +2,24 @@ application.name=${pom.name} application.version=${pom.version} application.releasedate=${timestamp} +application.reload=Click here to try again + +gnviewer.footer.home = Home +gnviewer.footer.contact = Contact +gnviewer.footer.about = Imprint + +gnviewer.header.restart = Restart +gnviewer.header.language = German +gnviewer.header.info = Info gnviewer.app.title = BSH-GDI genericViewer gnviewer.history.title=Summary +gnviewer.history.back.button=Change gnviewer.project.save = Save Project gnviewer.project.load = Load Project -gnviewer.project.load.button = Load +gnviewer.project.load.button.src = ./images/load.png gnviewer.fis.fis_marnet = Marnet gnviewer.fis.fis_imis = IMIS @@ -27,9 +37,15 @@ gnviewer.fis.fis_seacat = SeaCat gnviewer.fis.fis_currentmeter = Current Meter gnviewer.fis.fis_icestations = Ice Station Report +gnviewer.fis.fis_nauthis = Nauthis +gnviewer.fis.fis_contis=Contis +gnviewer.fis.fis_marinefeatures = Marine Features gnviewer.select.button = Choose +gnviewer.select.button.src = ./images/choose.png gnviewer.draw.button = Update +gnviewer.example.linestring=Insert an example linestring as wkt +gnviewer.example.polygon=Insert an example polygon as wkt gnviewer.productselection.overlay.title = Your request will be processed. Please wait... gnviewer.productselection.fisselection.title = Data set @@ -63,18 +79,21 @@ binwidth=Class width # diagram options dialog +gnviewer.diagram.button=Diagram gnviewer.diagram.options.header.title=Diagram options # wms gnviewer.wms.server.path=WMS URL -gnviewer.wms.server.layer=Layername +gnviewer.wms.layer.ttl=Layer is valid to +gnviewer.wms.options.header.title=WMS Optionen # attachedOutputOptions gnviewer.output.options.diagramm.alt=Diagram gnviewer.output.options.histogram.alt=Histogram -gnviewer.output.options.save.title=Save Diagram +gnviewer.output.options.refresh.title=Refresh chart gnviewer.output.options.export.csv.title=Export Data as CSV gnviewer.output.options.export.odv.title=Export Data as ODV +gnviewer.output.options.export.png.title=Export chart as PNG gnviewer.output.options.export.pdf.title=Export chart as PDF gnviewer.output.options.export.svg.title=Export chart as SVG gnviewer.output.options.export.zip.title=Export as ZIP archive @@ -86,10 +105,44 @@ height=Height width=Width points=Draw data points +title=Title java.io.ioexception..connection.refused = The Connection to the ArtifactDatabase is interrupted. Please try again later. +java.io.ioexception..connection.reset = The Connection to the ArtifactDatabase is interrupted. Please try again later. java.io.ioexception..unable.to.parse.the.response.http.version..end.of.stream.reached.too.early= The Connection to the ArtifactDatabase was interrupted unexpected. no.inputdata.given..please.select.at.least.one.entry = No Entry was chosen. Please select at least one entry. -de.intevation.gnv.geobackend.base.query.exception.queryexception..java.sql.sqlexception: A internal Server error has occurred. Please contact the Support. -java.io.ioexception..the.server.encountered.an.unexpected.condition.which.prevented.it.from.fulfilling.the.request = A internal Server error has occurred. Please contact the Support. -java.lang.illegalargumentexception..inputstream.cannot.be.null = A internal Server error has occurred. Please contact the Support. +de.intevation.gnv.geobackend.base.query.exception.queryexception..java.sql.sqlexception=An internal server error has occurred. Please contact the support. +java.io.ioexception..the.server.encountered.an.unexpected.condition.which.prevented.it.from.fulfilling.the.request=An internal server error has occurred. Please contact the support. +java.lang.illegalargumentexception..inputstream.cannot.be.null = An internal server error has occurred. Please contact the support. +input.is.not.valid.for.this.state=You entered an invalid value. Please try again. +input.not.a.integer= is not a valid integer. Please try again. +input.not.a.double= is not a valid floating-point number. Please try again. +upload.failure=An error occured while uploading file. +no.artifact.chosen=No fis selected yet. +invalid.artifact=Invalid artifact found. +mismatching.checksum=Invalid artifact found. +no.such.factory=Invalid artifact found. +java.io.ioexception..no.such.artifact=Your artifact is invalid or out of date. +java.io.ioexception..java.heap.space = An internal server error has occurred. Please contact the support. +sessiontimeout.has.occured=Your session timed out. + +# the map client +gnvview.mapclient.fullscreen = Full screen +gnviewer.mapclient.layercontrol = Layercontrol +gnviewer.mapclient.layercontrol.baselayer = Baselayer +gnviewer.mapclient.layercontrol.overlay = Overlay +gnviewer.mapclient.legend = Legend +gnviewer.mapclient.wms.load.title = Add further Layer +gnviewer.mapclient.wms.load.addlayer = Add Layer +gnviewer.mapclient.wms.load.grid.name = Name +gnviewer.mapclient.wms.load.grid.title = Title +gnviewer.mapclient.wms.load.bt.text = Load +gnviewer.mapclient.wms.load.bt.tooltip = Load the Capabilities document from the given destination. +gnviewer.mapclient.wms.load.grid.error.title = Error +gnviewer.mapclient.wms.load.grid.error.message = No layer could be determined under the given url. +gnviewer.mapclient.controls.nav.previous.title = Jumps to the last Mapview +gnviewer.mapclient.controls.nav.next.title = Jumps to the last Mapview +gnviewer.mapclient.controls.navigate.title = Moves the map +gnviewer.mapclient.controls.zoombox.title = Zoom by clicking an moving the mouse to generate a box +gnviewer.mapclient.controls.info.title = Identify features by clicking +gnviewer.mapclient.wms.local.service.name = GNV Web Map Service
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/classes/log4j.properties Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,19 @@ +#### Log just errors and warnings to a file. +log4j.rootLogger=WARN, BSH + +## The following line enables the output of the MapViewer call document. +log4j.category.de.intevation.gnv.action.mapviewer.MapViewerCallAction=DEBUG + +#### Log everything to a file. +#log4j.rootLogger=DEBUG, BSH + +log4j.appender.BSH=org.apache.log4j.RollingFileAppender +log4j.appender.BSH.File=${catalina.base}/logs/gnv.log +log4j.appender.BSH.layout=org.apache.log4j.PatternLayout +log4j.appender.BSH.layout.ConversionPattern=%d [%t] %-5p %c - %m%n + +# set WARN log level for following packages to reduce output. +log4j.category.org.apache.jasper=WARN +log4j.category.org.apache.catalina=WARN +log4j.category.org.apache.commons=WARN +log4j.category.org.apache.struts=WARN
--- a/gnv/src/main/webapp/WEB-INF/config/log4j.properties Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n - -# Abschalten des geschwätzigen Loggings in dre Klasse JspServlet -log4j.category.org.apache.jasper.servlet.JspServlet=WARN -log4j.category.org.apache.catalina.core.ContainerBase=WARN \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/reachable-servers.conf Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,34 @@ +['BSH WMS Background','http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer'], +['BSH WMS CONTIS Administration','http://gdisrv.bsh.de/arcgis/services/CONTIS/Administration/MapServer/WMSServer'], +['BSH WMS CONTIS Facilities','http://gdisrv.bsh.de/arcgis/services/CONTIS/Facilities/MapServer/WMSServer'], +['BSH WMS NAUTHIS Skin of the Earth','http://gdisrv.bsh.de/arcgis/services/Nauthis/SkinOfTheEarth/MapServer/WMSServer '], +['BSH WMS NAUTHIS Navigational Aids','http://gdisrv.bsh.de/arcgis/services/Nauthis/NavigationalAids/MapServer/WMSServer '], +['BSH WMS NAUTHIS Seawards Limits','http://gdisrv.bsh.de/arcgis/services/Nauthis/SeawardsLimits/MapServer/WMSServer'], +['BSH WMS NAUTHIS Rocks Wrecks Obstructions','http://gdisrv.bsh.de/arcgis/services/Nauthis/RocksWrecksObstructions/MapServer/WMSServer'], +['BSH WMS NAUTHIS Hydrography','http://gdisrv.bsh.de/arcgis/services/Nauthis/Hydrography/MapServer/WMSServer'], +['BSH WMS NAUTHIS Topography','http://gdisrv.bsh.de/arcgis/services/Nauthis/Topography/MapServer/WMSServer'], +['BSH WMS Water Pollution Reports','http://gdisrv.bsh.de/arcgis/services/WaterPollution/WaterPollution/MapServer/WMSServer'], +['BSH WMS Marine Environmental Monitoring Network','http://gdisrv.bsh.de/arcgis/services/MARNET/MARNET/MapServer/WMSServer'], +['BSH WMS Remote Sensing Sea Surface Temperature','http://gdisrv.bsh.de/arcgis/services/RemoteSensing/SeaSurfaceTemperature/MapServer/WMSServer'], +['BSH WMS Sea Surface Temperature Analysis','http://gdisrv.bsh.de/arcgis/services/SeaSurfaceTemperature/SeaSurfaceTemperature/MapServer/WMSServer'], +['BSH WMS Prediction Model Current','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterCurrent/MapServer/WMSServer'], +['BSH WMS Prediction Model Water Level NN','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterLevelNN/MapServer/WMSServer'], +['BSH WMS Prediction Model Water Temperature','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterTemperature/MapServer/WMSServer'], +['BSH WMS Prediction Model Salinity','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterSalinity/MapServer/WMSServer'], +['BSH WMS SGE Additional Information','http://gdisrv.bsh.de/arcgis/services/SGE/AdditionalInformation/MapServer/WMSServer'], +['BSH WMS SGE Seabed Sediments','http://gdisrv.bsh.de/arcgis/services/SGE/SeabedSediments/MapServer/WMSServer'], +['BSH WMS SGE Subsurface Sediments','http://gdisrv.bsh.de/arcgis/services/SGE/SubsurfaceSediments/MapServer/WMSServer'], +['BSH WMS SGE Survey','http://gdisrv.bsh.de/arcgis/services/SGE/Survey/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Sediment PCB','http://gdisrv.bsh.de/arcgis/services/MUDAB/SedimentPCB/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Sediment Metalle','http://gdisrv.bsh.de/arcgis/services/MUDAB/SedimentMetals/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Sediment HCH','http://gdisrv.bsh.de/arcgis/services/MUDAB/SedimentHCH/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser PCB','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPCB/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser Nährstoffe','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterNutrients/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser Metalle','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterMetals/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser HCH','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterHCH/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser Physik','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPhysical/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser PAH','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPAH/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Wasser Pestizide','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPesticide/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Biota PCB','http://gdisrv.bsh.de/arcgis/services/MUDAB/BiotaPCB/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Biota Metalle','http://gdisrv.bsh.de/arcgis/services/MUDAB/BiotaMetals/MapServer/WMSServer'], +['BSH WMS MUDAB BLMP Biota HCH','http://gdisrv.bsh.de/arcgis/services/MUDAB/BiotaHCH/MapServer/WMSServer'] \ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Fri Sep 28 12:15:21 2012 +0200 @@ -6,9 +6,21 @@ <global-exceptions/> <global-forwards> <forward name="entrance" path="/start.do"/> + <forward name="imprint" path="/imprint.do"/> + <forward name="info" path="/info.do"/> </global-forwards> - + <action-mappings> + <action path="/imprint" + type="org.apache.struts.actions.ForwardAction" + parameter="/WEB-INF/jsp/imprint.jsp" + scope="request" + validate="false" /> + <action path="/info" + type="org.apache.struts.actions.ForwardAction" + parameter="/WEB-INF/jsp/info.jsp" + scope="request" + validate="false" /> <action path="/version" type="de.intevation.gnv.action.ArtifactDatabaseActionBase" scope="request" @@ -33,6 +45,34 @@ name="success" path="/WEB-INF/jsp/mainlayout.jsp"/> </action> + <action path="/store" + type="de.intevation.gnv.action.StoreAction" + scope="request" + validate="false"> + <forward + name="success" + path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="failure" + path="/WEB-INF/jsp/mainlayout.jsp"/> + </action> + <action path="/load" + type="de.intevation.gnv.action.LoadAction" + scope="request" + validate="false"> + <forward + name="success" + path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="failure" + path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="back" + path="/gnv/back.do"/> + <forward + name="selectfis" + path="/gnv/selectFis.do"/> + </action> <action path="/start" type="de.intevation.gnv.action.FetchArtifactFactoriesAction" scope="request" @@ -48,6 +88,9 @@ <forward name="success" path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="back" + path="/gnv/back.do"/> <forward name="selectfis" path="/gnv/selectFis.do"/> @@ -87,6 +130,12 @@ <forward name="selectfis" path="/gnv/selectFis.do"/> + <forward + name="store" + path="/gnv/store.do"/> + <forward + name="load" + path="/gnv/load.do"/> </action> <action path="/out" type="de.intevation.gnv.action.DoOutputAction" @@ -107,10 +156,22 @@ name="selectfis" path="/gnv/selectFis.do"/> </action> + <action path="/mapclient" + type="de.intevation.gnv.action.MapClientStandaloneAction" + scope="request" + validate="false"> + <forward + name="success" + path="/WEB-INF/jsp/wmsstandalone.jsp"/> + </action> + <action path="/export" type="de.intevation.gnv.action.DoExportAction" scope="request" validate="false"> + <forward + name="success" + path="/WEB-INF/jsp/mainlayout.jsp"/> </action> <action path="/changeOptions" type="de.intevation.gnv.action.ChangeOptionsAction" @@ -168,7 +229,35 @@ name="success" path="/WEB-INF/jsp/mainlayout.jsp"/> </action> - </action-mappings> + <action path="/describe" + type="de.intevation.gnv.action.DescribeUIAction" + scope="request" + validate="false"> + <forward + name="back" + path="/gnv/back.do"/> + <forward + name="selectfis" + path="/gnv/selectFis.do"/> + <forward + name="success" + path="/WEB-INF/jsp/mainlayout.jsp"/> + </action> + <action path="/language" + type="de.intevation.gnv.action.SwitchLanguageAction" + scope="request" + validate="false"> + <forward + name="success" + path="/WEB-INF/jsp/mainlayout.jsp"/> + <forward + name="back" + path="/gnv/back.do"/> + <forward + name="selectfis" + path="/gnv/selectFis.do"/> + </action> + </action-mappings> <message-resources parameter="applicationMessages" null="false"/> </struts-config>
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl Fri Sep 28 12:15:21 2012 +0200 @@ -11,7 +11,7 @@ <xsl:param name="back-url"/> <xsl:param name="selectfis"/> - <xsl:param name="edit">bearbeiten</xsl:param> + <xsl:param name="edit"></xsl:param> <xsl:param name="total"><xsl:value-of select="count(*)"/></xsl:param> <!-- start parsing document --> @@ -43,11 +43,9 @@ <xsl:param name="index" /> <xsl:param name="fis" /> <xsl:if test="$state != ''"> - <xsl:if test="$index = $total"> - <a href="{$back-url}?target={$state}"> - <img title="{$edit}" alt="{$edit}" src="images/back_button.png"/> - </a> - </xsl:if> + <a href="{$back-url}?target={$state}"> + <img title="{$edit}" alt="{$edit}" src="images/back_button.png"/> + </a> </xsl:if> <xsl:if test="$fis"> <a href="{$selectfis}"><img title="{$edit}" alt="{$edit}" src="images/back_button.png"/></a>
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Fri Sep 28 12:15:21 2012 +0200 @@ -9,6 +9,9 @@ <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no" /> + <xsl:param name="example-linestring"/> + <xsl:param name="example-polygon"/> + <!-- single select --> <xsl:template match="xform:select1"> <xsl:variable name="selectName" select="@ref"/> @@ -23,8 +26,10 @@ <xsl:template match="xform:select"> <xsl:variable name="selectName" select="@ref"/> <xsl:variable name="items" select="count(//xform:item)"/> + <legend> + <xsl:value-of select="xform:label"/> + </legend> - <legend><xsl:value-of select="xform:label"/></legend> <xsl:choose> <xsl:when test="$items = 1"> <select name="{$selectName}" multiple="multiple" size="{$items}"> @@ -80,7 +85,7 @@ </legend> <xsl:choose> - <xsl:when test="$selectcount < '2'"> + <xsl:when test="$selectcount < '1'"> <table class="dynamic"> <xsl:apply-templates/> </table> @@ -89,18 +94,38 @@ <table class="static"> <tr> <td><!-- nothing here --></td> - <xsl:for-each select="xform:select[1]/xform:item"> - <td class="matrixHeader"><xsl:value-of select="position()"/>.</td> - </xsl:for-each> + <!-- take the first select node to render column labels --> + <xsl:apply-templates select="xform:select[1]/xform:item" mode="matrixHeader"/> </tr> + <tr> + <td><!-- nothing here --></td> + <xsl:apply-templates select="xform:select[1]/xform:item" mode="matrixSelectable"/> + </tr> + <!-- render matrix' body --> <xsl:apply-templates select="xform:select" mode="matrix" /> </table> - <xsl:apply-templates select="xform:select[1]" mode="matrixLegend"/> </xsl:otherwise> </xsl:choose> </xsl:template> - <!-- template for rendering parameter matrix --> + <!-- rendering column headers (measurements) --> + <xsl:template match="xform:item" mode="matrixHeader"> + <td class="matrixHeader"> + <xsl:value-of select="xform:label/text()"/> + </td> + </xsl:template> + + <!-- --> + <xsl:template match="xform:item" mode="matrixSelectable"> + <xsl:variable name="value" select="xform:value/text()"/> + <xsl:variable name="name" select="@ref"/> + <td class="matrixSelectableHeader"> + <input type="checkbox" name="{$name}" value="{$value}" /> + </td> + </xsl:template> + + + <!-- render the first column with parameter names into matrix --> <xsl:template match="xform:select" mode="matrix"> <tr> <td><xsl:value-of select="@label" /></td> @@ -108,29 +133,19 @@ </tr> </xsl:template> - <!-- template for rendering parameter matrix --> - <xsl:template match="xform:select" mode="matrixLegend"> - <table> - <xsl:for-each select="xform:item"> - <tr> - <td><xsl:value-of select="position()" />.:</td> - <td><xsl:value-of select="@parameter" /></td> - </tr> - </xsl:for-each> - </table> - </xsl:template> - <!-- template for rendering parameter matrix --> + <!-- render checkboxes and disable checkboxes for invalid parameter + measurements --> <xsl:template match="xform:item" mode="matrix"> <xsl:variable name="value" select="xform:value/text()"/> <xsl:variable name="name" select="@ref"/> - <td> + <td class="matrixContent"> <xsl:choose> <xsl:when test="@disabled = 'true'"> - <input type="checkbox" name="{$name}" value="{$value}" disabled="true"></input> + <img src="./images/delete.png"/> </xsl:when> <xsl:otherwise> - <input type="checkbox" name="{$name}" value="{$value}"></input> + <img src="./images/tick.png"/> </xsl:otherwise> </xsl:choose> </td> @@ -145,17 +160,17 @@ <!-- TODO: Remove this when we have the GIS interface. (slt) --> <xsl:choose> <xsl:when test="$inputName = 'mesh_linestring'"> - <a href="javascript:copy_demo_wkt_line();"><xsl:text>Beispiel WKT-Linestring einfügen:</xsl:text></a><br/> + <a href="javascript:copy_demo_wkt_line();"><xsl:value-of select="$example-linestring"/>:</a><br/> </xsl:when> <xsl:when test="$inputName = 'mesh_polygon'"> - <a href="javascript:copy_demo_wkt_polygon();"><xsl:text>Beispiel WKT-Polygon einfügen:</xsl:text></a><br/> + <a href="javascript:copy_demo_wkt_polygon();"><xsl:value-of select="$example-polygon"/>:</a><br/> </xsl:when> </xsl:choose> <tr> <xsl:choose> <xsl:when test="$label != ''"> - <td><xsl:value-of select="$label"/>:</td> + <td class="parameter"><xsl:value-of select="$label"/>:</td> </xsl:when> </xsl:choose>
--- a/gnv/src/main/webapp/WEB-INF/jsp/footer.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/footer.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,6 +1,35 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" language="java" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> -<html:xhtml/> -<%--div style="clear: left; margin-top: 40px;"/--%> \ No newline at end of file +<table class="footerTable"> + <tr> + <td class="footerLine">© 2010 Bundesamt für Seeschifffahrt und Hydrographie</td> + <td></td> + </tr> + <tr> + <td colspan="2"> + <table class="footerTableLinks"> + <tr> + <td align="left"></td> + <td align="right"> + <html:link styleClass="footerLineLinks" href="http://www.bsh.de"><bean:message key="gnviewer.footer.home"/></html:link> + <font color="white">·</font> + <html:link styleClass="footerLineLinks" href="mailto:"><bean:message key="gnviewer.footer.contact"/></html:link> + <font color="white">·</font> + <html:link styleClass="footerLineLinks" page="/imprint.do"><bean:message key="gnviewer.footer.about"/></html:link> + </td> + </tr> + </table> + </td> + </tr> +</table> +<%--div style="clear: left; margin-top: 40px;"/--%>
--- a/gnv/src/main/webapp/WEB-INF/jsp/header.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/header.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,47 +1,33 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" language="java"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%> -<% Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID); - exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null); - exceptionMessage = (exceptionMessage != null && exceptionMessage.toString().endsWith(".") ? exceptionMessage.toString().substring(0,exceptionMessage.toString().length()-1) : exceptionMessage); - - boolean showmapviewercallBody = request.getAttribute("MAPVIEWERCALL") != null; - -%> -<%@page import="de.intevation.gnv.action.CommunicationKeys"%><html:xhtml /> -<!-- Kopfleiste--> -<div id="head" title="GDI BSH genericViewer"> - <div id="logo"> - - - </div> - <h1> - <a href="<html:rewrite action="/start"/>"> - <bean:message key="gnviewer.app.title" /> - </a> - </h1> - - <div id="project"> - <label style="font-weight:bold;"> - <bean:message key="gnviewer.project.load"/> - | - <bean:message key="gnviewer.project.save" /> - </label> - <div id="project_load"> - - </div> - <br/> - <%if (showmapviewercallBody){ %> - <jsp:include page="includes/display_mapviewercall_inc.jsp" /> - <%}%> - </div> - <div class="errormsg" id="load_error"> - <%if (exceptionMessage != null){ %> - <bean-el:message key="<%=exceptionMessage.toString()%>"/> - <%}%> - </div> + +<div id="headline"> + <h1 class="headline">BSH Generischer Viewer</h1> </div> +<br/> + +<table class="headerTableLinks"> + <tr> + <td align="left"></td> + <td align="right"> + <html:link styleClass="headerLineLinks" href="./start.do"><bean:message key="gnviewer.header.restart"/></html:link> + <font color="white">·</font> + <a class="headerLineLinks" href="<%=response.encodeURL("language.do?uid="+System.currentTimeMillis())%>"><bean:message key="gnviewer.header.language"/></a> + <font color="white">·</font> + <html:link styleClass="headerLineLinks" page="/info.do"><bean:message key="gnviewer.header.info"/></html:link> + </td> + </tr> +</table>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/imprint.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title> + <bean:message key="gnviewer.app.title"/> + </title> + <link href="styles/gnv.css" rel="stylesheet" type="text/css"/> + </head> + + <body id="gnviewerbody"> + <div id="page"> + <div id="headline"> + <h1 class="headline">BSH Generischer Viewer</h1> + </div> + + <br/> + + <div id="headerElement"> + <table class="headerTableLinks"> + <tr> + <td align="left"></td> + <td align="right"> + <html:link styleClass="headerLineLinks" page="/start.do"><bean:message key="gnviewer.header.restart"/></html:link> + <font size="1.5em" color="white">·</font> + <html:link styleClass="headerLineLinks" page="/info.do"><bean:message key="gnviewer.header.info"/></html:link> + </td> + </tr> + </table> + </div> + <div id="contentElement" class="contentElement"> + TODO: Impressum. + </div> + <div id="footerElement"> + <jsp:include page="footer.jsp" /> + </div> + </div> + </body> +</html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> @@ -32,7 +40,6 @@ %> <%-- diagramm is not null if the user clicked the 'draw' button --%> -<jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include> <div id="diagram"> <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+"&mode=img"+parameterString+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/> <br/>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,14 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> +<%@page import="de.intevation.gnv.action.CommunicationKeys"%> <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%> @@ -8,13 +17,17 @@ <%@page import="de.intevation.gnv.artifactdatabase.objects.ExportMode"%> <%@page import="java.util.Collection"%> <%@page import="java.util.Iterator"%> +<%@page import="java.util.Locale"%> <%@page import="java.net.URLEncoder"%> -<% +<% + String exceptionMsg = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE); + String exceptionValue = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE); String target = "chart"; String targetPDF = "pdf"; String targetSVG = "svg"; String targetIMG = "img"; SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Locale locale = sm.getCurrentLocale(); OutputMode outputMode = sm.getOutputMode(target); DiagrammOptions diagrammOptions = sm.getDiagrammOptions(); @@ -55,47 +68,51 @@ <legend onmousedown="displayDiv('diagramOptionsContent');" class="expandableFieldset"> <bean:message key="gnviewer.diagram.options.header.title"/> </legend> - <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do")%>"> - <table> + + <% if (exceptionMsg != null) {%> + <div id="chartException" class="chartException"> + '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/> + </div> + <%}%> + + <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do?target="+target)%>"> + <table class="static"> <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){ Iterator<OutputParameter> it = outputMode.getOutputParameters().iterator(); while (it.hasNext()){ OutputParameter om = it.next(); %> <tr> - <td> + <td class="parameter"> <bean-el:message key="<%=om.getName()%>"/> </td> <td> <%if (om.getType().equalsIgnoreCase("boolean")){ - boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName())) : om.getValue().equalsIgnoreCase("true"); + boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName(), locale)) : om.getValue().equalsIgnoreCase("true"); %> <input type="checkbox" name="<%=om.getName() %>" <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/> <%}else{%> - <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName()): om.getValue()%>"/> + <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName(), locale): om.getValue()%>"/> <%}%> </td> </tr> <%}%> </table> <div class="exportBar"> - <input type="image" name="target" value="chart" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>"/> + <input type="image" name="target" value="chart" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>" title="<bean:message key="gnviewer.output.options.refresh.title"/>"/> <%}%> <%if (supportIMG != null) { %> - <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&target="+target+"&mode="+targetIMG+parameterString+"uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>"> - <img src="images/diagram_export.png" border="0"/> - </a> + <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&target="+target+"&mode="+targetIMG+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.png.title"/>"> + <img src="images/diagram_export.png" border="0"/></a> <%}%> <%if (supportPDF != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&target="+target+"&mode="+targetPDF+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>"> - <img src="images/pdf.png" border="0"/> - </a> + <img src="images/pdf.png" border="0"/></a> <%}%> <%if (supportSVG != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&target="+target+"&mode="+targetSVG+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>"> - <img src="images/svg.png" border="0"/> - </a> + <img src="images/svg.png" border="0"/></a> <%}%> </div> </form>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> @@ -72,41 +80,34 @@ <fieldset> <legend><bean:message key="gnviewer.export.fieldset.title"/></legend> <%if (supportChart) { %> - <a href="<%=response.encodeURL("chart.do?mimetype="+mimeType+"&target="+target+"&mode=img"+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>"> - <img src="images/chart_curve.png" border="0"/> - </a> + <a href="<%=response.encodeURL("chart.do?mimetype="+mimeType+"&target="+target+"&mode=img"+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.diagram.button"/>"> + <img src="images/chart_curve.png" border="0"/></a> <%}%> <%if (supportWMS) { %> <a href="<%=response.encodeURL("wms.do?mimetype="+mimeTypeWMS+"&target="+targetWMS+"&uid="+System.currentTimeMillis()+"&layer="+wmslayer)%>" title="<bean:message key="gnviewer.output.options.export.wms.title"/>"> - <img src="images/map_go.png" border="0"/> - </a> + <img src="images/map_go.png" border="0"/></a> <%}%> <%if (supportZIP) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeZIP+"&target="+targetZIP+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.zip.title"/>"> - <img src="images/disk.png" border="0"/> - </a> + <img src="images/disk.png" border="0"/></a> <%}%> <%if (supportSta) { %> <a href="<%=response.encodeURL("statistic.do")%>" title="<bean:message key="gnviewer.statistic.button"/>"> - <img src="images/statistics.png" border="0"/> - </a> + <img src="images/statistics.png" border="0"/></a> <%}%> <%if (supportHis) { %> <a href="<%=response.encodeURL("histogram.do")%>" title="<bean:message key="gnviewer.histogram.button"/>"> - <img src="images/chart_bar.png" border="0"/> - </a> + <img src="images/chart_bar.png" border="0"/></a> <%}%> <%if (supportCSV) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&target="+targetCSV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.csv.title"/>"> - <img src="images/data_export.png" border="0"/> - </a> + <img src="images/data_export.png" border="0"/></a> <%}%> <%if (supportODV) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeODV+"&target="+targetODV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.odv.title"/>"> - <img src="images/data_export.png" border="0"/> - </a> + <img src="images/data_export.png" border="0"/></a> <%}%> </fieldset> </div>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> @@ -25,7 +33,7 @@ </select> <%}%> <br/> - <input type="submit" value="<bean:message key="gnviewer.select.button"/>" /> + <input style="margin-top: 5px;" type="image" src="<bean:message key="gnviewer.select.button.src"/>"/> </fieldset> </form> -</div> \ No newline at end of file +</div>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,11 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> @@ -27,7 +35,6 @@ } %> -<jsp:include page="/WEB-INF/jsp/includes/display_histogram_options_inc.jsp"></jsp:include> <div class="histogram"> <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+"&mode=img"+parameterString+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.histogram.alt"/>'/> </div>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,14 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> +<%@page import="de.intevation.gnv.action.CommunicationKeys"%> <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%> @@ -8,13 +17,17 @@ <%@page import="de.intevation.gnv.artifactdatabase.objects.ExportMode"%> <%@page import="java.util.Collection"%> <%@page import="java.util.Iterator"%> +<%@page import="java.util.Locale"%> <%@page import="java.net.URLEncoder"%> <% + String exceptionMsg = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE); + String exceptionValue = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE); String target = "histogram"; String targetPDF = "pdf"; String targetSVG = "svg"; String targetIMG = "img"; SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Locale locale = sm.getCurrentLocale(); OutputMode outputMode = sm.getOutputMode(target); DiagrammOptions diagrammOptions = sm.getDiagrammOptions(); @@ -54,6 +67,13 @@ <legend onmousedown="displayDiv('histogramOptionsContent');" class="expandableFieldset"> <bean:message key="gnviewer.histogram.options.header.title"/> </legend> + + <% if (exceptionMsg != null) {%> + <div id="chartException" class="chartException"> + '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/> + </div> + <%}%> + <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do?target="+target)%>"> <table> <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){ @@ -74,7 +94,7 @@ else { check = "checked=\"checked\""; }%> - <input type="checkbox" <%= check %> name="bintype" value="bincount" id="checkCount" onClick="toggleBinType('checkWidth')"> </input> + <input type="checkbox" <%= check %> name="bintype" value="bincount" id="checkCount" onClick="toggleBinType('checkWidth')"/> <%}%> <%if (om.getName().equals("binwidth")) { String check = ""; @@ -84,21 +104,21 @@ else if (diaOpts == null) { check = ""; }%> - <input type="checkbox" <%= check %> name="bintype" value="binwidth" id="checkWidth" onClick="toggleBinType('checkCount')"> </input> + <input type="checkbox" <%= check %> name="bintype" value="binwidth" id="checkWidth" onClick="toggleBinType('checkCount')"/> <%}%> </td> - <td> + <td class="parameter"> <bean-el:message key="<%=om.getName()%>"/> </td> <td> <%if (om.getType().equalsIgnoreCase("boolean")){ - boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName())) : om.getValue().equalsIgnoreCase("true"); + boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName(), locale)) : om.getValue().equalsIgnoreCase("true"); %> <input type="checkbox" name="<%=om.getName() %>" <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/> <%}else{%> - <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName()): om.getValue()%>"/> + <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName(), locale): om.getValue()%>"/> <%}%> </td> </tr> @@ -108,18 +128,15 @@ <%}%> <%if (supportIMG != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&target="+target+"&mode="+targetIMG+parameterString+"uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>"> - <img src="images/diagram_export.png" border="0"/> - </a> + <img src="images/diagram_export.png" border="0"/></a> <%}%> <%if (supportPDF != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&target="+target+"&mode="+targetPDF+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>"> - <img src="images/pdf.png" border="0"/> - </a> + <img src="images/pdf.png" border="0"/></a> <%}%> <%if (supportSVG != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&target="+target+"&mode="+targetSVG+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>"> - <img src="images/svg.png" border="0"/> - </a> + <img src="images/svg.png" border="0"/></a> <%}%> </form> </fieldset>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,19 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> +<div id="headline"> + <h1 class="headline">BSH Generischer Viewer</h1> +</div> +<div id="cap" style="height: 100%; width: 100%; overflow: auto"> + <div id="remoteinput"> + <div id="urlinput" style="width: 96%"><!-- Just a Comment --></div> + <div id="urlbutton"><!-- Just a Comment --></div> + </div> + <div id="capgrid"><!-- Just a Comment --></div> +</div> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,24 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> +<jsp:include page="display_wms_basic_informations.jsp" /> +<div> +<p align="right"> + <a target="blank" href="<%=response.encodeURL("mapclient.do?uid="+System.currentTimeMillis())%>"><bean:message key="gnvview.mapclient.fullscreen"/></a> +</p> +</div> +<br/> +<div id="cap" style="height: 100%; width: 100%; overflow: auto"> + <div id="remoteinput"> + <div id="urlinput" style="width: 96%"><!-- Just a Comment --></div> + <div id="urlbutton"><!-- Just a Comment --></div> + </div> + <div id="capgrid"><!-- Just a Comment --></div> +</div> +<div id="mapcontainer" style="width: 100%; height: 100%"><!-- Just a Comment --></div> \ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,3 +1,25 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<% +String geometry = "POINT (6.3333 56.5)"; +String geometrytype = request.getParameter("gt"); +if(geometrytype != null){ + if (geometrytype.equals("POINT")){ + geometry = "POINT (6.3333 56.5)"; + }else if (geometrytype.equals("LINESTRING")){ + geometry = "LINESTRING (0.4911 56.2489,10.4464 58.1608,12.2321 56.4127,13.1250 54.8832,15.4018 54.5008,19.6875 56.4127,20.6250 59.0349,28.1250 60.2640)"; + }else if (geometrytype.equals("POLYGON")){ + geometry = "POLYGON ((-1.5763 58.3616, 0.7526 53.8428, 4.2686 53.1972, 7.9217 54.1441, 7.6020 56.2959, 11.5747 57.2857, 0.4788 58.4908, 4.2686 58.8996, 0.0219 58.5768, -1.5763 58.3616))"; + } +} +%> + <div id="basefilter" style="left:310px;position:absolute;width:350px"> <form action="<%=response.encodeURL("extcall.do")%>" method="post"> <fieldset> @@ -36,10 +58,13 @@ <mapservice id='BSH_IMS_Prediction_Model_Salinity' type='arcims' url='http://foo.bar.de'> <Modeldata /> </mapservice> + <mapservice id='BSH_IMS_CONTIS_Resources' type='arcims' url='http://foo.bar.de'> + <Contis /> + </mapservice> </mapservices> <location> <srs>EPSG:4324</srs> - <data>POINT(8.6 56.0)</data> + <data><%=geometry%></data> </location> </gnviewer> </textarea>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,32 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<% +SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); +MapService localMapService = sm.getLocalMapService(); +Collection<Layer> layer = localMapService.getLayer(); +%> + +<%@page import="java.util.Collection"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%> +<%@page import="java.util.Iterator"%><div id="wms"> + <table> + <tr> + <td class="parameter"><bean:message key="gnviewer.wms.server.path"/>:</td> + <td class="wmsvalue"><%=localMapService.getURL()%>?SERVICE=WMS&REQUEST=GetCapabilities</td> + </tr> + <tr> + <td class="parameter"><bean:message key="gnviewer.wms.layer.ttl"/>:</td> + <td class="wmsvalue"><%=localMapService.getTtl()%></td> + </tr> + </table> +</div>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,76 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> +<%@page import="de.intevation.gnv.action.CommunicationKeys"%> +<%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%> +<%@page import="java.util.Collection"%> +<%@page import="java.util.Iterator"%> +<%@page import="java.util.Locale"%> +<%@page import="java.net.URLEncoder"%> +<% + String exceptionMsg = (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE); + String exceptionValue= (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE); + String layer = (String) request.getAttribute("layer"); + String target = "wms"; + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Locale locale = sm.getCurrentLocale(); + OutputMode om = sm.getOutputMode(target); + DiagrammOptions opts = sm.getDiagrammOptions(); + String uuid = sm.getCurrentArtifact().getId(); +%> + +<div id="diagramOptionsContent"> + <fieldset> + <legend onmousedown="displayDiv('diagramOptionsContent');" class="expandableFieldset"> + <bean:message key="gnviewer.wms.options.header.title"/> + </legend> + + <% if (exceptionMsg != null) {%> + <div id="chartException" class="chartException"> + '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/> + </div> + <%}%> + + <form id="outputOptionsForm" method="POST" action="<%=response.encodeURL("wms.do")%>"> + <table> + <% Collection<OutputParameter> params = om.getOutputParameters(); + if (om != null && params != null && !params.isEmpty()) { + Iterator<OutputParameter> iter = params.iterator(); + while (iter.hasNext()) { + OutputParameter param = iter.next(); %> + + <tr> + <td class="parameter"><bean-el:message key="<%=param.getName()%>"/></td> + <td> + <%if (param.getType().equalsIgnoreCase("boolean")) { + boolean checked = (opts != null) ? "true".equalsIgnoreCase(opts.getValue(param.getName(), locale)) : param.getValue().equalsIgnoreCase("true"); + %> + <input type="checkbox" name="<%=param.getName()%>" <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/> + <%} + else {%> + <input type="text" name="<%=param.getName() %>" value="<%= (opts != null) ? opts.getValue(param.getName()) : param.getValue()%>"/> + <%}%> + </td> + </tr> + <%} + }%> + <tr> + <td> + <input type="image" name="target" value="wms" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>"/> + </td> + </tr> + </table> + </form> + </fieldset> +</div>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/info_english.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,13 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<div class="info-content"> + <div style="padding-top: 15px;">Further information are available in German only.</div> +</div>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/info_german.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,67 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<div class="info-content"> + + <h2 class="headline infoheadline">Informationen über den Generischen Viewer in der GDI BSH</h2> + + In der Geodateninfrastruktur des <a href="http://www.bsh.de/" target="_new"> + Bundesamtes für Seeschifffahrt und Hydrographie (BSH)</a> werden alle + wesentlichen marinen Geodaten in einem Data Warehouse vorgehalten. Neben dem + Geodatenportal, dem <a href="http://www.geoseaportal.de/" target="_new"> + GeoSeaPortal</a>, werden v.a. die Parameter, die räumlich und zeitlich + variieren, über den Generischen Viewer bereitgestellt. + <br/>Der Generische Viewer übernimmt die Aufgaben, den umfangreichen + Datenbestand des Data Warehouses Endnutzern strukturierbar anzubieten, um + fachliche Analysen wie Zeitreihen, unterschiedliche Profile, Schnittoperationen + und Statistiken browsergestützt durchführen zu können. Über umfangreiche + Exportfunktionen stehen Fachdaten und Visualisierungsprodukte zur weiteren + Bearbeitung bereit. Der Generische Viewer liefert damit einen zentralen + Zugangspunkt für Fachdaten, die über eine rein kartographische Visualisierung + hinausgehen. + <br/> + Weitere Informationen zur Geodateninfrastruktur des BSH (GDI-BSH) unter + <a href="http://www.geoseaportal.de" target="_new">http://www.geoseaportal.de</a> + + <h2 class="headline infoheadline">Kontakt</h2> + + Projektgruppe GDI BSH im <a href="http://www.bsh.de/" target="_new">Bundesamt + für Seeschifffahrt und Hydrographie</a> Bernhard-Nocht-Straße 78 20359 Hamburg + <br/><br/> + Fachliche Fragen <a href="mailto:juergen.schulz-ohlberg@bsh.de">Jürgen Schulz-Ohlberg</a> + <br/><br/> + Technische Fragen <a href="mailto:joerg.gerdes@bsh.de">Jörg Gerdes</a> + <br/><br/> + <h2 class="headline infoheadline">Über Generischen Viewer (GNV)</h2> + + Die Software "Generische Viewer GDI-BSH" setzt auf dem verteilbaren Softwaresystem + des "Open Water Analyst" auf, um auf die umfangreichen Datenbestände des + Data Warehouses des BSH, realisiert auf ESRI ArcSDE und Oracle. Über ein + einheitliches Protokoll auf der Basis von REST steuert die webgestützte Oberfläche + des Generischen Viewers die Serverkomponente an, die für die Datenbeschaffung, die + -analyse und Ausgabengenerierung verantwortlich ist. Um vor allem Datenzugriffe zu + beschleunigen, sind Caching-Mechanismen integriert worden, die Zwischenergebnisse + vorhalten. + + Die Implementierung ist vollständig auf Basis Freier Software realisiert worden + und bindet alleinig properietäre Elemente zum Zugriff auf ESRI ArcSDE ein. Der + Generische Viewer ist eine Fachapplikation des Open Water Analyst. Die Umsetzung + weitere Fachlösungen ist aufgrund des Designs und eingesetzten Protokolles möglich. + + <h2 class="headline infoheadline">Umsetzung</h2> + + Design und Implementation der Software durch die <a href="http://www.intevation.de" target="_new"> + Intevation GmbH</a>, Bereich Geospatial: Hans Plum (Projektleitung), Tim + Englich, Sascha L. Teichmann und Ingo Weinzierl. + + <h2 class="headline infoheadline">Lizenz</h2> + + Die Software wird voraussichtlich im Sommer 2010 als Freie Software veröffentlicht. +</div>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,48 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%> +<% +boolean standalone = request.getAttribute(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null; +%> + +<head> + <title> + <bean:message key="gnviewer.app.title"/> + </title> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <meta http-equiv="Content-Script-Type" content="text/javascript"/> + <meta http-equiv="Content-Style-Type" content="text/css"/> + <meta http-equiv="Expires" content="Mon, 01 Jan 1990 00:00:01 GMT"/> + <meta http-equiv="pragma" content="no-cache"/> + <meta http-equiv="cache-control" content="no-cache"/> + <meta name="robots" content="noindex"/> + + <link rel="stylesheet" type="text/css" href="scripts/ext/ext-2.3.0/resources/css/ext-all.css"></link> + <link rel="stylesheet" type="text/css" href="scripts/geoext/geoext-0.6/resources/css/geoext-all.css"></link> + <link rel="stylesheet" type="text/css" href="scripts/openlayers/OpenLayers-2.9/theme/default/style.css"></link> + <link rel="stylesheet" type="text/css" href="styles/gnv.css"/> + <link rel="stylesheet" type="text/css" href="styles/ol_style.css"/> + <link rel="stylesheet" type="text/css" href="styles/extjs-override.css"/> + + <script type="text/javascript" src="scripts/ext/ext-2.3.0/adapter/ext/ext-base.js"></script> + <script type="text/javascript" src="scripts/ext/ext-2.3.0/ext-all.js"></script> + <script type="text/javascript" src="scripts/openlayers/OpenLayers-2.9/OpenLayers.js"></script> + <script type="text/javascript" src="scripts/geoext/geoext-0.6/script/GeoExt.js"></script> + <script type="text/javascript" src="<%=response.encodeURL("scripts/olutils.jsp?uid="+System.currentTimeMillis())%>">"></script> + <script type="text/javascript" src="<%=response.encodeURL("scripts/layers.jsp?uid="+System.currentTimeMillis())%>"></script> + <script type="text/javascript" src="<%=response.encodeURL("scripts/viewport.jsp?uid="+System.currentTimeMillis()+"&"+MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY+"="+standalone)%>"></script> + + <!-- save necessary variables here --> + <script type="text/javascript"> + var options, layer, extent, map, mapPanel, infoControls, capfield; + var controls,layers, mouseLoc, grid; + var infoActive = false; + </script> + </head> \ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,73 +1,180 @@ +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@page import="java.util.Collection"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%> +<%@page import="de.intevation.gnv.action.CommunicationKeys"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="java.util.Iterator"%> <% + String exception = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID); SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); Object ui = request.getAttribute("ui"); Object staticui = request.getAttribute("staticui"); Object chart = request.getAttribute("chart"); Object statistic = request.getAttribute("statistic"); Object histogram = request.getAttribute("histogram"); - Object wms = request.getAttribute("wms"); + Object wms_published = request.getAttribute("wms_published"); boolean furthertargets = true; - if (chart == null && statistic == null && histogram == null && wms == null) { + if (chart == null && statistic == null && histogram == null && wms_published == null) { boolean supportChart = sm.getOutputMode("chart") != null; if (supportChart) { chart = "true"; } } - + Object furthertargetsObject = request.getAttribute("furthertargets"); if (furthertargetsObject != null){ furthertargets = ((Boolean)furthertargetsObject).booleanValue(); } + + Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID); + exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null); + exceptionMessage = (exceptionMessage != null && exceptionMessage.toString().endsWith(".") ? exceptionMessage.toString().substring(0,exceptionMessage.toString().length()-1) : exceptionMessage); + + Object sessionException = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID); + sessionException = (sessionException != null ? sessionException.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null); + sessionException = (sessionException != null && sessionException.toString().endsWith(".") ? sessionException.toString().substring(0,sessionException.toString().length()-1) : sessionException); + + boolean showmapviewercallBody = request.getAttribute("MAPVIEWERCALL") != null; + + String exceptionProject = (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_PROJECT); + exceptionProject = exceptionProject != null ? exceptionProject.toLowerCase() : null; + exceptionProject = exceptionProject != null ? exceptionProject.replaceAll(" ", ".") : null; %> - <div> - <%if (staticui == null){ %> - <jsp:include page="includes/display_fis_inc.jsp"></jsp:include> - <%} else {%> - <div class="down"> - <fieldset> - <legend><bean:message key="gnviewer.history.title"/></legend> - <%=staticui.toString()%> - </fieldset> - </div> - <%}%> - - <%-- render the dynamic part to feed the state and advance to the next state --%> - <%if (ui != null){%> - <div id="timeseriesfilter"> - <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>" method="post"> - <fieldset> - <%=ui != null ? ui.toString().replaceAll(" ", "") : "" %> - - <%if(furthertargets){%> - <input type="submit" value="<bean:message key="gnviewer.select.button"/>"/> - <%}%> - </fieldset> - </form> - </div> - <%}%> + + <%-- div container for project loading/saving and error messages related to this --%> + <div id="project"> + <table width="100%"> + <tr> + <td style="float: left; width: 225px;"> + <a href="<%=response.encodeURL("store.do")%>"><bean:message key="gnviewer.project.save"/></a> + | + <a href="#" onclick="toggle('projectload');"><bean:message key="gnviewer.project.load"/></a> + </td> + <td style="float: left; width: 400px;"> + <div id="projectload"> + <form id="loadProject" action="<%=response.encodeURL("load.do")%>" method="post" enctype="multipart/form-data"> + <div id="browseDiv"><input type="file" name="document" accept="application/xml"/></div> + <div id="loadDiv"><input type="image" src="<bean:message key="gnviewer.project.load.button.src"/>"/></div> + </form> + </div> + </td> + </tr> + </table> + <%if (exceptionProject != null) {%> + <div class="projectException"> + <bean:message key="<%=exceptionProject%>"/> + <br/> + <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>"> + <bean:message key="application.reload"/> + </a> + </div> + <%}%> + <%if (showmapviewercallBody){ %> + <jsp:include page="includes/display_mapviewercall_inc.jsp" /> + <%}%> </div> - <%-- render export options if existing for this state --%> - <jsp:include page="includes/display_export_inc.jsp"></jsp:include> - - <%if (chart != null) {%> - <%-- render chart options if existing for this state --%> - <jsp:include page="includes/display_diagramm_inc.jsp"></jsp:include> - <%}%> + <table style="width:100%;"> + <tr id="contentRow"> + <td id="parameterColumn"> + <%-- the parameter panel is following --%> + <div id="parameterPanel"> + <%if (staticui == null){ %> + <jsp:include page="includes/display_fis_inc.jsp"></jsp:include> + <%} else {%> + <div class="down"> + <fieldset> + <legend><bean:message key="gnviewer.history.title"/></legend> + <%=staticui.toString()%> + </fieldset> + </div> + <%}%> - <%-- render statistic --%> - <%if (statistic != null) {%> - <jsp:include page="includes/display_diagramm_statistics_inc.jsp"></jsp:include> - <%}%> + <%-- render the dynamic part to feed the state and advance to the next state --%> + <%if (ui != null){%> + <div id="timeseriesfilter"> + <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>" method="post"> + <fieldset> - <%-- render histogram --%> - <%if (histogram != null) {%> - <jsp:include page="includes/display_histogram_inc.jsp"></jsp:include> - <%}%> + <%-- error message, if user input was not valid --%> + <%if (exception != null) {%> + <div class="inputException"><%=exception%></div> + <%}%> + <%=ui != null ? ui.toString().replaceAll(" ", "") : "" %> + + <%if(furthertargets){%> + <br/> + <input style="margin-top: 5px;" type="image" src="<bean:message key="gnviewer.select.button.src"/>"/> + <%}%> + </fieldset> + </form> + </div> + <%}%> + + <%-- render export options if existing for this state --%> + <jsp:include page="includes/display_export_inc.jsp"></jsp:include> + + <%if (chart != null) {%> + <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include> + <%}%> + + + <%if (histogram != null) {%> + <jsp:include page="/WEB-INF/jsp/includes/display_histogram_options_inc.jsp"></jsp:include> + <%}%> + + <%-- render wms options --%> + <%if (wms_published != null) {%> + <jsp:include page="/WEB-INF/jsp/includes/display_wms_options_inc.jsp"></jsp:include> + <%}%> + </div> + </td> + <td id="contentColumn"> + <%if (exceptionMessage != null){ %> + <div class="errormsg" id="load_error"> + <bean-el:message key="<%=exceptionMessage.toString()%>"/> + <p class="reload"> + <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>"> + <bean:message key="application.reload"/> + </a> + </p> + </div> + <%}%> + <%if (sessionException != null){ %> + <div class="errormsg" id="load_error"> + <bean-el:message key="<%=sessionException.toString()%>"/> + </div> + <%}%> + <%if (chart != null) {%> + <%-- render chart options if existing for this state --%> + <jsp:include page="includes/display_diagramm_inc.jsp"></jsp:include> + <%}%> + + <%-- render statistic --%> + <%if (statistic != null) {%> + <jsp:include page="includes/display_diagramm_statistics_inc.jsp"></jsp:include> + <%}%> + + <%-- render histogram --%> + <%if (histogram != null) {%> + <jsp:include page="includes/display_histogram_inc.jsp"></jsp:include> + <%}%> + + <%-- render wms layer --%> + <%if (wms_published != null) {%> + <jsp:include page="includes/display_map_inc.jsp"></jsp:include> + <%}%> + </td> + </tr> + </table>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/info.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@ page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@ page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@ page import="java.util.Locale"%> + +<% + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Locale locale = sm.getCurrentLocale(); +%> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title> + <bean:message key="gnviewer.app.title"/> + </title> + <link href="styles/gnv.css" rel="stylesheet" type="text/css"/> + </head> + + <body id="gnviewerbody"> + <div id="page"> + <div id="headline"> + <h1 class="headline">BSH Generischer Viewer</h1> + </div> + + <br/> + + <div id="headerElement"> + <table class="headerTableLinks"> + <tr> + <td align="left"></td> + <td align="right"> + <html:link styleClass="headerLineLinks" page="/start.do"><bean:message key="gnviewer.header.restart"/></html:link> + <font size="1.5em" color="white">·</font> + <html:link styleClass="headerLineLinks" page="/info.do"><bean:message key="gnviewer.header.info"/></html:link> + </td> + </tr> + </table> + </div> + <div id="contentElement" class="contentElement"> + <% + if (locale.getLanguage().equals(Locale.GERMAN.getLanguage())) { + %> + <jsp:include page="/WEB-INF/jsp/includes/info_german.jsp" /> + <% + } + else { + %> + <jsp:include page="/WEB-INF/jsp/includes/info_english.jsp" /> + <% + } + %> + </div> + <div id="footerElement"> + <jsp:include page="footer.jsp" /> + </div> + </div> + </body> +</html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,5 +1,14 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head> @@ -13,7 +22,7 @@ <meta http-equiv="pragma" content="no-cache"/> <meta http-equiv="cache-control" content="no-cache"/> <meta name="robots" content="noindex"/> - <link href="styles/default.css" rel="stylesheet" type="text/css"/> + <link href="styles/gnv.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="scripts/gnviewer.js"></script> <script type="text/javascript"> function copy_demo_wkt_line() { @@ -50,22 +59,43 @@ ele.checked = false; } } + +function toggle(element) { + var ele = document.getElementById(element); + var vis = ele.style.visibility; + if (vis != "visible") { + ele.style.visibility = "visible"; + } + else { + ele.style.visibility = "hidden"; + } +} + </script> </head> <body id="gnviewerbody"> <div id="overlay"></div> - <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute"> + <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute;visibility:hidden;"> <div id="overlayContent"> - <p> - <bean:message key="gnviewer.productselection.overlay.title"/> + <bean:message key="gnviewer.productselection.overlay.title"/> + <p class="reload"> + <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>"> + <bean:message key="application.reload"/> + </a> </p> </div> </div> <div id="page"> - <jsp:include page="header.jsp" /> - <jsp:include page="index.jsp" /> - <jsp:include page="footer.jsp" /> + <div id="headerElement"> + <jsp:include page="header.jsp" /> + </div> + <div id="contentElement" class="contentElement"> + <jsp:include page="index.jsp" /> + </div> + <div id="footerElement"> + <jsp:include page="footer.jsp" /> + </div> </div> </body> </html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/version.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/version.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,7 +1,16 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> -<html xhtml="true" locale="true"> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> <bean:message key="gnviewer.app.title"/> @@ -42,4 +51,4 @@ <jsp:include page="footer.jsp" /> </div> </body> -</html> \ No newline at end of file +</html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -1,57 +1,22 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> -<% - String serverPath = (String) request.getAttribute("mapserver"); - String mapfilePath = (String) request.getAttribute("mapfile"); - String layerName = (String) request.getAttribute("layer"); -%> - <html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title> - <bean:message key="gnviewer.app.title"/> - </title> - <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> - <meta http-equiv="Content-Script-Type" content="text/javascript"/> - <meta http-equiv="Content-Style-Type" content="text/css"/> - <meta http-equiv="Expires" content="Mon, 01 Jan 1990 00:00:01 GMT"/> - <meta http-equiv="pragma" content="no-cache"/> - <meta http-equiv="cache-control" content="no-cache"/> - <meta name="robots" content="noindex"/> - <link href="styles/default.css" rel="stylesheet" type="text/css"/> - <script type="text/javascript" src="scripts/gnviewer.js"></script> - <script src="http://www.openlayers.org/api/OpenLayers.js"></script> - <script type="text/javascript"> - var lon = 5; - var lat = 55; - var zoom = 5; - var map, layer; - - function init() { - map = new OpenLayers.Map('map'); - var server = '<%=serverPath%>?MAP=<%=mapfilePath%>'; - layer = new OpenLayers.Layer.WMS( - "MyWMS", - server, - { - layers: '<%=layerName%>', - format: 'image/png' - }, - { - singleTile: 'true' - } - ); - - map.addLayer(layer); - map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); - } - </script> - </head> - - <body id="gnviewerbody" onLoad="init()"> + <jsp:include page="/WEB-INF/jsp/includes/wms_header_inc.jsp" /> + <body id="gnviewerbody"> <div id="overlay"></div> - <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute"> + <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute;visibility:hidden;"> <div id="overlayContent"> <p> <bean:message key="gnviewer.productselection.overlay.title"/> @@ -59,24 +24,15 @@ </div> </div> <div id="page"> - <jsp:include page="header.jsp" /> - <jsp:include page="index.jsp" /> - <jsp:include page="footer.jsp" /> - - <div class="outerMap"> - <div id="wms"> - <table> - <tr> - <td class="parameter"><bean:message key="gnviewer.wms.server.path"/>:</td> - <td class="wmsvalue"><%=serverPath%>?MAP=<%=mapfilePath%></td> - </tr> - <tr> - <td class="parameter"><bean:message key="gnviewer.wms.server.layer"/>:</td> - <td class="wmsvalue"><%=layerName%></td> - </tr> - </table> - </div> - <div id="map"></div> + <div id="headerElement"> + <jsp:include page="header.jsp" /> + </div> + <div id="contentElement" class="contentElement"> + <jsp:include page="index.jsp" /> + </div> + <br/> + <div id="footerElement"> + <jsp:include page="footer.jsp" /> </div> </div> </body>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,16 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<%-- + Copyright (c) 2010 by Intevation GmbH + + This program is free software under the LGPL (>=v2.1) + Read the file LGPL.txt coming with the software for details + or visit http://www.gnu.org/licenses/ if it does not exist. +--%> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <jsp:include page="/WEB-INF/jsp/includes/wms_header_inc.jsp" /> + <body id="gnviewerbody"> + <jsp:include page="/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp" /> + </body> +</html>
--- a/gnv/src/main/webapp/WEB-INF/web.xml Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/WEB-INF/web.xml Fri Sep 28 12:15:21 2012 +0200 @@ -15,13 +15,6 @@ <param-value>/WEB-INF/config/struts-config.xml</param-value> </init-param> - <!-- The Log4J Configuration, relative to the Project-Folder, - which should be used in this Project. --> - <init-param> - <param-name>de.intevation.gnv.servlet.log4j.configuration</param-name> - <param-value>WEB-INF/config/log4j.properties</param-value> - </init-param> - <!-- The Number of ArtifacDatabases which are configured in this Document. --> <init-param> <param-name>de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count</param-name>
--- a/gnv/src/main/webapp/scripts/calendar-de.js Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -// ** I18N - -// Calendar DE language -// Author: Jack (tR), <jack@jtr.de> -// Encoding: any -// Distributed under the same terms as the calendar itself. - -// For translators: please use UTF-8 if possible. We strongly believe that -// Unicode is the answer to a real internationalized world. Also please -// include your contact information in the header, as can be seen above. - -// full day names -Calendar._DN = new Array -("Sonntag", - "Montag", - "Dienstag", - "Mittwoch", - "Donnerstag", - "Freitag", - "Samstag", - "Sonntag"); - -// Please note that the following array of short day names (and the same goes -// for short month names, _SMN) isn't absolutely necessary. We give it here -// for exemplification on how one can customize the short day names, but if -// they are simply the first N letters of the full name you can simply say: -// -// Calendar._SDN_len = N; // short day name length -// Calendar._SMN_len = N; // short month name length -// -// If N = 3 then this is not needed either since we assume a value of 3 if not -// present, to be compatible with translation files that were written before -// this feature. - -// short day names -Calendar._SDN = new Array -("So", - "Mo", - "Di", - "Mi", - "Do", - "Fr", - "Sa", - "So"); - - // First day of the week. "0" means display Sunday first, "1" means display -// Monday first, etc. -Calendar._FD = 0; - - -// full month names -Calendar._MN = new Array -("Januar", - "Februar", - "M\u00e4rz", - "April", - "Mai", - "Juni", - "Juli", - "August", - "September", - "Oktober", - "November", - "Dezember"); - -// short month names -Calendar._SMN = new Array -("Jan", - "Feb", - "M\u00e4r", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Okt", - "Nov", - "Dez"); - -// tooltips -Calendar._TT = {}; -Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul"; - -Calendar._TT["ABOUT"] = -"DHTML Date/Time Selector\n" + -"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-) -"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + -"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + -"\n\n" + -"Datum ausw\u00e4hlen:\n" + -"- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" + -"- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" + -"- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest."; -Calendar._TT["ABOUT_TIME"] = "\n\n" + -"Zeit ausw\u00e4hlen:\n" + -"- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" + -"- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" + -"- oder klicken und festhalten f\u00fcr Schnellauswahl."; - -Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen"; -Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen"; -Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)"; -Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen"; -Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten"; -Calendar._TT["PART_TODAY"] = " (Heute)"; - -// the following is to inform that "%s" is to be the first day of week -// %s will be replaced with the day name. -Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s "; - -// This may be locale-dependent. It specifies the week-end days, as an array -// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 -// means Monday, etc. -Calendar._TT["WEEKEND"] = "0,6"; - -Calendar._TT["CLOSE"] = "Schlie\u00dfen"; -Calendar._TT["TODAY"] = "Heute"; -Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern"; - -// date formats -Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; -Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; - -Calendar._TT["WK"] = "wk"; -Calendar._TT["TIME"] = "Zeit:";
--- a/gnv/src/main/webapp/scripts/calendar-en.js Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -// ** I18N - -// Calendar EN language -// Author: Mihai Bazon, <mihai_bazon@yahoo.com> -// Encoding: any -// Distributed under the same terms as the calendar itself. - -// For translators: please use UTF-8 if possible. We strongly believe that -// Unicode is the answer to a real internationalized world. Also please -// include your contact information in the header, as can be seen above. - -// full day names -Calendar._DN = new Array -("Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday"); - -// Please note that the following array of short day names (and the same goes -// for short month names, _SMN) isn't absolutely necessary. We give it here -// for exemplification on how one can customize the short day names, but if -// they are simply the first N letters of the full name you can simply say: -// -// Calendar._SDN_len = N; // short day name length -// Calendar._SMN_len = N; // short month name length -// -// If N = 3 then this is not needed either since we assume a value of 3 if not -// present, to be compatible with translation files that were written before -// this feature. - -// short day names -Calendar._SDN = new Array -("Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", - "Sun"); - -// First day of the week. "0" means display Sunday first, "1" means display -// Monday first, etc. -Calendar._FD = 0; - -// full month names -Calendar._MN = new Array -("January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"); - -// short month names -Calendar._SMN = new Array -("Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec"); - -// tooltips -Calendar._TT = {}; -Calendar._TT["INFO"] = "About the calendar"; - -Calendar._TT["ABOUT"] = -"DHTML Date/Time Selector\n" + -"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) -"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + -"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + -"\n\n" + -"Date selection:\n" + -"- Use the \xab, \xbb buttons to select year\n" + -"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + -"- Hold mouse button on any of the above buttons for faster selection."; -Calendar._TT["ABOUT_TIME"] = "\n\n" + -"Time selection:\n" + -"- Click on any of the time parts to increase it\n" + -"- or Shift-click to decrease it\n" + -"- or click and drag for faster selection."; - -Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; -Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; -Calendar._TT["GO_TODAY"] = "Go Today"; -Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; -Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; -Calendar._TT["SEL_DATE"] = "Select date"; -Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; -Calendar._TT["PART_TODAY"] = " (today)"; - -// the following is to inform that "%s" is to be the first day of week -// %s will be replaced with the day name. -Calendar._TT["DAY_FIRST"] = "Display %s first"; - -// This may be locale-dependent. It specifies the week-end days, as an array -// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 -// means Monday, etc. -Calendar._TT["WEEKEND"] = "0,6"; - -Calendar._TT["CLOSE"] = "Close"; -Calendar._TT["TODAY"] = "Today"; -Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; - -// date formats -Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; -Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; - -Calendar._TT["WK"] = "wk"; -Calendar._TT["TIME"] = "Time:";
--- a/gnv/src/main/webapp/scripts/calendar-setup.js Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ - * --------------------------------------------------------------------------- - * - * The DHTML Calendar - * - * Details and latest version at: - * http://dynarch.com/mishoo/calendar.epl - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - * - * This file defines helper functions for setting up the calendar. They are - * intended to help non-programmers get a working calendar on their site - * quickly. This script should not be seen as part of the calendar. It just - * shows you what one can do with the calendar, while in the same time - * providing a quick and simple method for setting it up. If you need - * exhaustive customization of the calendar creation process feel free to - * modify this code to suit your needs (this is recommended and much better - * than modifying calendar.js itself). - */ - -// $Id: calendar-setup.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $ - -/** - * This function "patches" an input field (or other element) to use a calendar - * widget for date selection. - * - * The "params" is a single object that can have the following properties: - * - * prop. name | description - * ------------------------------------------------------------------------------------------------- - * inputField | the ID of an input field to store the date - * displayArea | the ID of a DIV or other element to show the date - * button | ID of a button or other element that will trigger the calendar - * eventName | event that will trigger the calendar, without the "on" prefix (default: "click") - * ifFormat | date format that will be stored in the input field - * daFormat | the date format that will be used to display the date in displayArea - * singleClick | (true/false) wether the calendar is in single click mode or not (default: true) - * firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc. - * align | alignment (default: "Br"); if you don't know what's this see the calendar documentation - * range | array with 2 elements. Default: [1900, 2999] -- the range of years available - * weekNumbers | (true/false) if it's true (default) the calendar will display week numbers - * flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID - * flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar) - * disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar - * onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay) - * onClose | function that gets called when the calendar is closed. [default] - * onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar. - * date | the date that the calendar will be initially displayed to - * showsTime | default: false; if true the calendar will include a time selector - * timeFormat | the time format; can be "12" or "24", default is "12" - * electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close - * step | configures the step of the years in drop-down boxes; default: 2 - * position | configures the calendar absolute position; default: null - * cache | if "true" (but default: "false") it will reuse the same calendar object, where possible - * showOthers | if "true" (but default: "false") it will show days from other months too - * - * None of them is required, they all have default values. However, if you - * pass none of "inputField", "displayArea" or "button" you'll get a warning - * saying "nothing to setup". - */ -Calendar.setup = function (params) { - function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } }; - - param_default("inputField", null); - param_default("displayArea", null); - param_default("button", null); - param_default("eventName", "click"); - param_default("ifFormat", "%Y/%m/%d"); - param_default("daFormat", "%Y/%m/%d"); - param_default("singleClick", true); - param_default("disableFunc", null); - param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined - param_default("dateText", null); - param_default("firstDay", null); - param_default("align", "Br"); - param_default("range", [1900, 2999]); - param_default("weekNumbers", true); - param_default("flat", null); - param_default("flatCallback", null); - param_default("onSelect", null); - param_default("onClose", null); - param_default("onUpdate", null); - param_default("date", null); - param_default("showsTime", false); - param_default("timeFormat", "24"); - param_default("electric", true); - param_default("step", 2); - param_default("position", null); - param_default("cache", false); - param_default("showOthers", false); - param_default("multiple", null); - - var tmp = ["inputField", "displayArea", "button"]; - for (var i in tmp) { - if (typeof params[tmp[i]] == "string") { - params[tmp[i]] = document.getElementById(params[tmp[i]]); - } - } - if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { - alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code"); - return false; - } - - function onSelect(cal) { - var p = cal.params; - var update = (cal.dateClicked || p.electric); - if (update && p.inputField) { - p.inputField.value = cal.date.print(p.ifFormat); - if (typeof p.inputField.onchange == "function") - p.inputField.onchange(); - } - if (update && p.displayArea) - p.displayArea.innerHTML = cal.date.print(p.daFormat); - if (update && typeof p.onUpdate == "function") - p.onUpdate(cal); - if (update && p.flat) { - if (typeof p.flatCallback == "function") - p.flatCallback(cal); - } - if (update && p.singleClick && cal.dateClicked) - cal.callCloseHandler(); - }; - - if (params.flat != null) { - if (typeof params.flat == "string") - params.flat = document.getElementById(params.flat); - if (!params.flat) { - alert("Calendar.setup:\n Flat specified but can't find parent."); - return false; - } - var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); - cal.showsOtherMonths = params.showOthers; - cal.showsTime = params.showsTime; - cal.time24 = (params.timeFormat == "24"); - cal.params = params; - cal.weekNumbers = params.weekNumbers; - cal.setRange(params.range[0], params.range[1]); - cal.setDateStatusHandler(params.dateStatusFunc); - cal.getDateText = params.dateText; - if (params.ifFormat) { - cal.setDateFormat(params.ifFormat); - } - if (params.inputField && typeof params.inputField.value == "string") { - cal.parseDate(params.inputField.value); - } - cal.create(params.flat); - cal.show(); - return false; - } - - var triggerEl = params.button || params.displayArea || params.inputField; - triggerEl["on" + params.eventName] = function() { - var dateEl = params.inputField || params.displayArea; - var dateFmt = params.inputField ? params.ifFormat : params.daFormat; - var mustCreate = false; - var cal = window.calendar; - if (dateEl) - params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); - if (!(cal && params.cache)) { - window.calendar = cal = new Calendar(params.firstDay, - params.date, - params.onSelect || onSelect, - params.onClose || function(cal) { cal.hide(); }); - cal.showsTime = params.showsTime; - cal.time24 = (params.timeFormat == "24"); - cal.weekNumbers = params.weekNumbers; - mustCreate = true; - } else { - if (params.date) - cal.setDate(params.date); - cal.hide(); - } - if (params.multiple) { - cal.multiple = {}; - for (var i = params.multiple.length; --i >= 0;) { - var d = params.multiple[i]; - var ds = d.print("%Y%m%d"); - cal.multiple[ds] = d; - } - } - cal.showsOtherMonths = params.showOthers; - cal.yearStep = params.step; - cal.setRange(params.range[0], params.range[1]); - cal.params = params; - cal.setDateStatusHandler(params.dateStatusFunc); - cal.getDateText = params.dateText; - cal.setDateFormat(dateFmt); - if (mustCreate) - cal.create(); - cal.refresh(); - if (!params.position) - cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); - else - cal.showAt(params.position[0], params.position[1]); - return false; - }; - - return cal; -};
--- a/gnv/src/main/webapp/scripts/calendar-setup_stripped.js Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ - * --------------------------------------------------------------------------- - * - * The DHTML Calendar - * - * Details and latest version at: - * http://dynarch.com/mishoo/calendar.epl - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - * - * This file defines helper functions for setting up the calendar. They are - * intended to help non-programmers get a working calendar on their site - * quickly. This script should not be seen as part of the calendar. It just - * shows you what one can do with the calendar, while in the same time - * providing a quick and simple method for setting it up. If you need - * exhaustive customization of the calendar creation process feel free to - * modify this code to suit your needs (this is recommended and much better - * than modifying calendar.js itself). - */ - Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&¶ms.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;}; \ No newline at end of file
--- a/gnv/src/main/webapp/scripts/calendar.js Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1806 +0,0 @@ -/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo - * ----------------------------------------------------------- - * - * The DHTML Calendar, version 1.0 "It is happening again" - * - * Details and latest version at: - * www.dynarch.com/projects/calendar - * - * This script is developed by Dynarch.com. Visit us at www.dynarch.com. - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - */ - -// $Id: calendar.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $ - -/** The Calendar object constructor. */ -Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { - // member variables - this.activeDiv = null; - this.currentDateEl = null; - this.getDateStatus = null; - this.getDateToolTip = null; - this.getDateText = null; - this.timeout = null; - this.onSelected = onSelected || null; - this.onClose = onClose || null; - this.dragging = false; - this.hidden = false; - this.minYear = 1970; - this.maxYear = 2050; - this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; - this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; - this.isPopup = true; - this.weekNumbers = true; - this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. - this.showsOtherMonths = false; - this.dateStr = dateStr; - this.ar_days = null; - this.showsTime = false; - this.time24 = true; - this.yearStep = 2; - this.hiliteToday = true; - this.multiple = null; - // HTML elements - this.table = null; - this.element = null; - this.tbody = null; - this.firstdayname = null; - // Combo boxes - this.monthsCombo = null; - this.yearsCombo = null; - this.hilitedMonth = null; - this.activeMonth = null; - this.hilitedYear = null; - this.activeYear = null; - // Information - this.dateClicked = false; - - // one-time initializations - if (typeof Calendar._SDN == "undefined") { - // table of short day names - if (typeof Calendar._SDN_len == "undefined") - Calendar._SDN_len = 3; - var ar = new Array(); - for (var i = 8; i > 0;) { - ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); - } - Calendar._SDN = ar; - // table of short month names - if (typeof Calendar._SMN_len == "undefined") - Calendar._SMN_len = 3; - ar = new Array(); - for (var i = 12; i > 0;) { - ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); - } - Calendar._SMN = ar; - } -}; - -// ** constants - -/// "static", needed for event handlers. -Calendar._C = null; - -/// detect a special case of "web browser" -Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && - !/opera/i.test(navigator.userAgent) ); - -Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); - -/// detect Opera browser -Calendar.is_opera = /opera/i.test(navigator.userAgent); - -/// detect KHTML-based browsers -Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); - -// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate -// library, at some point. - -Calendar.getAbsolutePos = function(el) { - var SL = 0, ST = 0; - var is_div = /^div$/i.test(el.tagName); - if (is_div && el.scrollLeft) - SL = el.scrollLeft; - if (is_div && el.scrollTop) - ST = el.scrollTop; - var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; - if (el.offsetParent) { - var tmp = this.getAbsolutePos(el.offsetParent); - r.x += tmp.x; - r.y += tmp.y; - } - return r; -}; - -Calendar.isRelated = function (el, evt) { - var related = evt.relatedTarget; - if (!related) { - var type = evt.type; - if (type == "mouseover") { - related = evt.fromElement; - } else if (type == "mouseout") { - related = evt.toElement; - } - } - while (related) { - if (related == el) { - return true; - } - related = related.parentNode; - } - return false; -}; - -Calendar.removeClass = function(el, className) { - if (!(el && el.className)) { - return; - } - var cls = el.className.split(" "); - var ar = new Array(); - for (var i = cls.length; i > 0;) { - if (cls[--i] != className) { - ar[ar.length] = cls[i]; - } - } - el.className = ar.join(" "); -}; - -Calendar.addClass = function(el, className) { - Calendar.removeClass(el, className); - el.className += " " + className; -}; - -// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. -Calendar.getElement = function(ev) { - var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; - while (f.nodeType != 1 || /^div$/i.test(f.tagName)) - f = f.parentNode; - return f; -}; - -Calendar.getTargetElement = function(ev) { - var f = Calendar.is_ie ? window.event.srcElement : ev.target; - while (f.nodeType != 1) - f = f.parentNode; - return f; -}; - -Calendar.stopEvent = function(ev) { - ev || (ev = window.event); - if (Calendar.is_ie) { - ev.cancelBubble = true; - ev.returnValue = false; - } else { - ev.preventDefault(); - ev.stopPropagation(); - } - return false; -}; - -Calendar.addEvent = function(el, evname, func) { - if (el.attachEvent) { // IE - el.attachEvent("on" + evname, func); - } else if (el.addEventListener) { // Gecko / W3C - el.addEventListener(evname, func, true); - } else { - el["on" + evname] = func; - } -}; - -Calendar.removeEvent = function(el, evname, func) { - if (el.detachEvent) { // IE - el.detachEvent("on" + evname, func); - } else if (el.removeEventListener) { // Gecko / W3C - el.removeEventListener(evname, func, true); - } else { - el["on" + evname] = null; - } -}; - -Calendar.createElement = function(type, parent) { - var el = null; - if (document.createElementNS) { - // use the XHTML namespace; IE won't normally get here unless - // _they_ "fix" the DOM2 implementation. - el = document.createElementNS("http://www.w3.org/1999/xhtml", type); - } else { - el = document.createElement(type); - } - if (typeof parent != "undefined") { - parent.appendChild(el); - } - return el; -}; - -// END: UTILITY FUNCTIONS - -// BEGIN: CALENDAR STATIC FUNCTIONS - -/** Internal -- adds a set of events to make some element behave like a button. */ -Calendar._add_evs = function(el) { - with (Calendar) { - addEvent(el, "mouseover", dayMouseOver); - addEvent(el, "mousedown", dayMouseDown); - addEvent(el, "mouseout", dayMouseOut); - if (is_ie) { - addEvent(el, "dblclick", dayMouseDblClick); - el.setAttribute("unselectable", true); - } - } -}; - -Calendar.findMonth = function(el) { - if (typeof el.month != "undefined") { - return el; - } else if (typeof el.parentNode.month != "undefined") { - return el.parentNode; - } - return null; -}; - -Calendar.findYear = function(el) { - if (typeof el.year != "undefined") { - return el; - } else if (typeof el.parentNode.year != "undefined") { - return el.parentNode; - } - return null; -}; - -Calendar.showMonthsCombo = function () { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var mc = cal.monthsCombo; - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - if (cal.activeMonth) { - Calendar.removeClass(cal.activeMonth, "active"); - } - var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; - Calendar.addClass(mon, "active"); - cal.activeMonth = mon; - var s = mc.style; - s.display = "block"; - if (cd.navtype < 0) - s.left = cd.offsetLeft + "px"; - else { - var mcw = mc.offsetWidth; - if (typeof mcw == "undefined") - // Konqueror brain-dead techniques - mcw = 50; - s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; - } - s.top = (cd.offsetTop + cd.offsetHeight) + "px"; -}; - -Calendar.showYearsCombo = function (fwd) { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var yc = cal.yearsCombo; - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - if (cal.activeYear) { - Calendar.removeClass(cal.activeYear, "active"); - } - cal.activeYear = null; - var Y = cal.date.getFullYear() + (fwd ? 1 : -1); - var yr = yc.firstChild; - var show = false; - for (var i = 12; i > 0; --i) { - if (Y >= cal.minYear && Y <= cal.maxYear) { - yr.innerHTML = Y; - yr.year = Y; - yr.style.display = "block"; - show = true; - } else { - yr.style.display = "none"; - } - yr = yr.nextSibling; - Y += fwd ? cal.yearStep : -cal.yearStep; - } - if (show) { - var s = yc.style; - s.display = "block"; - if (cd.navtype < 0) - s.left = cd.offsetLeft + "px"; - else { - var ycw = yc.offsetWidth; - if (typeof ycw == "undefined") - // Konqueror brain-dead techniques - ycw = 50; - s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; - } - s.top = (cd.offsetTop + cd.offsetHeight) + "px"; - } -}; - -// event handlers - -Calendar.tableMouseUp = function(ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - if (cal.timeout) { - clearTimeout(cal.timeout); - } - var el = cal.activeDiv; - if (!el) { - return false; - } - var target = Calendar.getTargetElement(ev); - ev || (ev = window.event); - Calendar.removeClass(el, "active"); - if (target == el || target.parentNode == el) { - Calendar.cellClick(el, ev); - } - var mon = Calendar.findMonth(target); - var date = null; - if (mon) { - date = new Date(cal.date); - if (mon.month != date.getMonth()) { - date.setMonth(mon.month); - cal.setDate(date); - cal.dateClicked = false; - cal.callHandler(); - } - } else { - var year = Calendar.findYear(target); - if (year) { - date = new Date(cal.date); - if (year.year != date.getFullYear()) { - date.setFullYear(year.year); - cal.setDate(date); - cal.dateClicked = false; - cal.callHandler(); - } - } - } - with (Calendar) { - removeEvent(document, "mouseup", tableMouseUp); - removeEvent(document, "mouseover", tableMouseOver); - removeEvent(document, "mousemove", tableMouseOver); - cal._hideCombos(); - _C = null; - return stopEvent(ev); - } -}; - -Calendar.tableMouseOver = function (ev) { - var cal = Calendar._C; - if (!cal) { - return; - } - var el = cal.activeDiv; - var target = Calendar.getTargetElement(ev); - if (target == el || target.parentNode == el) { - Calendar.addClass(el, "hilite active"); - Calendar.addClass(el.parentNode, "rowhilite"); - } else { - if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) - Calendar.removeClass(el, "active"); - Calendar.removeClass(el, "hilite"); - Calendar.removeClass(el.parentNode, "rowhilite"); - } - ev || (ev = window.event); - if (el.navtype == 50 && target != el) { - var pos = Calendar.getAbsolutePos(el); - var w = el.offsetWidth; - var x = ev.clientX; - var dx; - var decrease = true; - if (x > pos.x + w) { - dx = x - pos.x - w; - decrease = false; - } else - dx = pos.x - x; - - if (dx < 0) dx = 0; - var range = el._range; - var current = el._current; - var count = Math.floor(dx / 10) % range.length; - for (var i = range.length; --i >= 0;) - if (range[i] == current) - break; - while (count-- > 0) - if (decrease) { - if (--i < 0) - i = range.length - 1; - } else if ( ++i >= range.length ) - i = 0; - var newval = range[i]; - el.innerHTML = newval; - - cal.onUpdateTime(); - } - var mon = Calendar.findMonth(target); - if (mon) { - if (mon.month != cal.date.getMonth()) { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - Calendar.addClass(mon, "hilite"); - cal.hilitedMonth = mon; - } else if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - } else { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - var year = Calendar.findYear(target); - if (year) { - if (year.year != cal.date.getFullYear()) { - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - Calendar.addClass(year, "hilite"); - cal.hilitedYear = year; - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } - return Calendar.stopEvent(ev); -}; - -Calendar.tableMouseDown = function (ev) { - if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { - return Calendar.stopEvent(ev); - } -}; - -Calendar.calDragIt = function (ev) { - var cal = Calendar._C; - if (!(cal && cal.dragging)) { - return false; - } - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posX = ev.pageX; - posY = ev.pageY; - } - cal.hideShowCovered(); - var st = cal.element.style; - st.left = (posX - cal.xOffs) + "px"; - st.top = (posY - cal.yOffs) + "px"; - return Calendar.stopEvent(ev); -}; - -Calendar.calDragEnd = function (ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - cal.dragging = false; - with (Calendar) { - removeEvent(document, "mousemove", calDragIt); - removeEvent(document, "mouseup", calDragEnd); - tableMouseUp(ev); - } - cal.hideShowCovered(); -}; - -Calendar.dayMouseDown = function(ev) { - var el = Calendar.getElement(ev); - if (el.disabled) { - return false; - } - var cal = el.calendar; - cal.activeDiv = el; - Calendar._C = cal; - if (el.navtype != 300) with (Calendar) { - if (el.navtype == 50) { - el._current = el.innerHTML; - addEvent(document, "mousemove", tableMouseOver); - } else - addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); - addClass(el, "hilite active"); - addEvent(document, "mouseup", tableMouseUp); - } else if (cal.isPopup) { - cal._dragStart(ev); - } - if (el.navtype == -1 || el.navtype == 1) { - if (cal.timeout) clearTimeout(cal.timeout); - cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); - } else if (el.navtype == -2 || el.navtype == 2) { - if (cal.timeout) clearTimeout(cal.timeout); - cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); - } else { - cal.timeout = null; - } - return Calendar.stopEvent(ev); -}; - -Calendar.dayMouseDblClick = function(ev) { - Calendar.cellClick(Calendar.getElement(ev), ev || window.event); - if (Calendar.is_ie) { - document.selection.empty(); - } -}; - -Calendar.dayMouseOver = function(ev) { - var el = Calendar.getElement(ev); - if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { - return false; - } - if (el.ttip) { - if (el.ttip.substr(0, 1) == "_") { - el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); - } - el.calendar.tooltips.innerHTML = el.ttip; - } - if (el.navtype != 300) { - Calendar.addClass(el, "hilite"); - if (el.caldate) { - Calendar.addClass(el.parentNode, "rowhilite"); - } - } - return Calendar.stopEvent(ev); -}; - -Calendar.dayMouseOut = function(ev) { - with (Calendar) { - var el = getElement(ev); - if (isRelated(el, ev) || _C || el.disabled) - return false; - removeClass(el, "hilite"); - if (el.caldate) - removeClass(el.parentNode, "rowhilite"); - if (el.calendar) - el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; - return stopEvent(ev); - } -}; - -/** - * A generic "click" handler :) handles all types of buttons defined in this - * calendar. - */ -Calendar.cellClick = function(el, ev) { - var cal = el.calendar; - var closing = false; - var newdate = false; - var date = null; - if (typeof el.navtype == "undefined") { - if (cal.currentDateEl) { - Calendar.removeClass(cal.currentDateEl, "selected"); - Calendar.addClass(el, "selected"); - closing = (cal.currentDateEl == el); - if (!closing) { - cal.currentDateEl = el; - } - } - cal.date.setDateOnly(el.caldate); - date = cal.date; - var other_month = !(cal.dateClicked = !el.otherMonth); - if (!other_month && !cal.currentDateEl) - cal._toggleMultipleDate(new Date(date)); - else - newdate = !el.disabled; - // a date was clicked - if (other_month) - cal._init(cal.firstDayOfWeek, date); - } else { - if (el.navtype == 200) { - Calendar.removeClass(el, "hilite"); - cal.callCloseHandler(); - return; - } - date = new Date(cal.date); - if (el.navtype == 0) - date.setDateOnly(new Date()); // TODAY - // unless "today" was clicked, we assume no date was clicked so - // the selected handler will know not to close the calenar when - // in single-click mode. - // cal.dateClicked = (el.navtype == 0); - cal.dateClicked = false; - var year = date.getFullYear(); - var mon = date.getMonth(); - function setMonth(m) { - var day = date.getDate(); - var max = date.getMonthDays(m); - if (day > max) { - date.setDate(max); - } - date.setMonth(m); - }; - switch (el.navtype) { - case 400: - Calendar.removeClass(el, "hilite"); - var text = Calendar._TT["ABOUT"]; - if (typeof text != "undefined") { - text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; - } else { - // FIXME: this should be removed as soon as lang files get updated! - text = "Help and about box text is not translated into this language.\n" + - "If you know this language and you feel generous please update\n" + - "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + - "and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n" + - "Thank you!\n" + - "http://dynarch.com/mishoo/calendar.epl\n"; - } - alert(text); - return; - case -2: - if (year > cal.minYear) { - date.setFullYear(year - 1); - } - break; - case -1: - if (mon > 0) { - setMonth(mon - 1); - } else if (year-- > cal.minYear) { - date.setFullYear(year); - setMonth(11); - } - break; - case 1: - if (mon < 11) { - setMonth(mon + 1); - } else if (year < cal.maxYear) { - date.setFullYear(year + 1); - setMonth(0); - } - break; - case 2: - if (year < cal.maxYear) { - date.setFullYear(year + 1); - } - break; - case 100: - cal.setFirstDayOfWeek(el.fdow); - return; - case 50: - var range = el._range; - var current = el.innerHTML; - for (var i = range.length; --i >= 0;) - if (range[i] == current) - break; - if (ev && ev.shiftKey) { - if (--i < 0) - i = range.length - 1; - } else if ( ++i >= range.length ) - i = 0; - var newval = range[i]; - el.innerHTML = newval; - cal.onUpdateTime(); - return; - case 0: - // TODAY will bring us here - if ((typeof cal.getDateStatus == "function") && - cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { - return false; - } - break; - } - if (!date.equalsTo(cal.date)) { - cal.setDate(date); - newdate = true; - } else if (el.navtype == 0) - newdate = closing = true; - } - if (newdate) { - ev && cal.callHandler(); - } - if (closing) { - Calendar.removeClass(el, "hilite"); - ev && cal.callCloseHandler(); - } -}; - -// END: CALENDAR STATIC FUNCTIONS - -// BEGIN: CALENDAR OBJECT FUNCTIONS - -/** - * This function creates the calendar inside the given parent. If _par is - * null than it creates a popup calendar inside the BODY element. If _par is - * an element, be it BODY, then it creates a non-popup calendar (still - * hidden). Some properties need to be set before calling this function. - */ -Calendar.prototype.create = function (_par) { - var parent = null; - if (! _par) { - // default parent is the document body, in which case we create - // a popup calendar. - parent = document.getElementsByTagName("body")[0]; - this.isPopup = true; - } else { - parent = _par; - this.isPopup = false; - } - this.date = this.dateStr ? new Date(this.dateStr) : new Date(); - - var table = Calendar.createElement("table"); - this.table = table; - table.cellSpacing = 0; - table.cellPadding = 0; - table.calendar = this; - Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); - - var div = Calendar.createElement("div"); - this.element = div; - div.className = "calendar"; - if (this.isPopup) { - div.style.position = "absolute"; - div.style.display = "none"; - } - div.appendChild(table); - - var thead = Calendar.createElement("thead", table); - var cell = null; - var row = null; - - var cal = this; - var hh = function (text, cs, navtype) { - cell = Calendar.createElement("td", row); - cell.colSpan = cs; - cell.className = "button"; - if (navtype != 0 && Math.abs(navtype) <= 2) - cell.className += " nav"; - Calendar._add_evs(cell); - cell.calendar = cal; - cell.navtype = navtype; - cell.innerHTML = "<div unselectable='on'>" + text + "</div>"; - return cell; - }; - - row = Calendar.createElement("tr", thead); - var title_length = 6; - (this.isPopup) && --title_length; - (this.weekNumbers) && ++title_length; - - hh("?", 1, 400).ttip = Calendar._TT["INFO"]; - this.title = hh("", title_length, 300); - this.title.className = "title"; - if (this.isPopup) { - this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; - this.title.style.cursor = "move"; - hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; - } - - row = Calendar.createElement("tr", thead); - row.className = "headrow"; - - this._nav_py = hh("«", 1, -2); - this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; - - this._nav_pm = hh("‹", 1, -1); - this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; - - this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); - this._nav_now.ttip = Calendar._TT["GO_TODAY"]; - - this._nav_nm = hh("›", 1, 1); - this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; - - this._nav_ny = hh("»", 1, 2); - this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; - - // day names - row = Calendar.createElement("tr", thead); - row.className = "daynames"; - if (this.weekNumbers) { - cell = Calendar.createElement("td", row); - cell.className = "name wn"; - cell.innerHTML = Calendar._TT["WK"]; - } - for (var i = 7; i > 0; --i) { - cell = Calendar.createElement("td", row); - if (!i) { - cell.navtype = 100; - cell.calendar = this; - Calendar._add_evs(cell); - } - } - this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; - this._displayWeekdays(); - - var tbody = Calendar.createElement("tbody", table); - this.tbody = tbody; - - for (i = 6; i > 0; --i) { - row = Calendar.createElement("tr", tbody); - if (this.weekNumbers) { - cell = Calendar.createElement("td", row); - } - for (var j = 7; j > 0; --j) { - cell = Calendar.createElement("td", row); - cell.calendar = this; - Calendar._add_evs(cell); - } - } - - if (this.showsTime) { - row = Calendar.createElement("tr", tbody); - row.className = "time"; - - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = 2; - cell.innerHTML = Calendar._TT["TIME"] || " "; - - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = this.weekNumbers ? 4 : 3; - - (function(){ - function makeTimePart(className, init, range_start, range_end) { - var part = Calendar.createElement("span", cell); - part.className = className; - part.innerHTML = init; - part.calendar = cal; - part.ttip = Calendar._TT["TIME_PART"]; - part.navtype = 50; - part._range = []; - if (typeof range_start != "number") - part._range = range_start; - else { - for (var i = range_start; i <= range_end; ++i) { - var txt; - if (i < 10 && range_end >= 10) txt = '0' + i; - else txt = '' + i; - part._range[part._range.length] = txt; - } - } - Calendar._add_evs(part); - return part; - }; - var hrs = cal.date.getHours(); - var mins = cal.date.getMinutes(); - var t12 = !cal.time24; - var pm = (hrs > 12); - if (t12 && pm) hrs -= 12; - var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); - var span = Calendar.createElement("span", cell); - span.innerHTML = ":"; - span.className = "colon"; - var M = makeTimePart("minute", mins, 0, 59); - var AP = null; - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = 2; - if (t12) - AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); - else - cell.innerHTML = " "; - - cal.onSetTime = function() { - var pm, hrs = this.date.getHours(), - mins = this.date.getMinutes(); - if (t12) { - pm = (hrs >= 12); - if (pm) hrs -= 12; - if (hrs == 0) hrs = 12; - AP.innerHTML = pm ? "pm" : "am"; - } - H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; - M.innerHTML = (mins < 10) ? ("0" + mins) : mins; - }; - - cal.onUpdateTime = function() { - var date = this.date; - var h = parseInt(H.innerHTML, 10); - if (t12) { - if (/pm/i.test(AP.innerHTML) && h < 12) - h += 12; - else if (/am/i.test(AP.innerHTML) && h == 12) - h = 0; - } - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); - date.setHours(h); - date.setMinutes(parseInt(M.innerHTML, 10)); - date.setFullYear(y); - date.setMonth(m); - date.setDate(d); - this.dateClicked = false; - this.callHandler(); - }; - })(); - } else { - this.onSetTime = this.onUpdateTime = function() {}; - } - - var tfoot = Calendar.createElement("tfoot", table); - - row = Calendar.createElement("tr", tfoot); - row.className = "footrow"; - - cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); - cell.className = "ttip"; - if (this.isPopup) { - cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; - cell.style.cursor = "move"; - } - this.tooltips = cell; - - div = Calendar.createElement("div", this.element); - this.monthsCombo = div; - div.className = "combo"; - for (i = 0; i < Calendar._MN.length; ++i) { - var mn = Calendar.createElement("div"); - mn.className = Calendar.is_ie ? "label-IEfix" : "label"; - mn.month = i; - mn.innerHTML = Calendar._SMN[i]; - div.appendChild(mn); - } - - div = Calendar.createElement("div", this.element); - this.yearsCombo = div; - div.className = "combo"; - for (i = 12; i > 0; --i) { - var yr = Calendar.createElement("div"); - yr.className = Calendar.is_ie ? "label-IEfix" : "label"; - div.appendChild(yr); - } - - this._init(this.firstDayOfWeek, this.date); - parent.appendChild(this.element); -}; - -/** keyboard navigation, only for popup calendars */ -Calendar._keyEvent = function(ev) { - var cal = window._dynarch_popupCalendar; - if (!cal || cal.multiple) - return false; - (Calendar.is_ie) && (ev = window.event); - var act = (Calendar.is_ie || ev.type == "keypress"), - K = ev.keyCode; - if (ev.ctrlKey) { - switch (K) { - case 37: // KEY left - act && Calendar.cellClick(cal._nav_pm); - break; - case 38: // KEY up - act && Calendar.cellClick(cal._nav_py); - break; - case 39: // KEY right - act && Calendar.cellClick(cal._nav_nm); - break; - case 40: // KEY down - act && Calendar.cellClick(cal._nav_ny); - break; - default: - return false; - } - } else switch (K) { - case 32: // KEY space (now) - Calendar.cellClick(cal._nav_now); - break; - case 27: // KEY esc - act && cal.callCloseHandler(); - break; - case 37: // KEY left - case 38: // KEY up - case 39: // KEY right - case 40: // KEY down - if (act) { - var prev, x, y, ne, el, step; - prev = K == 37 || K == 38; - step = (K == 37 || K == 39) ? 1 : 7; - function setVars() { - el = cal.currentDateEl; - var p = el.pos; - x = p & 15; - y = p >> 4; - ne = cal.ar_days[y][x]; - };setVars(); - function prevMonth() { - var date = new Date(cal.date); - date.setDate(date.getDate() - step); - cal.setDate(date); - }; - function nextMonth() { - var date = new Date(cal.date); - date.setDate(date.getDate() + step); - cal.setDate(date); - }; - while (1) { - switch (K) { - case 37: // KEY left - if (--x >= 0) - ne = cal.ar_days[y][x]; - else { - x = 6; - K = 38; - continue; - } - break; - case 38: // KEY up - if (--y >= 0) - ne = cal.ar_days[y][x]; - else { - prevMonth(); - setVars(); - } - break; - case 39: // KEY right - if (++x < 7) - ne = cal.ar_days[y][x]; - else { - x = 0; - K = 40; - continue; - } - break; - case 40: // KEY down - if (++y < cal.ar_days.length) - ne = cal.ar_days[y][x]; - else { - nextMonth(); - setVars(); - } - break; - } - break; - } - if (ne) { - if (!ne.disabled) - Calendar.cellClick(ne); - else if (prev) - prevMonth(); - else - nextMonth(); - } - } - break; - case 13: // KEY enter - if (act) - Calendar.cellClick(cal.currentDateEl, ev); - break; - default: - return false; - } - return Calendar.stopEvent(ev); -}; - -/** - * (RE)Initializes the calendar to the given date and firstDayOfWeek - */ -Calendar.prototype._init = function (firstDayOfWeek, date) { - var today = new Date(), - TY = today.getFullYear(), - TM = today.getMonth(), - TD = today.getDate(); - this.table.style.visibility = "hidden"; - var year = date.getFullYear(); - if (year < this.minYear) { - year = this.minYear; - date.setFullYear(year); - } else if (year > this.maxYear) { - year = this.maxYear; - date.setFullYear(year); - } - this.firstDayOfWeek = firstDayOfWeek; - this.date = new Date(date); - var month = date.getMonth(); - var mday = date.getDate(); - var no_days = date.getMonthDays(); - - // calendar voodoo for computing the first day that would actually be - // displayed in the calendar, even if it's from the previous month. - // WARNING: this is magic. ;-) - date.setDate(1); - var day1 = (date.getDay() - this.firstDayOfWeek) % 7; - if (day1 < 0) - day1 += 7; - date.setDate(-day1); - date.setDate(date.getDate() + 1); - - var row = this.tbody.firstChild; - var MN = Calendar._SMN[month]; - var ar_days = this.ar_days = new Array(); - var weekend = Calendar._TT["WEEKEND"]; - var dates = this.multiple ? (this.datesCells = {}) : null; - for (var i = 0; i < 6; ++i, row = row.nextSibling) { - var cell = row.firstChild; - if (this.weekNumbers) { - cell.className = "day wn"; - cell.innerHTML = date.getWeekNumber(); - cell = cell.nextSibling; - } - row.className = "daysrow"; - var hasdays = false, iday, dpos = ar_days[i] = []; - for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { - iday = date.getDate(); - var wday = date.getDay(); - cell.className = "day"; - cell.pos = i << 4 | j; - dpos[j] = cell; - var current_month = (date.getMonth() == month); - if (!current_month) { - if (this.showsOtherMonths) { - cell.className += " othermonth"; - cell.otherMonth = true; - } else { - cell.className = "emptycell"; - cell.innerHTML = " "; - cell.disabled = true; - continue; - } - } else { - cell.otherMonth = false; - hasdays = true; - } - cell.disabled = false; - cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; - if (dates) - dates[date.print("%Y%m%d")] = cell; - if (this.getDateStatus) { - var status = this.getDateStatus(date, year, month, iday); - if (this.getDateToolTip) { - var toolTip = this.getDateToolTip(date, year, month, iday); - if (toolTip) - cell.title = toolTip; - } - if (status === true) { - cell.className += " disabled"; - cell.disabled = true; - } else { - if (/disabled/i.test(status)) - cell.disabled = true; - cell.className += " " + status; - } - } - if (!cell.disabled) { - cell.caldate = new Date(date); - cell.ttip = "_"; - if (!this.multiple && current_month - && iday == mday && this.hiliteToday) { - cell.className += " selected"; - this.currentDateEl = cell; - } - if (date.getFullYear() == TY && - date.getMonth() == TM && - iday == TD) { - cell.className += " today"; - cell.ttip += Calendar._TT["PART_TODAY"]; - } - if (weekend.indexOf(wday.toString()) != -1) - cell.className += cell.otherMonth ? " oweekend" : " weekend"; - } - } - if (!(hasdays || this.showsOtherMonths)) - row.className = "emptyrow"; - } - this.title.innerHTML = Calendar._MN[month] + ", " + year; - this.onSetTime(); - this.table.style.visibility = "visible"; - this._initMultipleDates(); - // PROFILE - // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; -}; - -Calendar.prototype._initMultipleDates = function() { - if (this.multiple) { - for (var i in this.multiple) { - var cell = this.datesCells[i]; - var d = this.multiple[i]; - if (!d) - continue; - if (cell) - cell.className += " selected"; - } - } -}; - -Calendar.prototype._toggleMultipleDate = function(date) { - if (this.multiple) { - var ds = date.print("%Y%m%d"); - var cell = this.datesCells[ds]; - if (cell) { - var d = this.multiple[ds]; - if (!d) { - Calendar.addClass(cell, "selected"); - this.multiple[ds] = date; - } else { - Calendar.removeClass(cell, "selected"); - delete this.multiple[ds]; - } - } - } -}; - -Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { - this.getDateToolTip = unaryFunction; -}; - -/** - * Calls _init function above for going to a certain date (but only if the - * date is different than the currently selected one). - */ -Calendar.prototype.setDate = function (date) { - if (!date.equalsTo(this.date)) { - this._init(this.firstDayOfWeek, date); - } -}; - -/** - * Refreshes the calendar. Useful if the "disabledHandler" function is - * dynamic, meaning that the list of disabled date can change at runtime. - * Just * call this function if you think that the list of disabled dates - * should * change. - */ -Calendar.prototype.refresh = function () { - this._init(this.firstDayOfWeek, this.date); -}; - -/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ -Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { - this._init(firstDayOfWeek, this.date); - this._displayWeekdays(); -}; - -/** - * Allows customization of what dates are enabled. The "unaryFunction" - * parameter must be a function object that receives the date (as a JS Date - * object) and returns a boolean value. If the returned value is true then - * the passed date will be marked as disabled. - */ -Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { - this.getDateStatus = unaryFunction; -}; - -/** Customization of allowed year range for the calendar. */ -Calendar.prototype.setRange = function (a, z) { - this.minYear = a; - this.maxYear = z; -}; - -/** Calls the first user handler (selectedHandler). */ -Calendar.prototype.callHandler = function () { - if (this.onSelected) { - this.onSelected(this, this.date.print(this.dateFormat)); - } -}; - -/** Calls the second user handler (closeHandler). */ -Calendar.prototype.callCloseHandler = function () { - if (this.onClose) { - this.onClose(this); - } - this.hideShowCovered(); -}; - -/** Removes the calendar object from the DOM tree and destroys it. */ -Calendar.prototype.destroy = function () { - var el = this.element.parentNode; - el.removeChild(this.element); - Calendar._C = null; - window._dynarch_popupCalendar = null; -}; - -/** - * Moves the calendar element to a different section in the DOM tree (changes - * its parent). - */ -Calendar.prototype.reparent = function (new_parent) { - var el = this.element; - el.parentNode.removeChild(el); - new_parent.appendChild(el); -}; - -// This gets called when the user presses a mouse button anywhere in the -// document, if the calendar is shown. If the click was outside the open -// calendar this function closes it. -Calendar._checkCalendar = function(ev) { - var calendar = window._dynarch_popupCalendar; - if (!calendar) { - return false; - } - var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); - for (; el != null && el != calendar.element; el = el.parentNode); - if (el == null) { - // calls closeHandler which should hide the calendar. - window._dynarch_popupCalendar.callCloseHandler(); - return Calendar.stopEvent(ev); - } -}; - -/** Shows the calendar. */ -Calendar.prototype.show = function () { - var rows = this.table.getElementsByTagName("tr"); - for (var i = rows.length; i > 0;) { - var row = rows[--i]; - Calendar.removeClass(row, "rowhilite"); - var cells = row.getElementsByTagName("td"); - for (var j = cells.length; j > 0;) { - var cell = cells[--j]; - Calendar.removeClass(cell, "hilite"); - Calendar.removeClass(cell, "active"); - } - } - this.element.style.display = "block"; - this.hidden = false; - if (this.isPopup) { - window._dynarch_popupCalendar = this; - Calendar.addEvent(document, "keydown", Calendar._keyEvent); - Calendar.addEvent(document, "keypress", Calendar._keyEvent); - Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); - } - this.hideShowCovered(); -}; - -/** - * Hides the calendar. Also removes any "hilite" from the class of any TD - * element. - */ -Calendar.prototype.hide = function () { - if (this.isPopup) { - Calendar.removeEvent(document, "keydown", Calendar._keyEvent); - Calendar.removeEvent(document, "keypress", Calendar._keyEvent); - Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); - } - this.element.style.display = "none"; - this.hidden = true; - this.hideShowCovered(); -}; - -/** - * Shows the calendar at a given absolute position (beware that, depending on - * the calendar element style -- position property -- this might be relative - * to the parent's containing rectangle). - */ -Calendar.prototype.showAt = function (x, y) { - var s = this.element.style; - s.left = x + "px"; - s.top = y + "px"; - this.show(); -}; - -/** Shows the calendar near a given element. */ -Calendar.prototype.showAtElement = function (el, opts) { - var self = this; - var p = Calendar.getAbsolutePos(el); - if (!opts || typeof opts != "string") { - this.showAt(p.x, p.y + el.offsetHeight); - return true; - } - function fixPosition(box) { - if (box.x < 0) - box.x = 0; - if (box.y < 0) - box.y = 0; - var cp = document.createElement("div"); - var s = cp.style; - s.position = "absolute"; - s.right = s.bottom = s.width = s.height = "0px"; - document.body.appendChild(cp); - var br = Calendar.getAbsolutePos(cp); - document.body.removeChild(cp); - if (Calendar.is_ie) { - br.y += document.body.scrollTop; - br.x += document.body.scrollLeft; - } else { - br.y += window.scrollY; - br.x += window.scrollX; - } - var tmp = box.x + box.width - br.x; - if (tmp > 0) box.x -= tmp; - tmp = box.y + box.height - br.y; - if (tmp > 0) box.y -= tmp; - }; - this.element.style.display = "block"; - Calendar.continuation_for_the_fucking_khtml_browser = function() { - var w = self.element.offsetWidth; - var h = self.element.offsetHeight; - self.element.style.display = "none"; - var valign = opts.substr(0, 1); - var halign = "l"; - if (opts.length > 1) { - halign = opts.substr(1, 1); - } - // vertical alignment - switch (valign) { - case "T": p.y -= h; break; - case "B": p.y += el.offsetHeight; break; - case "C": p.y += (el.offsetHeight - h) / 2; break; - case "t": p.y += el.offsetHeight - h; break; - case "b": break; // already there - } - // horizontal alignment - switch (halign) { - case "L": p.x -= w; break; - case "R": p.x += el.offsetWidth; break; - case "C": p.x += (el.offsetWidth - w) / 2; break; - case "l": p.x += el.offsetWidth - w; break; - case "r": break; // already there - } - p.width = w; - p.height = h + 40; - self.monthsCombo.style.display = "none"; - fixPosition(p); - self.showAt(p.x, p.y); - }; - if (Calendar.is_khtml) - setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); - else - Calendar.continuation_for_the_fucking_khtml_browser(); -}; - -/** Customizes the date format. */ -Calendar.prototype.setDateFormat = function (str) { - this.dateFormat = str; -}; - -/** Customizes the tooltip date format. */ -Calendar.prototype.setTtDateFormat = function (str) { - this.ttDateFormat = str; -}; - -/** - * Tries to identify the date represented in a string. If successful it also - * calls this.setDate which moves the calendar to the given date. - */ -Calendar.prototype.parseDate = function(str, fmt) { - if (!fmt) - fmt = this.dateFormat; - this.setDate(Date.parseDate(str, fmt)); -}; - -Calendar.prototype.hideShowCovered = function () { - if (!Calendar.is_ie && !Calendar.is_opera) - return; - function getVisib(obj){ - var value = obj.style.visibility; - if (!value) { - if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C - if (!Calendar.is_khtml) - value = document.defaultView. - getComputedStyle(obj, "").getPropertyValue("visibility"); - else - value = ''; - } else if (obj.currentStyle) { // IE - value = obj.currentStyle.visibility; - } else - value = ''; - } - return value; - }; - - var tags = new Array("applet", "iframe", "select"); - var el = this.element; - - var p = Calendar.getAbsolutePos(el); - var EX1 = p.x; - var EX2 = el.offsetWidth + EX1; - var EY1 = p.y; - var EY2 = el.offsetHeight + EY1; - - for (var k = tags.length; k > 0; ) { - var ar = document.getElementsByTagName(tags[--k]); - var cc = null; - - for (var i = ar.length; i > 0;) { - cc = ar[--i]; - - p = Calendar.getAbsolutePos(cc); - var CX1 = p.x; - var CX2 = cc.offsetWidth + CX1; - var CY1 = p.y; - var CY2 = cc.offsetHeight + CY1; - - if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { - if (!cc.__msh_save_visibility) { - cc.__msh_save_visibility = getVisib(cc); - } - cc.style.visibility = cc.__msh_save_visibility; - } else { - if (!cc.__msh_save_visibility) { - cc.__msh_save_visibility = getVisib(cc); - } - cc.style.visibility = "hidden"; - } - } - } -}; - -/** Internal function; it displays the bar with the names of the weekday. */ -Calendar.prototype._displayWeekdays = function () { - var fdow = this.firstDayOfWeek; - var cell = this.firstdayname; - var weekend = Calendar._TT["WEEKEND"]; - for (var i = 0; i < 7; ++i) { - cell.className = "day name"; - var realday = (i + fdow) % 7; - if (i) { - cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); - cell.navtype = 100; - cell.calendar = this; - cell.fdow = realday; - Calendar._add_evs(cell); - } - if (weekend.indexOf(realday.toString()) != -1) { - Calendar.addClass(cell, "weekend"); - } - cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; - cell = cell.nextSibling; - } -}; - -/** Internal function. Hides all combo boxes that might be displayed. */ -Calendar.prototype._hideCombos = function () { - this.monthsCombo.style.display = "none"; - this.yearsCombo.style.display = "none"; -}; - -/** Internal function. Starts dragging the element. */ -Calendar.prototype._dragStart = function (ev) { - if (this.dragging) { - return; - } - this.dragging = true; - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posY = ev.clientY + window.scrollY; - posX = ev.clientX + window.scrollX; - } - var st = this.element.style; - this.xOffs = posX - parseInt(st.left); - this.yOffs = posY - parseInt(st.top); - with (Calendar) { - addEvent(document, "mousemove", calDragIt); - addEvent(document, "mouseup", calDragEnd); - } -}; - -// BEGIN: DATE OBJECT PATCHES - -/** Adds the number of days array to the Date object. */ -Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); - -/** Constants used for time computations */ -Date.SECOND = 1000 /* milliseconds */; -Date.MINUTE = 60 * Date.SECOND; -Date.HOUR = 60 * Date.MINUTE; -Date.DAY = 24 * Date.HOUR; -Date.WEEK = 7 * Date.DAY; - -Date.parseDate = function(str, fmt) { - var today = new Date(); - var y = 0; - var m = -1; - var d = 0; - var a = str.split(/\W+/); - var b = fmt.match(/%./g); - var i = 0, j = 0; - var hr = 0; - var min = 0; - for (i = 0; i < a.length; ++i) { - if (!a[i]) - continue; - switch (b[i]) { - case "%d": - case "%e": - d = parseInt(a[i], 10); - break; - - case "%m": - m = parseInt(a[i], 10) - 1; - break; - - case "%Y": - case "%y": - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - break; - - case "%b": - case "%B": - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } - } - break; - - case "%H": - case "%I": - case "%k": - case "%l": - hr = parseInt(a[i], 10); - break; - - case "%P": - case "%p": - if (/pm/i.test(a[i]) && hr < 12) - hr += 12; - else if (/am/i.test(a[i]) && hr >= 12) - hr -= 12; - break; - - case "%M": - min = parseInt(a[i], 10); - break; - } - } - if (isNaN(y)) y = today.getFullYear(); - if (isNaN(m)) m = today.getMonth(); - if (isNaN(d)) d = today.getDate(); - if (isNaN(hr)) hr = today.getHours(); - if (isNaN(min)) min = today.getMinutes(); - if (y != 0 && m != -1 && d != 0) - return new Date(y, m, d, hr, min, 0); - y = 0; m = -1; d = 0; - for (i = 0; i < a.length; ++i) { - if (a[i].search(/[a-zA-Z]+/) != -1) { - var t = -1; - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } - } - if (t != -1) { - if (m != -1) { - d = m+1; - } - m = t; - } - } else if (parseInt(a[i], 10) <= 12 && m == -1) { - m = a[i]-1; - } else if (parseInt(a[i], 10) > 31 && y == 0) { - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - } else if (d == 0) { - d = a[i]; - } - } - if (y == 0) - y = today.getFullYear(); - if (m != -1 && d != 0) - return new Date(y, m, d, hr, min, 0); - return today; -}; - -/** Returns the number of days in the current month */ -Date.prototype.getMonthDays = function(month) { - var year = this.getFullYear(); - if (typeof month == "undefined") { - month = this.getMonth(); - } - if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { - return 29; - } else { - return Date._MD[month]; - } -}; - -/** Returns the number of day in the year. */ -Date.prototype.getDayOfYear = function() { - var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); - var time = now - then; - return Math.floor(time / Date.DAY); -}; - -/** Returns the number of the week in year, as defined in ISO 8601. */ -Date.prototype.getWeekNumber = function() { - var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var DoW = d.getDay(); - d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu - var ms = d.valueOf(); // GMT - d.setMonth(0); - d.setDate(4); // Thu in Week 1 - return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; -}; - -/** Checks date and time equality */ -Date.prototype.equalsTo = function(date) { - return ((this.getFullYear() == date.getFullYear()) && - (this.getMonth() == date.getMonth()) && - (this.getDate() == date.getDate()) && - (this.getHours() == date.getHours()) && - (this.getMinutes() == date.getMinutes())); -}; - -/** Set only the year, month, date parts (keep existing time) */ -Date.prototype.setDateOnly = function(date) { - var tmp = new Date(date); - this.setDate(1); - this.setFullYear(tmp.getFullYear()); - this.setMonth(tmp.getMonth()); - this.setDate(tmp.getDate()); -}; - -/** Prints the date in a string according to the given format. */ -Date.prototype.print = function (str) { - var m = this.getMonth(); - var d = this.getDate(); - var y = this.getFullYear(); - var wn = this.getWeekNumber(); - var w = this.getDay(); - var s = {}; - var hr = this.getHours(); - var pm = (hr >= 12); - var ir = (pm) ? (hr - 12) : hr; - var dy = this.getDayOfYear(); - if (ir == 0) - ir = 12; - var min = this.getMinutes(); - var sec = this.getSeconds(); - s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] - s["%A"] = Calendar._DN[w]; // full weekday name - s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] - s["%B"] = Calendar._MN[m]; // full month name - // FIXME: %c : preferred date and time representation for the current locale - s["%C"] = 1 + Math.floor(y / 100); // the century number - s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) - s["%e"] = d; // the day of the month (range 1 to 31) - // FIXME: %D : american date style: %m/%d/%y - // FIXME: %E, %F, %G, %g, %h (man strftime) - s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) - s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) - s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) - s["%k"] = hr; // hour, range 0 to 23 (24h format) - s["%l"] = ir; // hour, range 1 to 12 (12h format) - s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 - s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 - s["%n"] = "\n"; // a newline character - s["%p"] = pm ? "PM" : "AM"; - s["%P"] = pm ? "pm" : "am"; - // FIXME: %r : the time in am/pm notation %I:%M:%S %p - // FIXME: %R : the time in 24-hour notation %H:%M - s["%s"] = Math.floor(this.getTime() / 1000); - s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 - s["%t"] = "\t"; // a tab character - // FIXME: %T : the time in 24-hour notation (%H:%M:%S) - s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; - s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) - s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) - // FIXME: %x : preferred date representation for the current locale without the time - // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) - s["%Y"] = y; // year with the century - s["%%"] = "%"; // a literal '%' character - - var re = /%./g; - if (!Calendar.is_ie5 && !Calendar.is_khtml) - return str.replace(re, function (par) { return s[par] || par; }); - - var a = str.match(re); - for (var i = 0; i < a.length; i++) { - var tmp = s[a[i]]; - if (tmp) { - re = new RegExp(a[i], 'g'); - str = str.replace(re, tmp); - } - } - - return str; -}; - -Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; -Date.prototype.setFullYear = function(y) { - var d = new Date(this); - d.__msh_oldSetFullYear(y); - if (d.getMonth() != this.getMonth()) - this.setDate(28); - this.__msh_oldSetFullYear(y); -}; - -// END: DATE OBJECT PATCHES - - -// global object that remembers the calendar -window._dynarch_popupCalendar = null;
--- a/gnv/src/main/webapp/scripts/calendar_stripped.js Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo - * ----------------------------------------------------------- - * - * The DHTML Calendar, version 1.0 "It is happening again" - * - * Details and latest version at: - * www.dynarch.com/projects/calendar - * - * This script is developed by Dynarch.com. Visit us at www.dynarch.com. - * - * This script is distributed under the GNU Lesser General Public License. - * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html - */ - Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.innerHTML=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)return false;removeClass(el,"hilite");if(el.caldate)removeClass(el.parentNode,"rowhilite");if(el.calendar)el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)cal._toggleMultipleDate(new Date(date));else newdate=!el.disabled;if(other_month)cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=new Date(cal.date);if(el.navtype==0)date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)if(range[i]==current)break;if(ev&&ev.shiftKey){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}break;}if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)newdate=closing=true;}if(newdate){ev&&cal.callHandler();}if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("×",1,200).ttip=Calendar._TT["CLOSE"];}row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("«",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("‹",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("›",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("»",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||" ";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else cell.innerHTML=" ";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)h=0;}var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)ne=cal.ar_days[y][x];else{x=6;K=38;continue;}break;case 38:if(--y>=0)ne=cal.ar_days[y][x];else{prevMonth();setVars();}break;case 39:if(++x<7)ne=cal.ar_days[y][x];else{x=0;K=40;continue;}break;case 40:if(++y<cal.ar_days.length)ne=cal.ar_days[y][x];else{nextMonth();setVars();}break;}break;}if(ne){if(!ne.disabled)Calendar.cellClick(ne);else if(prev)prevMonth();else nextMonth();}}break;case 13:if(act)Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML=" ";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)cell.title=toolTip;}if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))cell.disabled=true;cell.className+=" "+status;}}if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&¤t_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}if(weekend.indexOf(wday.toString())!=-1)cell.className+=cell.otherMonth?" oweekend":" weekend";}}if(!(hasdays||this.showsOtherMonths))row.className="emptyrow";}this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)continue;if(cell)cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}function fixPosition(box){if(box.x<0)box.x=0;if(box.y<0)box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)value=document.defaultView. getComputedStyle(obj,"").getPropertyValue("visibility");else value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else value='';}return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new Date();var y=0;var m=-1;var d=0;var a=str.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])continue;switch(b[i]){case "%d":case "%e":d=parseInt(a[i],10);break;case "%m":m=parseInt(a[i],10)-1;break;case "%Y":case "%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case "%b":case "%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}break;case "%H":case "%I":case "%k":case "%l":hr=parseInt(a[i],10);break;case "%P":case "%p":if(/pm/i.test(a[i])&&hr<12)hr+=12;else if(/am/i.test(a[i])&&hr>=12)hr-=12;break;case "%M":min=parseInt(a[i],10);break;}}if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}if(t!=-1){if(m!=-1){d=m+1;}m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}if(y==0)y=today.getFullYear();if(m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new Date(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())this.setDate(28);this.__msh_oldSetFullYear(y);};window._dynarch_popupCalendar=null; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/ext/readme Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,3 @@ +curl "http://www.extjs.com/deploy/ext-2.3.0.zip" > ext-2.3.0.zip +unzip ext-2.3.0.zip +rm ext-2.3.0.zip \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/geoext/readme Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,4 @@ +curl "http://trac.geoext.org/attachment/wiki/Download/GeoExt-release-0.6.zip?format=raw" > GeoExt-release-0.6.zip +unzip GeoExt-release-0.6.zip +mv GeoExt geoext-0.6 +rm GeoExt-release-0.6.zip \ No newline at end of file
--- a/gnv/src/main/webapp/scripts/gnviewer.js Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/scripts/gnviewer.js Fri Sep 28 12:15:21 2012 +0200 @@ -14,4 +14,4 @@ function showDiv(pName) { var el = document.getElementById(pName); el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"; -} \ No newline at end of file +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/layers.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,62 @@ + +<%@page import="java.util.Iterator"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>/** + * This function is called while initializing the application. You are allowed + * to change/add/remove layers. But be are of the comments inline this code! + */ +function initLayers() { + /** + * XXX This application needs a layer that is stored in a variable called + * 'layer'. So do not change the name of this variable. Just change the WMS + * layer itself. + */ + layer = new OpenLayers.Layer.WMS( + "Background1", + "http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer?", + { + layers: '0', + format: 'image/png', + transparent: false + }, + { + isBaseLayer: true, + singleTile: true + } + + ); + /** + * XXX This application needs an ARRAY that stores some layers (or a single + * layer). Do not change the name of the following variable 'layers'. + */ + layers = []; + layers[0] = layer; + + <% + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + MapService localMapService = sm.getLocalMapService(); + Iterator<Layer> it = localMapService.getLayer().iterator(); + int i = 1; + while (it.hasNext()){ + Layer layer = it.next(); + %> + layer<%=i%> = new OpenLayers.Layer.WMS( + "<%=layer.getID() %>", + "<%=localMapService.getURL() %>", + { + layers: '<%=layer.getName()%>', + format: 'image/png', + transparent: true + }, + { + isBaseLayer: false, + singleTile: true + } + + ); + layers[<%=i%>] = layer<%=i++%>; + <%}%> + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/olutils.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,238 @@ +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +function handleMeasurements(event) { + var geometry = event.geometry; + var units = event.units; + var order = event.order; + var measure = event.measure; + var element = document.getElementById('measurements'); + + var out = ""; + if(order == 1) { + out += "L\u00e4nge: " + measure.toFixed(3) + " " + units; + } else { + out += "Fl\u00e4che: " + measure.toFixed(3) + " " + units + "<sup>2</sup>"; + } + + element.innerHTML=out; +}; + + + +function readWMC(merge) { + var layers = mapPanel.layers; + map = mapPanel.map; + + var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}}); + var text = document.getElementById("wmc").value; + + merge = true; + if(merge) { + try { + map = format.read(text, {map: map}); + } catch(err) { + document.getElementById("wmc").value = err; + } + } else { + map.destroy(); + try { + var jsonFormat = new OpenLayers.Format.JSON(); + var mapOptions = jsonFormat.read(); + map = format.read(text, {map: mapOptions}); + } catch(err) { + document.getElementById("wmc").value = err; + } + } + + // create MapPanel + mapPanel = new GeoExt.MapPanel({ + border: true, + title: "Karte", + region: "center", + map: map, + zoom: 1, + layers: map.layers + }); +} + + +function writeWMC(merge) { + var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}}); + + try { + var text = format.write(map); + document.getElementById("wmc").value = text; + } catch(err) { + document.getElementById("wmc").value = err; + } +} + + + +function toggleGetFeatureInfo(evt) { + if (infoActive) { + infoControls.click.deactivate(); + infoActive = false; + } + else { + infoControls.click.activate(); + infoActive = true; + } +} + + +function showInfo(evt) { +} + + +function addLayer() { + var records = grid.getSelectionModel().getSelections(); + for (rec in records){ + + var record = records[rec]; + // TODO: Look for something better than object + if (typeof record == "object"){ + var copy = record.copy(); + copy.set("layer", record.get("layer")); + copy.get("layer").mergeNewParams({ + format: "image/png", + transparent: true + }); + mapPanel.layers.add(copy); + } + } + +} + + +// this is just copied from OpenLayers.Util +function urlAppend(url, paramStr) { + var newUrl = url; + if(paramStr) { + var parts = (url + " ").split(/[?&]/); + newUrl += (parts.pop() === " " ? + paramStr : + parts.length ? "&" + paramStr : "?" + paramStr); + } + return newUrl; +} + +function showWarning(){ + if (store.data.length == 0){ + Ext.MessageBox.alert("<bean:message key="gnviewer.mapclient.wms.load.grid.error.title"/>", '<bean:message key="gnviewer.mapclient.wms.load.grid.error.message"/>', grid); + return; + } +} + + +function updateCapabilities() { + + var url = capfield.getValue(); + var service = "SERVICE=WMS"; + var request = "REQUEST=GetCapabilities"; + var version = "VERSION=1.1.1"; + url = urlAppend(url, service); + url = urlAppend(url, request); + url = urlAppend(url, version); + + store = new GeoExt.data.WMSCapabilitiesStore({ + url: url, + layerOptions: {singleTile: true} + }); + store.load({ + callback: showWarning + }); + + grid.destroy(); + grid = new Ext.grid.GridPanel({ + id: 'wmsgrid', + collapsible: false, + split: false, + border: true, + // TODO: autoHeight might cause trouble + autoHeight: true, + overflow: 'auto', + store: store, + cm: new Ext.grid.ColumnModel([ + { + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.name"/>', + dataIndex: 'name', + sortable: true + }, + { + id: 'title', + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.title"/>', + dataIndex: 'title', + sortable: true + }]), + renderTo: 'capgrid', + bbar: [{ + text: '<bean:message key="gnviewer.mapclient.wms.load.addlayer"/>', + handler: addLayer + }] + }); +} + + +function editFeature(e) { + var feature = e.feature; + + // TODO SET FEATURE ATTRIBUTES + //feature.attributes['lawa'] = 999; + //feature.attributes['lawa_id'] = 999; + //feature.attributes['w_gwk_lawa'] = 999; + //feature.attributes['w_wrrl'] = 999; + //feature.attributes['length_fee'] = 999; +} + +function updateControls() { + var controls = panel.controls; + + controls.remove(drawPointControl); + controls.remove(drawPathControl); + controls.remove(drawPolygonControl); + + panel.destroy(); + panel = new OpenLayers.Control.Panel(); + panel.addControls(controls); + + if (points.getVisibility()) + panel.addControls(drawPointControl); + if (lines.getVisibility()) + panel.addControls(drawPathControl); + if (polygons.getVisibility()) + panel.addControls(drawPolygonControl); + + map.addControl(panel); +} +function parseGetFeatureInfoData(event) { + var contentHTML = "<div>"; + var features = event.features; + var first = true; + for (feat in features){ + if (feat != 'remove'){ + var feature = features[feat]; + var attributes = feature.attributes; + if (first){ + first = false; + }else{ + contentHTML += "<br/>"; + } + contentHTML += "<table>"; + for (att in attributes){ + contentHTML += "<tr><td><b>"+att+":</b></td><td>" + attributes[att] + "</td></tr>"; + } + contentHTML += "</table>"; + } + + } + contentHTML += "</div>"; + + mapPanel.map.addPopup(new OpenLayers.Popup.FramedCloud( + "chicken", + mapPanel.map.getLonLatFromPixel(event.xy), + null, + contentHTML, + null, + true + )); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/openlayers/readme Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,3 @@ +curl "http://www.openlayers.org/download/OpenLayers-2.9.zip" > OpenLayers.zip +unzip OpenLayers.zip +rm OpenLayers.zip \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/scripts/viewport.jsp Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,301 @@ +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<% +boolean standalone = request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null && +request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY).equals("true"); +MapService mapService = SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService(); +%> +OpenLayers.ImgPath = "images/ol/"; +OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url="; +OpenLayers.Lang.setCode('<%=SessionModelFactory.getInstance().getSessionModel(request).getCurrentLocale().getLanguage() %>'); +Ext.BLANK_IMAGE_URL = "scripts/openlayers/OpenLayers-2.9/theme/default/img/blank.gif"; + +/** + * XXX + * Change specific attributes for map, wfs-t, etc here. Do not change these + * settings inline the code! + */ +PROJECTION = "EPSG:4326"; +MAX_EXTENT = new OpenLayers.Bounds(-90,-180,90,180); +CURRENT_EXTENT = new OpenLayers.Bounds(<%=mapService.getBBoxValue().replace(' ',',')%>); +INITIAL_CENTER = new OpenLayers.LonLat(5, 55); +GETFEATUREINFO_URL = "<%=mapService.getURL()%>"; + +Ext.onReady(function() { + + /* this function call initialized the layers that are defined by the user. + * The variable 'layer' and 'layers' are initialized in this function as + * well, that are used in the following code! So do not remove this function + * call. + */ + initLayers(); + + var options = { + maxExtent: MAX_EXTENT, + projection: PROJECTION, + controls: [], + units: 'm' + }; + + +/* ------------------------ Create map and add controls ---------------------*/ + // create map + map = new OpenLayers.Map(options); + map.displayProjection = new OpenLayers.Projection(PROJECTION); + + // add controls + + + var nav = new OpenLayers.Control.NavigationHistory(); + nav.previous.title = "<bean:message key="gnviewer.mapclient.controls.nav.previous.title"/>"; + nav.next.title = "<bean:message key="gnviewer.mapclient.controls.nav.next.title"/>"; + map.addControl(nav); + + panel = new OpenLayers.Control.Panel(); + controls = { + previous: nav.previous, + next : nav.next, + navigate: new OpenLayers.Control.Navigation( + { + displayClass: 'olControlPan', + autoActivate: 'false', + title:'<bean:message key="gnviewer.mapclient.controls.navigate.title"/>' + } + ), + zoombox: new OpenLayers.Control.ZoomBox( + { + displayClass: 'olControlZoomBox', + title: '<bean:message key="gnviewer.mapclient.controls.zoombox.title"/>' + } + ), + info : new OpenLayers.Control.WMSGetFeatureInfo({ + displayClass: "olControlFeatureInfo", + url: GETFEATUREINFO_URL, + title: '<bean:message key="gnviewer.mapclient.controls.info.title"/>', + queryVisible: true, + infoFormat: 'application/vnd.ogc.gml', + eventListeners: { + getfeatureinfo: parseGetFeatureInfoData + } + }) + }; + + for (var key in controls) { + panel.addControls([controls[key]]); + } + + map.addControl(panel); + map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon: 'true'})); + // Displaying the mouse postion + mousePosition = new OpenLayers.Control.MousePosition(); + map.addControl(mousePosition); + +/* --------------------------------------------------------------------------- */ + + // create MapPanel + mapPanel = new GeoExt.MapPanel({ + border: true, + region: "center", + map: map, + layers: layers + }); + + //map.setCenter(INITIAL_CENTER); + + + store = new GeoExt.data.WMSCapabilitiesStore({ + }); + + grid = new Ext.grid.GridPanel({ + id: 'wmsgrid', + collapsible: false, + split: false, + border: true, + //height: 400, + autoHeight: true, + store: store, + cm: new Ext.grid.ColumnModel([ + { + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.name"/>', + dataIndex: 'name', + sortable: true + }, + { + id: 'title', + header: '<bean:message key="gnviewer.mapclient.wms.load.grid.title"/>', + dataIndex: 'title', + sortable: true + }]), + renderTo: 'capgrid', + bbar: [{ + text: '<bean:message key="gnviewer.mapclient.wms.load.addlayer"/>', + handler: addLayer + }] + }); + var cap = new Ext.Panel({ + id: 'wmspanel', + border: true, + region: 'east', + title: '<bean:message key="gnviewer.mapclient.wms.load.title"/>', + collapsible: false, + split: false, + height: 400, + contentEl: 'cap' + + }); + + var capstore = new Ext.data.SimpleStore({ + fields: ['name','url'], + data : [['<bean:message key="gnviewer.mapclient.wms.local.service.name"/>','<%=mapService.getURL()%>'],<jsp:include page="/WEB-INF/config/reachable-servers.conf" />] + }); + capfield = new Ext.form.ComboBox({ + id: 'capfield', + store: capstore, + displayField:'name', + width: 245, + valueField: 'url', + mode: 'local', + triggerAction: 'all', + selectOnFocus: true, + renderTo: 'urlinput', + editable: false, + value: '<%=mapService.getURL()%>' + + }); + + + + var capbutton = new Ext.Button({ + id: 'capbutton', + region: 'west', + handler: updateCapabilities, + text: '<bean:message key="gnviewer.mapclient.wms.load.bt.text"/>', + tooltip: '<bean:message key="gnviewer.mapclient.wms.load.bt.tooltip"/>', + renderTo: 'urlbutton' + }); + + + + +/* --------------------------- Layer Tree ----------------------------------- */ + + + // LayerTree + var tree = new Ext.tree.TreePanel({ + border: true, + enableDD: true, + region: "east", + title: "<bean:message key="gnviewer.mapclient.layercontrol"/>", + width: 200, + split: true, + collapsible: false, + collapseMode: "mini", + autoScroll: true, + loader: new Ext.tree.TreeLoader({ + applyLoader: false, + }), + root: { + nodeType: "async", + children: [{ + nodeType: "gx_baselayercontainer", + text: "<bean:message key="gnviewer.mapclient.layercontrol.baselayer"/>", + expanded: true + }, { + nodeType: "gx_overlaylayercontainer", + text: "<bean:message key="gnviewer.mapclient.layercontrol.overlay"/>", + expanded: true, + loader: { + filter: function(record) { + var layer = record.get("layer"); + return layer.displayInLayerSwitcher === true && + layer.isBaseLayer === false; + } + } + }] + }, + rootVisible: false, + lines: false + }); + +/*-------------------------------- Feature grid -------------------------------*/ + + // create legend paneclass="headerLineLinksl + legendPanel = new GeoExt.LegendPanel({ + id: 'legendpanel', + dynamic: true, + border: true, + title: '<bean:message key="gnviewer.mapclient.legend"/>', + collapsible: false, + split: false, + defaults: { + labelCls: 'legend', + style: 'padding: 5px' + }, + bodyStyle: 'padding:5px', + width: 250, + autoScroll: true, + region: 'east', + }); + + +// use separate panels + // Create GUI + + var mylegend = new Ext.Panel( + { + region: "west", + title: '', + split: true, + width: 250, + minSize: 225, + maxSize: 400, + collapsible: false, + overflow: 'auto', + margins: '0 0 0 5', + layout: 'accordion', + layoutConfig: { + animate: true, + activeOnTop: false + }, + items: [ + tree, + legendPanel, + cap + ] + } + ); + <%if (!standalone){%> + // The main panel + new Ext.Panel({ + renderTo: "mapcontainer", + layout: "border", + height: 400, + items: [mapPanel, mylegend] + }); + <%}else{ %> + // Create GUI + new Ext.Viewport({ + layout: "border", + items: [ + { + region: "north", + contentEl: "headline", + cls: 'title', + height: 40 + }, + mylegend, + mapPanel + ] + }); + <%}%> + map.zoomToExtent(CURRENT_EXTENT); + + // some code for automatically resizing the map panel if the window size + // changes + window.onresize=function() { + var mapcontainer = Ext.get('mapcontainer'); + mapPanel.setSize(mapcontainer.getSize()); + } +});
--- a/gnv/src/main/webapp/styles/calendar-blue.css Fri Sep 28 12:13:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* The main calendar widget. DIV containing a table. */ - -div.calendar { position: relative; } - -.calendar, .calendar table { - border: 1px solid #556; - font-size: 11px; - color: #000; - cursor: default; - background: #eef; - font-family: tahoma,verdana,sans-serif; -} - -/* Header part -- contains navigation buttons and day names. */ - -.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ - text-align: center; /* They are the navigation buttons */ - padding: 2px; /* Make the buttons seem like they're pressing */ -} - -.calendar .nav { - background: #778 url(menuarrow.gif) no-repeat 100% 100%; -} - -.calendar thead .title { /* This holds the current "month, year" */ - font-weight: bold; /* Pressing it will take you to the current date */ - text-align: center; - background: #fff; - color: #000; - padding: 2px; -} - -.calendar thead .headrow { /* Row <TR> containing navigation buttons */ - background: #778; - color: #fff; -} - -.calendar thead .daynames { /* Row <TR> containing the day names */ - background: #bdf; -} - -.calendar thead .name { /* Cells <TD> containing the day names */ - border-bottom: 1px solid #556; - padding: 2px; - text-align: center; - color: #000; -} - -.calendar thead .weekend { /* How a weekend day name shows in header */ - color: #a66; -} - -.calendar thead .hilite { /* How do the buttons in header appear when hover */ - background-color: #aaf; - color: #000; - border: 1px solid #04f; - padding: 1px; -} - -.calendar thead .active { /* Active (pressed) buttons in header */ - background-color: #77c; - padding: 2px 0px 0px 2px; -} - -/* The body part -- contains all the days in month. */ - -.calendar tbody .day { /* Cells <TD> containing month days dates */ - width: 2em; - color: #456; - text-align: right; - padding: 2px 4px 2px 2px; -} -.calendar tbody .day.othermonth { - font-size: 80%; - color: #bbb; -} -.calendar tbody .day.othermonth.oweekend { - color: #fbb; -} - -.calendar table .wn { - padding: 2px 3px 2px 2px; - border-right: 1px solid #000; - background: #bdf; -} - -.calendar tbody .rowhilite td { - background: #def; -} - -.calendar tbody .rowhilite td.wn { - background: #eef; -} - -.calendar tbody td.hilite { /* Hovered cells <TD> */ - background: #def; - padding: 1px 3px 1px 1px; - border: 1px solid #bbb; -} - -.calendar tbody td.active { /* Active (pressed) cells <TD> */ - background: #cde; - padding: 2px 2px 0px 2px; -} - -.calendar tbody td.selected { /* Cell showing today date */ - font-weight: bold; - border: 1px solid #000; - padding: 1px 3px 1px 1px; - background: #fff; - color: #000; -} - -.calendar tbody td.weekend { /* Cells showing weekend days */ - color: #a66; -} - -.calendar tbody td.today { /* Cell showing selected date */ - font-weight: bold; - color: #00f; -} - -.calendar tbody .disabled { color: #999; } - -.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ - visibility: hidden; -} - -.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ - display: none; -} - -/* The footer part -- status bar and "Close" button */ - -.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */ - text-align: center; - background: #556; - color: #fff; -} - -.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */ - background: #fff; - color: #445; - border-top: 1px solid #556; - padding: 1px; -} - -.calendar tfoot .hilite { /* Hover style for buttons in footer */ - background: #aaf; - border: 1px solid #04f; - color: #000; - padding: 1px; -} - -.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ - background: #77c; - padding: 2px 0px 0px 2px; -} - -/* Combo boxes (menus that display months/years for direct selection) */ - -.calendar .combo { - position: absolute; - display: none; - top: 0px; - left: 0px; - width: 4em; - cursor: default; - border: 1px solid #655; - background: #def; - color: #000; - font-size: 90%; - z-index: 100; -} - -.calendar .combo .label, -.calendar .combo .label-IEfix { - text-align: center; - padding: 1px; -} - -.calendar .combo .label-IEfix { - width: 4em; -} - -.calendar .combo .hilite { - background: #acf; -} - -.calendar .combo .active { - border-top: 1px solid #46a; - border-bottom: 1px solid #46a; - background: #eef; - font-weight: bold; -} - -.calendar td.time { - border-top: 1px solid #000; - padding: 1px 0px; - text-align: center; - background-color: #f4f0e8; -} - -.calendar td.time .hour, -.calendar td.time .minute, -.calendar td.time .ampm { - padding: 0px 3px 0px 4px; - border: 1px solid #889; - font-weight: bold; - background-color: #fff; -} - -.calendar td.time .ampm { - text-align: center; -} - -.calendar td.time .colon { - padding: 0px 2px 0px 3px; - font-weight: bold; -} - -.calendar td.time span.hilite { - border-color: #000; - background-color: #667; - color: #fff; -} - -.calendar td.time span.active { - border-color: #f00; - background-color: #000; - color: #0f0; -}
--- a/gnv/src/main/webapp/styles/default.css Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/main/webapp/styles/default.css Fri Sep 28 12:15:21 2012 +0200 @@ -36,17 +36,17 @@ } a { - color: #00416B; - text-decoration: none; + color: #FF6600; + text-decoration: underline; } legend { - border: 1px solid #CCD5DE; + border: 1px solid #003A66; padding: 4px 5px; margin: 0 0 0 0; background-color: white; font-weight: bolder; - color: #00416B; + color: #003A66; clear: both; } @@ -54,7 +54,8 @@ margin: 5px 0 0 10px; padding-left: 10px; padding-right: 10px; - border: 1px solid #CCD5DE; + border: 1px solid #003A66; + background-color: #F2F1F5; background-repeat: repeat-x; background-position: top left; display: block; @@ -65,6 +66,16 @@ padding: 0; } +#browseDiv { + float: left; + margin-top: 1px; +} + +#loadDiv { + float: right; + margin-left: 5px; +} + p, li, dl, input, select, address, legend, label, fieldset span { font-size: 0.7em; } @@ -115,8 +126,68 @@ border: 0px; } +/* styles used in footer.jsp */ +.footerTable { + width: 100%; + background-color: white; +} + +.footerLine { + color: #003A66; + font-family: Arial,Helvetica,sans-serif; + font-size: 0.95em; + line-height: 1.1em; + padding-left: 1px; +} + +.footerTableLinks { + width: 100%; + background-color: #003a66; +} + +.footerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 1.5em; + text-decoration:none; +} + +.headerTableLinks { + width: 100%; + background-color: #003a66; +} + +.headerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 1em; + text-decoration:none; +} + +/* styles used content */ +#contentElement { + height: 80%; + position: absolute; + top: 85px; + width: 100%; + margin: 0px 0px 10px 0px; + overflow: auto; +} + +.bgblue2 { + background-color: #F7F7F9; +} + +#footerElement { + position: absolute; + bottom: 0px; + margin-top: 10px; + width: 100%; + height: 20px; +} + .down { - padding-top: 20px; + padding-top: 15px; width: 315px; } @@ -126,8 +197,21 @@ text-align: right; } +#parameterPanel { + position: absolute; + float: left; + left: 0px; + top: 5%; + width: 400px; + height: 95%; +} + +td.parameter { + font-size: 0.6em; +} + .parameter { - color: #00416B; + color: #003A66; font-size: 0.8em; font-weight: bold; padding-left: 5px; @@ -138,6 +222,16 @@ .matrixHeader { padding-left: 5px; + text-align: center; +} + +.matrixSelectableHeader { + padding-left: 5px; + text-align: left; +} + +.matrixContent { + text-align: center; } .wmsvalue { @@ -161,24 +255,60 @@ color: #CD3426; font-size: 10px; font-weight: bold; - margin: 2px 2px; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; } .errormsg { - color: red; font-weight: bold; } +.chartException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.inputException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + /* ====================== Header ============================= */ -#head { - +#head { height: 25px; margin: 0; padding: 0; background-color: #103D64; } +#headline { + color: #4C7594; + font-family: "Arial Black",Arial,Helvetica,sans-serif; + font-weight: bold; + line-height: 1.1em; + padding-left: 5px; + width: 533px; +} + +.headline { + border-top: 2px solid #CCe0f4; + border-bottom: 2px solid #CCe0f4; + color: #4C7594; + /*font-weight: bold;*/ + font-size: 1.2em; + padding: 10px; +} + #logo { float:right; background-image: url( ../images/bsh_logo.gif ); @@ -191,21 +321,48 @@ } #head a { clear:left; - } + +.reload { + margin-top: 10px; +} + #project { - position:absolute; - top:27px; - left:10px; - width: 400px; + padding: 0px; text-align: left; - + font-size: 1.2em; + background-color: #e9e8f0; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 5%; +} + +#projectload { + float: left; + padding-left: 5px; + visibility: hidden; +} + +.devide { + width: 100%; + height: 2px; +} + +.projectException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; } #load_error { position:absolute; - top:27px; - left:425px; + top:175px; + left:375px; width: 400px; text-align: left; @@ -232,6 +389,12 @@ } +div#headerElement { + height: 85px; + position: absolute; + width: 100%; +} + div#header { background-color: #143B62; margin: 0; @@ -250,7 +413,7 @@ top: 0; left: 0; width: 100%; - + height: 100%; } .showContent { @@ -268,14 +431,15 @@ } div#diagram { + float: left; position: absolute; - top: 33px; - left: 350px; + top: 10%; + left: 330px; } div.outerMap { position: absolute; - top: 62px; + top: 12%; left: 350px; width: 555px; height: 436px; @@ -284,8 +448,8 @@ } div.wms { - position: relative; - top: 0px; + position: absolute; + top: 10%; left: 0px; height: 30px; border: 1px solid red; @@ -293,7 +457,7 @@ div#map { position: absolute; - top: 55px; + top: 65px; left: 0px; width: 555px; height: 381px; @@ -301,9 +465,10 @@ } div.histogram { + float: left; position: absolute; - top: 33px; - left: 350px; + top: 10%; + left: 330px; } div#export { @@ -327,9 +492,10 @@ } div.statistics { + float: left; position: absolute; - top : 33px; - left : 350px; + top: 10%; + left: 330px; width : 325px; } @@ -384,7 +550,7 @@ } div#basefilter { - margin-top: 30px; + margin-top: 50px; width: 325px; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/styles/extjs-override.css Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,35 @@ +.x-panel-header { + background: #F2F1F5; + border:1px solid #003A66; + color:#003A66; +} + +.x-border-layout-ct { + background:#F2F1F5; +} + +.x-panel-body { + border:1px solid #003A66; +} + +.x-toolbar{ + background:#F2F1F5; +} + +.x-panel-bbar .x-toolbar { + border:1px solid #003A66; +} + +.x-tool { + background:transparent url(../images/ol/tool-sprites.gif) no-repeat; +} + +.x-tree-node-expanded .x-tree-node-icon{ + background-image:url(../images/ol/folder-open.gif); +} +.x-tree-node-leaf .x-tree-node-icon{ + background-image:url(../images/ol/leaf.gif); +} +.x-tree-node-collapsed .x-tree-node-icon{ + background-image:url(../images/ol/folder.gif); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/styles/gnv.css Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,301 @@ +body { + background-color: #FFFFFF; + font-family: verdana, arial, Helvetica, sans-serif; + font-size: 0.7em; + height: 100%; + margin: 0; + padding: 0; +} + +fieldset { + margin: 5px 0 0 10px; + padding-left: 10px; + padding-right: 10px; + padding-bottom: 5px; + padding-top: 5px; + border: 1px solid #003A66; + background-color: #F2F1F5; + background-repeat: repeat-x; + background-position: top left; + display: block; +} + +legend { + border: 1px solid #003A66; + padding: 4px 5px; + margin: 0 0 0 0; + background-color: white; + font-weight: bolder; + color: #003A66; + clear: both; +} + +input { + font-family: verdana, arial, Helvetica, sans-serif; + font-size: 0.9em; +} + +select, textarea { + font-size: 0.9em; + width: 250px; +} + +img { + border: 0px; +} + +a { + color: #FF6600; + font-size: 1.2em; + text-decoration: underline; +} + +/* Some classes for the header */ +#headerElement { + float: left; + top: 0px; + width: 100%; +} + +#header { + background-color: #143B62; + margin: 0; + padding: 0; + height: 50px; +} + +#headline { + color: #4C7594; + font-family: "Arial Black",Arial,Helvetica,sans-serif; + font-weight: bold; + line-height: 1.1em; + padding-left: 5px; + width: 533px; +} + +.headline { + border-top: 2px solid #CCe0f4; + border-bottom: 2px solid #CCe0f4; + color: #4C7594; + padding: 10px; +} + +.infoheadline { + border: 0; + color: #4C7594; + font-family: "Arial Black",Arial,Helvetica,sans-serif; + padding: 0; +} + +.headerTableLinks { + width: 100%; + background-color: #003a66; +} + +.headerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 0.9em; + text-decoration:none; +} + +/* Some classes for the project load/save bar */ +#project { + background-color: #e9e8f0; + height: 5%; + left: 0px; + padding: 0px; + text-align: left; + top: 0px; + width: 100%; +} + +#projectload { + visibility: hidden; +} + +#browseDiv { + float: left; +} + +#loadDiv { + float: left; + margin-left: 5px; +} + +/* Some classes for the content */ +#contentElement { + float: left; + height: 90%; + width: 100%; + margin: 0px 0px 10px 0px; +} + +#contentRow { + vertical-align: top; +} + +.info-content { + padding-left : 15px; + padding-right: 15px; +} + +#parameterColumn { + width: 400px; +} + +#parameterPanel { + float: left; + width: 350px; +} + +.static { + background-color: #F2F1F5; + width: 300px; +} + +.parameter { + color: #003A66; + font-weight: bold; + padding-left: 5px; + text-align: left; + vertical-align: top; + width: 110px; +} + +.historyback { + padding-left: 10px; + vertical-align: top; + text-align: right; +} + +.statistics { + width: 350px; +} + +div.outerMap { + float: left; + width: 555px; + height: 436px; +} + +div.wms { + top: 10%; + left: 0px; + height: 30px; + border: 1px solid red; +} + +div#map { + top: 65px; + left: 0px; + width: 555px; + height: 381px; + border: 1px solid #CCD5DE; +} + + +/* Some classes for the footer */ +#footerElement { + clear: left; + bottom: 20px; + width: 100%; + height: 20px; +} + +.footerTable { + width: 100%; + background-color: white; +} + +.footerLine { + color: #003A66; + font-family: Arial,Helvetica,sans-serif; + line-height: 1.1em; + padding-left: 1px; +} + +.footerTableLinks { + width: 100%; + background-color: #003a66; +} + +.footerLineLinks { + color: #FFFFFF; + font-family: Arial,Helvetica,sans-serif; + font-size: 0.9em; + text-decoration:none; +} + + +/* ---------- OVERLAY ------------------------- */ +#overlay { + visibility: hidden; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + text-align: center; + z-index: 100; + background-color: white; + -moz-opacity: 0.5; + opacity: 0.5; +} + +#overlayContent { + visibility: hidden; + position: relative; + z-index: 101; + width: 300px; + margin: 150px auto; + background-color: #fff; + border: 1px solid #000; + padding: 75px; + text-align: right; + background-image: url( ../images/bsh_logo.gif ); + background-repeat: no-repeat; +} + + +/* warnings and errors */ +.projectException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.chartException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.inputException { + color: red; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.error { + color: #CD3426; + font-size: 10px; + font-weight: bold; + margin-bottom: 2px; + border: 2px solid red; + padding: 2px; +} + +.errormsg { + color: red; + font-weight: bold; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/styles/ol_style.css Fri Sep 28 12:15:21 2012 +0200 @@ -0,0 +1,69 @@ +.wmcbox { + width: 100%; + height: 480px; +} + +.olControlPanel div { + background-color: white; + float: left; + display: block; + position: relative; + left: 80px; + margin: 5px; + width: 24px; + height: 24px; +} + +.olControlPanel .olControlFeatureInfoItemActive { + width: 22px; + height: 22px; + background-image: url("../images/ol/feature_info_on.png"); +} +.olControlPanel .olControlFeatureInfoItemInactive { + width: 22px; + height: 22px; + background-image: url("../images/ol/feature_info_off.png"); +} + + +.olControlNavigationHistory { + background-image: url("../images/ol/navigation_history.png"); + background-repeat: no-repeat; + width: 22px; + height: 22px; + +} + +.olControlPanel .olControlPanItemActive { + width: 22px; + height: 22px; + background-image: url("../images/ol/pan_on.png"); +} +.olControlPanel .olControlPanItemInactive { + width: 22px; + height: 22px; + background-image: url("../images/ol/pan_off.png"); +} + +.olControlPanel .olControlZoomBoxItemActive { + width: 22px; + height: 22px; + background-image: url("../images/ol/zoom_box_on.png"); +} +.olControlPanel .olControlZoomBoxItemInactive { + width: 22px; + height: 22px; + background-image: url("../images/ol/zoom_box_off.png"); +} + +div.olControlMousePosition { + color:#003A66; + background-color: #F2F1F5; + filter: alpha(opacity=75); + opacity: 0.75 +} + +.olHandlerBoxZoomBox { + border: 2px solid #003A66; + background-color: #F2F1F5;; +}
--- a/gnv/src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,20 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + package de.intevation.gnv.action.mapviewer.parser; +import de.intevation.gnv.artifactdatabase.objects.map.Layer; +import de.intevation.gnv.artifactdatabase.objects.map.MapService; + import java.io.File; import java.io.FileInputStream; import java.io.InputStream; + import java.util.Collection; import java.util.Iterator; @@ -11,11 +23,8 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import de.intevation.gnv.artifactdatabase.objects.map.Layer; -import de.intevation.gnv.artifactdatabase.objects.map.MapService; +public class ExternalCallParserTestCase extends TestCase { -public class ExternalCallParserTestCase extends TestCase { - /** * the logger, used to log exceptions and additonaly information */ @@ -25,7 +34,7 @@ BasicConfigurator.configure(); log = Logger.getLogger(ExternalCallParserTestCase.class); } - + public ExternalCallParserTestCase() { super(); } @@ -33,7 +42,7 @@ public ExternalCallParserTestCase(String name) { super(name); } - + public void testParseExternalCall() { log.debug("Execute testParseExternalCall"); try { @@ -54,7 +63,7 @@ Iterator<MapService> it = mapServices.iterator(); MapService mapService1 = it.next(); MapService mapService2 = it.next(); - + log.debug("MapService 1"); log.debug("ID: "+mapService1.getID()); log.debug("URL: "+mapService1.getURL()); @@ -66,7 +75,7 @@ while(layerIt1.hasNext()){ log.debug(layerIt1.next().toString()); } - + log.debug("MapService 2"); log.debug("ID: "+mapService2.getID()); log.debug("URL: "+mapService2.getURL()); @@ -78,12 +87,12 @@ while(layerIt2.hasNext()){ log.debug(layerIt2.next().toString()); } - + } catch (Exception e) { log.error(e,e); fail(); } - + } }
--- a/gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,20 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.artifactdatabase.client; +import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; +import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; +import de.intevation.gnv.artifactdatabase.objects.InputParameter; + +import de.intevation.gnv.util.XSLTransformer; + import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -13,16 +25,9 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; -import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; -import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription; -import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; -import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; -import de.intevation.gnv.artifactdatabase.objects.InputParameter; -import de.intevation.gnv.util.XSLTransformer; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class ArtifactDatabaseClientTestCase extends TestCase { @@ -38,7 +43,7 @@ /** * Constructor - * + * * @param namemessage */ public ArtifactDatabaseClientTestCase(String name) { @@ -93,7 +98,7 @@ } } - } catch (ArtifactDatabaseClientException e) { + } catch (Exception e) { log.error(e, e); fail(); }
--- a/gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java Fri Sep 28 12:13:53 2012 +0200 +++ b/gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java Fri Sep 28 12:15:21 2012 +0200 @@ -1,8 +1,15 @@ -/** +/* + * Copyright (c) 2010 by Intevation GmbH * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. */ + package de.intevation.gnv.util; +import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -11,13 +18,12 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; + import org.w3c.dom.Document; -import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient; - /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + * */ public class XSLTransformerTestCase extends TestCase {