JDeveloper SCM API

oracle.ide.scm.util.runner
Class SCMPatternStreamMonitor

java.lang.Object
  |
  +--oracle.ide.scm.util.runner.SCMBufferedStreamMonitor
        |
        +--oracle.ide.scm.util.runner.SCMPatternStreamMonitor
All Implemented Interfaces:
SCMStreamMonitor

public abstract class SCMPatternStreamMonitor
extends SCMBufferedStreamMonitor

Pattern-based implementation of a stream monitor. An abstraction intended for subclass updates when a region of the buffered data read from the stream is found to match a given pattern. The current implementation only supports pattern specification as strings (not regular expressions). One useful application of this monitor type is that, if the process blocks after a password prompt (without a newline from output), the prompt pattern can be recognized and the state handled accordingly.


Fields inherited from class oracle.ide.scm.util.runner.SCMBufferedStreamMonitor
m_buffer
 
Constructor Summary
SCMPatternStreamMonitor(java.lang.String pattern)
          Constructs a new pattern stream monitor
 
Method Summary
protected abstract  void patternMatched(SCMProcess process)
          Notifies the monitor subclass that the pattern has been matched in output.
 void streamBytes(byte[] bytes, int length, SCMProcess process)
          Adds all new data to the buffer of the monitor and performs the pattern matching test.
 
Methods inherited from class oracle.ide.scm.util.runner.SCMBufferedStreamMonitor
clearBuffer, getBufferText, streamFinished
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCMPatternStreamMonitor

public SCMPatternStreamMonitor(java.lang.String pattern)
Constructs a new pattern stream monitor
Parameters:
pattern - the string to look for in buffered output.
Method Detail

streamBytes

public void streamBytes(byte[] bytes,
                        int length,
                        SCMProcess process)
                 throws SCMStreamMonitorException
Adds all new data to the buffer of the monitor and performs the pattern matching test.
Overrides:
streamBytes in class SCMBufferedStreamMonitor
Following copied from interface: oracle.ide.scm.util.runner.SCMStreamMonitor
Parameters:
bytes - the array containing recently read data, from index 0.
length - the length, in bytes, of the data that has been read.
process - the parent process for the stream.
Throws:
SCMStreamMonitorException - if the monitor raised an exception, and the stream should be closed.

patternMatched

protected abstract void patternMatched(SCMProcess process)
                                throws SCMStreamMonitorException
Notifies the monitor subclass that the pattern has been matched in output. The subclass should place specific state-handling code within the body of this method implementation.
Parameters:
process - the parent process for the stream.
Throws:
SCMStreamMonitorException - if the monitor raised an exception, and the stream should be closed.

Copyright © 2002 Oracle Corporation