KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > state > rules > ResourceRule


1 /*
2
3  * Created on 20 juin 2003
4
5  *
6
7  * To change this generated comment go to
8
9  * Window>Preferences>Java>Code Generation>Code Template
10
11  */

12
13 package org.ejtools.jmx.browser.state.rules;
14
15
16
17 import java.util.Map JavaDoc;
18
19
20
21 import org.ejtools.jmx.browser.frame.ServerInternalFrame;
22
23 import org.ejtools.jmx.browser.model.Resource;
24
25 import org.ejtools.util.state.DefaultRule;
26
27 import org.xml.sax.Attributes JavaDoc;
28
29
30
31 /**
32
33  * @author letiemble
34
35  * @created 20 juin 2003
36
37  * @version $Revision: 1.2 $
38
39  */

40
41 public class ResourceRule extends DefaultRule
42
43 {
44
45    /**
46
47     * Description of the Method
48
49     *
50
51     * @param context Description of the Parameter
52
53     */

54
55    public void loadEnter(Map JavaDoc context)
56
57    {
58
59       ServerInternalFrame frame = (ServerInternalFrame) context.get("FRAME");
60
61       Attributes JavaDoc attrs = (Attributes JavaDoc) context.get("ATTRIBUTES");
62
63
64
65       String JavaDoc objectName = attrs.getValue("objectName");
66
67       Resource resource = frame.queryMBean(objectName);
68
69       if (resource != null)
70
71       {
72
73          context.put("RESOURCE", resource);
74
75
76
77          String JavaDoc listen = attrs.getValue("listen");
78
79          if ("true".equals(listen))
80
81          {
82
83             try
84
85             {
86
87                resource.registerForNotifications();
88
89             }
90
91             catch (Exception JavaDoc e)
92
93             {
94
95                e.printStackTrace();
96
97             }
98
99          }
100
101       }
102
103    }
104
105 }
106
107
Popular Tags