Creates the process command from the fax job data.

@param   faxJob
The fax job object
@return  The process command to execute
199712
@Override
    protected String createResumeFaxJobProcessCommand(FaxJob faxJob)
    {
        //get arguments
        String commandArguments=this.createProcessCommandArgumentsForExistingFaxJob(Fax4jExeConstants.RESUME_ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT_VALUE.toString(),faxJob);
        
        //create command
        String command=this.createProcessCommand(commandArguments);
        
        return command;
    }
1298687
private String winGetFaxJobStatus(String serverName,int faxJobID)
    {
        String status=null;
        synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK)
        {
            //pre native call
            this.preNativeCall();
            
            //invoke native
            status=WindowsJNIFaxClientSpi.getFaxJobStatusNative(serverName,faxJobID);
        }
        
        return status;
    }
1174674
public void monitorFaxJob(FaxClientSpi faxClientSpi,FaxJob faxJob)
    {
        if(faxClientSpi==null)
        {
            throw new FaxException("Fax client SPI not provided.");
        }
        if(faxJob==null)
        {
            throw new FaxException("Fax job not provided.");
        }
        String id=faxJob.getID();
        if((id==null)||(id.length()==0))
        {
            throw new FaxException("Missing fax job ID in provided fax job.");
        }
        
        //monitor fax job
        this.monitorFaxJobImpl(faxClientSpi,faxJob);
        
    }
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);
    }
196465
@Override
    protected void cancelFaxJobImpl(FaxJob faxJob)
    {
        //create HTTP request
        HTTPRequest httpRequest=this.createCancelFaxJobHTTPRequest(faxJob);
        
        //submit HTTP request
        this.submitHTTPRequest(faxJob,httpRequest,FaxActionType.CANCEL_FAX_JOB);
    }
1358899
protected StringBuilder addToStringAttributes(String faxJobType)
    {
        //init buffer
        StringBuilder buffer=new StringBuilder(500);
        buffer.append(faxJobType);
        buffer.append(":");

        //append values
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("ID: ");
        buffer.append(this.getID());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("File: ");
        buffer.append(this.getFilePath());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("Priority: ");
        buffer.append(this.getPriority());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("Target Address: ");
        buffer.append(this.getTargetAddress());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("Target Name: ");
        buffer.append(this.getTargetName());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("Sender Name: ");
        buffer.append(this.getSenderName());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("Sender Fax Number: ");
        buffer.append(this.getSenderFaxNumber());
        buffer.append(Logger.SYSTEM_EOL);
        buffer.append("Sender Email: ");
        buffer.append(this.getSenderEmail());
        
        return buffer;
    }
893924
private static FaxJobMonitor createFaxJobMonitor(Map<String,String> systemConfig)
    {
        //get class name
        String className=systemConfig.get(FaxClientSpiFactory.FAX_JOB_MONITOR_CLASS_NAME_PROPERTY_KEY);
        if((className==null)||(className.length()==0))
        {
            className=FaxJobMonitorImpl.class.getName();
        }

        //create new instance
        FaxJobMonitor faxJobMonitorInstance=(FaxJobMonitor)ReflectionHelper.createInstance(className);

        return faxJobMonitorInstance;
    }
183940
@Override
    protected String createSubmitFaxJobProcessCommand(FaxJob faxJob)
    {
        //get arguments
        String commandArguments=this.createProcessCommandArgumentsForSubmitFaxJob(faxJob);
        
        //create command
        String command=this.createProcessCommand(commandArguments);
        
        return command;
    }
1108695
@Override
    protected void updateFaxJobFromInputDataImpl(HTTPRequest inputData,FaxJob faxJob)
    {
        //get content
        Map<String,ContentPart<?>> contentPartsMap=this.getContentPartsAsMap(inputData);

        //set priority
        String value=this.getContentPartAsString(contentPartsMap,this.priorityParameter);
        if((value!=null)&&(value.length()>0))
        {
            FaxJobPriority priority=FaxJobPriority.valueOf(value);
            faxJob.setPriority(priority);
        }

        //set target address
        value=this.getContentPartAsString(contentPartsMap,this.targetAddressParameter);
        if((value==null)||(value.length()==0))
        {
            throw new FaxException("Target address not provided.");
        }
        faxJob.setTargetAddress(value);

        //set target address
        value=this.getContentPartAsString(contentPartsMap,this.targetNameParameter);
        if((value!=null)&&(value.length()>0))
        {
            faxJob.setTargetName(value);
        }

        //set target address
        value=this.getContentPartAsString(contentPartsMap,this.senderNameParameter);
        if((value!=null)&&(value.length()>0))
        {
            faxJob.setSenderName(value);
        }

        //set target address
        value=this.getContentPartAsString(contentPartsMap,this.senderFaxNumberParameter);
        if((value!=null)&&(value.length()>0))
        {
            faxJob.setSenderFaxNumber(value);
        }

        //set target address
        value=this.getContentPartAsString(contentPartsMap,this.senderEMailParameter);
        if((value!=null)&&(value.length()>0))
        {
            faxJob.setSenderEmail(value);
        }
    }
