Prints the status of the jobs running on the server.
@param index The 1-based index of the job to print the status of, or
zero to print the status of all jobs.
320187
@CommandArgument
  public void stat(int index) {
    if (this.jobProgressStates == null) {
      System.err.println("Server not running");
      return;
    }
    if (index == 0) {
      List<ProgressState> progress = new ArrayList<ProgressState>(this.jobProgressStates);
      if (progress != null) {
        System.out.println("   # Title                     Progress Status                          ");
        System.out.println("------------------------------------------------------------------------");
        for (int i = 0, n = progress.size(); i < n; i++) {
          ProgressState state = progress.get(i);
          char flag = ' ';
          if (state.isComplete()) {
            flag = '*';
          } else if (state.isCancelled()) {
            flag = 'X';
          } else if (state.isCancelPending()) {
            flag = 'C';
          }
          String title = state.getTitle();
          if (title.length() > 25) {
            title = title.substring(0, 24) + ">";
          }
          String status = state.getStatus();
          if (status.length() > 32) {
            status = status.substring(0, 31) + ">";
          }
          String progStr = (state.isIndeterminant() ? "????????" : String.format(" % 6.2f%%", 100.0 * state.getProgress()));
          System.out.printf("%c% 3d %-25s %s %-33s\n",
              flag, i + 1, title, progStr, status);
        }
      }
    } else if (index > 0 && index <= this.jobProgressStates.size()) {
      ProgressState state = this.jobProgressStates.get(index - 1);
      System.out.printf("Job #%d", index);
      if (state.isComplete()) {
        System.out.print(" [COMPLETE]");
      } else if (state.isCancelled()) {
        System.out.print(" [CANCELLED]");
      } else if (state.isCancelPending()) {
        System.out.print(" [CANCEL PENDING]");
      }
      System.out.println();
      System.out.printf("Title    : %s\n", state.getTitle());
      if (state.isIndeterminant()) {
        System.out.print("Progress : ???");
      } else {
        System.out.printf("Progress : %.2f%%", 100.0 * state.getProgress());
      }
      int maximum = state.getMaximum();
      int value = state.getValue();
      if (maximum > 0) {
        System.out.printf(" (%d/%d)", value, maximum);
      }
      System.out.println();
      System.out.printf("Status   : %s\n", state.getStatus());
    } else {
      System.err.println("Invalid job number");
    }
  }
490419
public void index( final ByteBuffer index, final int position) {
			index.putInt( tag).putInt( getType()).putInt( position).putInt( count);
		}
1192017
private void displayQueueList() throws IOException {
    JobQueueInfo[] queues = jc.getQueues();
    for (JobQueueInfo queue : queues) {
      String schedInfo = queue.getSchedulingInfo();
      if(schedInfo.trim().equals("")){
        schedInfo = "N/A";
      }
      System.out.printf("Queue Name : %s \n", queue.getQueueName());
      System.out.printf("Scheduling Info : %s \n",queue.getSchedulingInfo());
    }
  }
515845
public void printJob(PrinterJob job)
    {
        Frame frame = this.getFrame();
        dialog = new PrintDialog(frame, false);
        
        dialog.pack();
        if (frame != null)
            this.centerDialogInFrame(dialog, frame);

        
        Map<String,Object> map = new Hashtable<String,Object>();
        map.put("job", job);
        SyncPageWorker thread = new SyncPageWorker(dialog, map)
        {
            public void runPageLoader()
            {
                Thread swingPageLoader = new Thread("SwingPageLoader")
                {
                    public void run()
                    {
                        ((PrintDialog)m_syncPage).setVisible(true);
                    }
                };
                SwingUtilities.invokeLater(swingPageLoader);
            }
            public void afterPageDisplay()
            {
                Thread swingPageLoader = new Thread("SwingPageLoader")
                {
                    public void run()
                    {
                        try {
                            PrinterJob job = (PrinterJob)get("job");
                            job.print();
                        } catch (PrinterException ex) {
                            ex.printStackTrace ();
                        }
                        ((PrintDialog)m_syncPage).setVisible(false);
                    }
                };
                SwingUtilities.invokeLater(swingPageLoader);
            }
        };
        thread.start();
    }
1209666
public void write(final AbstractIndex index)
		throws SQLException
	{

		Statement statement;
		StringBuilder cmd;

		while (index.size() > 0) {

			System.out.println("Transmit Index [" + index + "]");

			cmd = index.remove();
			// System.out.println(cmd.toString());

			statement = connection.createStatement();
			statement.execute(cmd.toString());
			statement.close();
		}
	}
