本文整理汇总了Java中com.google.inject.Scopes类的典型用法代码示例。如果您正苦于以下问题:Java Scopes类的具体用法?Java Scopes怎么用?Java Scopes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scopes类属于com.google.inject包,在下文中一共展示了Scopes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindDriftClient
import com.google.inject.Scopes; //导入依赖的package包/类
private <T> DriftClientBindingBuilder bindDriftClient(Class<T> clientInterface, String configPrefix, Class<? extends Annotation> annotation)
{
Annotation clientAnnotation = getDriftClientAnnotation(clientInterface, annotation);
configBinder(binder).bindConfig(DriftClientConfig.class, clientAnnotation, configPrefix);
TypeLiteral<DriftClient<T>> typeLiteral = driftClientTypeLiteral(clientInterface);
Provider<T> instanceProvider = new DriftClientInstanceProvider<>(clientAnnotation, Key.get(typeLiteral, annotation));
Provider<DriftClient<T>> factoryProvider = new DriftClientProvider<>(clientInterface, clientAnnotation);
binder.bind(Key.get(clientInterface, annotation)).toProvider(instanceProvider).in(Scopes.SINGLETON);
binder.bind(Key.get(typeLiteral, annotation)).toProvider(factoryProvider).in(Scopes.SINGLETON);
if (annotation == DefaultClient.class) {
binder.bind(Key.get(clientInterface)).toProvider(instanceProvider).in(Scopes.SINGLETON);
binder.bind(Key.get(typeLiteral)).toProvider(factoryProvider).in(Scopes.SINGLETON);
}
return new DriftClientBindingBuilder(binder, clientAnnotation, configPrefix);
}
示例2: configure
import com.google.inject.Scopes; //导入依赖的package包/类
/**
* Contributes bindings and other configurations for this module to {@code binder}.
*
* @param binder binder
*/
@Override
public void configure(Binder binder)
{
binder.bind(HDFSConnectorId.class).toInstance(new HDFSConnectorId(connectorId));
binder.bind(TypeManager.class).toInstance(typeManager);
configBinder(binder).bindConfig(MetaConfig.class);
binder.bind(HDFSMetadataFactory.class).in(Scopes.SINGLETON);
binder.bind(HDFSMetadata.class).in(Scopes.SINGLETON);
binder.bind(FSFactory.class).in(Scopes.SINGLETON);
binder.bind(HDFSConnector.class).in(Scopes.SINGLETON);
binder.bind(HDFSSplitManager.class).in(Scopes.SINGLETON);
binder.bind(HDFSPageSourceProvider.class).in(Scopes.SINGLETON);
binder.bind(ClassLoader.class).toInstance(HDFSPlugin.getClassLoader());
}
示例3: configure
import com.google.inject.Scopes; //导入依赖的package包/类
protected void configure() {
bindConstant().annotatedWith(Names.named("executable.graphviz"))
.to(locality.getValue("executable.graphviz", "dot"));
bind(OSWfConfiguration.class).toInstance(oswfConfiguration);
// Service implementations are singletons
bind(OSWfServiceImpl.class).in(Scopes.SINGLETON);
bind(GraphvizServiceImpl.class).in(Scopes.SINGLETON);
bind(WfDefinitionServiceImpl.class).in(Scopes.SINGLETON);
// Bind interfaces to implementation classes
bind(OSWfService.class).to(OSWfServiceImpl.class);
bind(WfDefinitionService.class).to(WfDefinitionServiceImpl.class);
bind(GraphvizService.class).to(GraphvizServiceImpl.class);
}
示例4: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
public void configure(Binder binder)
{
log.info("INFORMATION: AmpoolMetadata configure() called.");
binder.bind(TypeManager.class).toInstance(typeManager);
binder.bind(AmpoolConnectorID.class).toInstance(new AmpoolConnectorID(connectorId));
binder.bind(AmpoolConnector.class).in(Scopes.SINGLETON);
binder.bind(AmpoolMetadata.class).in(Scopes.SINGLETON);
binder.bind(AmpoolClient.class).in(Scopes.SINGLETON);
binder.bind(AmpoolSplitManager.class).in(Scopes.SINGLETON);
binder.bind(AmpoolRecordSetProvider.class).in(Scopes.SINGLETON);
//configBinder(binder).bindConfig(AmpoolConfig.class);
/*
jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
jsonCodecBinder(binder).bindMapJsonCodec(String.class, listJsonCodec(AmpoolTable.class));
*/
}
示例5: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
protected void configure() {
// Bind core implementations of guacamole-ext classes
bind(AuthenticationProvider.class).toInstance(authProvider);
bind(Environment.class).toInstance(environment);
// Bind services
bind(ConfigurationService.class);
bind(UserDataService.class);
// Bind singleton ObjectMapper for JSON serialization/deserialization
bind(ObjectMapper.class).in(Scopes.SINGLETON);
// Bind singleton Jersey REST client
bind(Client.class).toInstance(Client.create(CLIENT_CONFIG));
}
示例6: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
protected void configure()
{
bind(Datastore.class).to(CassandraDatastore.class).in(Scopes.SINGLETON);
bind(CassandraDatastore.class).in(Scopes.SINGLETON);
bind(IncreaseMaxBufferSizesJob.class).in(Scopes.SINGLETON);
bind(CleanRowKeyCache.class).in(Scopes.SINGLETON);
bind(HectorConfiguration.class).in(Scopes.SINGLETON);
bind(CassandraConfiguration.class).in(Scopes.SINGLETON);
bind(new TypeLiteral<List<RowKeyListener>>()
{
}).toProvider(RowKeyListenerProvider.class);
bind(new TypeLiteral<Map<String, String>>(){}).annotatedWith(Names.named(CASSANDRA_AUTH_MAP))
.toInstance(m_authMap);
bind(new TypeLiteral<Map<String, Object>>(){}).annotatedWith(Names.named(CASSANDRA_HECTOR_MAP))
.toInstance(m_hectorMap);
}
示例7: setup
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
protected void setup(Binder binder)
{
binder.disableCircularProxies();
binder.bind(AgentMap.class).to(DiscoveryAgentMap.class).in(Scopes.SINGLETON);
binder.bind(RequestDispatcher.class).in(Scopes.SINGLETON);
binder.bind(Client.class).to(JerseyClient.class).in(Scopes.SINGLETON);
binder.bind(ResponseWrapper.class);
jaxrsBinder(binder).bind(ControllerConfigAPI.class);
jaxrsBinder(binder).bind(ControllerConnectorAPI.class);
jaxrsBinder(binder).bind(ControllerLogsAPI.class);
jaxrsBinder(binder).bind(ControllerPackageAPI.class);
jaxrsBinder(binder).bind(ControllerControlAPI.class);
jaxrsBinder(binder).bind(InstantConverterProvider.class);
discoveryBinder(binder).bindSelector("presto-manager");
}
示例8: module
import com.google.inject.Scopes; //导入依赖的package包/类
public static <C> PrivateModule module(final PropertyIdentifier propertyIdentifier, final ConfigDescriptor desc)
{
return new PrivateModule()
{
@Override
protected void configure()
{
// Alias the private module scoped bindings for the un-annotated ConstantValuePropertyAccessor and PropertyIdentifier to globally scoped and annotated ones.
// Intent here is to make the implementation of this nice and guicified but support a number of different instances.
bind(ConstantValuePropertyAccessor.class).to(Key.get(ConstantValuePropertyAccessor.class, propertyIdentifier));
bind(PropertyIdentifier.class).to(Key.get(PropertyIdentifier.class, propertyIdentifier));
TypeLiteral<PropertyAccessor<C>> accessorType = (TypeLiteral<PropertyAccessor<C>>) TypeLiteral.get(Types.newParameterizedType(PropertyAccessor.class, desc.getConfigType()));
bind(Key.get(accessorType, propertyIdentifier)).to(accessorType).in(Scopes.SINGLETON);
expose(Key.get(accessorType, propertyIdentifier));
}
};
}
示例9: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
protected void configure() {
bind(RequestHelper.class).in(Scopes.SINGLETON);
bind(MetadataManager.class).in(Scopes.SINGLETON);
bind(StateManager.class).in(Scopes.SINGLETON);
bind(TaskManager.class).in(Scopes.SINGLETON);
bind(DeployManager.class).in(Scopes.SINGLETON);
bind(RackManager.class).in(Scopes.SINGLETON);
bind(RequestManager.class).in(Scopes.SINGLETON);
bind(SlaveManager.class).in(Scopes.SINGLETON);
bind(TaskRequestManager.class).in(Scopes.SINGLETON);
bind(SandboxManager.class).in(Scopes.SINGLETON);
bind(SingularityValidator.class).in(Scopes.SINGLETON);
bind(ExecutorIdGenerator.class).in(Scopes.SINGLETON);
bind(WebhookManager.class).in(Scopes.SINGLETON);
}
示例10: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
protected void configure() {
bind(ObjectMapper.class).toInstance(JavaUtils.newObjectMapper());
bind(MetricRegistry.class).toInstance(new MetricRegistry());
SingularityRunnerBaseLogging.quietEagerLogging();
bind(Validator.class).toInstance(Validation.buildDefaultValidatorFactory().getValidator());
bind(SingularityRunnerExceptionNotifier.class).in(Scopes.SINGLETON);
final Optional<String> consolidatedConfigFilename = Optional.fromNullable(Strings.emptyToNull(System.getProperty(CONFIG_PROPERTY)));
final ConfigurationBinder configurationBinder = ConfigurationBinder.newBinder(binder());
configurationBinder.bindPrimaryConfiguration(primaryConfigurationClass, consolidatedConfigFilename);
for (Class<? extends BaseRunnerConfiguration> additionalConfigurationClass : additionalConfigurationClasses) {
configurationBinder.bindConfiguration(additionalConfigurationClass, consolidatedConfigFilename);
}
if (!additionalConfigurationClasses.contains(SingularityRunnerBaseConfiguration.class)) {
configurationBinder.bindConfiguration(SingularityRunnerBaseConfiguration.class, consolidatedConfigFilename);
}
bind(SingularityRunnerBaseLogging.class).asEagerSingleton();
bind(new TypeLiteral<Optional<String>>(){}).annotatedWith(Names.named(CONSOLIDATED_CONFIG_FILENAME)).toInstance(consolidatedConfigFilename);
}
示例11: configure
import com.google.inject.Scopes; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void configure() {
this.bind(DataSource.class)
.toInstance(DataSourceManager.get().load(this.name, this.configuration).get(this.name));
this.bind(JdbcTypeConverter.class).to(PostgreSqlTypeConverter.class).in(Scopes.SINGLETON);
this.bind(JdbcExceptionMapper.class).to(PostgreSqlExceptionMapper.class).in(Scopes.SINGLETON);
this.bind(ConnectorDatabaseService.class)
.to(ConnectorUtils.getDatabaseServiceClass(this.configuration, PostgreSqlConnectorDatabaseService.class))
.in(Scopes.SINGLETON);
this.bind(ConnectorTableService.class)
.to(ConnectorUtils.getTableServiceClass(this.configuration, JdbcConnectorTableService.class))
.in(Scopes.SINGLETON);
this.bind(ConnectorPartitionService.class)
.to(ConnectorUtils.getPartitionServiceClass(this.configuration, JdbcConnectorPartitionService.class))
.in(Scopes.SINGLETON);
}
示例12: configure
import com.google.inject.Scopes; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void configure() {
this.bind(DataSource.class)
.toInstance(DataSourceManager.get().load(this.name, this.configuration).get(this.name));
this.bind(JdbcTypeConverter.class).to(MySqlTypeConverter.class).in(Scopes.SINGLETON);
this.bind(JdbcExceptionMapper.class).to(MySqlExceptionMapper.class).in(Scopes.SINGLETON);
this.bind(ConnectorDatabaseService.class)
.to(ConnectorUtils.getDatabaseServiceClass(this.configuration, MySqlConnectorDatabaseService.class))
.in(Scopes.SINGLETON);
this.bind(ConnectorTableService.class)
.to(ConnectorUtils.getTableServiceClass(this.configuration, JdbcConnectorTableService.class))
.in(Scopes.SINGLETON);
this.bind(ConnectorPartitionService.class)
.to(ConnectorUtils.getPartitionServiceClass(this.configuration, JdbcConnectorPartitionService.class))
.in(Scopes.SINGLETON);
}
示例13: configure
import com.google.inject.Scopes; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void configure() {
this.bind(DataSource.class)
.toInstance(DataSourceManager.get().load(this.name, this.configuration).get(this.name));
this.bind(JdbcTypeConverter.class).to(RedshiftTypeConverter.class).in(Scopes.SINGLETON);
this.bind(JdbcExceptionMapper.class).to(RedshiftExceptionMapper.class).in(Scopes.SINGLETON);
this.bind(ConnectorDatabaseService.class)
.to(ConnectorUtils.getDatabaseServiceClass(this.configuration, JdbcConnectorDatabaseService.class))
.in(Scopes.SINGLETON);
this.bind(ConnectorTableService.class)
.to(ConnectorUtils.getTableServiceClass(this.configuration, RedshiftConnectorTableService.class))
.in(Scopes.SINGLETON);
this.bind(ConnectorPartitionService.class)
.to(ConnectorUtils.getPartitionServiceClass(this.configuration, JdbcConnectorPartitionService.class))
.in(Scopes.SINGLETON);
}
示例14: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
binder.bind(AlarmDao.class).to(AlarmDaoAllImpl.class).in(Scopes.SINGLETON);
binder.bind(AlarmService.class).to(AlarmServiceImpl.class).in(Scopes.SINGLETON);
binder.bind(RobotDao.class).to(RobotDaoHttpImpl.class).in(Scopes.SINGLETON);
binder.bind(RobotService.class).to(RobotServiceImpl.class).in(Scopes.SINGLETON);
// binder.bind(Jdbc.class).to(JdbcH2Impl.class).in(Scopes.SINGLETON);
// binder.bind(SqlSession.class).to(SqlSessionH2Impl.class).in(Scopes.SINGLETON);
// binder.bind(H2Dao.class).to(H2DaoImpl.class).in(Scopes.SINGLETON);
//
// binder.bind(DataSource.class).toProvider(DataSourceProvider.class).in(Scopes.SINGLETON);
//
// binder.bind(JedisTestnbImpl.class).toInstance(new JedisTestnbImpl());
// binder.bind(TransactionTestnbImpl.class).toInstance(new TransactionTestnbImpl());
}
示例15: configure
import com.google.inject.Scopes; //导入依赖的package包/类
@Override
protected void configure() {
bind(IBehaviorDeserialization.class).to(BehaviorDeserialization.class).in(Scopes.SINGLETON);
MapBinder<String, ILifecycleTask> lifecycleTaskPlugins
= MapBinder.newMapBinder(binder(), String.class, ILifecycleTask.class);
lifecycleTaskPlugins.addBinding("ai.labs.behavior").to(BehaviorRulesEvaluationTask.class);
MapBinder<String, IBehaviorExtension> behaviorExtensionPlugins
= MapBinder.newMapBinder(binder(), String.class, IBehaviorExtension.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.inputmatcher").
to(InputMatcher.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.actionmatcher").
to(ActionMatcher.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.contextmatcher").
to(ContextMatcher.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.connector").
to(Connector.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.dependency").
to(Dependency.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.negation").
to(Negation.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.occurrence").
to(Occurrence.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.resultsize").
to(ResultSize.class);
}