ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/proposal/sandbox/filterreaders/docs/manual/CoreTypes filterchain.html
Date Wed, 27 Feb 2002 21:51:34 GMT
umagesh     02/02/27 13:51:34

  Added:       proposal/sandbox/filterreaders/docs/manual/CoreTypes
                        filterchain.html
  Log:
  Oops... missed adding this as well.
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/sandbox/filterreaders/docs/manual/CoreTypes/filterchain.html
  
  Index: filterchain.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  
  <HTML>
  <HEAD>
    <TITLE>FilterChain Type</TITLE>
  </HEAD>
  
  <BODY>
  <H2><A name="filterchain">FilterChain</A></H2>
  
  <P>FilterChains are groups of ordered FilterReaders. FilterChains can appear
  inside tasks that support this feature. <BR>FilterChains are used for
  filtering file contents read in by tasks like <a href="../CoreTasks/loadfile.html">
  LoadFile</a>, LoadProperties, etc.<BR>
  
  Each FilterChain is composed of zero or more of the following nested elements.<BR>
  <a href="#filterreader">FilterReader</a><BR>
  <a href="#headfilter">HeadFilter</a><BR>
  <a href="#linecontains">LineContains</a><BR>
  <a href="#prefixlines">PrefixLines</a><BR>
  <a href="#replacetokens">ReplaceTokens</a><BR>
  <a href="#stripjavacomments">StripJavaComments</a><BR>
  <a href="#striplinebreaks">StripLineBreaks</a><BR>
  <a href="#striplinecomments">StripLineComments</a><BR>
  <a href="#tabstospaces">TabsToSpaces</a><BR>
  <a href="#tailfilter">TailFilter</a><BR>
  
  <H2><a name="filterreader">FilterReader</a></H2>
  
  The filterreader element is the generic way to
  define a filter.  User defined filters can be
  used using this.  Built in filter readers can also
  be speficied using this.
  
  A FilterReader element must be supplied with a class name as
  an attribute value.  The class resolved by this name must
  extend java.io.FilterReader.  If the custom filter reader
  needs to be parameterized, it must implement
  org.apache.tools.type.Parameterizable.
  
  <TABLE cellSpacing=0 cellPadding=2 border=1>
    <TR>
      <TD vAlign=top><B>Attribute</B></TD>
      <TD vAlign=top><B>Description</B></TD>
      <TD vAlign=top align="center"><B>Required</B></TD>
    </TR>
    <TR>
      <TD vAlign=top>classname</TD>
      <TD vAlign=top>The class name of the filter reader.</TD>
      <TD vAlign=top align="center">Yes</TD>
    </TR>
  </TABLE>
  
  <p>
  The following FilterReaders are supplied with the default
  distribution.
  
  <H3>org.apache.tools.ant.filters.<a name="headfilter">HeadFilter</a></H3>
  
  This filter reads the first few lines from the data supplied to it.
  
  <TABLE cellSpacing=0 cellPadding=2 border=1>
    <TR>
      <TD vAlign=top><B>Parameter Name</B></TD>
      <TD vAlign=top><B>Parameter Value</B></TD>
      <TD vAlign=top align="center"><B>Required</B></TD>
    </TR>
    <TR>
      <TD vAlign=top>lines</TD>
      <TD vAlign=top align="center">Number of lines to be read.
      Defaults to &quot;10&quot;</TD>
      <TD vAlign=top align="center">No</TD>
    </TR>
  </TABLE>
  <P>
  <H4>Example:</H4>
  
  This stores the first 15 lines of the supplied data in the property ${src.file.head}
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.head}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.HeadFilter&quot;&gt;
        &lt;param name=&quot;lines&quot; value=&quot;15&quot;/&gt;
      &lt;/filterreader&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.head}&quot;&gt;
    &lt;filterchain&gt;
      &lt;headfilter lines=&quot;15&quot;/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  <H3>org.apache.tools.ant.filters.<a name="replacetokens">ReplaceTokens</a></H3>
  
  This filter reader replaces all strings that are
  sandwiched between begintoken and endtoken with
  user defined values.
  
  <TABLE cellSpacing=0 cellPadding=2 border=1>
    <TR>
      <TD vAlign=top><B>Parameter Type</B></TD>
      <TD vAlign=top><B>Parameter Name</B></TD>
      <TD vAlign=top><B>Parameter Value</B></TD>
      <TD vAlign=top align="center"><B>Required</B></TD>
    </TR>
    <TR>
      <TD vAlign=top>tokenchar</TD>
      <TD vAlign=top>begintoken</TD>
      <TD vAlign=top>Character marking the
      beginning of a token.  Defaults to @</TD>
      <TD vAlign=top align="center">No</TD>
    </TR>
    <TR>
      <TD vAlign=top>tokenchar</TD>
      <TD vAlign=top>endtoken</TD>
      <TD vAlign=top>Character marking the
      end of a token.  Defaults to @</TD>
      <TD vAlign=top align="center">No</TD>
    </TR>
    <TR>
      <TD vAlign=top>token</TD>
      <TD vAlign=top>User defined String.</TD>
      <TD vAlign=top>User defined search String</TD>
      <TD vAlign=top align="center">Yes</TD>
    </TR>
  </TABLE>
  <P>
  
  <H4>Example:</H4>
  
  This replaces occurences of the string @DATE@ in the data
  with today's date and stores it in the property ${src.file.replaced}
  <BLOCKQUOTE><PRE>
  &lt;tstamp/&gt;
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.replaced}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.ReplaceTokens&quot;&gt;
        &lt;param type=&quot;token&quot; name=&quot;DATE&quot; value=&quot;${TODAY}&quot;/&gt;
      &lt;/filterreader&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;tstamp/&gt;
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.replaced}&quot;&gt;
    &lt;filterchain&gt;
      &lt;replacetokens&gt;
        &lt;token key=&quot;DATE&quot; value=&quot;${TODAY}&quot;/&gt;
      &lt;/replacetokens&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  <H3>org.apache.tools.ant.filters.<a name="stripjavacomments">StripJavaComments</a></H3>
  
  This filter reader strips away comments from the data,
  using Java syntax guidelines.  This filter does not
  take in any parameters.
  <P>
  <H4>Example:</H4>
  
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${java.src.file}&quot; property=&quot;${java.src.file.nocomments}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.StripJavaComments&quot;/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${java.src.file}&quot; property=&quot;${java.src.file.nocomments}&quot;&gt;
    &lt;filterchain&gt;
      &lt;stripjavacomments/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  <H3>org.apache.tools.ant.filters.<a name="striplinebreaks">StripLineBreaks</a></H3>
  
  This filter reader strips away specific characters
  from the data supplied to it.
  
  <TABLE cellSpacing=0 cellPadding=2 border=1>
    <TR>
      <TD vAlign=top><B>Parameter Name</B></TD>
      <TD vAlign=top><B>Parameter Value</B></TD>
      <TD vAlign=top align="center"><B>Required</B></TD>
    </TR>
    <TR>
      <TD vAlign=top>linebreaks</TD>
      <TD vAlign=top align="center">Characters that are to
      be stripped out.  Defaults to &quot;\r\n&quot;</TD>
      <TD vAlign=top align="center">No</TD>
    </TR>
  </TABLE>
  <P>
  <H4>Examples:</H4>
  
  This strips the '\r' and '\n' characters.
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.contents}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.StripLineBreaks&quot;/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.contents}&quot;&gt;
    &lt;filterchain&gt;
      &lt;striplinebreaks/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  This treats the '(' and ')' characters as line break characters and
  strips them.
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.contents}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.StripLineBreaks&quot;&gt;
        &lt;param name=&quot;linebreaks&quot; value=&quot;()&quot;/&gt;
      &lt;/filterreader&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  <H3>org.apache.tools.ant.filters.<a name="tabstospaces">TabToSpaces</a></H3>
  
  This filter replaces tabs with spaces
  
  <TABLE cellSpacing=0 cellPadding=2 border=1>
    <TR>
      <TD vAlign=top><B>Parameter Name</B></TD>
      <TD vAlign=top><B>Parameter Value</B></TD>
      <TD vAlign=top align="center"><B>Required</B></TD>
    </TR>
    <TR>
      <TD vAlign=top>lines</TD>
      <TD vAlign=top align="center">tablength
      Defaults to &quot;8&quot;</TD>
      <TD vAlign=top align="center">No</TD>
    </TR>
  </TABLE>
  <P>
  <H4>Examples:</H4>
  
  This replaces tabs in ${src.file} with spaces.
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.notab}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.TabsToSpaces&quot;/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.notab}&quot;&gt;
    &lt;filterchain&gt;
      &lt;tabstospaces/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  <H3>org.apache.tools.ant.filters.<a name="tailfilter">TailFilter</a></H3>
  
  This filter reads the last few lines from the data supplied to it.
  
  <TABLE cellSpacing=0 cellPadding=2 border=1>
    <TR>
      <TD vAlign=top><B>Parameter Name</B></TD>
      <TD vAlign=top><B>Parameter Value</B></TD>
      <TD vAlign=top align="center"><B>Required</B></TD>
    </TR>
    <TR>
      <TD vAlign=top>lines</TD>
      <TD vAlign=top align="center">Number of lines to be read.
      Defaults to &quot;10&quot;</TD>
      <TD vAlign=top align="center">No</TD>
    </TR>
  </TABLE>
  <P>
  <H4>Examples:</H4>
  
  This stores the last 15 lines of the supplied data in the property ${src.file.tail}
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.tail}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.TailFilter&quot;&gt;
        &lt;param name=&quot;lines&quot; value=&quot;15&quot;/&gt;
      &lt;/filterreader&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.tail}&quot;&gt;
    &lt;filterchain&gt;
      &lt;tailfilter lines=&quot;15&quot;/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  
  This stores the last 5 lines of the first 15 lines of the supplied
  data in the property ${src.file.mid}
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.mid}&quot;&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.HeadFilter&quot;&gt;
        &lt;param name=&quot;lines&quot; value=&quot;15&quot;/&gt;
      &lt;/filterreader&gt;
      &lt;filterreader classname=&quot;org.apache.tools.ant.filters.TailFilter&quot;&gt;
        &lt;param name=&quot;lines&quot; value=&quot;5&quot;/&gt;
      &lt;/filterreader&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  Short form:
  <BLOCKQUOTE><PRE>
  &lt;loadfile srcfile=&quot;${src.file}&quot; property=&quot;${src.file.mid}&quot;&gt;
    &lt;filterchain&gt;
      &lt;HeadFilter lines=&quot;15&quot;/&gt;
      &lt;TailFilter lines=&quot;5&quot;/&gt;
    &lt;/filterchain&gt;
  &lt;/loadfile&gt;
  </PRE></BLOCKQUOTE>
  
  <HR>
  
  <P align=center>Copyright &copy; 2002 Apache Software Foundation. All rights
  Reserved.</P></BODY></HTML>
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message