XmlRpcMethodFactory.cc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2009 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "XmlRpcMethodFactory.h"
  36. #include "XmlRpcMethodImpl.h"
  37. #include "OptionParser.h"
  38. #include "OptionHandler.h"
  39. namespace aria2 {
  40. namespace xmlrpc {
  41. SharedHandle<XmlRpcMethod>
  42. XmlRpcMethodFactory::create(const std::string& methodName)
  43. {
  44. if(methodName == AddUriXmlRpcMethod::getMethodName()) {
  45. return SharedHandle<XmlRpcMethod>(new AddUriXmlRpcMethod());
  46. #ifdef ENABLE_BITTORRENT
  47. } else if(methodName == AddTorrentXmlRpcMethod::getMethodName()) {
  48. return SharedHandle<XmlRpcMethod>(new AddTorrentXmlRpcMethod());
  49. #endif // ENABLE_BITTORRENT
  50. #ifdef ENABLE_METALINK
  51. }
  52. else if(methodName == AddMetalinkXmlRpcMethod::getMethodName()) {
  53. return SharedHandle<XmlRpcMethod>(new AddMetalinkXmlRpcMethod());
  54. #endif // ENABLE_METALINK
  55. }
  56. else if(methodName == RemoveXmlRpcMethod::getMethodName()) {
  57. return SharedHandle<XmlRpcMethod>(new RemoveXmlRpcMethod());
  58. } else if(methodName == ForceRemoveXmlRpcMethod::getMethodName()) {
  59. return SharedHandle<XmlRpcMethod>(new ForceRemoveXmlRpcMethod());
  60. } else if(methodName == ChangePositionXmlRpcMethod::getMethodName()) {
  61. return SharedHandle<XmlRpcMethod>(new ChangePositionXmlRpcMethod());
  62. } else if(methodName == TellStatusXmlRpcMethod::getMethodName()) {
  63. return SharedHandle<XmlRpcMethod>(new TellStatusXmlRpcMethod());
  64. } else if(methodName == GetUrisXmlRpcMethod::getMethodName()) {
  65. return SharedHandle<XmlRpcMethod>(new GetUrisXmlRpcMethod());
  66. } else if(methodName == GetFilesXmlRpcMethod::getMethodName()) {
  67. return SharedHandle<XmlRpcMethod>(new GetFilesXmlRpcMethod());
  68. #ifdef ENABLE_BITTORRENT
  69. }
  70. else if(methodName == GetPeersXmlRpcMethod::getMethodName()) {
  71. return SharedHandle<XmlRpcMethod>(new GetPeersXmlRpcMethod());
  72. #endif // ENABLE_BITTORRENT
  73. } else if(methodName == GetServersXmlRpcMethod::getMethodName()) {
  74. return SharedHandle<XmlRpcMethod>(new GetServersXmlRpcMethod());
  75. } else if(methodName == TellActiveXmlRpcMethod::getMethodName()) {
  76. return SharedHandle<XmlRpcMethod>(new TellActiveXmlRpcMethod());
  77. } else if(methodName == TellWaitingXmlRpcMethod::getMethodName()) {
  78. return SharedHandle<XmlRpcMethod>(new TellWaitingXmlRpcMethod());
  79. } else if(methodName == TellStoppedXmlRpcMethod::getMethodName()) {
  80. return SharedHandle<XmlRpcMethod>(new TellStoppedXmlRpcMethod());
  81. } else if(methodName == GetOptionXmlRpcMethod::getMethodName()) {
  82. return SharedHandle<XmlRpcMethod>(new GetOptionXmlRpcMethod());
  83. } else if(methodName == ChangeUriXmlRpcMethod::getMethodName()) {
  84. return SharedHandle<XmlRpcMethod>(new ChangeUriXmlRpcMethod());
  85. } else if(methodName == ChangeOptionXmlRpcMethod::getMethodName()) {
  86. return SharedHandle<XmlRpcMethod>(new ChangeOptionXmlRpcMethod());
  87. } else if(methodName == GetGlobalOptionXmlRpcMethod::getMethodName()) {
  88. return SharedHandle<XmlRpcMethod>(new GetGlobalOptionXmlRpcMethod());
  89. } else if(methodName == ChangeGlobalOptionXmlRpcMethod::getMethodName()) {
  90. return SharedHandle<XmlRpcMethod>(new ChangeGlobalOptionXmlRpcMethod());
  91. } else if(methodName == PurgeDownloadResultXmlRpcMethod::getMethodName()) {
  92. return SharedHandle<XmlRpcMethod>(new PurgeDownloadResultXmlRpcMethod());
  93. } else if(methodName == GetVersionXmlRpcMethod::getMethodName()) {
  94. return SharedHandle<XmlRpcMethod>(new GetVersionXmlRpcMethod());
  95. } else if(methodName == GetSessionInfoXmlRpcMethod::getMethodName()) {
  96. return SharedHandle<XmlRpcMethod>(new GetSessionInfoXmlRpcMethod());
  97. } else if(methodName == SystemMulticallXmlRpcMethod::getMethodName()) {
  98. return SharedHandle<XmlRpcMethod>(new SystemMulticallXmlRpcMethod());
  99. } else {
  100. return SharedHandle<XmlRpcMethod>(new NoSuchMethodXmlRpcMethod());
  101. }
  102. }
  103. } // namespace xmlrpc
  104. } // namespace aria2