com.starteam
Class Server

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

public class Server
extends java.lang.Object

The Server class provides network access to a remote StarTeam Server. It only supports access through TCP/IP sockets and has the ability to encrypt and compress all communication between the client server.


Nested Class Summary
static class Server.CacheController
          For each repository accessed via some Server object, we maintain a local cache that holds data fetched from the repository.
static class Server.EmailAttachment
          This class embodies an email attachment.
static class Server.EncryptionAlgorithm
          This class provides a convenient place to refer to the different encryption algorithms that can be used for secure StarTeam connections.
static class Server.ProductCode
          This public final class defines constant values for the various StarTeam product codes.
static class Server.Session
          Represents a user's session with the server.
static class Server.WebCacheServer
          Base accessor for cached SDK objects encapsulating the statefulness of objects obtained from the artifact cache.
 
Field Summary
static DotNotation CONNECT_AS_110
          The server command API revision level of the StarTeam 2009 (11.0) server.
static DotNotation CONNECT_AS_120
          The server command API revision level of the StarTeam 12.0 server.
static DotNotation CONNECT_AS_125
          The server command API revision level of the StarTeam 12.5 server.
static DotNotation CONNECT_AS_130
          The server command API revision level of the StarTeam 13.0 server.
static DotNotation CONNECT_AS_140
          The server command API revision level of the StarTeam 14.0 server.
 
Constructor Summary
Server(ServerInfo info)
          Creates a new Server object, using the given connection information.
Server(java.lang.String serverName)
          Looks up the given server name in starteam-servers.xml, and uses the resulting ServerInfo to construct the server.
Server(java.lang.String address, int port)
          Constructs an object that represents a remote server process.
 
Method Summary
 void addGroupListener(GroupListener listener)
          Adds a listener for Group events.
 void addMPXStatusListener(MPXStatusListener listener)
          Adds a listener for MPXStatusEvents.
 void addProjectListener(ProjectListener listener)
          Adds a listener for Project events.
 void addServerControlListener(ServerControlListener listener)
          Adds a listener for ServerControl events.
 void addTypedResourceListener(TypedResourceListener listener, LiveObject container, TypeCollection types)
          Adds a listener for all events occurring on the specified container (Currently supports Project, View and Folder) This is a lightweight solution for listening to events without the need to keep the container open.
 void addTypeListener(TypeListener listener)
          Adds a listener for Type events.
 void addUserListener(UserListener listener)
          Adds a listener for User events.
 CacheAgent autoLocateCacheAgent()
          autoLocate a Cache Agent, return null if none found Attempts to autolocate can be expensive
 User autoLogOn()
          Log on to this server using credentials that have been cached on this workstation.
 void cacheLogOnCredentials(java.lang.String username, java.lang.String password)
          Saves logon credentials for this server so that they may be used in future calls to autoLogOn().
 User changePassword(java.lang.String logOnName, java.lang.String password, java.lang.String newPassword)
          Changes the password to the specified new password upon a successful login to the server, and immediately logs out.
 void connect()
          Establishes a network connection to the remote server process.
 void connect(DotNotation clientVersion)
          Establishes a network connection to the remote server process.
 void createTenant(int tenantID, java.lang.String tenantName, java.lang.String tenantAdminLoginName, java.lang.String tenantAdminPassword)
          Create a new tenant in an environment that supports multi-tenant hosting Will throw a server exception for on-premise servers
 Item.Type createType(java.lang.String xmlDefinition, boolean toCreate)
          create a custom component (a new type) on the server.
static void declareComponentDefinition(java.lang.String typeName, java.lang.Class componentClass)
          Registers this type to a User-defined (custom) component class definition.
static void declareComponentDefinitions(java.lang.String typeName, java.lang.String propertyName, java.lang.Class[] clazz)
          Registers this type to a set of user defined custom component class definitions.
 void disableMPX()
          Disables MPX, if it was enabled for this server.
 void discardAccounts()
          Discards all cached User and Group information.
 void discardGroups()
          Discards cached Group information.
 void discardProjects()
          Discards the list of cached projects.
 void discardUsers()
          Discards cached User information.
 void disconnect()
          Terminates the network connection to the remote server process.
static void enableCredentialCaching()
          Enables credential caching on this workstation, if it is available and not already enabled.
 void enableMPX()
          Enables MPX using the default client MPX profile.
 void enableMPX(EventHandlerProfile profile)
          Enables MPX using the given MPX profile.
 void enableMPX(java.lang.String strProfileName)
          Enables MPX using the MPX profile with the given name.
static java.io.File encryptPasswordToFile(java.lang.String password, java.lang.String fileName)
          Encrypt and save the specified clear text password to a file Return the file to the caller when done
 User[] fetchEmailUsers()
          This method issues a command to the server to return the list of users who are able to receive email messages.
 Group findGroup(int groupID)
          Returns the Group object for the given ID.
 Project findProject(int projectID)
          Finds a project in the server's project collection.
 Project findProject(java.lang.String name)
          Finds a project in the server's project collection.
 User findUser(int userID)
          Returns the User object for the given ID.
 Group[] getActiveGroups()
          Returns all of the active (non-deleted) groups in this Server.
 User[] getActiveUsers()
          Returns all of the active (non-deleted) users in this Server.
 java.lang.String getAddress()
          Network address of this server.
 ServerAdministration getAdministration()
          Returns the ServerAdministration object through which various administration operations can be performed on the server.
 Group getAdministratorsGroup()
          Return an instance of the "Administrators" Group.
 Group getAllUsersGroup()
          Return an instance of the "AllUsers" Group.
 Application getApplication()
          Gets the client application that owns this Server instance.
 int getAutoReconnectAttempts()
          If automatic reconnect is enabled, indicates the maximum number of attempts to reconnect that will be made while executing a single server command.
 int getAutoReconnectWait()
          If automatic reconnect is enabled, indicates the number of seconds that we will wait before each reconnect attempt.
