com.starteam
Class ServerAdministration

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

public final class ServerAdministration
extends java.lang.Object

The ServerAdministration class provides a convenient interface to perform various server level administration commands. The current set of operations are for field customization. Ultimately these methods should hang off of the core Type and Property objects but the refresh issues are too complex to deal with at this time. After calling any of the customization methods one should do a FULL refresh by discarding everything including the Server object itself and start over.


Nested Class Summary
static class ServerAdministration.License
          Information about the licenses registered on a StarTeam Server.
static class ServerAdministration.LockStatus
          Information about the lock status of the server.
static class ServerAdministration.SecurityLogEntry
          Information about the security log entries on a StarTeam Server.
static class ServerAdministration.ServerLogMode
          Information about the log mode of the server.
static class ServerAdministration.ServerLogType
          Information about the log type of the server.
 
Method Summary
 void discard()
          Discards all cached UserAccount and GroupAccount information.
 Group findGroup(int groupID)
          Returns the Group object for the given ID.
 Group findGroup(java.lang.String groupName)
          Returns the Group object with the given name.
 User findUser(int userID)
          Returns the User object for the given ID.
 User findUser(java.lang.String logonName)
          Returns the User object with the given logonName.
 java.lang.String generateDiagnosticDump(int minidumpType)
          Creates a diagnostic file and places it in the server configurations' log path.
 ServerConfiguration getConfiguration()
          Gets the current server configuration options.
 Group[] getGroups()
          Returns all of the active groups accounts on the server along with their complete account information.
 HiveManager getHiveManager()
          Gets the HiveManager that manages new vault format hives.
 ServerAdministration.License getLicenseInformation()
          Gets information about the licenses registered on this server.
 java.lang.String getLog()
          Return the server log for this server.
 java.lang.String[] getNamedConfigOptions(java.lang.String[] names)
          Return a String array of values that matches the input String array of option names.
 SystemPolicy getPolicy()
          Gets the current system policy options.
 PurgeController getPurgeController()
          Provides control of the Online Purge service.
 ACE[] getRights()
          Returns the Access control list for this server.
 ServerAdministration.SecurityLogEntry[] getSecurityLog(ServerAdministration.SecurityLogEntry.EventType eventType)
          Returns an array of SecurityLogEntry objects for this server, for the specified security event type.
 Server getServer()
          returns a reference to the Server
 void getServerCommandStats(java.io.OutputStream out)
          Retrieves the server's command statistics and writes it to the specified output stream.
 ServerAdministration.LockStatus getServerLockStatus()
          Returns the "locked", "locked exclusively" or "unlocked" status of the server.
 User[] getUsers()
          Returns all of the active users on the server along with their complete account information.
 boolean hasPermissions(PermissionCollection permissions)
          Returns true if desired permissions are granted
 boolean isRefreshRequired()
          Returns true if a refresh() operation might have resulted in UserAccount or GroupAccount information being updated; returns false if and only if it is known that the UserAccount and GroupAccount information had not been changed since the last refresh.
 void lockServer()
          Puts the server in "Locked" mode.
 void lockServerExclusively()
          Puts the server in "LockedExclusively" mode: only the locker can perform operations.
 void populateGroupMembershipForAllUsers()
          A single server command to populate the group membership for all active users on this server.
 void refresh()
          Updates cached Users and Groups account information to reflect recent changes to the repository.
 void restartServer()
          Shuts down and restarts the server.
 void setConfiguration(ServerConfiguration config)
          Saves the given server configuration options.
 void setNamedConfigOptions(java.lang.String[] names, java.lang.String[] values)
          Set a group of named configuration options.
 void setPolicy(SystemPolicy policy)
          Saves the given system policy options.
 void setRights(ACE[] acl)
          Modify the access control list for this server.
 void shutdownServer()
          Shuts down the server.
 boolean testDirectoryServiceSettings(java.lang.String URL, int port, boolean bUseSecureDirectoryService)
          Tests this set of Directory Service parameters.
 java.lang.Boolean treatMixedEOLFileContentAsBinary()
          True if MixedEOL content should be treated as BINARY files This is a CAE use case and has associated rules which require all EOL computation to be contained entirely within the SDK.
 void unlockServer()
          Unlocks a server in "Locked" mode.
 void writeLogFile(java.io.File out, ServerAdministration.ServerLogType logType, ServerAdministration.ServerLogMode[] logModes)
          Retrieves the server log and writes it to the specified file.
 void writeServerCommandStats(java.io.File file)
          Retrieves the server's command statistics and writes it to the specified file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getServer

public Server getServer()
returns a reference to the Server

Returns:
a reference to the Server

getPurgeController

public PurgeController getPurgeController()
Provides control of the Online Purge service. The service may be configured to start automatically when the server starts up. If configured to do so, it will run a purge in the background while the server is running. This eliminates the requirement for costly down time just to purge the starteam repository. The online purge will not affect any resources deleted during the current active server session. Access the purge log by issuing a writeLogFile command with a logType value of 1.

