com.starteam
Class LinkCache

java.lang.Object
  extended by com.starteam.LinkCache

public final 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.
 Link[] getLinks(ViewMember vm)
          Gets the links for the given ViewMember.
 boolean isPopulated(ViewMember vm)
          Determines whether of not the given view member's links have already been cached.
 void populate(Folder folder, Item.Type itemType, int depth)
          Ensures that the links are cached for all items of the given type in the given folder.
 void populate(View view, Item.Type type)
          Ensures that the links are cached for all items of the given type in the given view.
 void populate(ViewMemberCollection list)
          Ensures that the links are cached for all of the given view members.
 void refresh(Folder folder, Item.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(View view, Item.Type itemType)
          Ensures that the latest links are available for all items of the given type in the given view.
 void refresh(ViewMemberCollection list)
          Ensures that the latest links are available for all of the given view members.
 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,
                     Item.Type type)
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.
type - The type whose links are to be cached.

populate

public void populate(Folder folder,
                     Item.Type itemType,
                     int depth)
Ensures that the links are cached for all items of the given type in the given folder. Items in sub-folders 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 sub-folders up to n levels deeper to be processed. A negative value causes this folder and all subfolders to be processed.

populate

public void populate(ViewMemberCollection list)
Ensures that the links are cached for all of the given view members.

If the links for some of the view members 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 view members whose links are to be cached.

isPopulated

public boolean isPopulated(ViewMember vm)
Determines whether of not the given view member's links have already been cached.

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

refresh

public void refresh(View view,
                    Item.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.

refresh

public void refresh(Folder folder,
                    Item.Type itemType,
                    int depth)
Ensures that the latest links are available for all items of the given type in the given folder. Items in sub-folders 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 sub-folders up to n levels deeper to be processed. A negative value causes this folder and all sub-folders to be processed.

refresh

public void refresh(ViewMemberCollection list)
Ensures that the latest links are available for all of the given view members.

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 view members. 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 view members whose links are to be refreshed.

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(ViewMember vm)
Gets the links for the given ViewMember. 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:
vm - The ViewMember whose links are to be fetched.
Returns:
The set of links whose parent is the given ViewMember.

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.starteam.events.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.starteam.events.LinkUpdateListener)


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.