blob: 4e1b3158f22b70bc3b41748a582053503c23c46b [file] [log] [blame]
<HTML><!-- #BeginTemplate "/Templates/MainTemplate.dwt" -->
<!-- #BeginEditable "doctitle" -->
<TITLE>RBReporter Scan File</TITLE>
<!-- #EndEditable -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
.topicHead { font-family: "Times New Roman", Times, serif; font-size: 14pt; font-weight: bold; text-align: center; color: #333333}
.topicList { font-family: Georgia, "Times New Roman", Times, serif; font-size: 9pt; color: #FF0099; list-style-image: url(images/diamond_bullet.gif); text-decoration: none; font-weight: bold}
.mainBlock { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; text-align: justify}
<TD ROWSPAN="2" COLSPAN="2" BACKGROUND="images/template_ul.gif" HEIGHT="75"><IMG SRC="images/spacer.gif" WIDTH="280" HEIGHT="1" HSPACE="0"></TD>
<TD HEIGHT="15" WIDTH="100%" BACKGROUND="images/template_u.gif"></TD>
<TD HEIGHT="60" >
<CENTER><IMG SRC="images/TitleLogo_transparent.gif" VSPACE="0"></CENTER>
<TD WIDTH="200" BACKGROUND="images/template_l.gif" VALIGN="top">
<TD CLASS="topicHead">General</TD>
<TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD>
<TD CLASS="topicList">
<LI><A HREF="system_requirements.html">System Requirements</A></LI>
<LI><A HREF="faq.html">FAQ</A></LI>
<LI><A HREF="future_features.html">Future Releases</A></LI>
<LI CLASS="topicList"><A HREF="future_features.html">Version
<TD CLASS="topicHead">RB Manager</TD>
<TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD>
<TD CLASS="topicList">
<LI><A HREF="index.html">Home</A></LI>
<LI><A HREF="tutorial/index.html">Tutorial</A></LI>
<LI><A HREF="views/index.html">Functionality and Views</A></LI>
<LI><A HREF="lookandfeel.html">Look and Feel</A></LI>
<LI><A HREF="menu.html">Menu Items</A></LI>
<LI CLASS="topicList"><A HREF="tutorial/step1.html">Preferences</A></LI>
<TD CLASS="topicHead">RB Reporter</TD>
<TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD>
<TD CLASS="topicList">
<LI><A HREF="RBReporter.html">Home</A></LI>
<LI>Report Types</LI>
<LI><A HREF="scanfile.html">Code Scanning</A></LI>
<P>&nbsp; </P>
<TD COLSPAN="2" VALIGN="top" CLASS="mainBlock"><!-- #BeginEditable "Main" -->
<H1 ALIGN="CENTER">RBReporter Scan XML Configuration File</H1>
<P>The configuration file for RBReporter scans is a text file stored in
XML. The design on the format for this configuration file was kept simple
and so the general application of the scanner is not meant for complicated
analysis. The design works around three types of rules: Directory Rules,
File Rules, and Parse Rules. Each of these will be explained below. First,
here is an example file for reference. This file is the configuration
file used to scan the resource bundle associated with RBManager.</P>
<P><B>Sample Scan File </B>(rbmanager_scan.xml<B>)</B></P>
&lt;?xml version="1.0" ?>
&lt;RBFILESCANNER NAME="RBManager Scanner" FILENAME="rbmanager_scanner.xml">
&lt;!-- FileRules can have attributes starts_with, ends_with, and contains -->
&lt;FILERULE NAME="Java File" ENDS_WITH=".java" />
&lt;FILERULE NAME="XSL File" ENDS_WITH=".xsl" />
&lt;!-- ParseRules can have attributes follows and precedes -->
&lt;PARSERULE NAME="Java static resource" FOLLOWS="Resources.getTranslation(&amp;quot;" PRECEDES="&amp;quot;" />
&lt;DIRECTORY LOCATION="\C:\Development\RBManager\Source" RECURSE_DIRECTORIES="true">
&lt;APPLYPARSERULE NAME="Java static resource" />
<P>The root element of the XML file is named 'RBFILESCANNER'. This root
element has two optional attributes for naming the scan file in a human
readable manner and specifying the file name. These attributes are for
the developers reference; they mean nothing to RBReporter. Beneath the
root element are three required elements 'FILERULES', 'PARSERULES' and
'SCAN'. </P>
<P>Beneath the FILERULES element are found FILERULE elements. Any number
of these rules can be specified, though each must have a unique name as
specified in the element's NAME attribute. Along with this name attribute,
the attributes STARTS_WITH, ENDS_WITH, and CONTAINS may be optionally
specified. These are the rules applied to each file in a directory to
determine whether or not they will be scanned. The attribute rules are
applied to the file names of each file in the directory and if each is
found to be true, that file is evaluated against the parse rules.</P>
<P>Beneath the PARSERULES element are found PARSERULE elements. Any number
of these rules can be specified, though each must have a uniques name
as specifiedn in the element's NAME attrinute. Along with this name attribute,
the attributes FOLLOWS and PRECEDES may optionally be specified. These
are the rules applied to each line of text in a selected file to determine
if that line of text contains one or more resource keys.</P>
<P>Beneath the SCAN element are found DIRECTORY elements. Any number of
these elements can be specified. The required LOCATION attribute specifies
in a machine dependent manner the location of a directory for which the
files are to be scanned for resource bundles. An optional RECURSE_DIRECTORIES
attribute may be specified. If the value of this attribute is set to 'true',
then all directories beneath the directory specified are also scanned.</P>
<P>Beneath each DIRECTORY element, exactly one RULES elements can be specified.Beneath
this element, any number of APPLY FILE RULE elements may be specified.
The required NAME attribute specifies which of the file rules defined
previously are to be applied. Beneath these element any number of APPLYPARSERULE
elements may be specified. The required NAME attribute specifies which
of the parse rules defined previously are to be applied to the files accepted
by the parent file rule.</P>
<P><B>The Example File Explained</B></P>
<P>Given the details of the file structure, we can now examine how the example
file specifies which files to scan, and then how it specifies how to find
the resource keys contained in those files.</P>
<P>RBReporter first begins by going through each of the directories specified.
In the example file case, there is only one directory. It then goes through
each of the files contained in that directory and its subdirectories looking
for files that pass the 'Java File' file test. The 'Java File' test simply
checks the file name to see if it ends in the extension '.java'. If the
file has such an extension the parse rule 'Java static resource' is applied
to every line of text within that file.</P>
<P>Thus if the following file, named, were to be found in the
directory. The two resource keys 'Hello' and 'World' would be found.</P>
public class Sample {
public static void main(String args[]) {
System.out.println(Resources.getTranslation(&quot;Hello&quot;) + &quot; &quot; + Resources.getTranslation(&quotWorld&quot;));
<!-- #EndEditable --></TD>
<TD BACKGROUND="images/template_ll.gif" HEIGHT="40" WIDTH="200">
<!-- Comment -->
<TD WIDTH="80">
<!-- Comment -->
<CENTER><SPAN CLASS="Copyright">Copyright 2000-2001 International Business Machines, All Rights Reserved</SPAN></CENTER>
<!-- #EndTemplate --></HTML>