本文整理汇总了Java中org.glassfish.hk2.api.DynamicConfiguration.commit方法的典型用法代码示例。如果您正苦于以下问题:Java DynamicConfiguration.commit方法的具体用法?Java DynamicConfiguration.commit怎么用?Java DynamicConfiguration.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.glassfish.hk2.api.DynamicConfiguration
的用法示例。
在下文中一共展示了DynamicConfiguration.commit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import org.glassfish.hk2.api.DynamicConfiguration; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean bind(final Class<?> component, final Set<Class<?>> providerContracts) {
if (!managedClasses().contains(component)) {
return false;
}
LOG.trace("Binding {} {} to dependency injection", component, providerContracts);
final DynamicConfiguration dynamicConfig = Injections.getConfiguration(locator);
final DependencyInjectionFactory<Object> factory = new DependencyInjectionFactory<>(
(Class<Object>) component,
dependencyInjection()
);
final ServiceBindingBuilder<Object> binding = Injections.newFactoryBinder(factory)
.to(component);
(providerContracts == null ? Collections.<Class<?>>emptySet() : providerContracts).forEach(binding::to);
Injections.addBinding(binding, dynamicConfig);
dynamicConfig.commit();
return true;
}
示例2: link
import org.glassfish.hk2.api.DynamicConfiguration; //导入方法依赖的package包/类
/**
* @see #link(ServiceLocator, Injector)
* @see #newChildInjector(Injector, ServiceLocator)
*/
private static ServiceLocator link(ServiceLocator locator,
Injector injector, Iterable<? extends Binder> binders) {
DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
DynamicConfiguration dc = dcs.createDynamicConfiguration();
GuiceJustInTimeResolver resolver = new GuiceJustInTimeResolver(locator, injector);
dc.bind(BuilderHelper.createConstantDescriptor(resolver));
dc.addActiveDescriptor(GuiceScopeContext.class);
bind(locator, dc, new MessagingBinders.HeaderDelegateProviders());
for (Binder binder : binders) {
bind(locator, dc, binder);
}
dc.commit();
return locator;
}
示例3: RestApplication
import org.glassfish.hk2.api.DynamicConfiguration; //导入方法依赖的package包/类
@Inject
public RestApplication(ServiceLocator serviceLocator) {
DynamicConfiguration dc = Injections.getConfiguration(serviceLocator);
Injections.addBinding(Injections.newBinder(DatabaseClientService.class).to(IClientService.class),dc);
Injections.addBinding(Injections.newBinder(Configuration.class).to(IConfiguration.class),dc);
Injections.addBinding(Injections.newBinder(Configuration.class).to(IRSConfiguration.class),dc);
Injections.addBinding(Injections.newBinder(DefaultPrincipalUserService.class).to(IUserService.class),dc);
Injections.addBinding(Injections.newBinder(CachingAccessTokenStorage.class).to(IAccessTokenStorageService.class),dc);
Injections.addBinding(Injections.newBinder(IntegratedAccessTokenVerifier.class).to(IAccessTokenVerifier.class),dc);
Injections.addBinding(Injections.newBinder(RequestFactory.class).to(IRequestFactory.class),dc);
Injections.addBinding(Injections.newBinder(MD5TokenGenerator.class).to(ITokenGenerator.class),dc);
Injections.addBinding(Injections.newBinder(UUIDClientIdGenerator.class).to(IClientIdGenerator.class),dc);
EntityManagerFactory emf = new PersistenceProvider().get();
Injections.addBinding(Injections.newBinder(emf).to(EntityManagerFactory.class),dc);
CacheManager cacheManager = new DefaultCacheManagerProvider().get();
Injections.addBinding(Injections.newBinder(cacheManager).to(CacheManager.class),dc);
dc.commit();
}
示例4: finishBinding
import org.glassfish.hk2.api.DynamicConfiguration; //导入方法依赖的package包/类
/**
* Completes the {@link #activeBuilder} and adds it to the {@link #getLocator() service locator}
*/
private void finishBinding() {
if (activeBuilder != null) {
DynamicConfiguration config = ServiceLocatorUtilities.createDynamicConfiguration(getLocator());
BindingBuilderFactory.addBinding(activeBuilder, config);
config.commit();
activeBuilder = null;
}
}
示例5: RESTApplication
import org.glassfish.hk2.api.DynamicConfiguration; //导入方法依赖的package包/类
@Inject
public RESTApplication(ServiceLocator serviceLocator) {
log.info("Initialisation de l'application");
classes.add(LdapResource.class);
classes.add(NameNotFoundMapper.class);
classes.add(MultiPartFeature.class);
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
singletons.add(provider);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(SPRING_CONFIG);
Rest2LdapConfig config = ctx.getBean("rest2ldapConfig", Rest2LdapConfig.class);
ILdapDAO ldapDAO = ctx.getBean(ILdapDAO.class);
DynamicConfiguration dc = Injections.getConfiguration(serviceLocator);
Injections.addBinding(
Injections.newBinder(ctx).to(ApplicationContext.class), dc);
Injections.addBinding(
Injections.newBinder(config).to(Rest2LdapConfig.class), dc);
Injections.addBinding(
Injections.newBinder(ldapDAO).to(ILdapDAO.class), dc);
dc.commit();
testLdapConnection(ctx);
}