sbIFileSystemWatcher.idl
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2009 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 #include "nsISupports.idl"
28 
29 interface sbIFileSystemListener;
30 
31 //
32 // \brief A watcher interface that creates an XPCOM wrapper around filesystem
33 // events. Once a watcher instance is created - simply pass in the root
34 // path of the fileystem resources that need to be monitored. Callbacks
35 // will begin once |startWatching()| has been called.
36 //
37 [scriptable, uuid(61D13E2E-4927-4BAB-A327-23607AC4872F)]
39 {
40  //
41  // \brief Initialize a file system watcher with a given path and listnener.
42  // \param aListener The file sytem listener callback instance.
43  // \param aRootPath The root file path to listen at.
44  // \param aIsRecursive If the file path should be recusively watched.
45  //
46  void init(in sbIFileSystemListener aListener,
47  in AString aRootPath,
48  in boolean aIsRecursive);
49 
50  //
51  // \brief Initialize a file system watcher from a previous watched
52  // session. Use this method to retreive change information since
53  // the watcher was last run. All previous changed callback information
54  // will be sent out before |onWatcherStarted()| is called.
55  // \param aSessionGuid The session GUID to attempt to restore from.
56  // \param aListener the file system listener callback instance.
57  //
58  void initWithSession(in ACString aSessionGuid,
59  in sbIFileSystemListener aListener);
60 
61  //
62  // \brief Start watching the path designated in |init()|.
63  // Once the watching has fully initialized, the listener will be
64  // informed via |onWatcherStarted()|.
65  //
66  void startWatching();
67 
68  //
69  // \brief Stop watching the assigned path with the option to save
70  // information from the watched session.
71  // NOTE:
72  // Once the watcher has fully stopped, the listener will be informed
73  // via |onWatcherStopped()|.
74  // \pram aShouldSaveSession If true, the watcher will save information about
75  // the current state of the watched path.
76  //
77  void stopWatching(in boolean aShouldSaveSession);
78 
79  //
80  // \brief When a session is saved in |stopWatching()|, serialized data is
81  // stored in the users profile. Use this method to remove the stored
82  // serialized data when a session is no longer needed.
83  // \param aSessionGuid The GUID of the session to remove.
84  //
85  void deleteSession(in ACString aSessionGuid);
86 
87  //
88  // \brief Find out if the watcher is running.
89  //
90  readonly attribute boolean isWatching;
91 
92  //
93  // \brief Get the watch path of this watcher.
94  //
95  readonly attribute AString watchPath;
96 
97  //
98  // \brief Get the session GUID of the file system watcher instance.
99  // NOTE: Use this value to restore a session and receive callback
100  // information about all changes since the session was last run.
101  //
102  readonly attribute ACString sessionGuid;
103 
104  //
105  // \brief Find out if the file system watcher is supported on the current OS.
106  // \return True if file system watcher is supported, false if not.
107  //
108  readonly attribute boolean isSupported;
109 };
110 
void initWithSession(in ACString aSessionGuid, in sbIFileSystemListener aListener)
readonly attribute boolean isWatching
void deleteSession(in ACString aSessionGuid)
readonly attribute boolean isSupported
var uuid
void init(in sbIFileSystemListener aListener, in AString aRootPath, in boolean aIsRecursive)
readonly attribute ACString sessionGuid
void stopWatching(in boolean aShouldSaveSession)
readonly attribute AString watchPath