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

COVERAGE SUMMARY FOR SOURCE FILE [HiveBoardMain.java]

nameclass, %method, %block, %line, %
HiveBoardMain.java100% (1/1)100% (7/7)98%  (81/83)100% (22.9/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class HiveBoardMain100% (1/1)100% (7/7)98%  (81/83)100% (22.9/23)
checkArguments (String []): void 100% (1/1)95%  (37/39)99%  (7.9/8)
HiveBoardMain (): void 100% (1/1)100% (6/6)100% (3/3)
end (): void 100% (1/1)100% (20/20)100% (5/5)
getDefaultConfigDir (): String 100% (1/1)100% (2/2)100% (1/1)
initProperties (): void 100% (1/1)100% (9/9)100% (3/3)
isGuiTest (): boolean 100% (1/1)100% (3/3)100% (1/1)
main (String []): void 100% (1/1)100% (4/4)100% (2/2)

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.main;
16 
17import java.io.File;
18 
19import org.jdesktop.application.TaskService;
20 
21import net.sourceforge.hiveboard.util.ExitManager;
22import net.sourceforge.hivegui.application.HiveGuiApplicationMain;
23 
24public class HiveBoardMain extends HiveGuiApplicationMain
25{
26        static private final String        PROP_CONFIG_DIR                = "config-dir";
27        static private final String        ARG_GUITEST                        = "-guitest";
28        static private final String        DEFAULT_CONFIG_DIR        = "etc";
29 
30        protected HiveBoardMain()
31        {
32        }
33        
34        /**
35         * HiveBoard client main entry point.
36         * @param args command line arguments.
37         */
38        static public void main(String[] args)
39        {
40                launch(HiveBoardMain.class, args);
41        }
42 
43        @Override protected void checkArguments(String[] args)
44        {
45                super.checkArguments(args);
46                for (String arg: args)
47                {
48                        if (ARG_GUITEST.equals(arg))
49                        {
50                                _guiTest = true;
51                                // For GUI tests, change session storage directory
52                                File dir = new File("dist/runtime/session").getAbsoluteFile();
53                                getContext().getLocalStorage().setDirectory(dir);
54                                break;
55                        }
56                }
57        }
58        
59        public boolean        isGuiTest()
60        {
61                return _guiTest;
62        }
63 
64        @Override protected String getDefaultConfigDir()
65        {
66                return DEFAULT_CONFIG_DIR;
67        }
68 
69        @Override protected void initProperties()
70        {
71                System.getProperties().setProperty(PROP_CONFIG_DIR, getConfigDir());
72                super.initProperties();
73        }
74 
75        // NB: Logging and HiveMind Registry have been shutdown already: don't use them!
76        @Override protected void end()
77        {
78                // First shutdown all running TaskService (because they may have
79                // active threads -not daemons- that will prevent JVM exit
80                for (TaskService service: getContext().getTaskServices())
81                {
82                        service.shutdownNow();
83                }
84                // Exit by disposing of all windows (ie ending EDT)
85                ExitManager.exit(0, true);
86        }
87 
88        private boolean        _guiTest = false;
89}

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