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

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


    }
    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


    Properties properties = getSearchFactoryImplementor().getConfigurationProperties();
    String factoryClassName = properties.getProperty( MassIndexerFactory.MASS_INDEXER_FACTORY_CLASSNAME );

    if ( factoryClassName != null ) {
      SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
      ServiceManager serviceManager = searchFactoryImplementor.getServiceManager();
      factory = ClassLoaderHelper.instanceFromName(
          MassIndexerFactory.class, factoryClassName, "Mass indexer factory", serviceManager
      );
    }
    else {
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

    Properties properties = getSearchFactoryImplementor().getConfigurationProperties();
    String factoryClassName = properties.getProperty( MassIndexerFactory.MASS_INDEXER_FACTORY_CLASSNAME );

    if ( factoryClassName != null ) {
      SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
      ServiceManager serviceManager = searchFactoryImplementor.getServiceManager();
      factory = ClassLoaderHelper.instanceFromName(
          MassIndexerFactory.class, factoryClassName, "Mass indexer factory", serviceManager
      );
    }
    else {
View Full Code Here

      Properties indexProperties,
      WorkerBuildContext buildContext) {
    MaskedProperty maskedProperty = new MaskedProperty( indexProperties, "optimizer" );
    String optimizerImplClassName = maskedProperty.getProperty( "implementation" );
    if ( optimizerImplClassName != null && ( !"default".equalsIgnoreCase( optimizerImplClassName ) ) ) {
      ServiceManager serviceManager = buildContext.getServiceManager();
      return ClassLoaderHelper.instanceFromName(
          OptimizerStrategy.class,
          optimizerImplClassName,
          "Optimizer Strategy",
          serviceManager
View Full Code Here

    }
    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

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.