Package org.hibernate.search.event

Examples of org.hibernate.search.event.FullTextIndexEventListener


  }

  private FullTextIndexEventListener getLuceneEventListener() {
    PostInsertEventListener[] listeners = ( ( SessionFactoryImpl ) getSessions() ).getEventListeners()
        .getPostInsertEventListeners();
    FullTextIndexEventListener listener = null;
    //FIXME this sucks since we mandante the event listener use
    for ( PostInsertEventListener candidate : listeners ) {
      if ( candidate instanceof FullTextIndexEventListener ) {
        listener = ( FullTextIndexEventListener ) candidate;
        break;
View Full Code Here


    cfg.setListener( "post-delete", "org.hibernate.search.event.FullTextIndexEventListener" );
    cfg.setListener( "post-collection-recreate", "org.hibernate.search.event.FullTextIndexEventListener" );
    cfg.setListener( "post-collection-remove", "org.hibernate.search.event.FullTextIndexEventListener" );
    cfg.setListener( "post-collection-update", "org.hibernate.search.event.FullTextIndexEventListener" );
   
    cfg.setListeners( "flush", new FlushEventListener[]{new DefaultFlushEventListener(), new FullTextIndexEventListener()} );

    cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
    cfg.setProperty( org.hibernate.search.Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
  }
View Full Code Here

    return getLuceneEventListener().getSearchFactoryImplementor().getDirectoryProviders( clazz )[0].getDirectory();
  }

  private FullTextIndexEventListener getLuceneEventListener() {
        PostInsertEventListener[] listeners = ( (SessionFactoryImpl) getSessions() ).getEventListeners().getPostInsertEventListeners();
        FullTextIndexEventListener listener = null;
        //FIXME this sucks since we mandante the event listener use
        for (PostInsertEventListener candidate : listeners) {
            if (candidate instanceof FullTextIndexEventListener ) {
                listener = (FullTextIndexEventListener) candidate;
                break;
View Full Code Here

    super.configure( cfg );
    File sub = getBaseIndexDir();
    cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
    cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
    cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
    FullTextIndexEventListener del = new FullTextIndexEventListener();
    cfg.getEventListeners().setPostDeleteEventListeners( new PostDeleteEventListener[] { del } );
    cfg.getEventListeners().setPostUpdateEventListeners( new PostUpdateEventListener[] { del } );
    cfg.getEventListeners().setPostInsertEventListeners( new PostInsertEventListener[] { del } );
  }
View Full Code Here

    super.configure( cfg );
    File sub = getBaseIndexDir();
    cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
    cfg.setProperty( "hibernate.search.Clock.directory_provider", FSDirectoryProvider.class.getName() );
    cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
    FullTextIndexEventListener del = new FullTextIndexEventListener();
    cfg.getEventListeners().setPostDeleteEventListeners( new PostDeleteEventListener[]{del} );
    cfg.getEventListeners().setPostUpdateEventListeners( new PostUpdateEventListener[]{del} );
    cfg.getEventListeners().setPostInsertEventListeners( new PostInsertEventListener[]{del} );
  }
View Full Code Here

    super.configure( cfg );
    File sub = getBaseIndexDir();
    cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
    cfg.setProperty( "hibernate.search.Clock.directory_provider", FSDirectoryProvider.class.getName() );
    cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
    FullTextIndexEventListener del = new FullTextIndexEventListener();
    cfg.getEventListeners().setPostDeleteEventListeners( new PostDeleteEventListener[]{del} );
    cfg.getEventListeners().setPostUpdateEventListeners( new PostUpdateEventListener[]{del} );
    cfg.getEventListeners().setPostInsertEventListeners( new PostInsertEventListener[]{del} );
  }
View Full Code Here

    EventListenerRegister.enableHibernateSearch( evListeners, new Properties() );
    assertPresence( true, evListeners );
  }
 
  public void testOnAlreadyRegistered() {
    helperOnAlreadyRegistered( new FullTextIndexEventListener() );
  }
View Full Code Here

    cfg.setListener( "post-delete", "org.hibernate.search.event.FullTextIndexEventListener" );
    cfg.setListener( "post-collection-recreate", "org.hibernate.search.event.FullTextIndexEventListener" );
    cfg.setListener( "post-collection-remove", "org.hibernate.search.event.FullTextIndexEventListener" );
    cfg.setListener( "post-collection-update", "org.hibernate.search.event.FullTextIndexEventListener" );
   
    cfg.setListeners( "flush", new FlushEventListener[]{new DefaultFlushEventListener(), new FullTextIndexEventListener()} );

    cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
    cfg.setProperty( org.hibernate.search.Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
  }
View Full Code Here

  }

  private FullTextIndexEventListener getLuceneEventListener() {
    PostInsertEventListener[] listeners = ( ( SessionFactoryImpl ) getSessions() ).getEventListeners()
        .getPostInsertEventListeners();
    FullTextIndexEventListener listener = null;
    //FIXME this sucks since we mandante the event listener use
    for ( PostInsertEventListener candidate : listeners ) {
      if ( candidate instanceof FullTextIndexEventListener ) {
        listener = ( FullTextIndexEventListener ) candidate;
        break;
View Full Code Here

  }

 
  public static SearchFactoryImplementor getSearchFactoryBySFI(SessionImplementor session) {
    PostInsertEventListener[] listeners = session.getListeners().getPostInsertEventListeners();
    FullTextIndexEventListener listener = null;
    //FIXME this sucks since we mandante the event listener use
    for ( PostInsertEventListener candidate : listeners ) {
      if ( candidate instanceof FullTextIndexEventListener ) {
        listener = (FullTextIndexEventListener) candidate;
        break;
      }
    }
    if ( listener == null ) throw new HibernateException(
        "Hibernate Search Event listeners not configured, please check the reference documentation and the " +
            "application's hibernate.cfg.xml" );
    return listener.getSearchFactoryImplementor();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.event.FullTextIndexEventListener

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.