1 19 package org.netbeans.modules.j2ee.sun.bridge.apis; 20 21 import java.util.Iterator ; 22 import java.util.List ; 23 import javax.management.Attribute ; 24 import javax.management.MBeanAttributeInfo ; 25 import org.netbeans.modules.j2ee.sun.util.PropertySupportFactory; 26 import org.openide.nodes.Children; 27 import org.openide.nodes.PropertySupport; 28 import org.openide.nodes.Sheet; 29 30 31 32 37 public abstract class AppserverMgmtActiveNode extends AppserverMgmtNode { 38 39 private Controller controller; 40 private PropertySupportFactory propSupportFactory = 41 PropertySupportFactory.getInstance(); 42 43 48 public AppserverMgmtActiveNode(Children children, String nodeType) { 49 super(children, nodeType); 50 } 51 52 53 58 public AppserverMgmtActiveNode(Children children, Controller controller, 59 String nodeType) { 60 super(children, nodeType); 61 this.controller = controller; 62 } 63 64 65 70 public AppserverMgmtActiveNode(final Children children, 71 final AppserverMgmtController controller, 72 final String nodeType) { 73 super(controller, children, nodeType); 74 } 75 76 77 82 protected final Controller getController() { 83 return controller; 84 } 85 86 92 protected Sheet createSheet() { 93 Sheet sheet = Sheet.createDefault(); 94 95 ClassLoader origClassLoader=Thread.currentThread().getContextClassLoader(); 96 try { 97 Thread.currentThread().setContextClassLoader( 98 this.getClass().getClassLoader()); 99 100 Sheet.Set props = sheet.get(Sheet.PROPERTIES); 101 props.put(createPropertySupportArray(getSheetProperties())); 102 return sheet; 103 }catch(NullPointerException ex){ 104 return sheet; 105 } catch(RuntimeException rex) { 106 return sheet; 107 } finally { 108 Thread.currentThread().setContextClassLoader(origClassLoader); 109 } 110 } 111 112 113 119 PropertySupport[] createPropertySupportArray(final java.util.Map attrMap) { 120 PropertySupport[] supports = new PropertySupport[attrMap.size()]; 121 int i = 0; 122 for(Iterator itr = attrMap.keySet().iterator(); itr.hasNext(); ) { 123 Attribute attr = (Attribute ) itr.next(); 124 MBeanAttributeInfo info = (MBeanAttributeInfo ) attrMap.get(attr); 125 supports[i] = 126 propSupportFactory.getPropertySupport(this, attr, info); 127 i++; 128 } 129 return supports; 130 } 131 132 133 139 protected List getPropertiesToIgnore() { 140 return null; 141 } 142 143 144 151 abstract protected java.util.Map getSheetProperties(); 152 153 164 abstract public javax.management.Attribute setSheetProperty(String attrName, Object value); 165 166 167 } 168 | Popular Tags |