Java Code Examples for javax.inject.Named
The following examples show how to use
javax.inject.Named.
These examples are extracted from open source projects.
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 Project: linstor-server Author: LINBIT File: CmdDeleteConfValue.java License: GNU General Public License v3.0 | 6 votes |
@Inject public CmdDeleteConfValue( DbConnectionPool dbConnectionPoolRef, @Named(CoreModule.CTRL_CONF_LOCK) ReadWriteLock confLockRef, SystemConfRepository systemConfRepositoryRef, Provider<TransactionMgr> trnActProviderRef ) { super( new String[] { "DelCfgVal" }, "Deletes a configuration value", "Deletes an entry from the configuration.", PARAMETER_DESCRIPTIONS, null ); dbConnectionPool = dbConnectionPoolRef; confWrLock = confLockRef.writeLock(); systemConfRepository = systemConfRepositoryRef; trnActProvider = trnActProviderRef; }
Example #2
Source Project: watchpresenter Author: google File: MessagingEndpoint.java License: Apache License 2.0 | 6 votes |
/** * * @param versionNumber Version number for which message should be retrieved */ @ApiMethod(name = "getMessageForVersion") public VersionMessage getMessageForVersion(@Named("versionNumber")int versionNumber, User user) throws IOException, OAuthRequestException { if(user == null){ throw new OAuthRequestException("Not authorized"); } final String userId = PresenterRecord.getUserId(user.getEmail()); if(log.isLoggable(Level.FINE)) { log.fine("Get message version for userId " + userId + ". Version number: " + versionNumber); } VersionMessage message = new VersionMessage( VersionMessage.ACTION_NOTHING, "", ""); return message; }
Example #3
Source Project: quarkus Author: quarkusio File: KafkaRuntimeConfigProducer.java License: Apache License 2.0 | 6 votes |
@Produces @DefaultBean @ApplicationScoped @Named("default-kafka-broker") public Map<String, Object> createKafkaRuntimeConfig() { Map<String, Object> properties = new HashMap<>(); final Config config = ConfigProvider.getConfig(); StreamSupport .stream(config.getPropertyNames().spliterator(), false) .map(String::toLowerCase) .filter(name -> name.startsWith(configPrefix)) .distinct() .sorted() .forEach(name -> { final String key = name.substring(configPrefix.length() + 1).toLowerCase().replaceAll("[^a-z0-9.]", "."); final String value = config.getOptionalValue(name, String.class).orElse(""); properties.put(key, value); }); return properties; }
Example #4
Source Project: besu Author: hyperledger File: BlockchainModule.java License: Apache License 2.0 | 6 votes |
@Provides MutableWorldView getMutableWorldView( @Named("StateRoot") final Bytes32 stateRoot, final WorldStateStorage worldStateStorage, final WorldStatePreimageStorage worldStatePreimageStorage, final GenesisState genesisState, @Named("KeyValueStorageName") final String keyValueStorageName) { if ("memory".equals(keyValueStorageName)) { final DefaultMutableWorldState mutableWorldState = new DefaultMutableWorldState(worldStateStorage, worldStatePreimageStorage); genesisState.writeStateTo(mutableWorldState); return mutableWorldState; } else { return new DefaultMutableWorldState(stateRoot, worldStateStorage, worldStatePreimageStorage); } }
Example #5
Source Project: aptoide-client-v8 Author: Aptoide File: ApplicationModule.java License: GNU General Public License v3.0 | 6 votes |
@Singleton @Provides AnalyticsManager providesAnalyticsManager( @Named("aptoideLogger") EventLogger aptoideBiEventLogger, @Named("facebook") EventLogger facebookEventLogger, @Named("flurryLogger") EventLogger flurryEventLogger, HttpKnockEventLogger knockEventLogger, @Named("aptoideEvents") Collection<String> aptoideEvents, @Named("facebookEvents") Collection<String> facebookEvents, @Named("flurryEvents") Collection<String> flurryEvents, @Named("flurrySession") SessionLogger flurrySessionLogger, @Named("aptoideSession") SessionLogger aptoideSessionLogger, @Named("normalizer") AnalyticsEventParametersNormalizer analyticsNormalizer, @Named("rakamEventLogger") EventLogger rakamEventLogger, @Named("rakamEvents") Collection<String> rakamEvents, AnalyticsLogger logger) { return new AnalyticsManager.Builder().addLogger(aptoideBiEventLogger, aptoideEvents) .addLogger(facebookEventLogger, facebookEvents) .addLogger(flurryEventLogger, flurryEvents) .addLogger(rakamEventLogger, rakamEvents) .addSessionLogger(flurrySessionLogger) .addSessionLogger(aptoideSessionLogger) .setKnockLogger(knockEventLogger) .setAnalyticsNormalizer(analyticsNormalizer) .setDebugLogger(logger) .build(); }
Example #6
Source Project: che Author: eclipse File: ProbeScheduler.java License: Eclipse Public License 2.0 | 6 votes |
@Inject public ProbeScheduler( @Named("che.workspace.probe_pool_size") int probeSchedulerPoolSize, ExecutorServiceWrapper executorServiceWrapper) { probesExecutor = executorServiceWrapper.wrap( new ScheduledThreadPoolExecutor( probeSchedulerPoolSize, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("ServerProbes-%s") .build()), ProbeScheduler.class.getName()); timeouts = new Timer("ServerProbesTimeouts", true); probesFutures = new ConcurrentHashMap<>(); }
Example #7
Source Project: toothpick Author: stephanenicolas File: BindingToClassTest.java License: Apache License 2.0 | 6 votes |
@Test public void testBindingToClassAPI_withNameAsAnnotation_asSingleton() { // GIVEN Module module = new Module(); // WHEN module.bind(String.class).withName(Named.class).to(String.class).singleton(); // THEN Binding<String> binding = getBinding(module); assertBinding( binding, CLASS, String.class, Named.class.getCanonicalName(), String.class, null, null, null, true, false, false, false); }
Example #8
Source Project: nexus-public Author: sonatype File: ApplicationDirectoriesImpl.java License: Eclipse Public License 1.0 | 6 votes |
@Inject public ApplicationDirectoriesImpl(@Named("${karaf.base}") final File installDir, @Named("${karaf.data}") final File workDir) { this.installDir = resolve(installDir, false); log.debug("Install dir: {}", this.installDir); this.configDir = resolve(new File(installDir, "etc"), false); log.debug("Config dir: {}", this.configDir); this.workDir = resolve(workDir, true); log.debug("Work dir: {}", this.workDir); // Resolve the tmp dir from system properties. String tmplocation = System.getProperty("java.io.tmpdir", "tmp"); this.tempDir = resolve(new File(tmplocation), true); log.debug("Temp dir: {}", this.tempDir); }
Example #9
Source Project: che Author: eclipse File: JwtProxyProvisioner.java License: Eclipse Public License 2.0 | 6 votes |
@Inject public JwtProxyProvisioner( SignatureKeyManager signatureKeyManager, JwtProxyConfigBuilderFactory jwtProxyConfigBuilderFactory, ExternalServiceExposureStrategy externalServiceExposureStrategy, CookiePathStrategy cookiePathStrategy, @Named("che.server.secure_exposer.jwtproxy.image") String jwtProxyImage, @Named("che.server.secure_exposer.jwtproxy.memory_limit") String memoryLimitBytes, @Named("che.server.secure_exposer.jwtproxy.cpu_limit") String cpuLimitCores, @Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy, @Assisted RuntimeIdentity identity) throws InternalInfrastructureException { super( constructKeyPair(signatureKeyManager, identity), jwtProxyConfigBuilderFactory, externalServiceExposureStrategy, cookiePathStrategy, jwtProxyImage, memoryLimitBytes, cpuLimitCores, imagePullPolicy, identity.getWorkspaceId(), true); }
Example #10
Source Project: micronaut-kafka Author: micronaut-projects File: WordCountStream.java License: Apache License 2.0 | 6 votes |
@Singleton @Named(MY_STREAM) KStream<String, String> myStream( @Named(MY_STREAM) ConfiguredStreamBuilder builder) { // end::namedStream[] // set default serdes Properties props = builder.getConfiguration(); props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName()); props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName()); props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); KStream<String, String> source = builder.stream(NAMED_WORD_COUNT_INPUT); KTable<String, Long> counts = source .flatMapValues(value -> Arrays.asList(value.toLowerCase(Locale.getDefault()).split(" "))) .groupBy((key, value) -> value) .count(); // need to override value serde to Long type counts.toStream().to(NAMED_WORD_COUNT_OUTPUT, Produced.with(Serdes.String(), Serdes.Long())); return source; }
Example #11
Source Project: bisq Author: bisq-network File: CreateOfferDataModel.java License: GNU Affero General Public License v3.0 | 5 votes |
@Inject public CreateOfferDataModel(CreateOfferService createOfferService, OpenOfferManager openOfferManager, BtcWalletService btcWalletService, BsqWalletService bsqWalletService, Preferences preferences, User user, P2PService p2PService, PriceFeedService priceFeedService, AccountAgeWitnessService accountAgeWitnessService, FeeService feeService, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, MakerFeeProvider makerFeeProvider, Navigation navigation) { super(createOfferService, openOfferManager, btcWalletService, bsqWalletService, preferences, user, p2PService, priceFeedService, accountAgeWitnessService, feeService, btcFormatter, makerFeeProvider, navigation); }
Example #12
Source Project: micronaut-data Author: micronaut-projects File: DefaultJdbcRepositoryOperations.java License: Apache License 2.0 | 5 votes |
/** * Default constructor. * * @param dataSourceName The data source name * @param dataSource The datasource * @param transactionOperations The JDBC operations for the data source * @param executorService The executor service * @param beanContext The bean context * @param codecs The codecs * @param dateTimeProvider The dateTimeProvider */ protected DefaultJdbcRepositoryOperations(@Parameter String dataSourceName, DataSource dataSource, @Parameter TransactionOperations<Connection> transactionOperations, @Named("io") @Nullable ExecutorService executorService, BeanContext beanContext, List<MediaTypeCodec> codecs, @NonNull DateTimeProvider dateTimeProvider) { super( new ColumnNameResultSetReader(), new ColumnIndexResultSetReader(), new JdbcQueryStatement(), codecs, dateTimeProvider ); ArgumentUtils.requireNonNull("dataSource", dataSource); ArgumentUtils.requireNonNull("transactionOperations", transactionOperations); this.dataSource = dataSource; this.transactionOperations = transactionOperations; this.executorService = executorService; Collection<BeanDefinition<GenericRepository>> beanDefinitions = beanContext.getBeanDefinitions(GenericRepository.class, Qualifiers.byStereotype(Repository.class)); for (BeanDefinition<GenericRepository> beanDefinition : beanDefinitions) { String targetDs = beanDefinition.stringValue(Repository.class).orElse("default"); if (targetDs.equalsIgnoreCase(dataSourceName)) { Dialect dialect = beanDefinition.enumValue(JdbcRepository.class, "dialect", Dialect.class).orElseGet(() -> beanDefinition.enumValue(JdbcRepository.class, "dialectName", Dialect.class).orElse(Dialect.ANSI)); dialects.put(beanDefinition.getBeanType(), dialect); QueryBuilder qb = queryBuilders.get(dialect); if (qb == null) { queryBuilders.put(dialect, new SqlQueryBuilder(dialect)); } } } }
Example #13
Source Project: portals-pluto Author: apache File: PortletArtifactProducer.java License: Apache License 2.0 | 5 votes |
/** * Producer method for the ResourceRequest. * @return */ @Produces @PortletRequestScoped @Named("resourceRequest") @Typed(ResourceRequest.class) public static ResourceRequest produceResourceRequest() { PortletArtifactProducer pap = producers.get(); assert pap != null; ResourceRequest req = null; if (pap.req instanceof ResourceRequest) { req = (ResourceRequest) pap.req; } return req; }
Example #14
Source Project: neoscada Author: eclipse File: DefaultExecutableFactory.java License: Eclipse Public License 1.0 | 5 votes |
private String makeName ( final Annotation[] an ) { for ( final Annotation a : an ) { if ( a instanceof Named ) { return ( (Named)a ).value (); } } return null; }
Example #15
Source Project: joynr Author: bmwcarit File: MqttGlobalAddressFactory.java License: Apache License 2.0 | 5 votes |
@Inject public MqttGlobalAddressFactory(@Named(MessagingPropertyKeys.GBID_ARRAY) String[] gbids, @Named(MessagingPropertyKeys.CHANNELID) String localChannelId, MqttTopicPrefixProvider mqttTopicPrefixProvider) { defaultGbid = gbids[0]; this.localChannelId = localChannelId; this.mqttTopicPrefixProvider = mqttTopicPrefixProvider; }
Example #16
Source Project: mvp-android-arch-component Author: quangctkm9207 File: ApiServiceModule.java License: MIT License | 5 votes |
@Provides @Singleton Retrofit provideRetrofit(@Named(BASE_URL) String baseUrl, Converter.Factory converterFactory, CallAdapter.Factory callAdapterFactory, OkHttpClient client) { return new Retrofit.Builder().baseUrl(baseUrl) .addConverterFactory(converterFactory) .addCallAdapterFactory(callAdapterFactory) .client(client) .build(); }
Example #17
Source Project: nexus-public Author: sonatype File: OrientPyPiGroupFacet.java License: Eclipse Public License 1.0 | 5 votes |
@Inject public OrientPyPiGroupFacet(final RepositoryManager repositoryManager, final ConstraintViolationFactory constraintViolationFactory, @Named(GroupType.NAME) final Type groupType) { super(repositoryManager, constraintViolationFactory, groupType); }
Example #18
Source Project: attic-stratos Author: apache File: AWSEC2DestroyNodeStrategy.java License: Apache License 2.0 | 5 votes |
@Inject protected AWSEC2DestroyNodeStrategy(AWSEC2Api client, GetNodeMetadataStrategy getNode, @Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache, Map<String, Credentials> credentialStore) { super(client, getNode, elasticIpCache); this.client = checkNotNull(client, "client"); this.credentialStore = checkNotNull(credentialStore, "credentialStore"); }
Example #19
Source Project: endpoints-java Author: cloudendpoints File: WaxEndpoint.java License: Apache License 2.0 | 5 votes |
/** * Remove an existing session. * <p> * Clients that create sessions without a duration (will last forever) will need to call this * method on their own to clean up the session. * * @return {@link WaxRemoveSessionResponse} with the deleted session id * @throws InternalServerErrorException if the session deletion failed */ @ApiMethod( name = "sessions.remove", path = "removesession", httpMethod = HttpMethod.POST) public WaxRemoveSessionResponse removeSession(@Named("sessionId") String sessionId) throws InternalServerErrorException { try { store.deleteSession(sessionId); return new WaxRemoveSessionResponse(sessionId); } catch (InvalidSessionException e) { throw new InternalServerErrorException(e.getMessage()); } }
Example #20
Source Project: SciGraph Author: SciGraph File: GraphOwlVisitor.java License: Apache License 2.0 | 5 votes |
@Inject public GraphOwlVisitor(OWLOntologyWalker walker, Graph graph, @Named("owl.mappedProperties") List<MappedProperty> mappedProperties) { super(walker); this.graph = graph; this.mappedProperties = new HashMap<>(); for (MappedProperty mappedProperty : mappedProperties) { for (String property : mappedProperty.getProperties()) { this.mappedProperties.put(property, mappedProperty.getName()); } } }
Example #21
Source Project: bisq Author: bisq-network File: OfferBookChartView.java License: GNU Affero General Public License v3.0 | 5 votes |
@Inject public OfferBookChartView(OfferBookChartViewModel model, Navigation navigation, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, @Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) { super(model); this.navigation = navigation; this.formatter = formatter; this.useDevPrivilegeKeys = useDevPrivilegeKeys; }
Example #22
Source Project: heroic Author: spotify File: Slf4jQueryLoggerFactory.java License: Apache License 2.0 | 5 votes |
@Inject public Slf4jQueryLoggerFactory( @Named("logger") Consumer<String> logger, @Named(MediaType.APPLICATION_JSON) ObjectMapper objectMapper ) { this.logger = logger; this.objectMapper = objectMapper; }
Example #23
Source Project: endpoints-java Author: cloudendpoints File: AnnotationApiConfigGeneratorTest.java License: Apache License 2.0 | 5 votes |
@Test public void testValidEnumInParameter() throws Exception { @Api class EnumParameter { @SuppressWarnings("unused") public void pick(@Named("outcome") Outcome outcome) { } } String apiConfigSource = g.generateConfig(EnumParameter.class).get("myapi-v1.api"); ObjectNode root = objectMapper.readValue(apiConfigSource, ObjectNode.class); JsonNode request = root.path("methods").path("myapi.enumParameter.pick").path("request"); verifyMethodRequestParameter(request, "outcome", "string", true, false, "WON", "LOST", "TIE"); assertTrue(root.path("descriptor").path("schemas").path("Outcome").isMissingNode()); verifyEmptyMethodRequest(root, EnumParameter.class.getName() + ".pick"); }
Example #24
Source Project: unleash-maven-plugin Author: shillner File: ArtifactResolver.java License: Eclipse Public License 1.0 | 5 votes |
@Inject public ArtifactResolver(RepositorySystem repoSystem, RepositorySystemSession repoSession, @Named("projectRepositories") List<RemoteRepository> remoteProjectRepos, Logger log) { this.repoSession = repoSession; this.cache = CacheBuilder.newBuilder() .build(new ArtifactCacheLoader(repoSystem, repoSession, remoteProjectRepos, log)); }
Example #25
Source Project: nomulus Author: google File: CertificateSupplierModule.java License: Apache License 2.0 | 5 votes |
@Singleton @Provides @PemFile static Supplier<PrivateKey> providePemPrivateKeySupplier( @PemFile Provider<PrivateKey> privateKeyProvider, @Named("remoteCertCachingDuration") Duration cachingDuration) { return memoizeWithExpiration(privateKeyProvider::get, cachingDuration.getSeconds(), SECONDS); }
Example #26
Source Project: linstor-server Author: LINBIT File: ReqVlmAllocated.java License: GNU General Public License v3.0 | 5 votes |
@Inject public ReqVlmAllocated( ScopeRunner scopeRunnerRef, StltApiCallHandlerUtils apiCallHandlerUtilsRef, CommonSerializer commonSerializerRef, @Named(ApiModule.API_CALL_ID) Provider<Long> apiCallIdProviderRef ) { scopeRunner = scopeRunnerRef; apiCallHandlerUtils = apiCallHandlerUtilsRef; commonSerializer = commonSerializerRef; apiCallIdProvider = apiCallIdProviderRef; }
Example #27
Source Project: exchange-rates-mvvm Author: krokers File: ApplicationModule.java License: Apache License 2.0 | 5 votes |
@Override @Provides @Singleton @Named("remote") public CurrencyDataSource provideRemoteCurrencyDataSource(ApplicationProperties properties, final CurrencyDataApi currencyDataApi){ return new RetrofitCurrencyDataSource(currencyDataApi, properties.getOerAppId()); }
Example #28
Source Project: nexus-public Author: sonatype File: DynamicFilterChainManager.java License: Eclipse Public License 1.0 | 5 votes |
@Inject public DynamicFilterChainManager(@Named("SHIRO") final ServletContext servletContext, final List<FilterChain> filterChains, final BeanLocator locator) { super(new DelegatingFilterConfig("SHIRO", checkNotNull(servletContext))); this.filterChains = checkNotNull(filterChains); // install the watchers for dynamic components contributed by other bundles locator.watch(Key.get(Filter.class, Named.class), new FilterInstaller(), this); locator.watch(Key.get(FilterChain.class), new FilterChainRefresher(), this); }
Example #29
Source Project: fyber_mobile_offers Author: mohsenoid File: ClientModule.java License: MIT License | 5 votes |
@Provides @Singleton public Cache provideCache(@Named("cacheDir") File cacheDir, @Named("cacheSize") long cacheSize) { Cache cache = null; try { cache = new Cache(new File(cacheDir.getPath(), "http-cache"), cacheSize); } catch (Exception e) { e.printStackTrace(); } return cache; }
Example #30
Source Project: nexus-public Author: sonatype File: NexusLifecycleManagerTest.java License: Eclipse Public License 1.0 | 5 votes |
@Before public void setUp() throws Exception { phases = newArrayList( offPhase, kernelPhase, storagePhase, restorePhase, upgradePhase, schemasPhase, eventsPhase, securityPhase, servicesPhase, capabilitiesPhase, tasksPhase ); assertThat("One or more phases is not mocked", phases.size(), is(Phase.values().length)); // OFF phase should never get called doThrow(new Exception("testing")).when(offPhase).start(); doThrow(new Exception("testing")).when(offPhase).stop(); // randomize location results randomPhases = new ArrayList<>(phases); Collections.shuffle(randomPhases); Iterable<BeanEntry<Named, Lifecycle>> entries = randomPhases.stream().map(phase -> { BeanEntry<Named, Lifecycle> entry = mock(BeanEntry.class); doReturn(phase.getClass().getSuperclass()).when(entry).getImplementationClass(); when(entry.getValue()).thenReturn(phase); return entry; }).collect(toList()); when(locator.<Named, Lifecycle> locate(Key.get(Lifecycle.class, Named.class))).thenReturn(entries); underTest = new NexusLifecycleManager(locator, systemBundle); }