View Javadoc

1   package fr.in2p3.jsaga.sync.namespace;
2   
3   import org.ogf.saga.error.*;
4   import org.ogf.saga.url.URL;
5   
6   import java.util.List;
7   
8   /**
9    * Represents a namespace entry that is a directory, and defines additional
10   * methods for them. This interface extends <code>Iterable</code>, which
11   * allows an application to iterate over the entries in this directory.
12   * Implementations can use {@link #getNumEntriesSync()} and {@link #getEntrySync(int)}
13   * to implement an iterator, but will have to encapsulate the exceptions that
14   * these methods can throw in either a {@link java.lang.RuntimeException} or a
15   * {@link java.lang.Error}.
16   */
17  public interface SyncNSDirectory extends SyncNSEntry, Iterable<URL> {
18  
19      /**
20       * Changes the working directory.
21       *
22       * @param dir
23       *            the directory to change to.
24       */
25      public void changeDirSync(URL dir) throws NotImplementedException,
26              IncorrectURLException, AuthenticationFailedException,
27              AuthorizationFailedException, PermissionDeniedException,
28              BadParameterException, IncorrectStateException,
29              DoesNotExistException, TimeoutException, NoSuccessException;
30  
31      /**
32       * Lists entries in the directory that match the specified pattern. If the
33       * pattern is an empty string, all entries are listed. The only allowed flag
34       * is DEREFERENCE.
35       *
36       * @param pattern
37       *            name or pattern to list.
38       * @param flags
39       *            defining the operation modus.
40       * @return the matching entries.
41       */
42      public List<URL> listSync(String pattern, int flags)
43              throws NotImplementedException, AuthenticationFailedException,
44              AuthorizationFailedException, PermissionDeniedException,
45              BadParameterException, IncorrectStateException, TimeoutException,
46              NoSuccessException, IncorrectURLException;
47  
48      /**
49       * Lists entries in the directory. The only allowed flag is DEREFERENCE.
50       *
51       * @param flags
52       *            defining the operation modus.
53       * @return the directory entries.
54       */
55      public List<URL> listSync(int flags) throws NotImplementedException,
56              AuthenticationFailedException, AuthorizationFailedException,
57              PermissionDeniedException, BadParameterException,
58              IncorrectStateException, TimeoutException, NoSuccessException,
59              IncorrectURLException;
60  
61      /**
62       * Lists entries in the directory that match the specified pattern. If the
63       * pattern is an empty string, all entries are listed.
64       *
65       * @param pattern
66       *            name or pattern to list.
67       * @return the matching entries.
68       */
69      public List<URL> listSync(String pattern) throws NotImplementedException,
70              AuthenticationFailedException, AuthorizationFailedException,
71              PermissionDeniedException, BadParameterException,
72              IncorrectStateException, TimeoutException, NoSuccessException,
73              IncorrectURLException;
74  
75      /**
76       * Lists entries in the directory.
77       *
78       * @return the directory entries.
79       */
80      public List<URL> listSync() throws NotImplementedException,
81              AuthenticationFailedException, AuthorizationFailedException,
82              PermissionDeniedException, BadParameterException,
83              IncorrectStateException, TimeoutException, NoSuccessException,
84              IncorrectURLException;
85  
86      /**
87       * Finds entries in the directory and below that match the specified
88       * pattern. If the pattern is an empty string, all entries are listed.
89       *
90       * @param pattern
91       *            name or pattern to find.
92       * @param flags
93       *            defining the operation modus.
94       * @return the matching entries.
95       */
96      public List<URL> findSync(String pattern, int flags)
97              throws NotImplementedException, AuthenticationFailedException,
98              AuthorizationFailedException, PermissionDeniedException,
99              BadParameterException, IncorrectStateException, TimeoutException,
100             NoSuccessException;
101 
102     /**
103      * Finds entries in the directory and below that match the specified
104      * pattern. If the pattern is an empty string, all entries are listed.
105      *
106      * @param pattern
107      *            name or pattern to find.
108      * @return the matching entries.
109      */
110     public List<URL> findSync(String pattern) throws NotImplementedException,
111             AuthenticationFailedException, AuthorizationFailedException,
112             PermissionDeniedException, BadParameterException,
113             IncorrectStateException, TimeoutException, NoSuccessException;
114 
115     /**
116      * Queries for the existence of an entry.
117      *
118      * @param name
119      *            to be tested for existence.
120      * @return <code>true</code> if the name exists.
121      */
122     public boolean existsSync(URL name) throws NotImplementedException,
123             IncorrectURLException, AuthenticationFailedException,
124             AuthorizationFailedException, PermissionDeniedException,
125             BadParameterException, IncorrectStateException, TimeoutException,
126             NoSuccessException;
127 
128     /**
129      * Returns the time of the last modification in seconds since epoch
130      * (01.01.1970) of the specified name.
131      *
132      * @param name
133      *      the name of which the last modification time must be returned.
134      * @return
135      *      the last modification time.
136      */
137     public long getMTimeSync(URL name) throws NotImplementedException,
138             IncorrectURLException, DoesNotExistException, AuthenticationFailedException,
139             AuthorizationFailedException, PermissionDeniedException,
140             BadParameterException, IncorrectStateException, TimeoutException,
141             NoSuccessException;
142 
143     /**
144      * Tests the name for being a directory.
145      *
146      * @param name
147      *            to be tested.
148      * @return <code>true</code> if the name represents a directory.
149      */
150     public boolean isDirSync(URL name) throws NotImplementedException,
151             IncorrectURLException, DoesNotExistException,
152             AuthenticationFailedException, AuthorizationFailedException,
153             PermissionDeniedException, BadParameterException,
154             IncorrectStateException, TimeoutException, NoSuccessException;
155 
156     /**
157      * Tests the name for being a namespace entry.
158      *
159      * @param name
160      *            to be tested.
161      * @return <code>true</code> if the name represents a non-directory entry.
162      */
163     public boolean isEntrySync(URL name) throws NotImplementedException,
164             IncorrectURLException, DoesNotExistException,
165             AuthenticationFailedException, AuthorizationFailedException,
166             PermissionDeniedException, BadParameterException,
167             IncorrectStateException, TimeoutException, NoSuccessException;
168 
169     /**
170      * Tests the name for being a link.
171      *
172      * @param name
173      *            to be tested.
174      * @return <code>true</code> if the name represents a link.
175      */
176     public boolean isLinkSync(URL name) throws NotImplementedException,
177             IncorrectURLException, DoesNotExistException,
178             AuthenticationFailedException, AuthorizationFailedException,
179             PermissionDeniedException, BadParameterException,
180             IncorrectStateException, TimeoutException, NoSuccessException;
181 
182     /**
183      * Returns the URL representing the link target.
184      *
185      * @param name
186      *            the name of the link.
187      * @return the resolved name.
188      */
189     public URL readLinkSync(URL name) throws NotImplementedException,
190             IncorrectURLException, DoesNotExistException,
191             AuthenticationFailedException, AuthorizationFailedException,
192             PermissionDeniedException, BadParameterException,
193             IncorrectStateException, TimeoutException, NoSuccessException;
194 
195     /**
196      * Obtains the number of entries in this directory.
197      *
198      * @return the number of entries.
199      */
200     public int getNumEntriesSync() throws NotImplementedException,
201             AuthenticationFailedException, AuthorizationFailedException,
202             PermissionDeniedException, IncorrectStateException,
203             TimeoutException, NoSuccessException;
204 
205     /**
206      * Gives the name of an entry in the directory based upon the enumeration
207      * defined by {@link #getNumEntriesSync()}.
208      *
209      * @param entry
210      *            index of the entry to get.
211      * @return the name of the entry.
212      * @exception DoesNotExistException
213      *                is thrown when the index is invalid.
214      */
215     public URL getEntrySync(int entry) throws NotImplementedException,
216             AuthenticationFailedException, AuthorizationFailedException,
217             PermissionDeniedException, IncorrectStateException,
218             DoesNotExistException, TimeoutException, NoSuccessException;
219 
220     /**
221      * Copies the source entry to another part of the namespace.
222      *
223      * @param source
224      *            name to copy.
225      * @param target
226      *            name to copy to.
227      * @param flags
228      *            defining the operation modus.
229      */
230     public void copySync(URL source, URL target, int flags)
231             throws NotImplementedException, AuthenticationFailedException,
232             AuthorizationFailedException, PermissionDeniedException,
233             IncorrectURLException, BadParameterException,
234             IncorrectStateException, AlreadyExistsException,
235             DoesNotExistException, TimeoutException, NoSuccessException;
236 
237     /**
238      * Copies the source entry to another part of the namespace.
239      *
240      * @param source
241      *            name to copy.
242      * @param target
243      *            name to copy to.
244      */
245     public void copySync(URL source, URL target) throws NotImplementedException,
246             AuthenticationFailedException, AuthorizationFailedException,
247             PermissionDeniedException, IncorrectURLException,
248             BadParameterException, IncorrectStateException,
249             AlreadyExistsException, DoesNotExistException, TimeoutException,
250             NoSuccessException;
251 
252     /**
253      * Copies the source entry to another part of the namespace. The source may
254      * contain wildcards.
255      *
256      * @param source
257      *            name to copy.
258      * @param target
259      *            name to copy to.
260      * @param flags
261      *            defining the operation modus.
262      */
263     public void copySync(String source, URL target, int flags)
264             throws NotImplementedException, AuthenticationFailedException,
265             AuthorizationFailedException, PermissionDeniedException,
266             IncorrectURLException, BadParameterException,
267             IncorrectStateException, AlreadyExistsException,
268             DoesNotExistException, TimeoutException, NoSuccessException;
269 
270     /**
271      * Copies the source entry to another part of the namespace. The source may
272      * contain wildcards.
273      *
274      * @param source
275      *            name to copy.
276      * @param target
277      *            name to copy to.
278      */
279     public void copySync(String source, URL target) throws NotImplementedException,
280             AuthenticationFailedException, AuthorizationFailedException,
281             PermissionDeniedException, IncorrectURLException,
282             BadParameterException, IncorrectStateException,
283             AlreadyExistsException, DoesNotExistException, TimeoutException,
284             NoSuccessException;
285 
286     /**
287      * Creates a symbolic link from the specified target to the specified
288      * source.
289      *
290      * @param source
291      *            name to link to.
292      * @param target
293      *            name of the link.
294      * @param flags
295      *            defining the operation modus.
296      */
297     public void linkSync(URL source, URL target, int flags)
298             throws NotImplementedException, AuthenticationFailedException,
299             AuthorizationFailedException, PermissionDeniedException,
300             IncorrectURLException, BadParameterException,
301             IncorrectStateException, AlreadyExistsException,
302             DoesNotExistException, TimeoutException, NoSuccessException;
303 
304     /**
305      * Creates a symbolic link from the specified target to the specified
306      * source.
307      *
308      * @param source
309      *            name to link to.
310      * @param target
311      *            name of the link.
312      */
313     public void linkSync(URL source, URL target) throws NotImplementedException,
314             AuthenticationFailedException, AuthorizationFailedException,
315             PermissionDeniedException, IncorrectURLException,
316             BadParameterException, IncorrectStateException,
317             AlreadyExistsException, DoesNotExistException, TimeoutException,
318             NoSuccessException;
319 
320     /**
321      * Creates a symbolic link from the specified target to the specified
322      * source. The source may contain wildcards.
323      *
324      * @param source
325      *            name to link to.
326      * @param target
327      *            name of the link.
328      * @param flags
329      *            defining the operation modus.
330      */
331     public void linkSync(String source, URL target, int flags)
332             throws NotImplementedException, AuthenticationFailedException,
333             AuthorizationFailedException, PermissionDeniedException,
334             IncorrectURLException, BadParameterException,
335             IncorrectStateException, AlreadyExistsException,
336             DoesNotExistException, TimeoutException, NoSuccessException;
337 
338     /**
339      * Creates a symbolic link from the specified target to the specified
340      * source. The source may contain wildcards.
341      *
342      * @param source
343      *            name to link to.
344      * @param target
345      *            name of the link.
346      */
347     public void linkSync(String source, URL target) throws NotImplementedException,
348             AuthenticationFailedException, AuthorizationFailedException,
349             PermissionDeniedException, IncorrectURLException,
350             BadParameterException, IncorrectStateException,
351             AlreadyExistsException, DoesNotExistException, TimeoutException,
352             NoSuccessException;
353 
354     /**
355      * Renames the specified source to the specified target, or move the
356      * specified source to the specified target if the target is a directory.
357      *
358      * @param source
359      *            name to move.
360      * @param target
361      *            name to move to.
362      * @param flags
363      *            defining the operation modus.
364      */
365     public void moveSync(URL source, URL target, int flags)
366             throws NotImplementedException, AuthenticationFailedException,
367             AuthorizationFailedException, PermissionDeniedException,
368             IncorrectURLException, BadParameterException,
369             IncorrectStateException, AlreadyExistsException,
370             DoesNotExistException, TimeoutException, NoSuccessException;
371 
372     /**
373      * Renames the specified source to the specified target, or move the
374      * specified source to the specified target if the target is a directory.
375      *
376      * @param source
377      *            name to move.
378      * @param target
379      *            name to move to.
380      */
381     public void moveSync(URL source, URL target) throws NotImplementedException,
382             AuthenticationFailedException, AuthorizationFailedException,
383             PermissionDeniedException, IncorrectURLException,
384             BadParameterException, IncorrectStateException,
385             AlreadyExistsException, DoesNotExistException, TimeoutException,
386             NoSuccessException;
387 
388     /**
389      * Renames the specified source to the specified target, or move the
390      * specified source to the specified target if the target is a directory.
391      * The source may contain wildcards.
392      *
393      * @param source
394      *            name to move.
395      * @param target
396      *            name to move to.
397      * @param flags
398      *            defining the operation modus.
399      */
400     public void moveSync(String source, URL target, int flags)
401             throws NotImplementedException, AuthenticationFailedException,
402             AuthorizationFailedException, PermissionDeniedException,
403             IncorrectURLException, BadParameterException,
404             IncorrectStateException, AlreadyExistsException,
405             DoesNotExistException, TimeoutException, NoSuccessException;
406 
407     /**
408      * Renames the specified source to the specified target, or move the
409      * specified source to the specified target if the target is a directory.
410      * The source may contain wildcards.
411      *
412      * @param source
413      *            name to move.
414      * @param target
415      *            name to move to.
416      */
417     public void moveSync(String source, URL target) throws NotImplementedException,
418             AuthenticationFailedException, AuthorizationFailedException,
419             PermissionDeniedException, IncorrectURLException,
420             BadParameterException, IncorrectStateException,
421             AlreadyExistsException, DoesNotExistException, TimeoutException,
422             NoSuccessException;
423 
424     /**
425      * Removes the specified entry.
426      *
427      * @param target
428      *            name to remove.
429      * @param flags
430      *            defining the operation modus.
431      */
432     public void removeSync(URL target, int flags) throws NotImplementedException,
433             AuthenticationFailedException, AuthorizationFailedException,
434             PermissionDeniedException, IncorrectURLException,
435             BadParameterException, IncorrectStateException,
436             DoesNotExistException, TimeoutException, NoSuccessException;
437 
438     /**
439      * Removes the specified entry.
440      *
441      * @param target
442      *            name to remove.
443      */
444     public void removeSync(URL target) throws NotImplementedException,
445             AuthenticationFailedException, AuthorizationFailedException,
446             PermissionDeniedException, IncorrectURLException,
447             BadParameterException, IncorrectStateException,
448             DoesNotExistException, TimeoutException, NoSuccessException;
449 
450     /**
451      * Removes the specified entry. The target string may contain wildcards.
452      *
453      * @param target
454      *            name to remove.
455      * @param flags
456      *            defining the operation modus.
457      */
458     public void removeSync(String target, int flags)
459             throws NotImplementedException, AuthenticationFailedException,
460             AuthorizationFailedException, PermissionDeniedException,
461             IncorrectURLException, BadParameterException,
462             IncorrectStateException, DoesNotExistException, TimeoutException,
463             NoSuccessException;
464 
465     /**
466      * Removes the specified entry. The target string may contain wildcards.
467      *
468      * @param target
469      *            name to remove.
470      */
471     public void removeSync(String target) throws NotImplementedException,
472             AuthenticationFailedException, AuthorizationFailedException,
473             PermissionDeniedException, IncorrectURLException,
474             BadParameterException, IncorrectStateException,
475             DoesNotExistException, TimeoutException, NoSuccessException;
476 
477     /**
478      * Creates a new directory.
479      *
480      * @param target
481      *            directory to create.
482      * @param flags
483      *            defining the operation modus.
484      */
485     public void makeDirSync(URL target, int flags) throws NotImplementedException,
486             IncorrectURLException, AuthenticationFailedException,
487             AuthorizationFailedException, PermissionDeniedException,
488             BadParameterException, IncorrectStateException,
489             AlreadyExistsException, DoesNotExistException, TimeoutException,
490             NoSuccessException;
491 
492     /**
493      * Creates a new directory.
494      *
495      * @param target
496      *            directory to create.
497      */
498     public void makeDirSync(URL target) throws NotImplementedException,
499             IncorrectURLException, AuthenticationFailedException,
500             AuthorizationFailedException, PermissionDeniedException,
501             BadParameterException, IncorrectStateException,
502             AlreadyExistsException, DoesNotExistException, TimeoutException,
503             NoSuccessException;
504 
505     /**
506      * Allows the specified permissions for the specified id. An id of "*"
507      * enables the permissions for all.
508      *
509      * @param target
510      *            the entry affected.
511      * @param id
512      *            the id.
513      * @param permissions
514      *            the permissions to enable.
515      * @param flags
516      *            the only allowed flags are RECURSIVE and DEREFERENCE.
517      */
518     public void permissionsAllowSync(URL target, String id, int permissions,
519             int flags) throws NotImplementedException, IncorrectURLException,
520             AuthenticationFailedException, AuthorizationFailedException,
521             PermissionDeniedException, IncorrectStateException,
522             BadParameterException, TimeoutException, NoSuccessException;
523 
524     /**
525      * Allows the specified permissions for the specified id. An id of "*"
526      * enables the permissions for all.
527      *
528      * @param target
529      *            the entry affected.
530      * @param id
531      *            the id.
532      * @param permissions
533      *            the permissions to enable.
534      */
535     public void permissionsAllowSync(URL target, String id, int permissions)
536             throws NotImplementedException, AuthenticationFailedException,
537             AuthorizationFailedException, PermissionDeniedException, IncorrectURLException,
538             IncorrectStateException, BadParameterException, TimeoutException,
539             NoSuccessException;
540 
541     /**
542      * Allows the specified permissions for the specified id. An id of "*"
543      * enables the permissions for all.
544      *
545      * @param target
546      *            the entry affected.
547      * @param id
548      *            the id.
549      * @param permissions
550      *            the permissions to enable.
551      * @param flags
552      *            the only allowed flags are RECURSIVE and DEREFERENCE.
553      */
554     public void permissionsAllowSync(String target, String id, int permissions,
555             int flags) throws NotImplementedException, IncorrectURLException,
556             AuthenticationFailedException, AuthorizationFailedException,
557             PermissionDeniedException, IncorrectStateException,
558             BadParameterException, TimeoutException, NoSuccessException;
559 
560     /**
561      * Allows the specified permissions for the specified id. An id of "*"
562      * enables the permissions for all.
563      *
564      * @param target
565      *            the entry affected.
566      * @param id
567      *            the id.
568      * @param permissions
569      *            the permissions to enable.
570      */
571     public void permissionsAllowSync(String target, String id, int permissions)
572             throws NotImplementedException, AuthenticationFailedException,
573             AuthorizationFailedException, PermissionDeniedException, IncorrectURLException,
574             IncorrectStateException, BadParameterException, TimeoutException,
575             NoSuccessException;
576 
577     /**
578      * Denies the specified permissions for the specified id. An id of "*"
579      * disables the permissions for all.
580      *
581      * @param target
582      *            the entry affected.
583      * @param id
584      *            the id.
585      * @param permissions
586      *            the permissions to disable.
587      * @param flags
588      *            the only allowed flags are RECURSIVE and DEREFERENCE.
589      */
590     public void permissionsDenySync(URL target, String id, int permissions,
591             int flags) throws NotImplementedException, IncorrectURLException,
592             AuthenticationFailedException, AuthorizationFailedException,
593             PermissionDeniedException, BadParameterException, TimeoutException,
594             NoSuccessException;
595 
596     /**
597      * Denies the specified permissions for the specified id. An id of "*"
598      * disables the permissions for all.
599      *
600      * @param target
601      *            the entry affected.
602      * @param id
603      *            the id.
604      * @param permissions
605      *            the permissions to disable.
606      */
607     public void permissionsDenySync(URL target, String id, int permissions)
608             throws NotImplementedException, AuthenticationFailedException,
609             AuthorizationFailedException, PermissionDeniedException, IncorrectURLException,
610             BadParameterException, TimeoutException, NoSuccessException;
611 
612     /**
613      * Denies the specified permissions for the specified id. An id of "*"
614      * disables the permissions for all.
615      *
616      * @param target
617      *            the entry affected.
618      * @param id
619      *            the id.
620      * @param permissions
621      *            the permissions to disable.
622      * @param flags
623      *            the only allowed flags are RECURSIVE and DEREFERENCE.
624      */
625     public void permissionsDenySync(String target, String id, int permissions,
626             int flags) throws NotImplementedException, IncorrectURLException,
627             AuthenticationFailedException, AuthorizationFailedException,
628             PermissionDeniedException, BadParameterException, TimeoutException,
629             NoSuccessException;
630 
631     /**
632      * Denies the specified permissions for the specified id. An id of "*"
633      * disables the permissions for all.
634      *
635      * @param target
636      *            the entry affected.
637      * @param id
638      *            the id.
639      * @param permissions
640      *            the permissions to disable.
641      */
642     public void permissionsDenySync(String target, String id, int permissions)
643             throws NotImplementedException, AuthenticationFailedException,
644             AuthorizationFailedException, PermissionDeniedException, IncorrectURLException,
645             BadParameterException, TimeoutException, NoSuccessException;
646 }