001// Copyright 2006, 2007, 2009 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.ioc.services; 016 017import org.slf4j.Logger; 018 019/** 020 * Service that can create a logging interceptor that wraps around a service implementation (or interceptor). The 021 * interceptor works with the service's log to log, at debug level, method entry (with arguments), method exit (with 022 * return value, if any) as well as any thrown exceptions. 023 * <p/> 024 * This represents the Tapestry 5.0 decorator approach; for Tapestry 5.1 you may want to use the {@link 025 * org.apache.tapestry5.ioc.services.LoggingAdvisor} in conjunction with a service advisor method. 026 */ 027public interface LoggingDecorator 028{ 029 /** 030 * Builds a logging interceptor instance. 031 * 032 * @param <T> 033 * @param serviceInterface interface implemented by the delegate 034 * @param delegate existing object to be wrapped 035 * @param serviceId id of service 036 * @param logger log used for debug level logging messages by the interceptor 037 * @return a new object implementing the interface that can be used in place of the delegate, providing logging 038 * behavior around each method call on the service interface 039 */ 040 <T> T build(Class<T> serviceInterface, T delegate, String serviceId, Logger logger); 041}