1 package org.apache.commons.jcs3.engine.logging.behavior; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 /** 23 * This defines the behavior for event logging. Auxiliaries will send events to injected event 24 * loggers. 25 * <p> 26 * In general all ICache interface methods should call the logger if one is configured. This will be 27 * done on an ad hoc basis for now. Various auxiliaries may have additional events. 28 */ 29 public interface ICacheEventLogger 30 { 31 // TODO: Use enum 32 /** ICache update */ 33 String UPDATE_EVENT = "update"; 34 35 /** ICache get */ 36 String GET_EVENT = "get"; 37 38 /** ICache getMultiple */ 39 String GETMULTIPLE_EVENT = "getMultiple"; 40 41 /** ICache getMatching */ 42 String GETMATCHING_EVENT = "getMatching"; 43 44 /** ICache remove */ 45 String REMOVE_EVENT = "remove"; 46 47 /** ICache removeAll */ 48 String REMOVEALL_EVENT = "removeAll"; 49 50 /** ICache dispose */ 51 String DISPOSE_EVENT = "dispose"; 52 53 /** ICache enqueue. The time in the queue. */ 54 //String ENQUEUE_EVENT = "enqueue"; 55 /** 56 * Creates an event. 57 * <p> 58 * @param source - e.g. RemoteCacheServer 59 * @param region - the name of the region 60 * @param eventName - e.g. update, get, put, remove 61 * @param optionalDetails - any extra message 62 * @param key - the cache key 63 * @return ICacheEvent 64 */ 65 <T> ICacheEvent<T> createICacheEvent( String source, String region, 66 String eventName, String optionalDetails, T key ); 67 68 /** 69 * Logs an event. 70 * <p> 71 * @param event - the event created in createICacheEvent 72 */ 73 <T> void logICacheEvent( ICacheEvent<T> event ); 74 75 /** 76 * Logs an event. These are internal application events that do not correspond to ICache calls. 77 * <p> 78 * @param source - e.g. RemoteCacheServer 79 * @param eventName - e.g. update, get, put, remove 80 * @param optionalDetails - any extra message 81 */ 82 void logApplicationEvent( String source, String eventName, String optionalDetails ); 83 84 /** 85 * Logs an error. 86 * <p> 87 * @param source - e.g. RemoteCacheServer 88 * @param eventName - e.g. update, get, put, remove 89 * @param errorMessage - any error message 90 */ 91 void logError( String source, String eventName, String errorMessage ); 92 }