public object GetAttribute(ObjectName name, string attributeName) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); TestPermissions(bean.GetMBeanInfo().ClassName, attributeName, name, MBeanPermissionAction.GetAttribute); return(bean.GetAttribute(attributeName)); }
public void SetAttribute(ObjectName name, string attributeName, object value) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); TestPermissions(bean.GetMBeanInfo().ClassName, attributeName, name, MBeanPermissionAction.SetAttribute); bean.SetAttribute(attributeName, value); }
public bool IsInstanceOf(ObjectName name, string className) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); MBeanInfo info = bean.GetMBeanInfo(); TestPermissions(info.ClassName, null, name, MBeanPermissionAction.IsInstanceOf); return(info.ClassName == className); }
public MBeanInfo GetMBeanInfo(ObjectName name) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); MBeanInfo info = bean.GetMBeanInfo(); TestPermissions(info.ClassName, null, name, MBeanPermissionAction.GetMBeanInfo); return(info); }
private ObjectInstance RegisterMBeanInternal(ObjectName name, IDynamicMBean bean) { IMBeanRegistration registration = new MBeanRegistrationHelper(bean as IMBeanRegistration); name = registration.PreRegister(this, name); string className = bean.GetMBeanInfo().ClassName; TestPermissions(className, null, name, MBeanPermissionAction.RegisterMBean); if (_beans.ContainsKey(name)) { registration.PostRegister(false); throw new InstanceAlreadyExistsException(name.ToString()); } _beans[name] = bean; registration.PostRegister(true); _delegate.SendNotification(new MBeanServerNotification(MBeanServerNotification.RegistrationNotification, null, -1, name)); _domainSet[name.Domain] = true; return(new ObjectInstance(name, bean.GetMBeanInfo().ClassName)); }
public object Invoke(ObjectName name, string operationName, object[] arguments) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); TestPermissions(bean.GetMBeanInfo().ClassName, operationName, name, MBeanPermissionAction.Invoke); try { return(bean.Invoke(operationName, arguments)); } catch (Exception e) { throw new MBeanException("Exception during 'invoke' operation.", e); } }
public void UnregisterMBean(ObjectName name) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); MBeanInfo info = bean.GetMBeanInfo(); TestPermissions(info.ClassName, null, name, MBeanPermissionAction.UnregisterMBean); IMBeanRegistration registration = new MBeanRegistrationHelper(bean as IMBeanRegistration); registration.PreDeregister(); _beans.Remove(name); registration.PostDeregister(); _delegate.SendNotification(new MBeanServerNotification(MBeanServerNotification.UnregistrationNotification, null, -1, name)); _domainSet.Remove(name.Domain); }
public IList <AttributeValue> GetAttributes(ObjectName name, string[] attributeNames) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); string className = bean.GetMBeanInfo().ClassName; List <AttributeValue> results = new List <AttributeValue>(); foreach (string attributeName in attributeNames) { TestPermissions(className, attributeName, name, MBeanPermissionAction.GetAttribute); try { results.Add(new AttributeValue(attributeName, bean.GetAttribute(attributeName))); } catch (AttributeNotFoundException) { } } return(results); }
public IList <AttributeValue> SetAttributes(ObjectName name, IEnumerable <AttributeValue> namesAndValues) { name = GetNameWithDomain(name); IDynamicMBean bean = GetMBean(name); string className = bean.GetMBeanInfo().ClassName; List <AttributeValue> results = new List <AttributeValue>(); foreach (AttributeValue nameAndValue in namesAndValues) { TestPermissions(className, nameAndValue.Name, name, MBeanPermissionAction.SetAttribute); try { bean.SetAttribute(nameAndValue.Name, nameAndValue.Value); results.Add(new AttributeValue(nameAndValue.Name, nameAndValue.Value)); } catch (AttributeNotFoundException) { //Best-effort } } return(results); }
public bool HasAttribute(string attributeName) { return(_bean.GetMBeanInfo().Attributes.Any(x => x.Name == attributeName)); }
private ObjectInstance RegisterMBeanInternal(ObjectName name, IDynamicMBean bean) { IMBeanRegistration registration = new MBeanRegistrationHelper(bean as IMBeanRegistration); name = registration.PreRegister(this, name); string className = bean.GetMBeanInfo().ClassName; TestPermissions(className, null, name, MBeanPermissionAction.RegisterMBean); if (_beans.ContainsKey(name)) { registration.PostRegister(false); throw new InstanceAlreadyExistsException(name.ToString()); } _beans[name] = bean; registration.PostRegister(true); _delegate.SendNotification(new MBeanServerNotification(MBeanServerNotification.RegistrationNotification, null, -1, name)); _domainSet[name.Domain] = true; return new ObjectInstance(name, bean.GetMBeanInfo().ClassName); }