private String index() { String index = REQUEST.index.readFileUnique(this); StringBuilder builder = new StringBuilder(index); WaarpStringUtils.replaceAll( builder, REPLACEMENT.XXXHOSTIDXXX.toString(), Configuration.configuration.getHOST_ID()); WaarpStringUtils.replaceAll( builder, REPLACEMENT.XXXADMINXXX.toString(), "Administrator Connected"); WaarpStringUtils.replace(builder, REPLACEMENT.XXXVERSIONXXX.toString(), Version.ID); return builder.toString(); }
/** * Applied current lang to system page * * @param builder */ private void langHandle(StringBuilder builder) { // i18n: add here any new languages WaarpStringUtils.replace( builder, REPLACEMENT.XXXCURLANGENXXX.name(), lang.equalsIgnoreCase("en") ? "checked" : ""); WaarpStringUtils.replace( builder, REPLACEMENT.XXXCURLANGFRXXX.name(), lang.equalsIgnoreCase("fr") ? "checked" : ""); WaarpStringUtils.replace( builder, REPLACEMENT.XXXCURSYSLANGENXXX.name(), Messages.getSlocale().equalsIgnoreCase("en") ? "checked" : ""); WaarpStringUtils.replace( builder, REPLACEMENT.XXXCURSYSLANGFRXXX.name(), Messages.getSlocale().equalsIgnoreCase("fr") ? "checked" : ""); }
private String readFileHeader(String filename) { String value; try { value = WaarpStringUtils.readFileException(filename); } catch (InvalidArgumentException e) { logger.error("Error while trying to open: " + filename, e); return ""; } catch (FileTransferException e) { logger.error("Error while trying to read: " + filename, e); return ""; } StringBuilder builder = new StringBuilder(value); WaarpStringUtils.replace( builder, REPLACEMENT.XXXLOCALXXX.toString(), Integer.toString(Configuration.configuration.getLocalTransaction().getNumberLocalChannel()) + " " + Thread.activeCount()); WaarpStringUtils.replace( builder, REPLACEMENT.XXXNETWORKXXX.toString(), Integer.toString( Configuration.configuration.getLocalTransaction().getNumberLocalChannel())); WaarpStringUtils.replace( builder, REPLACEMENT.XXXHOSTIDXXX.toString(), Configuration.configuration.getHOST_ID()); if (authentHttp.isAuthenticated()) { WaarpStringUtils.replace( builder, REPLACEMENT.XXXADMINXXX.toString(), Messages.getString("HttpSslHandler.1")); // $NON-NLS-1$ } else { WaarpStringUtils.replace( builder, REPLACEMENT.XXXADMINXXX.toString(), Messages.getString("HttpSslHandler.0")); // $NON-NLS-1$ } TrafficCounter trafficCounter = Configuration.configuration.getGlobalTrafficShapingHandler().trafficCounter(); WaarpStringUtils.replace( builder, REPLACEMENT.XXXBANDWIDTHXXX.toString(), Messages.getString("HttpSslHandler.IN") + (trafficCounter.lastReadThroughput() >> 20) + //$NON-NLS-1$ Messages.getString("HttpSslHandler.MOPS") + //$NON-NLS-1$ Messages.getString("HttpSslHandler.OUT") + //$NON-NLS-1$ (trafficCounter.lastWriteThroughput() >> 20) + Messages.getString("HttpSslHandler.MOPS")); // $NON-NLS-1$ WaarpStringUtils.replace(builder, REPLACEMENT.XXXLANGXXX.toString(), lang); return builder.toString(); }
/** @param builder */ private void replaceStringSystem(StringBuilder builder) { WaarpStringUtils.replace( builder, REPLACEMENT.XXXXSESSIONLIMITWXXX.toString(), Long.toString(Configuration.configuration.getServerChannelWriteLimit())); WaarpStringUtils.replace( builder, REPLACEMENT.XXXXSESSIONLIMITRXXX.toString(), Long.toString(Configuration.configuration.getServerChannelReadLimit())); WaarpStringUtils.replace( builder, REPLACEMENT.XXXXDELAYCOMMDXXX.toString(), Long.toString(Configuration.configuration.getDelayCommander())); WaarpStringUtils.replace( builder, REPLACEMENT.XXXXDELAYRETRYXXX.toString(), Long.toString(Configuration.configuration.getDelayRetry())); WaarpStringUtils.replace( builder, REPLACEMENT.XXXXCHANNELLIMITWXXX.toString(), Long.toString(Configuration.configuration.getServerGlobalWriteLimit())); WaarpStringUtils.replace( builder, REPLACEMENT.XXXXCHANNELLIMITRXXX.toString(), Long.toString(Configuration.configuration.getServerGlobalReadLimit())); WaarpStringUtils.replace( builder, "XXXBLOCKXXX", Configuration.configuration.isShutdown() ? "checked" : ""); switch (WaarpLoggerFactory.getLogLevel()) { case DEBUG: WaarpStringUtils.replace(builder, "XXXLEVEL1XXX", "checked"); WaarpStringUtils.replace(builder, "XXXLEVEL2XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL3XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL4XXX", ""); break; case INFO: WaarpStringUtils.replace(builder, "XXXLEVEL1XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL2XXX", "checked"); WaarpStringUtils.replace(builder, "XXXLEVEL3XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL4XXX", ""); break; case WARN: WaarpStringUtils.replace(builder, "XXXLEVEL1XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL2XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL3XXX", "checked"); WaarpStringUtils.replace(builder, "XXXLEVEL4XXX", ""); break; case ERROR: WaarpStringUtils.replace(builder, "XXXLEVEL1XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL2XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL3XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL4XXX", "checked"); break; default: WaarpStringUtils.replace(builder, "XXXLEVEL1XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL2XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL3XXX", ""); WaarpStringUtils.replace(builder, "XXXLEVEL4XXX", ""); break; } }