
org.glassfish.admingui.common.handlers.LoggingHandlers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of console-common Show documentation
Show all versions of console-common Show documentation
This bundle contains common code that may be shared across plugins.
The newest version!
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.admingui.common.handlers;
import com.sun.jsftemplating.annotation.Handler;
import com.sun.jsftemplating.annotation.HandlerInput;
import com.sun.jsftemplating.annotation.HandlerOutput;
import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.glassfish.admingui.common.util.GuiUtil;
import org.glassfish.admingui.common.util.RestUtil;
/**
* @author anilam 2006
*/
public class LoggingHandlers {
@Handler(id = "getLoggerLevels",
input = {
@HandlerInput(name = "loggerLevels", type = Map.class, required = true)},
output = {
@HandlerOutput(name = "loggerList", type = List.class)
})
public static void getLoggerLevels(HandlerContext handlerCtx) {
Map loggerLevels = (Map) handlerCtx.getInputValue("loggerLevels");
List result = new ArrayList();
if (loggerLevels != null) {
for (Map.Entry e : loggerLevels.entrySet()) {
Map oneRow = new HashMap();
oneRow.put("loggerName", e.getKey());
oneRow.put("level", e.getValue());
oneRow.put("selected", false);
result.add(oneRow);
}
}
handlerCtx.setOutputValue("loggerList", result);
}
@Handler(id = "changeLoggerLevels",
input = {
@HandlerInput(name = "newLogLevel", type = String.class, required = true),
@HandlerInput(name = "allRows", type = List.class, required = true)},
output = {
@HandlerOutput(name = "newList", type = List.class)})
public static void changeLoggerLevels(HandlerContext handlerCtx) {
String newLogLevel = (String) handlerCtx.getInputValue("newLogLevel");
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy