com.starbase.starteam
Class LinkCache

java.lang.Object
  |
  +--com.starbase.starteam.LinkCache

public class LinkCache
extends java.lang.Object

Caches links for a given set of items. One LinkCache may be populated with links from multiple view configurations on multiple servers.


Constructor Summary
LinkCache()
          Constructs a new link cache.
 
Method Summary
 void addLinkUpdateListener(LinkUpdateListener listener)
          Registers a LinkUpdateListener, which will then receive LinkUpdateEvents whenever a link is added or removed from the cache, and whenever a previously cached link is modified.
 LinkFactory getLinkFactory()
          Gets a LinkFactory that may be used to create new links.
 Link[] getLinks(Item item)
          Gets the links for the given item.
 boolean isPopulated(Item item)
          Determines whether of not the given item's links have already been cached.
 void populate(Folder folder, Type itemType, int depth)
          Ensures that the links are cached for all items of the given type in the given folder.
 void populate(Items list)
          Ensures that the links are cached for all of the given items.
 void populate(View view, Type itemType)
          Ensures that the links are cached for all items of the given type in the given view.
 void refresh(Folder folder, Type itemType, int depth)
          Ensures that the latest links are available for all items of the given type in the given folder.
 void refresh(Item item)
          Ensures that the latest links are available for the given item.
 void refresh(Items list)
          Ensures that the latest links are available for all of the given items.
 void refresh(View view, Type itemType)
          Ensures that the latest links are available for all items of the given type in the given view.
 void removeLinkUpdateListener(LinkUpdateListener listener)
          Removes a previously registered LinkUpdateListener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkCache

public LinkCache()
Constructs a new link cache. The cache is initially empty.

Method Detail

populate

public void populate(View view,
                     Type itemType)
Ensures that the links are cached for all items of the given type in the given view.

If the links for some of the items have not yet been cached, then they are retrieved from the StarTeam server. Links are fetched in bulk for servers that support it.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache.

Parameters:
view - The view containing the items whose links are to be cached.
itemType - The type item whose links are to be cached.
See Also:
SupportedFeatures.hasBulkFetchLinks()

populate

public void populate(Folder folder,
                     Type itemType,
                     int depth)
Ensures that the links are cached for all items of the given type in the given folder. Items in subfolders may also be included.

If the links for some of the items have not yet been cached, then they are retrieved from the StarTeam server. Links are fetched in bulk for servers that support it.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache.

Parameters:
folder - The folder containing the items whose links are to be cached.
itemType - The type item whose links are to be cached.
depth - The number of levels deep in the folder tree that child folders should also be processed. A value of 0 causes only this folder to be processed. A positive value n will cause this folder and all subfolders up to n levels deeper to be processed. A negative value causes this folder and all subfolders to be processed.
See Also:
SupportedFeatures.hasBulkFetchLinks()

populate

public void populate(Items list)
Ensures that the links are cached for all of the given items.

If the links for some of the items have not yet been cached, then they are retrieved from the StarTeam server. Links are fetched in bulk for servers that support it.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache.

Parameters:
list - The list of items whose links are to be cached.
See Also:
SupportedFeatures.hasBulkFetchLinks()

isPopulated

public boolean isPopulated(Item item)
Determines whether of not the given item's links have already been cached.

Parameters:
item - The item to be tested.
Returns:
true if the given item's links have been cached, and false otherwise.

refresh

public void refresh(View view,
                    Type itemType)
Ensures that the latest links are available for all items of the given type in the given view.

Existing Link objects are modified in place whenever possible.

Note that since links are not currently MPX-aware, this re-fetches the links for all relevant items. Links are fetched in bulk for servers that support it.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache, a linkRemoved() event for each old link removed from the cache, and a linkChanged() event for each cached link modified during the refresh.

Parameters:
view - The view containing the items whose links are to be refreshed.
itemType - The type item whose links are to be refreshed.
See Also:
SupportedFeatures.hasBulkFetchLinks()

refresh

public void refresh(Folder folder,
                    Type itemType,
                    int depth)
Ensures that the latest links are available for all items of the given type in the given folder. Items in subfolders may also be included.

Existing Link objects are modified in place whenever possible.

Note that since links are not currently MPX-aware, this re-fetches the links for all relevant items. Links are fetched in bulk for servers that support it.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache, a linkRemoved() event for each old link removed from the cache, and a linkChanged() event for each cached link modified during the refresh.

Parameters:
folder - The folder containing the items whose links are to be refreshed.
itemType - The type item whose links are to be refreshed.
depth - The number of levels deep in the folder tree that child folders should also be processed. A value of 0 causes only this folder to be processed. A positive value n will cause this folder and all subfolders up to n levels deeper to be processed. A negative value causes this folder and all subfolders to be processed.
See Also:
SupportedFeatures.hasBulkFetchLinks()

refresh

public void refresh(Items list)
Ensures that the latest links are available for all of the given items.

Existing Link objects are modified in place whenever possible.

Note that since links are not currently MPX-aware, this re-fetches the links for all of the given items. Links are fetched in bulk for servers that support it.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache, a linkRemoved() event for each old link removed from the cache, and a linkChanged() event for each cached link modified during the refresh.

Parameters:
list - The list of items whose links are to be refreshed.
See Also:
SupportedFeatures.hasBulkFetchLinks()

refresh

public void refresh(Item item)
Ensures that the latest links are available for the given item.

Existing Link objects are modified in place whenever possible.

Note that since links are not currently MPX-aware, this re-fetches the links for the given item.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache, a linkRemoved() event for each old link removed from the cache, and a linkChanged() event for each cached link modified during the refresh.

Parameters:
item - The item whose links are to be refreshed.

getLinks

public Link[] getLinks(Item item)
Gets the links for the given item. If the links were not previously cached, they are fetched from the server and cached now.

If there are any LinkUpdateListeners registered, they will each receive a linkAdded() event for each new link added to the cache.

Parameters:
item - The item whose links are to be fetched.
Returns:
The set of links whose parent is the given item.

getLinkFactory

public LinkFactory getLinkFactory()
Gets a LinkFactory that may be used to create new links.

For items whose links are already cached, creating new links through this LinkFactory will ensure that the cached links are updated automatically, without having to explicitly refresh the cache.

Returns:
The LinkFactory.

addLinkUpdateListener

public void addLinkUpdateListener(LinkUpdateListener listener)
Registers a LinkUpdateListener, which will then receive LinkUpdateEvents whenever a link is added or removed from the cache, and whenever a previously cached link is modified.

Parameters:
listener - The LinkUpdateListener to be registered.
See Also:
LinkCache.removeLinkUpdateListener(com.starbase.starteam.LinkUpdateListener)

removeLinkUpdateListener

public void removeLinkUpdateListener(LinkUpdateListener listener)
Removes a previously registered LinkUpdateListener.

Parameters:
listener - A LinkUpdateListener that was previously registered.
See Also:
LinkCache.addLinkUpdateListener(com.starbase.starteam.LinkUpdateListener)


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.