This function extracts the fax job status from the process output.

@param   processOutput
The process output
@return  The fax job status
489581
protected FaxJobStatus getFaxJobStatus(ProcessOutput processOutput)
    {
        FaxJobStatus faxJobStatus=null;
        if(this.processOutputHandler!=null)
        {
            //get fax job status
            faxJobStatus=this.processOutputHandler.getFaxJobStatus(this,processOutput);
        }
        
        //if unable to get the status, set to unknown
        if(faxJobStatus==null)
        {
            faxJobStatus=FaxJobStatus.UNKNOWN;
        }

        return faxJobStatus;
    }
1199801
private JsonNode parseProcessOutput(String processOutput) {
        JsonNode credentialsJson = Jackson.jsonNodeOf(processOutput);

        if (!credentialsJson.isObject()) {
            throw new IllegalStateException("Process did not return a JSON object.");
        }

        JsonNode version = credentialsJson.get("Version");
        if (version == null || !version.isInt() || version.asInt() != 1) {
            throw new IllegalStateException("Unsupported credential version: " + version);
        }
        return credentialsJson;
    }
1220982
@Override
    public synchronized Collection<IOutput> outputs()
    {
        if (null == outputs)
        {
            outputs = new ArrayList<IOutput>();
            final Iterator<Output> processInputs = service.getProcess().getOutputs().iterator();
            while (processInputs.hasNext())
            {
                outputs.add(new IOutput()
                {
                    private Output owlOutput = processInputs.next();

                    @Override
                    public String name()
                    {
                        return owlOutput.getName();
                    }

                    @Override
                    public ISemanticIdentifier getSemanticAnnotation()
                    {
                        //return new SemanticIdentifier(owlOutput.getType().getURI());
                        return new SemanticIdentifier(owlOutput.getParamType().getURI());
                    }
                });
            }
        }

        return outputs;
    }
978838
public FaxJob createFaxJob()
    {
        //create new fax job
        FaxJob faxJob=this.createFaxJobImpl();
        
        //fire event
        this.fireFaxEvent(FaxClientActionEventID.CREATE_FAX_JOB,faxJob);
        
        return faxJob;
    }
172302
@Override
    public void validateProcessOutput(FaxClientSpi faxClientSpi,ProcessOutput processOutput,FaxActionType faxActionType)
    {
        //call exit code validation
        super.validateProcessOutput(faxClientSpi,processOutput,faxActionType);

        //get output
        String output=processOutput.getOutputText();
        String errorPut=processOutput.getErrorText();

        boolean throwError=false;
        if((output!=null)&&(output.length()>0))
        {
            if(output.indexOf(VBSProcessOutputValidator.OPERATION_OUTPUT_DONE)==-1)
            {
                throwError=true;
            }
        }
        else
        {
            throwError=true;
        }
        
        if(throwError)
        {
            String message=this.getVBSFailedLineErrorMessage(errorPut);
            if((errorPut!=null)&&(errorPut.indexOf(VBSProcessOutputValidator.ACTIVE_X_NOT_INSTALLED)!=-1))
            {
                throw new FaxException("Error while invoking VBS script (fax server ActiveX not installed on system),"+message+" script output:\n"+output+"\nScript error:\n"+errorPut);
            }
            
            throw new FaxException("Error while invoking VBS script,"+message+" script output:\n"+output+"\nScript error:\n"+errorPut);
        }
    }
573917
@Override
    protected void cancelFaxJobImpl(FaxJob faxJob)
    {
        //get fax job ID
        int faxJobIDInt=WindowsFaxClientSpiHelper.getFaxJobID(faxJob);

        //invoke fax action
        this.winCancelFaxJob(this.faxServerName,faxJobIDInt);
    }
324081
@Override
    protected String createGetStatusFaxJobProcessCommand(FaxJob faxJob)
    {
        //get arguments
        String commandArguments=this.createProcessCommandArgumentsForExistingFaxJob(Fax4jExeConstants.GET_STATUS_ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT_VALUE.toString(),faxJob);
        
        //create command
        String command=this.createProcessCommand(commandArguments);
        
        return command;
    }
