scuffed-code/tools/unicodetools/com/ibm/rbm/docs/scanfile.html
2003-11-04 22:49:40 +00:00

221 lines
9.8 KiB
HTML

<HTML><!-- #BeginTemplate "/Templates/MainTemplate.dwt" -->
<HEAD>
<!-- #BeginEditable "doctitle" -->
<TITLE>RBReporter Scan File</TITLE>
<!-- #EndEditable -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<STYLE TYPE="TEXT/CSS">
<!--
.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}
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<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>
</TR>
<TR>
<TD HEIGHT="60" >
<CENTER><IMG SRC="images/TitleLogo_transparent.gif" VSPACE="0"></CENTER>
</TD>
</TR>
<TR>
<TD WIDTH="200" BACKGROUND="images/template_l.gif" VALIGN="top">
<TABLE WIDTH="180" CELLSPACING="0" CELLPADDING="1">
<TR>
<TD CLASS="topicHead">General</TD>
</TR>
<TR>
<TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD>
</TR>
<TR>
<TD CLASS="topicList">
<UL>
<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
History</A></LI>
</UL>
</TD>
</TR>
<TR>
<TD CLASS="topicHead">RB Manager</TD>
</TR>
<TR>
<TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD>
</TR>
<TR>
<TD CLASS="topicList">
<UL>
<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>
</UL>
</TD>
</TR>
<TR>
<TD CLASS="topicHead">RB Reporter</TD>
</TR>
<TR>
<TD VALIGN="center"><IMG SRC="images/template_line.gif"></TD>
</TR>
<TR>
<TD CLASS="topicList">
<UL>
<LI><A HREF="RBReporter.html">Home</A></LI>
<LI>Report Types</LI>
<LI><A HREF="scanfile.html">Code Scanning</A></LI>
</UL>
</TD>
</TR>
</TABLE>
<P>&nbsp; </P>
</TD>
<TD COLSPAN="2" VALIGN="top" CLASS="mainBlock"><!-- #BeginEditable "Main" -->
<H1 ALIGN="CENTER">RBReporter Scan XML Configuration File</H1>
<P><B>Introduction</B></P>
<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>
<BLOCKQUOTE><CODE>
<PRE>
&lt;?xml version="1.0" ?>
&lt;RBFILESCANNER NAME="RBManager Scanner" FILENAME="rbmanager_scanner.xml">
&lt;FILERULES>
&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;/FILERULES>
&lt;PARSERULES>
&lt;!-- ParseRules can have attributes follows and precedes -->
&lt;PARSERULE NAME="Java static resource" FOLLOWS="Resources.getTranslation(&amp;quot;" PRECEDES="&amp;quot;" />
&lt;/PARSERULES>
&lt;SCAN>
&lt;DIRECTORY LOCATION="\C:\Development\RBManager\Source" RECURSE_DIRECTORIES="true">
&lt;RULES>
&lt;APPLYFILERULE NAME="Java File">
&lt;APPLYPARSERULE NAME="Java static resource" />
&lt;/APPLYFILERULE>
&lt;/RULES>
&lt;/DIRECTORY>
&lt;/SCAN>
&lt;/RBFILESCANNER>
</PRE>
</CODE></BLOCKQUOTE>
<P><B>Details</B></P>
<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 Sample.java, were to be found in the
directory. The two resource keys 'Hello' and 'World' would be found.</P>
<blockquote><code>
<pre>
public class Sample {
public static void main(String args[]) {
System.out.println(Resources.getTranslation(&quot;Hello&quot;) + &quot; &quot; + Resources.getTranslation(&quotWorld&quot;));
}
}
</pre>
</code></blockquote>
<!-- #EndEditable --></TD>
</TR>
<TR>
<TD BACKGROUND="images/template_ll.gif" HEIGHT="40" WIDTH="200">
<!-- Comment -->
</TD>
<TD WIDTH="80">
<!-- Comment -->
</TD>
<TD>
<CENTER><SPAN CLASS="Copyright">Copyright 2000-2001 International Business Machines, All Rights Reserved</SPAN></CENTER>
</TD>
</TR>
</TABLE>
<!--
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR>
<TD WIDTH="200" BGCOLOR="#CCCCFF">&nbsp;</TD>
<TD>
<DIV ALIGN="CENTER"><IMG SRC="../images/TitleLogo_transparent.gif" WIDTH="175" HEIGHT="50"></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD WIDTH="200" BGCOLOR="#CCCCFF">
<P><A HREF="index.html">RBManager</A></P>
<P><A HREF="RBReporter.html">RBReporter</A></P>
<P><A HREF="../Tutorial/step1.html">System Requirements</A></P>
<P><A HREF="faq.html">FAQ</A></P>
<P>Topics</P>
<UL>
<LI><A HREF="../Tutorial/index.html">Step-by-step Tutorial</A></LI>
<LI><A HREF="step1.html">Changing Prefences</A></LI>
<LI><A HREF="future_features.html">Future Release Features</A></LI>
<LI><A HREF="mailto:jjared@almaden.ibm.com">Contact the Author</A></LI>
</UL>
</TD>
<TD></TD>
</TR>
</TABLE>
-->
</BODY>
<!-- #EndTemplate --></HTML>