List of usage examples for org.springframework.context ConfigurableApplicationContext getMessage
String getMessage(String code, @Nullable Object[] args, Locale locale) throws NoSuchMessageException;
From source file:com.jaspersoft.jasperserver.export.BaseExportImportCommand.java
protected boolean process(String[] args) throws IOException { Parameters exportParameters = parseArgs(args); ConfigurableApplicationContext ctx; if (exportParameters.hasParameter(ARG_HELP)) { ctx = createSpringContext(exportParameters, "helpApplicationContext-export-import*.xml"); } else {//from w ww. ja v a 2s . com ctx = createSpringContext(exportParameters, "applicationContext*.xml"); } try { boolean success = true; CommandMetadata metadataBean = getCommandMetadataBean(ctx); if (exportParameters.hasParameter(ARG_HELP)) { CommandHelp helpBean = getHelpBean(ctx); helpBean.printHelp(args[0], metadataBean, System.out); } else { CommandBean commandBean = getCommandBean(exportParameters, ctx); try { metadataBean.validateParameters(exportParameters); commandBean.process(exportParameters); } catch (JSExceptionWrapper e) { throw e; } catch (JSException e) { success = false; if (log.isInfoEnabled()) { log.info(e.getMessage(), e); } String message = ctx.getMessage(e.getMessage(), e.getArgs(), Locale.getDefault()); System.err.println(message); } } return success; } finally { ctx.close(); } }