910158
Output getDefaultOutput()
    {
        if (default_output != null)
            return default_output;

        if (parent_queue != null)
            return parent_queue.getDefaultOutput();

        return null;
    }
224582
public static Path getOutputPath(JobContext job) {
    String name = job.getConfiguration().get("mapred.output.dir");
    return name == null ? null: new Path(name);
  }
984268
public Iterator<AbstractJobOutputVertex> getOutputVertices() {

		final Collection<AbstractJobOutputVertex> coll = this.outputVertices.values();

		return coll.iterator();
	}
551865
@Override
    protected void outputPass() {
        if(!prototype.isOutputSupported())
            return;

        // take a snapshot of the current container state.
        final LinkedList<Object> toOutput = new LinkedList<Object>(instances.keySet());

        Executor executorService = null;
        Semaphore taskLock = null;
        executorService = super.getOutputExecutorService();
        if(executorService != null)
            taskLock = new Semaphore(outputConcurrency);

        // This keeps track of the number of concurrently running
        // output tasks so that this method can wait until they're
        // all done to return.
        //
        // It's also used as a condition variable signaling on its
        // own state changes.
        final AtomicLong numExecutingOutputs = new AtomicLong(0);

        // keep going until all of the outputs have been invoked
        while(toOutput.size() > 0 && isRunning.get()) {
            for(final Iterator<Object> iter = toOutput.iterator(); iter.hasNext();) {
                final Object key = iter.next();

                final WorkingPlaceholder wp = new WorkingPlaceholder();
                // we're going to hold up all incomming message to this mp
                wp.mailbox.getAndSet(null); // this blocks other threads from
                                            // dropping messages in the mailbox

                final WorkingPlaceholder alreadyThere = working.putIfAbsent(key, wp); // try to get a lock
                if(alreadyThere == null) { // we got it the lock
                    final Object instance = instances.get(key);

                    if(instance != null) {
                        final Semaphore taskSepaphore = taskLock;

                        // This task will release the wrapper's lock.
                        final Runnable task = new Runnable() {

                            @Override
                            public void run() {
                                final List<KeyedMessageWithType> response;
                                try {
                                    if(isRunning.get())
                                        response = invokeOperation(instance, Operation.output, null);
                                    else
                                        response = null;
                                } finally {
                                    working.remove(key); // releases this back to the world

                                    // this signals that we're done.
                                    synchronized(numExecutingOutputs) {
                                        numExecutingOutputs.decrementAndGet();
                                        numExecutingOutputs.notifyAll();
                                    }
                                    if(taskSepaphore != null)
                                        taskSepaphore.release();
                                }

                                if(response != null) {
                                    try {
                                        dispatcher.dispatch(response);
                                    } catch(final Exception de) {
                                        if(isRunning.get())
                                            LOGGER.warn("Failed on subsequent dispatch of " + response + ": " + de.getLocalizedMessage());
                                    }
                                }
                            }
                        };

                        synchronized(numExecutingOutputs) {
                            numExecutingOutputs.incrementAndGet();
                        }

                        if(executorService != null) {
                            try {
                                taskSepaphore.acquire();
                                executorService.execute(task);
                            } catch(final RejectedExecutionException e) {
                                working.remove(key); // we never got into the run so we need to release the lock
                                // this may happen because of a race condition between the
                                taskSepaphore.release();
                            } catch(final InterruptedException e) {
                                // this can happen while blocked in the semaphore.acquire.
                                // if we're no longer running we should just get out
                                // of here.
                                //
                                // Not releasing the taskSepaphore assumes the acquire never executed.
                                // if (since) the acquire never executed we also need to release the
                                // wrapper lock or that Mp will never be usable again.
                                working.remove(key); // we never got into the run so we need to release the lock
                            }
                        } else
                            task.run();

                        iter.remove();

                    } else {
                        working.remove(key);
                        LOGGER.warn("There was an attempt to evict a non-existent Mp for key " + SafeString.objectDescription(key));
                    }
                } // didn't get the lock
            } // loop over every mp
        } // end while there are still Mps that haven't had output invoked.

        // =======================================================
        // now make sure all of the running tasks have completed
        synchronized(numExecutingOutputs) {
            while(numExecutingOutputs.get() > 0) {
                try {
                    numExecutingOutputs.wait();
                } catch(final InterruptedException e) {
                    // if we were interupted for a shutdown then just stop
                    // waiting for all of the threads to finish
                    if(!isRunning.get())
                        break;
                    // otherwise continue checking.
                }
            }
        }
        // =======================================================

    }
