001    // Copyright 2004, 2005 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    
015    package org.apache.tapestry.engine;
016    
017    /**
018     *  Basic support for application monitoring and metrics.  
019     *  This interface defines events; the implementation
020     *  decides what to do with them (such as record them to a database).
021     *
022     *  @author Howard Lewis Ship
023     * 
024     **/
025    
026    public interface IMonitor
027    {
028            /**
029             *  Invoked before constructing a page.
030             *
031             **/
032    
033            public void pageCreateBegin(String pageName);
034    
035            /**
036             *  Invoked after successfully constructing a page and all of its components.
037             *
038             **/
039    
040            public void pageCreateEnd(String pageName);
041    
042            /**
043             *  Invoked when a page is loaded.  This includes time to locate or create an instance
044             *  of the page and rollback its state (to any previously recorded value).
045             *
046             **/
047    
048            public void pageLoadBegin(String pageName);
049    
050            /**
051             *  Invoked once a page is completely loaded and rolled back to its prior state.
052             *
053             **/
054    
055            public void pageLoadEnd(String pageName);
056    
057            /**
058             *  Invoked before a page render begins.
059             *
060             **/
061    
062            public void pageRenderBegin(String pageName);
063    
064            /**
065             *  Invoked after a page has succesfully rendered.
066             *
067             **/
068    
069            public void pageRenderEnd(String pageName);
070    
071            /**
072             *  Invoked before a page rewind (to respond to an action) begins.
073             *
074             **/
075    
076            public void pageRewindBegin(String pageName);
077    
078            /**
079             *  Invoked after a page has succesfully been rewound (which includes
080             *  any activity related to the action listener).
081             *
082             **/
083    
084            public void pageRewindEnd(String pageName);
085    
086            /**
087             *  Invoked when a service begins processing.
088             *
089             **/
090    
091            public void serviceBegin(String serviceName, String detailMessage);
092    
093            /**
094             *  Invoked when a service successfully ends.
095             *
096             **/
097    
098            public void serviceEnd(String serviceName);
099    
100            /**
101             *  Invoked when a service throws an exception rather than completing normally.
102             *  Processing of the request may continue with the display of an exception
103             *  page.
104             * 
105             *  <p>
106             *  serviceException() is always invoked <em>before</em>
107             * {@link #serviceEnd(String)}.
108             *
109             **/
110    
111            public void serviceException(Throwable exception);
112    
113            /**
114             *  Invoked when a session is initiated.  This is typically
115             *  done from the implementation of the home service.
116             *
117             **/
118    
119            public void sessionBegin();
120    }