EMMA Coverage Report (generated Tue May 16 15:34:38 CDT 2006)
[all classes][com.mysql.management.jmx.jboss]

COVERAGE SUMMARY FOR SOURCE FILE [JBossMysqldDynamicMBean.java]

nameclass, %method, %block, %line, %
JBossMysqldDynamicMBean.java100% (3/3)100% (10/10)100% (124/124)100% (34/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JBossMysqldDynamicMBean100% (1/1)100% (6/6)100% (76/76)100% (25/25)
JBossMysqldDynamicMBean (): void 100% (1/1)100% (5/5)100% (3/3)
JBossMysqldDynamicMBean (MysqldResourceI): void 100% (1/1)100% (6/6)100% (3/3)
create (): void 100% (1/1)100% (8/8)100% (3/3)
destroy (): void 100% (1/1)100% (8/8)100% (3/3)
initOps (): void 100% (1/1)100% (25/25)100% (5/5)
invoke (String, Object [], String []): Object 100% (1/1)100% (24/24)100% (8/8)
     
class JBossMysqldDynamicMBean$1100% (1/1)100% (2/2)100% (34/34)100% (6/6)
JBossMysqldDynamicMBean$1 (JBossMysqldDynamicMBean): void 100% (1/1)100% (6/6)100% (1/1)
inner (): void 100% (1/1)100% (28/28)100% (5/5)
     
class JBossMysqldDynamicMBean$2100% (1/1)100% (2/2)100% (14/14)100% (3/3)
JBossMysqldDynamicMBean$2 (JBossMysqldDynamicMBean): void 100% (1/1)100% (6/6)100% (1/1)
inner (): void 100% (1/1)100% (8/8)100% (2/2)

1/*
2 Copyright (C) 2004 MySQL AB
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 as 
6 published by the Free Software Foundation.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16 
17 */
18package com.mysql.management.jmx.jboss;
19 
20import javax.management.MBeanOperationInfo;
21import javax.management.ReflectionException;
22 
23import com.mysql.management.MysqldResourceI;
24import com.mysql.management.jmx.SimpleMysqldDynamicMBean;
25import com.mysql.management.util.Exceptions;
26 
27public final class JBossMysqldDynamicMBean extends SimpleMysqldDynamicMBean {
28    static final String CREATE_METHOD = "create";
29 
30    static final String DESTROY_METHOD = "destroy";
31 
32    private MBeanOperationInfo createMethod;
33 
34    private MBeanOperationInfo destroyMethod;
35 
36    public JBossMysqldDynamicMBean() {
37        super();
38        initOps();
39    }
40 
41    JBossMysqldDynamicMBean(MysqldResourceI mysqldResource) {
42        super(mysqldResource);
43        initOps();
44    }
45 
46    private void initOps() {
47        createMethod = newVoidMBeanOperation(CREATE_METHOD,
48                "Create MySQL MBean");
49        destroyMethod = newVoidMBeanOperation(DESTROY_METHOD,
50                "Destroy MySQL MBean");
51        getMBeanOperationInfoList().add(createMethod);
52        getMBeanOperationInfoList().add(destroyMethod);
53    }
54 
55    public synchronized Object invoke(String methodName, Object args[],
56            String types[]) throws ReflectionException {
57 
58        clearMBeanInfo();
59 
60        if (methodName.equals(CREATE_METHOD)) {
61            create();
62            return null;
63        }
64 
65        if (methodName.equals(DESTROY_METHOD)) {
66            destroy();
67            return null;
68        }
69 
70        return super.invoke(methodName, args, types);
71    }
72 
73    public void create() {
74        Exceptions.VoidBlock block = new Exceptions.VoidBlock() {
75            public void inner() throws Exception {
76                String autoStart = "" + getAttribute(AUTOSTART_ATTR);
77                autoStart = autoStart.toLowerCase();
78                if (autoStart.equals(Boolean.TRUE.toString())) {
79                    invoke(START_METHOD, null, null);
80                }
81            }
82        };
83        block.exec();
84    }
85 
86    public void destroy() {
87        Exceptions.VoidBlock block = new Exceptions.VoidBlock() {
88            public void inner() throws ReflectionException {
89                invoke(STOP_METHOD, null, null);
90            }
91        };
92        block.exec();
93    }
94}

[all classes][com.mysql.management.jmx.jboss]
EMMA 2.0.5312 (C) Vladimir Roubtsov