/*
 * Copyright 2011 Damien Bourdette
 *
 * 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 org.glass.log;

import org.glass.history.HistoryLog;
import org.springframework.stereotype.Service;

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

/**
 * @author damien bourdette
 * @version \$Revision$
 */
@Service
public class Logs {
    private List<Log> logs = new ArrayList<Log>();

    private static final int MAX_SIZE = 10000;

    private static final int PAGE_SIZE = 100;

    public synchronized void add(Log log) {
        logs.add(log);

        if (logs.size() > MAX_SIZE) {
            logs.remove(0);
        }
    }

    public synchronized List<HistoryLog> getLogs() {
        List<HistoryLog> page = null;

        if (logs.size() > PAGE_SIZE) {
            page = new ArrayList(logs.subList(0, PAGE_SIZE));
        } else {
            page = new ArrayList(logs.subList(0, logs.size()));
        }

        Collections.reverse(page);

        return page;
    }
}

@@ -618,93 +618,8 @@
 g;%0A%0A
-import org.glass.history.HistoryLog;%0Aimport org.springframework.stereotype.Service;%0A%0A
 impo
@@ -696,16 +696,64 @@
 .List;%0A%0A
+import org.springframework.stereotype.Service;%0A%0A
 /**%0A * @
@@ -1156,31 +1156,24 @@
 onized List%3C
-History
 Log%3E getLogs
@@ -1194,15 +1194,8 @@
 ist%3C
-History
 Log%3E
@@ -1272,32 +1272,37 @@
  = new ArrayList
+%3CLog%3E
 (logs.subList(0,
@@ -1364,16 +1364,21 @@
 rrayList
+%3CLog%3E
 (logs.su

Change the return type on Logs.getLogs(). replace List<HistoryLog> by List<Log>.