001    package hirondelle.web4jtools.logview.parser;
002    
003    import hirondelle.web4jtools.logview.simpleview.LogFor;
004    
005    /**
006    * Returns a {@link LogParser} either for an application log file, or a server log file.
007    * 
008    * <P>If you need to create an alternate version of {@link LogParser}, then you 
009    * should 
010    *<ul>
011    * <li>place it in this package, and make it package-private
012    * <li>alter the implementation of this class, to return it as required.
013    *</ul>
014    */
015    public final class LogParserInstance {
016      
017      public static LogParser getFor(LogFor aLogFor){
018        /*
019        * This implementation is redundant, but allows for future changes, if needed.
020        * 
021        * It allows for various parser implementations, should they be 
022        * required. It also allows the server logs to be in a different format from the 
023        * application logs.
024        */
025        LogParser result = null;
026        if( LogFor.Application == aLogFor ) {
027          result = new LogParserForJDKDefault();
028        }
029        else if ( LogFor.Server == aLogFor ) {
030          result = new LogParserForJDKDefault();
031        }
032        return result;
033      }
034      
035      private LogParserInstance(){} //hide from caller
036    }