Java 类com.google.inject.name.Named 实例源码

项目:bromium    文件:DefaultModule.java   
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);
}
项目:abhot    文件:KairosDatastore.java   
@SuppressWarnings("ResultOfMethodCallIgnored")
@Inject
public KairosDatastore(Datastore datastore, QueryQueuingManager queuingManager,
        List<DataPointListener> dataPointListeners, KairosDataPointFactory dataPointFactory,
        @Named(KEEP_CACHE_FILES) boolean keepCacheFiles)
        throws DatastoreException
{
    m_datastore = checkNotNull(datastore);
    m_dataPointListeners = checkNotNull(dataPointListeners);
    m_queuingManager = checkNotNull(queuingManager);
    m_dataPointFactory = dataPointFactory;

    m_baseCacheDir = System.getProperty("java.io.tmpdir") + "/kairos_cache/";
    m_keepCacheFiles = keepCacheFiles;

    setupCacheDirectory();
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOURIProvider.class)
public ProxyDriverIntegrator getProxyDriverIntegrator(IOProvider<RequestFilter> requestFilterIOProvider,
                                                      IOProvider<ResponseFilter> responseFilterIOURIProvider,
                                                      WebDriverSupplier webDriverSupplier,
                                                      DriverServiceSupplier driverServiceSupplier,
                                                      @Named(PATH_TO_DRIVER) String pathToDriverExecutable,
                                                      @Named(SCREEN) String screen,
                                                      @Named(TIMEOUT) int timeout) throws IOException, URISyntaxException {
    return getProxyDriverIntegrator(requestFilterIOProvider.get(),
            webDriverSupplier,
            driverServiceSupplier,
            pathToDriverExecutable,
            screen,
            timeout,
            responseFilterIOURIProvider.get());
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides
@Named("publisherSaltCache")
@Singleton
public Cache<Long, String> getPublisherSaltLoadingCache(
        @Named("publisherSaltRedisCache") LoadingCache<Long, String> publisherSaltRedisCache) {
    LoadingCacheGuavaImpl<Long, String> l1Cache = new LoadingCacheGuavaImpl<>();
    l1Cache.setGuavaCache(CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS).build());
    l1Cache.setCacheLoader((key) -> publisherSaltRedisCache.get(key));

    return l1Cache;
}
项目:minebox    文件:LazyEncyptionKeyProvider.java   
private void watchParentDirectory(@Named("encryptionKeyPath") String encryptionKeyPath) {
    try {
        seedFile = Paths.get(encryptionKeyPath);
        watchService = FileSystems.getDefault().newWatchService();
        final Path parent = seedFile.getParent();
        if (!Files.isDirectory(parent)) {
            Files.createDirectories(parent);
        }
        watchKey = parent.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY);

    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
项目:tools    文件:MetaDataStatus.java   
@Inject
public MetaDataStatusProvider(
        @Named("parentDirs") List<String> parentDir,
        SerialNumberService serialNumberService) {

    this.parentDirs = parentDir;
    this.serialNumberService = serialNumberService;
}
项目:n4js    文件:TestTreeRegistryImpl.java   
@Inject
/* default */ TestTreeRegistryImpl(final TestFsmRegistry fsmRegistry,
        final @Named(TEST_TREE_TIMEOUT_KEY) long timeout) {
    this.fsmRegistry = fsmRegistry;
    this.timeout = timeout;
    cache = synchronizedMap(newHashMap());
    mutex = synchronizedMap(newHashMap());
}
项目:n4js    文件:TesterFacadeImpl.java   
@Inject
TesterFacadeImpl(final TestFsmRegistry fsmRegistry, final HttpServerManager serverManager,
        final InternalTestTreeRegistry treeRegistry, @Named(HTTP_SERVER_PORT_KEY) final int port) {

    this.fsmRegistry = fsmRegistry;
    this.serverManager = serverManager;
    this.treeRegistry = treeRegistry;
    this.port = port;
    this.actualPort = port; // try with default.
}
项目:clustercode    文件:TimeConstraint.java   
@Inject
protected TimeConstraint(@Named(ConstraintModule.CONSTRAINT_TIME_BEGIN_KEY) String begin,
                         @Named(ConstraintModule.CONSTRAINT_TIME_STOP_KEY) String stop,
                         Clock clock) {
    this.clock = clock;
    try {
        this.begin = LocalTime.parse(begin, formatter);
        this.stop = LocalTime.parse(stop, formatter);
    } catch (DateTimeParseException ex) {
        throw new InvalidConfigurationException("The time format is HH:mm. You specified: begin({}), stop({})", ex,
                begin, stop);
    }
    checkConfiguration();
}
项目:maven-artifacts-uploader    文件:XmlTagChanger.java   
@Inject
public XmlTagChanger(@Named("tagToChange") String tagToChange,
                     @Named("oldValue") String tagOldValue,
                     @Named("newValue") String tagNewValue) {
    this.tagToChange = tagToChange;
    this.tagOldValue = tagOldValue;
    this.tagNewValue = tagNewValue;
}
项目:Pogamut3    文件:UT2004LockableLocalWorldView.java   
@Inject
public UT2004LockableLocalWorldView(
        @Named(WORLDVIEW_DEPENDENCY) ComponentDependencies dependencies,
        ILifecycleBus bus, IAgentLogger logger, IMediator mediator,
        ISharedWorldView parentWorldView, ITeamedAgentId agentId) {
    super(dependencies, bus, logger, parentWorldView, agentId);
    mediator.setConsumer(this);
}
项目:abhot    文件:WebServer.java   
@Inject(optional = true)
public void setThreadPool(@Named(JETTY_THREADS_QUEUE_SIZE_PROPERTY) int maxQueueSize,
                            @Named(JETTY_THREADS_MIN_PROPERTY) int minThreads,
                            @Named(JETTY_THREADS_MAX_PROPERTY) int maxThreads,
                            @Named(JETTY_THREADS_KEEP_ALIVE_MS_PROPERTY) long keepAliveMs)
{
    LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueueSize);
    m_pool = new ExecutorThreadPool(minThreads, maxThreads, keepAliveMs, TimeUnit.MILLISECONDS, queue);
}
项目:abhot    文件:KairosDatastore.java   
@SuppressWarnings("UnusedDeclaration")
@Inject(optional = true)
public void setBaseCacheDir(@Named(QUERY_CACHE_DIR) String cacheTempDir)
{
    if (cacheTempDir != null && !cacheTempDir.equals(""))
    {
        m_baseCacheDir = cacheTempDir;
        setupCacheDirectory();
    }
}
项目:json2java4idea    文件:JavaConverterFactory.java   
@Inject
public JavaConverterFactory(@Nonnull Provider<PsiNameHelper> nameHelperProvider,
                            @Nonnull @Named("FieldName") Provider<NamePolicy> fieldNamePolicyProvider,
                            @Nonnull @Named("MethodName") Provider<NamePolicy> methodNamePolicyProvider,
                            @Nonnull @Named("ParameterName") Provider<NamePolicy> parameterNamePolicyProvider) {
    this.nameHelperProvider = nameHelperProvider;
    this.fieldNamePolicyProvider = fieldNamePolicyProvider;
    this.methodNamePolicyProvider = methodNamePolicyProvider;
    this.parameterNamePolicyProvider = parameterNamePolicyProvider;
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides
@Named("publisherSaltRedisCache")
@Singleton
public LoadingCache<Long, String> getLoadingCache(
        @Named("publisherSaltRedisDao") RedisDao<Long, String> publisherSaltRedisDao,
        PublisherDao publisherDao) {
    LoadingCacheRedisImpl<Long, String> l2Cache = new LoadingCacheRedisImpl<>();
    l2Cache.setRedisDao(publisherSaltRedisDao);
    l2Cache.setCacheLoader((key) -> publisherDao.read(key).map((publisher) -> {LOG.debug("found publisher for l3 [{}]", publisher.getSalt());return publisher.getSalt();}));

    return l2Cache;
}
项目:abhot    文件:WebServer.java   
@Inject
public WebServer(@Named(JETTY_ADDRESS_PROPERTY) String address,
        @Named(JETTY_PORT_PROPERTY) int port,
        @Named(JETTY_WEB_ROOT_PROPERTY) String webRoot)
        throws UnknownHostException
{
    checkNotNull(webRoot);

    m_port = port;
    m_webRoot = webRoot;
    m_address = InetAddress.getByName(address);
}
项目:Equella    文件:ViewItemAuditor.java   
@Inject
public void setAuditLevelString(@Named("audit.level") String auditLevelString)
{
    try
    {
        this.auditLevel = AuditLevel.valueOf(auditLevelString.toUpperCase());
    }
    catch( IllegalArgumentException e )
    {
        LOGGER.error("Could not parse audit.level property.  Setting to NONE");
        this.auditLevel = AuditLevel.NONE;
    }
}
项目:Equella    文件:CloudViewItemAuditor.java   
@Inject
public void setAuditLevelString(@Named("audit.level") String auditLevelString)
{
    try
    {
        this.auditLevel = AuditLevel.valueOf(auditLevelString.toUpperCase());
    }
    catch( IllegalArgumentException e )
    {
        LOGGER.error("Could not parse audit.level property.  Setting to NONE");
        this.auditLevel = AuditLevel.NONE;
    }
}
项目:abhot    文件:MetricReporterService.java   
@Inject
public MetricReporterService(KairosDatastore datastore,
        List<KairosMetricReporter> reporters,
        @Named(SCHEDULE_PROPERTY) String schedule,
        @Named(HOSTNAME) String hostname)
{
    m_datastore = checkNotNull(datastore);
    m_hostname = checkNotNullOrEmpty(hostname);
    m_reporters = reporters;
    m_schedule = schedule;
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides @Named("beanFactoryMap")
@Singleton
public Map<Class<?>, BeanFactory<?>> provideBeanFactoryMap(AuthenticatableBeanFactory authenticatableBeanFactory,
                                                           AuthenticationCredentialsBeanFactory credentialsBeanFactory) {
    Map<Class<?>, BeanFactory<?>> beanFactoryMap = new HashMap<>();

    beanFactoryMap.put(Authenticatable.class, authenticatableBeanFactory);
    beanFactoryMap.put(AuthenticationCredentials.class, credentialsBeanFactory);

    return beanFactoryMap;
}
项目:bromium    文件:ReplayCommand.java   
@Inject
public ReplayCommand(IOURIProvider<ReplayBrowser> replayBrowserProvider,
                     IOProvider<TestScenarioSteps> stepsProvider,
                     VirtualScreenProcessCreator virtualScreenProcessCreator,
                     @Named(SCREEN_NUMBER) Integer screenNumber,
                     @Named(MEASUREMENTS_FILE) File measurementsFile,
                     @Named(HAR_FILE) File harFile) {
    this.replayBrowserProvider = replayBrowserProvider;
    this.stepsProvider = stepsProvider;
    this.virtualScreenProcessCreator = virtualScreenProcessCreator;
    this.screenNumber = screenNumber;
    this.measurementsFile = measurementsFile;
    this.harFile = harFile;
}
项目:abhot    文件:PutMillisecondCommand.java   
@Inject
public PutMillisecondCommand(KairosDatastore datastore, @Named("HOSTNAME") String hostname,
        LongDataPointFactory longFactory, DoubleDataPointFactory doubleFactory)
{
    checkNotNullOrEmpty(hostname);
    m_hostName = hostname;
    m_datastore = datastore;
    m_longFactory = longFactory;
    m_doubleFactory = doubleFactory;
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides
@Named("passwordSaltRedisDao")
public RedisDao<String, String> getAdminSaltRedisDao(JedisPool jedisPool) {
    return new RedisDaoImpl<String, AuthenticatedEntity>()
            .setPrefix("ADMIN_SALT")
            .setPool(jedisPool)
            .setTtlSeconds(172800)
            .setDeserializer((salt) -> salt)
            .setSerializer((salt) -> salt);
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOProvider.class)
public ApplicationConfiguration getApplicationConfiguration(ApplicationConfigurationParser applicationConfigurationParser,
                                                            @Named(CONFIGURATION_FILE)
                                                            Provider<File> fileProvider) throws IOException {
    File file = fileProvider.get();
    return applicationConfigurationParser.parseApplicationConfiguration(file);
}
项目:VoxelGamesLibv2    文件:VoxelGamesLibModule.java   
@Provides
@Named("IgnoreExposedBS")
@Nonnull
public Gson getGsonWithoutExposed(@Nonnull Injector injector) {
    GsonBuilder builder = new GsonBuilder();
    addTypeAdapters(builder, injector);
    builder.setPrettyPrinting();
    return builder.create();
}
项目:abhot    文件:RollUpTasksFileStore.java   
@SuppressWarnings("ResultOfMethodCallIgnored")
@Inject
public RollUpTasksFileStore(@Named("STORE_DIRECTORY") String storeDirectory,
        QueryParser parser) throws IOException, RollUpException
{
    checkNotNullOrEmpty(storeDirectory);
    checkNotNull(parser);

    createStoreDirectory(storeDirectory);
    configFile = new File(storeDirectory, FILE_NAME);
    configFile.createNewFile();
    this.parser = parser;

    readFromFile();
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOProvider.class)
@Named(PAGE_LOADING_EVENT_DETECTOR)
public EventDetector getPageLoadingEventDetector(GetHtmlFromCurrentHostPredicate getHtmlFromCurrentHostPredicate,
                                                 IOProvider<RequestToPageLoadingEventConverter>
                                                         requestToPageLoadingEventConverterIOProvider) throws IOException {
    return new EventDetectorImpl(getHtmlFromCurrentHostPredicate,
            requestToPageLoadingEventConverterIOProvider.get());
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOProvider.class)
public List<EventDetector> getEventDetectors(@Named(CONVENTION_EVENT_DETECTOR) EventDetector conventionEventDetector,
                                             @Named(PAGE_LOADING_EVENT_DETECTOR) IOProvider<EventDetector>
                                                     pageLoadingEventDetectorIOProvider) throws IOException {
    List<EventDetector> eventDetectors = new ArrayList<>();
    eventDetectors.add(conventionEventDetector);
    eventDetectors.add(pageLoadingEventDetectorIOProvider.get());
    return eventDetectors;
}
项目:bromium    文件:DefaultModule.java   
@Provides
public List<ConditionsUpdater> getConditionsUpdaters(@Named(CONDITION_SATISFIED_PREDICATE)
                                                     Predicate<HttpRequest> conditionSatisfiedPredicate,
                                                     @Named(CONDITION_NOT_SATISFIED_PREDICATE)
                                                     Predicate<HttpRequest> conditionNotSatisfiedPredicate) {
    List<ConditionsUpdater> conditionsUpdaters = new ArrayList<>();
    conditionsUpdaters.add(new ConditionsUpdater(conditionSatisfiedPredicate, new SignalizingStateConditionsUpdater()));
    conditionsUpdaters.add(new ConditionsUpdater(conditionNotSatisfiedPredicate, ReplayingState::setConditionNotSatisfied));
    return conditionsUpdaters;
}
项目:tools    文件:StatusResource.java   
@Inject
public StatusResource(EncyptionKeyProvider encyptionKeyProvider
        , @Named("parentDirs") List<String> parentDirs
        , DownloadFactory downloadFactory
        , SerialNumberService serialNumberService) {

    this.encyptionKeyProvider = encyptionKeyProvider;
    this.parentDirs = parentDirs;
    this.downloadFactory = downloadFactory;
    this.serialNumberService = serialNumberService;
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides @Named("samlEntity")
@Singleton
public IdentityProviderDao provideSamlEntityDao(DbExecutor dbExecutor) throws Exception {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    Properties properties = new Properties();
    properties.load(classLoader.getResourceAsStream("dao/saml-entity-dao-db.properties"));

    return new IdentityProviderDaoDbImpl(properties.getProperty("saml-entity.dao.db.create"),
            properties.getProperty("saml-entity.dao.db.read"),
            properties.getProperty("saml-entity.dao.db.filter"),
            dbExecutor,
            SamlEntity.class);
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides
@Named("publisherSaltRedisDao")
@Singleton
public RedisDao<Long, String> getPublisherSaltRedisDao(JedisPool jedisPool) {
    return new RedisDaoImpl<String, AuthenticatedEntity>()
            .setPrefix("PUBLISHER_SALT")
            .setPool(jedisPool)
            .setTtlSeconds(172800)
            .setDeserializer((salt) -> salt)
            .setSerializer((salt) -> salt);
}
项目:abhot    文件:TelnetServer.java   
@Inject
public TelnetServer(@Named("kairosdb.telnetserver.address") String address,
        @Named("kairosdb.telnetserver.port") int port,
        @Named("kairosdb.telnetserver.max_command_size") int maxCommandLength,
        CommandProvider commandProvider)
        throws UnknownHostException
{
    checkArgument(maxCommandLength > 0, "command length must be greater than zero");

    this.port = port;
    this.maxCommandLength = maxCommandLength;
    this.commandProvider = checkNotNull(commandProvider);
    this.address = InetAddress.getByName(address);
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOProvider.class)
public RecordingJavascriptGenerator getRecordingJavascriptGenerator(@Named(BASE_RECORDING_TEMPLATE) IOProvider<String>
                                                                            baseTemplateProvider,
                                                                    JavascriptGenerator<ApplicationActionConfiguration>
                                                                            applicationActionJavascriptGenerator)
        throws IOException {
    return new RecordingJavascriptGenerator(baseTemplateProvider.get(), applicationActionJavascriptGenerator);
}
项目:abhot    文件:QueryQueuingManager.java   
@Inject
public QueryQueuingManager(@Named(CONCURRENT_QUERY_THREAD) int concurrentQueryThreads, @Named("HOSTNAME") String hostname)
{
    checkArgument(concurrentQueryThreads > 0);
    this.hostname = checkNotNullOrEmpty(hostname);
    semaphore = new Semaphore(concurrentQueryThreads, true);
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOProvider.class)
@Named(GENERATED_RECORD_JAVASCRIPT)
public String getGeneratedRecordJavascript(IOProvider<RecordingJavascriptGenerator> recordingJavascriptGeneratorIOProvider,
                                           IOProvider<ApplicationConfiguration> configurationIOProvider) throws IOException {
    ApplicationConfiguration configuration = configurationIOProvider.get();
    RecordingJavascriptGenerator recordingJavascriptGenerator = recordingJavascriptGeneratorIOProvider.get();
    return recordingJavascriptGenerator.generate(configuration);
}
项目:wayf-cloud    文件:WayfGuiceModule.java   
@Provides @Named("oauthEntity")
@Singleton
public IdentityProviderDao provideOauthEntityDao(DbExecutor dbExecutor) throws Exception {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    Properties properties = new Properties();

    properties.load(classLoader.getResourceAsStream("dao/oauth-entity-dao-db.properties"));

    return new IdentityProviderDaoDbImpl(properties.getProperty("oauth-entity.dao.db.create"),
            properties.getProperty("oauth-entity.dao.db.read"),
            properties.getProperty("oauth-entity.dao.db.filter"),
            dbExecutor,
            OauthEntity.class);
}
项目:bromium    文件:DefaultModule.java   
@CheckedProvides(IOProvider.class)
@Named(RECORDING_JAVASCRIPT_CODE)
public String getRecordingJavascriptCode(@Named(RECORDING_JAVASCRIPT_INJECTOR)
                                                 IOProvider<JavascriptInjectionPreparator> javascriptInjectorIOProvider) throws IOException {
    String generatedJavascriptCode = javascriptInjectorIOProvider.get().getInjectionCode();
    logger.debug(generatedJavascriptCode);
    return generatedJavascriptCode;
}
项目:abhot    文件:HectorConfiguration.java   
@Inject(optional = true)
public void setMaxActive(@Named(MAX_ACTIVE) int maxActive)
{
    hostConfig.setMaxActive(maxActive);
}
项目:abhot    文件:HectorConfiguration.java   
@Inject(optional = true)
public void setRunAutoDiscoveryAtStartup(@Named(RUN_AUTO_DISCOVERY_AT_STARTUP) boolean runAutoDiscoveryAtStartup)
{
    hostConfig.setRunAutoDiscoveryAtStartup(runAutoDiscoveryAtStartup);
}