1818 */
1919package org .apache .cloudstack .spring .module .model .impl ;
2020
21- import org .apache .cloudstack .spring .module .context .ResourceApplicationContext ;
22- import org .apache .cloudstack .spring .module .model .ModuleDefinition ;
23- import org .apache .cloudstack .spring .module .model .ModuleDefinitionSet ;
24- import org .apache .commons .io .IOUtils ;
25- import org .apache .logging .log4j .LogManager ;
26- import org .apache .logging .log4j .Logger ;
27- import org .springframework .beans .BeansException ;
28- import org .springframework .context .ApplicationContext ;
29- import org .springframework .context .annotation .Bean ;
30- import org .springframework .context .annotation .Configuration ;
31- import org .springframework .core .io .Resource ;
32- import org .springframework .core .io .UrlResource ;
33- import org .springframework .util .StringUtils ;
34-
3521import java .io .IOException ;
3622import java .io .InputStream ;
3723import java .net .URL ;
4632import java .util .Set ;
4733import java .util .Stack ;
4834
35+ import org .apache .commons .io .IOUtils ;
36+ import org .apache .logging .log4j .Logger ;
37+ import org .apache .logging .log4j .LogManager ;
38+ import org .springframework .beans .BeansException ;
39+ import org .springframework .context .ApplicationContext ;
40+ import org .springframework .context .annotation .Bean ;
41+ import org .springframework .context .annotation .Configuration ;
42+ import org .springframework .core .io .Resource ;
43+ import org .springframework .core .io .UrlResource ;
44+ import org .springframework .util .StringUtils ;
45+
46+ import org .apache .cloudstack .spring .module .context .ResourceApplicationContext ;
47+ import org .apache .cloudstack .spring .module .model .ModuleDefinition ;
48+ import org .apache .cloudstack .spring .module .model .ModuleDefinitionSet ;
49+
50+
4951public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
5052
5153 protected Logger logger = LogManager .getLogger (getClass ());
@@ -74,9 +76,8 @@ public DefaultModuleDefinitionSet(Map<String, ModuleDefinition> modules, String
7476 }
7577
7678 public void load () throws IOException {
77- if (!loadRootContext ()) {
79+ if (!loadRootContext ())
7880 return ;
79- }
8081
8182 printHierarchy ();
8283 loadContexts ();
@@ -86,9 +87,8 @@ public void load() throws IOException {
8687 protected boolean loadRootContext () {
8788 ModuleDefinition def = modules .get (root );
8889
89- if (def == null ) {
90+ if (def == null )
9091 return false ;
91- }
9292
9393 ApplicationContext defaultsContext = getDefaultsContext ();
9494
@@ -194,7 +194,8 @@ protected ApplicationContext getDefaultsContext() {
194194 context .setApplicationName ("/defaults" );
195195 context .refresh ();
196196
197- @ SuppressWarnings ("unchecked" ) final List <Resource > resources = (List <Resource >) context .getBean (DEFAULT_CONFIG_RESOURCES );
197+ @ SuppressWarnings ("unchecked" )
198+ final List <Resource > resources = (List <Resource >) context .getBean (DEFAULT_CONFIG_RESOURCES );
198199
199200 withModule (new WithModule () {
200201 @ Override
@@ -205,12 +206,12 @@ public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
205206 }
206207 });
207208
208- configProperties = (Properties ) context .getBean (DEFAULT_CONFIG_PROPERTIES );
209+ configProperties = (Properties )context .getBean (DEFAULT_CONFIG_PROPERTIES );
209210 for (Resource resource : resources ) {
210211 load (resource , configProperties );
211212 }
212213
213- for (Resource resource : (Resource []) context .getBean (MODULE_PROPERITES )) {
214+ for (Resource resource : (Resource [])context .getBean (MODULE_PROPERITES )) {
214215 load (resource , configProperties );
215216 }
216217
@@ -266,9 +267,8 @@ protected void withModule(WithModule with) {
266267 }
267268
268269 protected void withModule (ModuleDefinition def , Stack <ModuleDefinition > parents , WithModule with ) {
269- if (def == null ) {
270+ if (def == null )
270271 return ;
271- }
272272
273273 if (!shouldLoad (def )) {
274274 logger .info ("Excluding context [" + def .getName () + "] based on configuration" );
0 commit comments