当前位置: 首页>>代码示例>>Java>>正文


Java DynamicConfiguration.commit方法代码示例

本文整理汇总了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;
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:20,代码来源:ComponentProvider.java

示例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;
}
 
开发者ID:Squarespace,项目名称:jersey2-guice,代码行数:25,代码来源:JerseyGuiceUtils.java

示例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();
}
 
开发者ID:hburgmeier,项目名称:jerseyoauth2,代码行数:23,代码来源:RestApplication.java

示例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;
    }
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:12,代码来源:HK2Bundle.java

示例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);        
}
 
开发者ID:lgangloff,项目名称:ldap2rest,代码行数:28,代码来源:RESTApplication.java


注:本文中的org.glassfish.hk2.api.DynamicConfiguration.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。