use of org.activiti.management.jmx.annotations.ManagedOperation in project Activiti by Activiti.
the class MBeanInfoAssembler method doDoExtractAttributesAndOperations.
private void doDoExtractAttributesAndOperations(Class<?> managedClass, Map<String, ManagedAttributeInfo> attributes, Set<ManagedOperationInfo> operations) {
LOG.trace("Extracting attributes and operations from class: {}", managedClass);
for (Method method : managedClass.getMethods()) {
// must be from declaring class
if (method.getDeclaringClass() != managedClass) {
continue;
}
LOG.trace("Extracting attributes and operations from method: {}", method);
ManagedAttribute ma = method.getAnnotation(ManagedAttribute.class);
if (ma != null) {
String key;
String desc = ma.description();
Method getter = null;
Method setter = null;
if (ReflectUtil.isGetter(method)) {
key = ReflectUtil.getGetterShorthandName(method);
getter = method;
} else if (ReflectUtil.isSetter(method)) {
key = ReflectUtil.getSetterShorthandName(method);
setter = method;
} else {
throw new IllegalArgumentException("@ManagedAttribute can only be used on Java bean methods, was: " + method + " on bean: " + managedClass);
}
// they key must be capitalized
key = capitalize(key);
// lookup first
ManagedAttributeInfo info = attributes.get(key);
if (info == null) {
info = new ManagedAttributeInfo(key, desc);
}
if (getter != null) {
info.setGetter(getter);
}
if (setter != null) {
info.setSetter(setter);
}
attributes.put(key, info);
continue;
}
// operations
ManagedOperation mo = method.getAnnotation(ManagedOperation.class);
if (mo != null) {
String desc = mo.description();
Method operation = method;
operations.add(new ManagedOperationInfo(desc, operation));
}
}
}
use of org.activiti.management.jmx.annotations.ManagedOperation in project Activiti by Activiti.
the class ProcessDefinitionsMBean method getProcessDefinitionById.
@ManagedOperation(description = "get a specific process definition")
public List<String> getProcessDefinitionById(String id) {
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
List<String> item = new ArrayList<String>(3);
item.add(pd.getId());
item.add(pd.getName());
item.add(Integer.toString(pd.getVersion()));
item.add(Boolean.toString(pd.isSuspended()));
item.add(pd.getDescription());
return item;
}
use of org.activiti.management.jmx.annotations.ManagedOperation in project Activiti by Activiti.
the class ProcessDefinitionsMBean method deployProcessDefinition.
@ManagedOperation(description = "Deploy Process Definition")
public void deployProcessDefinition(String resourceName, String processDefinitionFile) throws FileNotFoundException {
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
Deployment deployment = deploymentBuilder.addInputStream(resourceName, new FileInputStream(processDefinitionFile)).deploy();
}
Aggregations