Package org.hibernate.search.engine.service.spi

Examples of org.hibernate.search.engine.service.spi.ServiceManager


    }
    else if ( "shared".equalsIgnoreCase( readerProviderImplName ) ) {
      readerProvider = new SharingBufferReaderProvider();
    }
    else {
      ServiceManager serviceManager = buildContext.getServiceManager();
      readerProvider = ClassLoaderHelper.instanceFromName(
          DirectoryBasedReaderProvider.class,
          readerProviderImplName,
          "readerProvider",
          serviceManager
View Full Code Here


  private IndexManager createIndexManager(String indexName,
      Similarity indexSimilarity,
      Properties properties,
      WorkerBuildContext workerBuildContext) {
    // get hold of the index manager factory via the service manager
    ServiceManager serviceManager = workerBuildContext.getServiceManager();
    IndexManagerFactory indexManagerFactory = serviceManager.requestService( IndexManagerFactory.class );

    // create IndexManager instance via the index manager factory
    String indexManagerImplementationName = properties.getProperty( Environment.INDEX_MANAGER_IMPL_NAME );
    final IndexManager manager;
    try {
      if ( StringHelper.isEmpty( indexManagerImplementationName ) ) {
        manager = indexManagerFactory.createDefaultIndexManager();
      }
      else {
        manager = indexManagerFactory.createIndexManagerByName( indexManagerImplementationName );
      }
    }
    finally {
      serviceManager.releaseService( IndexManagerFactory.class );
    }

    // init the IndexManager
    try {
      manager.initialize( indexName, properties, indexSimilarity, workerBuildContext );
View Full Code Here

  }

  private ShardIdentifierProvider createShardIdentifierProvider(WorkerBuildContext buildContext, Properties indexProperty) {
    ShardIdentifierProvider shardIdentifierProvider;
    String shardIdentityProviderName = indexProperty.getProperty( SHARDING_STRATEGY );
    ServiceManager serviceManager = buildContext.getServiceManager();
    shardIdentifierProvider = ClassLoaderHelper.instanceFromName(
        ShardIdentifierProvider.class,
        shardIdentityProviderName,
        "ShardIdentifierProvider",
        serviceManager
View Full Code Here

    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
View Full Code Here

  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
View Full Code Here

      else {
        shardingStrategy = new IdHashShardingStrategy();
      }
    }
    else {
      ServiceManager serviceManager = buildContext.getServiceManager();
      shardingStrategy = ClassLoaderHelper.instanceFromName(
          IndexShardingStrategy.class,
          shardingStrategyName,
          "IndexShardingStrategy",
          serviceManager
View Full Code Here

    }
    Class entityType = targetedEntities.size() == 0 ? null : targetedEntities.iterator().next();
    if ( criteria instanceof CriteriaImpl ) {
      String targetEntity = ( (CriteriaImpl) criteria ).getEntityOrClassName();
      if ( entityType == null ) {
        ServiceManager serviceManager = searchFactoryImplementor.getServiceManager();
        try {
          ClassLoaderService classLoaderService = serviceManager.requestService( ClassLoaderService.class );
          entityType = classLoaderService.classForName( targetEntity );
        }
        catch (ClassLoadingException e) {
          throw new SearchException( "Unable to load entity class from criteria: " + targetEntity, e );
        }
        finally {
          serviceManager.releaseService( ClassLoaderService.class );
        }
      }
      else {
        if ( !entityType.getName().equals( targetEntity ) ) {
          throw new SearchException( "Criteria query entity should match query entity" );
View Full Code Here

  private SerializationProvider serializationProvider;

  @Before
  public void setUp() {
    ServiceManager serviceManager = new StandardServiceManager(
        new SearchConfigurationForTest(),
        null
    );

    serializationProvider = serviceManager.requestService( SerializationProvider.class );
    assertTrue( "Wrong serialization provider", serializationProvider instanceof AvroSerializationProvider );
  }
View Full Code Here

  @Before
  public void setUp() {
    SearchConfiguration searchConfiguration = new SearchConfigurationForTest();
    BuildContext buildContext = new BuildContextForTest( searchConfiguration );
    ServiceManager serviceManager = new StandardServiceManager( searchConfiguration, buildContext );
    resourceLoader = new HibernateSearchResourceLoader( serviceManager );
  }
View Full Code Here

  public SearchFactoryHolder searchFactoryHolder = new SearchFactoryHolder( RemoteEntity.class );
  private SerializationProvider serializationProvider;

  @Before
  public void setUp() {
    ServiceManager serviceManager = new StandardServiceManager(
        new SearchConfigurationForTest(),
        null
    );
    serializationProvider = serviceManager.requestService( SerializationProvider.class );
    assertTrue( "Wrong serialization provider", serializationProvider instanceof AvroSerializationProvider );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.engine.service.spi.ServiceManager

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.