View Javadoc

1   package fr.in2p3.jsaga.impl.namespace;
2   
3   import fr.in2p3.jsaga.adaptor.data.DataAdaptor;
4   import org.ogf.saga.error.*;
5   import org.ogf.saga.namespace.NSDirectory;
6   import org.ogf.saga.namespace.NSEntry;
7   import org.ogf.saga.session.Session;
8   import org.ogf.saga.task.TaskMode;
9   import org.ogf.saga.url.URL;
10  
11  import java.util.List;
12  
13  /* ***************************************************
14  * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
15  * ***             http://cc.in2p3.fr/             ***
16  * ***************************************************
17  * File:   AbstractNSDirectoryImpl
18  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
19  * Date:   17 sept. 2007
20  * ***************************************************
21  * Description:                                      */
22  /**
23   *
24   */
25  public abstract class AbstractNSDirectoryImpl extends AbstractAsyncNSDirectoryImpl implements NSDirectory {
26      /** constructor for factory */
27      protected AbstractNSDirectoryImpl(Session session, URL url, DataAdaptor adaptor, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
28          super(session, url, adaptor, flags);
29      }
30  
31      /** constructor for NSDirectory.open() */
32      protected AbstractNSDirectoryImpl(AbstractNSDirectoryImpl dir, URL relativeUrl, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
33          super(dir, relativeUrl, flags);
34      }
35  
36      /** constructor for NSEntry.openAbsolute() */
37      protected AbstractNSDirectoryImpl(AbstractNSEntryImpl entry, String absolutePath, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
38          super(entry, absolutePath, flags);
39      }
40  
41      ////////////////////////////////////////// interface NSDirectory //////////////////////////////////////////
42  
43      public void changeDir(URL dir) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException {
44          // can not hang...
45          super.changeDirSync(dir);
46      }
47  
48      public List<URL> list(String pattern, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException, IncorrectURLException {
49          float timeout = this.getTimeout("list");
50          if (timeout == WAIT_FOREVER) {
51              return super.listSync(pattern, flags);
52          } else {
53              try {
54                  return (List<URL>) getResult(super.list(TaskMode.ASYNC, pattern, flags), timeout);
55              }
56              catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
57              catch (DoesNotExistException e) {throw new NoSuccessException(e);}
58              catch (SagaIOException e) {throw new NoSuccessException(e);}
59          }
60      }
61  
62      public List<URL> list(int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException, IncorrectURLException {
63          float timeout = this.getTimeout("list");
64          if (timeout == WAIT_FOREVER) {
65              return super.listSync(flags);
66          } else {
67              try {
68                  return (List<URL>) getResult(super.list(TaskMode.ASYNC, flags), timeout);
69              }
70              catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
71              catch (DoesNotExistException e) {throw new NoSuccessException(e);}
72              catch (SagaIOException e) {throw new NoSuccessException(e);}
73          }
74      }
75  
76      public List<URL> list(String pattern) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException, IncorrectURLException {
77          float timeout = this.getTimeout("list");
78          if (timeout == WAIT_FOREVER) {
79              return super.listSync(pattern);
80          } else {
81              try {
82                  return (List<URL>) getResult(super.list(TaskMode.ASYNC, pattern), timeout);
83              }
84              catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
85              catch (DoesNotExistException e) {throw new NoSuccessException(e);}
86              catch (SagaIOException e) {throw new NoSuccessException(e);}
87          }
88      }
89  
90      public List<URL> list() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException, IncorrectURLException {
91          float timeout = this.getTimeout("list");
92          if (timeout == WAIT_FOREVER) {
93              return super.listSync();
94          } else {
95              try {
96                  return (List<URL>) getResult(super.list(TaskMode.ASYNC), timeout);
97              }
98              catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
99              catch (DoesNotExistException e) {throw new NoSuccessException(e);}
100             catch (SagaIOException e) {throw new NoSuccessException(e);}
101         }
102     }
103 
104     public List<URL> find(String pattern, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
105         float timeout = this.getTimeout("find");
106         if (timeout == WAIT_FOREVER) {
107             return super.findSync(pattern, flags);
108         } else {
109             try {
110                 return (List<URL>) getResult(super.find(TaskMode.ASYNC, pattern, flags), timeout);
111             }
112             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
113             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
114             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
115             catch (SagaIOException e) {throw new NoSuccessException(e);}
116         }
117     }
118 
119     public List<URL> find(String pattern) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
120         float timeout = this.getTimeout("find");
121         if (timeout == WAIT_FOREVER) {
122             return super.findSync(pattern);
123         } else {
124             try {
125                 return (List<URL>) getResult(super.find(TaskMode.ASYNC, pattern), timeout);
126             }
127             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
128             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
129             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
130             catch (SagaIOException e) {throw new NoSuccessException(e);}
131         }
132     }
133 
134     public boolean exists(URL name) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
135         float timeout = this.getTimeout("exists");
136         if (timeout == WAIT_FOREVER) {
137             return super.existsSync(name);
138         } else {
139             try {
140                 return (Boolean) getResult(super.exists(TaskMode.ASYNC, name), timeout);
141             }
142             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
143             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
144             catch (SagaIOException e) {throw new NoSuccessException(e);}
145         }
146     }
147 
148     public long getMTime(URL name) throws NotImplementedException, IncorrectURLException, DoesNotExistException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
149         float timeout = this.getTimeout("getMTime");
150         if (timeout == WAIT_FOREVER) {
151             return super.getMTimeSync(name);
152         } else {
153             try {
154                 return (Long) getResult(super.getMTime(TaskMode.ASYNC, name), timeout);
155             }
156             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
157             catch (SagaIOException e) {throw new NoSuccessException(e);}
158         }
159     }
160 
161     public boolean isDir(URL name) throws NotImplementedException, IncorrectURLException, DoesNotExistException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
162         float timeout = this.getTimeout("isDir");
163         if (timeout == WAIT_FOREVER) {
164             return super.isDirSync(name);
165         } else {
166             try {
167                 return (Boolean) getResult(super.isDir(TaskMode.ASYNC, name), timeout);
168             }
169             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
170             catch (SagaIOException e) {throw new NoSuccessException(e);}
171         }
172     }
173 
174     public boolean isEntry(URL name) throws NotImplementedException, IncorrectURLException, DoesNotExistException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
175         float timeout = this.getTimeout("isEntry");
176         if (timeout == WAIT_FOREVER) {
177             return super.isEntrySync(name);
178         } else {
179             try {
180                 return (Boolean) getResult(super.isEntry(TaskMode.ASYNC, name), timeout);
181             }
182             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
183             catch (SagaIOException e) {throw new NoSuccessException(e);}
184         }
185     }
186 
187     public boolean isLink(URL name) throws NotImplementedException, IncorrectURLException, DoesNotExistException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
188         float timeout = this.getTimeout("isLink");
189         if (timeout == WAIT_FOREVER) {
190             return super.isLinkSync(name);
191         } else {
192             try {
193                 return (Boolean) getResult(super.isLink(TaskMode.ASYNC, name), timeout);
194             }
195             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
196             catch (SagaIOException e) {throw new NoSuccessException(e);}
197         }
198     }
199 
200     public URL readLink(URL name) throws NotImplementedException, IncorrectURLException, DoesNotExistException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
201         float timeout = this.getTimeout("readLink");
202         if (timeout == WAIT_FOREVER) {
203             return super.readLinkSync(name);
204         } else {
205             try {
206                 return (URL) getResult(super.readLink(TaskMode.ASYNC, name), timeout);
207             }
208             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
209             catch (SagaIOException e) {throw new NoSuccessException(e);}
210         }
211     }
212 
213     public int getNumEntries() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, TimeoutException, NoSuccessException {
214         float timeout = this.getTimeout("getNumEntries");
215         if (timeout == WAIT_FOREVER) {
216             return super.getNumEntriesSync();
217         } else {
218             try {
219                 return (Integer) getResult(super.getNumEntries(TaskMode.ASYNC), timeout);
220             }
221             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
222             catch (BadParameterException e) {throw new NoSuccessException(e);}
223             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
224             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
225             catch (SagaIOException e) {throw new NoSuccessException(e);}
226         }
227     }
228 
229     public URL getEntry(int entry) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException {
230         float timeout = this.getTimeout("getEntry");
231         if (timeout == WAIT_FOREVER) {
232             return super.getEntrySync(entry);
233         } else {
234             try {
235                 return (URL) getResult(super.getEntry(TaskMode.ASYNC, entry), timeout);
236             }
237             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
238             catch (BadParameterException e) {throw new NoSuccessException(e);}
239             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
240             catch (SagaIOException e) {throw new NoSuccessException(e);}
241         }
242     }
243 
244     public void copy(URL source, URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
245         float timeout = this.getTimeout("copy");
246         if (timeout == WAIT_FOREVER) {
247             super.copySync(source, target, flags);
248         } else {
249             try {
250                 getResult(super.copy(TaskMode.ASYNC, source, target, flags), timeout);
251             }
252             catch (SagaIOException e) {throw new NoSuccessException(e);}
253         }
254     }
255 
256     public void copy(URL source, URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
257         float timeout = this.getTimeout("copy");
258         if (timeout == WAIT_FOREVER) {
259             super.copySync(source, target);
260         } else {
261             try {
262                 getResult(super.copy(TaskMode.ASYNC, source, target), timeout);
263             }
264             catch (SagaIOException e) {throw new NoSuccessException(e);}
265         }
266     }
267 
268     public void copy(String source, URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
269         float timeout = this.getTimeout("copy");
270         if (timeout == WAIT_FOREVER) {
271             super.copySync(source, target, flags);
272         } else {
273             try {
274                 getResult(super.copy(TaskMode.ASYNC, source, target, flags), timeout);
275             }
276             catch (SagaIOException e) {throw new NoSuccessException(e);}
277         }
278     }
279 
280     public void copy(String source, URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
281         float timeout = this.getTimeout("copy");
282         if (timeout == WAIT_FOREVER) {
283             super.copySync(source, target);
284         } else {
285             try {
286                 getResult(super.copy(TaskMode.ASYNC, source, target), timeout);
287             }
288             catch (SagaIOException e) {throw new NoSuccessException(e);}
289         }
290     }
291 
292     public void link(URL source, URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
293         float timeout = this.getTimeout("link");
294         if (timeout == WAIT_FOREVER) {
295             super.linkSync(source, target, flags);
296         } else {
297             try {
298                 getResult(super.link(TaskMode.ASYNC, source, target, flags), timeout);
299             }
300             catch (SagaIOException e) {throw new NoSuccessException(e);}
301         }
302     }
303 
304     public void link(URL source, URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
305         float timeout = this.getTimeout("link");
306         if (timeout == WAIT_FOREVER) {
307             super.linkSync(source, target);
308         } else {
309             try {
310                 getResult(super.link(TaskMode.ASYNC, source, target), timeout);
311             }
312             catch (SagaIOException e) {throw new NoSuccessException(e);}
313         }
314     }
315 
316     public void link(String source, URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
317         float timeout = this.getTimeout("link");
318         if (timeout == WAIT_FOREVER) {
319             super.linkSync(source, target, flags);
320         } else {
321             try {
322                 getResult(super.link(TaskMode.ASYNC, source, target, flags), timeout);
323             }
324             catch (SagaIOException e) {throw new NoSuccessException(e);}
325         }
326     }
327 
328     public void link(String source, URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
329         float timeout = this.getTimeout("link");
330         if (timeout == WAIT_FOREVER) {
331             super.linkSync(source, target);
332         } else {
333             try {
334                 getResult(super.link(TaskMode.ASYNC, source, target), timeout);
335             }
336             catch (SagaIOException e) {throw new NoSuccessException(e);}
337         }
338     }
339 
340     public void move(URL source, URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
341         float timeout = this.getTimeout("move");
342         if (timeout == WAIT_FOREVER) {
343             super.moveSync(source, target, flags);
344         } else {
345             try {
346                 getResult(super.move(TaskMode.ASYNC, source, target, flags), timeout);
347             }
348             catch (SagaIOException e) {throw new NoSuccessException(e);}
349         }
350     }
351 
352     public void move(URL source, URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
353         float timeout = this.getTimeout("move");
354         if (timeout == WAIT_FOREVER) {
355             super.moveSync(source, target);
356         } else {
357             try {
358                 getResult(super.move(TaskMode.ASYNC, source, target), timeout);
359             }
360             catch (SagaIOException e) {throw new NoSuccessException(e);}
361         }
362     }
363 
364     public void move(String source, URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
365         float timeout = this.getTimeout("move");
366         if (timeout == WAIT_FOREVER) {
367             super.moveSync(source, target, flags);
368         } else {
369             try {
370                 getResult(super.move(TaskMode.ASYNC, source, target, flags), timeout);
371             }
372             catch (SagaIOException e) {throw new NoSuccessException(e);}
373         }
374     }
375 
376     public void move(String source, URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
377         float timeout = this.getTimeout("move");
378         if (timeout == WAIT_FOREVER) {
379             super.moveSync(source, target);
380         } else {
381             try {
382                 getResult(super.move(TaskMode.ASYNC, source, target), timeout);
383             }
384             catch (SagaIOException e) {throw new NoSuccessException(e);}
385         }
386     }
387 
388     public void remove(URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException {
389         float timeout = this.getTimeout("remove");
390         if (timeout == WAIT_FOREVER) {
391             super.removeSync(target, flags);
392         } else {
393             try {
394                 getResult(super.remove(TaskMode.ASYNC, target, flags), timeout);
395             }
396             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
397             catch (SagaIOException e) {throw new NoSuccessException(e);}
398         }
399     }
400 
401     public void remove(URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException {
402         float timeout = this.getTimeout("remove");
403         if (timeout == WAIT_FOREVER) {
404             super.removeSync(target);
405         } else {
406             try {
407                 getResult(super.remove(TaskMode.ASYNC, target), timeout);
408             }
409             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
410             catch (SagaIOException e) {throw new NoSuccessException(e);}
411         }
412     }
413 
414     public void remove(String target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException {
415         float timeout = this.getTimeout("remove");
416         if (timeout == WAIT_FOREVER) {
417             super.removeSync(target, flags);
418         } else {
419             try {
420                 getResult(super.remove(TaskMode.ASYNC, target, flags), timeout);
421             }
422             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
423             catch (SagaIOException e) {throw new NoSuccessException(e);}
424         }
425     }
426 
427     public void remove(String target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, IncorrectStateException, DoesNotExistException, TimeoutException, NoSuccessException {
428         float timeout = this.getTimeout("remove");
429         if (timeout == WAIT_FOREVER) {
430             super.removeSync(target);
431         } else {
432             try {
433                 getResult(super.remove(TaskMode.ASYNC, target), timeout);
434             }
435             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
436             catch (SagaIOException e) {throw new NoSuccessException(e);}
437         }
438     }
439 
440     public void makeDir(URL target, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
441         float timeout = this.getTimeout("makeDir");
442         if (timeout == WAIT_FOREVER) {
443             super.makeDirSync(target, flags);
444         } else {
445             try {
446                 getResult(super.makeDir(TaskMode.ASYNC, target, flags), timeout);
447             }
448             catch (SagaIOException e) {throw new NoSuccessException(e);}
449         }
450     }
451 
452     public void makeDir(URL target) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
453         float timeout = this.getTimeout("makeDir");
454         if (timeout == WAIT_FOREVER) {
455             super.makeDirSync(target);
456         } else {
457             try {
458                 getResult(super.makeDir(TaskMode.ASYNC, target), timeout);
459             }
460             catch (SagaIOException e) {throw new NoSuccessException(e);}
461         }
462     }
463 
464     public NSDirectory openDir(URL name, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
465         float timeout = this.getTimeout("openDir");
466         if (timeout == WAIT_FOREVER) {
467             return this.openDir(name, flags);
468         } else {
469             throw new NotImplementedException("Configuring user timeout is not supported for method: openDir");
470         }
471     }
472 
473     public NSDirectory openDir(URL name) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
474         float timeout = this.getTimeout("openDir");
475         if (timeout == WAIT_FOREVER) {
476             return this.openDir(name);
477         } else {
478             throw new NotImplementedException("Configuring user timeout is not supported for method: openDir");
479         }
480     }
481 
482     public NSEntry open(URL name, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
483         float timeout = this.getTimeout("open");
484         if (timeout == WAIT_FOREVER) {
485             return this.open(name, flags);
486         } else {
487             throw new NotImplementedException("Configuring user timeout is not supported for method: open");
488         }
489     }
490 
491     public NSEntry open(URL name) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException {
492         float timeout = this.getTimeout("open");
493         if (timeout == WAIT_FOREVER) {
494             return this.open(name);
495         } else {
496             throw new NotImplementedException("Configuring user timeout is not supported for method: open");
497         }
498     }
499 
500     public void permissionsAllow(URL target, String id, int permissions, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, BadParameterException, TimeoutException, NoSuccessException {
501         float timeout = this.getTimeout("permissionsAllow");
502         if (timeout == WAIT_FOREVER) {
503             super.permissionsAllowSync(target, id, permissions, flags);
504         } else {
505             try {
506                 getResult(super.permissionsAllow(TaskMode.ASYNC, target, id, permissions, flags), timeout);
507             }
508             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
509             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
510             catch (SagaIOException e) {throw new NoSuccessException(e);}
511         }
512     }
513 
514     public void permissionsAllow(URL target, String id, int permissions) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, IncorrectStateException, BadParameterException, TimeoutException, NoSuccessException {
515         float timeout = this.getTimeout("permissionsAllow");
516         if (timeout == WAIT_FOREVER) {
517             super.permissionsAllowSync(target, id, permissions);
518         } else {
519             try {
520                 getResult(super.permissionsAllow(TaskMode.ASYNC, target, id, permissions), timeout);
521             }
522             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
523             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
524             catch (SagaIOException e) {throw new NoSuccessException(e);}
525         }
526     }
527 
528     public void permissionsAllow(String target, String id, int permissions, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, BadParameterException, TimeoutException, NoSuccessException {
529         float timeout = this.getTimeout("permissionsAllow");
530         if (timeout == WAIT_FOREVER) {
531             super.permissionsAllowSync(target, id, permissions, flags);
532         } else {
533             try {
534                 getResult(super.permissionsAllow(TaskMode.ASYNC, target, id, permissions, flags), timeout);
535             }
536             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
537             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
538             catch (SagaIOException e) {throw new NoSuccessException(e);}
539         }
540     }
541 
542     public void permissionsAllow(String target, String id, int permissions) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, IncorrectStateException, BadParameterException, TimeoutException, NoSuccessException {
543         float timeout = this.getTimeout("permissionsAllow");
544         if (timeout == WAIT_FOREVER) {
545             super.permissionsAllowSync(target, id, permissions);
546         } else {
547             try {
548                 getResult(super.permissionsAllow(TaskMode.ASYNC, target, id, permissions), timeout);
549             }
550             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
551             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
552             catch (SagaIOException e) {throw new NoSuccessException(e);}
553         }
554     }
555 
556     public void permissionsDeny(URL target, String id, int permissions, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, TimeoutException, NoSuccessException {
557         float timeout = this.getTimeout("permissionsDeny");
558         if (timeout == WAIT_FOREVER) {
559             super.permissionsDenySync(target, id, permissions, flags);
560         } else {
561             try {
562                 getResult(super.permissionsDeny(TaskMode.ASYNC, target, id, permissions, flags), timeout);
563             }
564             catch (IncorrectStateException e) {throw new NoSuccessException(e);}
565             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
566             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
567             catch (SagaIOException e) {throw new NoSuccessException(e);}
568         }
569     }
570 
571     public void permissionsDeny(URL target, String id, int permissions) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, TimeoutException, NoSuccessException {
572         float timeout = this.getTimeout("permissionsDeny");
573         if (timeout == WAIT_FOREVER) {
574             super.permissionsDenySync(target, id, permissions);
575         } else {
576             try {
577                 getResult(super.permissionsDeny(TaskMode.ASYNC, target, id, permissions), timeout);
578             }
579             catch (IncorrectStateException e) {throw new NoSuccessException(e);}
580             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
581             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
582             catch (SagaIOException e) {throw new NoSuccessException(e);}
583         }
584     }
585 
586     public void permissionsDeny(String target, String id, int permissions, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, TimeoutException, NoSuccessException {
587         float timeout = this.getTimeout("permissionsDeny");
588         if (timeout == WAIT_FOREVER) {
589             super.permissionsDenySync(target, id, permissions, flags);
590         } else {
591             try {
592                 getResult(super.permissionsDeny(TaskMode.ASYNC, target, id, permissions, flags), timeout);
593             }
594             catch (IncorrectStateException e) {throw new NoSuccessException(e);}
595             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
596             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
597             catch (SagaIOException e) {throw new NoSuccessException(e);}
598         }
599     }
600 
601     public void permissionsDeny(String target, String id, int permissions) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectURLException, BadParameterException, TimeoutException, NoSuccessException {
602         float timeout = this.getTimeout("permissionsDeny");
603         if (timeout == WAIT_FOREVER) {
604             super.permissionsDenySync(target, id, permissions);
605         } else {
606             try {
607                 getResult(super.permissionsDeny(TaskMode.ASYNC, target, id, permissions), timeout);
608             }
609             catch (IncorrectStateException e) {throw new NoSuccessException(e);}
610             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
611             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
612             catch (SagaIOException e) {throw new NoSuccessException(e);}
613         }
614     }
615 
616     /////////////////////////////////////// override some methods of NSEntry ///////////////////////////////////////
617 
618     /** override super.getCWD() */
619     public URL getCWD() throws NotImplementedException, IncorrectStateException, TimeoutException, NoSuccessException {
620         float timeout = this.getTimeout("getCWD");
621         if (timeout == WAIT_FOREVER) {
622             return super.getCWDSync();
623         } else {
624             try {
625                 return (URL) getResult(super.getCWD(TaskMode.ASYNC), timeout);
626             }
627             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
628             catch (AuthenticationFailedException e) {throw new NoSuccessException(e);}
629             catch (AuthorizationFailedException e) {throw new NoSuccessException(e);}
630             catch (PermissionDeniedException e) {throw new NoSuccessException(e);}
631             catch (BadParameterException e) {throw new NoSuccessException(e);}
632             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
633             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
634             catch (SagaIOException e) {throw new NoSuccessException(e);}
635         }
636     }
637 
638     /** override super.copy() */
639     public void copy(URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, AlreadyExistsException, TimeoutException, NoSuccessException, IncorrectURLException {
640         float timeout = this.getTimeout("copy");
641         if (timeout == WAIT_FOREVER) {
642             super.copySync(target, flags);
643         } else {
644             try {
645                 getResult(super.copy(TaskMode.ASYNC, target, flags), timeout);
646             }
647             catch (SagaIOException e) {throw new NoSuccessException(e);}
648         }
649     }
650     public void copy(URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException, IncorrectURLException {
651         float timeout = this.getTimeout("copy");
652         if (timeout == WAIT_FOREVER) {
653             super.copySync(target);
654         } else {
655             try {
656                 getResult(super.copy(TaskMode.ASYNC, target), timeout);
657             }
658             catch (SagaIOException e) {throw new NoSuccessException(e);}
659         }
660     }
661 
662     /** override super.copyFrom() */
663     public void copyFrom(URL source, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, AlreadyExistsException, TimeoutException, NoSuccessException, IncorrectURLException {
664         float timeout = this.getTimeout("copyFrom");
665         if (timeout == WAIT_FOREVER) {
666             super.copyFromSync(source, flags);
667         } else {
668             try {
669                 getResult(super.copyFrom(TaskMode.ASYNC, source, flags), timeout);
670             }
671             catch (SagaIOException e) {throw new NoSuccessException(e);}
672         }
673     }
674     public void copyFrom(URL source) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, AlreadyExistsException, TimeoutException, NoSuccessException, IncorrectURLException {
675         float timeout = this.getTimeout("copyFrom");
676         if (timeout == WAIT_FOREVER) {
677             super.copyFromSync(source);
678         } else {
679             try {
680                 getResult(super.copyFrom(TaskMode.ASYNC, source), timeout);
681             }
682             catch (SagaIOException e) {throw new NoSuccessException(e);}
683         }
684     }
685 
686     /** override super.move() */
687     public void move(URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, AlreadyExistsException, TimeoutException, NoSuccessException, IncorrectURLException {
688         float timeout = this.getTimeout("move");
689         if (timeout == WAIT_FOREVER) {
690             super.moveSync(target, flags);
691         } else {
692             try {
693                 getResult(super.move(TaskMode.ASYNC, target, flags), timeout);
694             }
695             catch (SagaIOException e) {throw new NoSuccessException(e);}
696         }
697     }
698     public void move(URL target) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, AlreadyExistsException, DoesNotExistException, TimeoutException, NoSuccessException, IncorrectURLException {
699         float timeout = this.getTimeout("move");
700         if (timeout == WAIT_FOREVER) {
701             super.moveSync(target);
702         } else {
703             try {
704                 getResult(super.move(TaskMode.ASYNC, target), timeout);
705             }
706             catch (SagaIOException e) {throw new NoSuccessException(e);}
707         }
708     }
709 
710     /** override super.remove() */
711     public void remove(int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
712         float timeout = this.getTimeout("remove");
713         if (timeout == WAIT_FOREVER) {
714             super.removeSync(flags);
715         } else {
716             try {
717                 getResult(super.remove(TaskMode.ASYNC, flags), timeout);
718             }
719             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
720             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
721             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
722             catch (SagaIOException e) {throw new NoSuccessException(e);}
723         }
724     }
725     public void remove() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
726         float timeout = this.getTimeout("remove");
727         if (timeout == WAIT_FOREVER) {
728             super.removeSync();
729         } else {
730             try {
731                 getResult(super.remove(TaskMode.ASYNC), timeout);
732             }
733             catch (IncorrectURLException e) {throw new NoSuccessException(e);}
734             catch (AlreadyExistsException e) {throw new NoSuccessException(e);}
735             catch (DoesNotExistException e) {throw new NoSuccessException(e);}
736             catch (SagaIOException e) {throw new NoSuccessException(e);}
737         }
738     }
739 
740     ////////////////////////////////////////// private methods //////////////////////////////////////////
741 
742     private float getTimeout(String methodName) throws NoSuccessException {
743         return getTimeout(NSDirectory.class, methodName, m_url.getScheme());
744     }
745 }