/** Get statistical variable value. */ private static String getStatisticalVariableValue( FtpIoSession session, FtpServerContext context, String varName) { String varVal = null; FtpStatistics stat = context.getFtpStatistics(); // server start time if (varName.equals(STAT_START_TIME)) { varVal = DateUtils.getISO8601Date(stat.getStartTime().getTime()); } // connection statistical variables else if (varName.startsWith("stat.con")) { varVal = getStatisticalConnectionVariableValue(session, context, varName); } // login statistical variables else if (varName.startsWith("stat.login.")) { varVal = getStatisticalLoginVariableValue(session, context, varName); } // file statistical variable else if (varName.startsWith("stat.file")) { varVal = getStatisticalFileVariableValue(session, context, varName); } // directory statistical variable else if (varName.startsWith("stat.dir.")) { varVal = getStatisticalDirectoryVariableValue(session, context, varName); } return varVal; }
/** Get statistical login variable value. */ private static String getStatisticalLoginVariableValue( FtpIoSession session, FtpServerContext context, String varName) { String varVal = null; FtpStatistics stat = context.getFtpStatistics(); // total login number if (varName.equals(STAT_LOGIN_TOTAL)) { varVal = String.valueOf(stat.getTotalLoginNumber()); } // current login number else if (varName.equals(STAT_LOGIN_CURR)) { varVal = String.valueOf(stat.getCurrentLoginNumber()); } // total anonymous login number else if (varName.equals(STAT_LOGIN_ANON_TOTAL)) { varVal = String.valueOf(stat.getTotalAnonymousLoginNumber()); } // current anonymous login number else if (varName.equals(STAT_LOGIN_ANON_CURR)) { varVal = String.valueOf(stat.getCurrentAnonymousLoginNumber()); } return varVal; }
/** Get statistical directory variable value. */ private static String getStatisticalDirectoryVariableValue( FtpIoSession session, FtpServerContext context, String varName) { String varVal = null; FtpStatistics stat = context.getFtpStatistics(); // total directory created if (varName.equals(STAT_DIR_CREATE_COUNT)) { varVal = String.valueOf(stat.getTotalDirectoryCreated()); } // total directory removed else if (varName.equals(STAT_DIR_DELETE_COUNT)) { varVal = String.valueOf(stat.getTotalDirectoryRemoved()); } return varVal; }
/** Get statistical connection variable value. */ private static String getStatisticalConnectionVariableValue( FtpIoSession session, FtpServerContext context, String varName) { String varVal = null; FtpStatistics stat = context.getFtpStatistics(); // total connection number if (varName.equals(STAT_CON_TOTAL)) { varVal = String.valueOf(stat.getTotalConnectionNumber()); } // current connection number else if (varName.equals(STAT_CON_CURR)) { varVal = String.valueOf(stat.getCurrentConnectionNumber()); } return varVal; }
/** Get statistical file variable value. */ private static String getStatisticalFileVariableValue( FtpIoSession session, FtpServerContext context, String varName) { String varVal = null; FtpStatistics stat = context.getFtpStatistics(); // total number of file upload if (varName.equals(STAT_FILE_UPLOAD_COUNT)) { varVal = String.valueOf(stat.getTotalUploadNumber()); } // total bytes uploaded else if (varName.equals(STAT_FILE_UPLOAD_BYTES)) { varVal = String.valueOf(stat.getTotalUploadSize()); } // total number of file download else if (varName.equals(STAT_FILE_DOWNLOAD_COUNT)) { varVal = String.valueOf(stat.getTotalDownloadNumber()); } // total bytes downloaded else if (varName.equals(STAT_FILE_DOWNLOAD_BYTES)) { varVal = String.valueOf(stat.getTotalDownloadSize()); } // total number of files deleted else if (varName.equals(STAT_FILE_DELETE_COUNT)) { varVal = String.valueOf(stat.getTotalDeleteNumber()); } return varVal; }