public void addAttribute(GAttributeInfo info) { attributes.put(info.getName(), info); }
private boolean isMagicAttribute(GAttributeInfo attributeInfo) { String name = attributeInfo.getName(); String type = attributeInfo.getType(); return ("kernel".equals(name) && Kernel.class.getName().equals(type)) || ("classLoader".equals(name) && ClassLoader.class.getName().equals(type)) || ("abstractName".equals(name) && AbstractName.class.getName().equals(type)) || ("objectName".equals(name) && String.class.getName().equals(type)); }
for (Iterator iterator = attributes.iterator(); iterator.hasNext();) { GAttributeInfo attribute = (GAttributeInfo) iterator.next(); map.put(attribute.getName(), attribute);
/** * Return MBean attributes */ @RemoteMethod public Collection<Map<String, String>> getAttributes(String abstractNameString) { Map<String, Map<String, String>> attributes = new TreeMap<String, Map<String, String>>(); try { AbstractName abstractName = new AbstractName(URI.create(abstractNameString)); GBeanInfo gBeanInfo = kernel.getGBeanInfo(abstractName); Set<GAttributeInfo> attrs = gBeanInfo.getAttributes(); for (Iterator<GAttributeInfo> i = attrs.iterator(); i.hasNext();) { GAttributeInfo gAttrInfo = i.next(); String attrName = gAttrInfo.getName(); if (!GBEANINFO_ATTRIB.equals(attrName)) { // Don't include the 'GBeanInfo' attributes Map<String, String> attrInfoMap = getAttrInfoAsMap(abstractName, gAttrInfo); attributes.put(attrName, attrInfoMap); } } } catch (GBeanNotFoundException e) { // GBean not found, just ignore } return attributes.values(); }
GAttributeInfo attribInfo) { Map<String, String> map = new TreeMap<String, String>(); String attribName = attribInfo.getName(); map.put("name", attribName); map.put("getterName", attribInfo.getGetterName());
for (Iterator iterator = attributeInfos.iterator(); iterator.hasNext();) { GAttributeInfo attributeInfo = (GAttributeInfo) iterator.next(); attributeNames.add(attributeInfo.getName());
private void renderDetail(RenderRequest renderRequest, RenderResponse renderResponse, String name) throws PortletException, IOException { ObjectName gbeanName; try { gbeanName = new ObjectName(name); } catch (MalformedObjectNameException e) { throw new PortletException("Malformed parameter name: " + renderRequest.getParameter("name")); } try { GBeanInfo gbeanInfo = kernel.getGBeanInfo(gbeanName); Set attributes = gbeanInfo.getAttributes(); Map values = new HashMap(attributes.size()); for (Iterator i = attributes.iterator(); i.hasNext();) { GAttributeInfo attribute = (GAttributeInfo) i.next(); String gname = attribute.getName(); if (HIDDEN_ATTRIBUTES.contains(gname)) { continue; } Object value = kernel.getAttribute(gbeanName, gname); values.put(gname, value); } renderRequest.setAttribute("attributeMap", values); } catch (Exception e) { throw new PortletException(e); } detailView.include(renderRequest, renderResponse); }
for (Iterator i = source.getAttributes().iterator(); i.hasNext();) { GAttributeInfo attributeInfo = (GAttributeInfo) i.next(); attributes.put(attributeInfo.getName(), attributeInfo);