946056
public JobDetail getJobDetail(OutputInvoker outputInvoker) {
    JobBuilder jobBuilder = JobBuilder.newJob(OutputJob.class);
    JobDetail jobDetail = jobBuilder.build();
    jobDetail.getJobDataMap().put(OUTPUT_JOB_NAME, outputInvoker);
    return jobDetail;
  }
1077390
protected FaxJobStatus getFaxJobStatusFromWindowsFaxJobStatusString(String faxJobStatusStr)
    {
        FaxJobStatus faxJobStatus=FaxJobStatus.UNKNOWN;
        if((faxJobStatusStr!=null)&&(faxJobStatusStr.length()>0))
        {
            if((faxJobStatusStr.equalsIgnoreCase("Pending"))||(faxJobStatusStr.equalsIgnoreCase("Paused"))||(faxJobStatusStr.equalsIgnoreCase("Retrying")))
            {
                faxJobStatus=FaxJobStatus.PENDING;
            }
            else if(faxJobStatusStr.equalsIgnoreCase("In Progress"))
            {
                faxJobStatus=FaxJobStatus.IN_PROGRESS;
            }
            else if((faxJobStatusStr.equalsIgnoreCase("Failed"))||(faxJobStatusStr.equalsIgnoreCase("No Line"))||(faxJobStatusStr.equalsIgnoreCase("Retries Exceeded")))
            {
                faxJobStatus=FaxJobStatus.ERROR;
            }
        }
        
        return faxJobStatus;
    }
928429
@Override
	public FaxResult[] getFaxResult(String corpNum, String receiptNum)
			throws PopbillException {
		if (receiptNum == null)
			throw new PopbillException(-99999999, "접수번호가 입력되지 않았습니다.");
		if (receiptNum.length() != 18)
			throw new PopbillException(-99999999, "접수번호가 올바르지 않았습니다.");

		return httpget("/FAX/" + receiptNum, corpNum, null,
				FaxResult[].class);
	}
1157979
public static void validateFaxJobID(String faxJobID)
    {
        if((faxJobID==null)||(faxJobID.length()==0))
        {
            throw new FaxException("Fax job ID not provided.");
        }
        int faxJobIDInt=Integer.parseInt(faxJobID);
        WindowsFaxClientSpiHelper.validateFaxJobID(faxJobIDInt);
    }
426887
@Override
    protected void updateFaxJobFromInputDataImpl(HTTPRequest inputData,FaxJob faxJob)
    {
        //get parameters text as map
        Map<String,String> queryStringMap=this.convertParametersTextToMap(inputData);

        //update fax job
        this.updateFaxJobFromRequestImpl(inputData,faxJob,queryStringMap);
    }
130764
protected FaxJobStatus[] pollForFaxJobStatuesImpl(FaxJob[] faxJobs)
    {
        //get amount
        int amount=faxJobs.length;
        
        //init array
        FaxJobStatus[] faxJobStatuses=new FaxJobStatus[amount];

        FaxJob faxJob=null;
        FaxJobStatus faxJobStatus=null;
        for(int index=0;index<amount;index++)
        {
            //get next fax job
            faxJob=faxJobs[index];
            
            //set default
            faxJobStatus=FaxJobStatus.UNKNOWN;

            if(faxJob!=null)
            {
                try
                {
                    faxJobStatus=this.getFaxJobStatus(faxJob);
                }
                catch(RuntimeException exception)
                {
                    //ignore errors as this method should not throw any exception
                }
            }

            //set default
            if(faxJobStatus==null)
            {
                faxJobStatus=FaxJobStatus.UNKNOWN;
            }
            
            //put in output array
            faxJobStatuses[index]=faxJobStatus;
        }
        
        return faxJobStatuses;
    }