use of javax.management.MBeanOperationInfo in project Entitas-Java by Rubentxu.
the class VisualDebbuger method start.
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("VisualDebbuger.fxml"));
Parent root = loader.load();
primaryStage.setTitle("CodeGenerator");
primaryStage.setScene(new Scene(root, 560, 575));
primaryStage.setResizable(false);
primaryStage.show();
stage = primaryStage;
client = new JmxClient("localhost", 1313);
Set<ObjectName> names = client.getBeanNames();
beanNames.setText(names.stream().map(n -> n.getKeyPropertyListString()).reduce(String::concat).get());
// MBeanAttributeInfo[] attributeInfos =
// client.getAttributesInfo(objectName);
// MBeanOperationInfo[] operationInfos =
// client.getOperationsInfo(objectName);
}
use of javax.management.MBeanOperationInfo in project tdi-studio-se by Talend.
the class InvokeAction method selectionChanged.
/*
* @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
info = null;
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof MBeanOperationInfo) {
info = (MBeanOperationInfo) element;
}
}
setEnabled(info != null);
}
use of javax.management.MBeanOperationInfo in project tdi-studio-se by Talend.
the class OperationsTab method getValidOperations.
/**
* Gets the valid MBean operations.
*
* @param operations
* @return The valid MBean operations
*/
static MBeanOperationInfo[] getValidOperations(MBeanOperationInfo[] operations) {
List<MBeanOperationInfo> validOperations = new ArrayList<MBeanOperationInfo>();
for (MBeanOperationInfo operation : operations) {
boolean invalid = false;
MBeanParameterInfo[] signature = operation.getSignature();
for (int i = 0; i < signature.length; i++) {
String name = signature[i].getName();
String type = signature[i].getType();
String description = signature[i].getDescription();
if (name == null || type == null || description == null) {
invalid = true;
signature[i] = new MBeanParameterInfo(getNonNull(name), getNonNull(type), getNonNull(description), signature[i].getDescriptor());
}
}
if (invalid) {
operation = new MBeanOperationInfo(operation.getName(), operation.getDescription(), signature, operation.getReturnType(), operation.getImpact(), operation.getDescriptor());
}
validOperations.add(operation);
}
return validOperations.toArray(new MBeanOperationInfo[validOperations.size()]);
}
use of javax.management.MBeanOperationInfo in project Activiti by Activiti.
the class JobExecutorMBeanTest method testAnnotations.
@Test
public void testAnnotations() throws MalformedObjectNameException, JMException {
ModelMBean modelBean = assembler.assemble(jobExecutorMbean, new ObjectName("domain", "key", "value"));
assertNotNull(modelBean);
MBeanInfo beanInfo = modelBean.getMBeanInfo();
assertNotNull(beanInfo);
assertNotNull(beanInfo.getOperations());
assertEquals(2, beanInfo.getOperations().length);
int counter = 0;
for (MBeanOperationInfo op : beanInfo.getOperations()) {
if (op.getName().equals("setJobExecutorActivate")) {
counter++;
assertEquals("set job executor activate", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(1, op.getSignature().length);
assertEquals("java.lang.Boolean", op.getSignature()[0].getType());
}
}
assertEquals(1, counter);
// check attributes
assertNotNull(beanInfo.getAttributes());
assertEquals(1, beanInfo.getAttributes().length);
counter = 0;
for (MBeanAttributeInfo attr : beanInfo.getAttributes()) {
if (attr.getName().equals("JobExecutorActivated")) {
counter++;
assertEquals("check if the job executor is activated", attr.getDescription());
assertEquals("boolean", attr.getType());
}
}
assertEquals(1, counter);
}
use of javax.management.MBeanOperationInfo in project Activiti by Activiti.
the class ProcessDefinitionsTest method testAnnotations.
@Test
public void testAnnotations() throws MalformedObjectNameException, JMException {
ModelMBean modelBean = assembler.assemble(processDefinitionsMBean, new ObjectName("domain", "key", "value"));
assertNotNull(modelBean);
MBeanInfo beanInfo = modelBean.getMBeanInfo();
assertNotNull(beanInfo);
assertNotNull(beanInfo.getOperations());
assertEquals(9, beanInfo.getOperations().length);
int counter = 0;
for (MBeanOperationInfo op : beanInfo.getOperations()) {
if (op.getName().equals("deleteDeployment")) {
counter++;
assertEquals("delete deployment", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(1, op.getSignature().length);
assertEquals("java.lang.String", op.getSignature()[0].getType());
} else if (op.getName().equals("suspendProcessDefinitionById")) {
counter++;
assertEquals("Suspend given process ID", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(1, op.getSignature().length);
assertEquals("java.lang.String", op.getSignature()[0].getType());
} else if (op.getName().equals("activatedProcessDefinitionById")) {
counter++;
assertEquals("Activate given process ID", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(1, op.getSignature().length);
assertEquals("java.lang.String", op.getSignature()[0].getType());
} else if (op.getName().equals("suspendProcessDefinitionByKey")) {
counter++;
assertEquals("Suspend given process ID", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(1, op.getSignature().length);
assertEquals("java.lang.String", op.getSignature()[0].getType());
} else if (op.getName().equals("activatedProcessDefinitionByKey")) {
counter++;
assertEquals("Activate given process ID", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(1, op.getSignature().length);
assertEquals("java.lang.String", op.getSignature()[0].getType());
} else if (op.getName().equals("deployProcessDefinition")) {
counter++;
assertEquals("Deploy Process Definition", op.getDescription());
assertEquals("void", op.getReturnType());
assertEquals(2, op.getSignature().length);
assertEquals("java.lang.String", op.getSignature()[0].getType());
assertEquals("java.lang.String", op.getSignature()[1].getType());
}
}
assertEquals(6, counter);
// check attributes
assertNotNull(beanInfo.getAttributes());
assertEquals(2, beanInfo.getAttributes().length);
counter = 0;
for (MBeanAttributeInfo attr : beanInfo.getAttributes()) {
if (attr.getName().equals("ProcessDefinitions")) {
counter++;
assertEquals("List of Process definitions", attr.getDescription());
assertEquals("java.util.List", attr.getType());
} else if (attr.getName().equals("Deployments")) {
counter++;
assertEquals("List of deployed Processes", attr.getDescription());
assertEquals("java.util.List", attr.getType());
}
}
assertEquals(2, counter);
}
Aggregations