1 /* 2 * #%L 3 * Bitrepository Audit Trail Service 4 * 5 * $Id$ 6 * $HeadURL$ 7 * %% 8 * Copyright (C) 2010 - 2012 The State and University Library, The Royal Library and The State Archives, Denmark 9 * %% 10 * This program is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License as 12 * published by the Free Software Foundation, either version 2.1 of the 13 * License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Lesser Public License for more details. 19 * 20 * You should have received a copy of the GNU General Lesser Public 21 * License along with this program. If not, see 22 * <http://www.gnu.org/licenses/lgpl-2.1.html>. 23 * #L% 24 */ 25 package org.bitrepository.audittrails.store; 26 27 import java.util.Date; 28 29 import org.bitrepository.bitrepositoryelements.AuditTrailEvents; 30 import org.bitrepository.bitrepositoryelements.FileAction; 31 32 /** 33 * Interface for the storage of audit trail information for the AuditTrailService. 34 */ 35 public interface AuditTrailStore { 36 /** 37 * Obtain AuditEventIterator for extracting audit trails from the store. 38 * When done with the iterator, the user should ensure that it is closed. 39 * @param fileId [OPTIONAL] The id of the file for restricting the extraction. 40 * @param collectionID [OPTIONAL] The id of the collection from which to retrieve audit trails. 41 * @param contributorId [OPTIONAL] The id of the contributor for restricting the extraction. 42 * @param minSeqNumber [OPTIONAL] The minimum sequence number for restricting the extraction. 43 * @param maxSeqNumber [OPTIONAL] The maximum sequence number for restricting the extraction. 44 * @param actorName [OPTIONAL] The name of the actor for restricting the extraction. 45 * @param operation [OPTIONAL] The FileAction operation for restricting the extraction. 46 * @param startDate [OPTIONAL] The earliest date for the audits for restricting the extraction. 47 * @param endDate [OPTIONAL] The latest date for the audits for restricting the extraction. 48 * @param fingerprint [OPTIONAL] The fingerprint of the certificate for the audits 49 * @param operationID [OPTIONAL] The ID of the operation (conversationID) for the audits 50 * @return The requested audit trails from the store. 51 */ 52 public AuditEventIterator getAuditTrailsByIterator(String fileId, String collectionID, String contributorId, 53 Long minSeqNumber, Long maxSeqNumber, String actorName, FileAction operation, Date startDate, 54 Date endDate, String fingerprint, String operationID); 55 56 /** 57 * ingest audit trails into the store. 58 * @param newAuditTrails The audit trails to be ingested into the store. 59 * @param collectionID The id of the collection, where the audit trail events belong. 60 */ 61 public void addAuditTrails(AuditTrailEvents newAuditTrails, String collectionID); 62 63 /** 64 * Retrieves the largest sequence number for a given contributor. 65 * 66 * @param contributorId The id of the contributor to retrieve the largest sequence number from. 67 * @param collectionId The id of the collection for the sequence number of the contributor. 68 * @return The largest sequence number. 69 */ 70 public int largestSequenceNumber(String contributorId, String collectionId); 71 72 /** 73 * Retrieves the preservation sequence number for the given contributor, which tells how far the preservation 74 * of the audit trails has gotten. 75 * 76 * @param contributorId The id of the contributor. 77 * @param collectionId The id of the collection for the sequence number of the contributor. 78 * @return The preservation sequence number for the given contributor. 79 */ 80 public long getPreservationSequenceNumber(String contributorId, String collectionId); 81 82 /** 83 * Set the preservation sequence number for the given contributor. 84 * 85 * @param contributorId The id of the contributor. 86 * @param collectionId The id of the collection for the sequence number of the contributor. 87 * @param seqNumber The new preservation sequence number for the given contributor. 88 */ 89 public void setPreservationSequenceNumber(String contributorId, String collectionId, long seqNumber); 90 91 /** 92 * Check to see if the database knows a contributor 93 * 94 * @param contributorID The ID of the contributor 95 * @param collectionID The ID of the collection; 96 * @return boolean true, if the contributor is known by the database, false otherwise. 97 */ 98 boolean havePreservationKey(String contributorID, String collectionID); 99 100 /** 101 * Closes the store. 102 */ 103 public void close(); 104 }