本文整理汇总了Java中javax.management.openmbean.SimpleType.BYTE属性的典型用法代码示例。如果您正苦于以下问题:Java SimpleType.BYTE属性的具体用法?Java SimpleType.BYTE怎么用?Java SimpleType.BYTE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.openmbean.SimpleType
的用法示例。
在下文中一共展示了SimpleType.BYTE属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleTypeOf
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());
}
}
示例2: init
/**
* initialises the openmbean data types
*/
private static void init() throws OpenDataException
{
_msgContentAttributeTypes[0] = SimpleType.LONG; // For message id
_msgContentAttributeTypes[1] = SimpleType.STRING; // For MimeType
_msgContentAttributeTypes[2] = SimpleType.STRING; // For Encoding
_msgContentAttributeTypes[3] = new ArrayType(1, SimpleType.BYTE); // For message content
_msgContentType = new CompositeType("Message Content", "AMQ Message Content",
VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
_msgContentAttributeTypes);
_msgAttributeTypes[0] = SimpleType.LONG; // For message id
_msgAttributeTypes[1] = new ArrayType(1, SimpleType.STRING); // For header attributes
_msgAttributeTypes[2] = SimpleType.LONG; // For size
_msgAttributeTypes[3] = SimpleType.BOOLEAN; // For redelivered
_msgAttributeTypes[4] = SimpleType.LONG; // For queue position
_messageDataType = new CompositeType("Message", "AMQ Message",
VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.size()]),
VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.size()]), _msgAttributeTypes);
_messagelistDataType = new TabularType("Messages", "List of messages", _messageDataType,
VIEW_MSGS_TABULAR_UNIQUE_INDEX.toArray(new String[VIEW_MSGS_TABULAR_UNIQUE_INDEX.size()]));
}
示例3: getTypeForName
private static SimpleType<?> getTypeForName(String name) {
switch (name) {
case "boolean":
case "java.lang.Boolean": return SimpleType.BOOLEAN;
case "byte":
case "java.lang.Byte": return SimpleType.BYTE;
case "char":
case "java.lang.Character": return SimpleType.CHARACTER;
case "double":
case "java.lang.Double": return SimpleType.DOUBLE;
case "float":
case "java.lang.Float": return SimpleType.FLOAT;
case "int":
case "java.lang.Integer": return SimpleType.INTEGER;
case "long":
case "java.lang.Long": return SimpleType.LONG;
case "short":
case "java.lang.Short": return SimpleType.SHORT;
case "java.math.BigDecimal": return SimpleType.BIGDECIMAL;
case "java.math.BigInteger": return SimpleType.BIGINTEGER;
case "java.util.Date": return SimpleType.DATE;
case "javax.management.ObjectName": return SimpleType.OBJECTNAME;
case "java.lang.String": return SimpleType.STRING;
//CompositeData.class.getName(),
//TabularData.class.getName()
//}
}
return null;
}
示例4: getGcInfoCompositeType
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType<?>[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType<?>[] allItemTypes = new OpenType<?>[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw new RuntimeException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
示例5: getGcInfoCompositeType
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType<?>[] allItemTypes = new OpenType<?>[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
示例6: init
@Override
protected void init() throws OpenDataException {
super.init();
body = new ArrayType(SimpleType.BYTE, true);
addItem(CompositeDataConstants.BODY, CompositeDataConstants.BODY_DESCRIPTION, body);
}
示例7: getGcInfoCompositeType
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType[] allItemTypes = new OpenType[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
示例8: getOpenType
private static OpenType getOpenType(Object value) {
if (value == null) {
return SimpleType.VOID;
}
String name = value.getClass().getName();
//if (OpenType.ALLOWED_CLASSNAMES_LIST.contains(name)) {
if ("java.lang.Long".equals(name)) {
return SimpleType.LONG;
}
if ("java.lang.Integer".equals(name)) {
return SimpleType.INTEGER;
}
if ("java.lang.String".equals(name)) {
return SimpleType.STRING;
}
if ("java.lang.Double".equals(name)) {
return SimpleType.DOUBLE;
}
if ("java.lang.Float".equals(name)) {
return SimpleType.FLOAT;
}
if ("java.math.BigDecimal".equals(name)) {
return SimpleType.BIGDECIMAL;
}
if ("java.math.BigInteger".equals(name)) {
return SimpleType.BIGINTEGER;
}
if ("java.lang.Boolean".equals(name)) {
return SimpleType.BOOLEAN;
}
if ("java.lang.Byte".equals(name)) {
return SimpleType.BYTE;
}
if ("java.lang.Character".equals(name)) {
return SimpleType.CHARACTER;
}
if ("java.util.Date".equals(name)) {
return SimpleType.DATE;
}
if ("java.lang.Short".equals(name)) {
return SimpleType.SHORT;
}
//"javax.management.ObjectName",
//CompositeData.class.getName(),
//TabularData.class.getName()
//}
return null; // is it allowed ??
}
示例9: testDeploymentViaJmx
@Test
public void testDeploymentViaJmx() throws Exception {
ObjectName testDeploymentModelName = new ObjectName("" + RESOLVED_DOMAIN + ":deployment=" + DEPLOYMENT);
assertNoMBean(testDeploymentModelName);
File jarFile = new File(DEPLOYMENT);
Files.deleteIfExists(jarFile.toPath());
ServiceActivatorDeploymentUtil.createServiceActivatorDeployment(jarFile, "jboss.test:service="+DEPLOYMENT, Dynamic.class);
try (InputStream in = Files.newInputStream(jarFile.toPath())) {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
int i = in.read();
while (i != -1) {
bout.write(i);
i = in.read();
}
byte[] bytes = bout.toByteArray();
//Upload the content
byte[] hash = (byte[]) connection.invoke(RESOLVED_ROOT_MODEL_NAME, "uploadDeploymentBytes", new Object[]{bytes}, new String[]{byte.class.getName()});
String[] names = {"hash"};
String[] descriptions = { "the content hash" };
OpenType<?>[] types = { new ArrayType<>(SimpleType.BYTE, true)};
CompositeType contentType = new CompositeType("contents", "the contents", names, descriptions, types);
Map<String, Object> values = Collections.singletonMap("hash", hash);
CompositeData contents = new CompositeDataSupport(contentType, values);
//Deploy it
connection.invoke(RESOLVED_ROOT_MODEL_NAME,
"addDeployment",
new Object[]{DEPLOYMENT, DEPLOYMENT, new CompositeData[]{contents}, Boolean.TRUE},
new String[]{String.class.getName(), String.class.getName(), CompositeData.class.getName(), Boolean.class.getName()});
//Make sure the test deployment mbean and the management model mbean for the deployment are there
Assert.assertTrue((Boolean) connection.getAttribute(testDeploymentModelName, "enabled"));
//Undeploy
connection.invoke(testDeploymentModelName, "undeploy", new Object[0], new String[0]);
//Check the app was undeployed
Assert.assertFalse((Boolean) connection.getAttribute(testDeploymentModelName, "enabled"));
//Remove
connection.invoke(testDeploymentModelName, "remove", new Object[0], new String[0]);
assertNoMBean(testDeploymentModelName);
} finally {
Files.deleteIfExists(jarFile.toPath());
}
}