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
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);
        }
    }
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.");
        }
    }
694496
private void validateProcessReference(List<String> mqProcessList,
            Map<String, String> connectionProcessMap) throws RabbitmqCommunicateException
    {
        //RabbitMQプロセス一覧が未設定の場合、例外を出力する。
        if (mqProcessList == null || mqProcessList.size() == 0)
        {
            String message = "ProcessList is not defined.";
            throw new RabbitmqCommunicateException(message);
        }

        // 呼出元別、接続先RabbitMQプロセスの定義マップが未設定の場合、確認を行わない。
        if (connectionProcessMap == null || connectionProcessMap.size() == 0)
        {
            return;
        }

        Set<String> processSet = new HashSet<String>(mqProcessList);
        Set<String> connectionProcessSet = new HashSet<String>(connectionProcessMap.values());

        if (processSet.containsAll(connectionProcessSet) == false)
        {
            @SuppressWarnings("unchecked")
            Set<String> nonContainedProcessSet = new HashSet<String>(CollectionUtils.subtract(
                    connectionProcessSet, processSet));
            String messageFmt = "Connection process is illegal. NonContainedProcessSet={0}";
            String message = MessageFormat.format(messageFmt, nonContainedProcessSet.toString());
            throw new RabbitmqCommunicateException(message);
        }
    }
1025280
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString mapped_port_validator = new MPSString();
		mapped_port_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		mapped_port_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		mapped_port_validator.validate(operationType, mapped_port, "\"mapped_port\"");
		
		MPSIPAddress host_ip_address_validator = new MPSIPAddress();
		host_ip_address_validator.validate(operationType, host_ip_address, "\"host_ip_address\"");
		
		MPSString port_validator = new MPSString();
		port_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		port_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		port_validator.validate(operationType, port, "\"port\"");
		
		MPSString state_validator = new MPSString();
		state_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		state_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		state_validator.validate(operationType, state, "\"state\"");
		
		MPSString pair_port_validator = new MPSString();
		pair_port_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		pair_port_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		pair_port_validator.validate(operationType, pair_port, "\"pair_port\"");
		
		MPSString mode_validator = new MPSString();
		mode_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 32);
		mode_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		mode_validator.validate(operationType, mode, "\"mode\"");
		
	}
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\"");
		
	}
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);
                }
            }
        }
    }
522982
private static FaxClientSpiInterceptor[] createFaxClientSpiInterceptors(FaxClientSpi faxClientSpi)
    {
        //get type list
        String typeListStr=faxClientSpi.getConfigurationValue(FaxClientSpiFactory.SPI_INTERCEPTOR_LIST_PROPERTY_KEY);
        FaxClientSpiInterceptor[] interceptors=null;
        if(typeListStr!=null)
        {
            //split list
            String[] types=typeListStr.split(FaxClientSpiFactory.SPI_INTERCEPTOR_LIST_SEPARATOR);
            
            //get amount
            int amount=types.length;
            
            String type=null;
            String propertyKey=null;
            String className=null;
            FaxClientSpiInterceptor interceptor=null;
            List<FaxClientSpiInterceptor> interceptorList=new LinkedList<FaxClientSpiInterceptor>();
            for(int index=0;index<amount;index++)
            {
                //get next type
                type=types[index];
                
                if((type!=null)&&(type.length()>0))
                {
                    //get property key
                    propertyKey=FaxClientSpiFactory.SPI_INTERCEPTOR_TYPE_PROPERTY_KEY_PREFIX+type;
                    
                    //get class name
                    className=faxClientSpi.getConfigurationValue(propertyKey);
                    
                    if(className==null)
                    {
                        throw new FaxException("Class name not defined by property: "+propertyKey+" for SPI interceptor.");
                    }

                    //create new instance
                    interceptor=(FaxClientSpiInterceptor)ReflectionHelper.createInstance(className);
                    
                    //initialize
                    interceptor.initialize(faxClientSpi);
                    
                    //add to list
                    interceptorList.add(interceptor);
                }
                
                //convert to array
                interceptors=interceptorList.toArray(new FaxClientSpiInterceptor[interceptorList.size()]);
            }
        }
        
        return interceptors;
    }
