/[cvs]/nfo/php/libs/org.netfrag.glib/Data/Lift.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/Data/Lift.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by joko, Mon Mar 3 21:28:11 2003 UTC revision 1.7 by joko, Fri Apr 18 15:48:00 2003 UTC
# Line 1  Line 1 
1  <?  <?
2    /**
3     * This file contains the Data::Lift component.
4     *
5     * @author Andreas Motl <andreas.motl@ilo.de>
6     * @package org.netfrag.glib
7     * @name Data::Lift
8     *
9     */
10    
11  //    -------------------------------------------------------------------------  //    -------------------------------------------------------------------------
12  //    $Id$  //    $Id$
13  //    -------------------------------------------------------------------------  //    -------------------------------------------------------------------------
14  //    $Log$  //    $Log$
15    //    Revision 1.7  2003/04/18 15:48:00  joko
16    //    better error handling: a) croak messages, b) just perform lift module if instance could be created
17    //
18    //    Revision 1.6  2003/03/09 15:49:20  joko
19    //    fix towards optimizing autodocumentation:
20    //    enriched with metadata to tell autodia how to build object-relationships by discarding the fancy namespacing stuff there
21    //
22    //    Revision 1.5  2003/03/08 20:04:59  root
23    //    + optimized comments for Autodia
24    //
25    //    Revision 1.4  2003/03/08 18:22:23  joko
26    //    updated comments: now in phpDocumentor style
27    //
28  //    Revision 1.3  2003/03/03 21:28:11  joko  //    Revision 1.3  2003/03/03 21:28:11  joko
29  //    updated comments  //    updated comments
30  //  //
# Line 17  Line 39 
39  //    -------------------------------------------------------------------------  //    -------------------------------------------------------------------------
40    
41    
 //    Data::Lift  -  Pass data around between various "actors".  
 //  
 //    These "actors" are kinda plugin-modules  
 //    lying at "locations" and actually mungle the data.  
 //  
 //    "Locations" are by now:  
 //      x local filesystem  
 //      o remote anything  
 //  
 //    The "actors" require (by now) to be native php classes  
 //    having a method "perform". Please have a look at others  
 //    lying in the Data::Lift namespace at org.netfrag.glib to  
 //    get a picture of how to implement own "actors".  
 //  
 //    @url: http://cvs.netfrag.org/php/libs/org.netfrag.glib  
 //  
 //    TODO:  
 //      o refactor Data::Deep to a plugin module  
 //      o refactor Data::Encode to a plugin module  
 //      o combine Data::Lift and Data::Container somehow  
 //      o integrate with Data::Driver somehow  --  proposal:  
 //          $lift = new Data::Lift($locator);  
 //          $lift->perform();     // talks to a Data::Driver  
 //  
42    
43    
44    /**
45     * --- Data::Lift
46     *
47     * <pre>
48     *    Data::Lift  -  Pass data around between various "actors".
49     *
50     *    These "actors" are kinda plugin-modules
51     *    lying at "locations" and actually mungle the data.
52     *
53     *    "Locations" are by now:
54     *      x local filesystem
55     *      o remote anything
56     *
57     *    The "actors" require (by now) to be native php classes
58     *    having a method "perform". Please have a look at others
59     *    lying in the Data::Lift namespace at org.netfrag.glib to
60     *    get a picture of how to implement own "actors".
61     * </pre>
62     *
63     *
64     * @author Andreas Motl <andreas.motl@ilo.de>
65     * @copyright (c) 2003 - All Rights reserved.
66     * @license GNU LGPL (GNU Lesser General Public License)
67     *
68     * @link http://www.netfrag.org/~joko/
69     * @link http://www.gnu.org/licenses/lgpl.txt
70     *
71     * @package org.netfrag.glib
72     * @subpackage DataLift
73     * @name Data::Lift
74     *
75     * @link http://cvs.netfrag.org/php/libs/org.netfrag.glib
76     *
77     *
78     * @todo refactor Data::Deep to a plugin module
79     * @todo refactor Data::Encode to a plugin module
80     * @todo combine Data::Lift and Data::Container somehow
81     * @todo integrate with Data::Driver somehow  --  proposal:
82     *         //  $lift = ne w Data::Lift($locator);
83     *         //  $lift->perform();     // talks to a Data::Driver
84     *
85     *
86     */
87  class Data_Lift {  class Data_Lift {
88      
89      /**
90       * this is to trick Autodia let understanding "namespaces" in php
91       * unless the pattern can be tweaked by mode (namespace=0|1)
92       * // $this = ne w Data::Lift(&$payload, $options = array());
93       */
94    
95    var $dblocations;    var $dblocations;
96    var $actor;    var $actor;
97      var $actor_instance;
98    
99    var $payload;    var $payload;
100    var $vartype;    var $vartype;
# Line 101  class Data_Lift { Line 149  class Data_Lift {
149      //print "metatype: " . $this->metatype . "<br>";      //print "metatype: " . $this->metatype . "<br>";
150            
151      if (!$good) {      if (!$good) {
152        print "Data::Lift cannot handle this payload: ";        $msg = "Data::Lift cannot handle this payload: ";
153        print "(vartype=" . $this->vartype . ", metatype=" . $this->metatype . ")<br/>";        $msg .= "[vartype=" . $this->vartype . ", metatype=" . $this->metatype . "]<br/>";
154        print Dumper($this->payload);        $msg .= "payload: '" . Dumper($this->payload) . "'";
155          user_error($msg);
156      }      }
157            
158    }    }
# Line 136  class Data_Lift { Line 185  class Data_Lift {
185    function &_perform_actor() {    function &_perform_actor() {
186      //$actor_file = join('/', $this->actor) . '.php';      //$actor_file = join('/', $this->actor) . '.php';
187      //include($actor_file);      //include($actor_file);
188    
189        /**
190         * <!-- Autodia -->
191         * can do: (this is metadata supplied for Autodia, don't delete!)
192         *  $this->_actor_instance = new Data_Lift_hash_job_html()
193         *  $this->_actor_instance = new Data_Lift_hash_tree_PEAR_Tree()
194         *  $this->_actor_instance = new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu()
195         *  $this->_actor_instance = new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu_DHTML()
196         *  $this->_actor_instance = new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu_Listbox()
197         *
198         */
199    
200      $actor_name = 'Data/Lift/' . join('/', $this->actor);      $actor_name = 'Data/Lift/' . join('/', $this->actor);
201        //$actor_name = 'Data::Lift::' . join('::', $this->actor);
202    
203        //$actor_object = mkObject($actor_name);
204        //return $actor_object->perform($this->payload);
205        
206        // fix [2003-04-13]: just perform if instance good
207        //if ($actor_object = php::mkComponent($actor_name)) {
208      $actor_object = mkObject($actor_name);      $actor_object = mkObject($actor_name);
209      return $actor_object->perform($this->payload);      if (is_object($actor_object) && method_exists($actor_object, 'perform')) {
210          return $actor_object->perform($this->payload);
211        } else {
212          user_error("Data::Lift could not call method 'perform' on actor object. [actor_name='$actor_name']");
213          //return array();
214        }
215        
216    }    }
217    
218    function get() {    function get() {
# Line 151  class Data_Lift { Line 225  class Data_Lift {
225    
226  }  }
227    
 ?>  
228    ?>

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.7

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed