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

Annotation of /trunk/projects/grid/vospace/php_endpoint/vospace_service.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 738 - (hide annotations)
Thu Aug 21 21:45:51 2008 UTC (13 years, 1 month ago) by richard.p.wagner
File size: 3637 byte(s)
added simple authorization mechanism
1 richard.p.wagner 106 <?php
2    
3 richard.p.wagner 731 require_once('config.inc');
4 richard.p.wagner 106
5 richard.p.wagner 108 require_once(BACKEND.'node.php');
6 richard.p.wagner 734 require_once(BACKEND.'vospace.php');
7 richard.p.wagner 106
8 richard.p.wagner 735
9 richard.p.wagner 106 class VOSpaceService {
10    
11 richard.p.wagner 738 private $vospace;
12    
13     function __construct(){
14     $this->vospace = new VOSpace();
15     }
16    
17 richard.p.wagner 735 function GetViews($message){
18 richard.p.wagner 738 if($this->vospace->getAuthorization('GetViews') == False){
19     throw new SoapFault("Server", "Permission denied.", " ",
20     array(), "PermissionDenied");
21     }
22    
23     $views = $this->vospace->getViews();
24 richard.p.wagner 735 return $views;
25 richard.p.wagner 106 }
26    
27 richard.p.wagner 737 function GetProtocols($message){
28 richard.p.wagner 738 if($this->vospace->getAuthorization('GetProtocols') == False){
29     throw new SoapFault("Server", "Permission denied.", " ",
30     array(), "PermissionDenied");
31     }
32    
33     $protocols = $this->vospace->getProtocols();
34 richard.p.wagner 735 return $protocols;
35 richard.p.wagner 106 }
36    
37 richard.p.wagner 528 function GetProperties(){
38 richard.p.wagner 738 if($this->vospace->getAuthorization('GetProperties') == False){
39     throw new SoapFault("Server", "Permission denied.", " ",
40     array(), "PermissionDenied");
41     }
42    
43     $properties = $this->vospace->getProperties();
44 richard.p.wagner 734 return $properties;
45 richard.p.wagner 106 }
46    
47     function CreateNode($message)
48     {
49    
50     return $data;
51    
52     }
53    
54     function DeleteNode($message)
55     {
56    
57     return $data;
58    
59     }
60    
61     function MoveNode($message)
62     {
63    
64 richard.p.wagner 730 return $data;
65 richard.p.wagner 106
66     }
67    
68     function CopyNode($message)
69     {
70    
71    
72 richard.p.wagner 730 return $data;
73 richard.p.wagner 106
74     }
75    
76     function GetNode($target)
77     {
78 richard.p.wagner 738 if($this->vospace->getAuthorization('GetNode') == False){
79     throw new SoapFault("Server", "Permission denied.", " ",
80     array(), "PermissionDenied");
81     }
82 richard.p.wagner 106
83     $node = new Node($target->target);
84    
85     if(!$node->exists()){
86     $bad_target = $target->target;
87     throw new SoapFault("Server", "Node not found.", " ",
88     array("uri" => $bad_target),
89     "NodeNotFoundFault");
90     }
91    
92 richard.p.wagner 731 $node->populateProperties();
93 richard.p.wagner 106 return array('node' => $node);
94     }
95    
96     function SetNode($message)
97     {
98    
99    
100     return $data;
101    
102     }
103    
104 richard.p.wagner 735 function ListNodes($node_list_req){
105    
106 richard.p.wagner 738 if($this->vospace->getAuthorization('ListNodes') == False){
107     throw new SoapFault("Server", "Permission denied.", " ",
108     array(), "PermissionDenied");
109     }
110    
111 richard.p.wagner 735 // error_log(var_export($node_list_req, True), 3, "/var/tmp/my-errors.log");
112 richard.p.wagner 738 $node_list = $this->vospace->listNodes($node_list_req->request);
113 richard.p.wagner 735
114     if($node_list['nodes'] == Null){
115     throw new SoapFault("Server", "Node not found.", " ",
116     array("uri" => $node_list_req->request->nodes->node->uri),
117     "NodeNotFoundFault");
118     }
119    
120     return array('response' => $node_list);
121 richard.p.wagner 106 }
122 richard.p.wagner 734
123 richard.p.wagner 106 function FindNodes($message)
124     {
125    
126     return $data;
127    
128     }
129    
130     function PushToVoSpace($message)
131     {
132    
133     return $data;
134    
135     }
136    
137     function PullToVoSpace($message)
138     {
139    
140     return $data;
141    
142     }
143    
144 richard.p.wagner 731 function PullFromVoSpace($request)
145 richard.p.wagner 106 {
146 richard.p.wagner 738 if($this->vospace->getAuthorization('PullFromVoSpace') == False){
147     throw new SoapFault("Server", "Permission denied.", " ",
148     array(), "PermissionDenied");
149     }
150    
151 richard.p.wagner 731 $node = new Node($request->source);
152    
153     if(!$node->exists()){
154     $bad_target = $request->source;
155     throw new SoapFault("Server", "Node not found.", " ",
156     array("uri" => $bad_target),
157     "NodeNotFoundFault");
158     }
159 richard.p.wagner 106
160 richard.p.wagner 731 $view = $node->getView();
161     $protocols = $node->getProtocols();
162 richard.p.wagner 106
163 richard.p.wagner 734 // transfer element, with at least a view and protocol element
164     $response = array('transfer'=>
165     array('view' => $view,
166     'protocol' => $protocols));
167 richard.p.wagner 731
168     return $response;
169 richard.p.wagner 106 }
170    
171     function PushFromVoSpace($message){
172 richard.p.wagner 735 throw new SoapFault("Server", "Not implemented.", " ",
173 richard.p.wagner 738 array(), "InternalFault");
174 richard.p.wagner 106 }
175    
176 richard.p.wagner 738 function Security( $wsse_header ){
177     $this->vospace->getAuthInfo($wsse_header);
178 richard.p.wagner 737 }
179 richard.p.wagner 106 }
180    
181     ?>

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