// create Spring resource descriptor based on configuration
String stringResource = null;
try {
stringResource = createSpringContext(config);
} catch (TuboResourceException e) {
throw new TuboResourceException("Tubo configuration can't be created",e);
}
//
// create Bean Factory
ByteArrayResource byteResource = new ByteArrayResource(stringResource.getBytes());
BeanFactory beanFactory = new XmlBeanFactory(byteResource);
//
// get resource manager
SpringResourceManagerImpl rm = null;
try {
//
// get FlowExecutor via Spring
rm = (SpringResourceManagerImpl)beanFactory.getBean(SPRING_RESOURCE_MANAGER_BEAN_ID);
} catch (BeansException e) {
//
// log error
log.error("Error trying to get ResourceManager", e);
//
// throw
throw new TuboResourceException("Error trying to get Spring ResourceManager",e);
}
//
// set configuration
// TODO: can be inyected?
rm.setConfiguration(config);