Example usage for java.util.logging Level ALL

List of usage examples for java.util.logging Level ALL

Introduction

In this page you can find the example usage for java.util.logging Level ALL.

Prototype

Level ALL

To view the source code for java.util.logging Level ALL.

Click Source Link

Document

ALL indicates that all messages should be logged.

Usage

From source file:org.eclipse.birt.report.engine.api.ReportRunner.java

/**
 * new a EngineConfig and config it with user's setting
 * /*from w w  w . j av  a 2s.  co m*/
 */
protected EngineConfig createEngineConfig() {
    EngineConfig config = new EngineConfig();

    String resourcePath = (String) params.get("resourceDir");
    if (resourcePath != null)
        config.setResourcePath(resourcePath.trim());

    String tempDir = (String) params.get("tempDir");
    if (tempDir != null)
        config.setTempDir(tempDir.trim());

    String logDir = (String) params.get("logDir");
    String logLevel = (String) params.get("logLevel");
    Level level = null;
    if (logLevel != null) {
        logLevel = logLevel.trim();
        if ("all".equalsIgnoreCase(logLevel)) {
            level = Level.ALL;
        } else if ("config".equalsIgnoreCase(logLevel)) {
            level = Level.CONFIG;
        } else if ("fine".equalsIgnoreCase(logLevel)) {
            level = Level.FINE;
        } else if ("finer".equalsIgnoreCase(logLevel)) {
            level = Level.FINER;
        } else if ("finest".equalsIgnoreCase(logLevel)) {
            level = Level.FINEST;
        } else if ("info".equalsIgnoreCase(logLevel)) {
            level = Level.INFO;
        } else if ("off".equalsIgnoreCase(logLevel)) {
            level = Level.OFF;
        } else if ("severe".equalsIgnoreCase(logLevel)) {
            level = Level.SEVERE;
        } else if ("warning".equalsIgnoreCase(logLevel)) {
            level = Level.WARNING;
        }
    }
    String logD = (logDir == null) ? config.getLogDirectory() : logDir;
    Level logL = (level == null) ? config.getLogLevel() : level;
    config.setLogConfig(logD, logL);

    String logFile = (String) params.get("logFile");
    if (logFile != null)
        config.setLogFile(logFile.trim());

    String scripts = (String) params.get("scriptPath");
    HashMap map = new HashMap();
    map.put(EngineConstants.PROJECT_CLASSPATH_KEY, scripts);
    config.setAppContext(map);

    return config;
}

From source file:org.quickserver.net.qsadmin.CommandHandler.java

