GitHub user pedro-martins opened a pull request:

    https://github.com/apache/cloudstack/pull/714

    Changed variable s_logger to non-static and fixed its name in 
“com.cloud.utils.component.ComponentLifecycleBase” and its subclasses

    Hi guys, 
    We have noticed that every single class that is a subclass of 
“ComponentLifecycleBase” instantiate their on “logger” manually and 
uses a nonstandard name. We fixed that by changing the variable in 
“ComponentLifecycleBase” to protected and non-static and instantiated it 
using the method “getClass” from Object class. Therefore, we can reduce the 
code in a few hundred lines and use a more intuitive name for the logger 
variable.
    
    During that process we found a static method that used the “s_logger” 
variable in classes:
    com.cloud.network.element.VirtualRouterElement 
    org.apache.cloudstack.network.element.InternalLoadBalancerElement 
    
    To fix that we had to create a new class 
“com.cloud.network.element.HAProxyLBRule”, instantiate it with @Componente 
and inject into the aforementioned classes.
    
    The class that we create is “com.cloud.network.element.HAProxyLBRule” 
and has the following methods:
    com.cloud.network.element.HAProxyLBRule.containsOnlyNumbers(String, String)
    
com.cloud.network.element.HAProxyLBRule.validateHAProxyLBRule(LoadBalancingRule)
    
    Sadly we could not write test cases to it; hence we did not fully 
understand those methods. However, if anyone out there understands it, we would 
appreciate some code to be added to it.
    
    As minor this change may seem; we believe that it enhances a little bit the 
ACS code by using standard name to logger variable.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rafaelweingartner/cloudstack 
master-lrg-cs-hackday-003

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/714.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #714
    
----
commit 631dccada87c131f9b2106d9942d07cb6a61db79
Author: pedro-martins <php...@gmail.com>
Date:   2015-08-18T14:54:20Z

    Changed the variable in “ComponentLifecycleBase” to protected and
    non-static and instantiated it using the method “getClass” from Object
    class. Therefore, we can reduce the code in a few hundred lines and use
    a more intuitive name for the logger variable.
    
    During that process we found a static method that used the “s_logger”
    variable in classes:
    com.cloud.network.element.VirtualRouterElement 
    org.apache.cloudstack.network.element.InternalLoadBalancerElement 
    
    To fix that we had to create a new class
    “com.cloud.network.element.HAProxyLBRule”, instantiate it with
    @Componente and inject into the aforementioned classes.
    
    The class that we create is “com.cloud.network.element.HAProxyLBRule”
    and has the following methods:
    com.cloud.network.element.HAProxyLBRule.containsOnlyNumbers(String,
    String)
    
com.cloud.network.element.HAProxyLBRule.validateHAProxyLBRule(LoadBalancingRule)

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to