Package net.sf.regain

Examples of net.sf.regain.RegainException


  public static IndexConfig[] getAllIndexConfigArr(PageRequest request) throws RegainException {
    loadConfiguration(request);
    String[] indexNameArr;
    indexNameArr = mConfig.getAllIndexNameArr();
    if (indexNameArr == null) {
      throw new RegainException("There are no Indizes defined in the search configuration  "
          + "no index configured");
    }

    // Get the configurations for these indexes
    IndexConfig[] configArr = new IndexConfig[indexNameArr.length];
    for (int i = 0; i < indexNameArr.length; i++) {
      configArr[i] = mConfig.getIndexConfig(indexNameArr[i]);
      if (configArr[i] == null) {
        throw new RegainException("The configuration does not contain the index '" + indexNameArr[i] + "'");
      }
    }
    return configArr;
  }
View Full Code Here


        String queryString = "\"" + transformedFileUrl + "\"";
       
        try {
          query = parser.parse(queryString);
        } catch (ParseException ex) {
          throw new RegainException("Parsing of url lookup-query failed.", ex);
        }
       
        ScoreDoc[] hits = manager.search(query);
        // Allow the access if we found the file in the index
        if (hits.length > 0) {
View Full Code Here

        out = response.getOutputStream();
        in = new FileInputStream(file);
        RegainToolkit.pipe(in, out);
      }
      catch (IOException exc) {
        throw new RegainException("Sending file failed: " + file.getAbsolutePath(), exc);
      }
      finally {
        if (in != null) {
          try { in.close(); } catch (IOException exc) {}
        }
View Full Code Here

      try {
        response.print(dateFormatter.format((Date) formatter.parse(value)));

      } catch (ParseException ex) {
        throw new RegainException("Couldn't parse last-modified date.", ex);
      }
    }
  }
View Full Code Here

        imapStore.close();      
       
      }

    } catch (Throwable thr) {
      throw new RegainException( thr.getMessage(), thr );
   
    CRC32 crc = new CRC32();
    crc.update(bytearrayMessage);
   
    mLog.debug("loadIMAPMessage crc: " + crc.getValue() + " for IMAP url: " + url);
View Full Code Here

        mLastModifiedDate = new Date(smbFile.lastModified());
       
        return CrawlerToolkit.loadFileFromStream(in,smbFile.getContentLength());
       
      } else {
        throw new RegainException("Can't load content from: "
        + smbFile.getCanonicalPath());
      }
     
    } catch (Throwable thr) {
      throw new RegainException( thr.getMessage(), thr );
     
    } finally {
       if (in != null) {
        try { in.close(); } catch (IOException exc) {}
      }
View Full Code Here

      // Check whether download failed
      if (loaderThread.getError() != null) {
        if (loaderThread.getError() instanceof RedirectException) {
          throw (RedirectException) loaderThread.getError();
        } else {
          throw new RegainException("Loading Document by HTTP failed: " + url,
                                    loaderThread.getError());
        }
      }

      // Wir haben weder einen Inhalt noch einen Fehler
      // -> Der Download läuft noch
      // -> Da jedoch mittlerweile der Timeout abgelaufen ist -> Exception werfen
      throw new RegainException("Loading Document by HTTP timed out after " +
          mHttpTimeoutSecs + " seconds: " + url);
    }
  }
View Full Code Here

        FILE_LOADING_PROFILER.stopMeasuring(content.length);
        return content;
      }
      catch (RegainException exc) {
        FILE_LOADING_PROFILER.abortMeasuring();
        throw new RegainException("Loading Document for url: " + mUrl + " failed: "
          + mContentAsFile, exc);
      }
    }

    return mContent;
View Full Code Here

      if(mUrl.startsWith("file://")){
        try {
          return new FileInputStream(mContentAsFile);
       
        } catch (Throwable thr) {
          throw new RegainException("Creating stream for file failed: " +
              mContentAsFile, thr);
        }
      } else if(mUrl.startsWith("smb://")) {
        try {
           SmbFile smbFile = RegainToolkit.urlToSmbFile(
             CrawlerToolkit.replaceAuthenticationValuesInURL(mUrl, mAccountPasswordEntry));
           return smbFile.getInputStream();
          
        } catch (Throwable thr) {
          throw new RegainException("Creating stream for file failed: " +
              mContentAsFile, thr);
        }
      } else {
        throw new RegainException("Creating stream for unknown file protocoll failed.");
       
      }
    }
  }
View Full Code Here

      try {
        int size = Integer.parseInt(sizeAsString);

        response.print(RegainToolkit.bytesToString(size, request.getLocale()));
      } catch (NumberFormatException exc) {
        throw new RegainException("Field 'size' is not a number: '"
          + sizeAsString + "'");
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.regain.RegainException

Copyright © 2018 www.massapicom. 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.