Returns:
PurgeControl
See Also:
ServerAdministration.writeLogFile(java.io.File, com.starteam.ServerAdministration.ServerLogType, com.starteam.ServerAdministration.ServerLogMode[]), ServerAdministration.getLog()

getLog

public java.lang.String getLog()
Return the server log for this server.

Returns:
the server log.
See Also:
ServerAdministration.writeLogFile(java.io.File, com.starteam.ServerAdministration.ServerLogType, com.starteam.ServerAdministration.ServerLogMode[])

writeLogFile

public void writeLogFile(java.io.File out,
                         ServerAdministration.ServerLogType logType,
                         ServerAdministration.ServerLogMode[] logModes)
                  throws java.io.IOException
Retrieves the server log and writes it to the specified file.

Parameters:
out - The log file location.
logType - Log type (LOG_TYPE_SERVER, LOG_TYPE_PURGE, other types to be defined.)
logModes - Log mode. Valid values are: 1. LOG_ALL, LOG_ASSERTIONS, LOG_EXCEPTIONS, LOG_MESSAGES, LOG_WARNINGS or a combination of them.
Throws:
java.io.IOException
See Also:
ServerAdministration.getLog(), ServerAdministration.ServerLogMode.LOG_ALL, ServerAdministration.ServerLogMode.LOG_ASSERTIONS, ServerAdministration.ServerLogMode.LOG_EXCEPTIONS, ServerAdministration.ServerLogMode.LOG_MESSAGES, ServerAdministration.ServerLogMode.LOG_WARNINGS

getSecurityLog

public ServerAdministration.SecurityLogEntry[] getSecurityLog(ServerAdministration.SecurityLogEntry.EventType eventType)
Returns an array of SecurityLogEntry objects for this server, for the specified security event type.

Parameters:
eventType - an integer value that specifies the desired security event type. Must be one of the values defined in SecurityLogEntry.EventType.
Returns:
An array of SecurityLogEntry objects for this server, for the specified security event type.
See Also:
ServerAdministration.SecurityLogEntry.EventType

getLicenseInformation

public ServerAdministration.License getLicenseInformation()
Gets information about the licenses registered on this server.

Returns:
Information about the licenses registered on this server, or null if the license information is not available.
See Also:
ServerAdministration.License

getHiveManager

public HiveManager getHiveManager()
Gets the HiveManager that manages new vault format hives.

Returns:
the HiveManager.

testDirectoryServiceSettings

public boolean testDirectoryServiceSettings(java.lang.String URL,
                                            int port,
                                            boolean bUseSecureDirectoryService)
Tests this set of Directory Service parameters. Returns true if the test succeeds, otherwise false.

Parameters:
URL -
port -
bUseSecureDirectoryService -
Returns:
true if the test succeeds, otherwise false.

getConfiguration

public ServerConfiguration getConfiguration()
Gets the current server configuration options.

Returns:
The current server configuration options.

treatMixedEOLFileContentAsBinary

public java.lang.Boolean treatMixedEOLFileContentAsBinary()
True if MixedEOL content should be treated as BINARY files This is a CAE use case and has associated rules which require all EOL computation to be contained entirely within the SDK.

Returns:
True if MixedEOL content should be treated as BINARY files

setConfiguration

public void setConfiguration(ServerConfiguration config)
Saves the given server configuration options.

Parameters:
config - The current server configuration options.
See Also:
ServerConfiguration

getPolicy

public SystemPolicy getPolicy()
Gets the current system policy options.

Returns:
The current system policy options.
See Also:
SystemPolicy

setPolicy

public void setPolicy(SystemPolicy policy)
Saves the given system policy options.

Parameters:
policy - The current system policy options.
See Also:
SystemPolicy

getServerCommandStats

public void getServerCommandStats(java.io.OutputStream out)
                           throws java.io.IOException
Retrieves the server's command statistics and writes it to the specified output stream.

Parameters:
out - the output stream to which the commands statistics will be written.
Throws:
java.io.IOException

writeServerCommandStats

public void writeServerCommandStats(java.io.File file)
                             throws java.io.IOException
Retrieves the server's command statistics and writes it to the specified file.

Parameters:
file - the file to which the commands statistics will be written.
Throws:
java.io.IOException

getServerLockStatus

public ServerAdministration.LockStatus getServerLockStatus()
Returns the "locked", "locked exclusively" or "unlocked" status of the server.

Returns:
the "locked", "locked exclusively" or "unlocked" status of the server.
See Also:
ServerAdministration.lockServer(), ServerAdministration.lockServerExclusively(), ServerAdministration.unlockServer()

lockServer

public void lockServer()
Puts the server in "Locked" mode. No one can perform operations. Useful for freezing server for database backups.

See Also:
ServerAdministration.getServerLockStatus(), ServerAdministration.lockServerExclusively(), ServerAdministration.unlockServer()

lockServerExclusively

