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 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;
}