static ServerInfoCollection getCachedCredentials()
          If the StarTeam toolbar is running on this machine, and credentials have been cached return a collection of ServerInfo Objects representing Cached Credentials The returned ServerInfo objects in the collection have (at least) the user name, host name & port populated
 ClientContext getClientContext()
          Returns the ClientContext associated when logged in to the Server.
 java.lang.String getCommandAPIRevisionLevel()
          Returns the command interface revision level (dot notation) supported by this server.
 int getCommandCount()
          Gets the number of commands sent to the StarTeam server since the connection was established.
 CacheAgent getCurrentCacheAgent()
          returns the CacheAgent currently in use by this server, or null will attempt to locate a cache agent at a specified {address, port} or autoLocate one, if necessary
 EventHandlerProfile getCurrentMPXProfile()
          Gets the current MPX event handler profile.
 DateTime getCurrentTime()
          Gets the current time on the server.
 Server.EncryptionAlgorithm getEncryptionAlgorithm()
          Gets the level of EncryptionAlgorithm requested for the connection.
 EventHandlerInfo getEventHandlerInfo(java.lang.String eventHandlerInfoName)
          Returns the specified EventHandlerInfo object on this server.
 java.lang.String[] getEventHandlerInfoNames()
          Returns an array containing the names of all existing EventHandlerInfos on this server.
 Group[] getGroups()
          Returns all of the groups on this Server.
 int getKeepAliveInterval()
          Gets the keep-alive interval, in minutes.
 User getLoggedInUser()
          Gets the user object of the logged in user.
 int getMPXMessageCount()
          Gets the number of MPX messages received by the server since MPX was enabled.
 java.lang.String getMPXTransmitterName()
          The name of the event handler for the StarTeam MPX Transmitter.
 int getPort()
          TCP/IP port on which to connect to the remote server.
 Server.ProductCode[] getProductCodes()
          Gets the product codes licensed for this server.
 Project[] getProjects()
          Ensures that this server's project list has been retrieved and cached locally.
 int getProtocol()
          Gets the protocol used to connect to the server.
 GUID getRepositoryID()
          Uniquely identifies the repository served by this server amongst all StarTeam repositories in the universe.
 Server.EncryptionAlgorithm getRequiredEncryptionLevel()
          Returns the level of security required to connect to the server.
 short getRevisionLevel()
          Returns the interface revision level supported by this server.
 java.lang.String getServerBuild()
          Returns the server build number as reported by the server.
 java.lang.String getServerBuildDescription()
          Returns a server build description as reported by the server.
 ServerInfo getServerInfo()
          Return a copy of the serverInfo object used to construct this server session A copy is returned to prevent the caller from modifying the internal state of the server object after the connection has been established
 Server.Session getSession()
          Returns session information for the currently logged on user.
 Task.Status[] getStatus(Story.Status sts)
          Return the subset of Task Status values that match the specified Story Status for this project.
 SupportedFeatures getSupportedFeatures()
          Gets an instance of the SupportedFeatures class that can tell which features are available for this StarTeam server.
 TypeCollection getTypes()
          Returns collection of Type objects supported by this server.
 EnumeratedValue[] getUDAGroupings(Requirement.RequirementType typ)
          Return the subset of Requirement UDA Grouping values that match the specified Requirement Type for this project.
 User[] getUsers()
          Returns all the active and deleted users on this Server.
 PropertyCollection getVisibleProperties(EnumeratedValue value)
          Return the subset of properties that are visible in the context of the specified Enumerated Value
 void handleEvents()
          Places the current thread in an event-handling state.
 boolean hasInactivityTimeout()
          Returns true if the server has an inactivity timeout interval specified
 boolean hasProductCode(Server.ProductCode code)
          Determines whether or not the server has a license for the specified product code.
 boolean hasSavedStatus(Story.Status sts)
          Returns true if an explicit Story Status mapped to a Task Status (or set) has been saved for this project Note that if a status mapping is not saved to the server, the getStatus() api returns a default mapping
 void interruptHandleEvents()
          Interrupts a handleEvents() loop, if there is one running.
 boolean isAutoLogOnAvailable()
          Determines whether or not logon credentials for this server have been cached on this workstation.
 boolean isAutoReconnectEnabled()
          Indicates whether or not a reconnect is automatically attempted whenever a connection problem is detected while executing a server command.
 boolean isCompressed()
          Determines whether or not the server connection is compressed.
 boolean isConnected()
          Tells whether a network connection has been established to the server.
static boolean isCredentialCachingAvailable()
          Determines whether or not the credential caching feature is available on this workstation.
static boolean isCredentialCachingEnabled()
          Determines whether or not credential caching is enabled on this workstation.
 boolean isKeepAliveEnabled()
          Determines whether or not keep-alive mode is in effect.
 boolean isLoggedOn()
          Returns true if someone has logged on through this server object.
 boolean isMailAvailable()
          Determines whether or not the server supports email.
 boolean isMPXAvailable()
          Determines whether or not MPX is installed on this server.
 boolean isMPXEnabled()
          Determines whether or not MPX has been enabled for this server.
 boolean isMPXResponding()
          Determines whether or not the MPX server is running properly.
 boolean isRefreshAccountsRequired()
          Returns true if a refreshAccounts() operation might have resulted in User or Group information being updated; returns false if and only if it is known that the User and Group information had not been changed since the last refresh.
 boolean isRefreshGroupsRequired()
          Returns true if a refreshGroups() operation might have resulted in Group information being updated; returns false if and only if it is known that the Group information had not been changed since the last refresh.
 boolean isRefreshProjectsRequired()
          Determines whether or not the server's project list needs to be refreshed.
 boolean isRefreshUsersRequired()
          Returns true if a refreshUsers() operation might have resulted in User information being updated; returns false if and only if it is known that the User information had not been changed since the last refresh.
 CacheAgent locateCacheAgent(java.lang.String hostName, int port)
          locate a CacheAgent at a given address and port
 User logOn(java.lang.String logOnName, java.io.File passwordFile)
          Establishes a user-session with the remote server process.
 User logOn(java.lang.String logOnName, java.lang.String password)
          Establishes a user-session with the remote server process.
 User logOn(java.lang.String logOnName, java.lang.String password, ClientContext context)
          Establishes a user-session with the remote server process, on behalf of the specified ClientContext.
 User logOn(java.lang.String logOnName, java.lang.String password, GUID workStationID)
          Establishes a user-session with the remote server process, on behalf of the workstation with the given ID.
 GUID obtainLicense(User user)
          Get/Consume a license for the specified User, using this Server's session ID to obtain the license.
 GUID obtainLicense(User user, Server server)
          Get/Consume a license for the specified User, using the specified Server's session ID to obtain the license.
 boolean ping()
          Verifies that the server is responding and informs the server that this connection/user session is still active.
 void pingMPXServer()
          Throws an appropriate MPXException if the MPX server is not running properly.
 void reconnect()
          Attempts to re-establish the connection to the server, re-opening any existing view sessions.
 void reconnect(java.lang.String password)
          Attempts to re-establish the connection to the server, re-opening any existing view sessions.
 void refreshAccounts()
          Refreshes cached User and Group information.
 void refreshGroups()
          Refreshes cached Group information to reflect recent changes to the repository.
 void refreshProjects()
          Ensures that the latest list of projects has been retrieved from the server and cached locally.
 void refreshUsers()
          Refreshes cached User information to reflect recent changes to the repository.
 void releaseLicense(User user)
          Release a license owned by the specified User, where this Server's session ID was used to obtain the license.
 void releaseLicense(User user, GUID sessionID)
          Release the license obtained for the specified User via the specified GUID.
 void releaseLicense(User user, Server server)
          Release a license owned by the specified User, where the specified Server's session ID was used to obtain the license.
 void removeGroupListener(GroupListener listener)
          Removes a listener for Group events.
 void removeMPXStatusListener(MPXStatusListener listener)
          Removes a listener for MPXStatusEvents.
 void removeProjectListener(ProjectListener listener)
          Removes a listener for Project events.
 void removeServerControlListener(ServerControlListener listener)
          Removes a listener for ServerControl events.
 void removeTypedResourceListener(TypedResourceListener listener, LiveObject container)
          Removes a listener for TypedResource events.
 void removeTypeListener(TypeListener listener)
          Removes a listener for Type events.
 void removeUserListener(UserListener listener)
          Removes a listener for User events.
 void sendMail(View view, User[] to, User[] cc, User[] bcc, java.lang.String subject, java.lang.String body)
          Directs the StarTeam Server to send mail to the specified StarTeam users.
 void sendMail(View view, User[] to, User[] cc, User[] bcc, java.lang.String subject, java.lang.String body, Server.EmailAttachment[] attachments)
          Directs the StarTeam Server to send mail to the specified StarTeam users.
 void setAutoReconnectAttempts(int nAttempts)
          If automatic reconnect is enabled, specifies the maximum number of attempts to reconnect that will be made while executing a single server command.
 void setAutoReconnectEnabled(boolean bEnabled)
          Specifies whether or not a reconnect is automatically attempted whenever a connection problem is detected while executing a server command.
 void setAutoReconnectWait(int nSeconds)
          If automatic reconnect is enabled, specifies the number of seconds that we will wait before each reconnect attempt.
 void setKeepAlive(boolean bKeepAlive)
          Enables or disables keep-alive mode.
 void setKeepAliveInterval(int nMinutes)
          Sets the keep-alive interval, in minutes.
 void setStatus(Story.Status rfrnc, Task.Status[] mppdSts)
          Map a subset of Task Status values to specific Story States for the given project.
 void setUDAGroupings(Requirement.RequirementType typ, EnumeratedValue[] udas)
          Map a subset of UDA Grouping values to specific Requirement Types for the given project.
 void setVisibleProperties(EnumeratedValue value, PropertyCollection properties)
          Define a subset of properties of a given type that are marked visible
 void synchronize(java.lang.String[] keys, boolean acquire)
          Add or release a set of keys, i.e.
 java.lang.String toString()
          Returns a summary String representation of this server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECT_AS_110

