From 0e12d563f7adbcbb063131a32d813608e08fdf80 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 14 May 2007 02:04:58 +0000 Subject: cleaned up TFeedService. --- framework/Web/Services/IFeedContentProvider.php | 7 --- framework/Web/Services/TFeedService.php | 76 +++++++++---------------- framework/Web/Services/TSoapService.php | 2 +- 3 files changed, 29 insertions(+), 56 deletions(-) delete mode 100644 framework/Web/Services/IFeedContentProvider.php (limited to 'framework/Web/Services') diff --git a/framework/Web/Services/IFeedContentProvider.php b/framework/Web/Services/IFeedContentProvider.php deleted file mode 100644 index 0ba972f6..00000000 --- a/framework/Web/Services/IFeedContentProvider.php +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/framework/Web/Services/TFeedService.php b/framework/Web/Services/TFeedService.php index e1f38f04..00a251a7 100644 --- a/framework/Web/Services/TFeedService.php +++ b/framework/Web/Services/TFeedService.php @@ -5,8 +5,9 @@ * @author Qiang Xue * @author Knut Urdalen * @link http://www.pradosoft.com - * @copyright Copyright © 2006 PradoSoft + * @copyright Copyright © 2006-2007 PradoSoft * @license http://www.pradosoft.com/license/ + * @version $Id$ * @package System.Web.Services */ @@ -15,23 +16,25 @@ * * TFeedService provides to end-users feed content. * - * TFeedService manages a set of {@link TFeed}, each representing specific feed content. - * The service parameter, referring to the ID of the feed, specifies - * which feed content to be provided to end-users. + * TFeedService manages a set of feeds. The service parameter, referring + * to the ID of the feed, specifies which feed content to be provided to end-users. * * To use TFeedService, configure it in application configuration as follows, * - * + * * * * * * - * where each feed is specified via a <feed> element. Initial property - * values can be configured in a <feed> element. + * where each <feed> element specifies a feed identified by its "id" value (case-sensitive). + * The class attribute indicates which PHP class will provide the actual feed + * content. Note, the class must implement {@link IFeedContentProvider} interface. + * Other initial properties for the feed class may also be specified in the + * corresponding <feed> element. * - * To retrieve the feed content provided by "ch2", use the URL - * index.php?feed=ch2 + * To retrieve the feed content identified by "ch2", use the URL + * /path/to/index.php?feed=ch2 * * @author Qiang Xue * @author Knut Urdalen @@ -51,7 +54,7 @@ class TFeedService extends TService { foreach($config->getElementsByTagName('feed') as $feed) { - if(($id=$feed->getAttribute('id'))!==null) + if(($id=$feed->getAttributes()->removeAttribute('id'))!==null) $this->_feeds[$id]=$feed; else throw new TConfigurationException('feedservice_id_required'); @@ -80,7 +83,7 @@ class TFeedService extends TService if(($class=$properties->remove('class'))!==null) { $feed=Prado::createComponent($class); - if($feed instanceof TFeed) + if($feed instanceof IFeedContentProvider) { // init feed properties foreach($properties as $name=>$value) @@ -104,53 +107,30 @@ class TFeedService extends TService } /** - * TFeed class. - * - * TFeed is the base class for all feed provider classes. + * IFeedContentProvider interface. * - * Derived classes should override {@link getFeedContent()} to return - * an XML string that represents the feed content. + * IFeedContentProvider interface must be implemented by a feed class who + * provides feed content. * * @author Qiang Xue - * @version $Id$ - * @package System.Services + * @author Knut Urdalen + * @package System.Web.Services * @since 3.1 */ -abstract class TFeed extends TApplicationComponent +interface IFeedContentProvider { - private $_id=''; - - /** - * Initializes the feed. - * @param TXmlElement configurations specified in {@link TFeedService}. - */ - public function init($config) - { - } - /** - * @return string ID of this feed + * Initializes the feed content provider. + * This method is invoked (before {@link getFeedContent}) + * when the feed provider is requested by a user. + * @param TXmlElement configurations specified within the <feed> element + * corresponding to this feed provider when configuring {@link TFeedService}. */ - public function getID() - { - return $this->_id; - } - + public function init($config); /** - * @param string ID of this feed + * @return string feed content in proper XML format */ - public function setID($value) - { - $this->_id=$value; - } - - /** - * @return string an XML string representing the feed content - */ - public function getFeedContent() - { - return ''; - } + public function getFeedContent(); } ?> \ No newline at end of file diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php index e598d796..e2f91df2 100644 --- a/framework/Web/Services/TSoapService.php +++ b/framework/Web/Services/TSoapService.php @@ -5,7 +5,7 @@ * @author Knut Urdalen * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft + * @copyright Copyright © 2006-2007 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.Services -- cgit v1.2.3