unico       2004/07/11 04:19:38

  Modified:    src/stores/org/apache/slide/index TextContentIndexer.java
  Log:
  - use getLogger() instead of Domain.log
  - javadoc indexpath parameter
  
  Revision  Changes    Path
  1.3       +50 -48    
jakarta-slide/src/stores/org/apache/slide/index/TextContentIndexer.java
  
  Index: TextContentIndexer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/org/apache/slide/index/TextContentIndexer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TextContentIndexer.java   1 Jul 2004 13:01:00 -0000       1.2
  +++ TextContentIndexer.java   11 Jul 2004 11:19:38 -0000      1.3
  @@ -53,6 +53,7 @@
    * Time: 10:34:45 PM
    */
   public class TextContentIndexer extends XAServiceBase implements IndexStore {
  +
       private static final String INDEX_PATH = "indexpath";
   
       public static final String URI_FIELD = "uri";
  @@ -87,7 +88,7 @@
            }
            catch (IOException ex)
            {
  -            Domain.log("Error while initializing the Lucene index " + 
e.getMessage(), LOG_CHANNEL, Logger.ERROR);
  +            getLogger().log("Error while initializing the Lucene index " + 
e.getMessage(), LOG_CHANNEL, Logger.ERROR);
                  throw new ServiceInitializationFailedException(this, ex);
               }
           }
  @@ -98,11 +99,11 @@
         }
         catch (IOException e)
         {
  -         Domain.log("Error while initializing the Lucene index " + e.getMessage(), 
LOG_CHANNEL, Logger.ERROR);
  +          getLogger().log("Error while initializing the Lucene index " + 
e.getMessage(), LOG_CHANNEL, Logger.ERROR);
               throw new ServiceInitializationFailedException (this, e);
   
         }
  -      Domain.log("Lucene is correctly initialized", LOG_CHANNEL, Logger.INFO);
  +      getLogger().log("Lucene is correctly initialized", LOG_CHANNEL, Logger.INFO);
       }
   
       /**
  @@ -139,21 +140,21 @@
               indexWriter.addDocument(doc);
               indexWriter.optimize();
   
  -            Domain.log(
  +            getLogger().log(
                    "Added '" + uri.toString() + " - " + 
revisionDescriptor.getRevisionNumber().toString() + "' to index",
                    LOG_CHANNEL,
                    Logger.INFO);
          }
         catch (IOException e)
         {
  -         Domain.log(
  +         getLogger().log(
                   "Error creating an index with " + uri.toString() + " - " + 
revisionDescriptor.getRevisionNumber(),
                   LOG_CHANNEL,
                   Logger.ERROR);
         }
         catch( ExtractorException e)
         {
  -         Domain.log(
  +         getLogger().log(
               "Error extracting content from " + uri.toString() + " - " + 
revisionDescriptor.getRevisionNumber(),
               LOG_CHANNEL,
               Logger.ERROR);
  @@ -180,8 +181,8 @@
        *
        */
       synchronized public void updateIndex(Uri uri,
  -                                                  NodeRevisionDescriptor 
revisionDescriptor,
  -                                                  NodeRevisionContent 
revisionContent)
  +                                         NodeRevisionDescriptor revisionDescriptor,
  +                                         NodeRevisionContent revisionContent)
         throws IndexException
       {
           IndexWriter indexWriter = null;
  @@ -213,23 +214,25 @@
   
               indexWriter.addDocument(doc);
               indexWriter.optimize();
  -
  -            Domain.log(
  -            "Updated '" + uri.toString() + " - " + 
revisionDescriptor.getRevisionNumber().toString() + "' to index",
  -            LOG_CHANNEL,
  -            Logger.INFO);
  +            
  +            if (getLogger().isEnabled(Logger.DEBUG)) {
  +                getLogger().log(
  +                     "Updated '" + uri + " - " + 
revisionDescriptor.getRevisionNumber() + "' to index",
  +                     LOG_CHANNEL,
  +                     Logger.DEBUG);
  +            }
           }
           catch (IOException e)
           {
  -            Domain.log(
  -                 "Error updating the index with " + uri.toString() + " - " + 
revisionDescriptor.getRevisionNumber(),
  +            getLogger().log(
  +                 "Error updating the index with " + uri + " - " + 
revisionDescriptor.getRevisionNumber(),
                    LOG_CHANNEL,
                    Logger.ERROR);
           }
           catch( ExtractorException e)
           {
  -            Domain.log(
  -                 "Error extracting content from " + uri.toString() + " - " + 
revisionDescriptor.getRevisionNumber(),
  +            getLogger().log(
  +                 "Error extracting content from " + uri + " - " + 
revisionDescriptor.getRevisionNumber(),
                    LOG_CHANNEL,
                    Logger.ERROR);
           }
  @@ -265,14 +268,16 @@
               indexWriter = new IndexWriter(indexpath, new StandardAnalyzer(), false);
               indexWriter.optimize();
   
  -            Domain.log(
  -                 "Deleted '" + uri.toString() + "' from the index",
  -                 LOG_CHANNEL,
  -                 Logger.INFO);
  +            if (getLogger().isEnabled(Logger.DEBUG)) {
  +                getLogger().log(
  +                     "Deleted '" + uri + "' from the index",
  +                     LOG_CHANNEL,
  +                     Logger.DEBUG);
  +            }
           }
           catch (IOException e)
           {
  -            Domain.log("Impossible to delete " + uri.toString() + " - " + 
number.toString() + " from the Lucene index");
  +            getLogger().log("Impossible to delete " + uri + " - " + number + " from 
the Lucene index");
           }
           finally
          {
  @@ -305,10 +310,10 @@
       */
       public void connect() throws ServiceConnectionFailedException
       {
  -      Domain.log(
  -            "TextContentIndexer:  connect",
  -            LOG_CHANNEL,
  -            Logger.INFO);
  +        getLogger().log(
  +             "TextContentIndexer:  connect",
  +             LOG_CHANNEL,
  +             Logger.INFO);
           started = true;
       }
   
  @@ -324,13 +329,9 @@
      }
   
       /**
  -     * Initializes the service with a set of parameters. Those could be :
  -     * <li>User name, login info
  -     * <li>Host name on which to connect
  -     * <li>Remote port
  -     * <li>JDBC driver whoich is to be used :-)
  -     * <li>Anything else ...
  -     *
  +     * Parametrize the service. This index store expects one parameter
  +     * "indexpath" to contain the path to the directory to store the index.
  +     * 
        * @param parameters Hashtable containing the parameters' names
        * and associated values
        * @exception ServiceParameterErrorException Incorrect service parameter
  @@ -348,12 +349,12 @@
        *
        * @exception ServiceDisconnectionFailedException Disconnection failed
        */
  -   public void disconnect() throws ServiceDisconnectionFailedException
  -   {
  -      Domain.log(
  -            "TextContentIndexer:  disconnect",
  -            LOG_CHANNEL,
  -            Logger.INFO);
  +    public void disconnect() throws ServiceDisconnectionFailedException
  +    {
  +        getLogger().log(
  +             "TextContentIndexer:  disconnect",
  +             LOG_CHANNEL,
  +             Logger.INFO);
           started = false;
       }
   
  @@ -362,11 +363,12 @@
        *
        * @exception ServiceResetFailedException Reset failed
        */
  -   public void reset() throws ServiceResetFailedException
  -   {
  -      Domain.log(
  -            "TextContentIndexer:  reset",
  -            LOG_CHANNEL,
  -            Logger.INFO);
  +    public void reset() throws ServiceResetFailedException
  +    {
  +        getLogger().log(
  +             "TextContentIndexer:  reset",
  +             LOG_CHANNEL,
  +             Logger.INFO);
      }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to