public static final DotNotation CONNECT_AS_110
The server command API revision level of the StarTeam 2009 (11.0) server.

See Also:
Server.connect(DotNotation)

CONNECT_AS_120

public static final DotNotation CONNECT_AS_120
The server command API revision level of the StarTeam 12.0 server.

See Also:
Server.connect(DotNotation)

CONNECT_AS_125

public static final DotNotation CONNECT_AS_125
The server command API revision level of the StarTeam 12.5 server.

See Also:
Server.connect(DotNotation)

CONNECT_AS_130

public static final DotNotation CONNECT_AS_130
The server command API revision level of the StarTeam 13.0 server.

See Also:
Server.connect(DotNotation)

CONNECT_AS_140

public static final DotNotation CONNECT_AS_140
The server command API revision level of the StarTeam 14.0 server.

See Also:
Server.connect(DotNotation)
Constructor Detail

Server

public Server(java.lang.String serverName)
Looks up the given server name in starteam-servers.xml, and uses the resulting ServerInfo to construct the server. If no ServerInfo with that name is found, assumes that servername is the address, and uses the default port.

Parameters:
serverName - String a server name in starteam-servers.xml

Server

public Server(java.lang.String address,
              int port)
Constructs an object that represents a remote server process. Uses whatever EncryptionAlgorithm algorithm the server requires. The server does not require or enforce compression. The client application can choose to apply compression. To do so, create an instance of the ServerInfo object & set compression to true. Then use the Server constructor that takes a ServerInfo as a parameter

Parameters:
address - the host address of the remote server
port - the TCP/IP port of the remote server
See Also:
Server.Server(ServerInfo)

Server

public Server(ServerInfo info)
Creates a new Server object, using the given connection information.

The ServerInfo must specify a supported protocol; otherwise, an IllegalArgumentException will be thrown.

If ServerInfo specifies an MPXProfileName, then later, after the Server connection itself is established, an attempt will be made to automatically enable MPX.

Parameters:
info - Server connection information.
Throws:
java.lang.IllegalArgumentException
See Also:
ServerInfo, Server.connect(), Server.enableMPX()
Method Detail

getAdministratorsGroup

public Group getAdministratorsGroup()
Return an instance of the "Administrators" Group.

Returns:
"Administrators" group on this server.

getAllUsersGroup

public Group getAllUsersGroup()
Return an instance of the "AllUsers" Group.

Returns:
"AllUsers" group on this server.

getServerInfo

public ServerInfo getServerInfo()
Return a copy of the serverInfo object used to construct this server session A copy is returned to prevent the caller from modifying the internal state of the server object after the connection has been established

Returns:
A copy of serverInfo object used to construct this server session

getApplication

public Application getApplication()
Gets the client application that owns this Server instance.

Returns:
The client application that owns this Server instance.

getTypes

public TypeCollection getTypes()
Returns collection of Type objects supported by this server.

Returns:
a collection of Types instances

getAdministration

public ServerAdministration getAdministration()
Returns the ServerAdministration object through which various administration operations can be performed on the server.

Returns:
the ServerAdministration object for this server.

getSession

public Server.Session getSession()
Returns session information for the currently logged on user.

Returns:
session information for the currently logged on user.

fetchEmailUsers

public User[] fetchEmailUsers()
This method issues a command to the server to return the list of users who are able to receive email messages. returns an empty array if this server instance is not connected to the StarTeam Server


isRefreshUsersRequired

public boolean isRefreshUsersRequired()
Returns true if a refreshUsers() operation might have resulted in User information being updated; returns false if and only if it is known that the User information had not been changed since the last refresh. If MPX is not enabled, then isRefreshUsersRequired() always returns true.

Returns:
true if User information may be out of date.
See Also:
Server.refreshUsers(), Server.enableMPX()

refreshUsers

public void refreshUsers()
Refreshes cached User information to reflect recent changes to the repository. Modifies existing User objects in place whenever possible. If MPX is enabled, refreshUsers() is optimized to avoid unnecessary server commands.

See Also:
Server.isRefreshUsersRequired(), Server.getUsers(), Server.discardUsers(), Server.enableMPX()

discardUsers

public void discardUsers()
Discards cached User information. The next call to getUsers() will re-fetch the user information from the StarTeam Server (even when MPX is enabled).

See Also:
Server.getUsers(), Server.refreshUsers()

refreshAccounts

public void refreshAccounts()
Refreshes cached User and Group information. Existing User and Group objects are modified in place whenever possible.

See Also:
Server.isRefreshAccountsRequired(), Server.refreshUsers(), Server.refreshGroups(), Server.discardAccounts()

discardAccounts

public void discardAccounts()
Discards all cached User and Group information. It will be re-fetched from the server on demand (even when MPX is enabled).

See Also:
Server.refreshAccounts()

isRefreshAccountsRequired

public boolean isRefreshAccountsRequired()
Returns true if a refreshAccounts() operation might have resulted in User or Group information being updated; returns false if and only if it is known that the User and Group information had not been changed since the last refresh. If MPX is not enabled, then isRefreshUsersRequired() always returns true.

Returns:
true if User or Group information may be out of date.
See Also:
Server.refreshAccounts(), Server.isRefreshUsersRequired(), Server.isRefreshGroupsRequired(), Server.enableMPX()

isRefreshGroupsRequired

public boolean isRefreshGroupsRequired()
Returns true if a refreshGroups() operation might have resulted in Group information being updated; returns false if and only if it is known that the Group information had not been changed since the last refresh. If MPX is not enabled, then isRefreshUsersRequired() always returns true.

Returns:
true if Group information may be out of date.
See Also:
Server.refreshGroups(), Server.enableMPX()

discardGroups

public void discardGroups()
Discards cached Group information. The next call to getGroups() will re-fetch the group information from the StarTeam Server.

See Also:
Server.getGroups(), Server.refreshGroups()

refreshGroups

public void refreshGroups()
Refreshes cached Group information to reflect recent changes to the repository. Modifies existing Group objects in place whenever possible.

See Also:
Server.isRefreshGroupsRequired(), Server.getGroups(), Server.discardGroups()

getAddress

public java.lang.String getAddress()
Network address of this server.

Returns:
string representing the network address

getPort

public int getPort()
TCP/IP port on which to connect to the remote server.

Returns:
server's TCP/IP port

getEncryptionAlgorithm

public Server.EncryptionAlgorithm getEncryptionAlgorithm()
Gets the level of EncryptionAlgorithm requested for the connection.

Returns:
The level of EncryptionAlgorithm requested for the connection.
See Also:
Server.EncryptionAlgorithm

isCompressed

public boolean isCompressed()
Determines whether or not the server connection is compressed.

Returns:
true if the connection is compressed; false otherwise.

getProtocol

public int getProtocol()
Gets the protocol used to connect to the server.

Returns:
The protocol used to connect to the server.
See Also:
ServerConfiguration.PROTOCOL_TCP_IP_SOCKETS

getRepositoryID

