use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.
the class AbstractJobBeanDefinitionParser method createJobListeners.
private List<BeanDefinition> createJobListeners(final Element element) {
Element listenerElement = DomUtils.getChildElementByTagName(element, LISTENER_TAG);
Element distributedListenerElement = DomUtils.getChildElementByTagName(element, DISTRIBUTED_LISTENER_TAG);
List<BeanDefinition> result = new ManagedList<>(2);
if (null != listenerElement) {
BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(listenerElement.getAttribute(CLASS_ATTRIBUTE));
factory.setScope(BeanDefinition.SCOPE_PROTOTYPE);
result.add(factory.getBeanDefinition());
}
if (null != distributedListenerElement) {
BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(distributedListenerElement.getAttribute(CLASS_ATTRIBUTE));
factory.setScope(BeanDefinition.SCOPE_PROTOTYPE);
factory.addConstructorArgValue(distributedListenerElement.getAttribute(DISTRIBUTED_LISTENER_STARTED_TIMEOUT_MILLISECONDS_ATTRIBUTE));
factory.addConstructorArgValue(distributedListenerElement.getAttribute(DISTRIBUTED_LISTENER_COMPLETED_TIMEOUT_MILLISECONDS_ATTRIBUTE));
result.add(factory.getBeanDefinition());
}
return result;
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.
the class AbstractJobBeanDefinitionParser method createJobPropertiesBeanDefinition.
private BeanDefinition createJobPropertiesBeanDefinition(final Element element) {
BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(JobProperties.class);
Map<JobPropertiesEnum, String> map = new LinkedHashMap<>(JobPropertiesEnum.values().length, 1);
map.put(JobPropertiesEnum.EXECUTOR_SERVICE_HANDLER, element.getAttribute(EXECUTOR_SERVICE_HANDLER_ATTRIBUTE));
map.put(JobPropertiesEnum.JOB_EXCEPTION_HANDLER, element.getAttribute(JOB_EXCEPTION_HANDLER_ATTRIBUTE));
result.addConstructorArgValue(map);
return result.getBeanDefinition();
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.
the class AbstractJobBeanDefinitionParser method createJobCoreBeanDefinition.
private BeanDefinition createJobCoreBeanDefinition(final Element element) {
BeanDefinitionBuilder jobCoreBeanDefinitionBuilder = BeanDefinitionBuilder.rootBeanDefinition(JobCoreConfiguration.class);
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(ID_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(CRON_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(SHARDING_TOTAL_COUNT_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(SHARDING_ITEM_PARAMETERS_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(JOB_PARAMETER_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(FAILOVER_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(MISFIRE_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(element.getAttribute(DESCRIPTION_ATTRIBUTE));
jobCoreBeanDefinitionBuilder.addConstructorArgValue(createJobPropertiesBeanDefinition(element));
return jobCoreBeanDefinitionBuilder.getBeanDefinition();
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.
the class DataflowJobBeanDefinitionParser method getJobTypeConfigurationBeanDefinition.
@Override
protected BeanDefinition getJobTypeConfigurationBeanDefinition(final BeanDefinition jobCoreConfigurationBeanDefinition, final Element element) {
BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(DataflowJobConfiguration.class);
result.addConstructorArgValue(jobCoreConfigurationBeanDefinition);
result.addConstructorArgValue(element.getAttribute(BaseJobBeanDefinitionParserTag.CLASS_ATTRIBUTE));
result.addConstructorArgValue(element.getAttribute(DataflowJobBeanDefinitionParserTag.STREAMING_PROCESS_ATTRIBUTE));
return result.getBeanDefinition();
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.
the class ScriptJobBeanDefinitionParser method getJobTypeConfigurationBeanDefinition.
@Override
protected BeanDefinition getJobTypeConfigurationBeanDefinition(final BeanDefinition jobCoreConfigurationBeanDefinition, final Element element) {
BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(ScriptJobConfiguration.class);
result.addConstructorArgValue(jobCoreConfigurationBeanDefinition);
result.addConstructorArgValue(element.getAttribute(ScriptJobBeanDefinitionParserTag.SCRIPT_COMMAND_LINE_ATTRIBUTE));
return result.getBeanDefinition();
}
Aggregations