FileDocCategorySizeDatePackage
DisplayLogRecordsCommand.javaAPI DocGlassfish v2 API6738Fri May 04 22:25:10 BST 2007com.sun.enterprise.cli.commands

DisplayLogRecordsCommand

public class DisplayLogRecordsCommand extends BaseLoggingCommand

Fields Summary
private static final String
TIMESTAMP_OPTION
private static final String
MODULEID_OPTION
private static final String
LEVEL_OPTION
private static final String
MODULE_DELIMITER
Constructors Summary
Methods Summary
protected java.util.ListgetModuleIds()
Formulate and Returns module-id's from the given string

return
Properties

        final List moduleIds = new ArrayList();

        String modulesStr = (String) getOperands().get(0);
        final CLITokenizer modulesTok = new CLITokenizer(modulesStr, MODULE_DELIMITER);
        while (modulesTok.hasMoreTokens()) {
            moduleIds.add(modulesTok.nextToken());
        }
        return moduleIds;
    
protected java.lang.Object[]getParamsInfo()


        
    
        Object[] paramsInfo = new Object[11];
        long timestamp = Long.valueOf(getOption(TIMESTAMP_OPTION)).longValue(); 
        String errorLevel = getOption(LEVEL_OPTION);
        
        paramsInfo[0] = null;
        paramsInfo[1] = null;
        paramsInfo[2] = Boolean.FALSE;
        paramsInfo[3] = Boolean.FALSE;
        paramsInfo[4] = Integer.valueOf(1000);
        paramsInfo[5] = new Date(timestamp);
        paramsInfo[6] = new Date(timestamp + 3600000);
        paramsInfo[7] = (errorLevel == null) ? Level.WARNING.toString() : errorLevel;
        paramsInfo[8] = (errorLevel != null) ? Boolean.TRUE : Boolean.FALSE;
        paramsInfo[9] = getModuleIds();
        paramsInfo[10] = null;
        for (Object param : paramsInfo)
        {
            if (param != null)
                CLILogger.getInstance().printDebugMessage(param.toString());
            else
                CLILogger.getInstance().printDebugMessage("null");
        }
        return paramsInfo;
    
protected voidhandleReturnValue(java.lang.Object retVal)

        //final Map errorDistribution = (Map)retVal;
        final AttributeList results  = (AttributeList) retVal;
        List headerRow = (List)(((Attribute)results.get(0)).getValue());
        List rowList = (List)(((Attribute)results.get(1)).getValue());
        List row;

        Iterator it = rowList.iterator();
        if (it.hasNext())
        {
            CLILogger.getInstance().printDetailMessage(
                    "----------------------------------------------------------------------");
            
        }
        else
        {
            CLILogger.getInstance().printDetailMessage(
                                        getLocalizedString("NoElementsToList"));
        }
        while (it.hasNext())
        {
            row = (List)it.next();
	    if (row.size() != headerRow.size()) {
                //throw new CommandException(
                CLILogger.getInstance().printDebugMessage(
		"Row had '"+row.size()+"' columns, header has '"+
		    headerRow.size()+"' columns!");
	    }
            
            CLILogger.getInstance().printMessage(getLocalizedString("LogRecNumber") 
                                                    + " = " + row.get(0));
            CLILogger.getInstance().printMessage(getLocalizedString("LogDateTime") 
                                                    + " = " + row.get(1));
            CLILogger.getInstance().printMessage(getLocalizedString("LogMsgId") 
                                                    + " = " + row.get(6));
            CLILogger.getInstance().printMessage(getLocalizedString("LogLevel") 
                                                    + " = " + row.get(2));
            CLILogger.getInstance().printMessage(getLocalizedString("LogProductName") 
                                                    + " = " + row.get(3));
            CLILogger.getInstance().printMessage(getLocalizedString("LogLogger") 
                                                    + " = " + row.get(4));
            CLILogger.getInstance().printMessage(getLocalizedString("Lognvp") 
                                                    + " = " + row.get(5));
            CLILogger.getInstance().printMessage(getLocalizedString("LogMessage") 
                                                    + " = " + row.get(7));
            CLILogger.getInstance().printDetailMessage(
                    "----------------------------------------------------------------------");
        }