本文整理汇总了Java中javax.management.openmbean.SimpleType类的典型用法代码示例。如果您正苦于以下问题:Java SimpleType类的具体用法?Java SimpleType怎么用?Java SimpleType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleType类属于javax.management.openmbean包,在下文中一共展示了SimpleType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVersionedArrayType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private ArrayType<?> getVersionedArrayType(ArrayType<?> type, String version)
throws OpenDataException
{
if (type.isPrimitiveArray()) {
return type;
}
OpenType<?> ot = getVersionedType(
type.getElementOpenType(),
version
);
if (ot instanceof SimpleType) {
return new ArrayType<>((SimpleType<?>)ot, type.isPrimitiveArray());
} else {
return new ArrayType<>(type.getDimension(), ot);
}
}
示例2: getMBeanInfo
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
@Override
public MBeanInfo getMBeanInfo() {
ArrayList<OpenMBeanAttributeInfoSupport> attributes = new ArrayList<>();
attributes.add(new OpenMBeanAttributeInfoSupport("enabled", "enabled", SimpleType.BOOLEAN, true, true, true));
for (String type : registry.getTypes()) {
attributes.add(new OpenMBeanAttributeInfoSupport(type, type, getCompositeType(type), true, false, false));
}
OpenMBeanParameterInfo[] params = new OpenMBeanParameterInfoSupport[0];
OpenMBeanOperationInfoSupport reset = new OpenMBeanOperationInfoSupport("reset", "Reset all Metrics", params,
SimpleType.VOID, MBeanOperationInfo.ACTION);
OpenMBeanInfoSupport PSOMBInfo = new OpenMBeanInfoSupport(this.getClass().getName(), description,
attributes.toArray(new OpenMBeanAttributeInfoSupport[0]), new OpenMBeanConstructorInfoSupport[0],
new OpenMBeanOperationInfoSupport[] { reset }, new MBeanNotificationInfo[0]);
return PSOMBInfo;
}
示例3: getCompositeType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private OpenType<?> getCompositeType(final Type baseType, final TypeDefinition<?> baseTypeDefinition) {
final SimpleType<?> innerItemType = SimpleTypeResolver.getSimpleType(baseType);
final String innerItemName = this.typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition);
final String[] itemNames = new String[]{innerItemName};
final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
final OpenType<?>[] itemTypes = new OpenType[]{innerItemType};
try {
return new CompositeType(getUpperCaseCammelCase(), description, itemNames, itemNames, itemTypes);
} catch (final OpenDataException e) {
throw new RuntimeException("Unable to create " + CompositeType.class + " with inner element of type "
+ itemTypes, e);
}
}
示例4: getBaseGcNotifInfoCompositeType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
if (baseGcNotifInfoCompositeType == null) {
try {
OpenType<?>[] baseGcNotifInfoItemTypes = new OpenType<?>[] {
SimpleType.STRING,
SimpleType.STRING,
SimpleType.STRING,
GcInfoCompositeData.getBaseGcInfoCompositeType()
};
baseGcNotifInfoCompositeType =
new CompositeType("sun.management.BaseGarbageCollectionNotifInfoCompositeType",
"CompositeType for Base GarbageCollectionNotificationInfo",
gcNotifInfoItemNames,
gcNotifInfoItemNames,
baseGcNotifInfoItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw new RuntimeException(e);
}
}
return baseGcNotifInfoCompositeType;
}
示例5: getBaseGcNotifInfoCompositeType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
if (baseGcNotifInfoCompositeType == null) {
try {
OpenType<?>[] baseGcNotifInfoItemTypes = new OpenType<?>[] {
SimpleType.STRING,
SimpleType.STRING,
SimpleType.STRING,
GcInfoCompositeData.getBaseGcInfoCompositeType()
};
baseGcNotifInfoCompositeType =
new CompositeType("sun.management.BaseGarbageCollectionNotifInfoCompositeType",
"CompositeType for Base GarbageCollectionNotificationInfo",
gcNotifInfoItemNames,
gcNotifInfoItemNames,
baseGcNotifInfoItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
}
return baseGcNotifInfoCompositeType;
}
示例6: getPhiValues
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
@Override
public TabularData getPhiValues() throws OpenDataException {
final CompositeType ct = new CompositeType("Node", "Node", new String[] { "Endpoint", "PHI" },
new String[] { "IP of the endpoint", "PHI value" },
new OpenType[] { SimpleType.STRING, SimpleType.DOUBLE });
final TabularDataSupport results = new TabularDataSupport(
new TabularType("PhiList", "PhiList", ct, new String[] { "Endpoint" }));
final JsonArray arr = client.getJsonArray("/failure_detector/endpoint_phi_values");
for (JsonValue v : arr) {
JsonObject o = (JsonObject) v;
String endpoint = o.getString("endpoint");
double phi = Double.parseDouble(o.getString("phi"));
if (phi != Double.MIN_VALUE) {
// returned values are scaled by PHI_FACTOR so that the are on
// the same scale as PhiConvictThreshold
final CompositeData data = new CompositeDataSupport(ct, new String[] { "Endpoint", "PHI" },
new Object[] { endpoint, phi * PHI_FACTOR });
results.put(data);
}
}
return results;
}
示例7: TestClass
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
public TestClass(String str, URL url)
{
this.str = str;
this.url = url;
list.add("a");
list.add("b");
list.add("c");
map.put("1", "a");
map.put("2", "b");
map.put("3", "c");
try
{
CompositeType type = new CompositeType("My type",
"My type",
new String[]{"item1", "item2"},
new String[]{"item1", "item2"},
new OpenType[]{SimpleType.STRING, SimpleType.STRING});
compositeData = new CompositeDataSupport(type, new String[]{"item1", "item2"}, new Object[]{"item value 1", "item value 2"});
}
catch (OpenDataException e)
{
e.printStackTrace();
}
}
示例8: getJmxType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private OpenType<?> getJmxType(Class<?> type) {
if (type == Boolean.class) {
return SimpleType.BOOLEAN;
} else if (type == Integer.class || type == AtomicInteger.class) {
return SimpleType.INTEGER;
} else if (type == Long.class || type == AtomicLong.class) {
return SimpleType.LONG;
} else if (type == Double.class) {
return SimpleType.DOUBLE;
} else if (type == String.class) {
return SimpleType.STRING;
} else {
throw new UnsupportedOperationException(
"Don't know how to process Monitorable of type [" + type + "]");
}
}
示例9: getThrottleConfig
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
@Override
// MBean method
// @Description is set at the interface level
public final CompositeDataSupport getThrottleConfig() throws OpenDataException {
final CompositeType throttleConfigurationType = new CompositeType(
"Throttle Configuration",
"Throttle Configuration",
new String[]{"Throttle (in ms)", "Batch size"},
new String[]{"Throttle (in ms)", "Batch size"},
new OpenType[]{SimpleType.INTEGER, SimpleType.INTEGER}
);
final Map<String, Object> data = new HashMap<String, Object>();
data.put("Throttle (in ms)", this.throttle.get());
data.put("Batch size", this.batchSize.get());
return new CompositeDataSupport(throttleConfigurationType, data);
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:19,代码来源:SampleContentReplicationHarnessImpl.java
示例10: simpleTypeOf
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private static SimpleType<?> simpleTypeOf(Class<?> clazz) throws IllegalArgumentException {
if (clazz == boolean.class || clazz == Boolean.class) {
return SimpleType.BOOLEAN;
} else if (clazz == byte.class || clazz == Byte.class) {
return SimpleType.BYTE;
} else if (clazz == short.class || clazz == Short.class) {
return SimpleType.SHORT;
} else if (clazz == char.class || clazz == Character.class) {
return SimpleType.CHARACTER;
} else if (clazz == int.class || clazz == Integer.class) {
return SimpleType.INTEGER;
} else if (clazz == long.class || clazz == Long.class) {
return SimpleType.LONG;
} else if (clazz == float.class || clazz == Float.class) {
return SimpleType.FLOAT;
} else if (clazz == double.class || clazz == Double.class) {
return SimpleType.DOUBLE;
} else if (clazz == String.class) {
return SimpleType.STRING;
} else {
throw new IllegalArgumentException("There is no SimpleType for " + clazz.getName());
}
}
示例11: before
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
@Before
public void before() throws OpenDataException {
exceptionDetailsItemNames = new String[]{
"lastException",
"lastExceptionCausedObject",
"lastExceptionStackTrace",
"lastExceptionTimestamp",
"totalExceptions"
};
exceptionDetailsItemTypes = new OpenType<?>[]{
SimpleType.STRING,
SimpleType.STRING,
new ArrayType<>(1, SimpleType.STRING),
SimpleType.LONG,
SimpleType.INTEGER
};
}
示例12: testJsonObject
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
@Test
public void testJsonObject() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT);
TypeConverter converter = getConverter(description);
Assert.assertEquals(SimpleType.STRING, converter.getOpenType());
ModelNode node = new ModelNode();
node.get("long").set(5L);
node.get("string").set("Value");
node.get("a", "b").set(true);
node.get("c", "d").set(40);
String json = node.toJSONString(false);
String data = assertCast(String.class, converter.fromModelNode(node));
Assert.assertEquals(json, data);
Assert.assertEquals(ModelNode.fromJSONString(json), converter.toModelNode(data));
}
示例13: propertiesToCompositeData
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private CompositeDataSupport propertiesToCompositeData(final Map<String, ?> properties) {
// try {
try {
final String[] keys = properties.keySet().toArray(new String[0]);
final OpenType[] itemTypes = new OpenType[keys.length];
for (int i = 0; i < itemTypes.length; i++) {
itemTypes[i] = SimpleType.STRING;
}
CompositeType propsType;
propsType = new CompositeType("Properties type", "properties", keys, keys, itemTypes);
final CompositeDataSupport propsData = new CompositeDataSupport(propsType, properties);
return propsData;
} catch (final OpenDataException e) {
throw new AssertException("problem with jmx data generation", e);
}
}
示例14: getOpenType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private static OpenType getOpenType(Object value) throws OpenDataException {
if (value == null) {
return SimpleType.VOID;
}
//if (OpenType.ALLOWED_CLASSNAMES_LIST.contains(name)) {
int dim = 0;
Class<?> cls = value.getClass();
while (cls.isArray()) {
cls = value.getClass().getComponentType();
dim++;
}
SimpleType<?> type = getTypeForName(cls.getName());
if (type != null && dim > 0) {
if (cls.isPrimitive() && dim == 1) {
return new ArrayType<>(type, true);
}
return new ArrayType<>(dim, type);
}
return type;
}
示例15: getBaseGcNotifInfoCompositeType
import javax.management.openmbean.SimpleType; //导入依赖的package包/类
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
if (baseGcNotifInfoCompositeType == null) {
try {
OpenType[] baseGcNotifInfoItemTypes = new OpenType[] {
SimpleType.STRING,
SimpleType.STRING,
SimpleType.STRING,
GcInfoCompositeData.getBaseGcInfoCompositeType()
};
baseGcNotifInfoCompositeType =
new CompositeType("sun.management.BaseGarbageCollectionNotifInfoCompositeType",
"CompositeType for Base GarbageCollectionNotificationInfo",
gcNotifInfoItemNames,
gcNotifInfoItemNames,
baseGcNotifInfoItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
}
return baseGcNotifInfoCompositeType;
}
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:23,代码来源:GarbageCollectionNotifInfoCompositeData.java