|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.option.UsageOptions
public class UsageOptions
Global server usage options class.
Intended to implement some of the options described in the main Perforce p4 usage and p4 undoc documentation on a per-IOptionsServer object basis, and also implements some of the broader environment settings (such as the client name used by the P4Java server implementation when no client has been associated with the server).
The UsageOptions object associated with a server is read and used for a small number of usage values (currently programName, programVersion, unsetUserName, and unsetClientName) each time a command is issued to the corresponding Perforce server, so updates to the UsageOptions object and / or any associated Properties object will be reflected at the next command execution except where noted. Note that this means that UsageOption objects shared between multiple servers are sensitive to such changes, and that changes that occur when a server is processing command requests may cause unexpected results.
A UsageOption object is associated with a server instance when the server is issued by the server factory; this can be the default object or one passed-in to the server factory specifically for that server.
Note that the UsageOptions class should be used with some care as the possible side effects of setting some of the usage parameters to the wrong value can lead to unexpected or odd behaviour.
Field Summary | |
---|---|
protected String |
defaultWorkingDirectory
Default working directory from the JVM to fall back to if not working directory is set on the usage options |
protected String |
hostName
If not null, specifies the host name used by the server's commands. |
protected String |
programName
If not null, will be used to identify the P4Java application's program name to the Perforce server. |
protected String |
programVersion
If not null, will be used to identify the P4Java application's program version to the Perforce server. |
protected Properties |
props
Properties object used to get default field values from. |
protected String |
textLanguage
If not null, use this field to tell the server which language to use in text messages it sends back to the client. |
protected String |
unsetClientName
If set, this will be used as the name of the client when no client has actually been explicitly set for the associated server(s). |
protected String |
unsetUserName
What will be sent to the Perforce server with each command as the user name if no user name has been explicitly set for servers associated with this UsageOption. |
static String |
WORKING_DIRECTORY_PROPNAME
The name of the system property used to determine the JVM's current working directory. |
protected String |
workingDirectory
If not null, this specifies the Perforce server's idea of each command's working directory for the associated server object. |
Constructor Summary | |
---|---|
UsageOptions(Properties props)
Default constructor. |
|
UsageOptions(Properties props,
String programName,
String programVersion,
String workingDirectory,
String hostName,
String textLanguage,
String unsetUserName,
String noClientName)
Explicit value constructor. |
Method Summary | |
---|---|
String |
getHostName()
|
String |
getProgramName()
Return the program name. |
protected String |
getProgramNameDefault(Properties props)
Get a suitable default value for the programName field. |
String |
getProgramVersion()
Return the program version. |
protected String |
getProgramVersionDefault(Properties props)
Get a suitable default value for the programVersion field. |
Properties |
getProps()
|
String |
getTextLanguage()
|
String |
getUnsetClientName()
Return the unset client name. |
protected String |
getUnsetClientNameDefault(Properties props)
Get a suitable default value for the unsetClientName field. |
String |
getUnsetUserName()
Return the unset user name. |
protected String |
getUnsetUserNameDefault(Properties props)
Get a suitable default value for the unsetUserName field. |
String |
getWorkingDirectory()
Return the current value of the working directory; this can be dynamically set explicitly using the setter method or implicitly when the object is constructed using the JVM's working directory as reflected in the System properties. |
protected String |
getWorkingDirectoryDefault(Properties props)
Get a suitable default value for the workingDirectory field. |
protected void |
setFieldDefaults(Properties props)
Set any non-null default values when the object is constructed. |
UsageOptions |
setHostName(String hostName)
Set the host name. |
UsageOptions |
setProgramName(String programName)
|
UsageOptions |
setProgramVersion(String programVersion)
|
UsageOptions |
setProps(Properties props)
|
UsageOptions |
setTextLanguage(String textLanguage)
|
UsageOptions |
setUnsetClientName(String unsetClientName)
|
UsageOptions |
setUnsetUserName(String unsetUserName)
|
UsageOptions |
setWorkingDirectory(String workingDirectory)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String WORKING_DIRECTORY_PROPNAME
protected Properties props
protected String programName
protected String programVersion
protected String workingDirectory
This affects all commands on the associated server from this point on, and the passed-in path should be both absolute and valid, otherwise strange errors may appear from the server. If workingDirectory is null, the Java VM's actual current working directory at the time this object is constructed is used instead (which is almost always a safe option unless you're using Perforce alt roots).
Note: no checking is done at any time for correctness (or otherwise) of the workingDirectory option.
protected String hostName
protected String textLanguage
protected String unsetUserName
protected String unsetClientName
protected String defaultWorkingDirectory
Constructor Detail |
---|
public UsageOptions(Properties props)
public UsageOptions(Properties props, String programName, String programVersion, String workingDirectory, String hostName, String textLanguage, String unsetUserName, String noClientName)
Method Detail |
---|
protected void setFieldDefaults(Properties props)
Fields set here: workingDirectory.
protected String getProgramNameDefault(Properties props)
protected String getProgramVersionDefault(Properties props)
protected String getWorkingDirectoryDefault(Properties props)
protected String getUnsetUserNameDefault(Properties props)
protected String getUnsetClientNameDefault(Properties props)
public String getProgramName()
public UsageOptions setProgramName(String programName)
public String getProgramVersion()
public UsageOptions setProgramVersion(String programVersion)
public String getWorkingDirectory()
public UsageOptions setWorkingDirectory(String workingDirectory)
public String getHostName()
public UsageOptions setHostName(String hostName)
public String getTextLanguage()
public UsageOptions setTextLanguage(String textLanguage)
public Properties getProps()
public UsageOptions setProps(Properties props)
public String getUnsetClientName()
public UsageOptions setUnsetClientName(String unsetClientName)
public String getUnsetUserName()
public UsageOptions setUnsetUserName(String unsetUserName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |