This function validates the process output for errors.<br>
If not valid, an exception should be thrown.

@param   faxClientSpi
The fax client SPI
@param   processOutput
The process output to validate
@param   faxActionType
The fax action type
961918
public void validateProcessOutput(FaxClientSpi faxClientSpi,ProcessOutput processOutput,FaxActionType faxActionType)
    {
        //validate exit code
        int exitCode=processOutput.getExitCode();
        if(exitCode!=0)
        {
            throw new FaxException("Error while invoking fax action process, exit code: "+exitCode+" process output:\n"+processOutput.getOutputText()+"\nprocess error:\n"+processOutput.getErrorText());
        }
    }
742990
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSInt ica_license_in_use_validator = new MPSInt();
		ica_license_in_use_validator.validate(operationType, ica_license_in_use, "\"ica_license_in_use\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}
475208
@Override
    protected void populateFaxActionType2ReponseDataPathMappings()
    {
        //populate map
        FaxActionType[] faxActionTypes=new FaxActionType[]{FaxActionType.SUBMIT_FAX_JOB,
                                                           FaxActionType.SUSPEND_FAX_JOB,
                                                           FaxActionType.RESUME_FAX_JOB,
                                                           FaxActionType.CANCEL_FAX_JOB,
                                                           FaxActionType.GET_FAX_JOB_STATUS};
        Enum<?>[] configurationKeys=new Enum<?>[]{XMLHTTPResponseHandlerConfigurationConstants.SUBMIT_XML_OUTPUT_PROPERTY_KEY,
                                     XMLHTTPResponseHandlerConfigurationConstants.SUSPEND_XML_OUTPUT_PROPERTY_KEY,
                                     XMLHTTPResponseHandlerConfigurationConstants.RESUME_XML_OUTPUT_PROPERTY_KEY,
                                     XMLHTTPResponseHandlerConfigurationConstants.CANCEL_XML_OUTPUT_PROPERTY_KEY,
                                     XMLHTTPResponseHandlerConfigurationConstants.GET_STATUS_XML_OUTPUT_PROPERTY_KEY};
        this.populateFaxActionType2ReponseDataPathMappings(faxActionTypes,configurationKeys);
    }
1309250
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString response_validator = new MPSString();
		response_validator.validate(operationType, response, "\"response\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}
488129
@Override
    protected void initializeChildFaxClientSpi()
    {
        //get logger
        Logger logger=this.getLogger();
        
        //get types
        String types=this.getConfigurationValue(FaxClientSpiConfigurationConstants.SPI_TYPES_PROPERTY_KEY);
        logger.logDebug(new Object[]{FaxClientSpiConfigurationConstants.SPI_TYPES_PROPERTY_KEY," value is ",types},null);
        
        if(types!=null)
        {
            //split type values
            String[] typeValues=types.split(FaxClientSpiConfigurationConstants.PROPERTY_VALUE_LIST_SEPARATOR.toString());
            
            //get amount
            int amount=typeValues.length;
            
            String typeValue=null;
            String conditionString=null;
            String[] conditionBlocks=null;
            String conditionBlock=null;
            String[] conditionBlockValues=null;
            String conditionKey=null;
            String conditionValue=null;
            int subAmount=-1;
            boolean conditionValid=true;
            StringBuilder conditionStringBuffer=new StringBuilder();
            for(int index=0;index<amount;index++)
            {
                //get next element
                typeValue=typeValues[index];
                logger.logDebug(new Object[]{"Checking conditions for type: ",typeValue},null);
                
                //get condition string
                conditionString=this.getConfigurationValue(FaxClientSpiConfigurationConstants.SPI_CONDITION_PROPERTY_KEY_PREFIX+typeValue);
                logger.logDebug(new Object[]{"Configured condition for type: ",typeValue," is set to: ",conditionString},null);
                
                //append mandatory conditions
                conditionStringBuffer.delete(0,conditionStringBuffer.length());
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_CONDITION);
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_BLOCK_VALUE_SEPARATOR);
                conditionStringBuffer.append(FaxClientSpiFactory.SPI_CLASS_NAME_TYPE_MAP_PROPERTY_KEY_PREFIX);
                conditionStringBuffer.append(typeValue);
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_VALUE_LIST_SEPARATOR);
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.JAVA_CLASS_CONDITION);
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_BLOCK_VALUE_SEPARATOR);
                conditionStringBuffer.append(this.getConfigurationValue(FaxClientSpiFactory.SPI_CLASS_NAME_TYPE_MAP_PROPERTY_KEY_PREFIX+typeValue));
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_VALUE_LIST_SEPARATOR);
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.STABLE_CONDITION);
                conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_BLOCK_VALUE_SEPARATOR);
                conditionStringBuffer.append(typeValue);
                if(conditionString!=null)
                {
                    conditionStringBuffer.append(FaxClientSpiConfigurationConstants.PROPERTY_VALUE_LIST_SEPARATOR);
                    conditionStringBuffer.append(conditionString);
                }
                conditionString=conditionStringBuffer.toString();
                logger.logDebug(new Object[]{"Updated condition for type: ",typeValue," is set to: ",conditionString},null);
                                
                //split condition to blocks
                conditionBlocks=conditionString.split(FaxClientSpiConfigurationConstants.PROPERTY_VALUE_LIST_SEPARATOR.toString());
                
                //get amount
                subAmount=conditionBlocks.length;
                
                conditionValid=true;
                for(int blockIndex=0;blockIndex<subAmount;blockIndex++)
                {
                    //get next element
                    conditionBlock=conditionBlocks[blockIndex];
                    
                    //split condition block
                    conditionBlockValues=conditionBlock.split(FaxClientSpiConfigurationConstants.PROPERTY_BLOCK_VALUE_SEPARATOR.toString());
                    
                    //check condition block contains only 2 parts (key and value)
                    if(conditionBlockValues.length!=2)
                    {
                        throw new FaxException("Condition block must contain 2 parts separated by "+FaxClientSpiConfigurationConstants.PROPERTY_BLOCK_VALUE_SEPARATOR);
                    }
                    
                    //get condition key and value
                    conditionKey=conditionBlockValues[0];
                    conditionValue=conditionBlockValues[1];
                    
                    //validate condition
                    logger.logDebug(new Object[]{"Validating condition for type: ",typeValue," key: ",conditionKey," value: ",conditionValue},null);
                    if(!this.validateCondition(conditionKey,conditionValue))
                    {
                        conditionValid=false;
                        break;
                    }
                }
                
                if(conditionValid)
                {
                    logger.logDebug(new Object[]{"Conditions validated for type: ",typeValue},null);
                    
                    //create SPI
                    this.createFaxClientSpi(typeValue);
                    
                    break;
                }
            }
        }
        
        if(this.faxClientSpi==null)
        {
            throw new FaxException("No internal SPI available.");
        }
    }
