本文整理汇总了Java中javax.management.openmbean.TabularData类的典型用法代码示例。如果您正苦于以下问题:Java TabularData类的具体用法?Java TabularData怎么用?Java TabularData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabularData类属于javax.management.openmbean包,在下文中一共展示了TabularData类的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: getAllTriggers
import javax.management.openmbean.TabularData; //导入依赖的package包/类
public TabularData getAllTriggers(String instanceId)
throws SchedulerException {
SchedulingContext cntx = new SchedulingContext(instanceId);
List<Trigger> triggerList = new ArrayList<Trigger>();
for (String triggerGroupName : scheduler.getTriggerGroupNames(cntx)) {
for (String triggerName : scheduler.getTriggerNames(cntx,
triggerGroupName)) {
triggerList.add(scheduler.getTrigger(cntx, triggerName,
triggerGroupName));
}
}
return TriggerSupport.toTabularData(triggerList
.toArray(new Trigger[triggerList.size()]));
}
示例3: newJobDetail
import javax.management.openmbean.TabularData; //导入依赖的package包/类
/**
* @param cData
* @return JobDetail
*/
public static JobDetail newJobDetail(CompositeData cData) {
JobDetail jobDetail = new JobDetail();
int i = 0;
jobDetail.setName((String) cData.get(ITEM_NAMES[i++]));
jobDetail.setGroup((String) cData.get(ITEM_NAMES[i++]));
jobDetail.setDescription((String) cData.get(ITEM_NAMES[i++]));
try {
Class c = Class.forName((String) cData.get(ITEM_NAMES[i++]));
jobDetail.setJobClass(c);
} catch (ClassNotFoundException cnfe) {
/**/
}
jobDetail.setJobDataMap(JobDataMapSupport
.newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
jobDetail.setVolatility((Boolean) cData.get(ITEM_NAMES[i++]));
jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));
return jobDetail;
}
示例4: toString
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Override
public String toString() {
if (userData == null) {
return null;
}
if (userData.getClass().isArray()) {
String name =
Utils.getArrayClassName(userData.getClass().getName());
int length = Array.getLength(userData);
return name + "[" + length + "]";
}
if (userData instanceof CompositeData ||
userData instanceof TabularData) {
return userData.getClass().getName();
}
return userData.toString();
}
示例5: toString
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Override
public String toString() {
if(value == null) return null;
if(value.getClass().isArray()) {
String name =
Utils.getArrayClassName(value.getClass().getName());
int length = Array.getLength(value);
return name + "[" + length +"]";
}
if(value instanceof CompositeData ||
value instanceof TabularData)
return value.getClass().getName();
return value.toString();
}
示例6: fromNonNullOpenValue
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Override
final Object fromNonNullOpenValue(Object openValue)
throws InvalidObjectException {
final TabularData table = (TabularData) openValue;
final Collection<CompositeData> rows = cast(table.values());
final Map<Object, Object> valueMap =
sortedMap ? newSortedMap() : newInsertionOrderMap();
for (CompositeData row : rows) {
final Object key =
keyMapping.fromOpenValue(row.get("key"));
final Object value =
valueMapping.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;
}
示例7: 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
}
}
示例8: convertToString
import javax.management.openmbean.TabularData; //导入依赖的package包/类
public static String convertToString(Object value) {
if (value == null) {
return null;
}
if (value.getClass().isArray()) {
StringBuilder b = new StringBuilder("[");
int length = Array.getLength(value);
for (int i = 0; i < length; i++) {
Object o = Array.get(value, i);
b.append(convertToString(o));
if (i < length - 1) {
b.append(", ");
}
}
return b.append("]").toString();
}
else if (value instanceof CompositeData) {
return compositeToString((CompositeData) value);
}
else if (value instanceof TabularData) {
return tabularToString((TabularData) value);
}
return value.toString();
}
示例9: browse
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Override
public TabularData browse(String routeId, int limit, boolean sortByLongestDuration) {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listInflightExchangesTabularType());
Collection<InflightRepository.InflightExchange> exchanges = inflightRepository.browse(routeId, limit, sortByLongestDuration);
for (InflightRepository.InflightExchange entry : exchanges) {
CompositeType ct = CamelOpenMBeanTypes.listInflightExchangesCompositeType();
String exchangeId = entry.getExchange().getExchangeId();
String fromRouteId = entry.getFromRouteId();
String atRouteId = entry.getAtRouteId();
String nodeId = entry.getNodeId();
String elapsed = "" + entry.getElapsed();
String duration = "" + entry.getDuration();
CompositeData data = new CompositeDataSupport(ct,
new String[]{"exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration"},
new Object[]{exchangeId, fromRouteId, atRouteId, nodeId, elapsed, duration});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例10: extendedInformation
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Override
public TabularData extendedInformation() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.endpointsUtilizationTabularType());
// we only have 1 endpoint
CompositeType ct = CamelOpenMBeanTypes.endpointsUtilizationCompositeType();
String url = getDestination();
Long hits = processor.getCounter();
CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "hits"}, new Object[]{url, hits});
answer.put(data);
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例11: listEndpoints
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public TabularData listEndpoints() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEndpointsTabularType());
Collection<Endpoint> endpoints = endpointRegistry.values();
for (Endpoint endpoint : endpoints) {
CompositeType ct = CamelOpenMBeanTypes.listEndpointsCompositeType();
String url = endpoint.getEndpointUri();
if (sanitize) {
url = URISupport.sanitizeUri(url);
}
boolean fromStatic = endpointRegistry.isStatic(url);
boolean fromDynamic = endpointRegistry.isDynamic(url);
CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "static", "dynamic"}, new Object[]{url, fromStatic, fromDynamic});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例12: browse
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Override
public TabularData browse() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listAwaitThreadsTabularType());
Collection<AsyncProcessorAwaitManager.AwaitThread> threads = manager.browse();
for (AsyncProcessorAwaitManager.AwaitThread entry : threads) {
CompositeType ct = CamelOpenMBeanTypes.listAwaitThreadsCompositeType();
String id = "" + entry.getBlockedThread().getId();
String name = entry.getBlockedThread().getName();
String exchangeId = entry.getExchange().getExchangeId();
String routeId = entry.getRouteId();
String nodeId = entry.getNodeId();
String duration = "" + entry.getWaitDuration();
CompositeData data = new CompositeDataSupport(ct,
new String[]{"id", "name", "exchangeId", "routeId", "nodeId", "duration"},
new Object[]{id, name, exchangeId, routeId, nodeId, duration});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例13: listTypeConverters
import javax.management.openmbean.TabularData; //导入依赖的package包/类
public TabularData listTypeConverters() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listTypeConvertersTabularType());
List<Class<?>[]> converters = registry.listAllTypeConvertersFromTo();
for (Class<?>[] entry : converters) {
CompositeType ct = CamelOpenMBeanTypes.listTypeConvertersCompositeType();
String from = entry[0].getCanonicalName();
String to = entry[1].getCanonicalName();
CompositeData data = new CompositeDataSupport(ct, new String[]{"from", "to"}, new Object[]{from, to});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例14: listEips
import javax.management.openmbean.TabularData; //导入依赖的package包/类
public TabularData listEips() throws Exception {
try {
// find all EIPs
Map<String, Properties> eips = context.findEips();
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEipsTabularType());
// gather EIP detail for each eip
for (Map.Entry<String, Properties> entry : eips.entrySet()) {
String name = entry.getKey();
String title = (String) entry.getValue().get("title");
String description = (String) entry.getValue().get("description");
String label = (String) entry.getValue().get("label");
String type = (String) entry.getValue().get("class");
String status = CamelContextHelper.isEipInUse(context, name) ? "in use" : "on classpath";
CompositeType ct = CamelOpenMBeanTypes.listEipsCompositeType();
CompositeData data = new CompositeDataSupport(ct, new String[]{"name", "title", "description", "label", "status", "type"},
new Object[]{name, title, description, label, status, type});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例15: testListEips
import javax.management.openmbean.TabularData; //导入依赖的package包/类
@Test
public void testListEips() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\"");
assertTrue("Should be registered", mbeanServer.isRegistered(on));
@SuppressWarnings("unchecked")
TabularData data = (TabularData) mbeanServer.invoke(on, "listEips", null, null);
assertNotNull(data);
assertTrue(data.size() > 150);
}