public GUID getRepositoryID()
Uniquely identifies the repository served by this server amongst all StarTeam repositories in the universe. Be warned that it is possible to take an existing StarTeam repository and re-host it on another machine in which case this unique ID is no longer unique.

Returns:
com.starteam.util.GUID

getRequiredEncryptionLevel

public Server.EncryptionAlgorithm getRequiredEncryptionLevel()
Returns the level of security required to connect to the server.

Returns:
level of EncryptionAlgorithm required to connect to the server or NULL if this server instance is not connected to the StarTeam Server

isConnected

public boolean isConnected()
Tells whether a network connection has been established to the server.

Returns:
true if a network connection to the StarTeam server has been established.

getClientContext

public ClientContext getClientContext()
Returns the ClientContext associated when logged in to the Server. This may return null if not logged in.

Returns:
the ClientContext associated when logged in to the Server. May return null if not logged in.

getProjects

public Project[] getProjects()
Ensures that this server's project list has been retrieved and cached locally. The project list is retrieved from the StarTeam repository only if it has not already been retrieved. Therefore, the projects may or may not be up-to-date with respect to the latest information in the repository. To ensure that the projects are up-to-date, use refreshProjects().

Returns:
The server's project list.
See Also:
Server.refreshProjects()

isRefreshProjectsRequired

public boolean isRefreshProjectsRequired()
Determines whether or not the server's project list needs to be refreshed. A refresh is required if the cached projects are not known to be up-to-date with respect to the latest information in the repository. Specifically, a refresh is required if:

Returns:
true if a refresh is required; false otherwise.
See Also:
Server.refreshProjects(), Server.enableMPX()

refreshProjects

public void refreshProjects()
Ensures that the latest list of projects has been retrieved from the server and cached locally. Also ensures that any previously cached project property values are up-to-date. refreshProjects() re-uses existing Project objects whenever possible, changing cached property values as necessary to bring older Projects up-to-date. When MPX is enabled, refreshProjects() is optimized to avoid unnecessary server commands.

See Also:
Server.getProjects(), Server.isRefreshProjectsRequired(), Server.discardProjects(), Server.enableMPX()

discardProjects

public void discardProjects()
Discards the list of cached projects. A subsequent call to getProjects() will re-fetch the projects from the server (even when MPX is enabled).

See Also:
Server.getProjects(), Server.refreshProjects(), Server.enableMPX()

findProject

public Project findProject(int projectID)
Finds a project in the server's project collection.

Parameters:
projectID - The project ID of the desired project.
Returns:
The project with the given ID, or null if no such project was found.

findProject

public Project findProject(java.lang.String name)
Finds a project in the server's project collection.

Parameters:
name - The name of the desired project.
Returns:
The project with the given ID, or null if no such project was found.

getActiveUsers

public User[] getActiveUsers()
Returns all of the active (non-deleted) users in this Server. The users returned contain only a limited subset of the full user account information. However, applications requiring access to the complete user account information should use use ServerAdministration.getUsers() to reduce the number of server commands issued.

Returns:
All of the active (non-deleted) users in this Server.
See Also:
Server.getUsers(), ServerAdministration.getUsers()

getUsers

public User[] getUsers()
Returns all the active and deleted users on this Server. The users returned contain only a limited subset of the whole account information and has low memory footprint, compared to ServerAdministration.getUsers() which loads the complete account information for all users. However, applications requiring access to the full user account information should use use ServerAdministration.getUsers() to reduce the number of server commands issued.

Returns:
All of the active and deleted users in this Server.
See Also:
Server.refreshUsers(), Server.discardUsers(), Server.getActiveUsers(), ServerAdministration.getUsers()

getActiveGroups

public Group[] getActiveGroups()
Returns all of the active (non-deleted) groups in this Server. The groups returned contain only a limited subset of the whole group account information However, applications requiring access to the full group account data should use use ServerAdministration.getGroups() to reduce the number of server commands issued.

Returns:
All of the active (non-deleted) groups in this Server.
See Also:
Server.getGroups(), ServerAdministration.getGroups()

getGroups

public Group[] getGroups()
Returns all of the groups on this Server. This includes both active and deleted groups. The groups returned contain only a limited subset of the group account information Use ServerAdministration.getGroups() to load the complete group account information

Returns:
All of the groups on this server.
See Also:
Server.refreshGroups(), Server.discardGroups(), Server.getActiveGroups()

findUser

public User findUser(int userID)
Returns the User object for the given ID. The user returned will contain only a limited subset of the account information. Returns null if userID is not found.

Parameters:
userID - the user ID in question
Returns:
the User object with the given ID.Will return null if not found.
See Also:
Server.getUsers()

findGroup

public Group findGroup(int groupID)
Returns the Group object for the given ID.

Parameters:
groupID - the group ID in question
Returns:
the Group object with the given ID. Will return null if not found.
See Also:
Server.getGroups()

getSupportedFeatures

public SupportedFeatures getSupportedFeatures()
Gets an instance of the SupportedFeatures class that can tell which features are available for this StarTeam server. Will throw an exception if the client is not yest connected to the server.

Returns:
An instance of the SupportedFeatures class that can tell which features are available for this StarTeam server
Throws:
java.lang.IllegalStateException - if the server is not connected
See Also:
Server.isConnected()

getProductCodes

public Server.ProductCode[] getProductCodes()
Gets the product codes licensed for this server. Will return an empty array if the server does not support that information or if a user has not yet logged in.

Returns:
The product codes licensed for this server.
See Also:
Server.ProductCode, Server.hasProductCode(com.starteam.Server.ProductCode)

hasProductCode

public boolean hasProductCode(Server.ProductCode code)
Determines whether or not the server has a license for the specified product code. Will return false if the information is not available from the server.

Parameters:
code - A product code.
Returns:
true if the server has a license for the specified product code.
See Also:
Server.ProductCode, Server.getProductCodes()

getRevisionLevel

public short getRevisionLevel()
Returns the interface revision level supported by this server. Different releases of StarTeam will have different revision levels indicating changes in command syntax or semantics. The SDK client classes will insulate users from these changes when possible by being backwards compatible with older releases of the StarTeam Server.

Returns:
the revision level of this server.

getCommandAPIRevisionLevel

public java.lang.String getCommandAPIRevisionLevel()
Returns the command interface revision level (dot notation) supported by this server. Different releases of StarTeam will have different revision levels indicating changes in command syntax or semantics. The SDK client classes will insulate users from these changes when possible by being backwards compatible with older releases of the StarTeam Server.

Returns:
the command API revision level of this server.

getServerBuild

public java.lang.String getServerBuild()
Returns the server build number as reported by the server. Returns an empty string if this server object is not connected.

Returns:
The server build number.

getServerBuildDescription

public java.lang.String getServerBuildDescription()
Returns a server build description as reported by the server. Will return an empty string if this server object is not connected to the server.

Returns:
The server build description.

getCommandCount

public int getCommandCount()
Gets the number of commands sent to the StarTeam server since the connection was established. This method is useful for debugging performance related problems.

Returns:
The number of commands sent to the StarTeam server since the connection was established.

getMPXMessageCount

public int getMPXMessageCount()
Gets the number of MPX messages received by the server since MPX was enabled. Useful for debugging MPX related problems.

Returns:
The number of MPX messages received since MPX was enabled; 0 if not enabled.

connect

public void connect()
Establishes a network connection to the remote server process.

If the network connection is successfully established, and an MPXProfileName was specified in the Server constructor, then an attempt is made to automatically enable MPX. If an MPXException is thrown, it will be ignored, and will not cause the connect() to fail. An application can use isMPXEnabled() to determine whether or not MPX was properly enabled.

See Also:
Server.Server(ServerInfo), Server.enableMPX(), Server.isMPXEnabled()

