RbUtils 0.13

org.ktc.rbutils.rb.check
Class MainChecker

java.lang.Object
  extended by org.ktc.rbutils.api.i18n.AbstractLocalized
      extended by org.ktc.rbutils.api.audit.AbstractProcessor
          extended by org.ktc.rbutils.api.audit.AbstractMainProcessor
              extended by org.ktc.rbutils.rb.check.MainChecker
All Implemented Interfaces:
MainProcessor, Processor, Localized

public class MainChecker
extends AbstractMainProcessor

Checks a set of Java RessourceBundle files using a set of Properties files.

Since:
RbUtils 0.1.0
Version:
$Revision: 1.5 $
Author:
redfish

Field Summary
 
Fields inherited from class org.ktc.rbutils.api.audit.AbstractMainProcessor
DEFAULT_PROPERTIES_EXTENSION, DEFAULT_RECURSIVE_CHECK, filesAlreadyAdded, filesList, recursiveCheck, root, srcRBextension
 
Fields inherited from class org.ktc.rbutils.api.audit.AbstractProcessor
loggers
 
Fields inherited from class org.ktc.rbutils.api.i18n.AbstractLocalized
classResource
 
Constructor Summary
MainChecker(File root)
          Constructs a checker with recursive check in directories and default valid extension for properties files.
MainChecker(File root, String srcRBextension)
          Constructs a checker with recursive check in directories.
 
Method Summary
 void addConsoleLogger()
          Adds a ConsoleLogger to this MainProcesor.
protected  void finalizeCheckerInitialization()
          Finalizes initialization as AbstractMainProcessor.finalizeInitialization() does and also validates the provided filechecker (class loading and extends the default class).
 int process()
          Launches the check of the properties source files against the runtime files (properties or class files).
 void setFileCheckerClassname(String fileCheckerClassname)
          Sets the name of the class to be used as FileChecker.
protected  void validateFileChecker()
          Validates the FileChecker.
 
Methods inherited from class org.ktc.rbutils.api.audit.AbstractMainProcessor
addFiles, finalizeInitialization, fireException, fireProcessEnded, fireProcessStarted, getErrorsCount, getExtension, getProcessedFilesCount, setExtension, setFilesAlreadyAdded, setMessagesLocale
 
Methods inherited from class org.ktc.rbutils.api.audit.AbstractProcessor
addLogger, addLoggers
 
Methods inherited from class org.ktc.rbutils.api.i18n.AbstractLocalized
getMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ktc.rbutils.api.audit.Processor
addLogger, addLoggers
 

Constructor Detail

MainChecker

public MainChecker(File root)
            throws FileNotFoundException
Constructs a checker with recursive check in directories and default valid extension for properties files.

Parameters:
root - the root directory for the RB check.
Throws:
NullArgumentException - if root is null.
FileNotFoundException - if root does not exist.
NotDirectoryException - if root is not a directory.

MainChecker

public MainChecker(File root,
                   String srcRBextension)
            throws FileNotFoundException
Constructs a checker with recursive check in directories.

Parameters:
root - the root directory for the RB check.
srcRBextension - valid extension for properties files.
Throws:
NullArgumentException - if root is null.
FileNotFoundException - if root does not exist.
NotDirectoryException - if root is not a directory.
Method Detail

process

public int process()
            throws ClassNotFoundException
Launches the check of the properties source files against the runtime files (properties or class files).

Returns:
the number of errors that occur during the audit.
Throws:
ClassNotFoundException - if the provided class can not be load.
ClassCastException - if the provided class does not extend the default one.

finalizeCheckerInitialization

protected void finalizeCheckerInitialization()
                                      throws ClassNotFoundException
Finalizes initialization as AbstractMainProcessor.finalizeInitialization() does and also validates the provided filechecker (class loading and extends the default class).

Throws:
ClassNotFoundException - if the provided file checker class can not be load.
ClassCastException - if the provided file checker class does not extend the default one.

validateFileChecker

protected void validateFileChecker()
                            throws ClassNotFoundException
Validates the FileChecker.

If not set, uses the default one. Then, try to get an instance of the Class specified by this class name. Finally, tests if this class extends this of the default file checker.

Throws:
ClassNotFoundException - if the provided class can not be load.
ClassCastException - if the provided class does not extend the default one.

addConsoleLogger

public void addConsoleLogger()
Adds a ConsoleLogger to this MainProcesor. Usually, this method will be called if there are no registered loggers.


setFileCheckerClassname

public void setFileCheckerClassname(String fileCheckerClassname)
Sets the name of the class to be used as FileChecker. In order to work, it must extend the default FileChecker class. If sets to null, the default FileChecker will be used.

Parameters:
fileCheckerClassname - the name of the class to be used as FileChecker.

Back to the RbUtils Home Page

Copyright © 2005-2009 RbUtils Project. All Rights Reserved.