This function will submit a new fax job.<br>
The fax job ID may be populated by this method in the provided
fax job object.

@param   faxJob
The fax job object containing the needed information
500645
@Override
    protected void submitFaxJobImpl(FaxJob faxJob)
    {
        //create HTTP request
        HTTPRequest httpRequest=this.createSubmitFaxJobHTTPRequest(faxJob);
        
        //submit HTTP request
        this.submitHTTPRequest(faxJob,httpRequest,FaxActionType.SUBMIT_FAX_JOB);
    }
23521
@Override
    protected void suspendFaxJobImpl(FaxJob faxJob)
    {
        //create command
        String command=this.createSuspendFaxJobProcessCommand(faxJob);
        
        //execute command
        this.executeProcess(faxJob,command,FaxActionType.SUSPEND_FAX_JOB);
    }
868630
protected void suspendFaxJob(HylaFaxJob faxJob,HylaFAXClient client) throws Exception
    {
        //get job
        Job job=faxJob.getHylaFaxJob();
        
        //suspend job
        client.suspend(job);
    }
991857
protected String createProcessCommandArgumentsForSubmitFaxJob(FaxJob faxJob)
    {
        //get values from fax job
        String targetAddress=faxJob.getTargetAddress();
        String targetName=faxJob.getTargetName();
        String senderName=faxJob.getSenderName();
        File file=faxJob.getFile();
        String fileName=null;
        try
        {
            fileName=file.getCanonicalPath();
        }
        catch(Exception exception)
        {
            throw new FaxException("Unable to extract canonical path from file: "+file,exception);
        }
        String documentName=faxJob.getProperty(WindowsFaxClientSpi.FaxJobExtendedPropertyConstants.DOCUMENT_NAME_PROPERTY_KEY.toString(), null);
        
        //init buffer
        StringBuilder buffer=new StringBuilder();
        
        //create command line arguments
        this.addCommandLineArgument(buffer,Fax4jExeConstants.ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),Fax4jExeConstants.SUBMIT_ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT_VALUE.toString());
        this.addCommandLineArgument(buffer,Fax4jExeConstants.SERVER_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),this.faxServerName);
        this.addCommandLineArgument(buffer,Fax4jExeConstants.TARGET_ADDRESS_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),targetAddress);
        this.addCommandLineArgument(buffer,Fax4jExeConstants.TARGET_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),targetName);
        this.addCommandLineArgument(buffer,Fax4jExeConstants.SENDER_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),senderName);
        this.addCommandLineArgument(buffer,Fax4jExeConstants.FILE_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),fileName);
        this.addCommandLineArgument(buffer,Fax4jExeConstants.DOCUMENT_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),documentName);
        
        //get text
        String commandArguments=buffer.toString();
        
        return commandArguments;
    }
310284
@Override
    protected void resumeFaxJobImpl(FaxJob faxJob)
    {
        //create command
        String command=this.createResumeFaxJobProcessCommand(faxJob);
        
        //execute command
        this.executeProcess(faxJob,command,FaxActionType.RESUME_FAX_JOB);
    }
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();
    }
1224844
public void resumeFaxJob(FaxJob faxJob)
    {
        //validate fax job ID
        this.invokeFaxJobIDValidation(faxJob);
        
        //invoke action
        this.resumeFaxJobImpl(faxJob);
        
        //fire event
        this.fireFaxEvent(FaxClientActionEventID.RESUME_FAX_JOB,faxJob);
    }
1156204
protected void populateStatusString2FaxStatusMappings(FaxJobStatus[] faxJobStatuses,Enum<?>[] configurationKeys)
    {
        //populate map
        FaxJobStatus faxJobStatus=null;
        String valuesStr=null;
        String[] values=null;
        String value=null;
        for(int index=0;index<configurationKeys.length;index++)
        {
            //get next values
            valuesStr=this.getConfigurationValue(configurationKeys[index]);
            if(valuesStr!=null)
            {
                //get next status
                faxJobStatus=faxJobStatuses[index];

                //split
                values=valuesStr.split(AbstractMappingHTTPResponseHandler.VALUES_SEPERATOR);
                for(int valueIndex=0;valueIndex<values.length;valueIndex++)
                {
                    //get next value
                    value=values[valueIndex];
                    
                    value=value.trim();
                    if(value.length()>0)
                    {
                        this.statusString2FaxStatusMap.put(value,faxJobStatus);
                    }
                }
            }
        }
    }
1115885
@Override
    protected void updateFaxJob2HTTPRequestConverterConfiguration(Map<String,String> configuration)
    {
        //get API key/secret
        String apiKey=this.getConfigurationValue(FaxClientSpiConfigurationConstants.API_KEY_PROPERTY_KEY);
        String apiSecret=this.getConfigurationValue(FaxClientSpiConfigurationConstants.API_SECRET_PROPERTY_KEY);
        
        //validate data
        if((apiKey==null)||(apiSecret==null))
        {
            throw new FaxException("Missing phaxio API key/secret values.");
        }

        //get property part
        String propertyPart=this.getPropertyPart();

        //modify configuration
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_FILE_CONTENT_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"filename");
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_TARGET_ADDRESS_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"to");
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_SENDER_FAX_NUMBER_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"caller_id");
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.CANCEL_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"id");
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.GET_FAX_JOB_STATUS_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"id");
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX.toString()+"api_key",propertyPart),apiKey);
        configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX.toString()+"api_secret",propertyPart),apiSecret);
    }
