1 |
richard.p.wagner |
731 |
<?php |
2 |
richard.p.wagner |
106 |
|
3 |
richard.p.wagner |
731 |
require_once(BACKEND.'config.backend.inc'); |
4 |
richard.p.wagner |
106 |
|
5 |
richard.p.wagner |
731 |
class Node { |
6 |
richard.p.wagner |
106 |
|
7 |
|
|
public $uri; |
8 |
richard.p.wagner |
731 |
public $file_path; |
9 |
richard.p.wagner |
106 |
public $properties; |
10 |
richard.p.wagner |
734 |
public $endpoint; |
11 |
richard.p.wagner |
106 |
|
12 |
|
|
function __construct($uri) { |
13 |
|
|
$this->uri = $uri; |
14 |
richard.p.wagner |
734 |
$this->properties = array(); |
15 |
richard.p.wagner |
731 |
$this->file_path = str_replace( VOSPACE_ROOT.'/', FILE_SYSTEM_ROOT, $uri ); |
16 |
richard.p.wagner |
734 |
$this->endpoint = str_replace( VOSPACE_ROOT.'/', HTTP_ROOT, $uri ); |
17 |
richard.p.wagner |
106 |
} |
18 |
|
|
|
19 |
richard.p.wagner |
731 |
function populateProperties($detail = "min"){ |
20 |
richard.p.wagner |
734 |
// Tells the node to fill in it's properties values. |
21 |
|
|
// File or directory had better exist! |
22 |
richard.p.wagner |
731 |
global $provided_properties; |
23 |
|
|
$f_stats = stat($this->file_path); |
24 |
|
|
$this->properties = $provided_properties; |
25 |
|
|
$this->properties[0]["_"] = $f_stats["size"]; |
26 |
|
|
$this->properties[1]["_"] = DATA_OWNER; |
27 |
|
|
$this->properties[2]["_"] = $f_stats["mtime"]; |
28 |
|
|
$this->properties[3]["_"] = $f_stats["ctime"]; |
29 |
richard.p.wagner |
106 |
} |
30 |
|
|
|
31 |
|
|
function exists(){ |
32 |
richard.p.wagner |
731 |
if( file_exists( $this->file_path ) ) |
33 |
richard.p.wagner |
106 |
return True; |
34 |
|
|
return False; |
35 |
|
|
} |
36 |
|
|
|
37 |
richard.p.wagner |
734 |
function getView(){ |
38 |
|
|
return array('uri' => 'ivo://net.ivoa.vospace/views#identity', |
39 |
|
|
'original'=>True); |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
function getProtocols(){ |
43 |
|
|
return array('endpoint' => $this->endpoint, |
44 |
|
|
'uri' => 'ivo://net.ivoa.vospace/protocols#http-client'); |
45 |
|
|
} |
46 |
richard.p.wagner |
106 |
} |
47 |
|
|
|
48 |
|
|
?> |