com.google.inject.name.Named Java Examples
The following examples show how to use
com.google.inject.name.Named.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidatorTester.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Inject public ValidatorTester(T validator, EValidatorRegistrar registrar, @Named(Constants.LANGUAGE_NAME) final String languageName) { this.validator = validator; EValidator.Registry originalRegistry = registrar.getRegistry(); EValidatorRegistryImpl newRegistry = new EValidatorRegistryImpl(); registrar.setRegistry(newRegistry); this.validator.register(registrar); diagnostician = new Diagnostician(newRegistry) { @Override public java.util.Map<Object,Object> createDefaultContext() { java.util.Map<Object,Object> map = super.createDefaultContext(); map.put(AbstractInjectableValidator.CURRENT_LANGUAGE_NAME, languageName); return map; } }; registrar.setRegistry(originalRegistry); validatorCalled = false; }
Example #2
Source File: CarbonTextServer.java From kairos-carbon with Apache License 2.0 | 6 votes |
@Inject public CarbonTextServer(FilterEventBus eventBus, TagParser tagParser, @Named("kairosdb.carbon.text.port") int port, @Named("kairosdb.carbon.text.address") String address) { m_port = port; m_publisher = checkNotNull(eventBus).createPublisher(DataPointEvent.class); m_tagParser = tagParser; m_address = null; try { m_address = InetAddress.getByName(address); } catch (UnknownHostException e) { logger.error("Unknown host name " + address + ", will bind to 0.0.0.0"); } }
Example #3
Source File: RichStringAwareTokenScanner.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Inject public void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) ITokenDefProvider tokenDefProvider) { Map<Integer, String> map = tokenDefProvider.getTokenDefMap(); int minTokenType = org.antlr.runtime.Token.MIN_TOKEN_TYPE; allTokenTypesAsString = new String[map.size() + minTokenType]; for(Map.Entry<Integer, String> entry: map.entrySet()) { String tokenName = entry.getValue(); if ("RULE_RICH_TEXT_START".equals(tokenName) || "RULE_RICH_TEXT_END".equals(tokenName) || "RULE_RICH_TEXT_INBETWEEN".equals(tokenName) || "RULE_COMMENT_RICH_TEXT_END".equals(tokenName) || "RULE_COMMENT_RICH_TEXT_INBETWEEN".equals(tokenName)) { allTokenTypesAsString[entry.getKey()] = tokenName; } } }
Example #4
Source File: ExportUnitGenerator.java From yql-plus with Apache License 2.0 | 6 votes |
public ObjectBuilder createModuleAdapter(String moduleName, Class<?> sourceClass, TypeWidget moduleType, TypeWidget contextType, BytecodeExpression sourceProvider) { gambitScope.addClass(sourceClass); ObjectBuilder adapter = gambitScope.createObject(); ObjectBuilder.ConstructorBuilder cb = adapter.getConstructor(); ObjectBuilder.FieldBuilder fld = adapter.field("$module", moduleType); fld.addModifiers(Opcodes.ACC_FINAL); cb.exec(fld.get(cb.local("this")).write(cb.cast(moduleType, cb.invokeExact(Location.NONE, "get", Provider.class, AnyTypeWidget.getInstance(), sourceProvider)))); adapter.addParameterField(fld); ObjectBuilder.FieldBuilder programName = adapter.field("$programName", BaseTypeAdapter.STRING); programName.annotate(Inject.class); programName.annotate(Named.class).put("value", "programName"); adapter.addParameterField(programName); BytecodeExpression metric = gambitScope.constant(PhysicalExprOperatorCompiler.EMPTY_DIMENSION); metric = metricWith(cb, metric, "source", moduleName); return adapter; }
Example #5
Source File: ProxyResource.java From browserup-proxy with Apache License 2.0 | 6 votes |
@Post @At("/:port/filter/response") public Reply<?> addResponseFilter(@Named("port") int port, Request request) throws IOException, ScriptException { LOG.info("POST /" + port + "/filter/response"); MitmProxyServer proxy = proxyManager.get(port); if (proxy == null) { return Reply.saying().notFound(); } JavascriptRequestResponseFilter requestResponseFilter = new JavascriptRequestResponseFilter(); String script = getEntityBodyFromRequest(request); requestResponseFilter.setResponseFilterScript(script); proxy.addResponseFilter(requestResponseFilter); return Reply.saying().ok(); }
Example #6
Source File: DefaultModule.java From bromium with MIT License | 6 votes |
private ProxyDriverIntegrator getProxyDriverIntegrator(RequestFilter recordRequestFilter, WebDriverSupplier webDriverSupplier, DriverServiceSupplier driverServiceSupplier, @Named(PATH_TO_DRIVER) String pathToDriverExecutable, @Named(SCREEN) String screen, @Named(TIMEOUT) int timeout, ResponseFilter responseFilter) throws IOException { BrowserMobProxy proxy = createBrowserMobProxy(timeout, recordRequestFilter, responseFilter); proxy.start(0); logger.info("Proxy running on port " + proxy.getPort()); Proxy seleniumProxy = createSeleniumProxy(proxy); DesiredCapabilities desiredCapabilities = createDesiredCapabilities(seleniumProxy); DriverService driverService = driverServiceSupplier.getDriverService(pathToDriverExecutable, screen); WebDriver driver = webDriverSupplier.get(driverService, desiredCapabilities); return new ProxyDriverIntegrator(driver, proxy, driverService); }
Example #7
Source File: IpcdService.java From arcusplatform with Apache License 2.0 | 6 votes |
@Inject public IpcdService( PlatformMessageBus platformBus, @Named(PROP_THREADPOOL) Executor executor, IpcdRegistry registry, IpcdDeviceDao ipcdDeviceDao, DeviceDAO devDao, BeanAttributesTransformer<com.iris.messages.model.Device> devTransformer, PlacePopulationCacheManager populationCacheMgr ) { super(platformBus, executor); this.registry = registry; this.bus = platformBus; this.ipcdDeviceDao = ipcdDeviceDao; this.devDao = devDao; this.devTransformer = devTransformer; this.populationCacheMgr = populationCacheMgr; }
Example #8
Source File: ScheduledRetryProcessor.java From arcusplatform with Apache License 2.0 | 6 votes |
@Inject public ScheduledRetryProcessor( NotificationServiceConfig config, RetryManager retryManager, NotificationAuditor auditor, Dispatcher dispatcher, @Named("notifications.executor") ExecutorService executor ) { this.retryManager = retryManager; this.auditor = auditor; this.dispatcher = dispatcher; this.executor = executor; ThreadFactory factory = new ThreadFactoryBuilder().setNameFormat("notifications-retry-%d").build(); this.scheduler = Executors.newScheduledThreadPool(config.getMaxRetryThreads(), factory); }
Example #9
Source File: StaticCapabilitiesProvisioning.java From joynr with Apache License 2.0 | 6 votes |
@Inject public StaticCapabilitiesProvisioning(@Named(PROPERTY_PROVISIONED_CAPABILITIES_FILE) String provisionedCapabilitiesFile, @Named(CHANNELID) String localChannelId, ObjectMapper objectMapper, LegacyCapabilitiesProvisioning legacyCapabilitiesProvisioning, ResourceContentProvider resourceContentProvider, @Named(MessagingPropertyKeys.GBID_ARRAY) String[] gbids) { internalInterfaces = new HashSet<String>(); internalInterfaces.add(GlobalCapabilitiesDirectory.INTERFACE_NAME); internalInterfaces.add(GlobalDomainAccessController.INTERFACE_NAME); internalInterfaces.add(GlobalDomainRoleController.INTERFACE_NAME); internalInterfaces.add(GlobalDomainAccessControlListEditor.INTERFACE_NAME); discoveryEntries = new HashSet<>(); this.gbids = gbids.clone(); this.resourceContentProvider = resourceContentProvider; addEntriesFromJson(provisionedCapabilitiesFile, objectMapper, localChannelId); logger.trace("{} provisioned discovery entries loaded from JSON: {}", discoveryEntries.size(), discoveryEntries); overrideEntriesFromLegacySettings(legacyCapabilitiesProvisioning); logger.trace("{} provisioned discovery entries after adding legacy entries: {}", discoveryEntries.size(), discoveryEntries); logger.debug("Statically provisioned discovery entries loaded: {}", discoveryEntries); }
Example #10
Source File: LongPollingChannelLifecycle.java From joynr with Apache License 2.0 | 6 votes |
@Inject public LongPollingChannelLifecycle(CloseableHttpClient httpclient, RequestConfig defaultRequestConfig, @Named(MessagingPropertyKeys.CHANNELID) String channelId, @Named(MessagingPropertyKeys.RECEIVERID) String receiverId, ObjectMapper objectMapper, HttpConstants httpConstants, HttpRequestFactory httpRequestFactory) { this.httpclient = httpclient; this.defaultRequestConfig = defaultRequestConfig; this.channelId = channelId; this.receiverId = receiverId; this.objectMapper = objectMapper; this.httpConstants = httpConstants; this.httpRequestFactory = httpRequestFactory; }
Example #11
Source File: SceneTemplateRequestHandler.java From arcusplatform with Apache License 2.0 | 6 votes |
@Inject protected SceneTemplateRequestHandler( @Named(PROP_THREADPOOL) Executor executor, PlatformMessageBus platformBus, SceneTemplateManager sceneTemplateDao, BeanAttributesTransformer<SceneTemplateEntity> transformer, GetAttributesModelRequestHandler getAttributesRequestHandler, CreateRequestHandler createHandler, ResolveActionsRequestHandler resolveActionsHandler ) { super(platformBus, SceneTemplateCapability.NAMESPACE, executor); this.sceneTemplateManager = sceneTemplateDao; this.transformer = transformer; // TODO change to a builder pattern? this.dispatcher = RequestHandlers .toDispatcher( platformBus, RequestHandlers.toRequestHandler(templateModelLoader, getAttributesRequestHandler), RequestHandlers.toRequestHandler(templateEntityLoader, createHandler), RequestHandlers.toRequestHandler(templateLoader, resolveActionsHandler) ); }
Example #12
Source File: ScanUploadModule.java From emodb with Apache License 2.0 | 5 votes |
@Provides @Singleton protected StashStateListener provideStashStateListener(MetricsStashStateListener metricsListener, Optional<SNSStashStateListener> snsListener, @Named("plugin") List<StashStateListener> pluginListeners) { List<StashStateListener> listeners = Lists.newArrayListWithCapacity(3); listeners.add(metricsListener); if (snsListener.isPresent()) { listeners.add(snsListener.get()); } listeners.addAll(pluginListeners); return MultiStashStateListener.combine(listeners); }
Example #13
Source File: ActiveApiServlet.java From swellrt with Apache License 2.0 | 5 votes |
@Inject public ActiveApiServlet(RobotSerializer robotSerializer, EventDataConverterManager converterManager, WaveletProvider waveletProvider, @Named("ActiveApiRegistry") OperationServiceRegistry operationRegistry, ConversationUtil conversationUtil, OAuthServiceProvider oAuthServiceProvider, OAuthValidator validator, AccountStore accountStore) { super(robotSerializer, converterManager, waveletProvider, operationRegistry, conversationUtil, validator); this.oauthServiceProvider = oAuthServiceProvider; this.accountStore = accountStore; }
Example #14
Source File: BounceProxyControllerUrl.java From joynr with Apache License 2.0 | 5 votes |
/** * Creates a new Bounce Proxy Controller URL class from a base URL. * * @param baseUrl the base URL * @param bounceProxyId the id of the bounce proxy */ @Inject public BounceProxyControllerUrl(@Named(BounceProxyPropertyKeys.PROPERTY_BOUNCE_PROXY_CONTROLLER_BASE_URL) final String baseUrl, @Named(BounceProxyPropertyKeys.PROPERTY_BOUNCE_PROXY_ID) final String bounceProxyId) { if (!baseUrl.endsWith(URL_PATH_SEPARATOR)) { this.baseUrl = baseUrl + URL_PATH_SEPARATOR + "bounceproxies/"; } else { this.baseUrl = baseUrl + "bounceproxies/"; } this.bounceProxyId = bounceProxyId; }
Example #15
Source File: CassandraActivityDao.java From arcusplatform with Apache License 2.0 | 5 votes |
@Inject public CassandraActivityDao( @Named(CassandraHistory.NAME) Session session, HistoryAppenderConfig config ) { this.bucketSizeMs = (int) TimeUnit.SECONDS.toMillis(config.getActivityBucketSizeSec()); this.rowTtlMs = TimeUnit.HOURS.toMillis(config.getActivitySubsysTtlHours()); this.session = session; this.upsert = CassandraQueryBuilder .update(TABLE_NAME) .set( // anything that was active in this window counts as active Columns.ACTIVE_DEVICES + " = " + Columns.ACTIVE_DEVICES + " + ?, " + // only things that are inactive *at the end of the window* count as inactive Columns.DEACTIVATED_DEVICES + " = ?" ) .addWhereColumnEquals(Columns.PLACE_ID) .addWhereColumnEquals(Columns.TIME) .withTtlSec(TimeUnit.HOURS.toSeconds(config.getActivitySubsysTtlHours())) .usingTimestamp() .prepare(session); this.listByRange = CassandraQueryBuilder .select(TABLE_NAME) .addColumns(Columns.PLACE_ID, Columns.TIME, Columns.ACTIVE_DEVICES, Columns.DEACTIVATED_DEVICES) .where(Columns.PLACE_ID + " = ? AND " + Columns.TIME + " >= ? AND " + Columns.TIME + " < ?") .withConsistencyLevel(ConsistencyLevel.LOCAL_ONE) .prepare(session); }
Example #16
Source File: BusinessUtils.java From business with Mozilla Public License 2.0 | 5 votes |
/** * Optionally returns the qualifier annotation of a class. */ public static Optional<Annotation> getQualifier(AnnotatedElement annotatedElement) { AnnotatedElement cleanedAnnotatedElement; if (annotatedElement instanceof Class<?>) { cleanedAnnotatedElement = ProxyUtils.cleanProxy((Class<?>) annotatedElement); } else { cleanedAnnotatedElement = annotatedElement; } return Annotations.on(cleanedAnnotatedElement) .findAll() .filter(annotationAnnotatedWith(Qualifier.class, false).or(annotationIsOfClass(Named.class))) .findFirst(); }
Example #17
Source File: TablesResource.java From airpal with Apache License 2.0 | 5 votes |
@Inject public TablesResource( final SchemaCache schemaCache, final ColumnCache columnCache, final PreviewTableCache previewTableCache, final UsageStore usageStore, @Named("default-catalog") final String defaultCatalog) { this.schemaCache = schemaCache; this.columnCache = columnCache; this.previewTableCache = previewTableCache; this.usageStore = usageStore; this.defaultCatalog = defaultCatalog; }
Example #18
Source File: SchedulerModule.java From flux with Apache License 2.0 | 5 votes |
@Provides @Singleton @Named("schedulerSessionFactoriesContext") public SessionFactoryContext getSessionFactoryProvider(@Named("schedulerSessionFactory") SessionFactory schedulerSessionFactory) { Map fluxRWSessionFactoriesMap = new HashMap<ShardId, SessionFactory>(); Map fluxROSessionFactoriesMap = new HashMap<ShardId, SessionFactory>(); Map fluxShardKeyToShardIdMap = new HashMap<String, ShardId>(); return new SessionFactoryContextImpl(fluxRWSessionFactoriesMap, fluxROSessionFactoriesMap, fluxShardKeyToShardIdMap, schedulerSessionFactory); }
Example #19
Source File: SchedulerModule.java From flux with Apache License 2.0 | 5 votes |
/** * Returns {@link SessionFactoryContext} which holds the Session Factory for Scheduler DB. */ @Provides @Singleton @Named("schedulerSessionFactory") public SessionFactory getSessionFactoryProvider(@Named("schedulerHibernateConfiguration") Configuration configuration) { return configuration.buildSessionFactory(); }
Example #20
Source File: PairingSubsystem.java From arcusplatform with Apache License 2.0 | 5 votes |
@Request(StartPairingRequest.NAME) public MessageBody startPairing( SubsystemContext<PairingSubsystemModel> context, PlatformMessage request, @Named(StartPairingRequest.ATTR_PRODUCTADDRESS) String productAddress, @Named(StartPairingRequest.ATTR_MOCK) Boolean mock ) { ProductCatalogEntry product = loader.get(context, productAddress).orElseThrow(() -> new ErrorEventException(Errors.CODE_MISSING_PARAM, StartPairingRequest.ATTR_PRODUCTADDRESS)); if(Boolean.TRUE.equals(mock)) { PairingUtils.setMockPairing(context); } return PairingStateMachine.get( context ).startPairing(request, product); }
Example #21
Source File: HookApi.java From bitbucket-rest with Apache License 2.0 | 5 votes |
@Named("hook:get-hook") @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/5.0.1/bitbucket-rest.html#idm45993794409760"}) @Consumes(MediaType.APPLICATION_JSON) @Path("/{project}/repos/{repo}/settings/hooks/{hookKey}") @Fallback(BitbucketFallbacks.HookOnError.class) @GET Hook get(@PathParam("project") String project, @PathParam("repo") String repo, @PathParam("hookKey") String hookKey);
Example #22
Source File: SecurityModule.java From emodb with Apache License 2.0 | 5 votes |
@Provides @Singleton @Named("dao") RoleManager provideRoleManagerDAO(AuthorizationConfiguration config, DataStore dataStore, PermissionManager permissionManager, @SystemTablePlacement String tablePlacement) { return new TableRoleManagerDAO(dataStore, config.getRoleTable(), config.getRoleGroupTable(), tablePlacement, permissionManager); }
Example #23
Source File: Fabric8AuthServiceClient.java From rh-che with Eclipse Public License 2.0 | 5 votes |
@Inject public Fabric8AuthServiceClient( @Named("che.fabric8.auth.endpoint") String baseAuthUrl, KeycloakSettings keycloakSettings, JwtParser jwtParser) { super(keycloakSettings, jwtParser); this.githubTokenEndpoint = baseAuthUrl + GITHUB_TOKEN_API_PATH; this.githubLinkEndpoint = baseAuthUrl + GITHUB_LINK_API_PATH; }
Example #24
Source File: ApplicationA.java From vespa with Apache License 2.0 | 5 votes |
@Inject public ApplicationA(@Named("Init") CountDownLatch initLatch, @Named("Start") CountDownLatch startLatch, @Named("Stop") CountDownLatch stopLatch, @Named("Destroy") CountDownLatch destroyLatch) { this.startLatch = startLatch; this.stopLatch = stopLatch; this.destroyLatch = destroyLatch; initLatch.countDown(); }
Example #25
Source File: SmartHomeSkillV3Handler.java From arcusplatform with Apache License 2.0 | 5 votes |
@Inject public SmartHomeSkillV3Handler( ShsConfig config, PlatformMessageBus bus, @Named(VoiceBridgeConfig.NAME_EXECUTOR) ExecutorService executor, VoiceBridgeMetrics metrics, PlacePopulationCacheManager populationCacheMgr ) { this.config = config; this.executor = executor; this.busClient = new PlatformBusClient(bus, executor, ImmutableSet.of(AddressMatchers.equals(AlexaUtil.ADDRESS_BRIDGE))); this.metrics = metrics; this.populationCacheMgr = populationCacheMgr; }
Example #26
Source File: RobotApiModule.java From swellrt with Apache License 2.0 | 5 votes |
@Provides @Singleton @Inject @Named("ActiveApiRegistry") protected OperationServiceRegistry provideActiveApiRegistry(Injector injector) { return new ActiveApiOperationServiceRegistry(injector); }
Example #27
Source File: DefaultModule.java From bromium with MIT License | 5 votes |
@CheckedProvides(IOURIProvider.class) public RecordBrowser getRecordBrowser(@Named(BASE_URL) String baseUrl, IOURIProvider<DriverOperations> driverOperationsIOURIProvider, RecordingState recordingState) throws IOException, URISyntaxException { return new RecordBrowser( baseUrl, driverOperationsIOURIProvider.get(), recordingState::getTestScenarioSteps); }
Example #28
Source File: HttpPermissionCheckerImpl.java From che with Eclipse Public License 2.0 | 5 votes |
@Inject public HttpPermissionCheckerImpl( @Named("che.api") String apiEndpoint, HttpJsonRequestFactory requestFactory) { // TODO mb make configurable size of cache and expiration time this.permissionsCache = CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterWrite(1, TimeUnit.MINUTES) .build( new CacheLoader<Key, Set<String>>() { @Override public Set<String> load(Key key) throws Exception { UriBuilder currentUsersPermissions = UriBuilder.fromUri(apiEndpoint).path("permissions/" + key.domain); if (key.instance != null) { currentUsersPermissions.queryParam("instance", key.instance); } String userPermissionsUrl = currentUsersPermissions.build().toString(); try { PermissionsDto usersPermissions = requestFactory .fromUrl(userPermissionsUrl) .useGetMethod() .request() .asDto(PermissionsDto.class); return new HashSet<>(usersPermissions.getActions()); } catch (NotFoundException e) { // user doesn't have permissions return new HashSet<>(); } } }); }
Example #29
Source File: ArbitratorManager.java From bisq-core with GNU Affero General Public License v3.0 | 5 votes |
@Inject public ArbitratorManager(KeyRing keyRing, ArbitratorService arbitratorService, User user, Preferences preferences, FilterManager filterManager, @Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) { this.keyRing = keyRing; this.arbitratorService = arbitratorService; this.user = user; this.preferences = preferences; this.filterManager = filterManager; publicKeys = useDevPrivilegeKeys ? Collections.unmodifiableList(Collections.singletonList(DevEnv.DEV_PRIVILEGE_PUB_KEY)) : Collections.unmodifiableList(Arrays.asList( "0365c6af94681dbee69de1851f98d4684063bf5c2d64b1c73ed5d90434f375a054", "031c502a60f9dbdb5ae5e438a79819e4e1f417211dd537ac12c9bc23246534c4bd", "02c1e5a242387b6d5319ce27246cea6edaaf51c3550591b528d2578a4753c56c2c", "025c319faf7067d9299590dd6c97fe7e56cd4dac61205ccee1cd1fc390142390a2", "038f6e24c2bfe5d51d0a290f20a9a657c270b94ef2b9c12cd15ca3725fa798fc55", "0255256ff7fb615278c4544a9bbd3f5298b903b8a011cd7889be19b6b1c45cbefe", "024a3a37289f08c910fbd925ebc72b946f33feaeff451a4738ee82037b4cda2e95", "02a88b75e9f0f8afba1467ab26799dcc38fd7a6468fb2795444b425eb43e2c10bd", "02349a51512c1c04c67118386f4d27d768c5195a83247c150a4b722d161722ba81", "03f718a2e0dc672c7cdec0113e72c3322efc70412bb95870750d25c32cd98de17d", "028ff47ee2c56e66313928975c58fa4f1b19a0f81f3a96c4e9c9c3c6768075509e", "02b517c0cbc3a49548f448ddf004ed695c5a1c52ec110be1bfd65fa0ca0761c94b", "03df837a3a0f3d858e82f3356b71d1285327f101f7c10b404abed2abc1c94e7169", "0203a90fb2ab698e524a5286f317a183a84327b8f8c3f7fa4a98fec9e1cefd6b72", "023c99cc073b851c892d8c43329ca3beb5d2213ee87111af49884e3ce66cbd5ba5" )); }
Example #30
Source File: SceneServiceHandler.java From arcusplatform with Apache License 2.0 | 5 votes |
@Inject public SceneServiceHandler( @Named(PROP_THREADPOOL) Executor executor, PlatformMessageBus platformBus, ListScenesRequestHandler listScenes, ListSceneTemplateRequestHandler listSceneTemplates ) { super(platformBus, SceneService.NAMESPACE, executor); this.dispatcher = RequestHandlers.toDispatcher(platformBus, listScenes, listSceneTemplates); }