org.zeroturnaround.exec.listener
Class CompositeProcessListener

java.lang.Object
  extended by org.zeroturnaround.exec.listener.ProcessListener
      extended by org.zeroturnaround.exec.listener.CompositeProcessListener
All Implemented Interfaces:
Cloneable

public class CompositeProcessListener
extends ProcessListener
implements Cloneable

Composite process event handler.

Author:
Rein Raudjärv

Constructor Summary
CompositeProcessListener()
           
CompositeProcessListener(List<ProcessListener> children)
           
 
Method Summary
 void add(ProcessListener listener)
          Add new listener.
 void afterFinish(Process process, ProcessResult result)
          Invoked after a process has finished successfully.
 void afterStart(Process process, ProcessExecutor executor)
          Invoked after a process has started.
 void afterStop(Process process)
          Invoked after a process has exited (whether finished or cancelled).
 void beforeStart(ProcessExecutor executor)
          Invoked before a process is started.
 void clear()
          Remove all existing listeners.
 CompositeProcessListener clone()
           
 void remove(ProcessListener listener)
          Remove existing listener.
 void removeAll(Class<? extends ProcessListener> type)
          Remove existing listeners of given type or its sub-types.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeProcessListener

public CompositeProcessListener()

CompositeProcessListener

public CompositeProcessListener(List<ProcessListener> children)
Method Detail

add

public void add(ProcessListener listener)
Add new listener.

Parameters:
listener - listener to be added.

remove

public void remove(ProcessListener listener)
Remove existing listener.

Parameters:
listener - listener to be removed.

removeAll

public void removeAll(Class<? extends ProcessListener> type)
Remove existing listeners of given type or its sub-types.

Parameters:
type - listener type.

clear

public void clear()
Remove all existing listeners.


clone

public CompositeProcessListener clone()
Overrides:
clone in class Object

beforeStart

public void beforeStart(ProcessExecutor executor)
Description copied from class: ProcessListener
Invoked before a process is started.

Overrides:
beforeStart in class ProcessListener
Parameters:
executor - executor used for starting a process. Any changes made here apply to the starting process. Once the process has started it is not affected by the ProcessExecutor any more.

afterStart

public void afterStart(Process process,
                       ProcessExecutor executor)
Description copied from class: ProcessListener
Invoked after a process has started.

Overrides:
afterStart in class ProcessListener
Parameters:
process - the process started.
executor - executor used for starting the process. Modifying the ProcessExecutor only affects the following processes not the one just started.

afterFinish

public void afterFinish(Process process,
                        ProcessResult result)
Description copied from class: ProcessListener
Invoked after a process has finished successfully.

Overrides:
afterFinish in class ProcessListener
Parameters:
process - process just finished.
result - result of the finished process.

afterStop

public void afterStop(Process process)
Description copied from class: ProcessListener
Invoked after a process has exited (whether finished or cancelled).

Overrides:
afterStop in class ProcessListener
Parameters:
process - process just stopped.


Copyright © 2015 ZeroTurnaround. All rights reserved.