141552
protected synchronized void submit() {
    try {
      if (theJobConf.getBoolean("create.empty.dir.if.nonexist", false)) {
        FileSystem fs = FileSystem.get(theJobConf);
        Path inputPaths[] = FileInputFormat.getInputPaths(theJobConf);
        for (int i = 0; i < inputPaths.length; i++) {
          if (!fs.exists(inputPaths[i])) {
            try {
              fs.mkdirs(inputPaths[i]);
            } catch (IOException e) {

            }
          }
        }
      }
      RunningJob running = jc.submitJob(theJobConf);
      this.mapredJobID = running.getID();
      this.state = Job.RUNNING;
    } catch (IOException ioe) {
      this.state = Job.FAILED;
      this.message = StringUtils.stringifyException(ioe);
    }
  }
1060894
@Override
    protected void suspendFaxJobImpl(FaxJob faxJob)
    {
        //get fax job ID
        int faxJobIDInt=WindowsFaxClientSpiHelper.getFaxJobID(faxJob);

        //invoke fax action
        this.winSuspendFaxJob(this.faxServerName,faxJobIDInt);
    }
839506
protected Object[] setupSubmitFaxJobInput(FaxJob faxJob)
    {
        //init list
        List<Object> inputList=new LinkedList<Object>();
        
        //set fax server information
        inputList.add(this.faxServerName);

        //set fax values
        File file=faxJob.getFile();
        inputList.add(file);
        String documentName=faxJob.getProperty(FaxJobExtendedPropertyConstants.DOCUMENT_NAME_FAX_JOB_PROPERTY_KEY.toString(),null);
        if((documentName==null)||(documentName.length()==0))
        {
            documentName=file.getName();
        }
        inputList.add(documentName);

        if(this.useWin2kAPI)
        {
            //set target information
            inputList.add(faxJob.getTargetAddress());
            inputList.add(faxJob.getTargetName());

            //set sender information
            inputList.add(faxJob.getSenderName());
            inputList.add(faxJob.getSenderFaxNumber());
        }
        else
        {
            FaxJobPriority priority=faxJob.getPriority();
            String valueStr="fptNORMAL";
            if(priority!=null)
            {
                switch(priority)
                {
                    case LOW_PRIORITY:
                        valueStr="fptLOW";
                        break;
                    case MEDIUM_PRIORITY:
                        valueStr="fptNORMAL";
                        break;
                    case HIGH_PRIORITY:
                        valueStr="fptHIGH";
                        break;
                }
            }
            inputList.add(valueStr);

            //set target information
            inputList.add(faxJob.getTargetAddress());
            inputList.add(faxJob.getTargetName());

            //set sender information
            inputList.add(faxJob.getSenderName());
            inputList.add(faxJob.getSenderFaxNumber());
            inputList.add(faxJob.getSenderEmail());
        }
        
        //convert to array
        int size=inputList.size();
        Object[] input=inputList.toArray(new Object[size]);
        
        return input;
    }
744189
@Override
    protected synchronized void submitFaxJobImpl(FaxJob faxJob)
    {
        //get the COMM port connection
        Connection<CommPortAdapter> connection=this.getCommPortConnection();

        //get adapter
        CommPortAdapter adapter=connection.getResource();

        //invoke action
        this.submitFaxJobImpl(faxJob,adapter);
    }
3820
private void winCancelFaxJob(String serverName,int faxJobID)
    {
        synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK)
        {
            //pre native call
            this.preNativeCall();
            
            //invoke native
            WindowsJNIFaxClientSpi.cancelFaxJobNative(serverName,faxJobID);
        }
    }
895187
protected FaxJob createFaxJobImpl()
    {
        //create new fax job
        FaxJob faxJob=new FaxJobImpl();
        
        //set defaults
        faxJob.setPriority(FaxJobPriority.MEDIUM_PRIORITY);
        
        return faxJob;
    }
820570
public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
    {
        //setup common request data
        HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType);
        
        //create content
        List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>();
        switch(faxActionType)
        {
            case SUBMIT_FAX_JOB:
                String value=faxJob.getTargetAddress();
                this.addContentPart(contentList,this.submitTargetAddressParameter,value);
                value=faxJob.getTargetName();
                this.addContentPart(contentList,this.submitTargetNameParameter,value);
                value=faxJob.getSenderName();
                this.addContentPart(contentList,this.submitSenderNameParameter,value);
                value=faxJob.getSenderFaxNumber();
                this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value);
                value=faxJob.getSenderEmail();
                this.addContentPart(contentList,this.submitSenderEMailParameter,value);
                File file=faxJob.getFile();
                contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE));
                if(this.shouldAddFileNamePart())
                {
                    value=file.getName();
                    this.addContentPart(contentList,this.submitFileNameParameter,value);
                }
                break;
            case SUSPEND_FAX_JOB:
                this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID());
                break;
            case RESUME_FAX_JOB:
                this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID());
                break;
            case CANCEL_FAX_JOB:
                this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID());
                break;
            case GET_FAX_JOB_STATUS:
                this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID());
                break;
            default:
                throw new FaxException("Fax action type: "+faxActionType+" not supported.");
        }
        
        //add additional parameters
        this.addAdditionalParameters(contentList);
        
        //add additional parts
        this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList);
        
        //convert to array
        ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]);
        
        //set content
        httpRequest.setContent(content);

        return httpRequest;
    }
93845
@Override
    protected void resumeFaxJobImpl(FaxJob faxJob)
    {
        //get fax job ID
        int faxJobIDInt=WindowsFaxClientSpiHelper.getFaxJobID(faxJob);

        //invoke fax action
        this.winResumeFaxJob(this.faxServerName,faxJobIDInt);
    }