Examples of MessageSearchException


Examples of com.stimulus.archiva.exception.MessageSearchException

            return null;
          }
      }
     public void deleteMessage(EmailID emailID) throws MessageSearchException {
        if (emailID == null)
                throw new MessageSearchException("assertion failure: null emailID",logger);
      logger.debug("delete message {'"+emailID+"'}");
      Volume volume = emailID.getVolume();
      File indexDir = new File(volume.getIndexPath());
      if (!indexDir.exists())
        throw new MessageSearchException("could not delete email from index. volume does not exist. {'"+emailID+"}",logger);
      synchronized(indexLock) {
        IndexReader indexReader = null;
        try {
          indexReader = IndexReader.open(indexDir);
        } catch (IOException e ) {
          throw new MessageSearchException("failed to open index to delete email",e,logger);
        }
        try {
          indexReader.deleteDocuments(new Term("uid",emailID.getUniqueID()));
          indexReader.close();
        } catch (Exception e) {
          throw new MessageSearchException("failed to delete email from index.",e,logger);
        }
      }
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

            if (logger.isDebugEnabled() && indexLogOut!=null) {
              writer.setInfoStream(indexLogOut);
            }
        } catch (IOException io) {
          lastError = io;
          throw new MessageSearchException("failed to open index writer. you must delete the file write.lock in the index directory. {location='"+volume.getIndexPath()+"'}",lastError,logger);
         
        }
       }
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

   
    public void indexMessage(Email message) throws MessageSearchException  {
     
      long s = (new Date()).getTime();
      if (message == null)
          throw new MessageSearchException("assertion failure: null message",logger);
      logger.debug("indexing message {"+message+"}");
     
      Document doc = new Document();
      try {
      
         DocumentIndex docIndex = new DocumentIndex(indexer);
         docIndex.write(message,doc)
         String language = doc.get("lang");
         if (language==null)
           language = indexer.getIndexLanguage();
           synchronized (indexLock) {
             openIndex();
             writer.addDocument(doc,AnalyzerFactory.getAnalyzer(language,AnalyzerFactory.Operation.INDEX));
           }
           doc = null;
         logger.debug("message indexed successfully {"+message+",language='"+language+"'}");
      } catch (MessagingException me)
      {
         throw new MessageSearchException("failed to decode message during indexing",me,logger, Level.DEBUG);
      } catch (IOException me) {
          throw new MessageSearchException("failed to index message {"+message+"}",me,logger, Level.DEBUG);
      } catch (ExtractionException ee)
      {
        // we will want to continue indexing
         //throw new MessageSearchException("failed to decode attachments in message {"+message+"}",ee,logger, Level.DEBUG);
      } catch (AlreadyClosedException ace) {
        indexMessage(message);
      } catch (Exception e) {
          throw new MessageSearchException("failed to index message",e,logger, Level.DEBUG);
      }
      logger.debug("indexing message end {"+message+"}");
     
      long e = (new Date()).getTime();
        logger.debug("indexing time {time='"+(e-s)+"'}");
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

           
          try {
            query = queryParser.parse(searchQuery);
            logger.debug("successfully parsed search query {query='"+searchQuery+"'}");
          } catch (Exception e) {
            throw new MessageSearchException("failed to parse search query {query='"+searchQuery+"'}",e,logger,Level.DEBUG);
          }
        } else {
          query = new MatchAllDocsQuery();
        }
        return query;
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

          Query query = filterQueryParser.parse(filterstr);
          queryFilter = new QueryWrapperFilter(query);
          logger.debug("successfully parsed filter query {query='"+filterstr+"'}");
      } catch (Exception pe)
      {
        throw new MessageSearchException("failed to parse search query {searchquery='"+getSearchQuery()+"'}",pe,logger,Level.DEBUG);
      }
      return queryFilter;
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

      Searcher searcher;
       try {
           searcher = new ParallelMultiSearcher(allsearchers);
      } catch (IOException io) {
          throw new MessageSearchException("failed to open/create one or more index searchers",logger);
      }
      return searcher;
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

          results.add(new LuceneResult(hits,i));
         }
     
         logger.info("search executed successfully {query='"+getSearchQuery()+"',returnedresults='"+results.size()+"'}");
      } catch (IOException io) {
      throw new MessageSearchException("failed to execute search query {searchquery='"+getSearchQuery()+"}",io,logger,Level.DEBUG);
      }
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

       
     
     
      public long getTotalMessageCount(Volume volume) throws MessageSearchException {
        if (volume == null)
                throw new MessageSearchException("assertion failure: null volume",logger);
        logger.debug("get total no emails {indexpath='"+volume.getIndexPath()+"'}");
          int count = 0;
        File indexDir = new File(volume.getIndexPath());
          if (!indexDir.exists())
              return 0;
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

           
          }
          protected Document getDocument() throws MessageSearchException {
            try {
              if (position >= hits.length())
                throw new MessageSearchException("failed to retrieve document from hits. position > length",logger,Level.DEBUG);
             
              if (doc==null)
                doc = hits.doc(position);
              return doc;
            } catch (Exception e) {
              throw new MessageSearchException("failed to retrieve document from hits:"+e.getMessage(),e,logger,Level.DEBUG);
             
            }
          }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageSearchException

   
    }

    public void searchMessage(Search search) throws MessageSearchException {
      if (search==null)
             throw new MessageSearchException("assertion failure: null search",logger);
        if (((MailArchivaPrincipal)search.getPrincipal()).getRole()==null || ((MailArchivaPrincipal)search.getPrincipal()).getName()==null)
            throw new MessageSearchException("assertion failure: null userRole or userName",logger);
        String queryStr = search.getSearchQuery();
        logger.debug("search {searchquery='"+queryStr+"'}");
        search.searchMessage();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.