public static DirectoryBasedReaderProvider createDirectoryBasedReaderProvider(DirectoryBasedIndexManager indexManager,
Properties properties,
WorkerBuildContext buildContext) {
Properties maskedProperties = new MaskedProperty( properties, Environment.READER_PREFIX );
String readerProviderImplName = maskedProperties.getProperty( "strategy" );
DirectoryBasedReaderProvider readerProvider;
if ( StringHelper.isEmpty( readerProviderImplName ) ) {
readerProvider = new SharingBufferReaderProvider();
}
else if ( "not-shared".equalsIgnoreCase( readerProviderImplName ) ) {
readerProvider = new NotSharedReaderProvider();
}
else if ( "shared".equalsIgnoreCase( readerProviderImplName ) ) {
readerProvider = new SharingBufferReaderProvider();
}
else {
ServiceManager serviceManager = buildContext.getServiceManager();
readerProvider = ClassLoaderHelper.instanceFromName(
DirectoryBasedReaderProvider.class,
readerProviderImplName,
"readerProvider",
serviceManager
);
}
readerProvider.initialize( indexManager, maskedProperties );
return readerProvider;
}