changeset 0:a1db30b33f43

Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client. http-client/trunk@1323 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 17 Feb 2011 10:31:40 +0000
parents
children c9ac6642973c
files ChangeLog LGPL.txt README bin/run.sh conf/demo-config.conf conf/log4j.properties pom.xml src/main/java/de/intevation/artifacts/httpclient/ConsoleClient.java src/main/java/de/intevation/artifacts/httpclient/exceptions/ConnectionException.java src/main/java/de/intevation/artifacts/httpclient/exceptions/NoSuchOptionException.java src/main/java/de/intevation/artifacts/httpclient/http/GNVClient.java src/main/java/de/intevation/artifacts/httpclient/http/GNVClientImpl.java src/main/java/de/intevation/artifacts/httpclient/http/response/DocumentResponseHandler.java src/main/java/de/intevation/artifacts/httpclient/http/response/ResponseHandler.java src/main/java/de/intevation/artifacts/httpclient/http/response/StreamResponseHandler.java src/main/java/de/intevation/artifacts/httpclient/http/response/StringResponseHandler.java src/main/java/de/intevation/artifacts/httpclient/objects/Artifact.java src/main/java/de/intevation/artifacts/httpclient/objects/ArtifactFactory.java src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactNamespaceContext.java src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java src/main/java/de/intevation/artifacts/httpclient/utils/Configuration.java src/main/java/de/intevation/artifacts/httpclient/utils/XFormNamespaceContext.java src/main/java/de/intevation/artifacts/httpclient/utils/XMLUtils.java src/test/java/de/intevation/artifacts/httpclient/ConsoleClientTest.java
diffstat 24 files changed, 2445 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ChangeLog	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,5 @@
+2011-02-17  Ingo Weinzierl <ingo@intevation.de>
+
+	* *: Initial checkin. This package has been copied from 'console-client'.
+	  The package structure has been modified and the maven project has been
+	  adapted.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LGPL.txt	Thu Feb 17 10:31:40 2011 +0000
@@ -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!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,49 @@
+============
+DEPENDENCIES
+============
+
+- JUnit 3.8.1
+- Log4j 1.2.14
+- Restlet 2.0-SNAPSHOT
+- Restlet-XML 2.0-SNAPSHOT
+
+
+============================
+COMPILATION AND INSTALLATION
+============================
+
+This project is based on maven2. To compile/install this client, just do:
+
+    mvn compile package
+
+The result will be an jar-archive in the ``target`` directory.
+
+If you want to use the contrib script ``run.sh`` (see below), you will need
+the jars of the dependencies as well. Therefore, just do:
+
+    mvn compile package dependency:copy-dependencies
+
+This command will compile the sources, build a jar of those and download the
+depending jar archives to ``target/dependency``.
+
+
+=============
+CONFIGURATION
+=============
+
+Currently, this client reads two configuration files:
+
+    - the artifact configuration (conf/demo-config.conf)
+    - the logging configuration (conf/log4j.properties)
+
+
+==================
+RUNNING THE CLIENT
+==================
+
+There is a bash script in the ``contrib`` directory. This might be used to
+start the console based client. Note, that you need the jars of the depending
+libraries in the ``target`` directory.
+
+    sh bin/run.sh
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/run.sh	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+DIR=`dirname $0`/..
+DIR=`readlink -f "$DIR"`
+
+CLASSPATH=
+for l in `find "$DIR/target" -name \*.jar -print`; do
+   CLASSPATH=$CLASSPATH:$l
+done
+
+export CLASSPATH
+
+exec java -Xmx256m \
+     -Djava.io.tmpdir="$DIR/cache" \
+     -Dconfig.dir="$DIR/conf" \
+     -Dconfig.file="demo-config.conf" \
+     de.intevation.bsh.consoleclient.ConsoleClient \
+     2>&1 > /dev/null
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/conf/demo-config.conf	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <artifact-server>
+        <host>http://localhost</host>
+        <port>8181</port>
+    </artifact-server>
+    <artifact>
+        <fis>fis_marnet</fis>
+        <product>Zeitserie</product>
+        <areaid>No Selection</areaid>
+        <featureid>Arkona Basin Buoy</featureid>
+        <vectorscalar>Skalare Werte</vectorscalar>
+        <parameterid>Salzgehalt  [pSal],Lufttemperatur  [degC]</parameterid>
+        <measurementid>10.0,-2.0</measurementid>
+        <minvalue>2009.09.26 10:00:00</minvalue>
+        <maxvalue>2009.12.09 04:00:00</maxvalue>
+    </artifact>
+    <output>
+        <type>chart</type>
+        <mime-type>image/png</mime-type>
+        <width>500</width>
+        <height>250</height>
+        <points>false</points>
+        <directory>./diagrams</directory>
+    </output>
+</configuration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/conf/log4j.properties	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,9 @@
+#### Log just errors and warnings to a file.
+log4j.rootLogger=DEBUG, BSH
+
+log4j.appender.BSH=org.apache.log4j.RollingFileAppender
+log4j.appender.BSH.File=./logs/console-client.log
+log4j.appender.BSH.MaxFileSize=5000KB
+log4j.appender.BSH.MaxBackupIndex=1
+log4j.appender.BSH.layout=org.apache.log4j.PatternLayout
+log4j.appender.BSH.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pom.xml	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,62 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>de.intevation.artifacts.httpclient</groupId>
+  <artifactId>http-client</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>http-client</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <repositories>
+    <repository>
+      <id>maven-restlet</id>
+      <name>Public online Restlet repository</name>
+      <url>http://maven.restlet.org</url>
+    </repository>
+  </repositories>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.14</version>
+    </dependency>
+    <dependency>
+      <groupId>org.restlet.jse</groupId>
+      <artifactId>org.restlet</artifactId>
+      <version>2.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.restlet.jse</groupId>
+      <artifactId>org.restlet.ext.xml</artifactId>
+      <version>2.0.4</version>
+    </dependency>
+  </dependencies>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/ConsoleClient.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.artifacts.httpclient;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+import java.net.MalformedURLException;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+import de.intevation.artifacts.httpclient.http.GNVClient;
+import de.intevation.artifacts.httpclient.http.GNVClientImpl;
+import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
+
+import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
+import de.intevation.artifacts.httpclient.exceptions.NoSuchOptionException;
+import de.intevation.artifacts.httpclient.objects.Artifact;
+import de.intevation.artifacts.httpclient.utils.ArtifactProtocolUtils;
+import de.intevation.artifacts.httpclient.utils.Configuration;
+import de.intevation.artifacts.httpclient.utils.XFormNamespaceContext;
+import de.intevation.artifacts.httpclient.utils.XMLUtils;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ConsoleClient
+{
+    /**
+     * The logging is done via Log4j. To configure the logging
+     * a file 'log4j.properties' is search in the configuration directory.
+     */
+    public static final String LOG4J_PROPERTIES = "log4j.properties";
+
+
+    /**
+     * The path of the configuration directory.
+     */
+    public static final String CONFIG_PATH = System.getProperty("config.dir",
+                                                                "conf");
+
+    public static final String CONFIG = System.getProperty("config.file",
+                                                           "use_case1.conf");
+
+
+    public static final String XPATH_DYNAMIC = "/art:result/art:ui/art:dynamic";
+
+    /**
+     * The logger used in this class.
+     */
+    private static Logger logger;
+
+
+    static {
+        configureLogging();
+
+        logger = Logger.getLogger(ConsoleClient.class);
+    }
+
+
+    /**
+     * Trys to load the Log4j configuration from ${config.dir}/log4j.properties.
+     */
+    public static final void configureLogging() {
+        File configDir = new File(CONFIG_PATH);
+        File propFile  = new File(configDir, LOG4J_PROPERTIES);
+
+        if (propFile.isFile() && propFile.canRead()) {
+            try {
+                PropertyConfigurator.configure(propFile.toURI().toURL());
+            }
+            catch (MalformedURLException mue) {
+                mue.printStackTrace(System.err);
+            }
+        }
+    }
+
+
+    public static final Configuration readConfiguration() {
+        File configDir  = new File(CONFIG_PATH);
+        File configFile = new File(configDir, CONFIG);
+
+        logger.debug("Configuration file: " + configFile.getAbsolutePath());
+
+        if (configFile.isFile() && configFile.canRead()) {
+            try {
+                Configuration conf = new Configuration(configFile);
+                conf.initialize();
+
+                return conf;
+            }
+            catch (IOException ioe) {
+                logger.error("Error while reading configuration.");
+            }
+        }
+
+        return null;
+    }
+
+
+    public static void main( String[] args )
+    {
+        logger.info("Starting GNV console client.");
+
+        Configuration conf = readConfiguration();
+
+        String serverHost  = (String) conf.getServerSettings("host");
+        String serverPort  = (String) conf.getServerSettings("port");
+        GNVClient client   = new GNVClientImpl(serverHost + ":" + serverPort);
+
+        try {
+            Document create = ArtifactProtocolUtils.createCreateDocument(
+                (String) conf.getArtifactSettings("fis"));
+            Artifact artifact = client.create(create);
+
+            Map attr       = new HashMap();
+            String   product  = (String) conf.getArtifactSettings("product");
+            String[] products = extractOptions(client, artifact, product);
+            attr.put("product", products[0]);
+
+            feedAndGo(client, artifact, attr, "timeSeries");
+
+            attr.clear();
+            String   area  = (String) conf.getArtifactSettings("areaid");
+            String[] areas = extractOptions(client, artifact, area);
+            attr.put("areaid", areas[0]);
+            feedAndGo(client, artifact, attr, "timeseries_without_geom");
+
+            attr.clear();
+            String   feature  = (String) conf.getArtifactSettings("featureid");
+            String[] features = extractOptions(client, artifact, feature);
+            attr.put("featureid", features[0]);
+            feedAndGo(client, artifact, attr, "timeseries_vector_scalar");
+
+            attr.clear();
+            String   vector  = (String) conf.getArtifactSettings("vectorscalar");
+            String[] vectors = extractOptions(client, artifact, vector);
+            attr.put("vectorscalar", vectors[0]);
+            feedAndGo(client, artifact, attr, "timeseries_parameter");
+
+            attr.clear();
+            String   parameter  = (String) conf.getArtifactSettings("parameterid");
+            String[] parameters = extractOptions(client, artifact, parameter);
+            attr.put("parameterid", parameters);
+            feedAndGo(client, artifact, attr, "timeseries_depth_height");
+
+            attr.clear();
+            String   measure  = (String) conf.getArtifactSettings("measurementid");
+            String[] measures = extractMeasurements(client, artifact, measure);
+            attr.put("measurementid", measures);
+            feedAndGo(client, artifact, attr, "timeseries_interval");
+
+            attr.clear();
+            String min = (String) conf.getArtifactSettings("minvalue");
+            String max = (String) conf.getArtifactSettings("maxvalue");
+            attr.put("minvalue", min);
+            attr.put("maxvalue", max);
+            feedAndGo(client, artifact, attr, "timeseries_calculate_results");
+
+            try {
+                Map opts = new HashMap();
+                opts.put("mime-type", conf.getOutputSettings("mime-type"));
+                opts.put("width", conf.getOutputSettings("width"));
+                opts.put("height", conf.getOutputSettings("height"));
+                opts.put("points", conf.getOutputSettings("points"));
+
+                Document chart =
+                    ArtifactProtocolUtils.createChartDocument(artifact, opts);
+
+                String dir = (String) conf.getOutputSettings("directory");
+
+                File outDir     = new File(dir);
+                File output     = new File(outDir, "output.png");
+                OutputStream os = new FileOutputStream(output);
+
+                client.out(artifact, chart, "chart", os);
+            }
+            catch (IOException ioe) {
+                logger.error(
+                    "IO error while writing the output: " + ioe.getMessage());
+            }
+
+            logger.debug("Finished GNV console client.");
+        }
+        catch (ConnectionException ce) {
+            logger.error(ce.getMessage());
+        }
+        catch (NoSuchOptionException nsoe) {
+            logger.error(
+                "No such option found: " + nsoe.getMessage());
+        }
+    }
+
+
+    public static void feedAndGo(
+        GNVClient client,
+        Artifact  artifact,
+        Map       attr,
+        String target)
+    throws ConnectionException
+    {
+        Document feed = ArtifactProtocolUtils.createFeedDocument(artifact, attr);
+        client.feed(artifact, feed, new DocumentResponseHandler());
+
+        Document advance = ArtifactProtocolUtils.createAdvanceDocument(
+            artifact,
+            target);
+
+        client.advance(artifact, advance, new DocumentResponseHandler());
+    }
+
+
+    /**
+     * XXX I think, this method should be implemented somewhere else to be able
+     * to re-use this implementation. But this method needs more work to be more
+     * abstract, so it needs to be reimplemented later, I think.
+     */
+    public static String[] extractOptions(
+        GNVClient client,
+        Artifact  artifact,
+        String    text)
+    throws NoSuchOptionException, ConnectionException
+    {
+        Document describe = ArtifactProtocolUtils.createDescribeDocument(
+            artifact, true);
+
+        Document description = (Document) client.describe(
+            artifact, describe, new DocumentResponseHandler());
+
+        List pieces  = Arrays.asList(text.split(","));
+        List options = new ArrayList(pieces.size()); 
+
+        Node dynamic   = XMLUtils.getNodeXPath(description, XPATH_DYNAMIC);
+
+        // TODO We should handle these cases better!!
+        NodeList items = (NodeList) XMLUtils.getXPath(
+            dynamic, "xform:select1/xform:choices/xform:item",
+            XPathConstants.NODESET, XFormNamespaceContext.INSTANCE);
+
+        if (items == null || items.getLength() == 0) {
+            items = (NodeList) XMLUtils.getXPath(
+                dynamic, "xform:select/xform:choices/xform:item",
+                XPathConstants.NODESET, XFormNamespaceContext.INSTANCE);
+        }
+
+        if (items == null || items.getLength() == 0) {
+            items = (NodeList) XMLUtils.getXPath(
+                dynamic, "xform:group/xform:select/xform:item",
+                XPathConstants.NODESET, XFormNamespaceContext.INSTANCE);
+        }
+
+
+        for (int i = 0; i < items.getLength(); i++) {
+            Node item  = items.item(i);
+            Node label = (Node) XMLUtils.getXPath(
+                item, "xform:label", XPathConstants.NODE,
+                XFormNamespaceContext.INSTANCE);
+
+            Node value = (Node) XMLUtils.getXPath(
+                item, "xform:value", XPathConstants.NODE,
+                XFormNamespaceContext.INSTANCE);
+
+            if (pieces.indexOf(label.getTextContent()) >= 0)
+                options.add(value.getTextContent());
+        }
+
+        if (options.isEmpty())
+            throw new NoSuchOptionException(text);
+
+        return (String[]) options.toArray(new String[options.size()]);
+    }
+
+
+    /**
+     * XXX This method extracts the measurement ids depending on the user
+     * configuration from describe document. Currently, this is a special case
+     * that should be handled the same way as all the other options in the
+     * describe document.
+     */
+    public static String[] extractMeasurements(
+        GNVClient client,
+        Artifact  artifact,
+        String    text)
+    throws NoSuchOptionException, ConnectionException
+    {
+        Document describe = ArtifactProtocolUtils.createDescribeDocument(
+            artifact, true);
+
+        Document description = (Document) client.describe(
+            artifact, describe, new DocumentResponseHandler());
+
+        List pieces  = Arrays.asList(text.split(","));
+        List options = new ArrayList(pieces.size());
+
+        Node dynamic = XMLUtils.getNodeXPath(description, XPATH_DYNAMIC);
+
+        NodeList params = (NodeList) XMLUtils.getXPath(
+            dynamic, "xform:group/xform:select",
+            XPathConstants.NODESET, XFormNamespaceContext.INSTANCE);
+
+        for (int i = 0; i < params.getLength(); i++) {
+            Node param = params.item(i);
+
+            NodeList items = (NodeList) XMLUtils.getXPath(
+                param, "xform:item[@disabled='false']", XPathConstants.NODESET,
+                XFormNamespaceContext.INSTANCE);
+
+            for (int j = 0; j < items.getLength(); j++) {
+                Node item = items.item(j);
+
+                Node label = (Node) XMLUtils.getXPath(
+                    item, "xform:label", XPathConstants.NODE,
+                    XFormNamespaceContext.INSTANCE);
+
+                if (pieces.indexOf(label.getTextContent()) < 0) {
+                    continue;
+                }
+
+                Node value = (Node) XMLUtils.getXPath(
+                    item, "xform:value", XPathConstants.NODE,
+                    XFormNamespaceContext.INSTANCE);
+
+                options.add(value.getTextContent());
+            }
+        }
+
+        if (options.isEmpty())
+            throw new NoSuchOptionException(text);
+
+        return (String[]) options.toArray(new String[options.size()]);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/exceptions/ConnectionException.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient.exceptions;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ConnectionException extends IOException {
+
+    public ConnectionException(String msg) {
+        super(msg);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/exceptions/NoSuchOptionException.java	Thu Feb 17 10:31:40 2011 +0000
@@ -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.
+ */
+package de.intevation.artifacts.httpclient.exceptions;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class NoSuchOptionException extends Exception {
+
+    public NoSuchOptionException(String msg) {
+        super(msg);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/GNVClient.java	Thu Feb 17 10:31:40 2011 +0000
@@ -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.artifacts.httpclient.http;
+
+import java.io.OutputStream;
+
+import org.w3c.dom.Document;
+
+import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
+import de.intevation.artifacts.httpclient.http.response.ResponseHandler;
+import de.intevation.artifacts.httpclient.objects.Artifact;
+import de.intevation.artifacts.httpclient.objects.ArtifactFactory;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface GNVClient {
+
+    ArtifactFactory[] getArtifactFactories()
+    throws ConnectionException;
+
+    Artifact create(Document createDocument)
+    throws ConnectionException;
+
+    Object describe(
+        Artifact        artifact,
+        Document        describeDocument,
+        ResponseHandler handler)
+    throws ConnectionException;
+
+    Object feed(Artifact artifact, Document feedDocument, ResponseHandler handler)
+    throws ConnectionException;
+
+    Object advance(
+        Artifact        artifact,
+        Document        advanceDocument,
+        ResponseHandler handler)
+    throws ConnectionException;
+
+    void out(
+        Artifact     artifact,
+        Document     outDocument,
+        String       target,
+        OutputStream out)
+    throws ConnectionException;
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/GNVClientImpl.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+package de.intevation.artifacts.httpclient.http;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.restlet.Client;
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.data.MediaType;
+import org.restlet.data.Method;
+import org.restlet.data.Protocol;
+import org.restlet.data.Status;
+import org.restlet.ext.xml.DomRepresentation;
+import org.restlet.representation.Representation;
+
+import org.w3c.dom.Document;
+
+import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
+import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
+import de.intevation.artifacts.httpclient.http.response.ResponseHandler;
+import de.intevation.artifacts.httpclient.http.response.StreamResponseHandler;
+import de.intevation.artifacts.httpclient.objects.Artifact;
+import de.intevation.artifacts.httpclient.objects.ArtifactFactory;
+import de.intevation.artifacts.httpclient.utils.ArtifactProtocolUtils;
+import de.intevation.artifacts.httpclient.utils.XMLUtils;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class GNVClientImpl implements GNVClient {
+
+    private static final Logger logger = Logger.getLogger(GNVClient.class);
+
+    private String serverUrl;
+
+
+    public GNVClientImpl(String serverUrl) {
+        this.serverUrl = serverUrl;
+    }
+
+
+    @Override
+    public ArtifactFactory[] getArtifactFactories()
+    throws ConnectionException
+    {
+        ResponseHandler handler = new DocumentResponseHandler();
+
+        try {
+            String    url   = serverUrl + "/factories";
+            Document result = (Document) handler.handle(doGet(url));
+
+            return ArtifactProtocolUtils.extractArtifactFactories(result);
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed. No Factories recieved.");
+        }
+    }
+
+
+    @Override
+    public Artifact create(Document doc) throws ConnectionException {
+        ResponseHandler handler = new DocumentResponseHandler();
+
+        try {
+            String   url    = serverUrl + "/create";
+            Document result = (Document) handler.handle(doPost(url, doc));
+
+            return ArtifactProtocolUtils.extractArtifact(result);
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed. No Artifact created.");
+        }
+    }
+
+
+    @Override
+    public Object describe(
+        Artifact        artifact,
+        Document        doc,
+        ResponseHandler handler)
+    throws ConnectionException
+    {
+        try {
+            String   url    = serverUrl + "/artifact/" + artifact.getUuid();
+            return handler.handle(doPost(url, doc));
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed: " + ioe.getMessage());
+        }
+    }
+
+
+    @Override
+    public Object feed(Artifact artifact, Document doc, ResponseHandler handler)
+    throws ConnectionException
+    {
+        try {
+            String   url    = serverUrl + "/artifact/" + artifact.getUuid();
+            Document result = (Document) handler.handle(doPost(url, doc));
+
+            return result;
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed: " + ioe.getMessage());
+        }
+    }
+
+
+    @Override
+    public Object advance(Artifact artifact, Document doc, ResponseHandler handler)
+    throws ConnectionException
+    {
+        try {
+            String   url    = serverUrl + "/artifact/" + artifact.getUuid();
+            Document result = (Document) handler.handle(doPost(url, doc));
+
+            return result;
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed: " + ioe.getMessage());
+        }
+    }
+
+
+    @Override
+    public void out(
+        Artifact     artifact,
+        Document     doc,
+        String       target,
+        OutputStream out)
+    throws ConnectionException
+    {
+        try {
+            String url =
+                serverUrl
+                + "/artifact/"
+                + artifact.getUuid()
+                + "/" + target;
+
+            ResponseHandler handler = new StreamResponseHandler();
+
+            InputStream stream = (InputStream) handler.handle(doPost(url, doc));
+
+            byte[] b = new byte[4096];
+            int i = -1;
+            while ((i = stream.read(b)) > 0) {
+                out.write(b, 0, i);
+            }
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed: " + ioe.getMessage());
+        }
+    }
+
+
+    private Response doPost(String url, Document body) throws IOException {
+        logger.info("Start HTTP-POST request to: "+ url);
+
+        Client client   = new Client(Protocol.HTTP);
+        Request request = new Request(Method.POST, url);
+
+        Representation representation = new DomRepresentation(
+            MediaType.APPLICATION_XML,
+            body);
+
+        request.setEntity(representation);
+        Response response = client.handle(request);
+
+        Status status = response.getStatus();
+        if (status.getCode() != 200) {
+            logger.error("Response status: " + status.getCode());
+            throw new IOException(status.getDescription());
+        }
+
+        return response;
+    }
+
+
+    private Response doGet(String url) throws IOException {
+        logger.info("Start HTTP-POST request to: "+ url);
+
+        Client client   = new Client(Protocol.HTTP);
+        Request request = new Request(Method.GET, url);
+
+        Response response = client.handle(request);
+
+        Status status = response.getStatus();
+        if (status.getCode() != 200) {
+            logger.error("Response status: " + status.getCode());
+            throw new IOException(status.getDescription());
+        }
+
+        return response;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/response/DocumentResponseHandler.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient.http.response;
+
+import java.io.IOException;
+
+import org.restlet.Response;
+import org.restlet.representation.Representation;
+
+import de.intevation.artifacts.httpclient.utils.XMLUtils;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DocumentResponseHandler implements ResponseHandler {
+
+    public DocumentResponseHandler() {
+    }
+
+    public Object handle(Response response) throws IOException {
+        Representation output = response.getEntity();
+        return XMLUtils.readDocument(output.getStream());
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/response/ResponseHandler.java	Thu Feb 17 10:31:40 2011 +0000
@@ -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.artifacts.httpclient.http.response;
+
+import java.io.IOException;
+
+import org.restlet.Response;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface ResponseHandler {
+
+    Object handle(Response response) throws IOException;
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/response/StreamResponseHandler.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient.http.response;
+
+import java.io.IOException;
+
+import org.restlet.Response;
+import org.restlet.representation.Representation;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class StreamResponseHandler implements ResponseHandler {
+
+    public StreamResponseHandler() {
+    }
+
+    public Object handle(Response response) throws IOException {
+        Representation output = response.getEntity();
+        return output.getStream();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/response/StringResponseHandler.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient.http.response;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.restlet.Response;
+import org.restlet.representation.Representation;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class StringResponseHandler extends StreamResponseHandler {
+
+    public StringResponseHandler() {
+    }
+
+    public Object handle(Response response) throws IOException {
+        InputStream  in  = (InputStream) super.handle(response);
+        OutputStream out = new ByteArrayOutputStream();
+
+        byte[] b = new byte[4096];
+        int i = -1;
+        while ((i = in.read(b)) > 0) {
+            out.write(b, 0, i);
+        }
+        out.close();
+
+        return out.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/src/main/java/de/intevation/artifacts/httpclient/objects/Artifact.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient.objects;
+
+/**
+ * An <code>ArtifactObject</code> representing an artifact.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ *
+ */
+public class Artifact {
+
+    /**
+     * The uuid of this Artifact which must be used to identify 
+     * the artifact at the <code>ArtifactDatabase</code>.
+     */
+    private String uuid = null;
+
+    /**
+     * The hash of the artifact which was send be the <code>ArtifactDatabase</code>.
+     */
+    private String hash = null;
+
+    /**
+     * 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.uuid = uuid;
+        this.hash = hash;
+    }
+
+    public String getHash() {
+        return this.hash;
+    }
+
+    public String getUuid() {
+        return this.uuid;
+    }
+}
+// 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/src/main/java/de/intevation/artifacts/httpclient/objects/ArtifactFactory.java	Thu Feb 17 10:31:40 2011 +0000
@@ -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.
+ */
+
+package de.intevation.artifacts.httpclient.objects;
+
+
+public class ArtifactFactory {
+
+    private String name;
+    private String description;
+
+    public ArtifactFactory(String name, String description) {
+        this.name        = name;
+        this.description = description;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+
+    public String getDescription() {
+        return description;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactNamespaceContext.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.artifacts.httpclient.utils;
+
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+
+/**
+ * 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
+{
+    /**
+     * The URI of the namespace of the artifacts.
+     */
+    public final static String NAMESPACE_URI = "http://www.intevation.de/2009/artifacts";
+
+    /**
+     * The XML prefix for the artifacts namespace.
+     */
+    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() {
+    }
+
+    public String getNamespaceURI(String prefix) {
+
+        if (prefix == null) {
+            throw new NullPointerException("Null prefix");
+        }
+
+        if (NAMESPACE_PREFIX.equals(prefix)) {
+            return NAMESPACE_URI;
+        }
+
+        if ("xml".equals(prefix)) {
+            return XMLConstants.XML_NS_URI;
+        }
+
+        return XMLConstants.NULL_NS_URI;
+    }
+
+    public String getPrefix(String uri) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Iterator getPrefixes(String uri) {
+        throw new UnsupportedOperationException();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+package de.intevation.artifacts.httpclient.utils;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+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 org.w3c.dom.NodeList;
+
+import de.intevation.artifacts.httpclient.objects.Artifact;
+import de.intevation.artifacts.httpclient.objects.ArtifactFactory;
+
+public class ArtifactProtocolUtils {
+
+    private static final Logger logger =
+        Logger.getLogger(ArtifactProtocolUtils.class);
+
+
+    public static ArtifactFactory[] extractArtifactFactories(Document doc) {
+        NodeList elements = (NodeList) XMLUtils.getXPath(
+            doc,
+            "/art:result/art:factories/art:factory",
+            XPathConstants.NODESET,
+            ArtifactNamespaceContext.INSTANCE);
+
+        if (elements == null || elements.getLength() == 0) {
+            return null;
+        }
+
+        ArtifactFactory[] facs = new ArtifactFactory[elements.getLength()];
+
+        for (int idx = 0; idx < elements.getLength(); idx++) {
+            Node factory = elements.item(idx);
+            String desc  = XMLUtils.getStringXPath(factory, "@art:description");
+            String name  = XMLUtils.getStringXPath(factory, "@art:name");
+
+            if (name != null) {
+                facs[idx] = new ArtifactFactory(name, desc);
+            }
+        }
+
+        return facs;
+    }
+
+
+    public static Document createCreateDocument(String fis) {
+        Document document = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element action = creator.create("action");
+
+        Element type = creator.create("type");
+        type.setAttribute("name", "create");
+
+        Element factory = creator.create("factory");
+        factory.setAttribute("name", fis);
+
+        action.appendChild(type);
+        action.appendChild(factory);
+        document.appendChild(action);
+
+        return document;
+    }
+
+
+    /**
+     * 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.
+     */
+    public static Artifact extractArtifact(Document document) {
+        String uuid = XMLUtils.getStringXPath(
+            document,
+            "/art:result/art:uuid/@value");
+
+        String hash = XMLUtils.getStringXPath(
+            document,
+            "/art:result/art:hash/@value");
+
+        logger.info("NEW Artifact: " + uuid + " / " + hash);
+        return new Artifact(uuid, hash);
+    }
+
+
+    private static Element createArtifactAction(
+        XMLUtils.ElementCreator creator,
+        Artifact                artifact,
+        String                  artifactAction)
+    {
+        Element action = creator.create("action");
+
+        Element type = creator.create("type");
+        type.setAttribute("name", artifactAction);
+
+        Element uuid = creator.create("uuid");
+        uuid.setAttribute("value", artifact.getUuid());
+
+        Element hash = creator.create("hash");
+        hash.setAttribute("value", artifact.getHash());
+
+        action.appendChild(type);
+        action.appendChild(uuid);
+        action.appendChild(hash);
+
+        return action;
+    }
+
+
+    public static Document createFeedDocument(Artifact artifact, Map attr) {
+        Document document = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element action = createArtifactAction(creator, artifact, "feed");
+        Element data   = creator.create("data");
+
+        Set keys      = attr.keySet();
+        Iterator iter = keys.iterator();
+        while (iter.hasNext()) {
+            String key    = (String) iter.next();
+            Object values = attr.get(key);
+
+            if (values instanceof Object[]) {
+                appendInputNodes(creator, data, key, (Object[]) values);
+            }
+            else {
+                appendInputNodes(creator, data, key, values);
+            }
+
+        }
+
+        action.appendChild(data);
+        document.appendChild(action);
+
+        return document;
+    }
+
+
+    private static void appendInputNodes(
+        XMLUtils.ElementCreator creator,
+        Element                 root,
+        String                  key,
+        Object                  value)
+    {
+        Element input = creator.create("input");
+        input.setAttribute("name", key);
+        input.setAttribute("value", (String) value);
+        root.appendChild(input);
+    }
+
+
+    private static void appendInputNodes(
+        XMLUtils.ElementCreator creator,
+        Element                 root,
+        String                  key,
+        Object[]                values)
+    {
+        for (Object value: values) {
+            Element input = creator.create("input");
+            input.setAttribute("name", key);
+            input.setAttribute("value", (String) value);
+            root.appendChild(input);
+        }
+    }
+
+
+    public static Document createDescribeDocument(Artifact art, boolean ui) {
+        Document document = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element action    = createArtifactAction(creator, art, "describe");
+        Element includeUi = creator.create("include-ui");
+        includeUi.setTextContent(String.valueOf(ui));
+
+        action.appendChild(includeUi);
+        document.appendChild(action);
+
+        return document;
+    }
+
+
+    public static Document createAdvanceDocument(Artifact art, String target) {
+        Document document = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element action    = createArtifactAction(creator, art, "advance");
+        Element targetEle = creator.create("target");
+        targetEle.setAttribute("name", target);
+
+        action.appendChild(targetEle);
+        document.appendChild(action);
+
+        return document;
+    }
+
+
+    public static Document createChartDocument(Artifact artifact, Map opts) {
+        Document document = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element action = createArtifactAction(creator, artifact, "out");
+        Element out    = creator.create("out");
+        out.setAttribute("name", "chart");
+
+        Element export = creator.create("export");
+        export.setAttribute("name", "img");
+
+        Element mimetype = creator.create("mime-type");
+        export.setAttribute("value", (String) opts.get("mime-type"));
+
+        Element params = creator.create("params");
+
+        Element width = creator.create("input");
+        width.setAttribute("name", "width");
+        width.setAttribute("value", (String) opts.get("width"));
+
+        Element height = creator.create("input");
+        height.setAttribute("name", "height");
+        height.setAttribute("value", (String) opts.get("height"));
+
+        Element points = creator.create("input");
+        points.setAttribute("name", "points");
+        points.setAttribute("value", (String) opts.get("points"));
+
+        params.appendChild(width);
+        params.appendChild(height);
+        params.appendChild(points);
+
+        out.appendChild(export);
+        out.appendChild(mimetype);
+        out.appendChild(params);
+
+        action.appendChild(out);
+        document.appendChild(action);
+
+        return document;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/utils/Configuration.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+package de.intevation.artifacts.httpclient.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class Configuration {
+
+    private static final Logger logger = Logger.getLogger(Configuration.class);
+
+    private File config;
+
+    private Map serverSettings;
+    private Map artifactSettings;
+    private Map outputSettings;
+
+    public static final String XPATH_SERVER = "/configuration/artifact-server";
+    public static final String XPATH_ARTIFACT = "/configuration/artifact";
+    public static final String XPATH_OUTPUT = "/configuration/output";
+
+
+    public Configuration(File config) {
+        this.config      = config;
+        serverSettings   = new HashMap();
+        artifactSettings = new HashMap();
+        outputSettings   = new HashMap();
+    }
+
+
+    public void initialize()
+    throws IOException
+    {
+        Document conf = XMLUtils.readDocument(new FileInputStream(config));
+
+        if (conf == null) {
+            throw new IOException("Can't read config: " + config.getName());
+        }
+
+        readServerSettings(conf);
+        readArtifactSettings(conf);
+        readOutputSettings(conf);
+    }
+
+
+    private void readServerSettings(Document document)
+    throws IOException
+    {
+        Node serverNode = XMLUtils.getNodeXPath(document, XPATH_SERVER);
+
+        if (serverNode == null) {
+            throw new IOException("No server configuration found.");
+        }
+
+        serverSettings = extractSettings(serverSettings, serverNode);
+    }
+
+
+    private void readArtifactSettings(Document document)
+    throws IOException
+    {
+        Node artifactNode = XMLUtils.getNodeXPath(document, XPATH_ARTIFACT);
+
+        if (artifactNode == null) {
+            throw new IOException("No artifact configuration found.");
+        }
+
+        artifactSettings = extractSettings(artifactSettings, artifactNode);
+    }
+
+
+    private void readOutputSettings(Document document)
+    throws IOException
+    {
+        Node outputNode = XMLUtils.getNodeXPath(document, XPATH_OUTPUT);
+
+        if (outputNode == null) {
+            throw new IOException("No output configuration found.");
+        }
+
+        outputSettings = extractSettings(outputSettings, outputNode);
+    }
+
+
+    private Map extractSettings(Map settings, Node node) {
+        NodeList children = node.getChildNodes();
+
+        for (int i = 0; i < children.getLength(); i++) {
+            Node child = children.item(i);
+            if (child.getNodeType() == Node.ELEMENT_NODE)
+                logger.debug(child.getNodeName() + "|" + child.getTextContent());
+                settings.put(child.getNodeName(), child.getTextContent());
+        }
+
+        return settings;
+    }
+
+
+    public Object getServerSettings(String key) {
+        return serverSettings.get(key);
+    }
+
+
+    public Object getArtifactSettings(String key) {
+        return artifactSettings.get(key);
+    }
+
+
+    public Object getOutputSettings(String key) {
+        return outputSettings.get(key);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/utils/XFormNamespaceContext.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient.utils;
+
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+
+/**
+ * The namespacecontext object used in xml documents retrieved by the artifact
+ * server.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation">Ingo Weinzierl</a>
+ */
+public class XFormNamespaceContext
+implements   NamespaceContext
+{
+    public final static String NAMESPACE_URI = "http://www.w3.org/2002/xforms";
+
+    public final static String NAMESPACE_PREFIX = "xform";
+
+    public static final XFormNamespaceContext INSTANCE =
+        new XFormNamespaceContext();
+
+    /**
+     * Constructor
+     */
+    public XFormNamespaceContext() {
+    }
+
+    public String getNamespaceURI(String prefix) {
+
+        if (prefix == null) {
+            throw new NullPointerException("Null prefix");
+        }
+
+        if (NAMESPACE_PREFIX.equals(prefix)) {
+            return NAMESPACE_URI;
+        }
+
+        if ("xml".equals(prefix)) {
+            return XMLConstants.XML_NS_URI;
+        }
+
+        return XMLConstants.NULL_NS_URI;
+    }
+
+    public String getPrefix(String uri) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Iterator getPrefixes(String uri) {
+        throw new UnsupportedOperationException();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/utils/XMLUtils.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.artifacts.httpclient.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringBufferInputStream;
+import java.io.StringWriter;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+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.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * This class provides many helper-Methods for handling different kinds of 
+ * XML-stuff.
+ * @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 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);
+            attr.setPrefix(prefix);
+            element.setAttributeNode(attr);
+        }
+    } // class ElementCreator
+
+    /**
+     * Creates a new document.
+     * @return the new document
+     */
+    public static Document newDocument() {
+        try {
+            return DocumentBuilderFactory.newInstance().newDocumentBuilder()
+                    .newDocument();
+        } catch (ParserConfigurationException pce) {
+            logger.error(pce.getLocalizedMessage(), pce);
+        }
+        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();
+        if (namespaceContext != null) {
+            xpath.setNamespaceContext(namespaceContext);
+        }
+        return xpath;
+    }
+
+    /**
+     * 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 = 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);
+    }
+
+    /**
+     * 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 {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
+                    .newInstance();
+            docBuilderFactory.setNamespaceAware(true);
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            returnValue = docBuilder.parse(inputStream);
+        } catch (ParserConfigurationException e) {
+            logger.error(e, e);
+        } catch (SAXException e) {
+            logger.error(e, e);
+        } catch (IOException e) {
+            logger.error(e, e);
+        }
+        return returnValue;
+    }
+
+    /**
+     * 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:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/artifacts/httpclient/ConsoleClientTest.java	Thu Feb 17 10:31:40 2011 +0000
@@ -0,0 +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.artifacts.httpclient;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple ConsoleClient.
+ */
+public class ConsoleClientTest
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public ConsoleClientTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( ConsoleClientTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testConsoleClient()
+    {
+        assertTrue( true );
+    }
+}

http://dive4elements.wald.intevation.org