use of com.cloud.spring.module.model.ModuleDefinition in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method withModule.
protected void withModule(final WithModule with) {
final ModuleDefinition rootDef = modules.get(root);
withModule(rootDef, new Stack<>(), with);
}
use of com.cloud.spring.module.model.ModuleDefinition in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method withModule.
protected void withModule(final ModuleDefinition def, final Stack<ModuleDefinition> parents, final WithModule with) {
if (def == null) {
return;
}
if (!shouldLoad(def)) {
log.info("Excluding context [{}] based on configuration", def.getName());
return;
}
with.with(def, parents);
parents.push(def);
for (final ModuleDefinition child : def.getChildren()) {
withModule(child, parents, with);
}
parents.pop();
}
use of com.cloud.spring.module.model.ModuleDefinition in project cosmic by MissionCriticalCloud.
the class CloudStackSpringContext method getModuleDefinitionForWeb.
public ModuleDefinition getModuleDefinitionForWeb(final String name) {
ModuleDefinition def = moduleDefinitionSet.getModuleDefinition(name);
if (def != null) {
return def;
}
/* Grab farthest descendant that is deterministic */
def = moduleDefinitionSet.getModuleDefinition(baseName);
if (def == null) {
throw new RuntimeException("Failed to find base spring module to extend for web");
}
while (def.getChildren().size() == 1) {
def = def.getChildren().iterator().next();
}
return def;
}
use of com.cloud.spring.module.model.ModuleDefinition in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method getConfigResources.
@Override
public Resource[] getConfigResources(final String name) {
final Set<Resource> resources = new LinkedHashSet<>();
ModuleDefinition original = null;
ModuleDefinition def = original = modules.get(name);
if (def == null) {
return new Resource[] {};
}
resources.addAll(def.getContextLocations());
while (def != null) {
resources.addAll(def.getInheritableContextLocations());
def = modules.get(def.getParentName());
}
resources.addAll(original.getOverrideContextLocations());
return resources.toArray(new Resource[resources.size()]);
}
use of com.cloud.spring.module.model.ModuleDefinition in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method loadRootContext.
protected boolean loadRootContext() {
final ModuleDefinition def = modules.get(root);
if (def == null) {
return false;
}
final ApplicationContext defaultsContext = getDefaultsContext();
rootContext = loadContext(def, defaultsContext);
return true;
}
Aggregations