Java 类com.vmware.vim25.mo.TaskHistoryCollector 实例源码

项目:vijava    文件:TaskHistoryMonitor.java   
public static void main(String[] args) throws Exception
{
  if(args.length != 3)
  {
    System.out.println("Usage: java TaskHistoryMonitor " 
      + "<url> <username> <password>");
    return;
  }

  ServiceInstance si = new ServiceInstance(
    new URL(args[0]), args[1], args[2], true);

  TaskManager taskMgr = si.getTaskManager();

  if(taskMgr!=null)
  {
    Folder root = si.getRootFolder();
    TaskFilterSpec tfs = createTaskFilterSpec(root); 
    TaskHistoryCollector thc = 
        taskMgr.createCollectorForTasks(tfs);

    // Note: 10 <= pagesize <= 62
    thc.setCollectorPageSize(15);

    System.out.println("Tasks in latestPage:");
    TaskInfo[] tis = thc.getLatestPage();
    printTaskInfos(tis);

    System.out.println("\nAll tasks:");
    int total = 0; 

    while(true)
    {
      tis= thc.readNextTasks(50);
      if(tis==null)
      {
        break;
      }
      total += tis.length;
      printTaskInfos(tis);
    }
    System.out.println("\nTotal number " +
            "of tasks retrieved:" + total);
    thc.destroyCollector();
  }
  si.getServerConnection().logout();
}
项目:jcloud-vsphere    文件:TaskManagerApi.java   
TaskHistoryCollector createCollectorForTasks(TaskFilterSpec filter) throws InvalidState, RuntimeFault, RemoteException;