Package org.hibernate.search

Examples of org.hibernate.search.SearchException


    log.debug( "Index directory: {}", indexDir.getPath() );
    try {
      indexName = indexDir.getCanonicalPath();
    }
    catch ( IOException e ) {
      throw new SearchException( "Unable to initialize index: " + directoryProviderName, e );
    }
    copyChunkSize = DirectoryProviderHelper.getCopyBufferSize( directoryProviderName, properties );
    current = 0; //publish all state to other threads
  }
View Full Code Here


      if (retry < 0) {
        throw new NumberFormatException( );
      }
    }
    catch ( NumberFormatException e ) {
      throw new SearchException("retry_marker_lookup options must be a positive number: "
          + properties.getProperty( Environment.RETRY_MARKER_LOOKUP ) );
    }
    boolean currentMarkerInSource = false;
    for ( int tried = 0 ; tried <= retry ; tried++ ) {
      //we try right away the first time
View Full Code Here

        }
        else if ( new File( sourceIndexDir, "current2" ).exists() ) {
          sourceCurrent = 2;
        }
        else {
          throw new SearchException( "No current file marker found in source directory: " + sourceIndexDir.getPath() );
        }
        try {
          FileHelper.synchronize(
              new File( sourceIndexDir, String.valueOf( sourceCurrent ) ),
              destinationFile, true, copyChunkSize
          );
        }
        catch ( IOException e ) {
          throw new SearchException( "Unable to synchronize directory: " + indexName, e );
        }
        if ( !currentMarker.createNewFile() ) {
          throw new SearchException( "Unable to create the directory marker file: " + indexName );
        }
      }
      log.debug( "Current directory: {}", currentToBe );
    }
    catch ( IOException e ) {
      throw new SearchException( "Unable to initialize index: " + directoryProviderName, e );
    }
    task = new TriggerTask( sourceIndexDir, indexDir );
    long period = DirectoryProviderHelper.getRefreshPeriod( properties, directoryProviderName );
    timer.scheduleAtFixedRate( task, period, period );
    this.current = currentToBe;
View Full Code Here

  private void addAnalyzerDef(AnalyzerDef analyzerDef, String annotationDefinitionPoint) {
    String analyzerDefinitionName = analyzerDef.name();

    if ( analyzerDefinitionPoints.containsKey( analyzerDefinitionName ) ) {
      if ( !analyzerDefinitionPoints.get( analyzerDefinitionName ).equals( annotationDefinitionPoint ) ) {
        throw new SearchException( "Multiple analyzer definitions with the same name: " + analyzerDef.name() );
      }
    }
    else {
      analyzerDefs.put( analyzerDefinitionName, analyzerDef );
      analyzerDefinitionPoints.put( analyzerDefinitionName, annotationDefinitionPoint );
View Full Code Here

          final Analyzer analyzer = buildAnalyzer( analyzerDefs.get( name ) );
          namedAnalyzer.setDelegate( analyzer );
          initializedAnalyzers.put( name, analyzer );
        }
        else {
          throw new SearchException( "Analyzer found with an unknown definition: " + name );
        }
      }
    }

    //initialize the remaining definitions
View Full Code Here

    return Collections.unmodifiableMap( initializedAnalyzers );
  }

  private Analyzer buildAnalyzer(AnalyzerDef analyzerDef) {
    if ( !solrPresent ) {
      throw new SearchException(
          "Use of @AnalyzerDef while Solr is not present in the classpath. Add apache-solr-analyzer.jar"
      );
    }

    // SolrAnalyzerBuilder references Solr classes.
View Full Code Here

  private static Object instantiate(Class clazz) {
    try {
      return clazz.newInstance();
    }
    catch ( IllegalAccessException e ) {
      throw new SearchException( "Unable to instantiate class: " + clazz, e );
    }
    catch ( InstantiationException e ) {
      throw new SearchException( "Unable to instantiate class: " + clazz, e );
    }
  }
View Full Code Here

      criteria.add( Restrictions.eq( entityInfo.idName, entityInfo.id ) );
      try {
        maybeProxy = criteria.uniqueResult();
      }
      catch ( HibernateException e ) {
        throw new SearchException(
            "Loading entity of type " + entityInfo.clazz.getName() + " using '"
                + entityInfo.idName
                + "' as document id and '"
                + entityInfo.id
                + "'  as value was not unique"
View Full Code Here

    final Class<?> clazz;
    try {
      clazz = ReflectHelper.classForName( cname );
    }
    catch ( ClassNotFoundException e ) {
      throw new SearchException("Unable to find class " + cname, e);
    }
    try {
      final Object instance = clazz.newInstance();
      if (instance instanceof ResourceLoaderAware) {
        ( ( ResourceLoaderAware) instance ).inform( this );
      }
      return instance;
    }
    catch ( InstantiationException e ) {
      throw new SearchException("Unable to instanciate class with no-arg constructor: " + cname, e);
    }
    catch ( IllegalAccessException e ) {
      throw new SearchException("Unable to instanciate class with no-arg constructor: " + cname, e);
    }
  }
View Full Code Here

    AbstractDocumentBuilder<T> entityBuilder = searchFactoryImplementor.getDocumentBuilderIndexedEntity( entityClass );
    if ( entityBuilder == null ) {
      entityBuilder = searchFactoryImplementor.getDocumentBuilderContainedEntity( entityClass );
      if ( entityBuilder == null ) {
        // should never happen but better be safe than sorry
        throw new SearchException( "Unable to perform work. Entity Class is not @Indexed nor hosts @ContainedIn: " + entityClass );
      }
    }
    return entityBuilder;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.SearchException

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.