|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXFileNotificationCenter
The file notification center is only used in developement systems. It provides a nice repository about
files and their last modified dates. So instead of every dynamic spot having to keep track of
the files' dates, register and check at the end of every request-response loop, instead you
can just add an observer to this center and be notified when the file changes. Files' last modification
dates are checked at the end of every request-response loop.
It should be noted that the current version of the file notification center will retain a
reference to each registered observer. This is not ideal and will be corrected in the
future.
Nested Class Summary | |
static class |
ERXFileNotificationCenter._ObserverSelectorHolder
Simple observer-selector holder class. |
Field Summary | |
static String |
FileDidChange
Contains the name of the notification that is posted when a file changes. |
static ERXLogger |
log
Logging support |
Constructor Summary | |
ERXFileNotificationCenter()
Default constructor. |
Method Summary | |
void |
addObserver(Object observer,
NSSelector selector,
File file)
Used to register file observers for a particular file. |
void |
addObserver(Object observer,
NSSelector selector,
String filePath)
Used to register file observers for a particular file. |
void |
checkIfFilesHaveChanged(NSNotification n)
Notified by the NSNotificationCenter at the end of every request-response loop. |
static ERXFileNotificationCenter |
defaultCenter()
|
protected void |
fileHasChanged(File file)
Only used internally. |
void |
finalize()
When the file notification center is garbage collected it removes itself as an observer from the NSNotificationCenter .
|
boolean |
hasFileChanged(File file)
Compares the last modified date of the file with the last recorded modification date. |
void |
registerLastModifiedDateForFile(File file)
Records the last modified date of the file for future comparison. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ERXLogger log
public static final String FileDidChange
Constructor Detail |
public ERXFileNotificationCenter()
WOApplication.ApplicationWillDispatchRequestNotification
which will enable it to check if files have changed at the end of every request-response
loop. If WOCaching is enabled then this object will not register for anything and will generate
warning messages if observers are registered with caching enabled.
Method Detail |
public static ERXFileNotificationCenter defaultCenter()
public void finalize() throws Throwable
NSNotificationCenter
.
Not doing this will cause exceptions.
Throwable
public void addObserver(Object observer, NSSelector selector, String filePath)
observer
- object to be notified when a file changesselector
- selector to be invoked on the observer when
the file changes.filePath
- location of the filepublic void addObserver(Object observer, NSSelector selector, File file)
observer
- object to be notified when a file changesselector
- selector to be invoked on the observer when
the file changes.file
- file to watch for changespublic void registerLastModifiedDateForFile(File file)
file
- file to record the last modified datepublic boolean hasFileChanged(File file)
file
- file to compare last modified date.
lastModified
value
was recorded.protected void fileHasChanged(File file)
file
- file that has changedpublic void checkIfFilesHaveChanged(NSNotification n)
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |