## org.apache.tools.ant.taskdefs.optional.perforce
Class P4Base

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.tools.ant.taskdefs.optional.perforce.P4Base

Direct Known Subclasses:
  P4Add, P4Change, P4Counter, P4Delete, P4Edit, P4Have, P4Label, P4Reopen, P4Revert, P4Submit, P4Sync

public abstract class P4Base
extends Task

Base class for Perforce (P4) ANT tasks. See individual task for example usage.

Author:
  Les Hughes
See Also:
  `P4Sync`, `P4Have`, `P4Change`, `P4Edit`, `P4Submit`, `P4Label`, `Exec`

Field Summary
`protected boolean` `failOnError` Keep going or fail on error - defaults to fail.
`protected java.lang.String` `P4Client` Perforce Client (eg myclientspec)
`protected java.lang.String` `P4CmdOpts` Perforce command opts.
`protected java.lang.String` `P4Opts` Perforce 'global' opts.
`protected java.lang.String` `P4Port` Perforce Server Port (eg KM01:1666)
`protected java.lang.String` `P4User` Perforce User (eg fbloggs)
`protected java.lang.String` `P4View` Perforce view for commands.
`protected java.lang.String` `shell` The OS shell to use (cmd.exe or /bin/sh)
`protected org.apache.oro.text.perl.Perl5Util` `util` Perl5 regexp in Java - cool eh?

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`P4Base()`

Method Summary
`protected void` `execP4Command(java.lang.String command)`
`protected void` `execP4Command(java.lang.String command, P4Handler handler)` Execute P4 command assembled by subclasses.
`void` `init()` Called by the project to let the task initialize properly.
`void` `setClient(java.lang.String P4Client)` The p4 client spec to use; optional, defaults to the current user
`void` `setCmdopts(java.lang.String P4CmdOpts)` Set extra command options; only used on some of the Perforce tasks.
`void` `setFailonerror(boolean fail)` whether to stop the build (true, default) or keep going if an error is returned from the p4 command
`void` `setPort(java.lang.String P4Port)` The p4d server and port to connect to; optional, default "perforce:1666"
`void` `setUser(java.lang.String P4User)` The p4 username; optional, defaults to the current user
`void` `setView(java.lang.String P4View)` The client, branch or label view to operate upon; optional default "//..."

Methods inherited from class org.apache.tools.ant.Task
`execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### util

    protected org.apache.oro.text.perl.Perl5Util util

  Perl5 regexp in Java - cool eh?

### shell

    protected java.lang.String shell

  The OS shell to use (cmd.exe or /bin/sh)

### P4Port

    protected java.lang.String P4Port

  Perforce Server Port (eg KM01:1666)

### P4Client

    protected java.lang.String P4Client

  Perforce Client (eg myclientspec)

### P4User

    protected java.lang.String P4User

  Perforce User (eg fbloggs)

### P4View

    protected java.lang.String P4View

  Perforce view for commands. (eg //projects/foobar/main/source/... )

### failOnError

    protected boolean failOnError

  Keep going or fail on error - defaults to fail.

### P4Opts

    protected java.lang.String P4Opts

  Perforce 'global' opts. Forms half of low level API

### P4CmdOpts

    protected java.lang.String P4CmdOpts

  Perforce command opts. Forms half of low level API

Constructor Detail

### P4Base

    public P4Base()

Method Detail

### setPort

    public void setPort(java.lang.String P4Port)

  The p4d server and port to connect to; optional, default "perforce:1666"

### setClient

    public void setClient(java.lang.String P4Client)

  The p4 client spec to use; optional, defaults to the current user

### setUser

    public void setUser(java.lang.String P4User)

  The p4 username; optional, defaults to the current user

### setView

    public void setView(java.lang.String P4View)

  The client, branch or label view to operate upon; optional default "//..."

### setCmdopts

    public void setCmdopts(java.lang.String P4CmdOpts)

  Set extra command options; only used on some of the Perforce tasks.

### setFailonerror

    public void setFailonerror(boolean fail)

  whether to stop the build (true, default) or keep going if an error is returned from the p4 command

### init

    public void init()

  Description copied from class: `Task`
  Called by the project to let the task initialize properly. The default implementation is a no-op.

  Overrides:
    `init` in class `Task`

### execP4Command

    protected void execP4Command(java.lang.String command)
                          throws BuildException

  Throws:
    `BuildException`

### execP4Command

    protected void execP4Command(java.lang.String command,
                                 P4Handler handler)
                          throws BuildException

  Execute P4 command assembled by subclasses.

  Parameters:
    `command` - The command to run
    `handler` - A P4Handler to process any input and output
  Throws:
    `BuildException`

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.