1 7 package org.ejtools.management.browser.state.rules; 8 9 import java.util.Map ; 10 11 import org.ejtools.management.browser.frame.ServerInternalFrame; 12 import org.ejtools.management.browser.model.ManagedObject; 13 import org.ejtools.util.state.DefaultRule; 14 import org.xml.sax.Attributes ; 15 16 21 public class ManagedObjectRule extends DefaultRule 22 { 23 28 public void loadEnter(Map context) 29 { 30 ServerInternalFrame frame = (ServerInternalFrame) context.get("FRAME"); 31 Attributes attrs = (Attributes ) context.get("ATTRIBUTES"); 32 33 String objectName = attrs.getValue("objectName"); 34 ManagedObject resource = frame.queryMBean(objectName); 35 if (resource != null) 36 { 37 context.put("MANAGED-OBJECT", resource); 38 39 String listen = attrs.getValue("listen"); 40 if ("true".equals(listen)) 41 { 42 try 43 { 44 resource.registerForNotifications(); 45 } 46 catch (Exception e) 47 { 48 e.printStackTrace(); 49 } 50 } 51 } 52 } 53 } 54 | Popular Tags |