description = name; Descriptor descriptor = new DescriptorSupport(); OpenType ot = OpenTypeUtils.typeToOpenType(field.getGenericType()); if (ot != null) {
public static DescriptorSupport descriptor(final DuckTyped dt) { final DescriptorSupport d = new DescriptorSupport(); d.setField(DESC_KIND, DuckTyped.class.getName()); return d; }
if("name".equals(localName)) support.setField(XMBeanConstants.NAME, value); support.setField(XMBeanConstants.PERSIST_POLICY, persistPolicy); support.setField(XMBeanConstants.PERSIST_PERIOD, persistPeriod); support.setField(XMBeanConstants.PERSIST_LOCATION, persistLocation); support.setField(XMBeanConstants.PERSIST_NAME, persistName); support.setField(XMBeanConstants.CURRENCY_TIME_LIMIT, value); support.setField(XMBeanConstants.DEFAULT, value); support.setField(XMBeanConstants.DISPLAY_NAME, value); support.setField(XMBeanConstants.CACHED_VALUE, value); support.setField(XMBeanConstants.PERSISTENCE_MANAGER, value); support.setField(desc.getName(), desc.getValue()); support.setField(desc.getName(), desc.getValue()); support.setField(XMBeanConstants.INTERCEPTORS, ivalue);
if (super.isValid())
public static DescriptorSupport mbeanDescriptor( final boolean immutable, final Class<?> intf, final boolean singleton, final boolean globalSingleton, final String group, final boolean supportsAdoption, final String[] subTypes) { final DescriptorSupport desc = new DescriptorSupport(); if (intf == null || !intf.isInterface()) { throw new IllegalArgumentException("interface class must be an interface"); } desc.setField(DESC_STD_IMMUTABLE_INFO, immutable); desc.setField(DESC_STD_INTERFACE_NAME, intf.getName()); desc.setField(DESC_IS_SINGLETON, singleton); desc.setField(DESC_IS_GLOBAL_SINGLETON, globalSingleton); desc.setField(DESC_GROUP, group); desc.setField(DESC_SUPPORTS_ADOPTION, supportsAdoption); if (subTypes != null) { desc.setField(DESC_SUB_TYPES, subTypes); } return desc; } }
if("name".equals(localName)) support.setField(XMBeanConstants.NAME, value); support.setField(XMBeanConstants.PERSIST_POLICY, persistPolicy); support.setField(XMBeanConstants.PERSIST_PERIOD, persistPeriod); support.setField(XMBeanConstants.PERSIST_LOCATION, persistLocation); support.setField(XMBeanConstants.PERSIST_NAME, persistName); support.setField(XMBeanConstants.CURRENCY_TIME_LIMIT, value); support.setField(XMBeanConstants.DEFAULT, value); support.setField(XMBeanConstants.DISPLAY_NAME, value); support.setField(XMBeanConstants.CACHED_VALUE, value); support.setField(XMBeanConstants.PERSISTENCE_MANAGER, value); support.setField(desc.getName(), desc.getValue()); support.setField(desc.getName(), desc.getValue()); support.setField(XMBeanConstants.INTERCEPTORS, ivalue);
@Override public ModelMBeanAttributeInfo createAttributeInfo() { Descriptor desc = new DescriptorSupport(new String[] {"name=" + this.displayName, "descriptorType=attribute", "currencyTimeLimit=-1", // always stale "displayName=" + this.displayName, "getMethod=getValue"}); Assert.assertTrue(this.stat != null, "Stat target object is null!"); desc.setField("targetObject", this.stat); ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(this.displayName, // name this.type, // type this.description, // description this.readable, // isReadable this.writeable, // isWritable this.is, // isIs desc); return info; } }
public static DescriptorSupport descriptor(final Element e) { final DescriptorSupport d = new DescriptorSupport(); d.setField(DESC_KIND, Element.class.getName()); d.setField(DESC_KEY, e.key()); d.setField(DESC_REQUIRED, e.required()); d.setField(DESC_REFERENCE, e.reference()); d.setField(DESC_VARIABLE_EXPANSION, e.variableExpansion()); return d; }
@Override public ModelMBeanAttributeInfo createAttributeInfo() { Descriptor desc = new DescriptorSupport(new String[] {"name=" + this.displayName, "descriptorType=attribute", "currencyTimeLimit=-1", // always stale "displayName=" + this.displayName, "getMethod=getJmxValue", "setMethod=setJmxValue"}); Assert.assertTrue(this.config != null, "Config target object is null!"); desc.setField("targetObject", this.config); ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(this.displayName, // name this.type, // type this.description, // description this.readable, // isReadable this.writeable, // isWritable this.is, // isIs desc); return info; } }
private DescriptorSupport descriptor() { final DescriptorSupport d = new DescriptorSupport(); String amxInterfaceName = AMXConfigProxy.class.getName(); // generic default final String intfPackage = mIntf.getPackage().getName(); if (Domain.class.getPackage().getName().equals(intfPackage)) { amxInterfaceName = mIntf.getName(); } d.setField(DESC_STD_INTERFACE_NAME, amxInterfaceName); d.setField(DESC_GENERIC_INTERFACE_NAME, AMXConfigProxy.class.getName()); d.setField(DESC_STD_IMMUTABLE_INFO, true); d.setField(DESC_GROUP, "config"); // Adoption is not supported, only other config elements d.setField(DESC_SUPPORTS_ADOPTION, false); d.setField(DESC_IS_SINGLETON, isSingleton()); final String[] subTypes = CollectionUtil.toArray(childTypes().keySet(), String.class); d.setField(DESC_SUB_TYPES, subTypes); return d; }
/** * @return notificationInfo */ public final MBeanNotificationInfo[] getNotificationInfo() { MBeanNotificationInfo[] result = new MBeanNotificationInfo[2]; Descriptor genericDescriptor = new DescriptorSupport(new String[] { "name=GENERIC", "descriptorType=notification", "LOGGER=T", "severity=5", "displayName=jmx.modelmbean.generic" }); result[0] = new ModelMBeanNotificationInfo(new String[] {"jmx.modelmbean.generic" }, "GENERIC", "A text notification has been issued by the managed resource", genericDescriptor); Descriptor attributeDescriptor = new DescriptorSupport(new String[] {"name=ATTRIBUTE_CHANGE", "descriptorType=notification", "LOGGER=T", "severity=5", "displayName=jmx.attribute.change" }); result[1] = new ModelMBeanNotificationInfo(new String[] {"jmx.attribute.change" }, "ATTRIBUTE_CHANGE", "Signifies that an observed MBean attribute value has changed", attributeDescriptor); return result; }
public static DescriptorSupport descriptor(final AttributeMethodInfo info) { final DescriptorSupport d = new DescriptorSupport(); final Attribute a = info.attribute(); d.setField(DESC_KIND, Attribute.class.getName()); if (!a.defaultValue().equals("\u0000")) { d.setField(DESC_DEFAULT_VALUE, a.defaultValue()); } d.setField(DESC_KEY, a.key()); d.setField(DESC_REQUIRED, a.required()); d.setField(DESC_REFERENCE, a.reference()); d.setField(DESC_VARIABLE_EXPANSION, a.variableExpansion()); d.setField(DESC_DATA_TYPE, info.inferDataType().getName()); return d; }
public RequiredModelMBean newModelMBean() throws MBeanException { Descriptor mmbDesc = new DescriptorSupport(); mmbDesc.setField( "name", objectName.toString() ); mmbDesc.setField( "descriptorType", "mbean" ); mmbDesc.setField( "displayName", displayName ); ModelMBeanInfo modelMBeanInfo = new ModelMBeanInfoSupport( className, displayName, attributes.toArray( new ModelMBeanAttributeInfo[attributes.size()]), constructors.toArray( new ModelMBeanConstructorInfo[constructors.size()]), operations.toArray( new ModelMBeanOperationInfo[operations.size()]), notifications.toArray( new ModelMBeanNotificationInfo[notifications.size()]) ); modelMBeanInfo.setMBeanDescriptor( mmbDesc ); return new RequiredModelMBean(modelMBeanInfo); } }
protected Descriptor[] buildInterceptors(Element descriptor) { List interceptors = descriptor.elements("interceptor"); ArrayList tmp = new ArrayList(); for(int i = 0; i < interceptors.size(); i ++) { Element interceptor = (Element) interceptors.get(i); String code = interceptor.attributeValue("code"); DescriptorSupport interceptorDescr = new DescriptorSupport(); interceptorDescr.setField("code", code); List attributes = interceptor.attributes(); for(int a = 0; a < attributes.size(); a ++) { Attribute attr = (Attribute) attributes.get(a); String name = attr.getName(); String value = attr.getValue(); value = StringPropertyReplacer.replaceProperties(value); interceptorDescr.setField(name, value); } tmp.add(interceptorDescr); } Descriptor[] descriptors = new Descriptor[tmp.size()]; tmp.toArray(descriptors); return descriptors; }
public RequiredModelMBean newModelMBean() throws MBeanException { Descriptor mmbDesc = new DescriptorSupport(); mmbDesc.setField( "name", objectName.toString() ); mmbDesc.setField( "descriptorType", "mbean" ); mmbDesc.setField( "displayName", displayName ); ModelMBeanInfo modelMBeanInfo = new ModelMBeanInfoSupport( className, displayName, attributes.toArray( new ModelMBeanAttributeInfo[attributes.size()]), constructors.toArray( new ModelMBeanConstructorInfo[constructors.size()]), operations.toArray( new ModelMBeanOperationInfo[operations.size()]), notifications.toArray( new ModelMBeanNotificationInfo[notifications.size()]) ); modelMBeanInfo.setMBeanDescriptor( mmbDesc ); return new RequiredModelMBean(modelMBeanInfo); } }
protected Descriptor[] buildInterceptors(Element descriptor) { List interceptors = descriptor.elements("interceptor"); ArrayList tmp = new ArrayList(); for(int i = 0; i < interceptors.size(); i ++) { Element interceptor = (Element) interceptors.get(i); String code = interceptor.attributeValue("code"); DescriptorSupport interceptorDescr = new DescriptorSupport(); interceptorDescr.setField("code", code); List attributes = interceptor.attributes(); for(int a = 0; a < attributes.size(); a ++) { Attribute attr = (Attribute) attributes.get(a); String name = attr.getName(); String value = attr.getValue(); value = StringPropertyReplacer.replaceProperties(value); interceptorDescr.setField(name, value); } tmp.add(interceptorDescr); } Descriptor[] descriptors = new Descriptor[tmp.size()]; tmp.toArray(descriptors); return descriptors; }
descriptor = new DescriptorSupport (new String[] { "name=GENERIC", "descriptorType=notification", descriptor = new DescriptorSupport (new String[] { "name=ATTRIBUTE_CHANGE", "descriptorType=notification",
/** Merge two descriptors. Values in 'src' override values in 'dest', but neither is modified, a new one is returned. */ public static DescriptorSupport mergeDescriptors( final Descriptor src, final Descriptor dest) { final DescriptorSupport d = new DescriptorSupport(); // do it manually, the APIs screw up booleans making the "(true)" instead of "true". String[] fieldNames = dest.getFieldNames(); for (final String fieldName : fieldNames) { d.setField(fieldName, dest.getFieldValue(fieldName)); } // now overwrite conflicting fields with those from 'src' fieldNames = src.getFieldNames(); for (final String fieldName : fieldNames) { d.setField(fieldName, src.getFieldValue(fieldName)); } return d; }
public Descriptor buildAttributeOperationDescriptor(String operationName) { Descriptor desc = new DescriptorSupport(); desc.setField("name", operationName); desc.setField("descriptorType", "operation"); if (operationName.indexOf("set") == 0) { desc.setField("role", "setter"); } else { desc.setField("role", "getter"); } return desc; }