diff gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java @ 38:fccf90761825

Format Code to max 80 Chars per Row better Formatter choosen gnv/trunk@174 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 02 Oct 2009 09:10:36 +0000
parents ad381cc47217
children 23a4f196d7d6
line wrap: on
line diff
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Fri Oct 02 08:55:23 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Fri Oct 02 09:10:36 2009 +0000
@@ -83,7 +83,7 @@
      * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#getArtifactFactories()
      */
     public Collection<ArtifactObject> getArtifactFactories()
-            throws ArtifactDatabaseClientException {
+                                                            throws ArtifactDatabaseClientException {
         Collection<ArtifactObject> resultValues = null;
         if (!initialized) {
             this.initialize();
@@ -109,7 +109,7 @@
     }
 
     private Collection<ArtifactObject> getArtifactFactories(Document document,
-            String server) {
+                                                            String server) {
         XMLUtils xmlUtils = new XMLUtils();
         NodeList artifactFactories = xmlUtils.getNodeSetXPath(document,
                 "/result/factories/factory");
@@ -134,7 +134,7 @@
      * @throws IOException
      */
     private Document doGetRequest(String requestUrl) throws IOException,
-            ArtifactDatabaseClientException {
+                                                    ArtifactDatabaseClientException {
         return this.doGetRequest(requestUrl, null);
     }
 
@@ -142,7 +142,8 @@
      * @throws IOException
      */
     private Document doGetRequest(String requestUrl, Document requestBody)
-            throws IOException, ArtifactDatabaseClientException {
+                                                                          throws IOException,
+                                                                          ArtifactDatabaseClientException {
         XMLUtils xmlUtils = new XMLUtils();
         Representation output = doGetRequestInternal(requestUrl, requestBody);
         Document document = xmlUtils.readDocument(output.getStream());
@@ -156,7 +157,7 @@
      * @return
      */
     private Representation doGetRequestInternal(String requestUrl,
-            Document requestBody) {
+                                                Document requestBody) {
         Client client = new Client(Protocol.HTTP);
         Request request = new Request(Method.GET, requestUrl);
         if (requestBody != null) {
@@ -176,7 +177,7 @@
      * @throws IOException
      */
     private InputStream doPostRequest(String requestUrl, Document requestBody)
-            throws IOException {
+                                                                              throws IOException {
         log.debug("##################################################");
         log.debug(new XMLUtils().writeDocument2String(requestBody));
         log.debug("##################################################");
@@ -211,7 +212,7 @@
      * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#createNewArtifact(de.intevation.gnv.artifactdatabase.objects.ArtifactObject)
      */
     public ArtifactObject createNewArtifact(ArtifactObject artifactFactory)
-            throws ArtifactDatabaseClientException {
+                                                                           throws ArtifactDatabaseClientException {
 
         try {
             Document request = this.createCreateRequestBody(artifactFactory
@@ -269,8 +270,9 @@
      * @throws IOException
      */
     private Document doPostRequest(ArtifactObject artifactFactory,
-            Document request, String suburl) throws IOException,
-            ArtifactDatabaseClientException {
+                                   Document request, String suburl)
+                                                                   throws IOException,
+                                                                   ArtifactDatabaseClientException {
         XMLUtils xmlUtils = new XMLUtils();
         String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl();
         InputStream is = this.doPostRequest(url + "/" + suburl, request);
@@ -284,8 +286,9 @@
      *      de.intevation.gnv.artifactdatabase.objects.ArtifactObject)
      */
     public ArtifactDescription getCurrentStepDescription(
-            ArtifactObject artifactFactory, ArtifactObject currentArtifact)
-            throws ArtifactDatabaseClientException {
+                                                         ArtifactObject artifactFactory,
+                                                         ArtifactObject currentArtifact)
+                                                                                        throws ArtifactDatabaseClientException {
         try {
             String url = this.getArtifactUrl(artifactFactory, currentArtifact);
             Document result = this.doGetRequest(url);
@@ -302,14 +305,15 @@
      * @return
      */
     private String getArtifactUrl(ArtifactObject artifactFactory,
-            ArtifactObject currentArtifact) {
+                                  ArtifactObject currentArtifact) {
         String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl()
-                + "/artifact/" + currentArtifact.getId();
+                     + "/artifact/" + currentArtifact.getId();
         return url;
     }
 
     private ArtifactDescription readDescription(Document document,
-            ArtifactObject artifact) throws ArtifactDatabaseClientException {
+                                                ArtifactObject artifact)
+                                                                        throws ArtifactDatabaseClientException {
         // Check if there was an Error or Exception reported from the
         // ArtifactDatabase
         this.check4ExceptionReport(document);
@@ -403,10 +407,12 @@
      *      de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
      *      java.lang.String, java.util.Collection)
      */
-    public ArtifactDescription doNextStep(ArtifactObject artifactFactory,
-            ArtifactObject currentArtifact, String target,
-            Collection<InputParameter> inputParameter)
-            throws ArtifactDatabaseClientException {
+    public ArtifactDescription doNextStep(
+                                          ArtifactObject artifactFactory,
+                                          ArtifactObject currentArtifact,
+                                          String target,
+                                          Collection<InputParameter> inputParameter)
+                                                                                    throws ArtifactDatabaseClientException {
 
         try {
             // 1 Feed
@@ -428,8 +434,9 @@
         }
     }
 
-    private Document createFeedRequestBody(ArtifactObject currentArtifact,
-            Collection<InputParameter> inputParameter) {
+    private Document createFeedRequestBody(
+                                           ArtifactObject currentArtifact,
+                                           Collection<InputParameter> inputParameter) {
         Document document = new XMLUtils().newDocument();
         Node rootNode = this.createRootNode(document);
 
@@ -458,8 +465,8 @@
      * @param rootNode
      */
     private Node createParameterNodes(
-            Collection<InputParameter> inputParameter, Document document,
-            String nodeName) {
+                                      Collection<InputParameter> inputParameter,
+                                      Document document, String nodeName) {
         Element dataNode = this.createArtifactElement(document, nodeName);
 
         if (inputParameter != null) {
@@ -484,7 +491,7 @@
     }
 
     private Document createAdvanceRequestBody(ArtifactObject currentArtifact,
-            String target) {
+                                              String target) {
         Document document = new XMLUtils().newDocument();
         Node rootNode = this.createRootNode(document);
 
@@ -512,10 +519,10 @@
      *      java.util.Collection)
      */
     public void doOutput(ArtifactObject artifactFactory,
-            ArtifactObject currentArtifact, OutputStream stream,
-            String targetName, String mimeType,
-            Collection<InputParameter> inputParameter)
-            throws ArtifactDatabaseClientException {
+                         ArtifactObject currentArtifact, OutputStream stream,
+                         String targetName, String mimeType,
+                         Collection<InputParameter> inputParameter)
+                                                                   throws ArtifactDatabaseClientException {
         try {
             XMLUtils xmlUtils = new XMLUtils();
             Document requestBody = this.createOutRequestBody(currentArtifact,
@@ -523,7 +530,7 @@
 
             String requestUrl = this.getArtifactUrl(artifactFactory,
                     currentArtifact)
-                    + "/" + targetName;
+                                + "/" + targetName;
             InputStream is = this.doPostRequest(requestUrl, requestBody);
 
             byte[] b = new byte[4096];
@@ -537,9 +544,11 @@
         }
     }
 
-    private Document createOutRequestBody(ArtifactObject currentArtifact,
-            String target, String mimeType,
-            Collection<InputParameter> inputParameter) {
+    private Document createOutRequestBody(
+                                          ArtifactObject currentArtifact,
+                                          String target,
+                                          String mimeType,
+                                          Collection<InputParameter> inputParameter) {
         Document document = new XMLUtils().newDocument();
         Node rootNode = this.createRootNode(document);
 
@@ -576,9 +585,9 @@
      *      java.util.Collection)
      */
     public void doFeed(ArtifactObject artifactFactory,
-            ArtifactObject currentArtifact,
-            Collection<InputParameter> inputParameter)
-            throws ArtifactDatabaseClientException {
+                       ArtifactObject currentArtifact,
+                       Collection<InputParameter> inputParameter)
+                                                                 throws ArtifactDatabaseClientException {
 
         try {
             Document feedDocument = this.createFeedRequestBody(currentArtifact,
@@ -595,7 +604,7 @@
     }
 
     private void check4ExceptionReport(Document document)
-            throws ArtifactDatabaseClientException {
+                                                         throws ArtifactDatabaseClientException {
 
         String message = new XMLUtils().getStringXPath(document,
                 "/exceptionreport/exception");
@@ -606,8 +615,9 @@
     }
 
     public Collection<ArtifactStatisticValue> calculateStatistics(
-            ArtifactObject artifactFactory, ArtifactObject currentArtifact)
-            throws ArtifactDatabaseClientException {
+                                                                  ArtifactObject artifactFactory,
+                                                                  ArtifactObject currentArtifact)
+                                                                                                 throws ArtifactDatabaseClientException {
         log.debug("DefaultArtifactDatabaseClient.calculateStatistics");
         Collection<ArtifactStatisticValue> result;
         try {
@@ -615,7 +625,7 @@
             String targetName = "statistics";
             String requestUrl = this.getArtifactUrl(artifactFactory,
                     currentArtifact)
-                    + "/" + targetName;
+                                + "/" + targetName;
             Document requestBody = this.createOutRequestBody(currentArtifact,
                     targetName, "text/xml", null);
             XMLUtils xmlUtils = new XMLUtils();

http://dive4elements.wald.intevation.org