connect

public void connect(DotNotation clientVersion)
Establishes a network connection to the remote server process.

This variation of connect() allows the client application to request a specific version of the server's command API. For example, requesting CONNECT_AS_110 would make a more recent server behave as if it were connecting to a StarTeam 11.0 client.

Parameters:
clientVersion - a representation of the specific version of the command api requested
See Also:
Server.connect()

disconnect

public void disconnect()
Terminates the network connection to the remote server process. The user will be logged off, and this server instance is effectively useless. Once disconnected, all objects & states previously associated with this server instance are now stale and cannot be relied upon. Even attempting a reconnect will not refresh them.


logOn

public User logOn(java.lang.String logOnName,
                  java.lang.String password)
Establishes a user-session with the remote server process. All subsequent user operations will be performed within the constraints of the privileges associated with the supplied user credentials.

Parameters:
logOnName - the user's logon name
password - the user's password
Returns:
the logged on user

encryptPasswordToFile

public static java.io.File encryptPasswordToFile(java.lang.String password,
                                                 java.lang.String fileName)
                                          throws java.io.IOException
Encrypt and save the specified clear text password to a file Return the file to the caller when done

Parameters:
password - the clear text password
fileName - the fully qualified path to a file If fileName is null or empty, a temporary file with the prefix "pwd" will be created The returned file with the encrypted password can be used by the method Server.logOn(String, java.io.File) or through the CommandProcessor
Returns:
a file containing the encrypted string
Throws:
java.io.IOException - if a file cannot be created
See Also:
CommandProcessor

logOn

public User logOn(java.lang.String logOnName,
                  java.io.File passwordFile)
Establishes a user-session with the remote server process. All subsequent user operations will be performed within the constraints of the privileges associated with the supplied user credentials.

Parameters:
logOnName - the user's logon name
passwordFile - the encrypted user's password saved in a file via the StarTeam Command Line or using the static method Server.encryptPasswordToFile(String, String)
Returns:
the logged on user
See Also:
CommandProcessor

changePassword

public User changePassword(java.lang.String logOnName,
                           java.lang.String password,
                           java.lang.String newPassword)
Changes the password to the specified new password upon a successful login to the server, and immediately logs out. New password is immediately effective upon a successful change of password.

Parameters:
logOnName - The user's logon name.
password - The user's old password.
newPassword - The user's new password.

logOn

public User logOn(java.lang.String logOnName,
                  java.lang.String password,
                  GUID workStationID)
Establishes a user-session with the remote server process, on behalf of the workstation with the given ID. This is useful when running on behalf of a remote client workstation.

Parameters:
logOnName - The user's logon name.
password - The user's password.
workStationID - The GUID of the client workstation.
Returns:
The logged on user.
See Also:
GUID

logOn

public User logOn(java.lang.String logOnName,
                  java.lang.String password,
                  ClientContext context)
Establishes a user-session with the remote server process, on behalf of the specified ClientContext. This is useful when running on behalf of a remote client workstation.

Parameters:
logOnName - The user's logon name.
password - The user's password.
context - The ClientContext of the client workstation.
Returns:
The logged on user.
See Also:
GUID

reconnect

public void reconnect()
Attempts to re-establish the connection to the server, re-opening any existing view sessions.

Uses the user credentials provided at logon time.

See Also:
Server.isAutoReconnectEnabled()

reconnect

public void reconnect(java.lang.String password)
Attempts to re-establish the connection to the server, re-opening any existing view sessions.

The server will re-authenticate the connection using the user name provided at logon time and the given password.

Parameters:
password - The password used to re-authenticate the connection.

isAutoReconnectEnabled

public boolean isAutoReconnectEnabled()
Indicates whether or not a reconnect is automatically attempted whenever a connection problem is detected while executing a server command.

Returns:
true if a reconnect is automatically attempted whenever a connection problem is detected while executing a server command. Automatic reconnect is enabled by default.
See Also:
Server.getAutoReconnectAttempts(), Server.getAutoReconnectWait(), Server.reconnect()

setAutoReconnectEnabled

public void setAutoReconnectEnabled(boolean bEnabled)
Specifies whether or not a reconnect is automatically attempted whenever a connection problem is detected while executing a server command.

Parameters:
bEnabled - true if a reconnect is automatically attempted whenever a connection problem is detected while executing a server command.

getAutoReconnectAttempts

public int getAutoReconnectAttempts()
If automatic reconnect is enabled, indicates the maximum number of attempts to reconnect that will be made while executing a single server command.

Returns:
If automatic reconnect is enabled, the maximum number of attempts to reconnect that will be made while executing a single server command. Default value is 1.
See Also:
Server.isAutoReconnectEnabled(), Server.getAutoReconnectWait(), Server.reconnect()

setAutoReconnectAttempts

public void setAutoReconnectAttempts(int nAttempts)
If automatic reconnect is enabled, specifies the maximum number of attempts to reconnect that will be made while executing a single server command.

Parameters:
nAttempts - If automatic reconnect is enabled, the maximum number of attempts to reconnect that will be made while executing a single server command.

getAutoReconnectWait

public int getAutoReconnectWait()
If automatic reconnect is enabled, indicates the number of seconds that we will wait before each reconnect attempt.

Returns:
If automatic reconnect is enabled, the number of seconds that we will wait before each reconnect attempt. Default value is 2 seconds.
See Also:
Server.isAutoReconnectEnabled(), Server.getAutoReconnectAttempts(), Server.reconnect()

setAutoReconnectWait

public void setAutoReconnectWait(int nSeconds)
If automatic reconnect is enabled, specifies the number of seconds that we will wait before each reconnect attempt.

Parameters:
nSeconds - If automatic reconnect is enabled, the number of seconds that we will wait before each reconnect attempt.

ping

public boolean ping()
Verifies that the server is responding and informs the server that this connection/user session is still active.

Returns:
true if the server responds, false if the server fails to respond for any reason, including not being connected

declareComponentDefinitions

public static void declareComponentDefinitions(java.lang.String typeName,
                                               java.lang.String propertyName,
                                               java.lang.Class[] clazz)
Registers this type to a set of user defined custom component class definitions. The classes should subclass either Item or TreeItem, but not both. The classes should be "public" and should provide a public constructor with a single argument of type "com.starteam.Folder". The value of the specified property, for a given artifact instance, determines the class definition chosen to "house" the artifact instance. This value must equal the name of one of the classes specified in the array. If a property value does not match any name in the array, the algorithm falls back to choose the definition (if any) provided for the type as a whole or else to Item or TreeItem as the case may be.

Parameters:
typeName - String The name of the Type to be registered
propertyName - String The name of the property whose value matches one of the class names in the array
clazz - a set of classes which provide alternate definitions for an artifact instance
Throws:
java.lang.IllegalArgumentException
See Also:
The SDK makes no assumptions about the assignability of the class definitions w.r.t. each other, other than that they subclass {Tree}Item and override the public constructor which takes the single Folder parameter. Call this method before calling either connect() or logon() on a server instance Note that usage of this api requires the specified property value to have been loaded prior to calls to View.findItem(...) or Folder.getItems(...), Class.getName()

declareComponentDefinition

public static void declareComponentDefinition(java.lang.String typeName,
                                              java.lang.Class componentClass)
