コード例 #1
0
 @Override
 public int getChildCount(Object parent) {
   if (parent == root) {
     return repositories.size();
   } else if (parent instanceof RemoteRepository) {
     ProcessList list = getProcessList((RemoteRepository) parent);
     if ((list == null) || (list.size() == 0)) {
       return 1; // if empty, just display single message string
     } else {
       return list.size();
     }
   } else if (parent instanceof ProcessResponse) {
     ProcessResponse proResponse = (ProcessResponse) parent;
     if (proResponse.getException() != null) {
       return 1;
     } else {
       int size = 0;
       ProcessStackTrace trace = proResponse.getTrace();
       if ((trace != null) && (trace.getElements() != null)) {
         size += trace.getElements().size();
       }
       if (proResponse.getOutputLocations() != null) {
         size += proResponse.getOutputLocations().size();
       }
       return size;
     }
   } else {
     return 0;
   }
 }
コード例 #2
0
 private void dump(ProcessResponse pInfo, PrintStream out) {
   out.println("State of process " + pInfo.getProcessLocation() + " (id=" + pInfo.getId() + ")");
   out.println("  Started:   " + pInfo.getStartTime());
   if (pInfo.getCompletionTime() != null) {
     out.println("  Completed: " + pInfo.getCompletionTime());
   }
   out.println("  State:     " + pInfo.getState());
   if (pInfo.getException() != null) {
     out.println("  Exception: " + pInfo.getException());
   }
   final ProcessStackTrace trace = pInfo.getTrace();
   if (trace != null) {
     out.println("  Trace:");
     for (ProcessStackTraceElement ste : trace.getElements()) {
       System.out.println(
           "     "
               + ste.getOperatorName()
               + " ("
               + ste.getApplyCount()
               + ", "
               + Tools.formatDuration(ste.getExecutionTime())
               + ")");
     }
   }
 }
コード例 #3
0
 @Override
 public Object getChild(Object parent, int index) {
   if (parent == root) {
     return repositories.get(index);
   } else if (parent instanceof RemoteRepository) {
     ProcessList processList = getProcessList((RemoteRepository) parent);
     if (processList.size() == 0) {
       if (processList.getState() == ProcessListState.PENDING) {
         return PENDING_PROCESS_LIST;
       } else {
         return EMPTY_PROCESS_LIST;
       }
     } else {
       return processList.getByIndex(index);
     }
   } else if (parent instanceof ProcessResponse) {
     ProcessResponse proResponse = (ProcessResponse) parent;
     if (proResponse.getException() != null) {
       if (index == 0) {
         return new ExceptionWrapper(proResponse.getException());
       } else {
         return null;
       }
     } else {
       ProcessStackTrace trace = proResponse.getTrace();
       int elementsSize = 0;
       if ((trace != null) && (trace.getElements() != null)) {
         elementsSize = trace.getElements().size();
       }
       if (index < elementsSize && trace != null) {
         return trace.getElements().get(index);
       } else {
         return new OutputLocation(proResponse.getOutputLocations().get(index - elementsSize));
       }
     }
   } else {
     return null;
   }
 }
コード例 #4
0
 @Override
 public int getIndexOfChild(Object parent, Object child) {
   if (child == RemoteProcessesTreeModel.EMPTY_PROCESS_LIST
       || child == RemoteProcessesTreeModel.PENDING_PROCESS_LIST) {
     return 0;
   } else if (parent == root) {
     return repositories.indexOf(child);
   } else if (parent instanceof RemoteRepository) {
     if (child instanceof ProcessResponse) {
       return getProcessList((RemoteRepository) parent).indexOf((ProcessResponse) child);
     } else {
       return 0;
     }
   } else if (parent instanceof ProcessResponse) {
     ProcessResponse proResponse = (ProcessResponse) parent;
     if (child instanceof ProcessStackTraceElement) {
       ProcessStackTrace trace = proResponse.getTrace();
       if ((trace != null) && (trace.getElements() != null)) {
         return trace.getElements().indexOf(child);
       } else {
         return -1;
       }
     } else if (child instanceof OutputLocation) {
       if (proResponse.getOutputLocations() != null) {
         return proResponse.getOutputLocations().indexOf(((OutputLocation) child).getLocation());
       } else {
         return -1;
       }
     } else if (child instanceof ExceptionWrapper) {
       return 0;
     } else {
       return -1;
     }
   } else {
     return -1;
   }
 }