Package org.hibernate.search.backend.spi

Examples of org.hibernate.search.backend.spi.BackendQueueProcessor


  }

  public static BackendQueueProcessor createBackend(String backend, DirectoryBasedIndexManager indexManager, WorkerBuildContext context,
      Properties properties) {

    final BackendQueueProcessor backendQueueProcessor;

    if ( StringHelper.isEmpty( backend ) || "lucene".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new LuceneBackendQueueProcessor();
    }
    else if ( "jms".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new JndiJMSBackendQueueProcessor();
    }
    else if ( "blackhole".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new BlackHoleBackendQueueProcessor();
    }
    else if ( "jgroupsMaster".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new MasterNodeSelector() );
    }
    else if ( "jgroupsSlave".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new SlaveNodeSelector() );
    }
    else if ( "jgroups".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new AutoNodeSelector( indexManager.getIndexName() ) );
    }
    else {
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          backend, BackendFactory.class, "processor"
      );
    }
    backendQueueProcessor.initialize( properties, context, indexManager );
    return backendQueueProcessor;
  }
View Full Code Here


 
  public static BackendQueueProcessor createBackend(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties properties) {

    String backend = properties.getProperty( Environment.WORKER_BACKEND );
   
    final BackendQueueProcessor backendQueueProcessor;
   
    if ( StringHelper.isEmpty( backend ) || "lucene".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new LuceneBackendQueueProcessor();
    }
    else if ( "jms".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new JMSBackendQueueProcessor();
    }
    else if ( "blackhole".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new BlackHoleBackendQueueProcessor();
    }
    else if ( "jgroupsMaster".equals( backend ) ) {
        backendQueueProcessor = new MasterJGroupsBackendQueueProcessor();
    }
    else if ( "jgroupsSlave".equals( backend ) ) {
        backendQueueProcessor = new SlaveJGroupsBackendQueueProcessor();
    }
    else {
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          backend, BackendFactory.class, "processor"
      );
    }
    backendQueueProcessor.initialize( properties, context, indexManager );
    return backendQueueProcessor;
  }
View Full Code Here

   
    Directory directory = directoryDAO.findByKey(workListEntity.getKey().getParent());
   
    IndexManager indexManager = getIndexManager(searchFactory, directory.getName());
    LuceneWorkSerializer serializer = indexManager.getSerializer();
    BackendQueueProcessor queueProcessor = createInstanceBackendQueueProcessor(searchFactory, indexManager);
   
    List<LuceneWork> luceneWorks = serializer.toLuceneWorks(workListEntity.getData());
   
    queueProcessor.applyWork(luceneWorks, null);
   
    workListDAO.delete(workListEntity);   
  }
View Full Code Here

  public static BackendQueueProcessor createBackend(String backend,
      DirectoryBasedIndexManager indexManager,
      WorkerBuildContext buildContext,
      Properties properties) {
    final BackendQueueProcessor backendQueueProcessor;

    if ( StringHelper.isEmpty( backend ) || "lucene".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new LuceneBackendQueueProcessor();
    }
    else if ( "jms".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          JMS_BACKEND_QUEUE_PROCESSOR,
          "JMS backend ",
          buildContext.getServiceManager()
      );
    }
    else if ( "blackhole".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new BlackHoleBackendQueueProcessor();
    }
    else if ( "jgroupsMaster".equals( backend ) ) {
      backendQueueProcessor = createJGroupsQueueProcessor( JGROUPS_MASTER_SELECTOR, buildContext );
    }
    else if ( "jgroupsSlave".equals( backend ) ) {
      backendQueueProcessor = createJGroupsQueueProcessor( JGROUPS_SLAVE_SELECTOR, buildContext );
    }
    else if ( "jgroups".equals( backend ) ) {
      Class<?> selectorClass = ClassLoaderHelper.classForName(
          JGROUPS_AUTO_SELECTOR,
          "JGroups node selector ",
          buildContext.getServiceManager()
      );

      final Constructor constructor;
      final Object autoNodeSelector;
      try {
        constructor = selectorClass.getConstructor( String.class );
        autoNodeSelector = constructor.newInstance( indexManager.getIndexName() );
      }
      catch (Exception e) {
        throw log.getUnableToCreateJGroupsBackendException( e );
      }
      backendQueueProcessor = createJGroupsQueueProcessor( autoNodeSelector, buildContext.getServiceManager() );
    }
    else {
      ServiceManager serviceManager = buildContext.getServiceManager();
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          backend,
          "processor",
          serviceManager
      );
    }
    backendQueueProcessor.initialize( properties, buildContext, indexManager );
    return backendQueueProcessor;
  }
