@Override public void inject(EmbeddedCacheManager cacheManager) { try { ClassLoader classLoader = cacheManager.getCacheManagerConfiguration().classLoader(); Class<?> marshallerClass = Class.forName(marshallerClassName, false, classLoader); builder.compatibility().marshaller(marshallerClass.asSubclass(Marshaller.class).newInstance()); } catch (Exception e) { throw InfinispanMessages.MESSAGES.unableToInstantiateClass(marshallerClassName); } } };
public CodecRegistry(EmbeddedCacheManager cacheManager) { GlobalConfiguration globalConfiguration = cacheManager.getCacheManagerConfiguration(); ClassLoader cl = globalConfiguration.classLoader(); ClassWhiteList classWhiteList = cacheManager.getClassWhiteList(); codecs = new HashMap<>(); Iterator<Codec> it = ServiceFinder.load(Codec.class, cl).iterator(); for (; ; ) { try { Codec codec = it.next(); codec.setWhiteList(classWhiteList); String name = codec.getName(); if (codecs.containsKey(name)) { log.duplicateCodec(codec.getClass().getName(), codecs.get(name).getClass().getName()); } else { codecs.put(name, codec); } } catch (ServiceConfigurationError e) { log.loadingCodecFailed(e); } catch (NoSuchElementException e) { break; } } }
@Override public void inject(EmbeddedCacheManager cacheManager) { try { ClassLoader classLoader = cacheManager.getCacheManagerConfiguration().classLoader(); Class<?> entityClass = Class.forName(className, false, classLoader); builder.indexing().addIndexedEntity(entityClass); } catch (Exception e) { throw InfinispanMessages.MESSAGES.unableToInstantiateClass(className); } } };
@Inject public void initialize(final EmbeddedCacheManager cacheManager, TimeService timeService) { this.cacheManager = cacheManager; this.codecRegistry = new CodecRegistry(cacheManager.getCacheManagerConfiguration().classLoader()); this.timeService = timeService; }
@Start public void start() { ClassLoader classLoader = cacheManager.getCacheManagerConfiguration().classLoader(); this.scriptEngineManager = new ScriptEngineManager(classLoader); internalCacheRegistry.registerInternalCache(SCRIPT_CACHE, getScriptCacheConfiguration().build(), EnumSet.of(Flag.USER, Flag.PROTECTED, Flag.PERSISTENT, Flag.GLOBAL)); taskManager.registerTaskEngine(new ScriptingTaskEngine(this)); scriptConversions = new ScriptConversions(encoderRegistry); }
@Override public void start() { if (configuration.manageConnectionFactory()) { ConnectionFactory factory = ConnectionFactory.getConnectionFactory(configuration.connectionFactory().connectionFactoryClass()); factory.start(configuration.connectionFactory(), factory.getClass().getClassLoader()); initializeConnectionFactory(factory); } try { Object mapper = Util.loadClassStrict(configuration.key2StringMapper(), globalConfiguration.classLoader()).newInstance(); if (mapper instanceof Key2StringMapper) key2StringMapper = (Key2StringMapper) mapper; } catch (Exception e) { log.errorf("Trying to instantiate %s, however it failed due to %s", configuration.key2StringMapper(), e.getClass().getName()); throw new IllegalStateException("This should not happen.", e); } if (trace) { log.tracef("Using key2StringMapper: %s", key2StringMapper.getClass().getName()); } if (configuration.preload()) { enforceTwoWayMapper("preload"); } if (isDistributedCache) { enforceTwoWayMapper("distribution/rehashing"); } }
@ManagedOperation(description = "Parses and executes IspnCliQL statements") public Map<String, String> execute(final String sessionId, final String s) throws Exception { Session session = null; ClassLoader oldCL = SecurityActions.setThreadContextClassLoader(cacheManager.getCacheManagerConfiguration().classLoader()); Map<String, String> response = new HashMap<>(); try {
@ManagedOperation(description = "Parses and executes IspnCliQL statements") public Map<String, String> execute(final String sessionId, final String s) throws Exception { Session session = null; ClassLoader oldCL = SysPropertyActions.setThreadContextClassLoader(cacheManager.getCacheManagerConfiguration().classLoader()); Map<String, String> response = new HashMap<String, String>(); try {
/** * Registers the Search interceptor in the cache before it gets started */ @Override public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) { InternalCacheRegistry icr = cr.getGlobalComponentRegistry().getComponent(InternalCacheRegistry.class); if (!icr.isInternalCache(cacheName) || icr.internalCacheHasFlag(cacheName, Flag.QUERYABLE)) { AdvancedCache<?, ?> cache = cr.getComponent(Cache.class).getAdvancedCache(); ClassLoader aggregatedClassLoader = makeAggregatedClassLoader(cr.getGlobalComponentRegistry().getGlobalConfiguration().classLoader()); SearchIntegrator searchFactory = null; boolean isIndexed = cfg.indexing().index().isEnabled(); if (isIndexed) { setBooleanQueryMaxClauseCount(); cr.registerComponent(new ShardAllocationManagerImpl(), ShardAllocatorManager.class); searchFactory = createSearchIntegrator(cfg.indexing(), cr, aggregatedClassLoader); KeyTransformationHandler keyTransformationHandler = new KeyTransformationHandler(aggregatedClassLoader); cr.registerComponent(keyTransformationHandler, KeyTransformationHandler.class); createQueryInterceptorIfNeeded(cr.getComponent(BasicComponentRegistry.class), cfg, cache, searchFactory, keyTransformationHandler); addCacheDependencyIfNeeded(cacheName, cache.getCacheManager(), cfg.indexing()); cr.registerComponent(new QueryBox(), QueryBox.class); } registerMatcher(cr, searchFactory, aggregatedClassLoader); cr.registerComponent(new EmbeddedQueryEngine(cache, isIndexed), EmbeddedQueryEngine.class); } }