1153454
private void displayQueueInfo(String queue, boolean showJobs) throws IOException {
    JobQueueInfo schedInfo = jc.getQueueInfo(queue);
    if (schedInfo == null) {
      System.out.printf("Queue Name : %s has no scheduling information \n", queue);
    } else {
      System.out.printf("Queue Name : %s \n", schedInfo.getQueueName());
      System.out.printf("Scheduling Info : %s \n",schedInfo.getSchedulingInfo());
    }
    if (showJobs) {
      System.out.printf("Job List\n");
      JobStatus[] jobs = jc.getJobsFromQueue(queue);
      if (jobs == null)
        jobs = new JobStatus[0];
      jc.displayJobList(jobs);
    }
  }
1202276
private void printStatus() {
		System.out.println("---");
		printStatistics(this.itemStatistics, "items");
		System.out.println(" * Site links: " + this.countSiteLinks);

		printStatistics(this.propertyStatistics, "properties");
	}
43787
int findIndex(final Job job) {
        int size = jobList.size();
        boolean found = false;

        int i = 0;
        for (; i < size; i++) {
            ScheduledJobEntry se = (ScheduledJobEntry) jobList.get(i);
            if (se.job == job) {
                found = true;
                break;
            }
        }
        if (found) {
            return i;
        } else {
            return -1;
        }
    }
844199
public JobStatus readJobStatus(JobID jobId) {
    JobStatus jobStatus = null;
    
    if (null == jobId) {
      LOG.warn("Could not read job status for null jobId");
      return null;
    }
    
    if (active) {
      try {
        FSDataInputStream dataIn = getJobInfoFile(jobId);
        if (dataIn != null) {
          jobStatus = readJobStatus(dataIn);
          dataIn.close();
        }
      } catch (IOException ex) {
        LOG.warn("Could not read [" + jobId + "] job status : " + ex, ex);
      }
    }
    return jobStatus;
  }
502628
private void printResultInfo(Status resultStatus, PrintWriter reportWriter) {
    switch (resultStatus) {
      case FAIL_TO_FIND_CLASS:
        reportWriter.println(FAIL_TO_FIND_CLASS_MESSAGE);
        reportWriter.println(TEST_FAILED_MESSAGE);
        break;
      case FAIL_TO_FIND_FS:
        reportWriter.println(FAIL_TO_FIND_FS_MESSAGE);
        reportWriter.println(TEST_FAILED_MESSAGE);
        break;
      case FAIL_TO_SUPPORT_HA:
        reportWriter.println(FAIL_TO_SUPPORT_HA_MESSAGE);
        reportWriter.println(TEST_FAILED_MESSAGE);
        break;
      default:
        reportWriter.println(TEST_PASSED_MESSAGE);
        break;
    }
  }
967375
@Override
    public void run() {

        // flag for logging in the "final" block
        boolean docOk = false;
        try {

            // create the index document
            m_result = createIndexDocument(m_cms, m_res, m_index, m_count, m_report);
            docOk = true;

            // check if the thread was interrupted
            if (isInterrupted() && LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(Messages.LOG_ABANDONED_THREAD_FINISHED_1, m_res.getRootPath()));
            }

        } catch (CmsIndexNoContentException e) {
            // Ignore exception caused by empty documents, so that the report is not messed up with error message
            m_report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);
        } catch (Throwable exc) {
            if (m_report != null) {
                m_report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                    I_CmsReport.FORMAT_ERROR);
                m_report.println(
                    org.opencms.report.Messages.get().container(
                        org.opencms.report.Messages.RPT_ARGUMENT_1,
                        exc.toString()),
                    I_CmsReport.FORMAT_ERROR);
            }
            if (LOG.isErrorEnabled()) {
                LOG.error(
                    Messages.get().getBundle().key(
                        Messages.ERR_INDEX_RESOURCE_FAILED_2,
                        m_res.getRootPath(),
                        m_index.getName()),
                    exc);
            }
            // set flag to avoid logging in finally block
            docOk = true;
        } finally {
            if (!docOk) {
                // apparently there was a Throwable that causes an issue
                if (m_report != null) {
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                        I_CmsReport.FORMAT_ERROR);
                    m_report.println(
                        Messages.get().container(
                            Messages.ERR_INDEX_RESOURCE_FAILED_2,
                            m_res.getRootPath(),
                            m_index.getName()),
                        I_CmsReport.FORMAT_ERROR);
                }
                if (LOG.isErrorEnabled()) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.ERR_INDEX_RESOURCE_FAILED_2,
                            m_res.getRootPath(),
                            m_index.getName()));
                }
            }
        }
    }