public void handleCommand(ClientHandler handler, String command) throws SocketTimeoutException, IOException {
    if (command == null || command.trim().equals("")) {
        handler.sendClientMsg("-ERR No command");
        return;//from  w w  w  . j a  va 2 s  .  c o  m
    }

    //v1.2 - plugin
    if (plugin != null && plugin.handleCommand(handler, command)) {
        logger.fine("Handled by plugin.");
        return;
    }
    QSAdminServer adminServer = (QSAdminServer) handler.getServer().getStoreObjects()[2];

    StringTokenizer st = new StringTokenizer(command, " ");
    String cmd = null;
    cmd = st.nextToken().toLowerCase();
    String param[] = new String[st.countTokens()];

    QuickServer target = null;
    for (int i = 0; st.hasMoreTokens(); i++) {
        param[i] = st.nextToken();
    }

    if (command.equals("start console")) { /*v1.4.5*/
        QSAdminShell.getInstance((QuickServer) handler.getServer().getStoreObjects()[0], null);
        handler.sendClientMsg("+OK QSAdminShell is started.");
        return;
    } else if (command.equals("stop console")) { /*v1.4.5*/
        QSAdminShell shell = QSAdminShell.getInstance(null, null);
        if (shell != null) {
            try {
                shell.stopShell();
            } catch (Exception err) {
                handler.sendClientMsg("-ERR Error stopping QSAdminShell: " + err);
            }
            handler.sendClientMsg("+OK QSAdminShell is stopped.");
        } else {
            handler.sendClientMsg("-ERR QSAdminShell is not running.");
        }
        return;
    } else if (cmd.equals("jvm")) {/*2.0.0*/
        /*
           jvm dumpHeap
           jvm dumpJmapHisto file
           jvm dumpJmapHisto log
           jvm threadDump file
           jvm threadDump log
           jvm dumpJStack file
           jvm dumpJStack log
         */

        if (param.length == 0) {
            handler.sendClientMsg("-ERR " + "Use jvm help");
            return;
        }

        if (param[0].equals("dumpHeap")) {
            File file = getFile("dumpHeap", ".bin");
            JvmUtil.dumpHeap(file.getAbsolutePath(), true);
            handler.sendClientMsg("+OK File " + file.getAbsolutePath());
        } else if (param[0].equals("dumpJmapHisto")) {
            if (param.length < 2)/*dumpJmapHisto file*/ {
                handler.sendClientMsg("-ERR " + "insufficient param");
                return;
            }

            if (param[1].equals("file")) {
                File file = getFile("dumpJmapHisto", ".txt");

                handler.sendClientMsg("+OK info follows");
                handler.sendClientMsg("Starting.. ");

                JvmUtil.dumpJmapHisto(file.getAbsolutePath());

                handler.sendClientMsg("Done - File " + file.getAbsolutePath());
                handler.sendClientMsg(".");
            } else if (param[1].equals("log")) {
                handler.sendClientMsg("+OK info follows");
                handler.sendClientMsg("Starting.. ");

                JvmUtil.dumpJmapHistoToLog();

                handler.sendClientMsg("Done - Dumped to jdk log file");
                handler.sendClientMsg(".");
            } else {
                handler.sendClientMsg("-ERR " + "bad param");
                return;
            }
        } else if (param[0].equals("threadDump")) {
            if (param.length < 2)/*threadDump file*/ {
                handler.sendClientMsg("-ERR " + "insufficient param");
                return;
            }

            if (param[1].equals("file")) {
                File file = getFile("threadDump", ".txt");

                handler.sendClientMsg("+OK info follows");
                handler.sendClientMsg("Starting.. ");

                JvmUtil.threadDump(file.getAbsolutePath());

                handler.sendClientMsg("Done - File " + file.getAbsolutePath());
                handler.sendClientMsg(".");
            } else if (param[1].equals("log")) {
                handler.sendClientMsg("+OK info follows");
                handler.sendClientMsg("Starting.. ");

                JvmUtil.threadDumpToLog();

                handler.sendClientMsg("Done - Dumped to jdk log file");
                handler.sendClientMsg(".");
            } else {
                handler.sendClientMsg("-ERR " + "bad param");
                return;
            }
        } else if (param[0].equals("dumpJStack")) {
            if (param.length < 2)/*dumpJStack file*/ {
                handler.sendClientMsg("-ERR " + "insufficient param");
                return;
            }

            if (param[1].equals("file")) {
                File file = getFile("dumpJStack", ".txt");

                handler.sendClientMsg("+OK info follows");
                handler.sendClientMsg("Starting.. ");

                JvmUtil.dumpJStack(file.getAbsolutePath());

                handler.sendClientMsg("Done - File " + file.getAbsolutePath());
                handler.sendClientMsg(".");
            } else if (param[1].equals("log")) {
                handler.sendClientMsg("+OK info follows");
                handler.sendClientMsg("Starting.. ");

                JvmUtil.dumpJStackToLog();

                handler.sendClientMsg("Done - Dumped to jdk log file");
                handler.sendClientMsg(".");
            } else {
                handler.sendClientMsg("-ERR " + "bad param");
                return;
            }
        } else if (param[0].equals("help")) {
            handler.sendClientMsg("+OK info follows");

            handler.sendClientMsg("jvm dumpJmapHisto file");
            handler.sendClientMsg("jvm dumpJStack file");

            handler.sendClientMsg(" ");

            handler.sendClientMsg("jvm threadDump file");
            handler.sendClientMsg("jvm dumpHeap");

            handler.sendClientMsg(" ");

            handler.sendClientMsg("jvm threadDump log");
            handler.sendClientMsg("jvm dumpJmapHisto log");
            handler.sendClientMsg("jvm dumpJStack log");

            handler.sendClientMsg(".");
            return;
        } else {
            handler.sendClientMsg("-ERR " + "bad param use jvm help");
        }
        return;
    }

    if (param.length > 0) {
        if (param[0].equals("server"))
            target = (QuickServer) handler.getServer().getStoreObjects()[0];
        else if (param[0].equals("self"))
            target = handler.getServer();
        else {
            handler.sendClientMsg("-ERR Bad <<target>> : " + param[0]);
            return;
        }
    }

    if (cmd.equals("help")) {
        handler.sendClientMsg(
                "+OK info follows" + "\r\n" + "Refer Api Docs for org.quickserver.net.qsadmin.CommandHandler");
        handler.sendClientMsg(".");
        return;
    } else if (cmd.equals("quit")) {
        handler.sendClientMsg("+OK Bye ;-)");
        handler.closeConnection();
        return;
    } else if (cmd.equals("shutdown")) {
        try {
            QuickServer controlServer = (QuickServer) handler.getServer().getStoreObjects()[0];
            if (controlServer != null && controlServer.isClosed() == false) {
                controlServer.stopServer();
            }
            if (handler.getServer() != null && handler.getServer().isClosed() == false) {
                handler.getServer().stopServer();
            }

            QSAdminShell shell = QSAdminShell.getInstance(null, null);
            if (shell != null) {
                try {
                    shell.stopShell();
                } catch (Exception err) {
                    logger.warning("Error stoping shell: " + err);
                }
            }

            handler.sendClientMsg("+OK Done");
        } catch (AppException e) {
            handler.sendClientMsg("-ERR " + e);
        }
        return;
    } else if (cmd.equals("version")) {
        handler.sendClientMsg("+OK " + QuickServer.getVersion());
        return;
    } else if (cmd.equals("kill") || cmd.equals("exit")) /*v1.3,v1.3.2*/ {
        StringBuilder errBuf = new StringBuilder();
        QuickServer controlServer = (QuickServer) handler.getServer().getStoreObjects()[0];
        int exitCode = 0;

        if (param.length != 0) {
            try {
                exitCode = Integer.parseInt(param[0]);
            } catch (Exception nfe) {
                /*ignore*/}
        }

        try {
            if (controlServer != null && controlServer.isClosed() == false) {
                try {
                    controlServer.stopServer();
                } catch (AppException ae) {
                    errBuf.append(ae.toString());
                }
            }
            if (handler.getServer() != null && handler.getServer().isClosed() == false) {
                try {
                    handler.getServer().stopServer();
                } catch (AppException ae) {
                    errBuf.append(ae.toString());
                }
            }

            QSAdminShell shell = QSAdminShell.getInstance(null, null);
            if (shell != null) {
                try {
                    shell.stopShell();
                } catch (Exception err) {
                    errBuf.append(err.toString());
                }
            }

            if (errBuf.length() == 0)
                handler.sendClientMsg("+OK Done");
            else
                handler.sendClientMsg("+OK Done, Errors: " + errBuf.toString());
        } catch (Exception e) {
            handler.sendClientMsg("-ERR Exception : " + e + "\r\n" + errBuf.toString());
            if (exitCode == 0)
                exitCode = 1;
        } finally {
            try {
                if (controlServer != null)
                    controlServer.closeAllPools();
                if (handler.getServer() != null)
                    handler.getServer().closeAllPools();
            } catch (Exception er) {
                logger.warning("Error closing pools: " + er);
            }
            System.exit(exitCode);
        }
        return;
    } else if (cmd.equals("memoryinfo")) { /*v1.3.2*/
        //Padding : Total:Used:Max
        float totalMemory = (float) runtime.totalMemory();
        float usedMemory = totalMemory - (float) runtime.freeMemory();
        float maxMemory = (float) runtime.maxMemory();
        handler.sendClientMsg("+OK " + totalMemory + ":" + usedMemory + ":" + maxMemory);
        return;
    } else if (cmd.equals("systeminfo")) { /*v1.4.5*/
        handler.sendClientMsg("+OK info follows");
        handler.sendClientMsg(MyString.getSystemInfo(target.getVersion()));
        handler.sendClientMsg(".");
        return;
    } else if (param.length == 0) {
        handler.sendClientMsg("-ERR Bad Command or No Param : ->" + cmd + "<-");
        return;
    }

    if (cmd.equals("start")) {
        try {
            target.startServer();
            handler.sendClientMsg("+OK Server Started");
        } catch (AppException e) {
            handler.sendClientMsg("-ERR " + e);
        }
        return;
    } else if (cmd.equals("stop")) {
        try {
            target.stopServer();
            handler.sendClientMsg("+OK Server Stopped");
        } catch (AppException e) {
            handler.sendClientMsg("-ERR " + e);
        }
        return;
    } else if (cmd.equals("restart")) {
        try {
            target.stopServer();
            target.startServer();
            handler.sendClientMsg("+OK Server Restarted");
        } catch (AppException e) {
            handler.sendClientMsg("-ERR " + e);
        }
        return;
    } else if (cmd.equals("info")) {
        handler.sendClientMsg("+OK info follows");
        handler.sendClientMsg("" + target);
        handler.sendClientMsg("Running : " + !target.isClosed());
        handler.sendClientMsg("PID : " + QuickServer.getPID());
        handler.sendClientMsg("Max Client Allowed  : " + target.getMaxConnection());
        handler.sendClientMsg("No Client Connected : " + target.getClientCount());
        if (target.isRunningSecure() == true) {
            handler.sendClientMsg("Running in secure mode : " + target.getSecure().getProtocol());
        } else {
            handler.sendClientMsg("Running in non-secure mode");
        }
        handler.sendClientMsg("Server Mode : " + target.getBasicConfig().getServerMode());
        handler.sendClientMsg("QuickServer v : " + QuickServer.getVersion());
        handler.sendClientMsg("Uptime : " + target.getUptime());
        handler.sendClientMsg(".");
        return;
    } else if (cmd.equals("noclient")) {
        handler.sendClientMsg("+OK " + target.getClientCount());
        return;
    } else if (cmd.equals("running")) {
        handler.sendClientMsg("+OK " + !target.isClosed());
        return;
    } else if (cmd.equals("suspendservice")) {
        handler.sendClientMsg("+OK " + target.suspendService());
        return;
    } else if (cmd.equals("resumeservice")) {
        handler.sendClientMsg("+OK " + target.resumeService());
        return;
    } else if (cmd.equals("client-thread-pool-info")) /*v1.3.2*/ {
        temp.setLength(0);//used:idle
        if (PoolHelper.isPoolOpen(target.getClientPool().getObjectPool()) == true) {
            temp.append(target.getClientPool().getNumActive());
            temp.append(':');
            temp.append(target.getClientPool().getNumIdle());
        } else {
            temp.append("0:0");
        }
        handler.sendClientMsg("+OK " + temp.toString());
        return;
    } else if (cmd.equals("client-thread-pool-dump")) /*v1.4.5*/ {
        if (PoolHelper.isPoolOpen(target.getClientPool().getObjectPool()) == true) {
            handler.sendClientMsg("+OK info follows");
            ClientThread ct = null;
            synchronized (target.getClientPool().getObjectToSynchronize()) {
                Iterator iterator = target.getClientPool().getAllClientThread();
                while (iterator.hasNext()) {
                    ct = (ClientThread) iterator.next();
                    handler.sendClientMsg(ct.toString());
                }
            }
            handler.sendClientMsg(".");
        } else {
            handler.sendClientMsg("-ERR Pool Closed");
        }
        return;
    } else if (cmd.equals("client-handler-pool-dump")) /*v1.4.6*/ {

        ObjectPool objectPool = target.getClientHandlerPool();

        if (PoolHelper.isPoolOpen(objectPool) == true) {
            if (QSObjectPool.class.isInstance(objectPool) == false) {
                handler.sendClientMsg("-ERR System Error!");
            }

            ClientIdentifier clientIdentifier = target.getClientIdentifier();
            ClientHandler foundClientHandler = null;
            synchronized (clientIdentifier.getObjectToSynchronize()) {
                Iterator iterator = clientIdentifier.findAllClient();
                handler.sendClientMsg("+OK info follows");
                while (iterator.hasNext()) {
                    foundClientHandler = (ClientHandler) iterator.next();
                    handler.sendClientMsg(foundClientHandler.info());
                }
            }
            handler.sendClientMsg(".");
        } else {
            handler.sendClientMsg("-ERR Pool Closed");
        }
        return;
    } else if (cmd.equals("client-data-pool-info")) /*v1.3.2*/ {
        temp.setLength(0);//used:idle
        if (target.getClientDataPool() != null) {
            if (PoolHelper.isPoolOpen(target.getClientDataPool()) == true) {
                temp.append(target.getClientDataPool().getNumActive());
                temp.append(':');
                temp.append(target.getClientDataPool().getNumIdle());
                handler.sendClientMsg("+OK " + temp.toString());
            } else {
                handler.sendClientMsg("-ERR Client Data Pool Closed");
            }
        } else {
            handler.sendClientMsg("-ERR No Client Data Pool");
        }
        return;
    } else if (cmd.equals("byte-buffer-pool-info")) /*v1.4.6*/ {
        temp.setLength(0);//used:idle
        if (target.getByteBufferPool() != null) {
            if (PoolHelper.isPoolOpen(target.getByteBufferPool()) == true) {
                temp.append(target.getByteBufferPool().getNumActive());
                temp.append(':');
                temp.append(target.getByteBufferPool().getNumIdle());
                handler.sendClientMsg("+OK " + temp.toString());
            } else {
                handler.sendClientMsg("-ERR ByteBuffer Pool Closed");
            }
        } else {
            handler.sendClientMsg("-ERR No ByteBuffer Pool");
        }
        return;
    } else if (cmd.equals("all-pool-info")) /*v1.4.5*/ {
        handler.sendClientMsg("+OK info follows");
        temp.setLength(0);//used:idle

        if (PoolHelper.isPoolOpen(target.getClientPool().getObjectPool()) == true) {
            temp.append("Client Thread Pool - ");
            temp.append("Num Active: ");
            temp.append(target.getClientPool().getNumActive());
            temp.append(", Num Idle: ");
            temp.append(target.getClientPool().getNumIdle());
            temp.append(", Max Idle: ");
            temp.append(target.getClientPool().getPoolConfig().getMaxIdle());
            temp.append(", Max Active: ");
            temp.append(target.getClientPool().getPoolConfig().getMaxActive());
        } else {
            temp.append("Byte Buffer Pool - Closed");
        }
        handler.sendClientMsg(temp.toString());
        temp.setLength(0);

        if (PoolHelper.isPoolOpen(target.getClientHandlerPool()) == true) {
            temp.append("Client Handler Pool - ");
            temp.append("Num Active: ");
            temp.append(target.getClientHandlerPool().getNumActive());
            temp.append(", Num Idle: ");
            temp.append(target.getClientHandlerPool().getNumIdle());
            temp.append(", Max Idle: ");
            temp.append(target.getBasicConfig().getObjectPoolConfig().getClientHandlerObjectPoolConfig()
                    .getMaxIdle());
            temp.append(", Max Active: ");
            temp.append(target.getBasicConfig().getObjectPoolConfig().getClientHandlerObjectPoolConfig()
                    .getMaxActive());
        } else {
            temp.append("Client Handler Pool - Closed");
        }
        handler.sendClientMsg(temp.toString());
        temp.setLength(0);

        if (target.getByteBufferPool() != null) {
            if (PoolHelper.isPoolOpen(target.getByteBufferPool()) == true) {
                temp.append("ByteBuffer Pool - ");
                temp.append("Num Active: ");
                temp.append(target.getByteBufferPool().getNumActive());
                temp.append(", Num Idle: ");
                temp.append(target.getByteBufferPool().getNumIdle());
                temp.append(", Max Idle: ");
                temp.append(target.getBasicConfig().getObjectPoolConfig().getByteBufferObjectPoolConfig()
                        .getMaxIdle());
                temp.append(", Max Active: ");
                temp.append(target.getBasicConfig().getObjectPoolConfig().getByteBufferObjectPoolConfig()
                        .getMaxActive());
            } else {
                temp.append("Byte Buffer Pool - Closed");
            }
        } else {
            temp.append("Byte Buffer Pool - Not Used");
        }
        handler.sendClientMsg(temp.toString());
        temp.setLength(0);

        if (target.getClientDataPool() != null) {
            if (PoolHelper.isPoolOpen(target.getClientDataPool()) == true) {
                temp.append("Client Data Pool - ");
                temp.append("Num Active: ");
                temp.append(target.getClientDataPool().getNumActive());
                temp.append(", Num Idle: ");
                temp.append(target.getClientDataPool().getNumIdle());
                temp.append(", Max Idle: ");
                temp.append(target.getBasicConfig().getObjectPoolConfig().getClientDataObjectPoolConfig()
                        .getMaxIdle());
                temp.append(", Max Active: ");
                temp.append(target.getBasicConfig().getObjectPoolConfig().getClientDataObjectPoolConfig()
                        .getMaxActive());
            } else {
                temp.append("Client Data Pool - Closed");
            }
        } else {
            temp.append("Client Data Pool - Not Used");
        }
        handler.sendClientMsg(temp.toString());
        temp.setLength(0);

        handler.sendClientMsg(".");
        return;
    } else if (cmd.equals("set")) {
        if (param.length < 3)/*target,key,value*/ {
            handler.sendClientMsg("-ERR " + "insufficient param");
            return;
        }
        if (param[2].equals("null"))
            param[2] = null;
        try {
            if (param[1].equals("maxClient")) {
                long no = Long.parseLong(param[2]);
                target.setMaxConnection(no);
            } else if (param[1].equals("maxClientMsg")) {
                target.setMaxConnectionMsg(param[2]);
            } else if (param[1].equals("port")) {
                long no = Long.parseLong(param[2]);
                target.setPort((int) no);
            } else if (param[1].equals("port")) {
                long no = Long.parseLong(param[2]);
                target.setPort((int) no);
            } else if (param[1].equals("maxAuthTry")) {
                int no = Integer.parseInt(param[2]);
                target.setMaxAuthTry(no);
            } else if (param[1].equals("maxAuthTryMsg")) {
                target.setMaxAuthTryMsg(param[2]);
            } else if (param[1].equals("clientEventHandler")) { /*v1.4.6*/
                target.setClientEventHandler(param[2]);
            } else if (param[1].equals("clientCommandHandler")) {
                target.setClientCommandHandler(param[2]);
            } else if (param[1].equals("clientWriteHandler")) { /*v1.4.6*/
                target.setClientWriteHandler(param[2]);
            } else if (param[1].equals("clientObjectHandler")) {
                target.setClientObjectHandler(param[2]); /*v1.3*/
            } else if (param[1].equals("clientAuthenticationHandler")) {
                target.setClientAuthenticationHandler(param[2]);
            } else if (param[1].equals("clientData")) {
                target.setClientData(param[2]);
            } else if (param[1].equals("clientExtendedEventHandler")) { /*v1.4.6*/
                target.setClientExtendedEventHandler(param[2]);
            } else if (param[1].equals("timeout")) {
                long no = Long.parseLong(param[2]);
                target.setTimeout((int) no);
            } else if (param[1].equals("timeoutMsg")) {
                target.setTimeoutMsg(param[2]); /* v1.3 */
            } else if (param[1].equals("plugin")) /* v1.2*/ {
                if (param[0].equals("self")) {
                    try {
                        adminServer.setCommandPlugin(param[2]);
                    } catch (Exception e) {
                        handler.sendClientMsg("-ERR not set : " + e);
                        return;
                    }
                } else {
                    handler.sendClientMsg("-ERR Bad target : " + param[0] + " self is only allowed.");
                    return;
                }
            } else if (param[1].equals("consoleLoggingFormatter")) {
                target.setConsoleLoggingFormatter(param[2]); /* v1.3 */
            } else if (param[1].equals("consoleLoggingLevel")) { /* v1.3 */
                if (param[2].endsWith("SEVERE"))
                    target.setConsoleLoggingLevel(Level.SEVERE);
                else if (param[2].endsWith("WARNING"))
                    target.setConsoleLoggingLevel(Level.WARNING);
                else if (param[2].endsWith("INFO"))
                    target.setConsoleLoggingLevel(Level.INFO);
                else if (param[2].endsWith("CONFIG"))
                    target.setConsoleLoggingLevel(Level.CONFIG);
                else if (param[2].endsWith("FINE"))
                    target.setConsoleLoggingLevel(Level.FINE);
                else if (param[2].endsWith("FINER"))
                    target.setConsoleLoggingLevel(Level.FINER);
                else if (param[2].endsWith("FINEST"))
                    target.setConsoleLoggingLevel(Level.FINEST);
                else if (param[2].endsWith("ALL"))
                    target.setConsoleLoggingLevel(Level.ALL);
                else if (param[2].endsWith("OFF"))
                    target.setConsoleLoggingLevel(Level.OFF);
                else {
                    handler.sendClientMsg("-ERR Bad Level " + param[2]);
                    return;
                }
            } else if (param[1].equals("loggingLevel")) { /* v1.3.1 */
                if (param[2].endsWith("SEVERE"))
                    target.setLoggingLevel(Level.SEVERE);
                else if (param[2].endsWith("WARNING"))
                    target.setLoggingLevel(Level.WARNING);
                else if (param[2].endsWith("INFO"))
                    target.setLoggingLevel(Level.INFO);
                else if (param[2].endsWith("CONFIG"))
                    target.setLoggingLevel(Level.CONFIG);
                else if (param[2].endsWith("FINE"))
                    target.setLoggingLevel(Level.FINE);
                else if (param[2].endsWith("FINER"))
                    target.setLoggingLevel(Level.FINER);
                else if (param[2].endsWith("FINEST"))
                    target.setLoggingLevel(Level.FINEST);
                else if (param[2].endsWith("ALL"))
                    target.setLoggingLevel(Level.ALL);
                else if (param[2].endsWith("OFF"))
                    target.setLoggingLevel(Level.OFF);
                else {
                    handler.sendClientMsg("-ERR Bad Level " + param[2]);
                    return;
                }
            } else if (param[1].equals("communicationLogging")) {
                if (param[2].equals("true"))/* v1.3.2 */
                    target.setCommunicationLogging(true);
                else
                    target.setCommunicationLogging(false);
            } else if (param[1].equals("objectPoolConfig-maxActive")) {
                int no = Integer.parseInt(param[2]);
                target.getConfig().getObjectPoolConfig().setMaxActive(no);
            } else if (param[1].equals("objectPoolConfig-maxIdle")) {
                int no = Integer.parseInt(param[2]);
                target.getConfig().getObjectPoolConfig().setMaxIdle(no);
            } else if (param[1].equals("objectPoolConfig-initSize")) {
                int no = Integer.parseInt(param[2]);
                target.getConfig().getObjectPoolConfig().setInitSize(no);
            } else {
                handler.sendClientMsg("-ERR Bad Set Key : " + param[1]);
                return;
            }
            handler.sendClientMsg("+OK Set");
        } catch (Exception e) {
            handler.sendClientMsg("-ERR " + e);
        }
        return;
    } else if (cmd.equals("get")) {
        if (param.length < 2)/*target,key*/ {
            handler.sendClientMsg("-ERR " + "insufficient param");
            return;
        }
        try {
            if (param[1].equals("maxClient")) {
                long no = target.getMaxConnection();
                handler.sendClientMsg("+OK " + no);
            } else if (param[1].equals("maxClientMsg")) {
                String msg = target.getMaxConnectionMsg();
                msg = MyString.replaceAll(msg, "\n", "\\n");
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("port")) {
                long no = target.getPort();
                handler.sendClientMsg("+OK " + no);
            } else if (param[1].equals("maxAuthTry")) {
                int no = target.getMaxAuthTry();
                handler.sendClientMsg("+OK " + no);
            } else if (param[1].equals("maxAuthTryMsg")) {
                String msg = target.getMaxAuthTryMsg();
                msg = MyString.replaceAll(msg, "\n", "\\n");
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientEventHandler")) { /*v1.4.6*/
                String msg = target.getClientEventHandler();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientCommandHandler")) {
                String msg = target.getClientCommandHandler();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientWriteHandler")) { /*v1.4.6*/
                String msg = target.getClientWriteHandler();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientObjectHandler")) {
                String msg = target.getClientObjectHandler();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientAuthenticationHandler")) {
                String msg = target.getClientAuthenticationHandler();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientData")) {
                String msg = target.getClientData();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("clientExtendedEventHandler")) { /*v1.4.6*/
                String msg = target.getClientExtendedEventHandler();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("timeout")) {
                String msg = "" + target.getTimeout();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("timeoutMsg")) {
                String msg = "" + target.getTimeoutMsg();
                msg = MyString.replaceAll(msg, "\n", "\\n");
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("plugin")) /* v1.2*/ {
                if (param[0].equals("self")) {
                    String msg = adminServer.getCommandPlugin();
                    handler.sendClientMsg("+OK " + msg);
                } else {
                    handler.sendClientMsg("-ERR Bad target : " + param[0] + " self is only allowed.");
                }
            } else if (param[1].equals("consoleLoggingFormatter")) {
                String msg = "" + target.getConsoleLoggingFormatter(); /* v1.3 */
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("consoleLoggingLevel")) { /* v1.3 */
                String msg = "" + target.getConsoleLoggingLevel();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("serviceState")) {
                int state = target.getServiceState(); /*v1.3*/
                if (state == org.quickserver.net.Service.INIT)
                    handler.sendClientMsg("+OK INIT");
                else if (state == org.quickserver.net.Service.RUNNING)
                    handler.sendClientMsg("+OK RUNNING");
                else if (state == org.quickserver.net.Service.STOPPED)
                    handler.sendClientMsg("+OK STOPPED");
                else if (state == org.quickserver.net.Service.SUSPENDED)
                    handler.sendClientMsg("+OK SUSPENDED");
                else
                    handler.sendClientMsg("+OK UNKNOWN");
            } else if (param[1].equals("communicationLogging")) {
                String msg = "" + target.getCommunicationLogging();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("objectPoolConfig-maxActive")) {
                String msg = "" + target.getConfig().getObjectPoolConfig().getMaxActive();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("objectPoolConfig-maxIdle")) {
                String msg = "" + target.getConfig().getObjectPoolConfig().getMaxIdle();
                handler.sendClientMsg("+OK " + msg);
            } else if (param[1].equals("objectPoolConfig-initSize")) {
                String msg = "" + target.getConfig().getObjectPoolConfig().getInitSize();
                handler.sendClientMsg("+OK " + msg);
            } else {
                handler.sendClientMsg("-ERR Bad Get Key : " + param[1]);
            }
        } catch (Exception e) {
            handler.sendClientMsg("-ERR " + e);
        }
        return;
    } else if (cmd.equals("kill-clients-all")) /*v2.0.0*/ {

        ObjectPool objectPool = target.getClientHandlerPool();

        if (PoolHelper.isPoolOpen(objectPool) == true) {
            if (QSObjectPool.class.isInstance(objectPool) == false) {
                handler.sendClientMsg("-ERR System Error!");
            }

            ClientIdentifier clientIdentifier = target.getClientIdentifier();
            ClientHandler foundClientHandler = null;
            synchronized (clientIdentifier.getObjectToSynchronize()) {
                Iterator iterator = clientIdentifier.findAllClient();
                handler.sendClientMsg("+OK closing");
                int count = 0;
                int found = 0;
                while (iterator.hasNext()) {
                    foundClientHandler = (ClientHandler) iterator.next();
                    found++;
                    if (foundClientHandler.isClosed() == false) {
                        foundClientHandler.closeConnection();
                        count++;
                    }
                }
                handler.sendClientMsg("Count Found: " + found);
                handler.sendClientMsg("Count Closed: " + count);
            }
            handler.sendClientMsg(".");
        } else {
            handler.sendClientMsg("-ERR Closing");
        }
        return;
    } else if (cmd.equals("kill-client-with")) /*v2.0.0*/ {

        if (param.length < 2)/*target,search*/ {
            handler.sendClientMsg("-ERR " + "insufficient param");
            return;
        }
        String search = param[1];

        ObjectPool objectPool = target.getClientHandlerPool();

        if (PoolHelper.isPoolOpen(objectPool) == true) {
            if (QSObjectPool.class.isInstance(objectPool) == false) {
                handler.sendClientMsg("-ERR System Error!");
            }

            ClientIdentifier clientIdentifier = target.getClientIdentifier();
            ClientHandler foundClientHandler = null;
            synchronized (clientIdentifier.getObjectToSynchronize()) {
                Iterator iterator = clientIdentifier.findAllClient();
                handler.sendClientMsg("+OK closing");
                int count = 0;
                int found = 0;
                while (iterator.hasNext()) {
                    foundClientHandler = (ClientHandler) iterator.next();
                    if (foundClientHandler.toString().indexOf(search) != -1) {
                        found++;
                        if (foundClientHandler.isClosed() == false) {
                            foundClientHandler.closeConnection();
                            count++;
                        }
                    }
                }
                handler.sendClientMsg("Count Found: " + found);
                handler.sendClientMsg("Count Closed: " + count);
            }
            handler.sendClientMsg(".");
        } else {
            handler.sendClientMsg("-ERR Closing");
        }
        return;
    } else {
        handler.sendClientMsg("-ERR Bad Command : " + cmd);
    }
    return;
}

From source file:view.FXApplicationController.java

public void showPopUp(String message) {
    FXPopUp popUp = new FXPopUp();
    popUp.showPopupMessage(message, primaryStage);
    Logger log = Logger.getLogger(this.getClass().getName());
    log.setLevel(Level.ALL);
    log.info(message);//from  w  ww.ja v  a2 s  .  c  o m
}