org.apache.tools.ant.taskdefs.optional.perforce

Class P4HandlerAdapter

Implemented Interfaces:
ExecuteStreamHandler, P4Handler
Known Direct Subclasses:
SimpleP4OutputHandler

public abstract class P4HandlerAdapter
extends java.lang.Object
implements P4Handler

base class to manage streams around the execution of the Perforce command line client

Method Summary

abstract void
process(String line)
subclasses of P4HandlerAdapter must implement this routine processing of one line of stdout or of stderr
void
setOutput(String p4Input)
set any data to be written to P4's stdin
void
setProcessErrorStream(InputStream is)
connects the handler to the stderr of the Perforce process
void
setProcessInputStream(OutputStream os)
connects the handler to the input stream into Perforce used indirectly by tasks requiring to send specific standard input such as p4label, p4change
void
setProcessOutputStream(InputStream is)
connects the handler to the stdout of the Perforce process
void
start()
this routine gets called by the execute routine of the Execute class it connects the PumpStreamHandler to the input/output/error streams of the process.
void
stop()
stops the processing of streams called from P4Base#execP4Command(String command, P4Handler handler)

Method Details

process

public abstract void process(String line)
subclasses of P4HandlerAdapter must implement this routine processing of one line of stdout or of stderr
Specified by:
process in interface P4Handler
Parameters:
line - line of stdout or stderr to process

setOutput

public void setOutput(String p4Input)
set any data to be written to P4's stdin
Specified by:
setOutput in interface P4Handler
Parameters:
p4Input - the text to write to P4's stdin

setProcessErrorStream

public void setProcessErrorStream(InputStream is)
            throws IOException
connects the handler to the stderr of the Perforce process
Specified by:
setProcessErrorStream in interface ExecuteStreamHandler
Parameters:
is - stderr coming from Perforce

setProcessInputStream

public void setProcessInputStream(OutputStream os)
            throws IOException
connects the handler to the input stream into Perforce used indirectly by tasks requiring to send specific standard input such as p4label, p4change
Specified by:
setProcessInputStream in interface ExecuteStreamHandler
Parameters:
os - the stream bringing input to the p4 executable

setProcessOutputStream

public void setProcessOutputStream(InputStream is)
            throws IOException
connects the handler to the stdout of the Perforce process
Specified by:
setProcessOutputStream in interface ExecuteStreamHandler
Parameters:
is - stdout coming from Perforce

start

public void start()
            throws BuildException
this routine gets called by the execute routine of the Execute class it connects the PumpStreamHandler to the input/output/error streams of the process.
Specified by:
start in interface ExecuteStreamHandler
Throws:
BuildException -

stop

public void stop()
stops the processing of streams called from P4Base#execP4Command(String command, P4Handler handler)
Specified by:
stop in interface ExecuteStreamHandler

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