|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.starbase.starteam.ViewPollingAgent
Used to periodically poll a given view for recent changes, triggering FolderUpdateEvents and ItemUpdateEvents describing the changes detected since the last poll.
Events are triggered only for differences detectable across the polling interval. For example, if an item is added then removed without an intervening refresh, then no events would be triggered for that item.
Events are triggered in an order that reflects the times the change actually occurred, when possible. For some older server versions, it is not possible to determine when a move has occurred. It is also not currently possible to determine when a folder or item was removed. Such events are triggered last.
There are two basic ways to use a ViewPollingAgent. The first way is to create one and keep it around for a long time, periodically calling refresh() to trigger events. This is generally faster than creating a new ViewPollingAgent for each refresh(). However, the ViewPollingAgent consumes memory while it is in use.
The second way is to create a new ViewPollingAgent at each polling interval, call refresh() once to trigger events, and save the time returned by refresh() to use later when creating a ViewPollingAgent for the next poll. This is slower, but uses less memory between polls.
| Constructor Summary | |
ViewPollingAgent(View view,
OLEDate startTime)
Constructs a new ViewPollingAgent. |
|
| Method Summary | |
void |
addFolderUpdateListener(FolderUpdateListener listener)
Registers a FolderUpdateListener, whose methods will be invoked during a refresh() whenever changes to the folder tree are detected. |
void |
addItemUpdateListener(ItemUpdateListener listener,
Type type)
Registers an ItemUpdateListener, whose methods will be invoked durng a refresh() whenever changes to the items of the given type are detected. |
void |
addRequiredPropertyName(Type type,
java.lang.String propertyName)
Marks a given property name as required for a given type. |
void |
addRequiredPropertyNames(Type type,
java.lang.String[] propertyNames)
Marks a list of property names as required for a given type. |
boolean |
equals(java.lang.Object source)
returns true if this object instance is equal to the source |
int |
hashCode()
returns a unique hash for all instances of this type |
OLEDate |
refresh()
Refreshes the view, triggering FolderUpdateEvents and ItemUpdateEvents for all changes detected since the previous refresh (or since the start ViewPollingAgent's start time, if this is the first refresh). |
void |
removeFolderUpdateListener(FolderUpdateListener listener)
Unregisters a previously registered FolderUpdateListener. |
void |
removeItemUpdateListener(ItemUpdateListener listener,
Type type)
Unregisters a previously registered ItemUpdateListener. |
void |
setAllPropertyNamesRequired(Type type)
Marks all property names as required for a given type. |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ViewPollingAgent(View view,
OLEDate startTime)
view - The view whose changes are to be monitored.startTime - The start time for detecting changes.
Often the same as the time returned by the last call to refresh()
from a previously instantiated ViewPollingAgent.| Method Detail |
public void addFolderUpdateListener(FolderUpdateListener listener)
listener - The listener to be registered.FolderUpdateListener,
ViewPollingAgent.refresh(),
ViewPollingAgent.removeFolderUpdateListener(com.starbase.starteam.FolderUpdateListener)public void removeFolderUpdateListener(FolderUpdateListener listener)
listener - The listener to be unregistered.ViewPollingAgent.addFolderUpdateListener(com.starbase.starteam.FolderUpdateListener)
public void addItemUpdateListener(ItemUpdateListener listener,
Type type)
Note that all ItemUpdateListeners must be added before the first refresh().
listener - The listener to be registered.type - The item type.ItemUpdateListener,
ViewPollingAgent.refresh(),
ViewPollingAgent.removeItemUpdateListener(com.starbase.starteam.ItemUpdateListener, com.starbase.starteam.Type)
public void removeItemUpdateListener(ItemUpdateListener listener,
Type type)
listener - The listener to be unregistered.type - The item type.ViewPollingAgent.addItemUpdateListener(com.starbase.starteam.ItemUpdateListener, com.starbase.starteam.Type)
public void addRequiredPropertyName(Type type,
java.lang.String propertyName)
If addPropertyName() or any of its variations is never called for a given type, then a default set of properties (including the type's descriptors) is assumed. In fact, if neither addPropertyName() nor addItemUpdateListener() is called, then that item type is not even refreshed.
type - An item type.propertyName - A property name.ViewPollingAgent.refresh(),
ViewPollingAgent.addRequiredPropertyNames(com.starbase.starteam.Type, java.lang.String[]),
ViewPollingAgent.setAllPropertyNamesRequired(com.starbase.starteam.Type)
public void addRequiredPropertyNames(Type type,
java.lang.String[] propertyNames)
type - An item type.propertyNames - A list of property names.ViewPollingAgent.addRequiredPropertyName(com.starbase.starteam.Type, java.lang.String)public void setAllPropertyNamesRequired(Type type)
type - An item type.ViewPollingAgent.addRequiredPropertyName(com.starbase.starteam.Type, java.lang.String)public OLEDate refresh()
The folder tree is always refreshed. In addition, all items a refreshed for each item type that the application has shown an interest in, either by adding an ItemUpdateListener for that item type, or by calling addRequiredPropertyName() with that item type.
public boolean equals(java.lang.Object source)
equals in class java.lang.Objectsource - Object the source to comapre with
public int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||