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


Java DynamicConfiguration类代码示例

本文整理汇总了Java中org.glassfish.hk2.api.DynamicConfiguration的典型用法代码示例。如果您正苦于以下问题:Java DynamicConfiguration类的具体用法?Java DynamicConfiguration怎么用?Java DynamicConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DynamicConfiguration类属于org.glassfish.hk2.api包,在下文中一共展示了DynamicConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: bind

import org.glassfish.hk2.api.DynamicConfiguration; //导入依赖的package包/类
@Override
default void bind(DynamicConfiguration config) {
    new AbstractBinder() {
        @Override
        protected void configure() {
            configureBindings(this);
        }
    }.bind(config);
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:10,代码来源:SimpleBinder.java

示例6: bind

import org.glassfish.hk2.api.DynamicConfiguration; //导入依赖的package包/类
@Override
public void bind(DynamicConfiguration config) {
  Injections.addBinding(
          Injections.newFactoryBinder(this).to(type).in(Singleton.class),
          config);
  Injections.addBinding(
          Injections.newBinder(this).to(ValueFactoryProvider.class),
          config);
}
 
开发者ID:silb,项目名称:shiro-jersey,代码行数:10,代码来源:TypeFactory.java

示例7: 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

示例8: bind

import org.glassfish.hk2.api.DynamicConfiguration; //导入依赖的package包/类
@Override
public void bind(DynamicConfiguration configuration) {
    super.bind(configuration);
    BootstrapExtensions.getImplementingBundles(bootstrap, SimpleBinder.class).forEach(bundle -> bundle.bind(configuration));
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:6,代码来源:BundleBinder.java

示例9: bind

import org.glassfish.hk2.api.DynamicConfiguration; //导入依赖的package包/类
/**
 * @see ServiceLocator#inject(Object)
 * @see Binder#bind(DynamicConfiguration)
 */
private static void bind(ServiceLocator locator, DynamicConfiguration dc, Binder binder) {
  locator.inject(binder);
  binder.bind(dc);
}
 
开发者ID:Squarespace,项目名称:jersey2-guice,代码行数:9,代码来源:JerseyGuiceUtils.java


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