org.hackystat.sensor.ant.perforce
Class P4Environment

java.lang.Object
  extended by org.hackystat.sensor.ant.perforce.P4Environment

public class P4Environment
extends java.lang.Object

Provides a simple mechanism for configuring the Perforce Java API connection to the p4 tool. Provides a wrapper around the Perforce Java API Env object, and supplies defaults for certain properties. Typical usage:

 P4Environment p4Env = new P4Environment();
 p4Env.setPort("myperforceserver.foo.com:1666");
 p4Env.setUser("philip_johnson");
 p4Env.setPassword("foo");
 p4Env.setVerbose(true);
 Env env = p4Env.getEnv();
 

Author:
Philip Johnson

Constructor Summary
P4Environment()
          Constructs a new P4Environment with default property values.
 
Method Summary
 com.perforce.api.Env getEnv()
          Returns a Perforce Java API Env instance constructed from the data supplied to this instance.
 void setP4Executable(java.lang.String path)
          Sets the path to the p4 executable.
 void setP4Password(java.lang.String password)
          Sets the password for the perforce user.
 void setP4Port(java.lang.String port)
          Sets the port for the perforce server.
 void setP4SystemDrive(java.lang.String sysdrive)
          Sets the system drive.
 void setP4SystemRoot(java.lang.String sysroot)
          Sets the system root.
 void setP4User(java.lang.String user)
          Sets the perforce user.
 void setVerbose(boolean isVerbose)
          Sets verbose mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

P4Environment

public P4Environment()
Constructs a new P4Environment with default property values.

Method Detail

setP4Executable

public void setP4Executable(java.lang.String path)
Sets the path to the p4 executable. Default: "C:\\Program Files\\Perforce\\P4.EXE"

Parameters:
path - The path.

setP4Port

public void setP4Port(java.lang.String port)
Sets the port for the perforce server. Default: "public.perforce.com:1666".

Parameters:
port - The port.

setP4User

public void setP4User(java.lang.String user)
Sets the perforce user. Example: philip_johnson.

Parameters:
user - The user.

setP4Password

public void setP4Password(java.lang.String password)
Sets the password for the perforce user.

Parameters:
password - The password.

setP4SystemRoot

public void setP4SystemRoot(java.lang.String sysroot)
Sets the system root. Only needed on Windows systems. Default: "C:\\WINDOWS".

Parameters:
sysroot - The system root.

setP4SystemDrive

public void setP4SystemDrive(java.lang.String sysdrive)
Sets the system drive. Only needed on Windows systems. Default: "C:".

Parameters:
sysdrive - The system drive.

setVerbose

public void setVerbose(boolean isVerbose)
Sets verbose mode. If true, lots of output regarding p4 tool execution is printed.

Parameters:
isVerbose - True to set verbose mode.

getEnv

public com.perforce.api.Env getEnv()
Returns a Perforce Java API Env instance constructed from the data supplied to this instance.

Returns:
The Env instance.