gpt4 book ai didi

org.hibernate.search.spi.WorkerBuildContext.getServiceManager()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 11:03:05 26 4
gpt4 key购买 nike

本文整理了Java中org.hibernate.search.spi.WorkerBuildContext.getServiceManager()方法的一些代码示例,展示了WorkerBuildContext.getServiceManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkerBuildContext.getServiceManager()方法的具体详情如下:
包路径:org.hibernate.search.spi.WorkerBuildContext
类名称:WorkerBuildContext
方法名:getServiceManager

WorkerBuildContext.getServiceManager介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-search

private static Worker instantiateExplicitlyConfiguredWorker(WorkerBuildContext buildContext, String workerImplClassName) {
  ServiceManager serviceManager = buildContext.getServiceManager();
  return ClassLoaderHelper.instanceFromName(
      Worker.class,
      workerImplClassName,
      "worker",
      serviceManager
  );
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private static Worker instantiateExplicitlyConfiguredWorker(WorkerBuildContext buildContext, String workerImplClassName) {
  ServiceManager serviceManager = buildContext.getServiceManager();
  return ClassLoaderHelper.instanceFromName(
      Worker.class,
      workerImplClassName,
      "worker",
      serviceManager
  );
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private Similarity getConfiguredPerIndexSimilarity(String directoryProviderName, Properties indexProperties, WorkerBuildContext buildContext) {
  Similarity configLevelSimilarity = null;
  String similarityClassName = indexProperties.getProperty( Environment.SIMILARITY_CLASS_PER_INDEX );
  if ( similarityClassName != null ) {
    ServiceManager serviceManager = buildContext.getServiceManager();
    configLevelSimilarity = ClassLoaderHelper.instanceFromName(
        Similarity.class,
        similarityClassName,
        "Similarity class for index " + directoryProviderName,
        serviceManager
    );
  }
  return configLevelSimilarity;
}

代码示例来源:origin: hibernate/hibernate-search

private Similarity getConfiguredPerIndexSimilarity(String directoryProviderName, Properties indexProperties, WorkerBuildContext buildContext) {
  Similarity configLevelSimilarity = null;
  String similarityClassName = indexProperties.getProperty( Environment.SIMILARITY_CLASS_PER_INDEX );
  if ( similarityClassName != null ) {
    ServiceManager serviceManager = buildContext.getServiceManager();
    configLevelSimilarity = ClassLoaderHelper.instanceFromName(
        Similarity.class,
        similarityClassName,
        "Similarity class for index " + directoryProviderName,
        serviceManager
    );
  }
  return configLevelSimilarity;
}

代码示例来源:origin: hibernate/hibernate-search

private EntityIndexBinder createDynamicShardingEntityIndexBinder(Properties indexProperty[], WorkerBuildContext buildContext) {
  String shardIdentityProviderName = indexProperty[0].getProperty( SHARDING_STRATEGY );
  ServiceManager serviceManager = buildContext.getServiceManager();
  Class<? extends ShardIdentifierProvider> shardIdentifierProviderClass = ClassLoaderHelper.classForName(
      ShardIdentifierProvider.class,
      shardIdentityProviderName,
      "ShardIdentifierProvider",
      serviceManager
  );
  return new DynamicShardingEntityIndexBinder( shardIdentifierProviderClass, indexProperty[0] );
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private EntityIndexBinder createDynamicShardingEntityIndexBinder(Properties indexProperty[], WorkerBuildContext buildContext) {
  String shardIdentityProviderName = indexProperty[0].getProperty( SHARDING_STRATEGY );
  ServiceManager serviceManager = buildContext.getServiceManager();
  Class<? extends ShardIdentifierProvider> shardIdentifierProviderClass = ClassLoaderHelper.classForName(
      ShardIdentifierProvider.class,
      shardIdentityProviderName,
      "ShardIdentifierProvider",
      serviceManager
  );
  return new DynamicShardingEntityIndexBinder( shardIdentifierProviderClass, indexProperty[0] );
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private static Backend createJGroupsBackend(String backendClassName, WorkerBuildContext context) {
  try {
    return ClassLoaderHelper.instanceFromName(
        Backend.class,
        backendClassName,
        "JGroups backend",
        context.getServiceManager()
    );
  }
  catch (Exception e) {
    throw log.getUnableToCreateJGroupsBackendException( e );
  }
}

代码示例来源:origin: hibernate/hibernate-search

private static Backend createJGroupsBackend(String backendClassName, WorkerBuildContext context) {
  try {
    return ClassLoaderHelper.instanceFromName(
        Backend.class,
        backendClassName,
        "JGroups backend",
        context.getServiceManager()
    );
  }
  catch (Exception e) {
    throw log.getUnableToCreateJGroupsBackendException( e );
  }
}

代码示例来源:origin: hibernate/hibernate-search

private Similarity getDefaultSimilarity(SearchConfiguration searchConfiguration, WorkerBuildContext buildContext) {
  String defaultSimilarityClassName = searchConfiguration.getProperty( Environment.SIMILARITY_CLASS );
  if ( StringHelper.isEmpty( defaultSimilarityClassName ) ) {
    return DEFAULT_SIMILARITY;
  }
  else {
    ServiceManager serviceManager = buildContext.getServiceManager();
    return ClassLoaderHelper.instanceFromName(
        Similarity.class,
        defaultSimilarityClassName,
        "default similarity",
        serviceManager
    );
  }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private Similarity getDefaultSimilarity(SearchConfiguration searchConfiguration, WorkerBuildContext buildContext) {
  String defaultSimilarityClassName = searchConfiguration.getProperty( Environment.SIMILARITY_CLASS );
  if ( StringHelper.isEmpty( defaultSimilarityClassName ) ) {
    return DEFAULT_SIMILARITY;
  }
  else {
    ServiceManager serviceManager = buildContext.getServiceManager();
    return ClassLoaderHelper.instanceFromName(
        Similarity.class,
        defaultSimilarityClassName,
        "default similarity",
        serviceManager
    );
  }
}

代码示例来源:origin: hibernate/hibernate-search

public AbstractWorkspaceImpl(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties cfg) {
  this.indexManager = indexManager;
  this.optimizerStrategy = indexManager.getOptimizerStrategy();
  this.writerHolder = new IndexWriterHolder( context.getErrorHandler(), indexManager );
  this.indexMetadataIsComplete = PropertiesParseHelper.isIndexMetadataComplete( cfg, context );
  this.deleteByTermEnforced = context.isDeleteByTermEnforced();
  this.serviceManager = context.getServiceManager();
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

public AbstractWorkspaceImpl(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties cfg) {
  this.indexManager = indexManager;
  this.optimizerStrategy = indexManager.getOptimizerStrategy();
  this.writerHolder = new IndexWriterHolder( context.getErrorHandler(), indexManager );
  this.indexMetadataIsComplete = PropertiesParseHelper.isIndexMetadataComplete( cfg, context );
  this.deleteByTermEnforced = context.isDeleteByTermEnforced();
  this.serviceManager = context.getServiceManager();
}

代码示例来源:origin: hibernate/hibernate-search

@Override
public void initialize(Properties props, WorkerBuildContext context, IndexManager indexManager) {
  serviceManager = context.getServiceManager();
  this.props = props;
  this.isTransactional = context.enlistWorkerInTransaction();
  this.jmsQueueName = props.getProperty( JMS_QUEUE );
  this.indexName = indexManager.getIndexName();
  this.integrator = context.getUninitializedSearchIntegrator();
  this.factory = initializeJMSQueueConnectionFactory( props );
  if ( ! isTransactional ) {
    // if we are not transactional, we can eagerly initialize the queue and connection
    this.jmsQueue = initializeJMSQueue( factory, props );
    this.connection = initializeJMSConnection( factory, props );
  }
}

代码示例来源:origin: org.hibernate/hibernate-search-backend-elasticsearch

@Override
public void initialize(Properties props, WorkerBuildContext context, IndexManager indexManager) {
  this.indexManager = (ElasticsearchIndexManager) indexManager;
  this.errorHandler = context.getErrorHandler();
  this.searchIntegrator = context.getUninitializedSearchIntegrator();
  this.visitor = new ElasticsearchIndexWorkVisitor(
      this.indexManager.getActualIndexName(),
      this.searchIntegrator
  );
  this.jestClient = context.getServiceManager().requestService( JestClient.class );
}

代码示例来源:origin: hibernate/hibernate-search

@Override
public void initialize(String indexName, Properties properties, Similarity similarity, WorkerBuildContext buildContext) {
  this.serviceManager = buildContext.getServiceManager();
  this.indexName = indexName;
  this.similarity = similarity;
  this.directoryProvider = createDirectoryProvider( indexName, properties, buildContext );
  this.indexingParameters = PropertiesParseHelper.extractIndexingPerformanceOptions( properties );
  this.optimizer = PropertiesParseHelper.getOptimizerStrategy( this, properties, buildContext );
  this.workspaceHolder = createWorkspaceHolder( indexName, properties, buildContext );
  this.directoryProvider.start( this );
  this.readers = createIndexReader( indexName, properties, buildContext );
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public void initialize(String indexName, Properties properties, Similarity similarity, WorkerBuildContext buildContext) {
  this.serviceManager = buildContext.getServiceManager();
  this.indexName = indexName;
  this.similarity = similarity;
  this.directoryProvider = createDirectoryProvider( indexName, properties, buildContext );
  this.indexingParameters = PropertiesParseHelper.extractIndexingPerformanceOptions( properties );
  this.optimizer = PropertiesParseHelper.getOptimizerStrategy( this, properties, buildContext );
  this.workspaceHolder = createWorkspaceHolder( indexName, properties, buildContext );
  this.directoryProvider.start( this );
  this.readers = createIndexReader( indexName, properties, buildContext );
}

代码示例来源:origin: org.infinispan/infinispan-query

@Override
public void initialize(Properties props, WorkerBuildContext context, IndexManager indexManager) {
 this.indexManager = indexManager;
 LocalBackendFactory localBackendFactory = new SimpleLocalBackendFactory(indexManager, props, context);
 serviceManager = context.getServiceManager();
 CacheManagerService cacheManagerService = serviceManager.requestService(CacheManagerService.class);
 this.indexName = indexManager.getIndexName();
 ComponentRegistryService componentRegistryService = serviceManager.requestService(ComponentRegistryService.class);
 ComponentRegistry componentRegistry = componentRegistryService.getComponentRegistry();
 this.forwardingBackend = createForwardingBackend(props, componentRegistry, indexName, localBackendFactory, cacheManagerService, indexManager);
 log.commandsBackendInitialized(indexName);
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public void initialize(Properties props, WorkerBuildContext context, IndexManager indexManager) {
 this.indexManager = indexManager;
 LocalBackendFactory localBackendFactory = new SimpleLocalBackendFactory(indexManager, props, context);
 serviceManager = context.getServiceManager();
 CacheManagerService cacheManagerService = serviceManager.requestService(CacheManagerService.class);
 this.indexName = indexManager.getIndexName();
 ComponentRegistryService componentRegistryService = serviceManager.requestService(ComponentRegistryService.class);
 ComponentRegistry componentRegistry = componentRegistryService.getComponentRegistry();
 this.forwardingBackend = createForwardingBackend(props, componentRegistry, indexName, localBackendFactory, cacheManagerService, indexManager);
 log.commandsBackendInitialized(indexName);
}

代码示例来源:origin: hibernate/hibernate-search

@Override
public void initialize(Properties properties, WorkerBuildContext context) {
  this.properties = properties;
  serviceManager = context.getServiceManager();
  /*
   * This service in particular must be started eagerly, because it sets up
   * the message consumers, allowing slaves to send messages to the master.
   * Note that slaves may create index managers before the master,
   * in particular when dynamic sharding is used.
   */
  messageSender = serviceManager.requestService( MessageSenderService.class );
  luceneWorkSerializer = serviceManager.requestService( LuceneWorkSerializer.class );
  masterNodeSelector = serviceManager.requestService( NodeSelectorService.class );
  sync = BackendFactory.isConfiguredAsSync( properties );
  Properties jgroupsProperties = new MaskedProperty( properties, JGROUPS_CONFIGURATION_SPACE );
  block = ConfigurationParseHelper.getBooleanValue( jgroupsProperties, BLOCK_WAITING_ACK, sync );
  messageTimeout = ConfigurationParseHelper.getLongValue( jgroupsProperties, MESSAGE_TIMEOUT_MS, DEFAULT_MESSAGE_TIMEOUT );
  delegateBackendName = ConfigurationParseHelper.getString( jgroupsProperties, DELEGATE_BACKEND, "local" );
}

代码示例来源:origin: org.hibernate/hibernate-search-backend-elasticsearch

@Override
public void initialize(String indexName, Properties properties, Similarity similarity, WorkerBuildContext context) {
  this.serviceManager = context.getServiceManager();
  this.indexName = getIndexName( indexName, properties );
  try ( ServiceReference<ConfigurationPropertiesProvider> propertiesProvider = serviceManager.requestReference( ConfigurationPropertiesProvider.class ) ) {
    this.indexManagementStrategy = getIndexManagementStrategy( propertiesProvider.get().getProperties() );
    this.indexManagementWaitTimeout = getIndexManagementWaitTimeout( propertiesProvider.get().getProperties() );
  }
  this.actualIndexName = IndexNameNormalizer.getElasticsearchIndexName( this.indexName );
  this.similarity = similarity;
  this.backend = BackendFactory.createBackend( this, context, properties );
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com