@Inject public TransportWhoAmIAction(final Settings settings, final ThreadPool threadPool, final ClusterService clusterService, final TransportService transportService, final AdminDNs adminDNs, final ActionFilters actionFilters, final IndexNameExpressionResolver indexNameExpressionResolver) { super(settings, WhoAmIAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, WhoAmIRequest::new); this.adminDNs = adminDNs; }
@Singleton public class MongoClientService extends AbstractLifecycleComponent<MongoClientService> {
static <T> ConstructorBindingImpl<T> create( InjectorImpl injector, Key<T> key, Object source, Scoping scoping) { Factory<T> factoryFactory = new Factory<>(); InternalFactory<? extends T> scopedFactory = Scopes.scope(key, injector, factoryFactory, scoping); return new ConstructorBindingImpl<>( injector, key, source, scopedFactory, scoping, factoryFactory); }
public Injector createInjector() { Injector injector = Guice.createInjector(modules); ((InjectorImpl) injector).clearCache(); // in ES, we always create all instances as if they are eager singletons // this allows for considerable memory savings (no need to store construction info) as well as cycles ((InjectorImpl) injector).readOnlyAllSingletons(); return injector; } }
public void readOnlyAllSingletons() { readOnly = true; state.makeAllBindingsToEagerSingletons(this); bindingsMultimap = new BindingsMultimap(); // reindex the bindings index(); } }
/** * Returns this key without annotation attributes, i.e. with only the * annotation type. */ Key<T> withoutAttributes() { return new Key<>(typeLiteral, annotationStrategy.withoutAttributes()); }
@Override public <T> MembersInjector<T> getMembersInjector(Class<T> type) { return getMembersInjector(TypeLiteral.get(type)); } }
ProviderBindingImpl(InjectorImpl injector, Key<Provider<T>> key, Binding<T> providedBinding) { super(injector, key, providedBinding.getSource(), createInternalFactory(providedBinding), Scoping.UNSCOPED); this.providedBinding = (BindingImpl<T>) providedBinding; }
/** * Gets the key of this key's provider. */ Key<Provider<T>> providerKey() { return ofType(typeLiteral.providerType()); }
@Override protected ConfigUpdateNodeResponse nodeOperation(final NodeConfigUpdateRequest request) { final Map<String, Settings> setn = configurationRepository.reloadConfiguration(Arrays.asList(request.request.getConfigTypes())); String licenseText = null; if(setn.get("config") != null) { licenseText = setn.get("config").get("searchguard.dynamic.license"); } if(licenseText != null && !licenseText.isEmpty()) { try { final SearchGuardLicense license = new SearchGuardLicense(XContentHelper.convertToMap(XContentType.JSON.xContent(), LicenseHelper.validateLicense(licenseText), true), clusterService); if(!license.isValid()) { logger.warn("License "+license.getUid()+" is invalid due to "+license.getMsgs()); //throw an exception here if loading of invalid license should be denied } } catch (Exception e) { logger.error("Invalid license",e); return new ConfigUpdateNodeResponse(clusterService.localNode(), new String[0], "Invalid license: "+e); } } backendRegistry.get().invalidateCache(); return new ConfigUpdateNodeResponse(clusterService.localNode(), setn.keySet().toArray(new String[0]), null); } }
@Inject public TransportConfigUpdateAction(final Settings settings, final ThreadPool threadPool, final ClusterService clusterService, final TransportService transportService, final IndexBaseConfigurationRepository configurationRepository, final ActionFilters actionFilters, final IndexNameExpressionResolver indexNameExpressionResolver, Provider<BackendRegistry> backendRegistry) { super(settings, ConfigUpdateAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, ConfigUpdateRequest::new, TransportConfigUpdateAction.NodeConfigUpdateRequest::new, ThreadPool.Names.MANAGEMENT, ConfigUpdateNodeResponse.class); this.configurationRepository = configurationRepository; this.backendRegistry = backendRegistry; }
@Inject public TransportLicenseInfoAction(final Settings settings, final ThreadPool threadPool, final ClusterService clusterService, final TransportService transportService, final IndexBaseConfigurationRepository configurationRepository, final ActionFilters actionFilters, final IndexNameExpressionResolver indexNameExpressionResolver) { super(settings, LicenseInfoAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, LicenseInfoRequest::new, TransportLicenseInfoAction.NodeLicenseRequest::new, ThreadPool.Names.MANAGEMENT, LicenseInfoNodeResponse.class); this.configurationRepository = configurationRepository; }
@Inject public MongoClientService(Settings settings) { super(settings); }
@Inject public PrivilegesInterceptorImpl(IndexNameExpressionResolver resolver, ClusterService clusterService, Client client, ThreadPool threadPool) { super(resolver, clusterService, client, threadPool); }
@Inject public GuiceHolder(final RepositoriesService repositoriesService, final TransportService remoteClusterService) { GuiceHolder.repositoriesService = repositoriesService; GuiceHolder.remoteClusterService = remoteClusterService.getRemoteClusterService(); }
@Inject public Configuration(Environment env,Settings settings) { this.environment = env; this.settings=settings; this.useSmart = settings.get("use_smart", "false").equals("true"); this.enableLowercase = settings.get("enable_lowercase", "true").equals("true"); this.enableRemoteDict = settings.get("enable_remote_dict", "true").equals("true"); Dictionary.initial(this); }
@Inject public PinyinAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); config=new PinyinConfig(settings); analyzer = new PinyinAnalyzer(config); }
@Inject public RestMongoDBRiverAction(Settings settings, Client esClient, RestController controller, @RiverIndexName String riverIndexName) { super(settings, controller, esClient); this.riverIndexName = riverIndexName; String baseUrl = "/" + riverIndexName + "/" + MongoDBRiver.TYPE; logger.trace("RestMongoDBRiverAction - baseUrl: {}", baseUrl); controller.registerHandler(RestRequest.Method.GET, baseUrl + "/{action}", this); controller.registerHandler(RestRequest.Method.POST, baseUrl + "/{river}/{action}", this); }
@Inject public MongoDBRiver(RiverName riverName, RiverSettings settings, @RiverIndexName String riverIndexName, Client esClient, ScriptService scriptService, MongoClientService mongoClientService) { super(riverName, settings); if (logger.isTraceEnabled()) { logger.trace("Initializing"); } this.esClient = esClient; this.scriptService = scriptService; this.mongoClientService = mongoClientService; this.definition = MongoDBRiverDefinition.parseSettings(riverName.name(), riverIndexName, settings, scriptService); BlockingQueue<QueueEntry> stream = definition.getThrottleSize() == -1 ? new LinkedTransferQueue<QueueEntry>() : new ArrayBlockingQueue<QueueEntry>(definition.getThrottleSize()); this.context = new SharedContext(stream, Status.STOPPED); }