Registers this type to a User-defined (custom) component class definition. The class should be an subclass of either an Item or TreeItem, whichever is appropriate. It should be "public" and provide a public constructor with a single argument of type "com.starteam.Folder". Alternately, if this class is a factory for encapsulating components of different types but a common super-set of properties, it needs a public constructor which takes 2 arguments; a String and a second argument of type "com.starteam.Folder". The string is the type name with which the SDK will instantiate the object encapsulating the appropriate type. Note that this class MUST provide either one of these two constructors but not both. In addition, if the class is a subclass of TreeItem, it also needs a second constructor which should also be "public" and has a single argument of type "com.starteam.TreeItem" or any assignable super-class including itself. Once registered, the class can be used just like regular StarTeam Component classes (File,Requirement,Task etc) If the component intends to add Custom Client Calculated Properties, it also needs to extend the Type model and the Property Collection i.e. it needs to implement a public static Type class that derives from the basic Type and hook in Custom Client Calculated Properties into the Property Collection Call this method before calling either connect() or logon() on a server instance

Parameters:
typeName - String The name of the Type to be registered or a regular expression wildcard describing a set of types
componentClass - the component class
Throws:
java.lang.IllegalArgumentException

getCurrentTime

public DateTime getCurrentTime()
Gets the current time on the server. Supported by StarTeam server versions 9.0 and later.

Returns:
The current server time or NULL if this server instance is not connected to the StarTeam Server

isCredentialCachingAvailable

public static boolean isCredentialCachingAvailable()
Determines whether or not the credential caching feature is available on this workstation. Currently, credential caching is available only when the StarTeam toolbar is installed. Note that credential caching may be available, but not enabled.

Returns:
true if the credential caching feature is available on this workstation, and false otherwise.
See Also:
Server.autoLogOn(), Server.isCredentialCachingEnabled()

isCredentialCachingEnabled

public static boolean isCredentialCachingEnabled()
Determines whether or not credential caching is enabled on this workstation. Currently, credential caching is enabled only when the StarTeam toolbar is running.

Returns:
true if credential caching is enabled on this workstation, and false otherwise.
See Also:
Server.autoLogOn(), Server.isCredentialCachingAvailable(), Server.enableCredentialCaching()

getCachedCredentials

public static ServerInfoCollection getCachedCredentials()
                                                 throws java.io.IOException
If the StarTeam toolbar is running on this machine, and credentials have been cached return a collection of ServerInfo Objects representing Cached Credentials The returned ServerInfo objects in the collection have (at least) the user name, host name & port populated

Returns:
a collection of ServerInfo Objects representing Cached Credentials
Throws:
java.io.IOException
See Also:
ServerInfo.getHost(), ServerInfo.getPort(), ServerInfo.getUserName()

enableCredentialCaching

public static void enableCredentialCaching()
Enables credential caching on this workstation, if it is available and not already enabled. Currently, this starts the StarTeam Toolbar.

See Also:
Server.autoLogOn(), Server.isCredentialCachingAvailable(), Server.isCredentialCachingEnabled(), Server.cacheLogOnCredentials(java.lang.String, java.lang.String)

isAutoLogOnAvailable

public boolean isAutoLogOnAvailable()
Determines whether or not logon credentials for this server have been cached on this workstation. If so, then the auto logon feature may be used to logon using the cached credentials.

Returns:
true if logon credentials for this server have been cached on this workstation, and false otherwise.
See Also:
Server.autoLogOn(), Server.isCredentialCachingEnabled(), Server.cacheLogOnCredentials(java.lang.String, java.lang.String)

autoLogOn

public User autoLogOn()
Log on to this server using credentials that have been cached on this workstation.

Returns:
the logged on user object
See Also:
Server.isAutoLogOnAvailable(), Server.cacheLogOnCredentials(java.lang.String, java.lang.String)

cacheLogOnCredentials

public void cacheLogOnCredentials(java.lang.String username,
                                  java.lang.String password)
Saves logon credentials for this server so that they may be used in future calls to autoLogOn().

Parameters:
username - the user name to save.
password - the password to save.
See Also:
Server.autoLogOn(), Server.isAutoLogOnAvailable(), Server.isCredentialCachingEnabled()

createType

public Item.Type createType(java.lang.String xmlDefinition,
                            boolean toCreate)
create a custom component (a new type) on the server. Support for Custom Components has been introduced in the 12.0 release

Parameters:
xmlDefinition - the xml definition describing the schema of the new Type
toCreate - true to create the Component, false to verify the schema
Returns:
the Type matching the component definition or NULL if the schema is being verified

createTenant

public void createTenant(int tenantID,
                         java.lang.String tenantName,
                         java.lang.String tenantAdminLoginName,
                         java.lang.String tenantAdminPassword)
Create a new tenant in an environment that supports multi-tenant hosting Will throw a server exception for on-premise servers

Parameters:
tenantID - the tenant ID
tenantName - the tenant Name
tenantAdminLoginName - the Login Name of the Tenant Administrator
tenantAdminPassword - a clear text password for the Tenant Administrator

synchronize

public void synchronize(java.lang.String[] keys,
                        boolean acquire)
Add or release a set of keys, i.e. acquire a lock for these named keys The server will synchronize access to an internal hash table across any/all threads which attempt key acquisitions. The first thread wins and acquires the key all subsequent threads lose and a server exception will be thrown If this method fails, a server exception will be thrown Well behaved applications that acquire a locked key should release it as quickly as possible

Parameters:
keys - the keys to be acquired or released
acquire - true to acquire the keys, false to release them

toString

public java.lang.String toString()
Returns a summary String representation of this server.

Overrides:
toString in class java.lang.Object
Returns:
a summary string for this server

isLoggedOn

public boolean isLoggedOn()
Returns true if someone has logged on through this server object.

Returns:
true if someone has logged on through this server object.

getLoggedInUser

public User getLoggedInUser()
Gets the user object of the logged in user.

Returns:
The user object of the logged in user, or null if no one has logged in.

sendMail

public void sendMail(View view,
                     User[] to,
                     User[] cc,
                     User[] bcc,
                     java.lang.String subject,
                     java.lang.String body)
Directs the StarTeam Server to send mail to the specified StarTeam users.

Parameters:
view - a valid view the sender has access to
to - the user IDs to whom the mail should be sent (To:)
cc - the user IDs to whom the mail should be cc'd (Cc:)
bcc - the user IDs to whom the mail should be blind-cc'd (Bcc:)
subject - the subject text for the mail message
body - the body of the mail message

sendMail

public void sendMail(View view,
                     User[] to,
                     User[] cc,
                     User[] bcc,
                     java.lang.String subject,
                     java.lang.String body,
                     Server.EmailAttachment[] attachments)
Directs the StarTeam Server to send mail to the specified StarTeam users.

Parameters:
view - a valid view the sender has access to
to - the users to whom the mail should be sent (To:)
cc - the users to whom the mail should be cc'd (Cc:)
bcc - the users to whom the mail should be blind-cc'd (Bcc:)
subject - the subject text for the mail message
body - the body of the mail message
attachments - The attachments to include with the email

isMailAvailable

public boolean isMailAvailable()
Determines whether or not the server supports email.

Returns:
true if the server supports email or false if this server instance is not connected to the StarTeam Server

getEventHandlerInfoNames

public java.lang.String[] getEventHandlerInfoNames()
Returns an array containing the names of all existing EventHandlerInfos on this server.

Returns:
an array containing the names of all existing EventHandlerInfos on this server.

getEventHandlerInfo

public EventHandlerInfo getEventHandlerInfo(java.lang.String eventHandlerInfoName)
Returns the specified EventHandlerInfo object on this server. If no such EventhandlerInfo exist, a null is returned.

Parameters:
eventHandlerInfoName - The name of the EventHandlerInfo object to be returned.
Returns:
the specified EventHandlerInfo object on this server. If no such EventhandlerInfo exist, a null is returned.
See Also:
Server.getEventHandlerInfoNames()

getMPXTransmitterName

