001package org.apache.archiva.repository; 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 022import java.time.LocalDateTime; 023 024/** 025 * Repository event. Repository events are used for providing information about repository changes. 026 * 027 * @param <T> 028 */ 029public class RepositoryEvent<T> { 030 031 final EventType type; 032 final Repository repo; 033 final T value; 034 final T oldValue; 035 final LocalDateTime instant; 036 037 public RepositoryEvent(EventType type, Repository repo, T oldValue, T value) { 038 this.type = type; 039 this.repo = repo; 040 this.value = value; 041 this.oldValue = oldValue; 042 this.instant = LocalDateTime.now(); 043 } 044 045 public interface EventType { 046 String name(); 047 } 048 049 050 public EventType getType() { 051 return type; 052 }; 053 054 public Repository getRepository() { 055 return repo; 056 }; 057 058 public T getValue() { 059 return value; 060 } 061 062 public T getOldValue() { 063 return oldValue; 064 } 065 066 public LocalDateTime getInstant() { 067 return instant; 068 } 069}