public ImmutableSearchFactory(SearchFactoryState state) { this.analyzers = state.getAnalyzers(); this.cacheBitResultsSize = state.getCacheBitResultsSize(); this.configurationProperties = state.getConfigurationProperties(); this.indexBindingForEntities = state.getIndexBindings(); this.documentBuildersContainedEntities = state.getDocumentBuildersContainedEntities(); this.filterCachingStrategy = state.getFilterCachingStrategy(); this.filterDefinitions = state.getFilterDefinitions(); this.indexHierarchy = state.getIndexHierarchy(); this.indexingMode = state.getIndexingMode(); this.worker = state.getWorker(); this.serviceManager = state.getServiceManager(); this.transactionManagerExpected = state.isTransactionManagerExpected(); this.allIndexesManager = state.getAllIndexesManager(); this.errorHandler = state.getErrorHandler(); this.instanceInitializer = state.getInstanceInitializer(); this.timeoutExceptionFactory = state.getDefaultTimeoutExceptionFactory(); this.timingSource = state.getTimingSource(); this.mapping = state.getProgrammaticMapping(); if (state.getStatistics() == null) { this.statistics = new StatisticsImpl(this); boolean statsEnabled = ConfigurationParseHelper.getBooleanValue( configurationProperties, Environment.GENERATE_STATS, false); this.statistics.setStatisticsEnabled(statsEnabled); } else { this.statistics = (StatisticsImpl) state.getStatistics(); } this.indexMetadataIsComplete = state.isIndexMetadataComplete(); this.isDeleteByTermEnforced = state.isDeleteByTermEnforced(); this.isIdProvidedImplicit = state.isIdProvidedImplicit(); this.indexManagerFactory = state.getIndexManagerFactory(); this.enableDirtyChecks = ConfigurationParseHelper.getBooleanValue( configurationProperties, Environment.ENABLE_DIRTY_CHECK, true); if (isJMXEnabled()) { this.statisticsMBeanName = registerMBeans(); } else { this.statisticsMBeanName = null; } this.indexReaderAccessor = new DefaultIndexReaderAccessor(this); this.indexedTypeDescriptors = new ConcurrentHashMap<>(); this.defaultObjectLookupMethod = determineDefaultObjectLookupMethod(); this.defaultDatabaseRetrievalMethod = determineDefaultDatabaseRetrievalMethod(); this.enlistWorkerInTransaction = ConfigurationParseHelper.getBooleanValue( configurationProperties, Environment.WORKER_ENLIST_IN_TRANSACTION, false); this.indexUninvertingAllowed = ConfigurationParseHelper.getBooleanValue( configurationProperties, Environment.INDEX_UNINVERTING_ALLOWED, true); }
@Override public void start(Properties properties, BuildContext context) { String name = ConfigurationParseHelper.getString(properties, CACHE_MANAGER_RESOURCE_PROP, null); if (name == null) { // No JNDI lookup configured: start the CacheManager String cfgName = properties.getProperty( INFINISPAN_CONFIGURATION_RESOURCENAME, DEFAULT_INFINISPAN_CONFIGURATION_RESOURCENAME); try { InfinispanConfigurationParser ispnConfiguration = new InfinispanConfigurationParser(CacheManagerServiceProvider.class.getClassLoader()); ConfigurationBuilderHolder configurationBuilderHolder = ispnConfiguration.parseFile(cfgName); cacheManager = new DefaultCacheManager(configurationBuilderHolder, true); manageCacheManager = true; } catch (IOException e) { throw new SearchException( "Could not start Infinispan CacheManager using as configuration file: " + cfgName, e); } } else { // use the CacheManager via JNDI cacheManager = locateCacheManager( name, JNDIHelper.getJndiProperties(properties, JNDIHelper.HIBERNATE_JNDI_PREFIX)); manageCacheManager = false; } }
@Override public void initialize( Properties props, WorkerBuildContext context, QueueingProcessor queueingProcessor) { this.queueingProcessor = queueingProcessor; this.factory = context.getUninitializedSearchIntegrator(); this.transactionExpected = context.isTransactionManagerExpected(); this.instanceInitializer = context.getInstanceInitializer(); this.enlistInTransaction = ConfigurationParseHelper.getBooleanValue( props, Environment.WORKER_ENLIST_IN_TRANSACTION, false); }
private Integer parseBoolean(String value) { boolean v = ConfigurationParseHelper.parseBoolean(value, "Invalid value for " + cfgKey + ": " + value); return v ? TRUE : FALSE; }
/** * Specific parameters may override to provide additional keywords support. * * @param value the string value as in configuration file * @return the integer value going to be set as parameter * @throws SearchException for unrecognized values */ public Integer parseVal(String value) { return ConfigurationParseHelper.parseInt(value, "Invalid value for " + cfgKey + ": " + value); }