001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021
022package org.nuxeo.ecm.platform.audit.api;
023
024import java.io.Serializable;
025import java.util.List;
026import java.util.Set;
027import java.util.concurrent.TimeUnit;
028
029import org.nuxeo.ecm.core.event.Event;
030import org.nuxeo.ecm.core.event.EventBundle;
031
032/**
033 * Interface for adding audit logs.
034 *
035 * @author tiry
036 */
037public interface AuditLogger {
038
039    /**
040     * Returns the list of auditable event names.
041     *
042     * @return list of String representing event names.
043     */
044    Set<String> getAuditableEventNames();
045
046    /**
047     * Create a new LogEntry instance.
048     *
049     * @return
050     */
051    LogEntry newLogEntry();
052
053    /**
054     * Create a new ExtendedInfo instance
055     *
056     * @return
057     */
058    ExtendedInfo newExtendedInfo(Serializable value);
059
060    /**
061     * Adds given log entries.
062     *
063     * @param entries the list of log entries.
064     */
065    void addLogEntries(List<LogEntry> entries);
066
067    /**
068     * Logs an Event.
069     */
070    void logEvent(Event event);
071
072    /**
073     * Logs a bundle of events
074     */
075    void logEvents(EventBundle eventBundle);
076
077    /**
078     *
079     * @since 8.2
080     */
081    boolean await(long time, TimeUnit unit) throws InterruptedException;
082}