void BatchFilter::replyOutputFormat( NameValueCollection& transportHeaders, int format ) { XALAN_USING_XALAN( FormatterListener ); string formatAsString = ""; switch( format ) { case FormatterListener::OUTPUT_METHOD_TEXT : formatAsString = BatchFilter::OUTPUT_METHOD_TEXT; break; case FormatterListener::OUTPUT_METHOD_XML : case FormatterListener::OUTPUT_METHOD_DOM : formatAsString = BatchFilter::OUTPUT_METHOD_XML; break; default : formatAsString = BatchFilter::OUTPUT_METHOD_NONE; break; } if ( transportHeaders.ContainsKey( BatchOUTPUTFORMAT ) ) transportHeaders[ BatchOUTPUTFORMAT ] = formatAsString; else transportHeaders.Add( BatchOUTPUTFORMAT, formatAsString ); }
int name_value_collection_Add(lua_State *L) { NameValueCollection *collection = GetCollection(L, lua_upvalueindex(1)); // TODO: permit nil const char *name = luaL_checkstring(L, 1); const char *value = luaL_checkstring(L, 2); lua_pushboolean(L, collection->Add(name, value)); return 1; }
bool RoutingCondition::internalEvalFunction( RoutingMessage& message ) const { DEBUG( "Evaluating function" ); switch ( m_EvalFunction ) { case RoutingCondition::VALIDATE_TO_XSD : { // local case vars block // create an XSD filter XSDFilter myFilter; NameValueCollection headers; headers.Add( XSDFilter::XSDFILE, m_EvalFunctionParams[ 0 ] ); if ( m_EvalFunctionParams.size() > 1 ) headers.Add( XSDFilter::XSDNAMESPACE, m_EvalFunctionParams[ 1 ] ); bool valid = true; try { myFilter.ProcessMessage( message.getPayload()->getDoc(), headers, true ); } catch( const XSDValidationException& ex ) { TRACE( ex.getMessage() ); valid = false; } return m_Evaluator.EvaluateBool( valid ); } case RoutingCondition::VALIDATE : { bool valid = true; string options = ""; if ( m_EvalFunctionParams.size() > 0 ) options = m_EvalFunctionParams[ 0 ]; valid = Validate( options, message ); return m_Evaluator.EvaluateBool( valid ); } case RoutingCondition::IS_ACK : { if ( m_EvalFunctionParams.size() == 0 ) return m_Evaluator.EvaluateBool( message.isAck() ); // hack for dd : RoutingMessageEvaluator* evaluator = message.getPayloadEvaluator(); if ( ( evaluator != NULL ) && ( evaluator->CheckPayloadType( RoutingMessageEvaluator::ACHBLKACC ) ) ) { return m_Evaluator.EvaluateBool( evaluator->isAck( m_EvalFunctionParams[ 0 ] ) ); } DEBUG( "Condition failed because the message is not in the correct format for ACK(param) evaluation" ); return false; } case RoutingCondition::IS_NACK : { if ( m_EvalFunctionParams.size() == 0 ) return m_Evaluator.EvaluateBool( message.isNack() ); // hack for dd : RoutingMessageEvaluator* evaluator = message.getPayloadEvaluator(); if ( ( evaluator != NULL ) && ( evaluator->CheckPayloadType( RoutingMessageEvaluator::ACHBLKRJCT ) ) ) { return m_Evaluator.EvaluateBool( evaluator->isNack( m_EvalFunctionParams[ 0 ] ) ); } DEBUG( "Condition failed because the message is not in the correct format for NACK(param) evaluation" ); return false; } case RoutingCondition::IS_REPLY : return m_Evaluator.EvaluateBool( message.isReply() ); default : // this should not happen ( function is parsed in ctor ) throw runtime_error( "Invalid function requested for evaluation." ); break; } return false; }