661564
public String getSenderName()
    {
        String value=null;
        try
        {
            value=this.JOB.getFromUser();
        }
        catch(Exception exception)
        {
            throw new FaxException("Error while extracting job sender name.",exception);
        }

        return value;
    }
707773
public void submitFaxJob(FaxJob faxJob)
    {
        //validate fax job
        this.invokeFaxJobNullValidation(faxJob);

        //validate fax job target address
        String targetAddress=faxJob.getTargetAddress();
        if((targetAddress==null)||(targetAddress.length()==0))
        {
            throw new FaxException("Fax job target address not provided.");
        }

        //validate fax job file
        File file=faxJob.getFile();
        if(file==null)
        {
            throw new FaxException("Fax job file not provided.");
        }
        else if(!file.exists())
        {
            throw new FaxException("Fax job file "+file.getPath()+" does not exist.");
        }
        else if(!file.isFile())
        {
            throw new FaxException("Fax job file "+file.getPath()+" is not a file.");
        }
        else if(file.length()==0)
        {
            throw new FaxException("Fax job file "+file.getPath()+" is empty.");
        }

        //invoke action
        this.submitFaxJobImpl(faxJob);
        
        //fire event
        this.fireFaxEvent(FaxClientActionEventID.SUBMIT_FAX_JOB,faxJob);

        //start monitoring fax job if and only if monitoring is supported and there are existing listeners
        if(this.isFaxMonitorEventsSupported())
        {
            synchronized(this.faxMonitorEventListeners)
            {
                if(!this.faxMonitorEventListeners.isEmpty())
                {
                    //monitor the submitted fax job
                    this.spiFaxJobMonitor.monitorFaxJob(this,faxJob);
                }
            }
        }
    }
729204
@Nonnull
    public Process exec() throws IOException {
        List<String> commandWords = toCommandWords();
        ProcessBuilder builder = new ProcessBuilder(commandWords);
        // TODO: Use Redirect to send the I/O somewhere useful.
        QEmuCommandLineUtils.redirectIO(builder);
        return builder.start();
    }
1063808
protected ProcessOutputHandler createProcessOutputHandler()
    {
        //get process output handler
        String className=this.getConfigurationValue(FaxClientSpiConfigurationConstants.PROCESS_OUTPUT_HANDLER_PRE_FORMAT_PROPERTY_KEY);
        ProcessOutputHandler handler=null;
        if(className!=null)
        {
            //create new instance
            handler=(ProcessOutputHandler)ReflectionHelper.createInstance(className);
        }

        return handler;
    }
967919
@Override
    protected void cancelFaxJobImpl(FaxJob faxJob)
    {
        //create command
        String command=this.createCancelFaxJobProcessCommand(faxJob);
        
        //execute command
        this.executeProcess(faxJob,command,FaxActionType.CANCEL_FAX_JOB);
    }
186255
public static StepExecutionItem createJobRef(
            final String jobIdentifier,
            final String[] args,
            final boolean nodeStep,
            final StepExecutionItem handler,
            final boolean keepgoingOnSuccess,
            final String label
    )
    {
        return createJobRef(
                jobIdentifier,
                args,
                nodeStep,
                handler,
                keepgoingOnSuccess,
                null,
                null,
                null,
                null,
                null,
                label,
                false,
                null,
                false,
                false,
                null,
                false
        );
    }
884001
@Override
    protected void cancelFaxJobImpl(FaxJob faxJob)
    {
        String name=VBSFaxClientSpi.VBS_WIN_XP_CANCEL_SCRIPT;
        if(this.useWin2kAPI)
        {
            name=VBSFaxClientSpi.VBS_WIN_2K_CANCEL_SCRIPT;
        }

        //invoke script
        this.invokeExistingFaxJobAction(name,faxJob,FaxActionType.CANCEL_FAX_JOB);
    }
40561
protected HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,Enum<?> templateNameEnum,FaxJob faxJob)
    {
        //get template name string
        String templateName=templateNameEnum.toString();

        //get template
        String template=this.httpRequestTemplateMap.get(templateName);

        HTTPRequest httpRequest=null;
        if(template!=null)
        {
            //format template
            String content=this.formatTemplate(template,faxJob);

            //format resource
            String resource=this.formatHTTPResource(faxClientSpi,faxActionType,faxJob);
            
            //format URL parameters
            String parametersText=this.formatHTTPURLParameters(faxClientSpi,faxJob);
            
            //create HTTP request
            httpRequest=new HTTPRequest();
            
            //setup HTTP request
            httpRequest.setResource(resource);
            httpRequest.setContent(content);
            httpRequest.setParametersText(parametersText);
        }

        return httpRequest;
    }