com.starbase.starteam
Class Server

java.lang.Object
  |
  +--com.starbase.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.


Constructor Summary
Server(ServerInfo info)
          Creates a new Server object, using the given connection information.
Server(java.lang.String address, int port)
          Constructs an object that represents a remote server process.
Server(java.lang.String address, int port, EncryptionAlgorithm algorithmID, boolean compressionLevel)
          Constructs an object that represents a remote server process specifying the encpryption algorithm and compression levels to use.
Server(java.lang.String address, int port, EncryptionAlgorithm algorithmID, boolean compressionLevel, int protocol)
          Constructs an object that represents a remote server process specifying the encpryption algorithm and compression levels to use.
 
Method Summary
 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 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
 int 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().
 void 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 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 discardTypes()
          Discards all cached Type information.
 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.
 boolean equals(java.lang.Object object)
          Two Server objects are considered equal only if they are exact same objects.
 User[] fetchEmailUsers()
          This method issues a command to the server to return the list of users that are able to recieve email messages.
 Link[] findLinks(Item item)
          Returns an array of Link objects associated with this item.
 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.
 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.
 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
 EventHandlerProfile getCurrentMPXProfile()
          Gets the current MPX event handler profile.
 OLEDate getCurrentTime()
          Gets the current time on the server.
 EncryptionAlgorithm getEncryptionAlgorithm()
          Gets the level of encryption 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.
 Filter[] getFilterList(Type type, boolean pub)
           
 java.lang.String[] getForeignArchivePaths(int projectType, java.lang.String configFile)
          Get the archive paths of the foreign archive specified.
 Group getGroup(int groupID)
          Returns the Group object for the given ID.
 Group[] getGroups()
          Returns all of the groups on this Server.
 int getKeepAliveInterval()
          Gets the keep-alive interval, in minutes.
 boolean getMPXCacheAgentEnabled()
          Deprecated. use ServerInfo#getUseCacheAgentForFileContent() instead
 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.
 MyUserAccount getMyUserAccount()
          Returns the user account for the currently logged on user.
 int getPort()
          TCP/IP port on which to connect to the remote server.
 int[] getProductCodes()
          Gets the product codes licensed for this server.
 Project[] getProjects()
          Gets the set of Projects accessible from this Server.
 PropertyEnums getPropertyEnums()
          Returns the PropertyEnums object for this server.
 PropertyNames getPropertyNames()
          Returns the PropertyNames object for this server.
 int getProtocol()
          Gets the protocol used to connect to the server.
 QueryInfo[] getQueryList(Type type, boolean pub)
           
 GUID getRepositoryID()
          Uniquely identifies the repository served by this server amongst all StarTeam repositories in the universe.
 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.
 ServerSession getSession()
          Returns session information for the currently logged on user.
 SupportedFeatures getSupportedFeatures()
          Gets an instance of the SupportedFeatures class that can tell which features are available for this StarTeam server.
 TypeNames getTypeNames()
          Returns the TypeNames object for this server.
 Type[] getTypes()
          Returns an array of Type objects supported by this server.
 User getUser(int userID)
          Returns the User object for the given ID.
 User[] getUsers()
          Returns all of the users in this Server.
 void handleEvents()
          Places the current thread in an event-handling state.
 int hashCode()
          Returns a hash code for this object.
 boolean hasProductCode(int code)
          Determines whether or not the server has a license for the specified product code.
 boolean hasProductCodeInformation()
          Deprecated. All supported versions of the StarTeam server provided licensed product codes. This method always returns true.
 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 isKeepAlive()
          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 resulting 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 isRefreshTypesRequired()
          Returns true if a refreshTypes() operation might have resulted in Type or Property information being updated; returns false if and only if it is known that the Type information has not been changed since the last refresh.
 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.
 boolean isTypeSupported(java.lang.String typeName)
          Return true if the type with the specified name is supported by this server.
 CacheAgent locateCacheAgent(java.lang.String hostName, int port)
          locate a CacheAgent at a given address and port
 int logOn(java.lang.String logOnName, java.lang.String password)
          Establishes a user-session with the remote server process.
 int logOnForWorkstation(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.
 int logOnWithClientContext(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.
 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 refreshTypes()
          Refreshes cached Type information to reflect recent changes to the repository.
 void refreshTypesInPlace()
          Deprecated.  
 void refreshUsers()
          Refreshes cached User information to reflect recent changes to the repository.
 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 removeTypeListener(TypeListener listener)
          Removes a listener for Type events.
 void removeUserListener(UserListener listener)
          Removes a listener for User events.
 void sendMailFromView(View view, int[] to, int[] cc, int[] bcc, java.lang.String subject, java.lang.String body)
          Directs the StarTeam Server to send mail to the specified StarTeam users.
 void sendMailWithAttachments(View view, int[] to, int[] cc, int[] bcc, java.lang.String subject, java.lang.String body, 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 setCommandUserID(int userID)
          act like a given User different from the User currently logged in
 void setForeignPassword(Project project)
          Sets a password for the foreign archive associated with this project.
 void setForeignPasswordExplicit(java.lang.String configPath, int type, java.lang.String password)
          Sets a password for the foreign archive specified.
 void setKeepAlive(boolean bKeepAlive)
          Enables or disables keep-alive mode.
 void setKeepAliveInterval(int nMinutes)
          Sets the keep-alive interval, in minutes.
 void setMPXCacheAgentEnabled(boolean bEnabled)
          Deprecated. use ServerInfo#setUseCacheAgentForFileContent(boolean) instead
 java.lang.String toString()
          Returns a summary String representation of this server.
 Type typeForClassID(int classID)
          Looks up the type information based on a type-number.
 Type typeForName(java.lang.String typeName)
          Returns a type instance for a type name.
 Connection useConnection()
          This method is no longer supported
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Server

public Server(java.lang.String address,
              int port)
Constructs an object that represents a remote server process. Uses whatever encryption algorithm and compression level the server requires. It does not automatically connect to the server.

Parameters:
address - the host address of the remote server
port - the TCP/IP port of the remote server

Server

public Server(java.lang.String address,
              int port,
              EncryptionAlgorithm algorithmID,
              boolean compressionLevel)
Constructs an object that represents a remote server process specifying the encpryption algorithm and compression levels to use. It does not automatically connect to the server. The connection will be encrypted with a level of encryption at least as strong as specified by the algorithmID paramter and possibly higher if the server requires it.

Parameters:
address - the host address of the remote server (may not be null)
port - the TCP/IP port of the remote server
algorithmID - the level of encryption desired for the connection. Value may be null.
compressionLevel - true if compression should be used for data transmission.

Server

public Server(java.lang.String address,
              int port,
              EncryptionAlgorithm algorithmID,
              boolean compressionLevel,
              int protocol)
Constructs an object that represents a remote server process specifying the encpryption algorithm and compression levels to use. It does not automatically connect to the server. The connection will be encrypted with a level of encryption at least as strong as specified by the algorithmID paramter and possibly higher if the server requires it.

Parameters:
address - the host address of the remote server (may not be null)
port - the TCP/IP port of the remote server
algorithmID - the level of encryption desired for the connection. Value may be null.
compressionLevel - true if compression should be used for data transmission.
protocol - to be used to connect to the server. Can only be ServerConfiguration.PROTOCOL_TCP_IP_SOCKETS_XML or ServerConfiguration.PROTOCOL_TCP_IP_SOCKETS
See Also:
ServerConfiguration.PROTOCOL_TCP_IP_SOCKETS_XML, ServerConfiguration.PROTOCOL_TCP_IP_SOCKETS

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.
See Also:
ServerInfo, Server.connect(), Server.enableMPX()
Method Detail

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.

findLinks

public Link[] findLinks(Item item)
Returns an array of Link objects associated with this item.

Parameters:
item - the item
Returns:
an array of Link objects

setCommandUserID

public void setCommandUserID(int userID)
act like a given User different from the User currently logged in

Parameters:
userID - int

equals

public boolean equals(java.lang.Object object)
Two Server objects are considered equal only if they are exact same objects. This means two different Server objects to the same network address will not be considered equal even though they in some sense represent the same StarTeam repository.

Overrides:
equals in class java.lang.Object
Parameters:
object - the object being compared
Returns:
true if the object is the Server itself and false otherwise.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code for this object.

isRefreshTypesRequired

public boolean isRefreshTypesRequired()
Returns true if a refreshTypes() operation might have resulted in Type or Property information being updated; returns false if and only if it is known that the Type information has not been changed since the last refresh. If MPX is not enabled, isRefreshTypesRequired() always returns true.

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

refreshTypes

public void refreshTypes()
Refreshes cached Type information to reflect recent changes to the repository. Existing Type and Property objects are modified in place, whenever possible. If MPX is enabled, refreshTypes() is optimized to avoid unnecessary server commands.

See Also:
Server.getTypes(), Server.isRefreshTypesRequired(), Server.discardTypes(), Server.enableMPX()

refreshTypesInPlace

public void refreshTypesInPlace()
Deprecated.  

Deprecated. Equivalent to refreshTypes().

See Also:
Server.refreshTypes()

discardTypes

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


getMyUserAccount

public MyUserAccount getMyUserAccount()
Returns the user account for the currently logged on user. Every user has permission to modify his own user account.

The user account information is not cached in the Server object; each call to getMyUserAccount() returns up-to-date information in a newly allocated MyUserAccount object.

getMyUserAccount() is not MPX-enabled; the account information is always retrieved directly from the repository.

Returns:
The user account for the currently logged on user.

getSession

public ServerSession 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 that are able to recieve email messages.

Returns:
the list of users that can receieve email messages
See Also:
Server.sendMailFromView(com.starbase.starteam.View, int[], int[], int[], java.lang.String, java.lang.String), Server.sendMailWithAttachments(com.starbase.starteam.View, int[], int[], int[], java.lang.String, java.lang.String, com.starbase.starteam.EmailAttachment[])

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. Note that since MPX does not currently broadcast any group-related events, isRefreshAccountsRequired() always returns true, even if MPX is enabled.

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 resulting 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. Note that since MPX does not currently broadcast any group-related events, isRefreshGroupsRequired() always returns true, even if MPX is enabled.

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 EncryptionAlgorithm getEncryptionAlgorithm()
Gets the level of encryption requested for the connection.

Returns:
The level of encryption requested for the connection.
See Also:
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_XML, 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.starbase.util.GUID

getRequiredEncryptionLevel

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

Returns:
level of encryption required to connect to the 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.

useConnection

public Connection useConnection()
This method is no longer supported

Returns:
the connection object used by this server.

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()
Gets the set of Projects accessible from this Server.

The project list is not cached in the Server object. Each call to getProjects() returns an up-to-date project list consisting of newly allocated Project objects.

If MPX is enabled, getProjects() is optimized to avoid unnecessary server commands.

Returns:
The set of Projects accessible from this Server. May be empty (but is never null).

isTypeSupported

public boolean isTypeSupported(java.lang.String typeName)
Return true if the type with the specified name is supported by this server.

Parameters:
typeName - the name of the type in question.
Returns:
true if the type is supported by this server.
See Also:
Server.getTypes(), Server.typeForClassID(int), Server.typeForName(String), Server.getTypeNames()

getTypes

public Type[] getTypes()
Returns an array of Type objects supported by this server.

Returns:
an array of Types instances
See Also:
Server.isTypeSupported(String), Server.typeForClassID(int), Server.typeForName(String), Server.getTypeNames()

typeForName

public Type typeForName(java.lang.String typeName)
                 throws java.lang.IllegalArgumentException,
                        TypeNotFoundException
Returns a type instance for a type name.

Parameters:
typeName - name of type in question. Must not be null.
Returns:
Type object representing the type information
Throws:
TypeNotFoundException - if the type is not found.
java.lang.IllegalArgumentException - if the typeName parameter is null
See Also:
Server.isTypeSupported(String), Server.getTypes(), Server.typeForClassID(int), Server.getTypeNames()

typeForClassID

public Type typeForClassID(int classID)
                    throws TypeNotFoundException
Looks up the type information based on a type-number.

Parameters:
classID - a server-assigned number that identifies the type
Returns:
the type information for the given type-number
Throws:
TypeNotFoundException - if the given type name is not valid in this name space
See Also:
Server.isTypeSupported(String), Server.getTypes(), Server.typeForName(String), Server.getTypeNames()

getActiveUsers

public User[] getActiveUsers()
Returns all of the active (non-deleted) users in this Server.

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

getUsers

public User[] getUsers()
Returns all of the users in this Server. This includes both active and deleted users.

Returns:
All of the users in this Server.
See Also:
Server.refreshUsers(), Server.discardUsers(), Server.getActiveUsers()

getActiveGroups

public Group[] getActiveGroups()
Returns all of the active (non-deleted) groups in this Server.

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

getGroups

public Group[] getGroups()
Returns all of the groups on this Server. This includes both active and deleted groups.

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

getUser

public User getUser(int userID)
Returns the User object for the given ID.

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()

getGroup

public Group getGroup(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()

hasProductCodeInformation

public boolean hasProductCodeInformation()
Deprecated. All supported versions of the StarTeam server provided licensed product codes. This method always returns true.

Determines whether or not the licensed product codes are available from this server.

Returns:
true if the licensed product codes are available from this server.
See Also:
ProductCodes, Server.getProductCodes(), Server.hasProductCode(int)

getProductCodes

public int[] 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:
ProductCodes, Server.hasProductCodeInformation(), Server.hasProductCode(int)

hasProductCode

public boolean hasProductCode(int 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:
ProductCodes, Server.getProductCodes(), Server.hasProductCodeInformation()

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.

getPropertyNames

public PropertyNames getPropertyNames()
Returns the PropertyNames object for this server. You must have already connected to the server or an IllegalStateException will be thrown.

Returns:
property names for this server.

getPropertyEnums

public PropertyEnums getPropertyEnums()
Returns the PropertyEnums object for this server. You must have already connected to the server or an IllegalStateException will be thrown.

Returns:
enumerated property values for this server.

getTypeNames

public TypeNames getTypeNames()
Returns the TypeNames object for this server. You must have already connected to the server or an IllegalStateException will be thrown.

Returns:
type names for this server.

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()

disconnect

public void disconnect()
Terminates the network connection to the remote server process. The user will be logged off.


logOn

public int 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 priveleges associated with the supplied user credentials.

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

changePassword

public void 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.


logOnForWorkstation

public int logOnForWorkstation(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 userID for the logged on user.
See Also:
GUID

logOnWithClientContext

public int logOnWithClientContext(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 userID for 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

getCurrentTime

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

Returns:
The current server time.
See Also:
SupportedFeatures.hasCurrentTime()

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()

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.

Returns:
true if credential caching is enabled, and false otherwise.
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 int autoLogOn()
Log on to this server using credentials that have been cached on this workstation.

Returns:
the userID for the logged on user.
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.
Returns:
true if successful, otherwise false.
See Also:
Server.autoLogOn(), Server.isAutoLogOnAvailable(), Server.isCredentialCachingEnabled()

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.

sendMailFromView

public void sendMailFromView(View view,
                             int[] to,
                             int[] cc,
                             int[] 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

sendMailWithAttachments

public void sendMailWithAttachments(View view,
                                    int[] to,
                                    int[] cc,
                                    int[] bcc,
                                    java.lang.String subject,
                                    java.lang.String body,
                                    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 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
attachments - The attachments to include with the email

getFilterList

public Filter[] getFilterList(Type type,
                              boolean pub)

getQueryList

public QueryInfo[] getQueryList(Type type,
                                boolean pub)

setForeignPassword

public void setForeignPassword(Project project)
Sets a password for the foreign archive associated with this project.

Parameters:
project - StarTeam Project.

setForeignPasswordExplicit

public void setForeignPasswordExplicit(java.lang.String configPath,
                                       int type,
                                       java.lang.String password)
Sets a password for the foreign archive specified.

Parameters:
configPath - the path to the configuration file of the foreign archive.
type - type of the project.
password - the new password to the foreign archive.

isMailAvailable

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

Returns:
true if the server supports email.

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()

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()

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"


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.


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 tiggered 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, MPXStatusAdapter, Server.removeMPXStatusListener(com.starbase.starteam.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.starbase.starteam.MPXStatusListener)

addServerControlListener

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

Event handlers will be tiggered 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, ServerControlAdapter, Server.removeServerControlListener(com.starbase.starteam.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.starbase.starteam.ServerControlListener)

addTypeListener

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

Event handlers will be tiggered 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, TypeAdapter, Server.removeTypeListener(com.starbase.starteam.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.starbase.starteam.TypeListener)

addUserListener

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

Event handlers will be tiggered 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, UserAdapter, Server.removeUserListener(com.starbase.starteam.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.starbase.starteam.UserListener)

addProjectListener

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

Event handlers will be tiggered 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, ProjectAdapter, Server.removeProjectListener(com.starbase.starteam.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.starbase.starteam.ProjectListener)

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.

isKeepAlive

public boolean isKeepAlive()
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.

getForeignArchivePaths

public java.lang.String[] getForeignArchivePaths(int projectType,
                                                 java.lang.String configFile)
Get the archive paths of the foreign archive specified. Note that if the password for the foreign archive is different from the StarTeam password, then you must first call setForeignPasswordExplicit().

See Also:
Server.setForeignPasswordExplicit(java.lang.String, int, java.lang.String), PropertyEnums.PROJECT_TYPE_PVCS, PropertyEnums.PROJECT_TYPE_VISUAL_SOURCESAFE

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

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 port the cache agent is running on
Returns:
CacheAgent a CacheAgent if found, or null

getCurrentCacheAgent

public CacheAgent getCurrentCacheAgent()
returns the CacheAgent currently in use by this server, or null

Returns:
CacheAgent the CacheAgent currently in use by this server, or null

setMPXCacheAgentEnabled

public void setMPXCacheAgentEnabled(boolean bEnabled)
Deprecated. use ServerInfo#setUseCacheAgentForFileContent(boolean) instead

Enables or disables checkouts via the MPX cache agent. The cache agent is disabled by default.

Parameters:
bEnabled - True to enable checkouts via the MPX cache agent; false to force all checkouts to use the StarTeam server directly.
See Also:
ServerInfo#setUseCacheAgentForFileContent(boolean)

getMPXCacheAgentEnabled

public boolean getMPXCacheAgentEnabled()
Deprecated. use ServerInfo#getUseCacheAgentForFileContent() instead

Indicates whether or not checkouts via the MPX cache agent are enabled. The cache agent is disabled by default.

Returns:
True to enable checkouts via the MPX cache agent; false to force all checkouts to use the StarTeam server directly.
See Also:
#getMPXCacheAgentAddress, #getMPXCacheAgentPort, #getMPXCacheAgentThreadCount, ServerInfo#getUseCacheAgentForFileContent()


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