public java.lang.String getMPXTransmitterName()
The name of the event handler for the StarTeam MPX Transmitter. Pass this name to Server.getEventHandlerInfo() to get the event handler information for the MPX event transmitter. Pre-9.0 servers use the name "StarbaseMPX Transmitter" 9.0 servers use the name "StarTeamMPX Transmitter"

Returns:
StarTeam MPX Transmitter name

isMPXAvailable

public boolean isMPXAvailable()
Determines whether or not MPX is installed on this server.

Returns:
true if MPX is installed on this server, and false otherwise. Note that if MPX is installed, that does not necessarily mean that you can successfully enable MPX (for example, the Message Broker might not be running).
See Also:
Server.enableMPX(), Server.enableMPX(String), Server.enableMPX(EventHandlerProfile)

enableMPX

public void enableMPX()
               throws MPXException
Enables MPX using the default client MPX profile.

Throws:
MPXException
See Also:
Server.enableMPX(String), Server.enableMPX(EventHandlerProfile)

enableMPX

public void enableMPX(java.lang.String strProfileName)
               throws MPXException
Enables MPX using the MPX profile with the given name.

Parameters:
strProfileName - The name of an MPX profile on this server.
Throws:
MPXException
See Also:
Server.enableMPX(), Server.enableMPX(EventHandlerProfile)

enableMPX

public void enableMPX(EventHandlerProfile profile)
               throws MPXException
Enables MPX using the given MPX profile.

Parameters:
profile - An MPX profile.
Throws:
MPXException
See Also:
Server.enableMPX(), Server.enableMPX(String), Server.isMPXAvailable(), Server.isMPXEnabled(), Server.isMPXResponding(), Server.pingMPXServer(), Server.disableMPX()

isMPXEnabled

public boolean isMPXEnabled()
Determines whether or not MPX has been enabled for this server.

Returns:
true if MPX has been enabled for this server, and false otherwise.

getCurrentMPXProfile

public EventHandlerProfile getCurrentMPXProfile()
Gets the current MPX event handler profile.

Returns:
The EventHandlerProfile of the MPX message broker, or null if MPX is not currently enabled.

isMPXResponding

public boolean isMPXResponding()
Determines whether or not the MPX server is running properly.

Returns:
true if the MPX server is running properly, and false otherwise.

pingMPXServer

public void pingMPXServer()
                   throws MPXException
Throws an appropriate MPXException if the MPX server is not running properly.

Throws:
MPXException

disableMPX

public void disableMPX()
Disables MPX, if it was enabled for this server.


addTypedResourceListener

public void addTypedResourceListener(TypedResourceListener listener,
                                     LiveObject container,
                                     TypeCollection types)
Adds a listener for all events occurring on the specified container (Currently supports Project, View and Folder) This is a lightweight solution for listening to events without the need to keep the container open. For instance, a build process can continuously monitor a particular view for File events to trigger a build, without actually keeping the view open.

Event handlers will be triggered whenever a TypedResource is added, changed or deleted in the specified container. Note that an application will receive only those events for which they have access, and for types to which they have registered.

In order to handle events, an application must enable MPX.

Parameters:
listener - Application-specific event handler for TypedResource events.
container - the container whose events the application is interested on. If null, application gets events on all views on the server.
types - event types (File, ChangeRequest etc) that the application is interested on.
See Also:
TypedResourceListener, Server.removeTypedResourceListener(com.starteam.events.TypedResourceListener, com.starteam.LiveObject), Server.enableMPX()

removeTypedResourceListener

public void removeTypedResourceListener(TypedResourceListener listener,
                                        LiveObject container)
Removes a listener for TypedResource events.

Parameters:
listener - Previously-registered event handler for TypedResource events.
container -
See Also:
TypedResourceListener, Server.addTypedResourceListener(com.starteam.events.TypedResourceListener, com.starteam.LiveObject, com.starteam.TypeCollection), Server.enableMPX()

handleEvents

public void handleEvents()
Places the current thread in an event-handling state.

While in an event-handling state, the thread is usually asleep, waking occasionally just long enough to ping the server (keeping the connection alive). The event-handling loop continues until some other thread (presumably, the event-handling thread for this Server object) calls interruptHandleEvents().

An application does not need to call handleEvents() in order to handle events; this is just a convenience method for applications that have nothing else they need to do while waiting for an event to occur.

Only one thread may call handleEvents() per Server object at any given time. After handleEvents() exits (as a result of a call to interruptHandleEvents), then handleEvents() may be called again by the same thread or by some other thread.

handleEvents() will fail if MPX is not enabled, or if there are no event-handlers running.

handleEvents() should not be called from within an event handler. (This would put the event-handling thread to sleep.)

See Also:
Server.interruptHandleEvents(), Server.enableMPX()

interruptHandleEvents

public void interruptHandleEvents()
Interrupts a handleEvents() loop, if there is one running. Usually called from within an event-handler, running in the event-handling thread for this Server object.

See Also:
Server.handleEvents()

addMPXStatusListener

public void addMPXStatusListener(MPXStatusListener listener)
Adds a listener for MPXStatusEvents.

Event handlers will be triggered whenever an important change occurs in the status of MPX or the MPX event transmitter.

Parameters:
listener - Application-specific event handler for MPXStatusEvents.
See Also:
MPXStatusListener, Server.removeMPXStatusListener(com.starteam.events.MPXStatusListener)

removeMPXStatusListener

public void removeMPXStatusListener(MPXStatusListener listener)
Removes a listener for MPXStatusEvents.

Parameters:
listener - Previously-registered event handlers for MPXStatusEvents.
See Also:
MPXStatusListener, Server.addMPXStatusListener(com.starteam.events.MPXStatusListener)

addServerControlListener

public void addServerControlListener(ServerControlListener listener)
Adds a listener for ServerControl events.

Event handlers will be triggered whenever this Server is stopped or restarted.

In order to handle events, an application must enable MPX.

Parameters:
listener - Application-specific event handler for ServerControl events.
See Also:
ServerControlListener, Server.removeServerControlListener(com.starteam.events.ServerControlListener), Server.enableMPX()

removeServerControlListener

public void removeServerControlListener(ServerControlListener listener)
Removes a listener for ServerControl events.

Parameters:
listener - Previously-registered event handlers for ServerControl events.
See Also:
ServerControlListener, Server.addServerControlListener(com.starteam.events.ServerControlListener)

addTypeListener

public void addTypeListener(TypeListener listener)
Adds a listener for Type events.

Event handlers will be triggered whenever a Type (or its associated Properties) are modified on this Server.

In order to handle events, an application must enable MPX.

Parameters:
listener - Application-specific event handler for Type events.
See Also:
TypeListener, Server.removeTypeListener(com.starteam.events.TypeListener), Server.enableMPX()

removeTypeListener

public void removeTypeListener(TypeListener listener)
Removes a listener for Type events.

Parameters:
listener - Previously-registered event handler for Type events.
See Also:
TypeListener, Server.addTypeListener(com.starteam.events.TypeListener)

addUserListener

public void addUserListener(UserListener listener)
Adds a listener for User events.

Event handlers will be triggered whenever a User is added, changed or deleted on this Server.

In order to handle events, an application must enable MPX.

Parameters:
listener - Application-specific event handler for User events.
See Also:
UserListener, Server.removeUserListener(com.starteam.events.UserListener), Server.enableMPX()

removeUserListener

public void removeUserListener(UserListener listener)
Removes a listener for User events.

Parameters:
listener - Previously-registered event handler for User events.
See Also:
UserListener, Server.addUserListener(com.starteam.events.UserListener)

addProjectListener

public void addProjectListener(ProjectListener listener)
Adds a listener for Project events.

Event handlers will be triggered whenever a Project is added, changed or deleted on this Server. Note that an application will not receive events for Projects that the logged-in user does not have permission to access.

