/[volute]/trunk/projects/grid/vospace/php_endpoint/backends/file_system/vospace.php
ViewVC logotype

Annotation of /trunk/projects/grid/vospace/php_endpoint/backends/file_system/vospace.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 734 - (hide annotations)
Tue Aug 19 19:37:17 2008 UTC (12 years, 5 months ago) by richard.p.wagner
File size: 1728 byte(s)
working on listing nodes
1 richard.p.wagner 734 <?php
2    
3     require_once(BACKEND.'config.backend.inc');
4     require_once(BACKEND.'properties.php');
5     require_once(BACKEND.'node.php');
6    
7     class VOSpace {
8    
9     function getProperties(){
10     global $provided_properties;
11     return array('accepts' => null,
12     'provides' => $provided_properties,
13     'contains' => null);
14     }
15    
16     function listNodes($node_request) {
17    
18     // get uri to list
19     // need to parse this for cleanliness at some point
20     // (trailing slashes, etc.)
21     $uri = $node_request['nodes'][0]['uri'];
22    
23     $token=null;
24     $limit=False;
25     $detail='min';
26    
27     if(array_key_exists('token', $node_request))
28     $token = $node_request['token'];
29     if(array_key_exists('limit', $node_request))
30     $token = $node_request['limit'];
31     if(array_key_exists('detail', $node_request))
32     $token = $node_request['detail'];
33    
34     // Null for nodes indicates path not found
35     $node_list = array('nodes' => Null,
36     'detail' => $detail);
37    
38     $dir_path = str_replace( VOSPACE_ROOT, FILE_SYSTEM_ROOT, $uri );
39     // $node_list['dir'] = $dir_path;
40     // $node_list['uri'] = $uri;
41     // $node_list['req'] = $node_request;
42    
43     if ($handle = opendir($dir_path)) {
44     // empty array for nodes indicates path found,
45     // but no child nodes
46     $node_list['nodes'] = array();
47     $i = 0;
48     while (false !== ($file = readdir($handle))) {
49     if ($file != "." && $file != ".." && $file != ".svn") {
50    
51     $node_uri = str_replace( FILE_SYSTEM_ROOT, VOSPACE_ROOT.'/', $file);
52    
53     $node_list['nodes'][$i++] = &new Node($node_uri);
54     if($detail != 'min')
55     $node_list['nodes'][$i]->populateProperties();
56     }
57     }
58     closedir($handle);
59     }
60    
61     return $node_list;
62     }
63     }
64    
65     ?>

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26