View Full Code Here

        ), serviceManager
    );
  }

  private static BackendQueueProcessor createJGroupsQueueProcessor(Object selectorInstance, ServiceManager serviceManager) {
    BackendQueueProcessor backendQueueProcessor;
    Class<?> processorClass = ClassLoaderHelper.classForName(
        JGROUPS_BACKEND_QUEUE_PROCESSOR,
        "JGroups backend ",
        serviceManager
    );
View Full Code Here

   private static final Log log = LogFactory.getLog(InfinispanIndexManager.class, Log.class);

   private InfinispanCommandsBackend remoteMaster;

   protected BackendQueueProcessor createBackend(String indexName, Properties cfg, WorkerBuildContext buildContext) {
      BackendQueueProcessor localMaster = BackendFactory.createBackend(this, buildContext, cfg);
      remoteMaster = new InfinispanCommandsBackend();
      remoteMaster.initialize(cfg, buildContext, this);
      //localMaster is already initialized by the BackendFactory
      MasterSwitchDelegatingQueueProcessor joinedMaster = new MasterSwitchDelegatingQueueProcessor(localMaster, remoteMaster);
      return joinedMaster;
View Full Code Here

  public static BackendQueueProcessor createBackend(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties properties) {

    String backend = properties.getProperty( Environment.WORKER_BACKEND );

    final BackendQueueProcessor backendQueueProcessor;

    if ( StringHelper.isEmpty( backend ) || "lucene".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new LuceneBackendQueueProcessor();
    }
    else if ( "jms".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new JMSBackendQueueProcessor();
    }
    else if ( "blackhole".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new BlackHoleBackendQueueProcessor();
    }
    else if ( "jgroupsMaster".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new MasterNodeSelector() );
    }
    else if ( "jgroupsSlave".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new SlaveNodeSelector() );
    }
    //TODO: enable it when considered less experimental:
    //else if ( "jgroups".equals( backend ) ) {
    //  backendQueueProcessor = new JGroupsBackendQueueProcessor(
    //      new AutoNodeSelector( indexManager.getIndexName() ) );
    //}
    else {
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          backend, BackendFactory.class, "processor"
      );
    }
    backendQueueProcessor.initialize( properties, context, indexManager );
    return backendQueueProcessor;
  }
View Full Code Here

  public static BackendQueueProcessor createBackend(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties properties) {

    String backend = properties.getProperty( Environment.WORKER_BACKEND );

    final BackendQueueProcessor backendQueueProcessor;

    if ( StringHelper.isEmpty( backend ) || "lucene".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new LuceneBackendQueueProcessor();
    }
    else if ( "jms".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new JMSBackendQueueProcessor();
    }
    else if ( "blackhole".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new BlackHoleBackendQueueProcessor();
    }
    else if ( "jgroupsMaster".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new MasterNodeSelector() );
    }
    else if ( "jgroupsSlave".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new SlaveNodeSelector() );
    }
    else if ( "jgroups".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new AutoNodeSelector( indexManager.getIndexName() ) );
    }
    else {
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          backend, BackendFactory.class, "processor"
      );
    }
    backendQueueProcessor.initialize( properties, context, indexManager );
    return backendQueueProcessor;
  }
View Full Code Here

  }

  public static BackendQueueProcessor createBackend(String backend, DirectoryBasedIndexManager indexManager, WorkerBuildContext context,
      Properties properties) {

    final BackendQueueProcessor backendQueueProcessor;

    if ( StringHelper.isEmpty( backend ) || "lucene".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new LuceneBackendQueueProcessor();
    }
    else if ( "jms".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new JndiJMSBackendQueueProcessor();
    }
    else if ( "blackhole".equalsIgnoreCase( backend ) ) {
      backendQueueProcessor = new BlackHoleBackendQueueProcessor();
    }
    else if ( "jgroupsMaster".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new MasterNodeSelector() );
    }
    else if ( "jgroupsSlave".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new SlaveNodeSelector() );
    }
    else if ( "jgroups".equals( backend ) ) {
      backendQueueProcessor = new JGroupsBackendQueueProcessor( new AutoNodeSelector( indexManager.getIndexName() ) );
    }
    else {
      backendQueueProcessor = ClassLoaderHelper.instanceFromName(
          BackendQueueProcessor.class,
          backend, BackendFactory.class, "processor"
      );
    }
    backendQueueProcessor.initialize( properties, context, indexManager );
    return backendQueueProcessor;
  }
View Full Code Here

    Assert.assertTrue( npeTriggered );
  }

  @Test
  public void alternativeBackendConfiguration() {
    BackendQueueProcessor backendQueueProcessor = extractBackendQueue( slaveNode, "dvds" );
    JGroupsBackendQueueProcessor jgroupsProcessor = (JGroupsBackendQueueProcessor) backendQueueProcessor;
    BackendQueueProcessor delegatedBackend = jgroupsProcessor.getDelegatedBackend();
    Assert.assertTrue( "dvds backend was configured with a deleage to blackhole but it's not using it", delegatedBackend instanceof BlackHoleBackendQueueProcessor );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.backend.spi.BackendQueueProcessor

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.