<?php

require_once 'Site/exceptions/SiteNotFoundException.php';
require_once 'Site/layouts/SiteXMLRPCServerLayout.php';
require_once 'Site/SitePageFactory.php';

/**
 * @package   Site
 * @copyright 2006 silverorange
 */
class SiteXMLRPCServerFactory extends SitePageFactory
{
	// {{{ public function __construct()

	public function __construct()
	{
		$this->class_map['Site'] = 'Site/pages';
	}

	// }}}
	// {{{ public function resolvePage()

	public function resolvePage(SiteWebApplication $app, $source)
	{
		$layout = $this->resolveLayout($app, $source);
		$map = $this->getPageMap();

		if (isset($map[$source])) {
			$class = $map[$source];
			$params = array($app, $layout);
			$page = $this->instantiatePage($app, $class, $params);
			return $page;
		}

		throw new SiteNotFoundException();
	}

	// }}}
	// {{{ protected function getPageMap()

	protected function getPageMap()
	{
		return array(
			'upload-status' => 'SiteUploadStatusServer',
		);
	}

	// }}}
	// {{{ protected function resolveLayout()

	protected function resolveLayout($app, $source)
	{
		return new SiteXMLRPCServerLayout($app);
	}

	// }}}
}

?>

<?php

require_once 'Site/exceptions/SiteNotFoundException.php';
require_once 'Site/layouts/SiteXMLRPCServerLayout.php';
require_once 'Site/SitePageFactory.php';

/**
 * @package   Site
 * @copyright 2006-2008 silverorange
 */
class SiteXMLRPCServerFactory extends SitePageFactory
{
	// {{{ public function get()

	public function ($source, SiteLayout $layout = null)
	{
		$layout = ($layout === null) ? $this->getLayout($source) : $layout;
		$map = $this->getPageMap();

		if (!isset($map[$source])) {
			throw new SiteNotFoundException();
		}

		$class = $map[$source];
		return $this->getPage($class, $layout);
	}

	// }}}
	// {{{ protected function getPageMap()

	protected function getPageMap()
	{
		return array(
			'upload-status' => 'SiteUploadStatusServer',
		);
	}

	// }}}
	// {{{ protected function getLayout()

	protected function getLayout($source)
	{
		return new SiteXMLRPCServerLayout($this->app);
	}

	// }}}
}

?>

Update XMLRPC page factory to new page factory API.
Update XMLRPC page factory to new page factory API.

svn commit r35170
