com.starteam
Class ArtifactCacheManager

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

public final class ArtifactCacheManager
extends java.lang.Object

A collection of ArtifactCache's managed for a given server. The framework owns these caches and the associated baselines, so that all web client applications (if loaded in the same JRE) will be able to access each others cache and share types across caches The managed caches comprise tip and baselines, i.e. rolled back configurations (identified by Context) The Tip Artifact caches all interesting projects, views and types (as determined by the caller) In contrast, each rolled back cache contains all the types for a single rolled back view


Nested Class Summary
static class ArtifactCacheManager.Client
          Establish the context of a Client Application.
static class ArtifactCacheManager.Context
          Establish the context in which a web application will execute some session specific requirement.
static interface ArtifactCacheManager.Securable
          An object that can be secured in the repository.
static interface ArtifactCacheManager.SecurableContainer
          A container in the repository that can hold secured objects of a given type.
 
Method Summary
 boolean canAccessContainerForReading(Principal.WebCachePrincipal principal, ArtifactCacheManager.Securable s)
          returns true if this securable's container is accessible for reading by the specified Principal
 boolean canAccessForReading(Principal.WebCachePrincipal principal, ArtifactCacheManager.Securable s)
          returns true if this securable's container is accessible for reading by the specified Principal
 boolean canCreateArtifactType(Principal.WebCachePrincipal principal, ArtifactCacheManager.SecurableContainer sc, Type.WebCacheType t)
          help method wrapping hasContainerRights specifically for GENERIC_CREATE_NEW_OBJECT
 boolean canCreateProject(User.WebCacheUser u)
          User must be logged in through JobRunner.logon.
 void dropCache(ArtifactCacheManager.Context ctxt)
          Drop a tip or historical cache configuration In a multi-tenant hosted model, there may be several tip caches, one per tenant
static ArtifactCacheManager[] getAllArtifactCacheManagers()
          returns the set of all artifact cache managers registered in this cache
 ArtifactCache[] getAllHistoricalCaches()
          returns the set of all historical Artifact Caches managed by this ArtifactCacheManager manager
 ArtifactCacheManager.Client[] getAllRegisteredClients()
          return the set of all registered clients
static java.util.Hashtable getApplicationStore()
          return a Hashtable that Hub clients may use to communicate across threads, across sessions, across processes – as long as they share the same VM (Runtime) The contents of this hashtable are irrelevant to the Baseline Manager
 ArtifactCache getCache(ArtifactCacheManager.Context ctxt)
          return the tip artifact cache for a specific tenant or the ArtifactCache used to house a historical (rolled back) configuration Note that the tenant is identified by the Administrative Context, i.e.
 ArtifactCacheManager.Client getClient(java.lang.String applicationName)
          Return the Client described by the specified Application Name or null if there is no client registered matching this application name Applications may choose to maintain their own Client Context, or allow the ArtifactCacheManager to maintain the Client context on their behalf
 java.lang.String getGUID()
          Returns the GUID for this ArtifactCacheManager
 DateTime getLastUsedAt(User.WebCacheUser usr)
          Returns the time at which the specified user last used the cache
static ArtifactCacheManager getManager(java.lang.String guid)
          returns an artifact cache manager responsible for managing the caches for a server or NULL
 boolean hasCache(ArtifactCacheManager.Context ctxt)
          returns true if this manager houses a historical cache described by the specified context
 boolean hasContainerRight(Principal.WebCachePrincipal principal, ArtifactCacheManager.SecurableContainer sc, Type.WebCacheType t, Permission p)
          true if this securable container has the selected rights for the specified Principal and specified Type
 boolean hasContainerRight(Principal.WebCachePrincipal principal, ArtifactCacheManager.Securable s, Permission p)
          true if this securable's container has the selected right for the specified Principal
 boolean hasContainerRights(Principal.WebCachePrincipal principal, ArtifactCacheManager.Securable s, PermissionCollection pc)
          true if this securable's container has the selected rights for the specified Principal
 boolean hasRight(Principal.WebCachePrincipal principal, ArtifactCacheManager.Securable s, Permission p)
          returns true if this securable has the selected right for the specified Principal
 boolean hasRights(Principal.WebCachePrincipal principal, ArtifactCacheManager.Securable s, PermissionCollection pc)
          returns true if this securable has the selected rights for the specified Principal
