Ejemplo n.º 1
0
  @Override
  public void notifyStack(IProcedure model, StackNotification data) {
    // We want to keep all models updated
    String instanceId = model.getProcId();
    // There may be stack notifications coming before having a model
    // actually created
    if (!m_procId.equals(instanceId)) {
      return;
    }

    CallstackNode currentNode = m_input.getCurrentNode();
    CallstackNode newNode = m_input.notifyStack(model, data);

    switch (data.getStackType()) {
      case CALL:
        m_viewer.add(currentNode, newNode);
        m_viewer.expandToLevel(newNode, TreeViewer.ALL_LEVELS);
        break;
      case RETURN:
        m_viewer.collapseToLevel(currentNode, TreeViewer.ALL_LEVELS);
        m_viewer.update(new Object[] {currentNode, newNode}, null);
        break;
      case LINE:
        m_viewer.refresh(newNode, true);
        break;
    }
  }
Ejemplo n.º 2
0
 @Override
 public void inputChanged(Viewer v, Object oldInput, Object newInput) {
   /*
    * Set the viewer
    */
   m_viewer = (TreeViewer) v;
   /*
    * Update the input
    */
   m_input = null;
   if (newInput != null) {
     IProcedure proc = (IProcedure) newInput;
     /*
      * Set procId
      */
     m_procId = proc.getProcId();
     /*
      * Set the input
      */
     m_input = new CallstackProcedureModel(m_procId, proc);
     /*
      * Subscribe to events
      */
     if (oldInput == null) {
       ProcedureBridge.get().addProcedureStackListener(this);
       ProcedureBridge.get().addProcedureStatusListener(this);
     }
   }
 }
Ejemplo n.º 3
0
 /**
  * ************************************************************************* Refresh all procedure
  * models ************************************************************************
  */
 public void refresh() {
   try {
     Logger.debug("Refresh executors table", Level.GUI, this);
     Object[] procs = ((IStructuredContentProvider) getContentProvider()).getElements(s_procMgr);
     for (Object procObj : procs) {
       if (procObj instanceof IProcedure) {
         IProcedure proc = (IProcedure) procObj;
         Logger.debug("Executor details" + proc.getProcId(), Level.GUI, this);
         Logger.debug(
             "    controlling client " + proc.getRuntimeInformation().getControllingClient(),
             Level.GUI,
             this);
         Logger.debug(
             "    monitoring clients " + proc.getRuntimeInformation().getMonitoringClients(),
             Level.GUI,
             this);
         proc.getController().updateInfo();
         refresh(proc);
       }
     }
     super.refresh();
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
Ejemplo n.º 4
0
  @Override
  public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    try {
      monitor.setTaskName("Retrieving LOG file for procedure " + m_proc.getProcName());

      IFileManager fileMgr = (IFileManager) ServiceManager.get(IFileManager.class);
      String path =
          fileMgr.getServerFilePath(m_proc.getProcId(), ServerFileType.EXECUTOR_LOG, monitor);
      Logger.debug("LOG file path: '" + path + "'", Level.PROC, this);

      logFile = (LogFile) fileMgr.getServerFile(path, ServerFileType.EXECUTOR_LOG, null, monitor);

      List<IServerFileLine> lines = logFile.getLines();

      monitor.beginTask("Exporting log data", lines.size());

      PrintWriter writer =
          new PrintWriter(new OutputStreamWriter(new FileOutputStream(m_destinationFileName)));
      for (IServerFileLine line : lines) {
        writer.println(line.toString());
        monitor.worked(1);
        if (monitor.isCanceled()) break;
      }
      writer.close();
      monitor.done();
      result = CommandResult.SUCCESS;
    } catch (Exception e) {
      Logger.error("Could retrieve LOG:" + e.getLocalizedMessage(), Level.PROC, this);
    }
    monitor.done();
  }
Ejemplo n.º 5
0
 /**
  * ************************************************************************* Constructor
  * ************************************************************************
  */
 public RemoteProcedure(IProcedure wasLocalProcedure) {
   m_procId = wasLocalProcedure.getProcId();
   m_properties = new HashMap<ProcProperties, String>();
   for (ProcProperties prop : ProcProperties.values()) {
     m_properties.put(prop, wasLocalProcedure.getProperty(prop));
   }
   m_controller = new RemoteController();
   ClientMode cmode = wasLocalProcedure.getRuntimeInformation().getClientMode();
   m_executionInformation = new ExecutionInformationHandler(cmode, this);
   IExecutorInfo info = (IExecutorInfo) wasLocalProcedure.getAdapter(ExecutorInfo.class);
   m_properties.put(ProcProperties.PROC_NAME, info.getName());
   m_executionInformation.copyFrom(info);
 }
Ejemplo n.º 6
0
  @Override
  public void notifyStatus(IProcedure model, StatusNotification data) {
    // We want to keep all models updated
    String instanceId = model.getProcId();
    // There may be stack notifications coming before having a model
    // actually created
    if (!m_procId.equals(instanceId)) {
      return;
    }

    switch (data.getStatus()) {
      case RELOADING:
        m_input.clear();
        m_viewer.refresh(true);
        break;
      default:
        break;
    }
  }
Ejemplo n.º 7
0
 /**
  * ************************************************************************* Refresh the selected
  * procedure. In case of failure, refresh the whole list, since the procedure may habe disappeared
  * ************************************************************************
  */
 public void refresh(String procId) {
   try {
     IProcedure proc = s_procMgr.getProcedure(procId);
     Logger.debug("Refreshing procedure with id " + procId, Level.GUI, this);
     Logger.debug("Executor details " + proc.getProcId(), Level.GUI, this);
     Logger.debug("    instance " + proc, Level.GUI, this);
     Logger.debug(
         "    controlling client " + proc.getRuntimeInformation().getControllingClient(),
         Level.GUI,
         this);
     Logger.debug(
         "    monitoring clients " + proc.getRuntimeInformation().getMonitoringClients(),
         Level.GUI,
         this);
     refresh(proc);
   } catch (Exception ex) {
     refresh();
   }
 }