001    package org.apache.archiva.audit;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import org.apache.archiva.metadata.repository.MetadataRepository;
023    import org.apache.archiva.metadata.repository.MetadataRepositoryException;
024    
025    import java.util.Collection;
026    import java.util.Date;
027    import java.util.List;
028    
029    public interface AuditManager
030    {
031        List<AuditEvent> getMostRecentAuditEvents( MetadataRepository metadataRepository, List<String> repositoryIds )
032            throws MetadataRepositoryException;
033    
034        void addAuditEvent( MetadataRepository repository, AuditEvent event )
035            throws MetadataRepositoryException;
036    
037        void deleteAuditEvents( MetadataRepository metadataRepository, String repositoryId )
038            throws MetadataRepositoryException;
039    
040        /**
041         * Get all audit events from the given repositories that match a certain range
042         *
043         * @param metadataRepository
044         * @param repositoryIds      the repositories to retrieve events for
045         * @param startTime          find events only after this time
046         * @param endTime            find events only before this time
047         * @return the list of events found
048         */
049        List<AuditEvent> getAuditEventsInRange( MetadataRepository metadataRepository, Collection<String> repositoryIds,
050                                                Date startTime, Date endTime )
051            throws MetadataRepositoryException;
052    
053        /**
054         * Get all audit events from the given repositories that match a certain range and resource pattern
055         *
056         * @param metadataRepository
057         * @param repositoryIds      the repositories to retrieve events for
058         * @param resourcePattern    find all events whose resources start with this string
059         * @param startTime          find events only after this time
060         * @param endTime            find events only before this time
061         * @return the list of events found
062         */
063        List<AuditEvent> getAuditEventsInRange( MetadataRepository metadataRepository, Collection<String> repositoryIds,
064                                                String resourcePattern, Date startTime, Date endTime )
065            throws MetadataRepositoryException;
066    }