1147969
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString response_validator = new MPSString();
		response_validator.validate(operationType, response, "\"response\"");
		
	}
832320
protected ProcessOutputValidator createProcessOutputValidator()
    {
        //get process output validator
        String className=this.getConfigurationValue(FaxClientSpiConfigurationConstants.PROCESS_OUTPUT_VALIDATOR_PRE_FORMAT_PROPERTY_KEY);
        ProcessOutputValidator validator=null;
        if(className==null)
        {
            className=ExitCodeProcessOutputValidator.class.getName();
        }

        //create new instance
        validator=(ProcessOutputValidator)ReflectionHelper.createInstance(className);

        return validator;
    }
852566
@Override
    protected void submitFaxJobImpl(FaxJob faxJob)
    {
        String name=VBSFaxClientSpi.VBS_WIN_XP_SUBMIT_SCRIPT;
        if(this.useWin2kAPI)
        {
            name=VBSFaxClientSpi.VBS_WIN_2K_SUBMIT_SCRIPT;
        }
        
        //setup input data
        Object[] input=setupSubmitFaxJobInput(faxJob);
        
        //invoke script
        this.invokeScript(faxJob,name,input,FaxActionType.SUBMIT_FAX_JOB);
    }
1098725
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString manager_ip_validator = new MPSString();
		manager_ip_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		manager_ip_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		manager_ip_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		manager_ip_validator.validate(operationType, manager_ip, "\"manager_ip\"");
		
		MPSString community_validator = new MPSString();
		community_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		community_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		community_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		community_validator.validate(operationType, community, "\"community\"");
		
		MPSString netmask_validator = new MPSString();
		netmask_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		netmask_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 50);
		netmask_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		netmask_validator.validate(operationType, netmask, "\"netmask\"");
		
		MPSIPAddress br_broker_ip_address_arr_validator = new MPSIPAddress();
		br_broker_ip_address_arr_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		if(br_broker_ip_address_arr != null)
		{
			for(int i=0; i<br_broker_ip_address_arr.length; i++)
			{
				br_broker_ip_address_arr_validator.validate(operationType, br_broker_ip_address_arr[i], "br_broker_ip_address_arr["+i+"]");
			}
		}
		
	}
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);
        
    }
1146028
@Override
    protected void submitFaxJobImpl(FaxJob faxJob)
    {
        //create command
        String command=this.createSubmitFaxCommand(faxJob);
        
        //execute process
        this.executeProcess(command,FaxActionType.SUBMIT_FAX_JOB);
    }
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;
    }
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);
    }
  }
95048
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSInt core_number_validator = new MPSInt();
		core_number_validator.validate(operationType, core_number, "\"core_number\"");
		
		MPSInt cpu_validator = new MPSInt();
		cpu_validator.validate(operationType, cpu, "\"cpu\"");
		
		MPSString hyper_threads_validator = new MPSString();
		hyper_threads_validator.validate(operationType, hyper_threads, "\"hyper_threads\"");
		
		MPSString instances_validator = new MPSString();
		instances_validator.validate(operationType, instances, "\"instances\"");
		
		MPSDouble avg_usage_validator = new MPSDouble();
		avg_usage_validator.validate(operationType, avg_usage, "\"avg_usage\"");
		
	}
253021
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSIPAddress ip_address_validator = new MPSIPAddress();
		ip_address_validator.validate(operationType, ip_address, "\"ip_address\"");
		
		MPSString app_name_validator = new MPSString();
		app_name_validator.validate(operationType, app_name, "\"app_name\"");
		
		MPSDouble total_wan_volume_validator = new MPSDouble();
		total_wan_volume_validator.validate(operationType, total_wan_volume, "\"total_wan_volume\"");
		
		MPSDouble total_sent_wan_volume_validator = new MPSDouble();
		total_sent_wan_volume_validator.validate(operationType, total_sent_wan_volume, "\"total_sent_wan_volume\"");
		
		MPSDouble total_received_wan_volume_validator = new MPSDouble();
		total_received_wan_volume_validator.validate(operationType, total_received_wan_volume, "\"total_received_wan_volume\"");
		
	}