View Javadoc

1   package fr.in2p3.jsaga.sync.file;
2   
3   import fr.in2p3.jsaga.sync.namespace.SyncNSDirectory;
4   import org.ogf.saga.error.*;
5   import org.ogf.saga.file.FileInputStream;
6   import org.ogf.saga.file.FileOutputStream;
7   import org.ogf.saga.url.URL;
8   
9   /**
10   * A Directory instance represents an open directory.
11   */
12  public interface SyncDirectory extends SyncNSDirectory {
13  
14      // Inspection methods
15  
16      /**
17       * Returns the number of bytes in the specified file.
18       *
19       * @param name
20       *            name of file to inspect.
21       * @param flags
22       *            mode for operation.
23       * @return the size.
24       */
25      public long getSizeSync(URL name, int flags) throws NotImplementedException,
26              IncorrectURLException, AuthenticationFailedException,
27              AuthorizationFailedException, PermissionDeniedException,
28              BadParameterException, IncorrectStateException,
29              DoesNotExistException, TimeoutException, NoSuccessException;
30  
31      /**
32       * Returns the number of bytes in the specified file.
33       *
34       * @param name
35       *            name of file to inspect.
36       * @return the size.
37       */
38      public long getSizeSync(URL name) throws NotImplementedException,
39              IncorrectURLException, AuthenticationFailedException,
40              AuthorizationFailedException, PermissionDeniedException,
41              BadParameterException, IncorrectStateException,
42              DoesNotExistException, TimeoutException, NoSuccessException;
43  
44      /**
45       * Tests the name for being a directory entry. Is an alias for
46       * {@link SyncNSDirectory#isEntrySync}.
47       *
48       * @param name
49       *            to be tested.
50       * @return <code>true</code> if the name represents a non-directory entry.
51       */
52      public boolean isFileSync(URL name) throws NotImplementedException,
53              IncorrectURLException, DoesNotExistException,
54              AuthenticationFailedException, AuthorizationFailedException,
55              PermissionDeniedException, BadParameterException,
56              IncorrectStateException, TimeoutException, NoSuccessException;
57  
58      // openDirectory and openFile: names changed with respect
59      // to specs because of Java restriction: cannot redefine methods with
60      // just a different return type.
61      // Thus, they don't hide the methods in NamespaceDirectory, but then,
62      // the ones in the SAGA spec don't either, because they have different
63      // out parameters.
64  
65      /**
66       * Creates a new <code>FileInputStream</code> instance.
67       *
68       * @param name
69       *            file to open.
70       * @return the input stream.
71       */
72      public FileInputStream openFileInputStreamSync(URL name)
73              throws NotImplementedException, IncorrectURLException,
74              AuthenticationFailedException, AuthorizationFailedException,
75              PermissionDeniedException, BadParameterException,
76              IncorrectStateException, AlreadyExistsException,
77              DoesNotExistException, TimeoutException, NoSuccessException;
78  
79      /**
80       * Creates a new <code>FileOutputStream</code> instance.
81       *
82       * @param name
83       *            file to open.
84       * @return the output stream.
85       */
86      public FileOutputStream openFileOutputStreamSync(URL name)
87              throws NotImplementedException, IncorrectURLException,
88              AuthenticationFailedException, AuthorizationFailedException,
89              PermissionDeniedException, BadParameterException,
90              IncorrectStateException, AlreadyExistsException,
91              DoesNotExistException, TimeoutException, NoSuccessException;
92  
93      /**
94       * Creates a new <code>FileOutputStream</code> instance.
95       *
96       * @param name
97       *            file to open.
98       * @param append
99       *            when set, the stream appends to the file.
100      * @return the output stream.
101      */
102     public FileOutputStream openFileOutputStreamSync(URL name, boolean append)
103             throws NotImplementedException, IncorrectURLException,
104             AuthenticationFailedException, AuthorizationFailedException,
105             PermissionDeniedException, BadParameterException,
106             IncorrectStateException, AlreadyExistsException,
107             DoesNotExistException, TimeoutException, NoSuccessException;
108 }