All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jwall.log.LogMessageExtractor Maven / Gradle / Ivy

/*
 *  Copyright (C) 2007-2014 Christian Bockermann 
 *
 *  This file is part of the  web-audit  library.
 *
 *  web-audit library is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  The  web-audit  library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see .
 *
 */
package org.jwall.log;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.jwall.audit.FeatureExtractor;

public class LogMessageExtractor implements FeatureExtractor> {

	public final static Set VARIABLES = new LinkedHashSet();
	static {
		VARIABLES.add( LogMessage.TIMESTAMP );
		VARIABLES.add( LogMessage.SOURCE );
		VARIABLES.add( LogMessage.MESSAGE );
	}
	
	@Override
	public List extract(String feature, LogMessage event) {
		List vals = new ArrayList();
		if( event.get( feature ) != null )
			vals.add(event.get( feature ));
		return vals;
	}

	@Override
	public Set getVariables(LogMessage event) {
		return Collections.unmodifiableSet( VARIABLES );
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy