001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/framework/util/LoggingInterceptor.java $
002    //$Id: LoggingInterceptor.java 9339 2007-12-27 12:31:52Z apoth $
003    /*----------------    FILE HEADER  ------------------------------------------
004     
005     This file is part of deegree.
006     Copyright (C) 2001-2008 by:
007     EXSE, Department of Geography, University of Bonn
008     http://www.giub.uni-bonn.de/deegree/
009     lat/lon GmbH
010     http://www.lat-lon.de
011     
012     This library is free software; you can redistribute it and/or
013     modify it under the terms of the GNU Lesser General Public
014     License as published by the Free Software Foundation; either
015     version 2.1 of the License, or (at your option) any later version.
016     
017     This library is distributed in the hope that it will be useful,
018     but WITHOUT ANY WARRANTY; without even the implied warranty of
019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
020     Lesser General Public License for more details.
021     
022     You should have received a copy of the GNU Lesser General Public
023     License along with this library; if not, write to the Free Software
024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
025     
026     Contact:
027     
028     Andreas Poth
029     lat/lon GmbH
030     Aennchenstr. 19
031     53115 Bonn
032     Germany
033     E-Mail: poth@lat-lon.de
034     
035     Prof. Dr. Klaus Greve
036     Department of Geography
037     University of Bonn
038     Meckenheimer Allee 166
039     53115 Bonn
040     Germany
041     E-Mail: greve@giub.uni-bonn.de
042     
043     
044     ---------------------------------------------------------------------------*/
045    
046    package org.deegree.framework.util;
047    
048    import java.lang.reflect.InvocationTargetException;
049    import java.lang.reflect.Method;
050    
051    /**
052     * Logging interceptor to log the entering and exiting of a method call.
053     * 
054     * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe </A>
055     * 
056     * @author last edited by: $Author: apoth $
057     * 
058     * @version 2.0, $Revision: 9339 $, $Date: 2007-12-27 13:31:52 +0100 (Do, 27 Dez 2007) $
059     * 
060     * @see <a href="http://www.dofactory.com/patterns/PatternChain.aspx">Chain of
061     *      Responsibility Design Pattern </a>
062     * 
063     * @since 2.0
064     */
065    public class LoggingInterceptor extends Interceptor {
066    
067        public LoggingInterceptor(Interceptor nextInterceptor) {
068            this.nextInterceptor = nextInterceptor;
069        }
070    
071        protected Object handleInvocation(Method method, Object[] params)
072                throws IllegalAccessException, InvocationTargetException {
073            LOG.logDebug(">Invoke " + method.getName() + " on " + getTarget());
074            Object result = nextInterceptor.handleInvocation(method, params);
075            LOG.logDebug("<Finish " + method.getName() + " on " + getTarget());
076            return result;
077        }
078    
079    }