public void lockServerExclusively()
Puts the server in "LockedExclusively" mode: only the locker can perform operations. Useful for restricting server access during replication operations.

See Also:
ServerAdministration.getServerLockStatus(), ServerAdministration.lockServer(), ServerAdministration.unlockServer()

unlockServer

public void unlockServer()
Unlocks a server in "Locked" mode.

See Also:
ServerAdministration.getServerLockStatus(), ServerAdministration.lockServer(), ServerAdministration.lockServerExclusively()

shutdownServer

public void shutdownServer()
Shuts down the server. This has the obvious side-effect of making the associated Server instance rather useless, as the StarTeam Server it was connected to will be shut down.


restartServer

public void restartServer()
Shuts down and restarts the server. This has the side-effect of making the associated Server instance rather useless as the StarTeam Server it was connected to will be shut down and restarted.


hasPermissions

public boolean hasPermissions(PermissionCollection permissions)
Returns true if desired permissions are granted

Parameters:
permissions - the desired permissions
See Also:
Permission, PermissionCollection

getRights

public ACE[] getRights()
Returns the Access control list for this server. This will return null if this server has not access control list. From 12.0 release of the server onwards, MPX events are sent by the server upon ACL updates. So, the server calls are optimized when mpx is enabled. For servers prior to 12.0 release, The access control list is not cached, and will be fetched from the server on demand.

Returns:
the access control list for this server or NULL.

setRights

public void setRights(ACE[] acl)
Modify the access control list for this server. If the input parameter is null then the access control list will be dropped.

Parameters:
acl - the new access control list or null if to be dropped

discard

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

See Also:
ServerAdministration.getUsers(), ServerAdministration.getGroups(), ServerAdministration.refresh()

refresh

public void refresh()
Updates cached Users and Groups account information to reflect recent changes to the repository. Existing UserAccount and GroupAccount objects are modified in place whenever possible.

See Also:
ServerAdministration.discard()

findUser

public User findUser(java.lang.String logonName)
Returns the User object with the given logonName. The user returned will contain all the account information. Returns null if logonName is not found.

Parameters:
logonName - the logonName in question
Returns:
the User object with the given name. Will return null if not found.
See Also:
ServerAdministration.getUsers()

isRefreshRequired

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

Returns:
true if account information may be out of date.
See Also:
ServerAdministration.refresh(), Server.enableMPX()

getUsers

public User[] getUsers()
Returns all of the active users on the server along with their complete account information. Deleted user accounts are not included.

Returns:
all of the active user accounts on the server.
Throws:
ServerException - when the logged in user does not have permission Permission.SERVER_ADMIN_USER_ACCOUNTS granted.
See Also:
Server.getActiveUsers()

getGroups

public Group[] getGroups()
Returns all of the active groups accounts on the server along with their complete account information. Deleted group accounts are not included.

Returns:
all of the active group accounts on the server.
Throws:
ServerException - when the logged in user does not have the permission Permission.SERVER_ADMIN_USER_ACCOUNTS granted.
See Also:
Server.getActiveGroups()

findUser

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

Parameters:
userID - the user ID in question
Returns:
the UserAccount object with the given ID. Will return null if not found.
Throws:
ServerException - when the logged in user does not have the permission Permission.SERVER_ADMIN_USER_ACCOUNTS granted.
See Also:
ServerAdministration.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:
ServerAdministration.getGroups()

findGroup

public Group findGroup(java.lang.String groupName)
Returns the Group object with the given name. The group returned will contain all the account information. Returns null if the group is not found.

Parameters:
groupName - the group name in question
Returns:
the Group object with the given name. Will return null if not found.
See Also:
ServerAdministration.getUsers()

populateGroupMembershipForAllUsers

public void populateGroupMembershipForAllUsers()
A single server command to populate the group membership for all active users on this server. Logged in user requires administrator privileges to execute this command This command is available only for server release 12.0 or earlier

Throws:
ServerException - when logged in user does not have administrator privileges
See Also:
ServerAdministration.getGroups()

getNamedConfigOptions

public java.lang.String[] getNamedConfigOptions(java.lang.String[] names)
Return a String array of values that matches the input String array of option names. This method is supported by server release 6.0 and later; ignored for earlier releases.

Parameters:
names - the key values of the options to retrieve.
Returns:
a String array of values that matches the input String array of option names.

setNamedConfigOptions

public void setNamedConfigOptions(java.lang.String[] names,
                                  java.lang.String[] values)
Set a group of named configuration options. This method is supported by server release 6.0 and later; ignored for earlier releases.

Parameters:
names - names of the options whose values are set.
values - values of the options to be set, in same sequence a names.

generateDiagnosticDump

public java.lang.String generateDiagnosticDump(int minidumpType)
Creates a diagnostic file and places it in the server configurations' log path. While creating the file, the server does no other processing This may take several minutes Use only at the direction of Borland Technical Support. Throws an SDKRuntimeException if the call fails

Parameters:
minidumpType - A mini-dump type
Returns:
the result of the dump command being executed


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