1255348
public void write(final AbstractIndex index)
		throws IOException
	{

		StringBuilder cmd;

		while (index.size() > 0) {

			System.out.println("Transmit Index [" + index + "]");

			cmd = index.remove();

			if(index instanceof ArticleIndex){
				articleIdxWriter.write(cmd.toString());
			}else if(index instanceof ChronoIndex){
				chronoIdxWriter.write(cmd.toString());
			}else if(index instanceof RevisionIndex){
				revisionIdxWriter.write(cmd.toString());
			}

		}

		if(index instanceof ArticleIndex){
			articleIdxWriter.flush();
		}else if(index instanceof ChronoIndex){
			chronoIdxWriter.flush();
		}else if(index instanceof RevisionIndex){
			revisionIdxWriter.flush();
		}
	}
324737
private void printStatus() {
		System.out.println("*** Found " + genderItemCount
				+ " items with gender within " + itemCount + " items.");

		System.out
				.println("*** Showing top ten sites with most items with gender data: ");
		int siteCount = 0;
		List<SiteRecord> siteRecords = new ArrayList<>(
				this.siteRecords.values());
		Collections.sort(siteRecords, new SiteRecordComparator());
		for (SiteRecord siteRecord : siteRecords) {
			if (siteCount >= 10) {
				break;
			}
			siteCount++;

			System.out.print(String.format("%1$8s", siteRecord.siteKey) + ": ");

			int genderCount = 0;
			for (EntityIdValue gender : this.genderNamesList) {
				System.out.print(this.genderNames.get(gender) + " ");

				int count;
				float ratio;
				if (siteRecord.genderCounts.containsKey(gender)) {
					count = siteRecord.genderCounts.get(gender);
					ratio = (float) count / siteRecord.humanGenderPageCount
							* 100;
				} else {
					count = 0;
					ratio = 0;
				}

				if (genderCount < 2) {
					System.out.printf("%7d (%5.3f%%) ", count, ratio);
				} else {
					System.out.printf("%3d (%5.4f%%) ", count, ratio);
				}

				genderCount++;
			}

			System.out
					.println(" -- gender pages: "
							+ siteRecord.humanGenderPageCount
							+ ", human pages: "
							+ siteRecord.humanPageCount
							+ ", total pages: "
							+ siteRecord.pageCount
							+ ", ghp/hp: "
							+ ((float) siteRecord.humanGenderPageCount
									/ siteRecord.humanPageCount * 100)
							+ "%, hp/p: "
							+ ((float) siteRecord.humanPageCount
									/ siteRecord.pageCount * 100) + "%");
		}
	}
184508
@GET
  @Path(ServiceConstants.GET_STATUS)
  @JacksonFeatures(serializationEnable = {SerializationFeature.INDENT_OUTPUT})
  public Response getStatus(@QueryParam("jobId") final long jobId) {
    return RestUtils.call(new RestUtils.RestCallable<JobInfo>() {
      @Override
      public JobInfo call() throws Exception {
        return mJobMaster.getStatus(jobId);
      }
    }, ServerConfiguration.global());
  }
1352019
private void updateIndexActionStatus(
      IndexAction indexAction, IndexActionMetadata.IndexStatus status) {
    indexAction.setIndexStatus(status);
    dataService.update(INDEX_ACTION, indexAction);
  }
530313
public boolean isExistingIndex(String index) throws IOException {
        logger.debug("is existing index [{}]", index);
        try {
            Response restResponse = lowLevelClient.performRequest("GET", "/" + index);
            logger.trace("get index metadata response: {}", asMap(restResponse));
            return true;
        } catch (ResponseException e) {
            if (e.getResponse().getStatusLine().getStatusCode() == 404) {
                logger.debug("index [{}] does not exist", index);
                return false;
            }
            throw e;
        }
    }
1003698
public static boolean isIndexExist(RestClient client, String index) throws Exception {
		Response response = client.performRequest(new Request("HEAD", "/" + index));
		return response.getStatusLine().getStatusCode() == 200;
	}