1 22 package org.jboss.system.metadata; 23 24 import javax.management.MBeanAttributeInfo ; 25 import javax.management.MBeanServer ; 26 27 import org.jboss.kernel.Kernel; 28 import org.jboss.kernel.spi.dependency.KernelController; 29 import org.jboss.system.ServiceController; 30 31 37 public class ServiceValueContext 38 { 39 40 private MBeanServer server; 41 42 43 private ServiceController controller; 44 45 46 private MBeanAttributeInfo attributeInfo; 47 48 49 private ClassLoader classloader; 50 51 52 private boolean trim; 53 54 55 private boolean replace; 56 57 60 public ServiceValueContext() 61 { 62 } 63 64 71 public ServiceValueContext(MBeanServer server, ServiceController controller, ClassLoader classloader) 72 { 73 this.server = server; 74 this.controller = controller; 75 this.classloader = classloader; 76 } 77 78 86 public ServiceValueContext(MBeanServer server, ServiceController controller, MBeanAttributeInfo attributeInfo, ClassLoader classloader) 87 { 88 this.server = server; 89 this.controller = controller; 90 this.attributeInfo = attributeInfo; 91 this.classloader = classloader; 92 } 93 94 99 public MBeanAttributeInfo getAttributeInfo() 100 { 101 return attributeInfo; 102 } 103 104 109 public void setAttributeInfo(MBeanAttributeInfo attributeInfo) 110 { 111 this.attributeInfo = attributeInfo; 112 } 113 114 119 public ClassLoader getClassloader() 120 { 121 return classloader; 122 } 123 124 129 public void setClassloader(ClassLoader classloader) 130 { 131 this.classloader = classloader; 132 } 133 134 139 public boolean isReplace() 140 { 141 return replace; 142 } 143 144 149 public void setReplace(boolean replace) 150 { 151 this.replace = replace; 152 } 153 154 159 public MBeanServer getServer() 160 { 161 if (server == null) 162 { 163 if (controller == null) 164 throw new IllegalStateException ("No MBeanServer"); 165 else 166 return controller.getMBeanServer(); 167 } 168 return server; 169 } 170 171 176 public void setServer(MBeanServer server) 177 { 178 this.server = server; 179 } 180 181 186 public ServiceController getServiceController() 187 { 188 if (controller == null) 189 throw new IllegalStateException ("No ServiceController"); 190 return controller; 191 } 192 193 198 public void setServiceController(ServiceController controller) 199 { 200 this.controller = controller; 201 } 202 203 208 public boolean isTrim() 209 { 210 return trim; 211 } 212 213 218 public void setTrim(boolean trim) 219 { 220 this.trim = trim; 221 } 222 223 228 public Kernel getKernel() 229 { 230 return getServiceController().getKernel(); 231 } 232 233 238 public KernelController getController() 239 { 240 return getKernel().getController(); 241 } 242 } 243 | Popular Tags |