001package org.apache.commons.jcs.engine.logging.behavior; 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/** 023 * This defines the behavior for event logging. Auxiliaries will send events to injected event 024 * loggers. 025 * <p> 026 * In general all ICache interface methods should call the logger if one is configured. This will be 027 * done on an ad hoc basis for now. Various auxiliaries may have additional events. 028 */ 029public interface ICacheEventLogger 030{ 031 // TODO: Use enum 032 /** ICache update */ 033 String UPDATE_EVENT = "update"; 034 035 /** ICache get */ 036 String GET_EVENT = "get"; 037 038 /** ICache getMultiple */ 039 String GETMULTIPLE_EVENT = "getMultiple"; 040 041 /** ICache getMatching */ 042 String GETMATCHING_EVENT = "getMatching"; 043 044 /** ICache remove */ 045 String REMOVE_EVENT = "remove"; 046 047 /** ICache removeAll */ 048 String REMOVEALL_EVENT = "removeAll"; 049 050 /** ICache dispose */ 051 String DISPOSE_EVENT = "dispose"; 052 053 /** ICache enqueue. The time in the queue. */ 054 //String ENQUEUE_EVENT = "enqueue"; 055 /** 056 * Creates an event. 057 * <p> 058 * @param source - e.g. RemoteCacheServer 059 * @param region - the name of the region 060 * @param eventName - e.g. update, get, put, remove 061 * @param optionalDetails - any extra message 062 * @param key - the cache key 063 * @return ICacheEvent 064 */ 065 <T> ICacheEvent<T> createICacheEvent( String source, String region, 066 String eventName, String optionalDetails, T key ); 067 068 /** 069 * Logs an event. 070 * <p> 071 * @param event - the event created in createICacheEvent 072 */ 073 <T> void logICacheEvent( ICacheEvent<T> event ); 074 075 /** 076 * Logs an event. These are internal application events that do not correspond to ICache calls. 077 * <p> 078 * @param source - e.g. RemoteCacheServer 079 * @param eventName - e.g. update, get, put, remove 080 * @param optionalDetails - any extra message 081 */ 082 void logApplicationEvent( String source, String eventName, String optionalDetails ); 083 084 /** 085 * Logs an error. 086 * <p> 087 * @param source - e.g. RemoteCacheServer 088 * @param eventName - e.g. update, get, put, remove 089 * @param errorMessage - any error message 090 */ 091 void logError( String source, String eventName, String errorMessage ); 092}