001/* 002 * (C) Copyright 2006-2018 Nuxeo (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 020package org.nuxeo.ecm.platform.audit.api; 021 022import java.io.Serializable; 023import java.util.List; 024import java.util.Set; 025import java.util.concurrent.TimeUnit; 026 027import org.nuxeo.ecm.core.event.Event; 028import org.nuxeo.ecm.core.event.EventBundle; 029 030/** 031 * Interface for adding audit logs. 032 * 033 * @author tiry 034 */ 035public interface AuditLogger { 036 037 /** 038 * Returns the list of auditable event names. 039 * 040 * @return list of String representing event names. 041 */ 042 Set<String> getAuditableEventNames(); 043 044 /** 045 * Create a new LogEntry instance. 046 */ 047 LogEntry newLogEntry(); 048 049 /** 050 * Create a new ExtendedInfo instance 051 */ 052 ExtendedInfo newExtendedInfo(Serializable value); 053 054 /** 055 * Adds given log entries. 056 * 057 * @param entries the list of log entries. 058 */ 059 void addLogEntries(List<LogEntry> entries); 060 061 /** 062 * Logs an Event. 063 * 064 * @deprecated since 10.10, audit event is now handled with nuxeo-stream, if you want to log events, contribute to 065 * NXAuditEventsService#event extension point 066 */ 067 @Deprecated 068 void logEvent(Event event); 069 070 /** 071 * Logs a bundle of events 072 * 073 * @deprecated since 10.10, audit event is now handled with nuxeo-stream, if you want to log events, contribute to 074 * NXAuditEventsService#event extension point 075 */ 076 @Deprecated 077 void logEvents(EventBundle eventBundle); 078 079 /** 080 * @since 8.2 081 */ 082 boolean await(long time, TimeUnit unit) throws InterruptedException; 083 084 /** 085 * Returns a log entry representation of an event. 086 * 087 * @since 9.3 088 */ 089 LogEntry buildEntryFromEvent(Event event); 090}