public void service(SourceBean serviceRequest, SourceBean serviceResponse) {
logger.debug("IN");
Monitor monitor =MonitorFactory.start("SpagoBI_Console.ConsoleEngineStartAction.service");
Locale locale;
DataSetServiceProxy proxyDS = null;
ConsoleEngineInstance consoleEngineInstance = null;
try {
setEngineName(ENGINE_NAME);
super.service(serviceRequest, serviceResponse);
logger.debug("User Id: " + getUserId());
logger.debug("Audit Id: " + getAuditId());
logger.debug("Document Id: " + getDocumentId());
logger.debug("Template: " + getTemplateAsString());
if(getAuditServiceProxy() != null) {
logger.debug("Audit enabled: [TRUE]");
getAuditServiceProxy().notifyServiceStartEvent();
} else {
logger.debug("Audit enabled: [FALSE]");
}
logger.debug("Creating engine instance ...");
try {
consoleEngineInstance = ConsoleEngine.createInstance( getTemplateAsJSONObject(), getEnv() );
} catch(Throwable t) {
SpagoBIEngineStartupException serviceException;
String msg = "Impossible to create engine instance for document [" + getDocumentId() + "].";
Throwable rootException = t;
while(rootException.getCause() != null) {
rootException = rootException.getCause();
}
String str = rootException.getMessage()!=null? rootException.getMessage(): rootException.getClass().getName();
msg += "\nThe root cause of the error is: " + str;
serviceException = new SpagoBIEngineStartupException(ENGINE_NAME, msg, t);
throw serviceException;
}
logger.debug("Engine instance succesfully created");
locale = (Locale)consoleEngineInstance.getEnv().get(EngineConstants.ENV_LOCALE);
setAttributeInSession( ENGINE_INSTANCE, consoleEngineInstance);
setAttribute(ENGINE_INSTANCE, consoleEngineInstance);
setAttribute(LANGUAGE, locale.getLanguage());