static void printTaskDescription(TaskDescription td) { ElementDescription[] methodInfos = td.getMethodInfo(); System.out.println("\n***Method descriptions:" + methodInfos.length); printElementDescriptions(methodInfos); System.out.println("\n***Reason descriptions:"); TypeDescription[] reasons = td.getReason(); for(int i=0; reasons!=null && i<reasons.length; i++) { System.out.println("\nKey:" + reasons[i].getKey()); System.out.println("Label:" + reasons[i].getLabel()); System.out.println("Summary:" + reasons[i].getSummary()); } System.out.println("\n***Task state enum descriptions:"); ElementDescription[] states = td.getState(); printElementDescriptions(states); }
public static void main(String[] args) throws Exception { if(args.length != 3) { System.out.println("Usage: java PrintTaskManager " + "<url> <username> <password>"); return; } ServiceInstance si = new ServiceInstance( new URL(args[0]), args[1], args[2], true); TaskManager taskMgr = si.getTaskManager(); int maxCollector = taskMgr.getMaxCollector(); System.out.println("Maximum number of collectors to " + "retrive historical tasks: " + maxCollector); System.out.println("\nTask description:"); TaskDescription td = taskMgr.getDescriptioin(); printTaskDescription(td); System.out.println("\nRecent tasks:"); Task[] recentTasks = taskMgr.getRecentTasks(); for(int i=0; recentTasks!=null && i<recentTasks.length; i++) { TaskInfo ti = recentTasks[i].getTaskInfo(); System.out.println("\nName:" + ti.getName()); System.out.println("Key:" + ti.getKey()); System.out.println("State:" + ti.getState()); } si.getServerConnection().logout(); }
TaskDescription getDescription();