org.ow2.jasmine.monitoring.mbeancmd
Class Outer

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.Outer
All Implemented Interfaces:
java.lang.Runnable

public class Outer
extends java.lang.Object
implements java.lang.Runnable

A pipe consists of a pair of channels: a writable channel (called "sink", where information is written to) and a readable channel (called "source", where information is obtained from). The general idea is that once some bytes are available on the source: 1. The pipe reads those bytes. 2. If required, does some action with some or all of these bytes (for example, write them to a file). 3. If a sink is present, writes the exact same bytes in the exact same order on the sink. An Outer instance can retrieve information from (=use as source) a PrintStream or a File and outputs information to (=uses as sink) a PipedOutputStream. The main difference between an Outer and an Iner is that an Outer can also filter out (@see Outer.setRegexp and Outer.setTimeFilter) information and output it on a target. Note that the sink still keeps on receiving unmodified data from the source.


Constructor Summary
Outer(java.io.PipedOutputStream src, java.io.File file)
          Creates an Outer using a PipedOutputStream as source and a File as output.
Outer(java.io.PipedOutputStream src, java.io.PrintStream target)
          Creates an Outer using a PipedOutputStream as source and a PrintStream as output.
 
Method Summary
 java.lang.String getId()
           
static java.lang.String getSeparator()
           
 java.io.PipedOutputStream getSink()
           
static void main(java.lang.String[] args)
          Tests the Outer implementation.
 void resetTimeFilter()
          Resets the time filter.
 void run()
          Starts the activity on the Outer (as described in the class header).
 void setFormatter(java.lang.String[] columns)
           
 void setId(java.lang.String id)
           
 void setRegexp(java.lang.String exp)
           
static void setSeparator(java.lang.String s)
           
 void setSink(java.io.PipedOutputStream sink)
           
 void setTimeFilter(java.lang.String field, java.lang.String fieldFormat, java.lang.String from, java.lang.String to)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Outer

public Outer(java.io.PipedOutputStream src,
             java.io.PrintStream target)
      throws java.io.IOException
Creates an Outer using a PipedOutputStream as source and a PrintStream as output. A dummy sink (accessible via getSink() and that can be used an input to any pipe) will be created by default.

Parameters:
src - PipedOutputStream to use as source.
target - PrintStream to use as target (can be null).
Throws:
java.io.IOException - If construction or pipe connection fails.
See Also:
setSink(PipedOutputStream)

Outer

public Outer(java.io.PipedOutputStream src,
             java.io.File file)
      throws java.io.IOException
Creates an Outer using a PipedOutputStream as source and a File as output. A dummy sink (accessible via getSink() and that can be used an input to any pipe) will be created by default.

Parameters:
src - PipedOutputStream to use as source.
file - File to use as output.
Throws:
java.io.IOException - If construction or pipe connection fails.
See Also:
setSink(PipedOutputStream)
Method Detail

setSink

public void setSink(java.io.PipedOutputStream sink)
Parameters:
sink - Sink to set. A dummy sink will be created if null.

getSink

public java.io.PipedOutputStream getSink()
Returns:
The sink currently used.

getId

public java.lang.String getId()
Returns:
The id set.

setId

public void setId(java.lang.String id)
Parameters:
id - The id to set.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Tests the Outer implementation.

Parameters:
args - Ignored.
Throws:
java.io.IOException - When there's a problem with the source or sink.

run

public void run()
Starts the activity on the Outer (as described in the class header).

Specified by:
run in interface java.lang.Runnable

setFormatter

public void setFormatter(java.lang.String[] columns)
Parameters:
columns - Name of the columns to set in the formatter.

setRegexp

public void setRegexp(java.lang.String exp)
Parameters:
exp - Regular expression to use as filter for the target.

setTimeFilter

public void setTimeFilter(java.lang.String field,
                          java.lang.String fieldFormat,
                          java.lang.String from,
                          java.lang.String to)
Parameters:
field - Which field to use for time filtering.
fieldFormat - Format of the time field as described in SimpleDateFormat.
from - Time from which to start outputting data.
to - Time at which to stop outputting data.
See Also:
resetTimeFilter()

resetTimeFilter

public void resetTimeFilter()
Resets the time filter.

See Also:
setTimeFilter(String, String, String, String)

getSeparator

public static java.lang.String getSeparator()
Returns:
The current field separator.

setSeparator

public static void setSeparator(java.lang.String s)
Parameters:
s - New field separator to use.


Copyright © 2009 OW2 Consortium. All Rights Reserved.