de.micromata.genome.logging.spi.RamLoggingDAOImpl Maven / Gradle / Ivy
The newest version!
//
// Copyright (C) 2010-2016 Micromata GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package de.micromata.genome.logging.spi;
import de.micromata.genome.logging.BaseLogging;
import de.micromata.genome.logging.EndOfSearch;
import de.micromata.genome.logging.LogEntryCallback;
import de.micromata.genome.logging.LogWriteEntry;
import de.micromata.genome.util.types.Pair;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
/**
* Very basic Logging, collecting log entries into a List.
*
* DO NOT USE THIS IN Production, because there will be a outofmemory very fast.
*
* @author roger
*
*/
public class RamLoggingDAOImpl extends BaseLogging
{
/**
* The log entries.
*/
public List logEntries = Collections.synchronizedList(new ArrayList());
@Override
public void doLogImpl(LogWriteEntry lwe)
{
if (lwe.getTimestamp() == 0) {
lwe.setTimestamp(System.currentTimeMillis());
}
logEntries.add(lwe);
}
@Override
public boolean supportsSearch()
{
return false;
}
@Override
public boolean supportsFulltextSearch()
{
return false;
}
@Override
public void selectLogsImpl(List