|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.perforce.api.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(Properties props)
Constructor that uses a set of Properties to set up the
environment. |
|
Env(String propfile)
Constructs an environment from a properties file. |
Method Summary | |
void |
appendPath(String path)
Append the path element to the existing path. |
void |
checkValidity()
Checks the environment to see if it is valid. |
String |
getClient()
Returns the P4CLIENT. |
String |
getenv(String name)
Returns the value for the named environment variable. |
String[] |
getEnvp()
Returns the environment in a String array. |
String |
getExecutable()
Returns the path to the executable. |
String |
getPassword()
Returns the P4PASSWORD. |
String |
getPath()
Returns the PATH. |
String |
getPort()
Returns the P4PORT. |
Properties |
getProperties()
Returns a new Properties instance that is set using the
environments properties as its default. |
String |
getProperty(String key)
Searches for the property with the specified key in this property list. |
String |
getProperty(String key,
String defaultValue)
Searches for the property with the specified key in this property list. |
Vector |
getPropertyList(String key,
String defaultValue)
Returns a Vector containing the property value list, as split up
by the commas. |
Vector |
getPropertyList(String key,
String defaultValue,
String delimeter)
Returns a Vector containing the property value list, as split up
by the specified delimeter. |
long |
getServerTimeout()
Return the server timeout threshold. |
String |
getUser()
Returns the P4USER. |
void |
setClient(String client)
Sets the P4CLIENT in the class information. |
void |
setenv(String name,
String value)
Allows the user to set any environment variable. |
void |
setExecutable(String exe)
Sets up the path to reach the p4 executable. |
void |
setFromProperties(Properties props)
Uses a set of Properties to set up the environment. |
void |
setPassword(String password)
Sets the P4PASSWD in the class information. |
void |
setPath(String path)
Sets the PATH in the class information. |
void |
setPort(String port)
Sets the P4PORT in the class information. |
String |
setProperty(String key,
String value)
Calls the hashtable method put. |
void |
setServerTimeout(long threshold)
Set the server timeout threshold. |
void |
setSystemDrive(String drive)
Sets the SystemDrive in the class information. |
void |
setSystemRoot(String root)
Sets the SystemRoot in the class information. |
void |
setUser(String user)
Sets the P4USER in the class information. |
String |
toString()
|
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(Env base)
base
- Environment to be copied into the new environment.public Env(Properties props)
Properties
to set up the
environment.props
- Used to construct the environment.setFromProperties(Properties)
public Env(String propfile) throws PerforceException
propfile
- full path to a properties file.Method Detail |
public void appendPath(String path)
path
- the path element to be appended.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.
public String getClient()
public String getenv(String name)
name
- environment variable namepublic String[] getEnvp()
String
array.public String getExecutable()
public String getPassword()
public String getPath()
public String getPort()
public Properties getProperties()
Properties
instance that is set using the
environments properties as its default.public String getProperty(String key)
key
- the property keyProperties
public String getProperty(String key, String defaultValue)
key
- the property keydefaultValue
- a default valueProperties
public Vector getPropertyList(String key, 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 valuepublic Vector getPropertyList(String key, String defaultValue, 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 long getServerTimeout()
public String getUser()
public void setClient(String client)
user
- P4CLIENT value.public void setenv(String name, String value)
name
- environment variable namevalue
- environment variable valuepublic void setExecutable(String exe)
p4.executable=/usr/bin/p4 # This will work p4.executable=/usr/bin/ # This will work p4.executable=/usr/bin # This won't work
exe
- Full path to the p4 executable.public void setFromProperties(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.setFromProperties(Properties)
public void setPassword(String password)
user
- P4PASSWD value.public void setPath(String path)
path
- PATH value.public void setPort(String port)
user
- P4PORT value.public String setProperty(String key, String value)
key
- the key to be placed into this property list.value
- the value corresponding to key.Properties.setProperty(String,String)
public void setServerTimeout(long threshold)
public void setSystemDrive(String drive)
user
- SystemDrive value.public void setSystemRoot(String root)
user
- SystemRoot value.public void setUser(String user)
user
- P4USER value.public String toString()
toString
in class Object
public String toXML()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |