KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > app > DebugPhaseListener


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the GNU Lesser General Public License as
5  * published by the Free Software Foundation; either version
6  * 2.1 of the License, or (at your option) any later version.
7  * You may obtain a copy of the License at
8  *
9  * http://www.gnu.org/licenses/lgpl.txt
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the
16  * License.
17  */

18 package org.alfresco.web.app;
19
20 import javax.faces.event.PhaseEvent;
21 import javax.faces.event.PhaseId;
22 import javax.faces.event.PhaseListener;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 /**
28  * Debug phase listener that simply logs when each phase is entered and exited.
29  *
30  * @author gavinc
31  */

32 public class DebugPhaseListener implements PhaseListener
33 {
34    private static final Log logger = LogFactory.getLog(DebugPhaseListener.class);
35    
36    /**
37     * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
38     */

39    public void afterPhase(PhaseEvent event)
40    {
41       if (logger.isDebugEnabled())
42          logger.debug("********** Exiting phase: " + event.getPhaseId().toString());
43    }
44
45    /**
46     * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent)
47     */

48    public void beforePhase(PhaseEvent event)
49    {
50       if (logger.isDebugEnabled())
51          logger.debug("********** Entering phase: " + event.getPhaseId().toString());
52    }
53
54    /**
55     * @see javax.faces.event.PhaseListener#getPhaseId()
56     */

57    public PhaseId getPhaseId()
58    {
59       return PhaseId.ANY_PHASE;
60    }
61
62 }
63
Popular Tags