[xoops-cvslog 3369] CVS update: xoops2jp/html/class

Back to archive index

Minahito minah****@users*****
2006年 6月 27日 (火) 15:42:19 JST


Index: xoops2jp/html/class/XCube_ServiceManager.class.php
diff -u xoops2jp/html/class/XCube_ServiceManager.class.php:1.1.2.1 xoops2jp/html/class/XCube_ServiceManager.class.php:1.1.2.2
--- xoops2jp/html/class/XCube_ServiceManager.class.php:1.1.2.1	Tue Nov  8 18:52:22 2005
+++ xoops2jp/html/class/XCube_ServiceManager.class.php	Tue Jun 27 15:42:19 2006
@@ -1,28 +1,104 @@
 <?php
 
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_Delegate.class.php";
+
+/**
+ * This class manages XCube_Service instances, searches these, creates a much
+ * client instance. Now, the purpose of this class is for inside of own XOOPS
+ * site. In other words, this class doesn't work for publishing web services.
+ * About these separated working, the core team shall examine.
+ * 
+ * XCube namespace can't contain the SOAP library directly. Delegate mechanism
+ * is good for this class. This class create client instance which to connect
+ * to a service, with following the kind of the service. For example, if the
+ * specified service is really web service, SOAP client has to be created. But,
+ * if the service is a virtual service of XCube, virtual client has to be
+ * created.
+ */
 class XCube_ServiceManager
 {
-	var $mServices=array();
+	/**
+	 * Array of XCube_Service instances.
+	 * 
+	 * @var Array
+	 */
+	var $mServices = array();
+	
+	/**
+	 * @var XCube_Delegate
+	 * @param &$client
+	 * @param $service
+	 */
+	var $mCreateClient = null;
 	
 	function XCube_ServiceManager()
 	{
+		$this->mCreateClient =& new XCube_NewDelegate();
+		$this->mCreateClient->register("XCube_ServiceManager.CreateClient");
 	}
 	
-	function addXCubeService($name,&$service)
+	/**
+	 * Add service object. $name must be unique in the list of service. If the 
+	 * service which has the same name, is a member of the list, return false.
+	 * 
+	 * @param $name string
+	 * @param $service XCube_Service
+	 * @return bool
+	 */
+	function addService($name, &$service)
 	{
-		$this->mServices[$name]=&$service;
+		$this->mServices[$name] =& $service;
 	}
 	
-	function &searchXCubeService($name)
+	/**
+	 * This member function will be removed at beta version.
+	 * 
+	 * @deprecated
+	 * @see XCube_ServiceManager::addService()
+	 */
+	function addXCubeService($name, &$service)
 	{
-		$ret =null;
+		return $this->addService($name, $service);
+	}
+	
+	function &getService($name)
+	{
+		$ret = null;
 
-		if(isset($this->mServices[$name]))
+		if (isset($this->mServices[$name])) {
 			return $this->mServices[$name];
+		}
 
 		return $ret;
 	}
-}
+	
+	/**
+	 * This member function will be removed at beta version.
+	 * 
+	 * @deprecated
+	 * @see XCube_ServiceManager::getService()
+	 */
+	function &searchXCubeService($name)
+	{
+		return $this->getService($name);
+	}
 
+	/**
+	 * Create client instance which to connect to a service, with following the
+	 * kind of the service. Then return that instance. For example, if the
+	 * specified service is really web service, SOAP client has to be created.
+	 * But, if the service is a virtual service of XCube, virtual client has to
+	 * be created.
+	 */
+	function &createClient(&$service)
+	{
+		$client = null;
+		$this->mCreateClient->call(new XCube_Ref($client), $service);
+		
+		return $client;
+	}
+}
 
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index