cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [13/48] All Checkstyle problems corrected
Date Thu, 12 Dec 2013 21:01:13 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/network-elements/palo-alto/src/com/cloud/network/resource/PaloAltoResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/palo-alto/src/com/cloud/network/resource/PaloAltoResource.java b/plugins/network-elements/palo-alto/src/com/cloud/network/resource/PaloAltoResource.java
index 1b05a11..2952b93 100644
--- a/plugins/network-elements/palo-alto/src/com/cloud/network/resource/PaloAltoResource.java
+++ b/plugins/network-elements/palo-alto/src/com/cloud/network/resource/PaloAltoResource.java
@@ -29,11 +29,11 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 // for prettyFormat()
 import javax.xml.transform.stream.StreamSource;
@@ -111,10 +111,10 @@ public class PaloAltoResource implements ServerResource {
     private String _threatProfile;
     private String _logProfile;
     private String _pingManagementProfile;
-    private final Logger s_logger = Logger.getLogger(PaloAltoResource.class);
+    private static final Logger s_logger = Logger.getLogger(PaloAltoResource.class);
 
-    private static String _apiUri = "/api";
-    private static HttpClient _httpclient;
+    private static String s_apiUri = "/api";
+    private static HttpClient s_httpclient;
 
     protected enum PaloAltoMethod {
         GET, POST;
@@ -127,7 +127,7 @@ public class PaloAltoResource implements ServerResource {
     private enum InterfaceType {
         AGGREGATE("aggregate-ethernet"), ETHERNET("ethernet");
 
-        private String type;
+        private final String type;
 
         private InterfaceType(String type) {
             this.type = type;
@@ -142,7 +142,7 @@ public class PaloAltoResource implements ServerResource {
     private enum Protocol {
         TCP("tcp"), UDP("udp"), ICMP("icmp"), ALL("all");
 
-        private String protocol;
+        private final String protocol;
 
         private Protocol(String protocol) {
             this.protocol = protocol;
@@ -365,14 +365,14 @@ public class PaloAltoResource implements ServerResource {
      * Login
      */
     private void openHttpConnection() {
-        _httpclient = new DefaultHttpClient();
+        s_httpclient = new DefaultHttpClient();
 
         // Allows you to connect via SSL using unverified certs
-        _httpclient = HttpClientWrapper.wrapClient(_httpclient);
+        s_httpclient = HttpClientWrapper.wrapClient(s_httpclient);
     }
 
     private boolean refreshPaloAltoConnection() {
-        if (_httpclient == null) {
+        if (s_httpclient == null) {
             openHttpConnection();
         }
 
@@ -1191,8 +1191,9 @@ public class PaloAltoResource implements ServerResource {
     private String genFirewallRuleName(long id) { // ingress
         return "policy_" + Long.toString(id);
     }
+
     private String genFirewallRuleName(long id, String vlan) { // egress
-        return "policy_"+Long.toString(id)+"_"+vlan;
+        return "policy_" + Long.toString(id) + "_" + vlan;
     }
 
     public boolean manageFirewallRule(ArrayList<IPaloAltoCommand> cmdList, PaloAltoPrimative prim, FirewallRuleTO rule) throws ExecutionException {
@@ -1311,7 +1312,7 @@ public class PaloAltoResource implements ServerResource {
                 xml += "<destination>" + dstAddressXML + "</destination>";
                 xml += "<application>" + appXML + "</application>";
                 xml += "<service>" + serviceXML + "</service>";
-                xml += "<action>"+action+"</action>";
+                xml += "<action>" + action + "</action>";
                 xml += "<negate-source>no</negate-source>";
                 xml += "<negate-destination>no</negate-destination>";
                 if (_threatProfile != null && action.equals("allow")) { // add the threat profile if it exists
@@ -1328,34 +1329,35 @@ public class PaloAltoResource implements ServerResource {
                     Map<String, String> e_params = new HashMap<String, String>();
                     e_params.put("type", "config");
                     e_params.put("action", "get");
-                    e_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_"+rule.getSrcVlanTag()+"']");
+                    e_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_" + rule.getSrcVlanTag() + "']");
                     String e_response = request(PaloAltoMethod.GET, e_params);
                     has_default = (validResponse(e_response) && responseNotEmpty(e_response));
-    
+
                     // there is an existing default rule, so we need to remove it and add it back after the new rule is added.
                     if (has_default) {
-                        s_logger.debug("Moving the default egress rule after the new rule: "+ruleName);
+                        s_logger.debug("Moving the default egress rule after the new rule: " + ruleName);
                         NodeList response_body;
                         Document doc = getDocument(e_response);
                         XPath xpath = XPathFactory.newInstance().newXPath();
                         try {
                             XPathExpression expr = xpath.compile("/response[@status='success']/result/entry/node()");
-                            response_body = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
+                            response_body = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);
                         } catch (XPathExpressionException e) {
                             throw new ExecutionException(e.getCause().getMessage());
                         }
-                        for (int i=0; i<response_body.getLength(); i++) {
+                        for (int i = 0; i < response_body.getLength(); i++) {
                             Node n = response_body.item(i);
                             defaultEgressRule += nodeToString(n);
                         }
                         Map<String, String> dd_params = new HashMap<String, String>();
                         dd_params.put("type", "config");
                         dd_params.put("action", "delete");
-                        dd_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_"+rule.getSrcVlanTag()+"']");
+                        dd_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_" + rule.getSrcVlanTag() +
+                            "']");
                         cmdList.add(new DefaultPaloAltoCommand(PaloAltoMethod.POST, dd_params));
                     }
                 }
-    
+
                 // add the new rule...
                 Map<String, String> a_params = new HashMap<String, String>();
                 a_params.put("type", "config");
@@ -1369,10 +1371,10 @@ public class PaloAltoResource implements ServerResource {
                     Map<String, String> da_params = new HashMap<String, String>();
                     da_params.put("type", "config");
                     da_params.put("action", "set");
-                    da_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_"+rule.getSrcVlanTag()+"']");
+                    da_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_" + rule.getSrcVlanTag() + "']");
                     da_params.put("element", defaultEgressRule);
                     cmdList.add(new DefaultPaloAltoCommand(PaloAltoMethod.POST, da_params));
-                    s_logger.debug("Completed move of the default egress rule after rule: "+ruleName);
+                    s_logger.debug("Completed move of the default egress rule after rule: " + ruleName);
                 }
 
                 return true;
@@ -1401,7 +1403,8 @@ public class PaloAltoResource implements ServerResource {
         Map<String, String> params = new HashMap<String, String>();
         params.put("type", "config");
         params.put("action", "get");
-        params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[contains(@name, 'policy') and contains(@name, '"+Long.toString(vlan)+"')]");
+        params.put("xpath",
+            "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[contains(@name, 'policy') and contains(@name, '" + Long.toString(vlan) + "')]");
         String response = request(PaloAltoMethod.GET, params);
         boolean has_orphans = (validResponse(response) && responseNotEmpty(response));
 
@@ -1409,12 +1412,13 @@ public class PaloAltoResource implements ServerResource {
             Map<String, String> d_params = new HashMap<String, String>();
             d_params.put("type", "config");
             d_params.put("action", "delete");
-            d_params.put("xpath", "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[contains(@name, 'policy') and contains(@name, '"+Long.toString(vlan)+"')]");
+            d_params.put("xpath",
+                "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[contains(@name, 'policy') and contains(@name, '" + Long.toString(vlan) +
+                    "')]");
             cmdList.add(new DefaultPaloAltoCommand(PaloAltoMethod.POST, d_params));
         }
     }
 
-
     /*
      * Usage
      */
@@ -1664,15 +1668,15 @@ public class PaloAltoResource implements ServerResource {
             }
 
             try {
-                debug_msg = debug_msg + "GET request: https://" + _ip + _apiUri + URLDecoder.decode(queryString, "UTF-8") + "\n";
+                debug_msg = debug_msg + "GET request: https://" + _ip + s_apiUri + URLDecoder.decode(queryString, "UTF-8") + "\n";
             } catch (UnsupportedEncodingException e) {
-                debug_msg = debug_msg + "GET request: https://" + _ip + _apiUri + queryString + "\n";
+                debug_msg = debug_msg + "GET request: https://" + _ip + s_apiUri + queryString + "\n";
             }
 
-            HttpGet get_request = new HttpGet("https://" + _ip + _apiUri + queryString);
+            HttpGet get_request = new HttpGet("https://" + _ip + s_apiUri + queryString);
             ResponseHandler<String> responseHandler = new BasicResponseHandler();
             try {
-                responseBody = _httpclient.execute(get_request, responseHandler);
+                responseBody = s_httpclient.execute(get_request, responseHandler);
             } catch (IOException e) {
                 throw new ExecutionException(e.getMessage());
             }
@@ -1688,12 +1692,12 @@ public class PaloAltoResource implements ServerResource {
                 nvps.add(new BasicNameValuePair("key", _key));
             }
 
-            debug_msg = debug_msg + "POST request: https://" + _ip + _apiUri + "\n";
+            debug_msg = debug_msg + "POST request: https://" + _ip + s_apiUri + "\n";
             for (NameValuePair nvp : nvps) {
                 debug_msg = debug_msg + "param: " + nvp.getName() + ", " + nvp.getValue() + "\n";
             }
 
-            HttpPost post_request = new HttpPost("https://" + _ip + _apiUri);
+            HttpPost post_request = new HttpPost("https://" + _ip + s_apiUri);
             try {
                 post_request.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
             } catch (UnsupportedEncodingException e) {
@@ -1701,7 +1705,7 @@ public class PaloAltoResource implements ServerResource {
             }
             ResponseHandler<String> responseHandler = new BasicResponseHandler();
             try {
-                responseBody = _httpclient.execute(post_request, responseHandler);
+                responseBody = s_httpclient.execute(post_request, responseHandler);
             } catch (IOException e) {
                 throw new ExecutionException(e.getMessage());
             }
@@ -1965,13 +1969,13 @@ public class PaloAltoResource implements ServerResource {
     }
 
     /* Get the type of interface from the PA device. */
-    private String getInterfaceType(String interface_name) throws ExecutionException {
+    private String getInterfaceType(String interfaceName) throws ExecutionException {
         String[] types = {InterfaceType.ETHERNET.toString(), InterfaceType.AGGREGATE.toString()};
         for (String type : types) {
             Map<String, String> params = new HashMap<String, String>();
             params.put("type", "config");
             params.put("action", "get");
-            params.put("xpath", "/config/devices/entry/network/interface/" + type + "/entry[@name='" + interface_name + "']");
+            params.put("xpath", "/config/devices/entry/network/interface/" + type + "/entry[@name='" + interfaceName + "']");
             String ethernet_response = request(PaloAltoMethod.GET, params);
             if (validResponse(ethernet_response) && responseNotEmpty(ethernet_response)) {
                 return type;
@@ -2081,7 +2085,7 @@ public class PaloAltoResource implements ServerResource {
             t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
             t.transform(new DOMSource(node), new StreamResult(sw));
         } catch (Throwable t) {
-            throw new ExecutionException("XML convert error when modifying PA config: "+t.getMessage());
+            throw new ExecutionException("XML convert error when modifying PA config: " + t.getMessage());
         }
         return sw.toString();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/network-elements/palo-alto/test/com/cloud/network/resource/MockablePaloAltoResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/palo-alto/test/com/cloud/network/resource/MockablePaloAltoResource.java b/plugins/network-elements/palo-alto/test/com/cloud/network/resource/MockablePaloAltoResource.java
index 44cc65b..6657ee3 100755
--- a/plugins/network-elements/palo-alto/test/com/cloud/network/resource/MockablePaloAltoResource.java
+++ b/plugins/network-elements/palo-alto/test/com/cloud/network/resource/MockablePaloAltoResource.java
@@ -54,7 +54,31 @@ public class MockablePaloAltoResource extends PaloAltoResource {
                     if (context.containsKey("public_using_ethernet") && context.get("public_using_ethernet").equals("true")) {
                         context.put("public_interface_type", "ethernet");
                         response =
-                            "<response status=\"success\" code=\"19\"><result total-count=\"1\" count=\"1\"><entry name=\"ethernet1/1\" admin=\"admin\" time=\"2013/06/18 13:33:56\"><layer3 admin=\"admin\" time=\"2013/06/18 13:33:56\"><ipv6><neighbor-discovery><router-advertisement><enable>no</enable><min-interval>200</min-interval><max-interval>600</max-interval><hop-limit>64</hop-limit><reachable-time>unspecified</reachable-time><retransmission-timer>unspecified</retransmission-timer><lifetime>1800</lifetime><managed-flag>no</managed-flag><other-flag>no</other-flag><enable-consistency-check>no</enable-consistency-check><link-mtu>unspecified</link-mtu></router-advertisement><enable-dad>no</enable-dad><reachable-time>30</reachable-time><ns-interval>1</ns-interval><dad-attempts>1</dad-attempts></neighbor-discovery><enabled>no</enabled><interface-id>EUI-64</interface-id></ipv6><untagged-sub-interface>no</untagged-sub-interface><units admin=\"admin\" time=\"2013/06/18 13:33:56\"><entry 
 name=\"ethernet1/1.9999\" admin=\"admin\" time=\"2013/06/18 13:33:56\"><ipv6><neighbor-discovery><router-advertisement><enable>no</enable><min-interval>200</min-interval><max-interval>600</max-interval><hop-limit>64</hop-limit><reachable-time>unspecified</reachable-time><retransmission-timer>unspecified</retransmission-timer><lifetime>1800</lifetime><managed-flag>no</managed-flag><other-flag>no</other-flag><enable-consistency-check>no</enable-consistency-check><link-mtu>unspecified</link-mtu></router-advertisement><enable-dad>no</enable-dad><reachable-time>30</reachable-time><ns-interval>1</ns-interval><dad-attempts>1</dad-attempts></neighbor-discovery><enabled>no</enabled><interface-id>EUI-64</interface-id></ipv6><ip admin=\"admin\" time=\"2013/06/18 13:33:56\"><entry name=\"192.168.80.254/24\"/></ip><adjust-tcp-mss>no</adjust-tcp-mss><tag>3033</tag></entry></units></layer3><link-speed>auto</link-speed><link-duplex>auto</link-duplex><link-state>auto</link-state></entry></result></r
 esponse>";
+                            "<response status=\"success\" code=\"19\"><result total-count=\"1\" count=\"1\"><entry name=\"ethernet1/1\" admin=\"admin\" time=\"2013/06/18 "
+                                +
+                                "13:33:56\"><layer3 admin=\"admin\" time=\"2013/06/18 13:33:56\"><ipv6><neighbor-discovery><router-advertisement><enable>no</enable>"
+                                +
+                                "<min-interval>200</min-interval><max-interval>600</max-interval><hop-limit>64</hop-limit><reachable-time>unspecified</reachable-time>"
+                                +
+                                "<retransmission-timer>unspecified</retransmission-timer><lifetime>1800</lifetime><managed-flag>no</managed-flag>"
+                                +
+                                "<other-flag>no</other-flag><enable-consistency-check>no</enable-consistency-check><link-mtu>unspecified</link-mtu></router-advertisement>"
+                                +
+                                "<enable-dad>no</enable-dad><reachable-time>30</reachable-time><ns-interval>1</ns-interval><dad-attempts>1</dad-attempts></neighbor-discovery>"+
+                                "<enabled>no</enabled><interface-id>EUI-64</interface-id></ipv6><untagged-sub-interface>no</untagged-sub-interface>"
+                                +
+                                "<units admin=\"admin\" time=\"2013/06/18 13:33:56\"><entry name=\"ethernet1/1.9999\" admin=\"admin\" time=\"2013/06/18 13:33:56\">"
+                                +
+                                "<ipv6><neighbor-discovery><router-advertisement><enable>no</enable><min-interval>200</min-interval><max-interval>600</max-interval>"
+                                +
+                                "<hop-limit>64</hop-limit><reachable-time>unspecified</reachable-time><retransmission-timer>unspecified</retransmission-timer><lifetime>"
+                                +
+                                "1800</lifetime><managed-flag>no</managed-flag><other-flag>no</other-flag><enable-consistency-check>no</enable-consistency-check>" +
+                                "<link-mtu>unspecified</link-mtu></router-advertisement><enable-dad>no</enable-dad><reachable-time>30</reachable-time><ns-interval>" +
+                                "1</ns-interval><dad-attempts>1</dad-attempts></neighbor-discovery><enabled>no</enabled><interface-id>EUI-64</interface-id></ipv6>" +
+                                "<ip admin=\"admin\" time=\"2013/06/18 13:33:56\"><entry name=\"192.168.80.254/24\"/></ip><adjust-tcp-mss>no</adjust-tcp-mss>" +
+                                "<tag>3033</tag></entry></units></layer3><link-speed>auto</link-speed><link-duplex>auto</link-duplex><link-state>auto</link-state>" +
+                                "</entry></result></response>";
                     } else {
                         response = "<response status=\"success\" code=\"19\"><result/></response>";
                     }
@@ -164,7 +188,7 @@ public class MockablePaloAltoResource extends PaloAltoResource {
                 // get egress firewall rule | has_egress_fw_rule | policy_0_3954
                 if (params.get("xpath").equals("/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='policy_0_3954']")) {
                     if (context.containsKey("has_egress_fw_rule") && context.get("has_egress_fw_rule").equals("true")) {
-                        response = 
+                        response =
                             "<response status=\"success\" code=\"19\"><result total-count=\"1\" count=\"1\">"
                                 + "<entry name=\"policy_0_3954\" admin=\"admin\" time=\"2013/07/03 12:43:30\"><from admin=\"admin\" time=\"2013/07/03 12:43:30\">"
                                 + "<member admin=\"admin\" time=\"2013/07/03 12:43:30\">trust</member></from><to><member>untrust</member></to><source><member>10.3.96.1/20</member>"
@@ -191,7 +215,8 @@ public class MockablePaloAltoResource extends PaloAltoResource {
                 }
 
                 // get default egress rule | policy_0_3954
-                if (params.get("xpath").equals("/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[contains(@name, 'policy') and contains(@name, '3954')]")) {
+                if (params.get("xpath").equals(
+                    "/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[contains(@name, 'policy') and contains(@name, '3954')]")) {
                     response = "<response status=\"success\" code=\"19\"><result/></response>";
                 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/network-elements/palo-alto/test/com/cloud/network/resource/PaloAltoResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/palo-alto/test/com/cloud/network/resource/PaloAltoResourceTest.java b/plugins/network-elements/palo-alto/test/com/cloud/network/resource/PaloAltoResourceTest.java
index 4ef8ecc..931e6cc 100755
--- a/plugins/network-elements/palo-alto/test/com/cloud/network/resource/PaloAltoResourceTest.java
+++ b/plugins/network-elements/palo-alto/test/com/cloud/network/resource/PaloAltoResourceTest.java
@@ -52,48 +52,48 @@ import com.cloud.utils.exception.ExecutionException;
 
 public class PaloAltoResourceTest {
     // configuration data
-    private String _test_name = "PaloAltoTestDevice";
-    private String _test_zoneId = "TestZone";
-    private String _test_ip = "192.168.80.2";
-    private String _test_username = "admin";
-    private String _test_password = "admin";
-    private String _test_publicInterface = "ethernet1/1";
-    private String _test_privateInterface = "ethernet1/2";
-    private String _test_publicZone = "untrust";
-    private String _test_privateZone = "trust";
-    private String _test_virtualRouter = "default";
+    private String _testName = "PaloAltoTestDevice";
+    private String _testZoneId = "TestZone";
+    private String _testIp = "192.168.80.2";
+    private String _testUsername = "admin";
+    private String _testPassword = "admin";
+    private String _testPublicInterface = "ethernet1/1";
+    private String _testPrivateInterface = "ethernet1/2";
+    private String _testPublicZone = "untrust";
+    private String _testPrivateZone = "trust";
+    private String _testVirtualRouter = "default";
 
     MockablePaloAltoResource _resource;
-    Map<String, Object> _resource_params;
+    Map<String, Object> _resourceParams;
     HashMap<String, String> _context;
 
     @Before
     public void setUp() {
         _resource = new MockablePaloAltoResource();
-        _resource_params = new HashMap<String, Object>(); // params to be passed to configure()
-        _resource_params.put("name", _test_name);
-        _resource_params.put("zoneId", _test_zoneId);
-        _resource_params.put("ip", _test_ip);
-        _resource_params.put("username", _test_username);
-        _resource_params.put("password", _test_password);
-        _resource_params.put("publicinterface", _test_publicInterface);
-        _resource_params.put("privateinterface", _test_privateInterface);
-        _resource_params.put("publicnetwork", _test_publicZone);
-        _resource_params.put("privatenetwork", _test_privateZone);
-        _resource_params.put("pavr", _test_virtualRouter);
-        _resource_params.put("guid", "aaaaa-bbbbb-ccccc");
+        _resourceParams = new HashMap<String, Object>(); // params to be passed to configure()
+        _resourceParams.put("name", _testName);
+        _resourceParams.put("zoneId", _testZoneId);
+        _resourceParams.put("ip", _testIp);
+        _resourceParams.put("username", _testUsername);
+        _resourceParams.put("password", _testPassword);
+        _resourceParams.put("publicinterface", _testPublicInterface);
+        _resourceParams.put("privateinterface", _testPrivateInterface);
+        _resourceParams.put("publicnetwork", _testPublicZone);
+        _resourceParams.put("privatenetwork", _testPrivateZone);
+        _resourceParams.put("pavr", _testVirtualRouter);
+        _resourceParams.put("guid", "aaaaa-bbbbb-ccccc");
 
         _context = new HashMap<String, String>(); // global context
-        _context.put("name", _test_name);
-        _context.put("zone_id", _test_zoneId);
-        _context.put("ip", _test_ip);
-        _context.put("username", _test_username);
-        _context.put("password", _test_password);
-        _context.put("public_interface", _test_publicInterface);
-        _context.put("private_interface", _test_privateInterface);
-        _context.put("public_zone", _test_publicZone);
-        _context.put("private_zone", _test_privateZone);
-        _context.put("pa_vr", _test_virtualRouter);
+        _context.put("name", _testName);
+        _context.put("zone_id", _testZoneId);
+        _context.put("ip", _testIp);
+        _context.put("username", _testUsername);
+        _context.put("password", _testPassword);
+        _context.put("public_interface", _testPublicInterface);
+        _context.put("private_interface", _testPrivateInterface);
+        _context.put("public_zone", _testPublicZone);
+        _context.put("private_zone", _testPrivateZone);
+        _context.put("pa_vr", _testVirtualRouter);
         // --
         _context.put("public_using_ethernet", "true");
         _context.put("private_using_ethernet", "true");
@@ -115,7 +115,7 @@ public class PaloAltoResourceTest {
         }
         _context.remove("has_management_profile");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
     }
 
     @Test
@@ -124,7 +124,7 @@ public class PaloAltoResourceTest {
             System.out.println("\nTEST: resourceConfigureWithManagementProfile");
             System.out.println("---------------------------------------------------");
         }
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
     }
 
     @Test(expected = ConfigurationException.class)
@@ -136,7 +136,7 @@ public class PaloAltoResourceTest {
         _context.put("firewall_has_pending_changes", "true");
         _context.remove("has_management_profile");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
     }
 
     @Test(expected = ConfigurationException.class)
@@ -148,7 +148,7 @@ public class PaloAltoResourceTest {
         _context.put("simulate_commit_failure", "true");
         _context.remove("has_management_profile");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
     }
 
     @Test
@@ -157,7 +157,7 @@ public class PaloAltoResourceTest {
             System.out.println("\nTEST: testInitialization");
             System.out.println("---------------------------------------------------");
         }
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         StartupCommand[] sc = _resource.initialize();
         assertTrue(sc.length == 1);
@@ -174,7 +174,7 @@ public class PaloAltoResourceTest {
             System.out.println("\nTEST: implementGuestNetwork");
             System.out.println("---------------------------------------------------");
         }
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         IpAddressTO ip = new IpAddressTO(Long.valueOf("1"), "192.168.80.102", true, false, true, "untagged", null, null, null, 100, false);
         IpAddressTO[] ips = new IpAddressTO[1];
@@ -201,7 +201,7 @@ public class PaloAltoResourceTest {
         _context.put("has_src_nat_rule", "true");
         _context.put("has_isolation_fw_rule", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         IpAddressTO ip = new IpAddressTO(Long.valueOf("1"), "192.168.80.102", false, false, true, "untagged", null, null, null, 100, false);
         IpAddressTO[] ips = new IpAddressTO[1];
@@ -227,7 +227,7 @@ public class PaloAltoResourceTest {
         _context.put("has_isolation_fw_rule", "true");
         _context.put("has_service_tcp_80", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<FirewallRuleTO> rules = new ArrayList<FirewallRuleTO>();
@@ -257,7 +257,7 @@ public class PaloAltoResourceTest {
         _context.put("has_service_tcp_80", "true");
         _context.put("has_ingress_fw_rule", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<FirewallRuleTO> rules = new ArrayList<FirewallRuleTO>();
@@ -284,7 +284,7 @@ public class PaloAltoResourceTest {
         _context.put("has_isolation_fw_rule", "true");
         _context.put("has_service_tcp_80", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<FirewallRuleTO> rules = new ArrayList<FirewallRuleTO>();
@@ -315,7 +315,7 @@ public class PaloAltoResourceTest {
         _context.put("has_service_tcp_80", "true");
         _context.put("has_egress_fw_rule", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<FirewallRuleTO> rules = new ArrayList<FirewallRuleTO>();
@@ -344,7 +344,7 @@ public class PaloAltoResourceTest {
         _context.put("has_isolation_fw_rule", "true");
         _context.put("has_service_tcp_80", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<StaticNatRuleTO> rules = new ArrayList<StaticNatRuleTO>();
@@ -372,7 +372,7 @@ public class PaloAltoResourceTest {
         _context.put("has_service_tcp_80", "true");
         _context.put("has_stc_nat_rule", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<StaticNatRuleTO> rules = new ArrayList<StaticNatRuleTO>();
@@ -399,7 +399,7 @@ public class PaloAltoResourceTest {
         _context.put("has_isolation_fw_rule", "true");
         _context.put("has_service_tcp_80", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<PortForwardingRuleTO> rules = new ArrayList<PortForwardingRuleTO>();
@@ -427,7 +427,7 @@ public class PaloAltoResourceTest {
         _context.put("has_service_tcp_80", "true");
         _context.put("has_dst_nat_rule", "true");
         _resource.setMockContext(_context);
-        _resource.configure("PaloAltoResource", _resource_params);
+        _resource.configure("PaloAltoResource", _resourceParams);
 
         long vlanId = 3954;
         List<PortForwardingRuleTO> rules = new ArrayList<PortForwardingRuleTO>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
index 50bacf3..173d6f0 100644
--- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
+++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
@@ -145,12 +145,12 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
         return provider;
     }
 
-    private List<SspClient> fetchSspClients(Long physicalNetworkId, Long dataCenterId, boolean enabled_only) {
+    private List<SspClient> fetchSspClients(Long physicalNetworkId, Long dataCenterId, boolean enabledOnly) {
         ArrayList<SspClient> clients = new ArrayList<SspClient>();
 
         boolean provider_found = false;
         PhysicalNetworkServiceProviderVO provider = _physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetworkId, s_SSP_NAME);
-        if (enabled_only) {
+        if (enabledOnly) {
             if (provider != null && provider.getState() == State.Enabled) {
                 provider_found = true;
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
index 1db10e2..d6e1a01 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -95,7 +95,7 @@ public class CloudStackImageStoreDriverImpl extends BaseImageStoreDriverImpl {
         }
         if (_sslCopy) {
             hostname = ipAddress.replace(".", "-");
-            if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){
+            if (_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0) {
                 hostname = hostname + "." + _ssvmUrlDomain;
             } else {
                 hostname = hostname + ".realhostip.com";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
index 95c9034..13bd5d8 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
@@ -65,8 +65,8 @@ public class CloudStackImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
         return _discoverers;
     }
 
-    public void setDiscoverers(List<? extends Discoverer> _discoverers) {
-        this._discoverers = _discoverers;
+    public void setDiscoverers(List<? extends Discoverer> discoverers) {
+        this._discoverers = discoverers;
     }
 
     public CloudStackImageStoreLifeCycleImpl() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/lifecycle/S3ImageStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/lifecycle/S3ImageStoreLifeCycleImpl.java b/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/lifecycle/S3ImageStoreLifeCycleImpl.java
index ff09306..718c591 100644
--- a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/lifecycle/S3ImageStoreLifeCycleImpl.java
+++ b/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/lifecycle/S3ImageStoreLifeCycleImpl.java
@@ -60,8 +60,8 @@ public class S3ImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
         return _discoverers;
     }
 
-    public void setDiscoverers(List<? extends Discoverer> _discoverers) {
-        this._discoverers = _discoverers;
+    public void setDiscoverers(List<? extends Discoverer> discoverers) {
+        this._discoverers = discoverers;
     }
 
     public S3ImageStoreLifeCycleImpl() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java
index 3faf8b7..5e424de 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java
@@ -21,7 +21,14 @@ import java.util.List;
 
 import javax.inject.Inject;
 
-import org.apache.cloudstack.api.*;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.LDAPConfigResponse;
 import org.apache.cloudstack.api.response.LdapConfigurationResponse;
 import org.apache.cloudstack.api.response.ListResponse;
@@ -30,10 +37,12 @@ import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 import org.apache.cloudstack.ldap.LdapConfiguration;
 import org.apache.cloudstack.ldap.LdapConfigurationVO;
 import org.apache.cloudstack.ldap.LdapManager;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.log4j.Logger;
 
-import com.cloud.exception.*;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.user.Account;
 import com.cloud.utils.Pair;
 
@@ -71,13 +80,19 @@ public class LDAPConfigCmd extends BaseCmd {
     @Parameter(name = ApiConstants.USE_SSL, type = CommandType.BOOLEAN, description = "Check Use SSL if the external LDAP server is configured for LDAP over SSL.")
     private Boolean useSSL;
 
-    @Parameter(name = ApiConstants.SEARCH_BASE, type = CommandType.STRING, description = "The search base defines the starting point for the search in the directory tree Example:  dc=cloud,dc=com.")
+    @Parameter(name = ApiConstants.SEARCH_BASE,
+               type = CommandType.STRING,
+               description = "The search base defines the starting point for the search in the directory tree Example:  dc=cloud,dc=com.")
     private String searchBase;
 
-    @Parameter(name = ApiConstants.QUERY_FILTER, type = CommandType.STRING, description = "You specify a query filter here, which narrows down the users, who can be part of this domain.")
+    @Parameter(name = ApiConstants.QUERY_FILTER,
+               type = CommandType.STRING,
+               description = "You specify a query filter here, which narrows down the users, who can be part of this domain.")
     private String queryFilter;
 
-    @Parameter(name = ApiConstants.BIND_DN, type = CommandType.STRING, description = "Specify the distinguished name of a user with the search permission on the directory.")
+    @Parameter(name = ApiConstants.BIND_DN,
+               type = CommandType.STRING,
+               description = "Specify the distinguished name of a user with the search permission on the directory.")
     private String bindDN;
 
     @Parameter(name = ApiConstants.BIND_PASSWORD, type = CommandType.STRING, description = "Enter the password.")
@@ -102,7 +117,7 @@ public class LDAPConfigCmd extends BaseCmd {
     }
 
     public void setBindDN(String bdn) {
-        this.bindDN = bdn;
+        bindDN = bdn;
     }
 
     public String getQueryFilter() {
@@ -162,7 +177,8 @@ public class LDAPConfigCmd extends BaseCmd {
     /////////////////////////////////////////////////////
 
     @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+        ResourceAllocationException {
         if (getListAll()) {
             // return the existing conf
 
@@ -176,21 +192,21 @@ public class LDAPConfigCmd extends BaseCmd {
                 String searchBaseConfig = _ldapConfiguration.getBaseDn();
                 String bindDnConfig = _ldapConfiguration.getBindPrincipal();
                 for (LdapConfigurationVO ldapConfigurationVO : result.first()) {
-                    responses.add(this.createLDAPConfigResponse(ldapConfigurationVO.getHostname(), ldapConfigurationVO.getPort(), useSSlConfig, null, searchBaseConfig,
-                            bindDnConfig));
+                    responses.add(createLDAPConfigResponse(ldapConfigurationVO.getHostname(), ldapConfigurationVO.getPort(), useSSlConfig, null, searchBaseConfig,
+                        bindDnConfig));
                 }
             }
             response.setResponses(responses);
             response.setResponseName(getCommandName());
-            this.setResponseObject(response);
+            setResponseObject(response);
         } else if (getHostname() == null || getPort() == null) {
             throw new InvalidParameterValueException("You need to provide hostname, port to configure your LDAP server");
         } else {
-            boolean result = this.updateLDAP();
+            boolean result = updateLDAP();
             if (result) {
-                LDAPConfigResponse lr = this.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
+                LDAPConfigResponse lr = createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
                 lr.setResponseName(getCommandName());
-                this.setResponseObject(lr);
+                setResponseObject(lr);
             }
         }
 
@@ -221,7 +237,7 @@ public class LDAPConfigCmd extends BaseCmd {
         _configDao.update(cvo.getName(), cvo.getCategory(), getSearchBase());
 
         /**
-         * There is no ssl now. it is derived from the presence of trust store and password 
+         * There is no ssl now. it is derived from the presence of trust store and password
          */
 //        cvo = _configDao.findByName(LDAPParams.usessl.toString());
 //        _configDao.update(cvo.getName(),cvo.getCategory(),getUseSSL().toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
index d817c33..89cec65 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
@@ -59,29 +59,29 @@ public class LdapImportUsersCmd extends BaseListCmd {
     private static final String s_name = "ldapuserresponse";
 
     @Parameter(name = ApiConstants.TIMEZONE,
-            type = CommandType.STRING,
-            description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
+               type = CommandType.STRING,
+               description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
     private String timezone;
 
     @Parameter(name = ApiConstants.ACCOUNT_TYPE,
-            type = CommandType.SHORT,
-            required = true,
-            description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
+               type = CommandType.SHORT,
+               required = true,
+               description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
     private Short accountType;
 
     @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
     private Map<String, String> details;
 
     @Parameter(name = ApiConstants.DOMAIN_ID,
-            type = CommandType.UUID,
-            entityType = DomainResponse.class,
-            description = "Specifies the domain to which the ldap users are to be "
-                    + "imported. If no domain is specified, a domain will created using group parameter. If the group is also not specified, a domain name based on the OU information will be "
-                    + "created. If no OU hierarchy exists, will be defaulted to ROOT domain")
+               type = CommandType.UUID,
+               entityType = DomainResponse.class,
+               description = "Specifies the domain to which the ldap users are to be "
+                   + "imported. If no domain is specified, a domain will created using group parameter. If the group is also not specified, a domain name based on the OU information will be "
+                   + "created. If no OU hierarchy exists, will be defaulted to ROOT domain")
     private Long domainId;
 
     @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "Specifies the group name from which the ldap users are to be imported. "
-            + "If no group is specified, all the users will be imported.")
+        + "If no group is specified, all the users will be imported.")
     private String groupName;
 
     private Domain _domain;
@@ -102,7 +102,7 @@ public class LdapImportUsersCmd extends BaseListCmd {
 
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
-    ResourceAllocationException, NetworkRuleConflictException {
+        ResourceAllocationException, NetworkRuleConflictException {
 
         List<LdapUser> users;
         try {
@@ -122,7 +122,7 @@ public class LdapImportUsersCmd extends BaseListCmd {
             Domain domain = getDomain(user);
             try {
                 _accountService.createUserAccount(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone,
-                        user.getUsername(), accountType, domain.getId(), domain.getNetworkDomain(), details, UUID.randomUUID().toString(), UUID.randomUUID().toString());
+                    user.getUsername(), accountType, domain.getId(), domain.getNetworkDomain(), details, UUID.randomUUID().toString(), UUID.randomUUID().toString());
                 addedUsers.add(user);
             } catch (InvalidParameterValueException ex) {
                 s_logger.error("Failed to create user with username: " + user.getUsername() + " ::: " + ex.getMessage());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java
index 578ebce..6d71f4f 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java
@@ -24,13 +24,22 @@ import javax.inject.Inject;
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
 
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.api.LdapValidator;
-import org.apache.cloudstack.api.command.*;
+import org.apache.cloudstack.api.command.LDAPConfigCmd;
+import org.apache.cloudstack.api.command.LDAPRemoveCmd;
+import org.apache.cloudstack.api.command.LdapAddConfigurationCmd;
+import org.apache.cloudstack.api.command.LdapCreateAccountCmd;
+import org.apache.cloudstack.api.command.LdapDeleteConfigurationCmd;
+import org.apache.cloudstack.api.command.LdapImportUsersCmd;
+import org.apache.cloudstack.api.command.LdapListConfigurationCmd;
+import org.apache.cloudstack.api.command.LdapListUsersCmd;
+import org.apache.cloudstack.api.command.LdapUserSearchCmd;
 import org.apache.cloudstack.api.response.LdapConfigurationResponse;
 import org.apache.cloudstack.api.response.LdapUserResponse;
 import org.apache.cloudstack.ldap.dao.LdapConfigurationDao;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.utils.Pair;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d256b97..59f3a6a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -470,7 +470,7 @@
           <includeTestSourceDirectory>true</includeTestSourceDirectory>
           <sourceDirectory>${project.basedir}</sourceDirectory>
           <includes>**\/*.java</includes>
-          <excludes>**\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</excludes>
+          <excludes>**\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/awsapi\/,**\/xapi\/,**\/apidoc\/</excludes>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
index 0bfe192..b77f8ac 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
@@ -296,7 +296,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
 
             boolean hostHasCpuCapability = _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), offering.getSpeed());
             boolean hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio,
-                    considerReservedCapacity);
+                considerReservedCapacity);
 
             if (hostHasCpuCapability && hostHasCapacity) {
                 if (s_logger.isDebugEnabled()) {
@@ -305,7 +305,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
                 suitableHosts.add(host);
             } else {
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Not using host " + host.getId() + "; host has cpu capability? " + hostHasCpuCapability +  ", host has capacity?" + hostHasCapacity);
+                    s_logger.debug("Not using host " + host.getId() + "; host has cpu capability? " + hostHasCpuCapability + ", host has capacity?" + hostHasCapacity);
                 }
                 avoid.addHost(host.getId());
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/alert/AlertManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java
index c742813..2a343d5 100755
--- a/server/src/com/cloud/alert/AlertManagerImpl.java
+++ b/server/src/com/cloud/alert/AlertManagerImpl.java
@@ -40,7 +40,12 @@ import javax.mail.URLName;
 import javax.mail.internet.InternetAddress;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.alert.AlertService.AlertType;
+import org.apache.log4j.Logger;
+
+import com.sun.mail.smtp.SMTPMessage;
+import com.sun.mail.smtp.SMTPSSLTransport;
+import com.sun.mail.smtp.SMTPTransport;
+
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.Configurable;
@@ -48,7 +53,6 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-import org.apache.log4j.Logger;
 
 import com.cloud.alert.dao.AlertDao;
 import com.cloud.api.ApiDBUtils;
@@ -81,11 +85,7 @@ import com.cloud.storage.StorageManager;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
-import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria;
-import com.sun.mail.smtp.SMTPMessage;
-import com.sun.mail.smtp.SMTPSSLTransport;
-import com.sun.mail.smtp.SMTPTransport;
 
 @Local(value = {AlertManager.class})
 public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable {
@@ -94,8 +94,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
 
     private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // thirty seconds expressed in milliseconds
 
-    private static final DecimalFormat _dfPct = new DecimalFormat("###.##");
-    private static final DecimalFormat _dfWhole = new DecimalFormat("########");
+    private static final DecimalFormat DfPct = new DecimalFormat("###.##");
+    private static final DecimalFormat DfWhole = new DecimalFormat("########");
 
     private EmailAlert _emailAlert;
     @Inject
@@ -259,6 +259,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
         }
     }
 
+    @Override
     public void recalculateCapacity() {
         // FIXME: the right way to do this is to register a listener (see RouterStatsListener, VMSyncListener)
         //        for the vm sync state.  The listener model has connects/disconnects to keep things in sync much better
@@ -542,7 +543,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
         String msgContent = null;
         String totalStr;
         String usedStr;
-        String pctStr = formatPercent(usedCapacity/totalCapacity);
+        String pctStr = formatPercent(usedCapacity / totalCapacity);
         AlertType alertType = null;
         Long podId = pod == null ? null : pod.getId();
         Long clusterId = cluster == null ? null : cluster.getId();
@@ -559,8 +560,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
                 break;
             case Capacity.CAPACITY_TYPE_CPU:
                 msgSubject = "System Alert: Low Unallocated CPU in cluster " + cluster.getName() + " pod " + pod.getName() + " of availability zone " + dc.getName();
-                totalStr = _dfWhole.format(totalCapacity);
-                usedStr = _dfWhole.format(usedCapacity);
+                totalStr = DfWhole.format(totalCapacity);
+                usedStr = DfWhole.format(usedCapacity);
                 msgContent = "Unallocated CPU is low, total: " + totalStr + " Mhz, used: " + usedStr + " Mhz (" + pctStr + "%)";
                 alertType = AlertManager.AlertType.ALERT_TYPE_CPU;
                 break;
@@ -684,7 +685,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
         private int _smtpTimeout;
         private int _smtpConnectionTimeout;
 
-        public EmailAlert(String[] recipientList, String smtpHost, int smtpPort, int smtpConnectionTimeout, int smtpTimeout, boolean smtpUseAuth, final String smtpUsername,
+        public EmailAlert(String[] recipientList, String smtpHost, int smtpPort, int smtpConnectionTimeout, int smtpTimeout, boolean smtpUseAuth,
+                final String smtpUsername,
                 final String smtpPassword, String emailSender, boolean smtpDebug) {
             if (recipientList != null) {
                 _recipientList = new InternetAddress[recipientList.length];
@@ -710,7 +712,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
                 Properties smtpProps = new Properties();
                 smtpProps.put("mail.smtp.host", smtpHost);
                 smtpProps.put("mail.smtp.port", smtpPort);
-                smtpProps.put("mail.smtp.auth", ""+smtpUseAuth);
+                smtpProps.put("mail.smtp.auth", "" + smtpUseAuth);
                 smtpProps.put("mail.smtp.timeout", _smtpTimeout);
                 smtpProps.put("mail.smtp.connectiontimeout", _smtpConnectionTimeout);
 
@@ -720,7 +722,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
 
                 smtpProps.put("mail.smtps.host", smtpHost);
                 smtpProps.put("mail.smtps.port", smtpPort);
-                smtpProps.put("mail.smtps.auth", ""+smtpUseAuth);
+                smtpProps.put("mail.smtps.auth", "" + smtpUseAuth);
                 smtpProps.put("mail.smtps.timeout", _smtpTimeout);
                 smtpProps.put("mail.smtps.connectiontimeout", _smtpConnectionTimeout);
 
@@ -745,18 +747,19 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
         }
 
         // TODO:  make sure this handles SSL transport (useAuth is true) and regular
-        public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long clusterId, String subject, String content) throws MessagingException, UnsupportedEncodingException {
+        public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long clusterId, String subject, String content) throws MessagingException,
+            UnsupportedEncodingException {
             s_alertsLogger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " +
                 podId + " // clusterId:: " + null + " // message:: " + subject);
             AlertVO alert = null;
             if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE) &&
-                    (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED)) {
+                (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) &&
+                (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) &&
+                (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY) &&
+                (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) &&
+                (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC) &&
+                (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE) &&
+                (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED)) {
                 alert = _alertDao.getLastAlert(alertType.getType(), dataCenterId, podId, clusterId);
             }
 
@@ -816,7 +819,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
                     }
                 }
             });
-         }
+        }
 
         public void clearAlert(short alertType, long dataCenterId, Long podId) {
             if (alertType != -1) {
@@ -831,12 +834,12 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
     }
 
     private static String formatPercent(double percentage) {
-        return _dfPct.format(percentage * 100);
+        return DfPct.format(percentage * 100);
     }
 
     private static String formatBytesToMegabytes(double bytes) {
         double megaBytes = (bytes / (1024 * 1024));
-        return _dfWhole.format(megaBytes);
+        return DfWhole.format(megaBytes);
     }
 
     @Override
@@ -850,7 +853,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
     }
 
     @Override
-    @ActionEvent(eventType = EventTypes.ALERT_GENERATE, eventDescription = "generating alert", async=true)
+    @ActionEvent(eventType = EventTypes.ALERT_GENERATE, eventDescription = "generating alert", async = true)
     public boolean generateAlert(AlertType alertType, long dataCenterId, Long podId, String msg) {
         try {
             sendAlert(alertType, dataCenterId, podId, msg, msg);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/alert/ClusterAlertAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/ClusterAlertAdapter.java b/server/src/com/cloud/alert/ClusterAlertAdapter.java
index 568fc0f..ccb1074 100644
--- a/server/src/com/cloud/alert/ClusterAlertAdapter.java
+++ b/server/src/com/cloud/alert/ClusterAlertAdapter.java
@@ -92,7 +92,8 @@ public class ClusterAlertAdapter extends AdapterBase implements AlertAdapter {
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("Detected management server node " + mshost.getServiceIP() + " is down, send alert");
                     }
-                    _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management server node " + mshost.getServiceIP() + " is down", "");
+                    _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management server node " + mshost.getServiceIP() + " is down",
+                        "");
                 } else {
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("Detected management server node " + mshost.getServiceIP() + " is down, but alert has already been set");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
index 86f7fc1..df4f5ba 100644
--- a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
+++ b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
@@ -68,9 +68,10 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte
                     s_logger.debug("Console proxy is up, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
                         ", private IP: " + proxy.getPrivateIpAddress());
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), "Console proxy up in zone: " + dc.getName() +
-                    ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " +
-                    (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()), "Console proxy up (zone " + dc.getName() + ")");
+                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(),
+                    "Console proxy up in zone: " + dc.getName() +
+                        ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " +
+                        (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()), "Console proxy up (zone " + dc.getName() + ")");
                 break;
 
             case ConsoleProxyAlertEventArgs.PROXY_DOWN:
@@ -78,9 +79,10 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte
                     s_logger.debug("Console proxy is down, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
                         ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), "Console proxy down in zone: " + dc.getName() +
-                    ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " +
-                    (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()), "Console proxy down (zone " + dc.getName() + ")");
+                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(),
+                    "Console proxy down in zone: " + dc.getName() +
+                        ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " +
+                        (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()), "Console proxy down (zone " + dc.getName() + ")");
                 break;
 
             case ConsoleProxyAlertEventArgs.PROXY_REBOOTED:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java b/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
index 9d4de55..b7834bb 100644
--- a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
+++ b/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
@@ -106,9 +106,10 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert
                     s_logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm creation failure. zone: " +
-                    dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
-                    (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()) + ", error details: " + args.getMessage(),
+                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(),
+                    "Secondary Storage Vm creation failure. zone: " +
+                        dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
+                        (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()) + ", error details: " + args.getMessage(),
                     "Secondary Storage Vm creation failure (zone " + dc.getName() + ")");
                 break;
 
@@ -117,9 +118,10 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert
                     s_logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm startup failure. zone: " +
-                    dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
-                    (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()) + ", error details: " + args.getMessage(),
+                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(),
+                    "Secondary Storage Vm startup failure. zone: " +
+                        dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
+                        (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()) + ", error details: " + args.getMessage(),
                     "Secondary Storage Vm startup failure (zone " + dc.getName() + ")");
                 break;
 


Mime
View raw message