javax.inject.Named Java Examples
The following examples show how to use
javax.inject.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: CmdDeleteConfValue.java From linstor-server with 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 File: MessagingEndpoint.java From watchpresenter with 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 File: KafkaRuntimeConfigProducer.java From quarkus with 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 File: BlockchainModule.java From besu with 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 File: ApplicationModule.java From aptoide-client-v8 with 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 File: ProbeScheduler.java From che with 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 File: BindingToClassTest.java From toothpick with 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 File: ApplicationDirectoriesImpl.java From nexus-public with 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 File: JwtProxyProvisioner.java From che with 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 File: WordCountStream.java From micronaut-kafka with 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 File: CreateOfferDataModel.java From bisq with 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 File: DefaultJdbcRepositoryOperations.java From micronaut-data with 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 File: PortletArtifactProducer.java From portals-pluto with 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 File: DefaultExecutableFactory.java From neoscada with 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 File: MqttGlobalAddressFactory.java From joynr with 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 File: ApiServiceModule.java From mvp-android-arch-component with 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 File: OrientPyPiGroupFacet.java From nexus-public with 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 File: AWSEC2DestroyNodeStrategy.java From attic-stratos with 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 File: WaxEndpoint.java From endpoints-java with 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 File: GraphOwlVisitor.java From SciGraph with 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 File: OfferBookChartView.java From bisq with 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 File: Slf4jQueryLoggerFactory.java From heroic with 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 File: AnnotationApiConfigGeneratorTest.java From endpoints-java with 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 File: ArtifactResolver.java From unleash-maven-plugin with 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 File: CertificateSupplierModule.java From nomulus with 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 File: ReqVlmAllocated.java From linstor-server with 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 File: ApplicationModule.java From exchange-rates-mvvm with 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 File: DynamicFilterChainManager.java From nexus-public with 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 File: ClientModule.java From fyber_mobile_offers with 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 File: NexusLifecycleManagerTest.java From nexus-public with 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); }