Perforce

com.perforce.api
Class Env

java.lang.Object
  |
  +--com.perforce.api.Env

public class Env
extends Object

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.

Version:
$Date: 2002/01/15 $ $Revision: #3 $
Author:
David Markley

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.
 
Method Summary
 String getClient()
          Returns the P4CLIENT.
protected  String[] getEnvp()
           
 String getExecutable()
          Returns the path to the executable.
 String getPassword()
          Returns the P4PASSWORD.
 String getPath()
          Returns the PATH.
 String getPort()
          Returns the P4PORT.
 long getServerTimeout()
          Return the server timeout threshold.
 String getUser()
          Returns the P4USER.
 void setClient(String client)
          Sets the P4CLIENT in the class information.
 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.
 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

Env

public Env()
Default, no-argument constructor.

Env

public Env(Env base)
Constructor that uses another environment as its basis. This is useful for cloning environments and then changing a few attributes.
Parameters:
base - Environment to be copied into the new environment.

Env

public Env(Properties props)
Constructor that uses a set of Properties to set up the environment.
Parameters:
props - Used to construct the environment.
See Also:
setFromProperties(Properties)
Method Detail

getClient

public String getClient()
Returns the P4CLIENT.

getEnvp

protected String[] getEnvp()

getExecutable

public String getExecutable()
Returns the path to the executable.

getPassword

public String getPassword()
Returns the P4PASSWORD.

getPath

public String getPath()
Returns the PATH.

getPort

public String getPort()
Returns the P4PORT.

getServerTimeout

public long getServerTimeout()
Return the server timeout threshold.

getUser

public String getUser()
Returns the P4USER.

setClient

public void setClient(String client)
Sets the P4CLIENT in the class information.
Parameters:
user - P4CLIENT value.

setExecutable

public void setExecutable(String exe)
Sets up the path to reach the p4 executable. The full path passed in must contain the executable or at least end in the system's file separator character. This gotten from the file.separator property. For example:
 p4.executable=/usr/bin/p4   # This will work
 p4.executable=/usr/bin/     # This will work
 p4.executable=/usr/bin      # This won't work
 
Parameters:
exe - Full path to the p4 executable.

setFromProperties

public void setFromProperties(Properties props)
Uses a set of Properties to set up the environment. The properties that are used used by this method are:
PropertyValue Set
p4.userP4USER
p4.clientP4CLIENT
p4.portP4PORT
p4.passwordP4PASSWORD
p4.executableExecutable
p4.sysdriveSystemDrive
p4.sysrootSystemRoot
p4.thresholdServer Timeout Threshold
Parameters:
props - Used to construct the environment.
See Also:
setFromProperties(Properties)

setPassword

public void setPassword(String password)
Sets the P4PASSWD in the class information.
Parameters:
user - P4PASSWD value.

setPath

public void setPath(String path)
Sets the PATH in the class information.
Parameters:
user - PATH value.

setPort

public void setPort(String port)
Sets the P4PORT in the class information.
Parameters:
user - P4PORT value.

setServerTimeout

public void setServerTimeout(long threshold)
Set the server timeout threshold.

setSystemDrive

public void setSystemDrive(String drive)
Sets the SystemDrive in the class information. This is only meaningful under Windows.
Parameters:
user - SystemDrive value.

setSystemRoot

public void setSystemRoot(String root)
Sets the SystemRoot in the class information. This is only meaningful under Windows.
Parameters:
user - SystemRoot value.

setUser

public void setUser(String user)
Sets the P4USER in the class information.
Parameters:
user - P4USER value.

toString

public String toString()
Overrides:
toString in class Object

toXML

public String toXML()
Returns an XML representation of the environment.

Perforce

Copyright © 2001, Perforce Software, All rights reserved.