You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2009/04/01 13:33:24 UTC

svn commit: r760857 - /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerConfigurationInformationFactory.java

Author: ruwan
Date: Wed Apr  1 11:33:23 2009
New Revision: 760857

URL: http://svn.apache.org/viewvc?rev=760857&view=rev
Log:
code reformatting

Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerConfigurationInformationFactory.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerConfigurationInformationFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerConfigurationInformationFactory.java?rev=760857&r1=760856&r2=760857&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerConfigurationInformationFactory.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerConfigurationInformationFactory.java Wed Apr  1 11:33:23 2009
@@ -18,9 +18,9 @@
  */
 package org.apache.synapse;
 
+import org.apache.axis2.Constants;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.Constants;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -131,7 +131,8 @@
     }
 
     /**
-     * Factory method for create a ServerConfigurationInformation based on information from ServletConfig
+     * Factory method for create a ServerConfigurationInformation based on information
+     * from ServletConfig
      *
      * @param servletConfig ServletConfig instance
      * @return ServerConfigurationInformation instance
@@ -175,7 +176,7 @@
      * Helper method to get a value of a parameters in the AxisConfiguration
      *
      * @param axisConfiguration AxisConfiguration instance
-     * @param paramKey          The name / key of the parameter
+     * @param paramKey The name / key of the parameter
      * @return The value of the parameter
      */
     private static String getAxis2ParameterValue(AxisConfiguration axisConfiguration,
@@ -197,7 +198,7 @@
     /**
      * Utility method to extract command line arguments
      *
-     * @param cmd     Command line which capture all command line arguments
+     * @param cmd Command line which capture all command line arguments
      * @param argName Name of the argument to be extracted
      * @return value of the argument if there is , o.w null
      */
@@ -205,23 +206,29 @@
 
         if (cmd == null) {
             handleFatal("CommandLine is null");
-        }
+        } else {
 
-        if (argName == null || "".equals(argName)) {
-            if (log.isDebugEnabled()) {
-                log.debug("Provided argument name is null. Returning null as value");
+            if (argName == null || "".equals(argName)) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Provided argument name is null. Returning null as value");
+                }
+                return null;
             }
-            return null;
-        }
 
-        if (cmd.hasOption(argName)) {
-            return cmd.getOptionValue(argName);
+            if (cmd.hasOption(argName)) {
+                return cmd.getOptionValue(argName);
+            }
         }
         return null;
     }
 
-    /*
+    /**
      * Load synapse initialization parameters from servlet configuration
+     *
+     * @param servletConfig Servlet configuration with the init parameters
+     * @param name name of the init parameter to be loaded
+     * @param required whether this parameter is a required one or not
+     * @return value of the loaded parameter
      */
     private static String loadParameter(ServletConfig servletConfig, String name,
                                         boolean required) {
@@ -229,11 +236,12 @@
         if (System.getProperty(name) == null) {
 
             String value = servletConfig.getInitParameter(name);
-            log.debug("Init parameter '" + name + "' : " + value);
-
+            if (log.isDebugEnabled()) {
+                log.debug("Init parameter '" + name + "' : " + value);
+            }
+                
             if ((value == null || value.trim().length() == 0) && required) {
-                handleFatal("A valid system property or init parameter '" + name +
-                        "' is required");
+                handleFatal("A valid system property or init parameter '" + name + "' is required");
             } else {
                 return value;
             }