571115
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSIPAddress ns_ip_address_arr_validator = new MPSIPAddress();
		ns_ip_address_arr_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		if(ns_ip_address_arr != null)
		{
			for(int i=0; i<ns_ip_address_arr.length; i++)
			{
				ns_ip_address_arr_validator.validate(operationType, ns_ip_address_arr[i], "ns_ip_address_arr["+i+"]");
			}
		}
		
	}
943613
private void postProcess(ProcessMethodCallback callback, TransactionContext txContext,
                           InputDatum input, ProcessMethod.ProcessResult result) {
    InputContext inputContext = input.getInputContext();
    Throwable failureCause = null;
    FailureReason.Type failureType = FailureReason.Type.IO_ERROR;
    try {
      if (result.isSuccess()) {
        // If it is a retry input, force the dequeued entries into current transaction.
        if (input.getRetry() > 0) {
          input.reclaim();
        }
        txContext.finish();
      } else {
        failureCause = result.getCause();
        failureType = FailureReason.Type.USER;
        txContext.abort();
      }
    } catch (Throwable e) {
      LOG.error("Transaction operation failed: {}", e.getMessage(), e);
      failureType = FailureReason.Type.IO_ERROR;
      if (failureCause == null) {
        failureCause = e;
      }
      try {
        if (result.isSuccess()) {
          txContext.abort();
        }
      } catch (Throwable ex) {
        LOG.error("Fail to abort transaction: {}", inputContext, ex);
      }
    }

    try {
      if (failureCause == null) {
        callback.onSuccess(result.getEvent(), inputContext);
      } else {
        callback.onFailure(result.getEvent(), inputContext,
                           new FailureReason(failureType, failureCause.getMessage(), failureCause),
                           createInputAcknowledger(input));
      }
    } catch (Throwable t) {
      LOG.error("Failed to invoke callback.", t);
    }
  }
1058764
public void updateFaxJob(FaxClientSpi faxClientSpi,FaxJob faxJob,ProcessOutput processOutput,FaxActionType faxActionType)
    {
        //get output
        String output=WindowsFaxClientSpiHelper.getOutputPart(processOutput,Fax4jExeConstants.FAX_JOB_ID_OUTPUT_PREFIX.toString());

        if(output!=null)
        {
            //validate fax job ID
            WindowsFaxClientSpiHelper.validateFaxJobID(output);
            
            //set fax job ID
            faxJob.setID(output);
        }
    }
