diff artifact-database/src/main/java/de/intevation/artifactdatabase/rest/BaseResource.java @ 88:69c84cf7c5d7

Added javadoc to the REST package of the artifact database (complete). artifacts/trunk@840 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 26 Mar 2010 15:05:11 +0000
parents b2e0cb83631c
children e27cf9c84eb8
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/BaseResource.java	Fri Mar 26 11:40:28 2010 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/BaseResource.java	Fri Mar 26 15:05:11 2010 +0000
@@ -21,6 +21,8 @@
 import de.intevation.artifactdatabase.DefaultPreferredLocale;
 
 /**
+ * Base class for the resources of REST interface of the artifact database.
+ * Primarily used to unify the logging.
  * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a>
  */
 public class BaseResource
@@ -28,9 +30,24 @@
 {
     private static Logger logger = Logger.getLogger(BaseResource.class);
 
+    /**
+     * Default constructor.
+     */
     public BaseResource() {
     }
 
+    /**
+     * Overrides the post method of ServerResource to handle some
+     * exceptions and to the required logging.
+     * The call bridges to #innerPost(Representation) which
+     * should be overwitten by the subclasses to do the real
+     * request processing.
+     * @param requestRepr The incoming represention of the HTTP request.
+     * @return The representation produced by #innerPost(Representation).
+     * @throws ResourceException Thrown if something went wrong during
+     * request processing.
+     */
+    @Override
     protected Representation post(Representation requestRepr)
     throws    ResourceException
     {
@@ -46,12 +63,30 @@
         }
     }
 
+    /**
+     * Trivial implementation of innerPost() which is called by
+     * #post(Representation) which simply calls super.post(Representation).
+     * This should be overwritten by subclasses which need POST support.
+     * @param requestRepr The incoming representation of the request.
+     * @return The representation produced by super.post(Representation).
+     * @throws ResourceException Thrown if something went wrong during
+     * request processing.
+     */
     protected Representation innerPost(Representation requestRepr)
     throws    ResourceException
     {
         return super.post(requestRepr);
     }
 
+    /**
+     * Wrapper around get() of the super class to handle some exceptions
+     * and do the corresponing logging. The call is bridged to #innerGet()
+     * which should be overwritten by subclasses.
+     * @return The representation produced by #innerGet()
+     * @throws ResourceException Thrown if something went wrong during
+     * request processing.
+     */
+    @Override
     protected Representation get()
     throws    ResourceException
     {
@@ -67,12 +102,25 @@
         }
     }
 
+    /**
+     * Trivial implementaion of innerGet() which simply calls
+     * super.get() to produce some output representation. This method
+     * should be overwritten by subclasses which need GET support.
+     * @return The representation produced by super.get().
+     * @throws ResourceException Thrown if something went wrong during
+     * request processing.
+     */
     protected Representation innerGet()
     throws    ResourceException
     {
         return super.get();
     }
 
+    /**
+     * Returns meta information (preferred languages et. al.)
+     * of the current HTTP request.
+     * @return the meta information
+     */
     protected CallMeta getCallMeta() {
         ClientInfo clientInfo = getClientInfo();
 
@@ -92,4 +140,4 @@
         return new DefaultCallMeta(languages);
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org