EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.pack]

COVERAGE SUMMARY FOR SOURCE FILE [HiveBoardPackHandler.java]

nameclass, %method, %block, %line, %
HiveBoardPackHandler.java0%   (0/1)0%   (0/6)0%   (0/74)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class HiveBoardPackHandler0%   (0/1)0%   (0/6)0%   (0/74)0%   (0/23)
HiveBoardPackHandler (): void 0%   (0/1)0%   (0/6)0%   (0/2)
doStart (): void 0%   (0/1)0%   (0/6)0%   (0/3)
doStop (): void 0%   (0/1)0%   (0/14)0%   (0/8)
getPendingRequests (): int 0%   (0/1)0%   (0/8)0%   (0/1)
handle (String, HttpServletRequest, HttpServletResponse, int): void 0%   (0/1)0%   (0/29)0%   (0/5)
setShutdown (boolean): void 0%   (0/1)0%   (0/11)0%   (0/4)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.pack;
16 
17import java.io.IOException;
18import java.sql.DriverManager;
19import java.sql.SQLException;
20 
21import javax.servlet.ServletException;
22import javax.servlet.http.HttpServletRequest;
23import javax.servlet.http.HttpServletResponse;
24 
25import org.mortbay.jetty.Handler;
26import org.mortbay.jetty.handler.ContextHandler;
27import org.mortbay.jetty.handler.HandlerWrapper;
28import org.mortbay.log.Log;
29 
30/**
31 * @author Jean-Francois Poilpret
32 */
33public class HiveBoardPackHandler extends HandlerWrapper
34{
35        protected void        doStart() throws Exception
36        {
37                super.doStart();
38                _pendingRequests = 0;
39        }
40        
41        protected void        doStop() throws Exception
42        {
43                super.doStop();
44                // Cleanly stop embedded Derby DBMS
45                try
46                {
47                        Log.info("Stopping Derby engine...");
48                        DriverManager.getConnection("jdbc:derby:;shutdown=true");
49                        Log.warn("Derby engine was not stopped!");
50                }
51                catch (SQLException e)
52                {
53                        // Just ignore it: Derby shutdown always throws SQLException
54                        Log.info("Derby engine stopped");
55                }
56        }
57        
58        public void        setShutdown(boolean shutdown)
59        {
60                Handler handler = getHandler();
61                if (handler instanceof ContextHandler)
62                {
63                        ((ContextHandler) handler).setShutdown(shutdown);
64                }
65        }
66 
67        public void        handle(        String                                target, 
68                                                HttpServletRequest        request, 
69                                                HttpServletResponse        response,
70                                                int                                        dispatch)
71                throws IOException, ServletException
72        {
73                try
74                {
75                        _pendingRequests++;
76                        super.handle(target, request, response, dispatch);
77                }
78                finally
79                {
80                        _pendingRequests--;
81                }
82        }
83        
84        public int        getPendingRequests()
85        {
86                return (isStarted() ? _pendingRequests : 0);
87        }
88 
89        private int _pendingRequests = 0;
90}

[all classes][net.sourceforge.hiveboard.pack]
EMMA 2.0.5312 (C) Vladimir Roubtsov