00001 /*========================================================================== 00002 * Copyright (c) 2004 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 // 00014 // NetworkServerStub 00015 // 00016 // 23 March 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_NETWORKSERVERSTUB_HPP 00020 #define INDRI_NETWORKSERVERSTUB_HPP 00021 00022 #include "indri/XMLNode.hpp" 00023 #include "indri/NetworkMessageStream.hpp" 00024 #include "indri/QueryServer.hpp" 00025 #include "indri/QueryResponsePacker.hpp" 00026 namespace indri 00027 { 00028 namespace net 00029 { 00030 00031 class NetworkServerStub : public MessageStreamHandler { 00032 private: 00033 indri::server::QueryServer* _server; 00034 NetworkMessageStream* _stream; 00035 00036 indri::xml::XMLNode* _encodeDocument( const struct indri::api::ParsedDocument* document ); 00037 void _decodeMetadataRequest( const class indri::xml::XMLNode* request, 00038 std::string& attributeName, 00039 std::vector<std::string>& attributeValues ); 00040 void _sendDocumentsResponse( class indri::server::QueryServerDocumentsResponse* response ); 00041 void _sendNumericResponse( const char* responseName, UINT64 number ); 00042 00043 void _handleDocuments( indri::xml::XMLNode* input ); 00044 void _handleDocumentMetadata( indri::xml::XMLNode* request ); 00045 void _handleDocumentVectors( indri::xml::XMLNode* request ); 00046 00047 void _handleDocumentIDsFromMetadata( indri::xml::XMLNode* request ); 00048 void _handleDocumentsFromMetadata( indri::xml::XMLNode* request ); 00049 00050 void _handleQuery( indri::xml::XMLNode* input ); 00051 00052 void _handleTermCount( indri::xml::XMLNode* request ); 00053 void _handleStemCountText( indri::xml::XMLNode* request ); 00054 void _handleTermCountText( indri::xml::XMLNode* request ); 00055 00056 void _handleTermName( indri::xml::XMLNode* request ); 00057 void _handleTermID( indri::xml::XMLNode* request ); 00058 00059 void _handleTermFieldCount( indri::xml::XMLNode* request ); 00060 void _handleStemFieldCount( indri::xml::XMLNode* request ); 00061 void _handleDocumentCount( indri::xml::XMLNode* request ); 00062 void _handleDocumentTermCount( indri::xml::XMLNode* request ); 00063 void _handleDocumentStemCount( indri::xml::XMLNode* request ); 00064 void _handleDocumentLength( indri::xml::XMLNode* request ); 00065 void _handleFieldList( indri::xml::XMLNode* request ); 00066 00067 void _handlePathNames( indri::xml::XMLNode* request ); 00068 00069 void _handleSetMaxWildcardTerms( indri::xml::XMLNode* request ); 00070 00071 public: 00072 NetworkServerStub( indri::server::QueryServer* server, NetworkMessageStream* stream ); 00073 void request( indri::xml::XMLNode* input ); 00074 void reply( indri::xml::XMLNode* input ); 00075 void reply( const std::string& name, const void* buffer, unsigned int length ); 00076 void replyDone(); 00077 void error( const std::string& error ); 00078 void run(); 00079 }; 00080 } 00081 } 00082 00083 #endif // INDRI_NETWORKSERVERSTUB_HPP