@Override public MetaValue createMetaValue(MetaType metaType, Map<String, Map<String, Long>> object) { Map<String, MetaValue> methodMap = new HashMap<String, MetaValue>(); for (Map.Entry<String, Map<String, Long>> entry: object.entrySet()) { if (entry.getKey().charAt(0) == '#') continue; MapCompositeValueSupport cvs = new MapCompositeValueSupport(METHOD_STATS_TYPE); for (String name : METHOD_STATS_TYPE.itemSet()) cvs.put(name, SimpleValueSupport.wrap(entry.getValue().get(name))); methodMap.put(entry.getKey(), cvs); } MapCompositeValueSupport root = new MapCompositeValueSupport(TYPE); for (int i = 0; i < 3; i++) root.put(rootItemNames[i], SimpleValueSupport.wrap(object.get("#Global").get(rootItemNames[i]))); root.put(rootItemNames[3], new MapCompositeValueSupport(methodMap, METHOD_STATS_MAP_TYPE)); return root; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof MapCompositeValueSupport == false) return false; MapCompositeValueSupport other = (MapCompositeValueSupport) obj; if (mapType.equals(other.getMetaType()) == false) return false; Map<String, MetaValue> otherMap = other.map; if (map == null && otherMap == null) return true; if (map == null && otherMap != null) return false; return map.equals(otherMap); }
@Override public MetaValue createMetaValue(MetaType metaType, ObjectName object) { String domain = object.getDomain(); Map<String, String> props = object.getKeyPropertyList(); Map<String, MetaValue> metaProps = new HashMap<String, MetaValue>(); metaProps.put("domain", SimpleValueSupport.wrap(domain)); for(Entry<String,String> entry : props.entrySet()) { metaProps.put(entry.getKey(), SimpleValueSupport.wrap(entry.getValue())); } MapCompositeValueSupport map = new MapCompositeValueSupport(metaProps, SimpleMetaType.STRING); return map; }
CompositeMetaType metaType = value.getMetaType(); CompositeValue row = (CompositeValue) value.get(name); if(row == null) continue;
@Override public MetaValue createMetaValue(MetaType metaType, Map<String, ProtocolStackConfigInfo> object) { Map<String, MetaValue> result = new HashMap<String, MetaValue>(); for (Map.Entry<String, ProtocolStackConfigInfo> entry : object.entrySet()) { ProtocolStackConfigInfo info = entry.getValue(); Map<String, MetaValue> stackValue = new HashMap<String, MetaValue>(); stackValue.put("name", SimpleValueSupport.wrap(info.getName())); stackValue.put("description", SimpleValueSupport.wrap(info.getDescription())); ProtocolData[] data = info.getConfiguration(); stackValue.put("configuration", CONFIG_MAPPER.createMetaValue(CONFIG_MAPPER.getMetaType(), data)); result.put(entry.getKey(), new CompositeValueSupport(TYPE, stackValue)); } return new MapCompositeValueSupport(result, TYPE); }
for(String name : mapValue.getMetaType().keySet()) String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name)); prop.setValue(svalue); list.add(prop);
@Override public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, MetaData metaData, T attachment) { MetaValue value = null; if("connection-properties".equals(property.getName())) { MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING); List<DataSourceConnectionPropertyMetaData> list = attachment.getDataSourceConnectionProperties(); if(list != null) { for(DataSourceConnectionPropertyMetaData prop : list) { MetaValue wrapped = SimpleValueSupport.wrap(prop.getValue()); mapValue.put(prop.getName(), wrapped); } } value = mapValue; } else { value = super.getValue(beanInfo, property, metaData, attachment); } return value; }
private MetaValue createViewMetaValue(View view) { Map<String, MetaValue> viewMap = new HashMap<String, MetaValue>(); viewMap.put("id", SimpleValueSupport.wrap(view.getVid().getId())); viewMap.put("creator", SimpleValueSupport.wrap(view.getCreator().toString())); Vector<Address> members = view.getMembers(); MetaValue[] memberValues = new MetaValue[members.size()]; for (int i = 0; i < memberValues.length; i++) { memberValues[i] = SimpleValueSupport.wrap(members.get(i).toString()); } viewMap.put("members", new CollectionValueSupport(MEMBERS_TYPE, memberValues)); if (memberValues.length > 0) { viewMap.put("coordinator", memberValues[0]); } MetaValue viewValue = new MapCompositeValueSupport(viewMap, VIEW_TYPE); return viewValue; }
for(String name : mapValue.getMetaType().keySet()) String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name)); prop.setValue(svalue); list.add(prop);
@Override public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, MetaData metaData, XADataSourceDeploymentMetaData attachment) { MetaValue metaValue = null; if("xa-datasource-properties".equals(property.getName())) { List<XAConnectionPropertyMetaData> list = attachment.getXADataSourceProperties(); if(list != null) { MapCompositeValueSupport map = new MapCompositeValueSupport(SimpleMetaType.STRING); for(XAConnectionPropertyMetaData prop : list) { MetaValue svalue = SimpleValueSupport.wrap(prop.getValue()); map.put(prop.getName(), svalue); } metaValue = map; } } else { metaValue = super.getValue(beanInfo, property, metaData, attachment); } return metaValue; }
protocolValue.put("protocolParameters", new MapCompositeValueSupport(paramValues, PROTOCOL_PARAMETER_MAP_TYPE)); dataElements[i] = new MapCompositeValueSupport(protocolValue, PROTOCOL_STACK_CONFIG_TYPE);
for(String name : mapValue.getMetaType().keySet()) String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name)); prop.setValue(svalue); String nameType = name+".type"; MetaValue typeValue = mapValue.get(nameType); if(typeValue != null)
MapCompositeMetaType mapType = (MapCompositeMetaType) type; MetaType mapValueType = mapType.getValueType(); MapCompositeValueSupport result = new MapCompositeValueSupport(mapValueType); for(Entry<String,?> entry : map.entrySet()) result.put(entry.getKey(), entryMetaValue);
/** * Create the MapCompositeValueSupport value. * * @param composite the persisted composite xml meta data * @param type the MapComposite meta type * @return the MapCompositeValueSupport */ protected MapCompositeValueSupport handleMapCompositeMetaType(PersistedCompositeValue composite, MapCompositeMetaType type) { Map<String, MetaValue> values = new HashMap<String, MetaValue>(); if(composite.getValues() != null && composite.getValues().isEmpty() == false) { for(PersistedValue persistedValue : composite.getValues()) { MetaValue value = createMetaValue(persistedValue, type.getValueType()); values.put(persistedValue.getName(), value); } } return new MapCompositeValueSupport(values, type); }
if("config-property".equals(property.getName())) MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING); List<ManagedConnectionFactoryPropertyMetaData> list = attachment.getManagedConnectionFactoryProperties(); if(list != null) mapValue.put(name, svalue); MetaValue stype = SimpleValueSupport.wrap(prop.getType()); mapValue.put(name+".type", stype);
data.put("currentView", viewValue); elements.add(new MapCompositeValueSupport(data, CHANNEL_TYPE));