EMMA Coverage Report (generated Sat Jul 01 16:38:45 PDT 2006)
[all classes][jade.jademx.server]

COVERAGE SUMMARY FOR SOURCE FILE [JadeMXServerFactory.java]

nameclass, %method, %block, %line, %
JadeMXServerFactory.java100% (1/1)80%  (4/5)88%  (21/24)75%  (6/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JadeMXServerFactory100% (1/1)80%  (4/5)88%  (21/24)75%  (6/8)
JadeMXServerFactory (): void 0%   (0/1)0%   (0/3)0%   (0/2)
jadeMXServerByClassName (String): JadeMXServer 100% (1/1)100% (5/5)100% (1/1)
jadeMXServerBySysProp (): JadeMXServer 100% (1/1)100% (3/3)100% (1/1)
serverClassName (): String 100% (1/1)100% (4/4)100% (1/1)
setSysProp (JadeMXServer): void 100% (1/1)100% (9/9)100% (3/3)

1// jademx - JADE management using JMX
2// Copyright 2005 Caboodle Networks, Inc.
3//
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8//
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12// Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 
18package jade.jademx.server;
19 
20/** 
21 * Factory class for <a href="JadeMXServer.html">JadeMXServer</a>.
22 * @author David Bernstein, <a href="http://www.caboodlenetworks.com"
23 *  >Caboodle Networks, Inc.</a>
24 */
25public class JadeMXServerFactory {
26    
27    /** 
28     * nobody should instantiate this class
29     */
30    private JadeMXServerFactory() {
31        // intentionally empty
32    }
33    
34    /** 
35     * system property describing server type.
36     * property value is name of a subclass of jade.jademx.server.JadeMXServer 
37     */
38    public final static String SERVER_TYPE_PROPERTY = 
39        "jade.jademx.server.type";
40 
41    /** default value for SERVER_TYPE_SYSTEM_PROPERTY */
42    public final static String SERVER_TYPE_DEFAULT = 
43        "jade.jademx.server.JavaPlatform";
44    
45    /**
46     * return name of jademx server class to use
47     * @return name of jademx server class to use
48     */
49    public static String serverClassName() {
50        return System.getProperty( SERVER_TYPE_PROPERTY, SERVER_TYPE_DEFAULT ); 
51    }
52    
53    /**
54     * return jademx server as specified by system property
55     * @return jademx server as specified by system property
56     * @throws ClassNotFoundException specified class not found
57     * @throws IllegalAccessException not allowed
58     * @throws InstantiationException constructor problem
59     */
60    public static JadeMXServer jadeMXServerBySysProp() 
61      throws InstantiationException, 
62             IllegalAccessException, 
63             ClassNotFoundException {
64        return jadeMXServerByClassName( serverClassName() );
65    }
66    
67    
68    /**
69     * return jademx server as specified by argument class name
70     * @param className name to instantiate
71     * @return jademx server as specified by system property
72     * @throws ClassNotFoundException specified class not found
73     * @throws IllegalAccessException not allowed
74     * @throws InstantiationException constructor problem
75     */
76    public static JadeMXServer jadeMXServerByClassName( String className ) 
77      throws InstantiationException, 
78             IllegalAccessException, 
79             ClassNotFoundException {
80        return (JadeMXServer)Class.forName( className ).newInstance();
81    }
82    
83    /**
84     * make sure server type property set to desired server
85     * @param jadeMXServer JadeMXServer whose class to be set as sysprop
86     */
87    public static void setSysProp( JadeMXServer jadeMXServer ) {
88        String jmxsClassName = jadeMXServer.getClass().getName();
89        System.setProperty( SERVER_TYPE_PROPERTY, jmxsClassName );
90    }
91 
92 
93 
94}

[all classes][jade.jademx.server]
EMMA 2.0.5312 (C) Vladimir Roubtsov