<?php
/**
- * The Horde_RPC:: class provides a set of server and client methods for
+ * The Horde_Rpc:: class provides a set of server and client methods for
* RPC communication.
*
* TODO:
*
* EXAMPLE:
* <code>
- * $response = Horde_RPC::request('xmlrpc',
+ * $response = Horde_Rpc::request('xmlrpc',
* 'http://localhost:80/horde/rpc.php',
* 'contacts.search',
* array(array('jan'), array('localsql'),
* 'pass' => Auth::getCredential('password')));
* </code>
*
- * $Horde: framework/RPC/RPC.php,v 1.30 2009/01/06 17:49:37 jan Exp $
- *
* Copyright 2002-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
*
* @author Jan Schneider <jan@horde.org>
* @since Horde 3.0
- * @package Horde_RPC
+ * @package Horde_Rpc
*/
-class Horde_RPC {
-
+class Horde_Rpc
+{
/**
* All driver-specific parameters.
*
* @param array $config A hash containing any additional configuration or
* connection parameters a subclass might need.
*
- * @return Horde_RPC An RPC server instance.
+ * @return Horde_Rpc An RPC server instance.
*/
- function Horde_RPC($params = array())
+ public function __construct($params = array())
{
$this->_params = $params;
* @return mixed The returned result from the method or a PEAR
* error object on failure.
*/
- function request($driver, $url, $method, $params = null, $options = array())
+ public static function request($driver, $url, $method, $params = null, $options = array())
{
$driver = basename($driver);
- $class = 'Horde_RPC_' . $driver;
- if (!class_exists($class)) {
- include 'Horde/RPC/' . $driver . '.php';
- }
-
+ $class = 'Horde_Rpc_' . $driver;
if (class_exists($class)) {
return call_user_func(array($class, 'request'), $url, $method, $params, $options);
} else {
- include_once 'PEAR.php';
- return PEAR::raiseError('Class definition of ' . $class . ' not found.');
+ throw new Horde_Rpc_Exception('Class definition of ' . $class . ' not found.');
}
}
* Attempts to return a concrete RPC server instance based on
* $driver.
*
- * @param mixed $driver The type of concrete RPC subclass to return. If
- * $driver is an array, then we will look in
- * $driver[0]/lib/RPC/ for the subclass
- * implementation named $driver[1].php.
+ * @param mixed $driver The type of concrete Horde_Rpc subclass to return.
* @param array $params A hash containing any additional configuration or
* connection parameters a subclass might need.
*
- * @return Horde_RPC The newly created concrete Horde_RPC server instance,
- * or PEAR_Error on error.
+ * @return Horde_Rpc The newly created concrete Horde_Rpc server instance,
+ * or an exception if there is an error.
*/
- function factory($driver, $params = null)
+ public static function factory($driver, $params = null)
{
$driver = basename($driver);
- if ($driver == 'soap' && class_exists('SoapServer')) {
- $driver = 'PhpSoap';
- }
-
- $class = 'Horde_RPC_' . $driver;
- if (!class_exists($class)) {
- include 'Horde/RPC/' . $driver . '.php';
- }
-
+ $class = 'Horde_Rpc_' . $driver;
if (class_exists($class)) {
return new $class($params);
} else {
- include_once 'PEAR.php';
- return PEAR::raiseError('Class definition of ' . $class . ' not found.');
+ throw new Horde_Rpc_Exception('Class definition of ' . $class . ' not found.');
}
}
--- /dev/null
+<?php
+class Horde_Rpc_Exception extends Exception
+{
+}
<?php
/**
- * $Horde: framework/RPC/RPC/jsonrpc.php,v 1.9 2009/02/21 01:58:14 chuck Exp $
- *
* Copyright 2007-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Joey Hewitt <joey@joeyhewitt.com>
- * @author Jan Schneider <jan@horde.org>
- * @since Horde 3.2
- * @package Horde_RPC
+ * @author Joey Hewitt <joey@joeyhewitt.com>
+ * @author Jan Schneider <jan@horde.org>
+ * @since Horde 3.2
+ * @category Horde
+ * @package Horde_Rpc
*/
/**
* works with positional parameters.
* - Service Descriptions are not supported yet.
*
- * @link http://json-rpc.org
- * @package Horde_RPC
+ * @link http://json-rpc.org
+ * @category Horde
+ * @package Horde_RPC
*/
-class Horde_RPC_jsonrpc extends Horde_RPC {
-
+class Horde_Rpc_Jsonrpc extends Horde_Rpc
+{
/**
* Returns the Content-Type of the response.
*
$options = array_merge($options, $GLOBALS['conf']['http']['proxy']);
}
- require_once 'HTTP/Request.php';
+ /*@TODO Use Horde_Http_Request */
$http = new HTTP_Request($url, $options);
if (!empty($language)) {
$http->addHeader('Accept-Language', $language);
<?php
/**
- * The Horde_RPC_phpgw class provides an XMLRPC implementation of the
+ * The Horde_Rpc_Phpgw class provides an XMLRPC implementation of the
* Horde RPC system compatible with phpgw. It is based on the
* xmlrpc.php implementation by Jan Schneider.
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Michael Braun <mi.braun@onlinehome.de>
- * @since Horde 3.2
- * @package Horde_RPC
+ * @author Michael Braun <mi.braun@onlinehome.de>
+ * @since Horde 3.2
+ * @category Horde
+ * @package Horde_Rpc
*/
-class Horde_RPC_phpgw extends Horde_RPC {
-
+class Horde_Rpc_Phpgw extends Horde_Rpc
+{
/**
* Resource handler for the XML-RPC server.
*
/**
* XMLRPC server constructor.
*/
- function Horde_RPC_phpgw()
+ function __construct()
{
- parent::Horde_RPC();
+ parent::__construct();
$this->_server = xmlrpc_server_create();
$methods = explode('/', $method);
array_shift($methods);
$method = implode('.', $methods);
- xmlrpc_server_register_method($this->_server, $method, array('Horde_RPC_phpgw', '_dispatcher'));
+ xmlrpc_server_register_method($this->_server, $method, array('Horde_Rpc_Phpgw', '_dispatcher'));
}
}
$options = array_merge($options, $GLOBALS['conf']['http']['proxy']);
}
- require_once 'HTTP/Request.php';
$http = new HTTP_Request($url, $options);
if (!empty($language)) {
$http->addHeader('Accept-Language', $language);
<?php
/**
- * The Horde_RPC_PhpSoap class provides a PHP 5 Soap implementation
+ * The Horde_Rpc_Soap class provides a PHP 5 Soap implementation
* of the Horde RPC system.
*
* Copyright 2003-2009 The Horde Project (http://www.horde.org/)
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @since Horde 3.2
- * @package Horde_RPC
+ * @package Horde_Rpc
*/
class Horde_Rpc_Soap extends Horde_Rpc
{
/**
- * Resource handler for the RPC server.
+ * Resource handler for the SOAP server.
*
* @var object
*/
{
NLS::setCharset('UTF-8');
- parent::Horde_RPC($params);
+ parent::__construct($params);
if (!empty($params['allowedTypes'])) {
$this->_allowedTypes = $params['allowedTypes'];
$this->_server = new SoapServer(null, array('uri' => Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/rpc.php', true, false)));
$this->_server->addFunction(SOAP_FUNCTIONS_ALL);
- $this->_server->setClass('Horde_RPC_PhpSoap_Caller', $params);
+ $this->_server->setClass('Horde_Rpc_Soap_Caller', $params);
}
/**
- * Takes an RPC request and returns the result.
+ * Takes a SOAP request and returns the result.
*
* @param string The raw request string.
*
function getResponse($request)
{
if ($request == 'disco' || $request == 'wsdl') {
- /* TODO - replace PEAR here? For now fall back to the PEAR
- * server. */
- if (!class_exists('Horde_RPC_soap')) {
- include dirname(__FILE__) . '/soap.php';
- }
- $handler = new Horde_RPC_soap($this->_params);
- return $handler->getResponse($request);
+ /*@TODO Replace with subcalls for disco and wsdl generation from the old SOAP driver. */
+ //$handler = new Horde_Rpc_Soap($this->_params);
+ //return $handler->getResponse($request);
}
/* We can't use Horde_Util::bufferOutput() here for some reason. */
}
-class Horde_RPC_PhpSoap_Caller {
+class Horde_Rpc_Soap_Caller {
/**
* List of method names to allow.
require_once 'SyncML/Backend.php';
/**
- * The Horde_RPC_syncml class provides a SyncML implementation of the Horde
+ * The Horde_Rpc_Syncml class provides a SyncML implementation of the Horde
* RPC system.
*
- * $Horde: framework/RPC/RPC/syncml.php,v 1.45 2009/01/06 17:49:38 jan Exp $
- *
* Copyright 2003-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* @author Chuck Hagenbuch <chuck@horde.org>
* @author Anthony Mills <amills@pyramid6.com>
* @since Horde 3.0
- * @package Horde_RPC
+ * @package Horde_Rpc
*/
-
-class Horde_RPC_syncml extends Horde_RPC {
-
+class Horde_Rpc_Syncml extends Horde_Rpc
+{
/**
* SyncML handles authentication internally, so bypass the RPC framework
* auth check by just returning true here.
<?php
-
-require_once dirname(__FILE__) . '/syncml.php';
-
/**
- * The Horde_RPC_syncml_wbxml class provides a SyncML implementation of the
+ * The Horde_Rpc_Syncml_Wbxml class provides a SyncML implementation of the
* Horde RPC system using WBXML encoding.
*
- * $Horde: framework/RPC/RPC/syncml_wbxml.php,v 1.29 2009/01/06 17:49:38 jan Exp $
- *
* Copyright 2003-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* @author Chuck Hagenbuch <chuck@horde.org>
* @author Anthony Mills <amills@pyramid6.com>
* @since Horde 3.0
- * @package Horde_RPC
+ * @package Horde_Rpc
*/
-class Horde_RPC_syncml_wbxml extends Horde_RPC_syncml {
-
+class Horde_Rpc_Syncml_Wbxml extends Horde_Rpc_Syncml
+{
/**
* Returns the Content-Type of the response.
*
<?php
/**
- * The Horde_RPC_webdav class provides a WebDAV implementation of the
+ * The Horde_Rpc_Webdav class provides a WebDAV implementation of the
* Horde RPC system.
*
- * $Horde: framework/RPC/RPC/webdav.php,v 1.49 2009/03/05 04:20:33 slusarz Exp $
- *
* Copyright 2008-2009 The Horde Project (http://www.horde.org/)
*
* Derived from the HTTP_WebDAV_Server PEAR package:
* @author Hartmut Holzgraefe
* @author Christian Stocker
* @since Horde 3.0
- * @package Horde_RPC
+ * @package Horde_Rpc
*/
-
-// Use Horde's Xml_Element to construct the DAV responses
-require_once 'Horde/Xml/Element.php';
-
-class Horde_RPC_webdav extends Horde_RPC {
-
+class Horde_Rpc_Webdav extends Horde_Rpc
+{
/**
* CalDAV XML namespace
*
*
* @access private
*/
- function Horde_RPC_webdav()
+ public function __construct()
{
// PHP messages destroy XML output -> switch them off
- ini_set("display_errors", 0);
+ ini_set('display_errors', 0);
// copy $_SERVER variables to local _SERVER array
// so that derived classes can simply modify these
$this->_SERVER = $_SERVER;
- parent::Horde_RPC();
+ parent::__construct();
}
/**
exit;
}
-
/**
* GET implementation.
*
$timeout = 600;
}
- require_once 'Horde/Lock.php';
- $locks = &Horde_Lock::singleton($GLOBALS['conf']['lock']['driver']);
+ $locks = Horde_Lock::singleton($GLOBALS['conf']['lock']['driver']);
if (is_a($locks, 'PEAR_Error')) {
Horde::logMessage($locks, __FILE__, __LINE__, PEAR_LOG_ERR);
return 500;
return 500;
}
- require_once 'Horde/Lock.php';
- $locks = &Horde_Lock::singleton($GLOBALS['conf']['lock']['driver']);
+ $locks = Horde_Lock::singleton($GLOBALS['conf']['lock']['driver']);
if (is_a($locks, 'PEAR_Error')) {
Horde::logMessage($locks, __FILE__, __LINE__, PEAR_LOG_ERR);
return 500;
return false;
}
- require_once 'Horde/Lock.php';
- $locks = &Horde_Lock::singleton($GLOBALS['conf']['lock']['driver']);
+ $locks = Horde_Lock::singleton($GLOBALS['conf']['lock']['driver']);
if (is_a($locks, 'PEAR_Error')) {
Horde::logMessage($locks, __FILE__, __LINE__, PEAR_LOG_ERR);
return false;
<?php
/**
- * The Horde_RPC_xmlrpc class provides an XMLRPC implementation of the
+ * The Horde_Rpc_xmlrpc class provides an XMLRPC implementation of the
* Horde RPC system.
*
- * $Horde: framework/RPC/RPC/xmlrpc.php,v 1.24 2009/01/06 17:49:38 jan Exp $
- *
* Copyright 2002-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
*
* @author Jan Schneider <jan@horde.org>
* @since Horde 3.0
- * @package Horde_RPC
+ * @package Horde_Rpc
*/
-class Horde_RPC_xmlrpc extends Horde_RPC {
-
+class Horde_Rpc_Xmlrpc extends Horde_Rpc
+{
/**
* Resource handler for the XMLRPC server.
*
*
* @access private
*/
- function Horde_RPC_xmlrpc()
+ public function __construct()
{
- parent::Horde_RPC();
+ parent::__construct();
$this->_server = xmlrpc_server_create();
foreach ($GLOBALS['registry']->listMethods() as $method) {
- xmlrpc_server_register_method($this->_server, str_replace('/', '.', $method), array('Horde_RPC_xmlrpc', '_dispatcher'));
+ xmlrpc_server_register_method($this->_server, str_replace('/', '.', $method), array('Horde_Rpc_Xmlrpc', '_dispatcher'));
}
}
$options = array_merge($options, $GLOBALS['conf']['http']['proxy']);
}
- require_once 'HTTP/Request.php';
+ /*@TODO Use Horde_Http_Request */
$http = new HTTP_Request($url, $options);
if (!empty($language)) {
$http->addHeader('Accept-Language', $language);
<name>Rpc</name>
<channel>pear.horde.org</channel>
<summary>Horde RPC API</summary>
- <description>The Horde_RPC:: class provides a common abstracted interface to
+ <description>The Horde_Rpc:: class provides a common abstracted interface to
various remote methods of accessing Horde functionality.
</description>
<lead>
<dir name="Syncml">
<file name="Wbxml.php" role="php" />
</dir> <!-- /lib/Horde/Rpc/Syncml -->
+ <file name="Exception.php" role="php" />
<file name="Jsonrpc.php" role="php" />
<file name="Phpgw.php" role="php" />
<file name="Soap.php" role="php" />
</dependencies>
<phprelease>
<filelist>
- <install name="lib/Horde/Rpc/Syncml/Wbxml.php" as="Horde/Rpc/Syncml/Wbxml.php" />
+ <install name="lib/Horde/Rpc/Exception.php" as="Horde/Rpc/Exception.php" />
<install name="lib/Horde/Rpc/Jsonrpc.php" as="Horde/Rpc/Jsonrpc.php" />
<install name="lib/Horde/Rpc/Phpgw.php" as="Horde/Rpc/Phpgw.php" />
<install name="lib/Horde/Rpc/Soap.php" as="Horde/Rpc/Soap.php" />
+ <install name="lib/Horde/Rpc/Syncml/Wbxml.php" as="Horde/Rpc/Syncml/Wbxml.php" />
<install name="lib/Horde/Rpc/Syncml.php" as="Horde/Rpc/Syncml.php" />
<install name="lib/Horde/Rpc/Webdav.php" as="Horde/Rpc/Webdav.php" />
<install name="lib/Horde/Rpc/Xmlrpc.php" as="Horde/Rpc/Xmlrpc.php" />
<install name="lib/Horde/Rpc.php" as="Horde/Rpc.php" />
</filelist>
</phprelease>
- <changelog>
- <release>
- <version>
- <release>0.0.1</release>
- <api>0.0.1</api>
- </version>
- <stability>
- <release>beta</release>
- <api>beta</api>
- </stability>
- <date>2003-11-25</date>
- <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>Initial release as a Horde package
- </notes>
- </release>
- </changelog>
</package>