use of org.meveo.service.script.ScriptInstanceService in project meveo by meveo-org.
the class MeveoFunctionMapper method getScriptInstanceService.
@SuppressWarnings("unchecked")
private static ScriptInstanceService getScriptInstanceService() {
if (scriptInstanceService == null) {
try {
InitialContext initialContext = new InitialContext();
BeanManager beanManager = (BeanManager) initialContext.lookup("java:comp/BeanManager");
Bean<ScriptInstanceService> bean = (Bean<ScriptInstanceService>) beanManager.resolve(beanManager.getBeans(ScriptInstanceService.class));
scriptInstanceService = (ScriptInstanceService) beanManager.getReference(bean, bean.getBeanClass(), beanManager.createCreationalContext(bean));
} catch (NamingException e) {
Logger log = LoggerFactory.getLogger(MeveoFunctionMapper.class);
log.error("Unable to access ScriptInstanceService", e);
throw new RuntimeException(e);
}
}
return scriptInstanceService;
}
Aggregations