SHOW Signed

net.rim.device.api.io.file
Class FileSystemJournal

java.lang.Object
  |
  +--net.rim.device.api.io.file.FileSystemJournal

public final class FileSystemJournal
extends Object

This class represents a file system journal. The journal tracks changes to the file system and applications can query the entries. The journal has limited space so applications should be aware that not all changes are stored and that journal changes may be lost after a reset. For optimality, it is stressed that iteration be done backwards from the next USN to the cached value of the application or until a null journal entry is reached. An example of the code is provided below, which involves querying the journal and looking for a previously-added file with the name "mindwave".

   long nextUSN = FileSystemJournal.getNextUSN();
   for (long lookUSN = nextUSN-1; lookUSN >= _myStoredUSN; lookUSN--) {
       FileSystemJournalEntry entry = FileSystemJournal.getEntry(lookUSN);

       if (entry == null) {
           // we didn't find an entry.
           break;
       }

       if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED) {
           String path = entry.getPath();
           if (path != null && path.indexOf("mindwave") != -1) {
               System.out.println("Found a file added named mindwave");
               break;
           }
       }
   }
   _myStoredUSN = nextUSN;

   
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

Since:
JDE 4.2.0

Method Summary
 Category: Signed static FileSystemJournalEntry getEntry(long usn)
          Retrieve a journal entry for corresponding USN.
 Category: Signed static long getNextUSN()
          This method returns the next USN (Update Sequence Number) that the journal system will use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNextUSN

public static long getNextUSN()
This method returns the next USN (Update Sequence Number) that the journal system will use.
Returns:
The next USN to be used.
Since:
JDE 4.2.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getEntry

public static FileSystemJournalEntry getEntry(long usn)
Retrieve a journal entry for corresponding USN. This method will return null if the update sequence number is out of range of the current stored values. It is recommended that once an application retrieves a null journal entry that iteration stop.
Parameters:
usn - The update sequence number of the entry to be retrieved.
Returns:
The corresponding update sequence number, possibly null.
Since:
JDE 4.2.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2006 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.