module.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 file : $URL: https://frepple.svn.sourceforge.net/svnroot/frepple/trunk/modules/webservice/module.cpp $ 00003 version : $LastChangedRevision: 644 $ $LastChangedBy: jdetaeye $ 00004 date : $LastChangedDate: 2008-01-07 10:46:56 +0100 (Mon, 07 Jan 2008) $ 00005 ***************************************************************************/ 00006 00007 /*************************************************************************** 00008 * * 00009 * Copyright (C) 2007 by Johan De Taeye * 00010 * * 00011 * This library is free software; you can redistribute it and/or modify it * 00012 * under the terms of the GNU Lesser General Public License as published * 00013 * by the Free Software Foundation; either version 2.1 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * 00019 * General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * 00024 * * 00025 ***************************************************************************/ 00026 00027 00028 #include "module.h" 00029 00030 00031 namespace module_webservice 00032 { 00033 00034 const MetaClass CommandWebservice::metadata; 00035 00036 unsigned int CommandWebservice::port = 6262; 00037 unsigned int CommandWebservice::threads = 10; 00038 00039 00040 MODULE_EXPORT const char* initialize(const CommandLoadLibrary::ParameterList& z) 00041 { 00042 // Initialize only once 00043 static bool init = false; 00044 static const char* name = "webservice"; 00045 if (init) 00046 { 00047 logger << "Warning: Initializing module webservice more than once." << endl; 00048 return name; 00049 } 00050 init = true; 00051 00052 // Process the module parameters 00053 for (CommandLoadLibrary::ParameterList::const_iterator x = z.begin(); 00054 x != z.end(); ++x) 00055 { 00056 if (x->first == "port") 00057 CommandWebservice::setPort(x->second.getInt()); 00058 else if (x->first == "threads") 00059 CommandWebservice::setThreads(x->second.getInt()); 00060 else 00061 logger << "Warning: Unrecognized parameter '" << x->first << "'" << endl; 00062 } 00063 00064 // Initialize the metadata. 00065 CommandWebservice::metadata.registerClass( 00066 "command", 00067 "command_webservice", 00068 Object::createDefault<CommandWebservice>); 00069 00070 // Return the name of the module 00071 return name; 00072 } 00073 00074 00075 } // end namespace
Documentation generated by
