本文整理汇总了Java中javax.management.openmbean.TabularData.values方法的典型用法代码示例。如果您正苦于以下问题:Java TabularData.values方法的具体用法?Java TabularData.values怎么用?Java TabularData.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.openmbean.TabularData
的用法示例。
在下文中一共展示了TabularData.values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeTabularData
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
public void writeTabularData(TabularData tabularData) {
if (tabularData == null) {
writeNull();
return;
}
int entryIndex = 0;
write('[');
for (Object item : tabularData.values()) {
if (entryIndex != 0) {
write(',');
}
CompositeData row = (CompositeData) item;
writeCompositeData(row);
entryIndex++;
}
write(']');
}
示例2: recursive
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
private void recursive(GenericObject object, String key, Object value) {
if (value instanceof CompositeData) {
CompositeData composite = (CompositeData) value;
object.put(key, toGenericObject(composite));
} else if (value instanceof TabularData) {
TabularData tabularData = (TabularData) value;
@SuppressWarnings("unchecked")
Collection<CompositeData> values = (Collection<CompositeData>) tabularData.values();
GenericArray array = new GenericArray();
for (CompositeData data : values) {
array.add(toGenericObject(data));
}
object.put(key, array);
} else if (value instanceof Number || value instanceof Boolean || value instanceof String){
object.put(key, value);
} else {
// todo log
}
}
示例3: processAttrValue
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/**
* Process/extract value from a given MBean attribute
*
* @param snapshot instance where extracted attribute is stored
* @param mbAttrInfo MBean attribute info
* @param propName name to be assigned to given attribute value
* @param value associated with attribute
* @return snapshot instance where all attributes are contained
*/
protected PropertySnapshot processAttrValue(PropertySnapshot snapshot, MBeanAttributeInfo mbAttrInfo,
PropertyNameBuilder propName, Object value) {
if (value instanceof CompositeData) {
CompositeData cdata = (CompositeData) value;
Set<String> keys = cdata.getCompositeType().keySet();
for (String key : keys) {
Object cVal = cdata.get(key);
processAttrValue(snapshot, mbAttrInfo, propName.append(key), cVal);
propName.popLevel();
}
} else if (value instanceof TabularData) {
TabularData tData = (TabularData) value;
Collection<?> values = tData.values();
int row = 0;
for (Object tVal : values) {
processAttrValue(snapshot, mbAttrInfo, propName.append(padNumber(++row)), tVal);
propName.popLevel();
}
} else {
snapshot.add(propName.propString(), value);
}
return snapshot;
}
示例4: writeTabularData
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
public Object writeTabularData(TabularData tabularData) {
if (tabularData == null) {
writeNull();
return this;
}
int entryIndex = 0;
write('[');
for (Object item : tabularData.values()) {
if (entryIndex != 0) {
write(',');
}
CompositeData row = (CompositeData) item;
writeCompositeData(row);
entryIndex++;
}
write(']');
return this;
}
示例5: testDirectExchangeMBean
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/**
* Test for direct exchange mbean
* @throws Exception
*/
public void testDirectExchangeMBean() throws Exception
{
DirectExchange exchange = new DirectExchange();
exchange.initialise(_virtualHost, ExchangeDefaults.DIRECT_EXCHANGE_NAME, false, 0, true);
ManagedObject managedObj = exchange.getManagedObject();
ManagedExchange mbean = (ManagedExchange)managedObj;
mbean.createNewBinding(_queue.getNameShortString().toString(), "binding1");
mbean.createNewBinding(_queue.getNameShortString().toString(), "binding2");
TabularData data = mbean.bindings();
ArrayList<Object> list = new ArrayList<Object>(data.values());
assertTrue(list.size() == 2);
// test general exchange properties
assertEquals(mbean.getName(), "amq.direct");
assertEquals(mbean.getExchangeType(), "direct");
assertTrue(mbean.getTicketNo() == 0);
assertTrue(!mbean.isDurable());
assertTrue(mbean.isAutoDelete());
}
示例6: testTopicExchangeMBean
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/**
* Test for "topic" exchange mbean
* @throws Exception
*/
public void testTopicExchangeMBean() throws Exception
{
TopicExchange exchange = new TopicExchange();
exchange.initialise(_virtualHost,ExchangeDefaults.TOPIC_EXCHANGE_NAME, false, 0, true);
ManagedObject managedObj = exchange.getManagedObject();
ManagedExchange mbean = (ManagedExchange)managedObj;
mbean.createNewBinding(_queue.getNameShortString().toString(), "binding1");
mbean.createNewBinding(_queue.getNameShortString().toString(), "binding2");
TabularData data = mbean.bindings();
ArrayList<Object> list = new ArrayList<Object>(data.values());
assertTrue(list.size() == 2);
// test general exchange properties
assertEquals(mbean.getName(), "amq.topic");
assertEquals(mbean.getExchangeType(), "topic");
assertTrue(mbean.getTicketNo() == 0);
assertTrue(!mbean.isDurable());
assertTrue(mbean.isAutoDelete());
}
示例7: testHeadersExchangeMBean
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/**
* Test for "Headers" exchange mbean
* @throws Exception
*/
public void testHeadersExchangeMBean() throws Exception
{
HeadersExchange exchange = new HeadersExchange();
exchange.initialise(_virtualHost,ExchangeDefaults.HEADERS_EXCHANGE_NAME, false, 0, true);
ManagedObject managedObj = exchange.getManagedObject();
ManagedExchange mbean = (ManagedExchange)managedObj;
mbean.createNewBinding(_queue.getNameShortString().toString(), "key1=binding1,key2=binding2");
mbean.createNewBinding(_queue.getNameShortString().toString(), "key3=binding3");
TabularData data = mbean.bindings();
ArrayList<Object> list = new ArrayList<Object>(data.values());
assertTrue(list.size() == 2);
// test general exchange properties
assertEquals(mbean.getName(), "amq.match");
assertEquals(mbean.getExchangeType(), "headers");
assertTrue(mbean.getTicketNo() == 0);
assertTrue(!mbean.isDurable());
assertTrue(mbean.isAutoDelete());
}
示例8: writeObject
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
private void writeObject(JsonGenerator jg, Object value) throws IOException {
if(value == null) {
jg.writeNull();
} else {
Class<?> c = value.getClass();
if (c.isArray()) {
jg.writeStartArray();
int len = Array.getLength(value);
for (int j = 0; j < len; j++) {
Object item = Array.get(value, j);
writeObject(jg, item);
}
jg.writeEndArray();
} else if(value instanceof Number) {
Number n = (Number)value;
jg.writeNumber(n.toString());
} else if(value instanceof Boolean) {
Boolean b = (Boolean)value;
jg.writeBoolean(b);
} else if(value instanceof CompositeData) {
CompositeData cds = (CompositeData)value;
CompositeType comp = cds.getCompositeType();
Set<String> keys = comp.keySet();
jg.writeStartObject();
for(String key: keys) {
writeAttribute(jg, key, cds.get(key));
}
jg.writeEndObject();
} else if(value instanceof TabularData) {
TabularData tds = (TabularData)value;
jg.writeStartArray();
for(Object entry : tds.values()) {
writeObject(jg, entry);
}
jg.writeEndArray();
} else {
jg.writeString(value.toString());
}
}
}
示例9: fromNonNullOpenValue
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
public final Object fromNonNullOpenValue(Object openValue) throws InvalidObjectException {
final TabularData table = (TabularData) openValue;
final Collection<CompositeData> rows = (Collection<CompositeData>) table.values();
final Map<Object, Object> valueMap =
sortedMap ? OpenTypeUtil.newSortedMap() : OpenTypeUtil.newMap();
for (CompositeData row : rows) {
final Object key = keyConverter.fromOpenValue(row.get("key"));
final Object value = valueConverter.fromOpenValue(row.get("value"));
if (valueMap.put(key, value) != null) {
final String msg = "Duplicate entry in TabularData: key=" + key;
throw new InvalidObjectException(msg);
}
}
return valueMap;
}
示例10: tabularToString
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
private static String tabularToString(TabularData tabularData) {
TabularType type = tabularData.getTabularType();
StringBuilder b = new StringBuilder();
b.append("(").append(type.getTypeName()).append(")\n");
Collection<CompositeData> values = (Collection) tabularData.values();
for (CompositeData cd: values) {
b.append(compositeToString(cd));
}
return b.toString();
}
示例11: writeObject
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
private void writeObject(JsonGenerator jg, Object value) throws IOException {
if (value == null) {
jg.writeNull();
} else {
Class<?> c = value.getClass();
if (c.isArray()) {
jg.writeStartArray();
int len = Array.getLength(value);
for (int j = 0; j < len; j++) {
Object item = Array.get(value, j);
writeObject(jg, item);
}
jg.writeEndArray();
} else if (value instanceof Number) {
Number n = (Number) value;
jg.writeNumber(n.toString());
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
jg.writeBoolean(b);
} else if (value instanceof CompositeData) {
CompositeData cds = (CompositeData) value;
CompositeType comp = cds.getCompositeType();
Set<String> keys = comp.keySet();
jg.writeStartObject();
for (String key : keys) {
writeAttribute(jg, key, cds.get(key));
}
jg.writeEndObject();
} else if (value instanceof TabularData) {
TabularData tds = (TabularData) value;
jg.writeStartArray();
for (Object entry : tds.values()) {
writeObject(jg, entry);
}
jg.writeEndArray();
} else {
jg.writeString(value.toString());
}
}
}
示例12: appendTabularMap
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
public static void appendTabularMap(Map map, CompositeData cdata, String fieldName) {
Object tabularObject = cdata.get(fieldName);
if (tabularObject instanceof TabularData) {
TabularData tabularData = (TabularData) tabularObject;
Collection<CompositeData> values = (Collection<CompositeData>) tabularData.values();
for (CompositeData compositeData : values) {
Object key = compositeData.get("key");
Object value = compositeData.get("value");
map.put(key, value);
}
}
}
示例13: propsFromTabular
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/**
* Converts JMX TabularData structure into a Map of strings. Every composite part is should contain name and value parameters
*
* @param props the source TabularData
* @return the resulting properties Map
*/
public static Map<String, String> propsFromTabular(TabularData props) {
Map<String, String> result = new HashMap<String, String>(props.size());
for (Object prop : props.values()) {
CompositeData data = (CompositeData) prop;
result.put((String) data.get("name"), (String) data.get("value"));
}
return result;
}
示例14: crawlIsEnded
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/** Check if the crawl has ended, either because Heritrix finished
* of its own, or because we terminated it.
*
* @return True if the crawl has ended, either because Heritrix finished
* or because we terminated it. Otherwise we return false.
* @see HeritrixController#crawlIsEnded()
*/
public synchronized boolean crawlIsEnded() {
// End of crawl can be seen in one of three ways:
// 1) The Heritrix process has exited.
// 2) The job has been moved to the completed jobs list in Heritrix.
// 3) The job is in one of the FINISHED states.
if (processHasExited()) {
return true;
}
TabularData jobs =
(TabularData) executeHeritrixCommand(
COMPLETED_JOBS_COMMAND);
if (jobs != null && jobs.size() > 0) {
for (CompositeData value
: (Collection<CompositeData>) jobs.values()) {
String thisJobID = value.get(JmxUtils.NAME)
+ "-" + value.get(UID_PROPERTY);
if (thisJobID.equals(jobName)) {
return true;
}
}
}
String status = (String) getCrawlJobAttribute(STATUS_ATTRIBUTE);
return status == null
|| status.equals(FINISHED_STATUS)
|| status.equals(ILLEGAL_STATUS);
}
示例15: renderMeTo
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Override
public void renderMeTo(TJContext tjContext, TabularData td, StringBuilder output) {
output.append("TabularData of ").append(td.getTabularType().getRowType().getTypeName()).append(" {\n");
int index = 0;
for (Object o : td.values()) {
output.append(SHIFT_SPACE).append("[").append(Integer.toString(index)).append("]: ");
Renderer renderer = getRendererByTypeName(o.getClass().getName());
CharSequence vOut = renderer.render(tjContext, o);
vOut = vOut.toString().trim().replace("\n", "\n" + SHIFT_SPACE);
output.append(vOut).append('\n');
}
output.append("}\n");
}