GitHub user ProjectMoon opened a pull request:

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

    Make VirtualMachineName into an injectable service class

    This pull request refactors the VirtualMachineName class into an injectable 
dependency. It is one of the few remaining classes that appears to be spaghetti 
tangled through many places in the code, and it hasn't been updated in years. 
These two commits introduce a VirtualMachineNameService which is injected 
everywhere it's relevant.
    
    The rationale for this is to separate concerns better and remove spaghetti 
dependencies on static methods. It also opens up the door to easier 
extensibility in the future.
    
    Some potential issues with this pull request:
    
    * Should the VirtualMachineNameService go into 
spring-core-managers-context.xml?
    * I have added an injection to both VMWare and HypervDirectConnectResource. 
HyperV already had an inject, but VMWare did not. Both of these are direct 
agents which means they run in the management server... so injection should 
work. But I don't know if this violates some guideline or not.

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

    $ git pull https://github.com/greenqloud/cloudstack pr-vm-name-destatic

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

    https://github.com/apache/cloudstack/pull/988.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 #988
    
----
commit 8095afc07a2657b1363bbeddf80e54931f150f19
Author: jeff <j...@greenqloud.com>
Date:   2015-10-27T11:27:52Z

    Make VirtualMachineName into an injectable dependency.
    
    This is one of few remaining classes that is not injectable. In most
    places that reference it, it can be injected easily. It should also
    be inejctable in the VMWare and HyperV resources which reference it
    since they are direct agents.
    
    Rationale: Updating the code to remove static spaghetti dependencies
    and paving the way for more internal extensibility.

commit d351ba982a4f4914eb0ad3a77ee67549a328965d
Author: jeff <j...@greenqloud.com>
Date:   2015-10-27T12:04:07Z

    Move VirtualMachineName to Service/Impl pattern.
    
    This commit mmakes the VirtualMachineName class into a
    VirtualMachineNameService which has an implementation class loaded as
    a bean in the core-managers-context. This brings it in line with the
    dependency injection patterns used in the CloudStack management
    server.

----


---
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