|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.perforce.api.Env
public class Env
Representation of a source control environment. This information is typically
passed to a P4Process instance by the
SourceControlObject instances. It can also be set in the
base P4Process instance. This will cause it to be
used as the default environment for all command execution.
Values for the environment can be easily loaded from a
Properties file. This makes configuration of the
environment much simpler.
Properties| Constructor Summary | |
|---|---|
Env()
Default, no-argument constructor. |
|
Env(Env base)
Constructor that uses another environment as its basis. |
|
Env(java.util.Properties props)
Constructor that uses a set of Properties to set up the
environment. |
|
Env(java.lang.String propfile)
Constructs an environment from a properties file. |
|
| Method Summary | |
|---|---|
void |
appendPath(java.lang.String path)
Append the path element to the existing path. |
void |
checkValidity()
Checks the environment to see if it is valid. |
java.lang.String |
getClient()
Returns the P4CLIENT. |
java.lang.String |
getenv(java.lang.String name)
Returns the value for the named environment variable. |
java.lang.String[] |
getEnvp()
Returns the environment in a String array. |
java.lang.String |
getExecutable()
Returns the path to the executable. |
java.lang.String |
getPassword()
Returns the P4PASSWORD. |
java.lang.String |
getPath()
Returns the PATH. |
java.lang.String |
getPort()
Returns the P4PORT. |
java.util.Properties |
getProperties()
Returns a new Properties instance that is set using the
environments properties as its default. |
java.lang.String |
getProperty(java.lang.String key)
Searches for the property with the specified key in this property list. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Searches for the property with the specified key in this property list. |
java.util.Vector |
getPropertyList(java.lang.String key,
java.lang.String defaultValue)
Returns a Vector containing the property value list, as
split up by the commas. |
java.util.Vector |
getPropertyList(java.lang.String key,
java.lang.String defaultValue,
java.lang.String delimeter)
Returns a Vector containing the property value list, as
split up by the specified delimeter. |
long |
getServerTimeout()
Return the server timeout threshold. |
java.lang.String |
getUser()
Returns the P4USER. |
void |
setClient(java.lang.String client)
Sets the P4CLIENT in the class information. |
void |
setenv(java.lang.String name,
java.lang.String value)
Allows the user to set any environment variable. |
void |
setExecutable(java.lang.String exe)
Sets up the path to reach the p4 executable. |
void |
setFromProperties(java.util.Properties props)
Uses a set of Properties to set up the environment. |
void |
setFromProperties(java.lang.String propfile)
Sets the environment using the specified properties file. |
void |
setPassword(java.lang.String password)
Sets the P4PASSWD in the class information. |
void |
setPath(java.lang.String path)
Sets the PATH in the class information. |
void |
setPort(java.lang.String port)
Sets the P4PORT in the class information. |
java.lang.String |
setProperty(java.lang.String key,
java.lang.String value)
Calls the hashtable method put. |
void |
setServerTimeout(long threshold)
Set the server timeout threshold. |
void |
setSystemDrive(java.lang.String drive)
Sets the SystemDrive in the class information. |
void |
setSystemRoot(java.lang.String root)
Sets the SystemRoot in the class information. |
void |
setUser(java.lang.String user)
Sets the P4USER in the class information. |
java.lang.String |
toString()
|
java.lang.String |
toXML()
Returns an XML representation of the environment. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Env()
public Env(java.lang.String propfile)
throws PerforceException
propfile - full path to a properties file.
PerforceExceptionpublic Env(Env base)
base - Environment to be copied into the new environment.public Env(java.util.Properties props)
Properties to set up the
environment.
props - Used to construct the environment.setFromProperties(Properties)| Method Detail |
|---|
public void setenv(java.lang.String name,
java.lang.String value)
name - environment variable namevalue - environment variable valuepublic java.lang.String getenv(java.lang.String name)
name - environment variable namepublic java.lang.String[] getEnvp()
String array.
public void checkValidity()
throws PerforceException
If the environment is valid, this method will return quietly. Otherwise,
it will throw a PerforceException with a message regarding
the failure.
PerforceException
public java.util.Vector getPropertyList(java.lang.String key,
java.lang.String defaultValue)
Vector containing the property value list, as
split up by the commas. This is used to get the values for a property in
the form of:
some.property.key=val1,val2,val3
Will always return a Vector, even if it is empty.
key - the property keydefaultValue - a default value
public java.util.Vector getPropertyList(java.lang.String key,
java.lang.String defaultValue,
java.lang.String delimeter)
Vector containing the property value list, as
split up by the specified delimeter. This is used to get the values for a
property in the form of:
some.property.key=val1,val2,val3
Will always return a Vector, even if it is empty.
key - the property keydefaultValue - a default valuedelimeter - string that seperates the valuespublic java.util.Properties getProperties()
Properties instance that is set using the
environments properties as its default.
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
key - the property keydefaultValue - a default value
Propertiespublic java.lang.String getProperty(java.lang.String key)
key - the property key
Properties
public java.lang.String setProperty(java.lang.String key,
java.lang.String value)
key - the key to be placed into this property list.value - the value corresponding to key.Properties.setProperty(String,String)
public void setFromProperties(java.lang.String propfile)
throws PerforceException
propfile - Path to a properties file.
PerforceExceptionsetFromProperties(Properties)public void setFromProperties(java.util.Properties props)
Properties to set up the environment. The
properties that are used used by this method are:
| Property | Value Set |
|---|---|
| p4.user | P4USER |
| p4.client | P4CLIENT |
| p4.port | P4PORT |
| p4.password | P4PASSWORD |
| p4.executable | Executable |
| p4.sysdrive | SystemDrive |
| p4.sysroot | SystemRoot |
| p4.threshold | Server Timeout Threshold |
props - Used to construct the environment.public void setUser(java.lang.String user)
user - P4USER value.public java.lang.String getUser()
public void setClient(java.lang.String client)
user - P4CLIENT value.public java.lang.String getClient()
public void setPort(java.lang.String port)
user - P4PORT value.public java.lang.String getPort()
public void setPassword(java.lang.String password)
user - P4PASSWD value.public java.lang.String getPassword()
public void setPath(java.lang.String path)
path - PATH value.public void appendPath(java.lang.String path)
path - the path element to be appended.public java.lang.String getPath()
public void setSystemDrive(java.lang.String drive)
user - SystemDrive value.public void setSystemRoot(java.lang.String root)
user - SystemRoot value.public void setExecutable(java.lang.String exe)
p4.executable=/usr/bin/p4 # This will work p4.executable=/usr/bin/ # This will work <font color=Red>p4.executable=/usr/bin # This won't work</font>
exe - Full path to the p4 executable.public java.lang.String getExecutable()
public void setServerTimeout(long threshold)
public long getServerTimeout()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toXML()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||