static ArtifactCacheManager.Context register(ServerInfo si)
          create an artifact cache manager with the given connectivity and credentials
 ArtifactCacheManager.Client registerClient(java.lang.String appName)
          Register a Client for this ArtifactCacheManager.
 void resetRefreshPeriod(int refreshPeriod)
          Reset the refresh period for the artifact cache managers.
static void unregister(java.lang.String guid)
          remove an artifact cache manager from the cache
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClient

public ArtifactCacheManager.Client getClient(java.lang.String applicationName)
Return the Client described by the specified Application Name or null if there is no client registered matching this application name Applications may choose to maintain their own Client Context, or allow the ArtifactCacheManager to maintain the Client context on their behalf

Parameters:
applicationName - the application name
Returns:
the Client described by the specified Application Name

getAllRegisteredClients

public ArtifactCacheManager.Client[] getAllRegisteredClients()
return the set of all registered clients

Returns:
the set of all registered clients

registerClient

public ArtifactCacheManager.Client registerClient(java.lang.String appName)
Register a Client for this ArtifactCacheManager. Once registered, whenever a baseline cache is requested through this ArtifactCacheManager, all registered clients will be queried and their types will be cached in the ArtifactCacheManager Attempting to re-register a client with an existing name will throw an IllegalStateException If this client is interested in listening for events, listener interfaces must be attached to the client, and finally the client itself must be registered with the tip artifact cache

Parameters:
appName - the client to register

getLastUsedAt

public DateTime getLastUsedAt(User.WebCacheUser usr)
Returns the time at which the specified user last used the cache

Parameters:
usr - the user to test
Returns:
the time at which the specified user last used this cache or DateTime.VALUE_NOT_SET if this user has been logged out of the cache

canCreateProject

public boolean canCreateProject(User.WebCacheUser u)
User must be logged in through JobRunner.logon.

Parameters:
u - The Logged on user to be tested for create project permission (SERVER_CREATE_PROJECT)
Returns:
true if user can create a project, false if they cannot or are not logged in

getApplicationStore

public static java.util.Hashtable getApplicationStore()
return a Hashtable that Hub clients may use to communicate across threads, across sessions, across processes – as long as they share the same VM (Runtime) The contents of this hashtable are irrelevant to the Baseline Manager

Returns:
a Hashtable that may be used for inter-client communication

resetRefreshPeriod

public void resetRefreshPeriod(int refreshPeriod)
Reset the refresh period for the artifact cache managers. The default refresh period is set to 30 seconds.

Parameters:
refreshPeriod - the new refresh period

register

public static ArtifactCacheManager.Context register(ServerInfo si)
create an artifact cache manager with the given connectivity and credentials

Parameters:
si - the ServerInfo to register
Returns:
the registered baseline artifact cache manager context representing the logged in user

getManager

public static ArtifactCacheManager getManager(java.lang.String guid)
returns an artifact cache manager responsible for managing the caches for a server or NULL

Parameters:
guid - the GUID describing the repository (server)
Returns:
a artifact cache manager or NULL
See Also:
Server.getRepositoryID()

unregister

public static void unregister(java.lang.String guid)
remove an artifact cache manager from the cache

Parameters:
guid - the GUID describing the repository (server)

getAllArtifactCacheManagers

public static ArtifactCacheManager[] getAllArtifactCacheManagers()
returns the set of all artifact cache managers registered in this cache

Returns:
the set of all artifact cache managers registered in this cache

getGUID

public java.lang.String getGUID()
Returns the GUID for this ArtifactCacheManager

Returns:
the GUID for this ArtifactCacheManager

hasCache

public boolean hasCache(ArtifactCacheManager.Context ctxt)
returns true if this manager houses a historical cache described by the specified context

Parameters:
ctxt - the context that specifies a historical cache
Returns:
true if this manager houses a historical cache described by the specified context

getCache

public ArtifactCache getCache(ArtifactCacheManager.Context ctxt)
return the tip artifact cache for a specific tenant or the ArtifactCache used to house a historical (rolled back) configuration Note that the tenant is identified by the Administrative Context, i.e. the administrative logged in user id who registered the artifact cache

Parameters:
ctxt - the context that identifies the ArtifactCache. It may be the tip or rolled back
Returns:
an ArtifactCache matching the specified context

getAllHistoricalCaches

public ArtifactCache[] getAllHistoricalCaches()
returns the set of all historical Artifact Caches managed by this ArtifactCacheManager manager

Returns:
the set of all historical Artifact Caches

canAccessForReading

public boolean canAccessForReading(Principal.WebCachePrincipal principal,
                                   ArtifactCacheManager.Securable s)
returns true if this securable's container is accessible for reading by the specified Principal

Parameters:
principal - the principal in whose context the test is being made
s - the securable whose container object (artifact) is being tested
Returns:
true if the principal can see the object

canAccessContainerForReading

public boolean canAccessContainerForReading(Principal.WebCachePrincipal principal,
                                            ArtifactCacheManager.Securable s)
returns true if this securable's container is accessible for reading by the specified Principal

Parameters:
principal - the principal in whose context the test is being made
s - the securable whose container object (artifact) is being tested
Returns:
true if the principal can see the object

hasRight

public boolean hasRight(Principal.WebCachePrincipal principal,
                        ArtifactCacheManager.Securable s,
                        Permission p)
returns true if this securable has the selected right for the specified Principal

Parameters:
principal - the principal whose right is being checked
s - the securable object (artifact) being tested
p - the permission (access right) in question
Returns:
true if the principal has the specified right to the securable

hasRights

public boolean hasRights(Principal.WebCachePrincipal principal,
                         ArtifactCacheManager.Securable s,
                         PermissionCollection pc)
returns true if this securable has the selected rights for the specified Principal

Parameters:
principal - the principal whose rights are being checked
s - the securable object (artifact) being tested
pc - the permissions (access rights) in question
Returns:
true if the principal has the specified rights to the securable

hasContainerRight

public boolean hasContainerRight(Principal.WebCachePrincipal principal,
                                 ArtifactCacheManager.Securable s,
                                 Permission p)
true if this securable's container has the selected right for the specified Principal

Parameters:
principal - the principal whose rights are being checked
s - the securable whose container object (artifact) is being tested
p - the permission (access right) in question
Returns:
true if the principal has the specified right to the securable's container

hasContainerRights

public boolean hasContainerRights(Principal.WebCachePrincipal principal,
                                  ArtifactCacheManager.Securable s,
                                  PermissionCollection pc)
true if this securable's container has the selected rights for the specified Principal

Parameters:
principal - the principal whose rights are being checked
s - the securable whose container object (artifact) is being tested
pc - the permissions (access rights) in question
Returns:
true if the principal has the specified rights to the securable's container

hasContainerRight

public boolean hasContainerRight(Principal.WebCachePrincipal principal,
                                 ArtifactCacheManager.SecurableContainer sc,
                                 Type.WebCacheType t,
                                 Permission p)
true if this securable container has the selected rights for the specified Principal and specified Type

Parameters:
principal - the principal whose rights are being checked
sc - the securable container being tested
t - the type to check permissions for in the securable container
p - the permission (access right) in question
Returns:
true if the principal has the specified rights to the type in the securable container

canCreateArtifactType

public boolean canCreateArtifactType(Principal.WebCachePrincipal principal,
                                     ArtifactCacheManager.SecurableContainer sc,
                                     Type.WebCacheType t)
help method wrapping hasContainerRights specifically for GENERIC_CREATE_NEW_OBJECT

Parameters:
principal - the principal whose rights are being checked
sc - the securable container being tested
t - the type to check create permissions for
Returns:
true if the principal has create permissions in the securable container for the type

dropCache

public void dropCache(ArtifactCacheManager.Context ctxt)
Drop a tip or historical cache configuration In a multi-tenant hosted model, there may be several tip caches, one per tenant

Parameters:
ctxt - The context specifying a historical configuration


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