990769
private static void validateInput(ColumnType columnType) throws ExecutionException {
        if (columnType == null) {
            String messagge = "The ColumnType can not be null.";
            LOGGER.error(messagge);
            throw new ExecutionException(messagge);
        }
    }
660480
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString image_name_validator = new MPSString();
		image_name_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		image_name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		image_name_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		image_name_validator.validate(operationType, image_name, "\"image_name\"");
		
		MPSString doc_file_validator = new MPSString();
		doc_file_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		doc_file_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		doc_file_validator.validate(operationType, doc_file, "\"doc_file\"");
		
		MPSIPAddress ns_ip_address_arr_validator = new MPSIPAddress();
		ns_ip_address_arr_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		if(ns_ip_address_arr != null)
		{
			for(int i=0; i<ns_ip_address_arr.length; i++)
			{
				ns_ip_address_arr_validator.validate(operationType, ns_ip_address_arr[i], "ns_ip_address_arr["+i+"]");
			}
		}
		
		MPSString act_id_validator = new MPSString();
		act_id_validator.validate(operationType, act_id, "\"act_id\"");
		
	}
69720
protected void fireFaxEvent(FaxClientActionEventID id,FaxJob faxJob)
    {
        //create new fax event
        FaxClientActionEvent event=new FaxClientActionEvent(id,faxJob);

        //get listeners
        FaxClientActionEventListener[] listeners=null;
        synchronized(this.faxClientActionEventListeners)
        {
            listeners=this.faxClientActionEventListeners.toArray(new FaxClientActionEventListener[this.faxClientActionEventListeners.size()]);
        }
        
        int amount=listeners.length;
        FaxClientActionEventListener listener=null;
        for(int index=0;index<amount;index++)
        {
            //get next element
            listener=listeners[index];
            
            //fire event
            if(listener!=null)
            {
                switch(id)
                {
                    case CREATE_FAX_JOB:
                        listener.faxJobCreated(event);
                        break;
                    case SUBMIT_FAX_JOB:
                        listener.faxJobSubmitted(event);
                        break;
                    case SUSPEND_FAX_JOB:
                        listener.faxJobSuspended(event);
                        break;
                    case RESUME_FAX_JOB:
                        listener.faxJobResumed(event);
                        break;
                    case CANCEL_FAX_JOB:
                        listener.faxJobCancelled(event);
                        break;
                    default:
                        throw new FaxException("Unable to support fax event, for event ID: "+id);
                }
            }
        }
    }
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);
        
    }
661688
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSIPAddress device_ipaddress_validator = new MPSIPAddress();
		device_ipaddress_validator.validate(operationType, device_ipaddress, "\"device_ipaddress\"");
		
		MPSString traceroute_status_validator = new MPSString();
		traceroute_status_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 1024);
		traceroute_status_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		traceroute_status_validator.validate(operationType, traceroute_status, "\"traceroute_status\"");
		
	}
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;
    }
387716
protected String formatHTTPResource(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
    {
        //get resource
        String resourceTemplate=faxClientSpi.getHTTPResource(faxActionType);
        
        //format resource
        String resource=SpiUtil.formatTemplate(resourceTemplate,faxJob,SpiUtil.URL_ENCODER,false,false);
        
        return resource;
    }
531234
private static FaxClientSpiProxy createFaxClientSpiProxy(FaxClientSpi faxClientSpi)
    {
        //create fax client SPI interceptors
        FaxClientSpiInterceptor[] interceptors=FaxClientSpiFactory.createFaxClientSpiInterceptors(faxClientSpi);
        
        //get class name
        String className=faxClientSpi.getConfigurationValue(FaxClientSpiFactory.SPI_PROXY_CLASS_NAME_PROPERTY_KEY);
        if(className==null)
        {
            className=FaxClientSpiProxyImpl.class.getName();
        }

        //create new instance
        FaxClientSpiProxy faxClientSpiProxy=(FaxClientSpiProxy)ReflectionHelper.createInstance(className);
        
        //initialize
        faxClientSpiProxy.initialize(faxClientSpi,interceptors);
        
        return faxClientSpiProxy;
    }
119776
@Override
    protected void submitFaxJobImpl(FaxJob faxJob)
    {
        try
        {
            this.submitFaxJobViaFaxModem(faxJob);
        }
        catch(RuntimeException exception)
        {
            throw exception;
        }
        catch(Exception exception)
        {
            throw new FaxException("Unable to send fax via fax modem.",exception);
        }
    }