} else {
throw new IllegalArgumentException("Neither template nor module name was specified to render a control");
}
// controlTool֧�ֿ�component���ã�����ȡ��ָ��component�µ�service��
ModuleLoaderService moduleLoaderService = getService("moduleLoaderService", componentName,
this.moduleLoaderService, ModuleLoaderService.class);
MappingRuleService mappingRuleService = getService("mappingRuleService", componentName,
this.mappingRuleService, MappingRuleService.class);
TemplateService templateService = getService("templateService", componentName, this.templateService,
TemplateService.class);
// ȡ��ʵ�ʵ�template/module����
String templateName = null;
String moduleName = null;
if (isTemplate) {
templateName = target;
moduleName = mappingRuleService.getMappedName(CONTROL_MODULE, target);
} else {
moduleName = mappingRuleService.getMappedName(CONTROL_MODULE_NO_TEMPLATE, target);
}
// ִ��control module
Module controlModule;
if (templateName == null) {
// templateNameδָ��ʱ��������module����û�����׳�ModuleNotFoundException
controlModule = moduleLoaderService.getModule(CONTROL_MODULE, moduleName);
} else {
// ��ָ����templateNameʱ������û�е�control module����������Ⱦģ�塣
// ������ʵ����page-driven������дģ�壬��Ҫʱ��дһ��module class��֮��Ӧ��
controlModule = moduleLoaderService.getModuleQuiet(CONTROL_MODULE, moduleName);
}
if (log.isTraceEnabled()) {
if (templateName != null) {
log.trace("Rendering control: template=" + templateName + ", control=" + moduleName);