In order to handle events, an application must enable MPX.

Parameters:
listener - Application-specific event handler for Project events.
See Also:
ProjectListener, Server.removeProjectListener(com.starteam.events.ProjectListener), Server.enableMPX()

removeProjectListener

public void removeProjectListener(ProjectListener listener)
Removes a listener for Project events.

Parameters:
listener - Previously-registered event handler for Project events.
See Also:
ProjectListener, Server.addProjectListener(com.starteam.events.ProjectListener)

addGroupListener

public void addGroupListener(GroupListener listener)
Adds a listener for Group events.

Event handlers will be triggered whenever a Group is added, changed or deleted on this Server.

In order to handle events, an application must enable MPX.

Parameters:
listener - Application-specific event handler for Group events.
See Also:
GroupListener, Server.removeGroupListener(com.starteam.events.GroupListener), Server.enableMPX()

removeGroupListener

public void removeGroupListener(GroupListener listener)
Removes a listener for Group events.

Parameters:
listener - Previously-registered event handler for Group events.
See Also:
GroupListener, Server.addGroupListener(com.starteam.events.GroupListener)

hasInactivityTimeout

public boolean hasInactivityTimeout()
Returns true if the server has an inactivity timeout interval specified

Returns:
True if the server has an Inactivity Timeout Interval specified

getKeepAliveInterval

public int getKeepAliveInterval()
Gets the keep-alive interval, in minutes. When keep-alive is in effect, the keep-alive interval is the number of minutes between successive calls to ping().

Returns:
The current keep-alive interval, in minutes.
See Also:
Server.setKeepAlive(boolean)

setKeepAliveInterval

public void setKeepAliveInterval(int nMinutes)
Sets the keep-alive interval, in minutes. When keep-alive is in effect, the keep-alive interval is the number of minutes between successive calls to ping(). Setting the keep-alive interval to zero uses a default value based on the inactivity timeout.

Parameters:
nMinutes - The new keep-alive interval, in minutes.

isKeepAliveEnabled

public boolean isKeepAliveEnabled()
Determines whether or not keep-alive mode is in effect.

Returns:
true if keep-alive mode is in effect; false otherwise. In keep-alive mode, a background thread periodically pings the server to keep the connection alive. Keep-alive is off by default.
See Also:
Server.getKeepAliveInterval()

setKeepAlive

public void setKeepAlive(boolean bKeepAlive)
Enables or disables keep-alive mode.

Parameters:
bKeepAlive - true to enable keep-alive mode; false to disable it. In keep-alive mode, a background thread periodically pings the server to keep the connection alive. Keep-alive is off by default.

autoLocateCacheAgent

public CacheAgent autoLocateCacheAgent()
autoLocate a Cache Agent, return null if none found Attempts to autolocate can be expensive

Returns:
CacheAgent a CacheAgent if found, or null
See Also:
ServerInfo.getAutoLocateCacheAgent()

locateCacheAgent

public CacheAgent locateCacheAgent(java.lang.String hostName,
                                   int port)
locate a CacheAgent at a given address and port

Parameters:
hostName - String the address at which to look for a cache agent
port - int the port the cache agent is running on
Returns:
CacheAgent a CacheAgent if found, or null
See Also:
ServerInfo.getMPXCacheAgentAddress(), ServerInfo.getMPXCacheAgentPort()

getCurrentCacheAgent

public CacheAgent getCurrentCacheAgent()
returns the CacheAgent currently in use by this server, or null will attempt to locate a cache agent at a specified {address, port} or autoLocate one, if necessary

Returns:
CacheAgent the CacheAgent currently in use by this server, or null
See Also:
Server.locateCacheAgent(String, int), Server.autoLocateCacheAgent()

obtainLicense

public GUID obtainLicense(User user)
Get/Consume a license for the specified User, using this Server's session ID to obtain the license. Returns the SessionID (GUID) that was used to obtain the license.

Parameters:
user - the user who will "own" the license.
Returns:
the GUID that was used to obtain the license.

obtainLicense

public GUID obtainLicense(User user,
                          Server server)
Get/Consume a license for the specified User, using the specified Server's session ID to obtain the license. Returns the SessionID (GUID) that was used to obtain the license.

Parameters:
user - the user who will "own" the license.
server - the server whose session ID will be used to obtain the license.
Returns:
the GUID that was used to obtain the license.

releaseLicense

public void releaseLicense(User user)
Release a license owned by the specified User, where this Server's session ID was used to obtain the license.

Parameters:
user - the user who "owns" the license.

releaseLicense

public void releaseLicense(User user,
                           Server server)
Release a license owned by the specified User, where the specified Server's session ID was used to obtain the license.

Parameters:
user - the user who "owns" the license.
server - the server whose session ID was used to obtain the license.

releaseLicense

public void releaseLicense(User user,
                           GUID sessionID)
Release the license obtained for the specified User via the specified GUID.

Parameters:
user - the User who "owns" the license.
sessionID - the GUID that was used to obtain the license.

getVisibleProperties

public PropertyCollection getVisibleProperties(EnumeratedValue value)
Return the subset of properties that are visible in the context of the specified Enumerated Value

Parameters:
value - an Enumerated Value for a specific Enumerated Property of a chosen type
Returns:
the subset of properties of the same Type that are marked visible in the context of this enum

getUDAGroupings

public EnumeratedValue[] getUDAGroupings(Requirement.RequirementType typ)
Return the subset of Requirement UDA Grouping values that match the specified Requirement Type for this project. This feature was introduced in the 14.0 server

Parameters:
typ - the requirement type to test
Returns:
a mapping set of UDA Groupings or an empty array

setUDAGroupings

public void setUDAGroupings(Requirement.RequirementType typ,
                            EnumeratedValue[] udas)
Map a subset of UDA Grouping values to specific Requirement Types for the given project.

Parameters:
typ - the requirement type to be mapped
udas - the set of UDA Groupings

setVisibleProperties

public void setVisibleProperties(EnumeratedValue value,
                                 PropertyCollection properties)
Define a subset of properties of a given type that are marked visible

Parameters:
value - an Enumerated Value for a specific Enumerated Property of a chosen type
properties - the set of properties marked visible in the context of the specified enum

getStatus

public Task.Status[] getStatus(Story.Status sts)
Return the subset of Task Status values that match the specified Story Status for this project. Story Status of NOT_STARTED and COMPLETED may return at most one corresponding Task Status. Story Status of STARTED may return a subset of Task Status The returned subsets across all three Story States are disjoint. This feature was introduced in the 14.0 server

Parameters:
sts - the story status to test
Returns:
a mapping set of Task States or an empty array

setStatus

public void setStatus(Story.Status rfrnc,
                      Task.Status[] mppdSts)
Map a subset of Task Status values to specific Story States for the given project. Story Status of NOT_STARTED and COMPLETED must map to one and only one equivalent Task Status Story Status of STARTED may map to a subset of Task States, provided that all mappings are unique and disjoint. The calling application is responsible for ensuring that each Story Status is mapped to one or more Task States as the case demands. This feature was introduced in the 14.0 server

Parameters:
rfrnc - the reference Story Status to be mapped
mppdSts - the Task States to map it to.

hasSavedStatus

public boolean hasSavedStatus(Story.Status sts)
Returns true if an explicit Story Status mapped to a Task Status (or set) has been saved for this project Note that if a status mapping is not saved to the server, the getStatus() api returns a default mapping

Parameters:
sts - the status to test for in this project context
Returns:
true if an explicit Story Status mapped to a Task Status (or set) has been saved for this project
See Also:
Server.getStatus(com.starteam.Story.Status)


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