--- nfo/php/libs/org.netfrag.glib/DataSource/Generic.php 2003/04/06 04:46:33 1.15 +++ nfo/php/libs/org.netfrag.glib/DataSource/Generic.php 2003/04/08 17:55:20 1.16 @@ -12,9 +12,14 @@ * Cvs-Log: * *
- * $Id: Generic.php,v 1.15 2003/04/06 04:46:33 joko Exp $
+ * $Id: Generic.php,v 1.16 2003/04/08 17:55:20 joko Exp $
  *
  * $Log: Generic.php,v $
+ * Revision 1.16  2003/04/08 17:55:20  joko
+ * CHANGE: renamed property 'datasource' to 'transport'
+ * NEW: new case 'method' in 'function datasource_handler_buildoptions'
+ * minor fixes: updated logging/debugging messages
+ *
  * Revision 1.15  2003/04/06 04:46:33  joko
  * renamed linking function
  * mozilla fixes
@@ -283,7 +288,7 @@
     * other presets.
     *
     * See '_buildLocator' which acts as a dispatcher
-    * depending on $_options[datasource].
+    * depending on $_options[transport].
     * (main dispatching level)
     *
     * The structure of a full blown locator looks like this:
@@ -372,9 +377,9 @@
 	function DataSource_Generic( &$locator, $query ) {
 
 		// copy parameter from query to locator
-		//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[datasource] ), '_');
-		//$this->_locator->_datasource_type = $query[datasource];
-		//$locator[_datasource_type] = $query[datasource];
+		//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[transport] ), '_');
+		//$this->_locator->_datasource_type = $query[transport];
+		//$locator[_datasource_type] = $query[transport];
 		
       /**
        * 
@@ -384,7 +389,7 @@
        */
 
 		// build master locator
-		$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) );
+		$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[transport] ) );
 		//exit;
 		//$this->_locator = php::mkComponent('DataSource::Locator');
 		
@@ -421,9 +426,9 @@
     // pre-flight: check locator metadata
       //$locator->build();
       if (!$this->_locator->check()) {
-        user_error("locator-check failed.");
-        exit;
-         //return;
+        user_error("DataSource::Generic: locator-check failed." . "
" . "Locator was: " . Dumper($this->_locator) ); + //exit; + return; } //exit; @@ -495,7 +500,7 @@ break; default: - user_error("DataSource::GenericDataSource: no Adapter could be selected!"); + user_error("DataSource::Generic: no Adapter could be selected!"); break; } @@ -700,7 +705,7 @@ case 'objects': if (!$this->_query[classname]) { $msg = "_query[vartype] == 'objects' requires _query[classname]"; - user_error("GenericDataSource::query_data() - failed: " . $msg); + user_error("DataSource::Generic: query_data() - failed: " . $msg); } array_push($args, $this->_query[classname]); break; @@ -711,7 +716,7 @@ case 'list': if (!$this->_query[classname]) { $msg = "_query[vartype] == 'objects' requires _query[classname]"; - user_error("GenericDataSource::query_data() - failed: " . $msg); + user_error("DataSource::Generic: query_data() - failed: " . $msg); } //array_push($query_args, $this->_query[classname]); $query_args[classname] = $this->_query[classname]; @@ -719,7 +724,7 @@ case 'item': if (!$this->_query[classname]) { $msg = "_query[vartype] == 'objects' requires _query[classname]"; - user_error("GenericDataSource::query_data() - failed: " . $msg); + user_error("DataSource::Generic: query_data() - failed: " . $msg); } $query_args[guid] = $this->_query[ident]; $query_args[classname] = $this->_query[classname]; @@ -741,8 +746,18 @@ $command = 'querySchema'; $args = array( $this->_query[filter] ); break; + + // remoteMethod + case 'method': + $command = $this->_query[method]; + $args = $this->_query[args]; + break; + } + + // FIXME: bad behaviour? + if (!is_array($args)) { $args = array( $args ); } /* $this->_query[rpc_command] = $command; @@ -787,7 +802,7 @@ // pre-flight checks if (!$call[method]) { $msg = "Remote method is empty, please pass in proper metadata or check configuration."; - user_error("GenericDataSource::query_data() - failed: " . $msg); + user_error("DataSource::Generic: query_data() - failed: " . $msg); return; }