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


Java AbstractBinder类代码示例

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


AbstractBinder类属于org.glassfish.hk2.utilities.binding包,在下文中一共展示了AbstractBinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
    Configuration configuration = context.getConfiguration();
    if (!configuration.isRegistered(ConfigPropertyResolver.class)) {
        LOGGER.debug("Register ConfigPropertyFeature");
        context.register(ConfigPropertyResolver.class);
        context.register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(ConfigPropertyResolver.class)
                        .to(new TypeLiteral<InjectionResolver<ConfigProperty>>() {})
                        .in(Singleton.class);
            }
        });
    }
    return true;
}
 
开发者ID:protoxme,项目名称:protox-webapp-archetype,代码行数:18,代码来源:ConfigPropertyFeature.java

示例2: JerseyResourceConfig

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public JerseyResourceConfig() {

        register(new AbstractBinder() {
            @Override
            protected void configure() {
                bindFactory(ContextFactory.class)
                        .to(ServiceRequestContext.class).proxy(true)
                        .proxyForSameScope(false).in(RequestScoped.class);
            }
        });

        register(ActivityFilter.class);
        register(AuthenticationFilter.class);
        register(AuthorizationFilter.class);
        register(MethodFilter.class);
        register(VersionFilter.class);

        register(Health.class);
        register(Frontend.class);

        register(VersionedMessageProvider.class);
        register(ExceptionProvider.class);
    }
 
开发者ID:servicecatalog,项目名称:service-tools,代码行数:24,代码来源:JerseyResourceConfig.java

示例3: configure

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {

	context.register(new AbstractBinder() {

		@Override
		protected void configure() {

			Injector injector = ClientGuiceBridgeFeature.getInjector(context.getConfiguration());
			ClientGuiceInjectInjector injectInjector = new ClientGuiceInjectInjector(injector);

			bind(injectInjector).to(new TypeLiteral<InjectionResolver<com.google.inject.Inject>>() {
			});
		}
	});

	return true;
}
 
开发者ID:bootique,项目名称:bootique-jersey-client,代码行数:19,代码来源:ClientGuiceBridgeFeature.java

示例4: setUp

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator();
    ServiceLocatorUtilities.bind(locator, new AbstractBinder() {

        @Override
        protected void configure() {
            bind(SecurityService.class).to(SecurityService.class);
            bind(accountDao).to(AccountDao.class);
            bind(passwordDao).to(AccountPasswordDao.class);
            bind(userProvider).to(UserProvider.class);
            bind(event).to(new TypeLiteral<Event<SignedInEvent>>() {
            });
        }
    });
    locator.inject(this);
}
 
开发者ID:backpaper0,项目名称:sealion,代码行数:18,代码来源:SecurityServiceTest.java

示例5: XbddApplication

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public XbddApplication() {
	packages(getClass().getPackage().getName());

	// MVC feature
	property(JspMvcFeature.TEMPLATE_BASE_PATH, "/WEB-INF/jsp");
	register(JspMvcFeature.class);
	register(MultiPartFeature.class);

	// Logging.
	// register(LoggingFilter.class);

	property(ServerProperties.TRACING, TracingConfig.ON_DEMAND.name());

	register(new AbstractBinder() {
		@Override
		protected void configure() {
			bindFactory(ServletContextMongoClientFactory.class).to(MongoDBAccessor.class).in(Singleton.class);
		}
	});
}
 
开发者ID:orionhealth,项目名称:XBDD,代码行数:21,代码来源:XbddApplication.java

示例6: JerseyApplication

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public JerseyApplication() {
	property(CrnkProperties.RESOURCE_SEARCH_PACKAGE, "io.crnk.example.jersey.domain");
	property(CrnkProperties.RESOURCE_DEFAULT_DOMAIN, APPLICATION_URL);
	register(CrnkDynamicFeature.class);
	register(new AbstractBinder() {
		@Override
		public void configure() {
			bindFactory(ObjectMapperFactory.class).to(ObjectMapper.class).in(Singleton.class);
			bindService(TaskRepository.class);
			bindService(ProjectRepository.class);
			bindService(TaskToProjectRepository.class);
		}

		private void bindService(Class<?> serviceType) {
			bind(serviceType).to(serviceType).proxy(true).in(RequestScoped.class);
		}
	});

}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:20,代码来源:JerseyApplication.java

示例7: run

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
public void run(final CONFIG configuration,
                final Environment environment) {
    environment.jersey().register(auditedQueryResourceClass);
    environment.jersey().register(auditedDocRefResourceClass);
    environment.jersey().register(new AbstractBinder() {
        @Override
        protected void configure() {
            bind(QueryEventLoggingService.class).to(EventLoggingService.class);
            bind(queryServiceClass).to(QueryService.class);
            bind(docRefServiceClass).to(new ParameterizedTypeImpl(DocRefService.class, docRefEntityClass));
            bind(AuthorisationServiceImpl.class).to(AuthorisationService.class);
            bind(configuration.getAuthorisationServiceConfig()).to(AuthorisationServiceConfig.class);
            bind(configuration.getTokenConfig()).to(TokenConfig.class);
        }
    });
}
 
开发者ID:gchq,项目名称:stroom-query,代码行数:18,代码来源:AuditedQueryBundle.java

示例8: run

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
public void run(final CONFIG configuration,
                final Environment environment) throws Exception {

    environment.jersey().register(auditedQueryResourceClass);
    environment.jersey().register(auditedDocRefResourceClass);
    environment.jersey().register(new AbstractBinder() {
        @Override
        protected void configure() {
            bind(QueryEventLoggingService.class).to(EventLoggingService.class);

            final QueryService queryService =
                    new QueryServiceCriteriaImpl<>(AuditedCriteriaQueryBundle.this.queryableEntityClass, hibernateBundle.getSessionFactory());

            bind(queryService).to(QueryService.class);
            bind(hibernateBundle.getSessionFactory()).to(SessionFactory.class);
            bind(docRefServiceClass).to(new ParameterizedTypeImpl(DocRefService.class, docRefClass));
            bind(AuthorisationServiceImpl.class).to(AuthorisationService.class);
            bind(configuration.getAuthorisationServiceConfig()).to(AuthorisationServiceConfig.class);
            bind(configuration.getTokenConfig()).to(TokenConfig.class);
        }
    });

}
 
开发者ID:gchq,项目名称:stroom-query,代码行数:25,代码来源:AuditedCriteriaQueryBundle.java

示例9: init

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) throws Exception
{
    if(event.getSide().isServer())
        modpack = new Modpack(logger, solderConfig, gson);
    if(event.getSide().isServer() && solderConfig.isEnabled()) {

        logger.info("Loading mod MinecraftSolder");
        ResourceConfig config = new ResourceConfig()
                .packages("it.admiral0")
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(solderConfig);
                        bind(Loader.instance());
                        bind(modpack);
                        bind(gson);
                    }
                });
        HttpServer server = GrizzlyHttpServerFactory.createHttpServer(solderConfig.getBaseUri(), config);
        server.getServerConfiguration().addHttpHandler(
                new StaticHttpHandler(modpack.getSolderCache().toAbsolutePath().toString()), "/download"
        );
        server.start();
        logger.info("Server running on " + solderConfig.getBaseUri().toString());
    }else{
        logger.info("Mod is disabled.");
    }
}
 
开发者ID:admiral0,项目名称:MinecraftSolder,代码行数:30,代码来源:MinecraftSolder.java

示例10: backstopperOnlyExceptionMapperFactory_removes_all_exception_mappers_except_Jersey2ApiExceptionHandler

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Test
public void backstopperOnlyExceptionMapperFactory_removes_all_exception_mappers_except_Jersey2ApiExceptionHandler()
    throws NoSuchFieldException, IllegalAccessException {
    // given
    AbstractBinder lotsOfExceptionMappersBinder = new AbstractBinder() {
        @Override
        protected void configure() {
            bind(JsonMappingExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);
            bind(JsonParseExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);
            bind(generateJerseyApiExceptionHandler(projectApiErrors, utils)).to(ExceptionMapper.class);
        }
    };

    ServiceLocator locator = ServiceLocatorUtilities.bind(lotsOfExceptionMappersBinder);

    // when
    BackstopperOnlyExceptionMapperFactory overrideExceptionMapper = new BackstopperOnlyExceptionMapperFactory(locator);

    // then
    Set<Object> emTypesLeft = overrideExceptionMapper.getFieldObj(
        ExceptionMapperFactory.class, overrideExceptionMapper, "exceptionMapperTypes"
    );
    assertThat(emTypesLeft).hasSize(1);
    ServiceHandle serviceHandle = overrideExceptionMapper.getFieldObj(emTypesLeft.iterator().next(), "mapper");
    assertThat(serviceHandle.getService()).isInstanceOf(Jersey2ApiExceptionHandler.class);
}
 
开发者ID:Nike-Inc,项目名称:backstopper,代码行数:27,代码来源:Jersey2BackstopperConfigHelperTest.java

示例11: JerseyApplication

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public JerseyApplication() {
    property(KatharsisProperties.RESOURCE_SEARCH_PACKAGE, "io.katharsis.example.jersey.domain");
    property(KatharsisProperties.RESOURCE_DEFAULT_DOMAIN, APPLICATION_URL);
    register(KatharsisDynamicFeature.class);
    register(new AbstractBinder() {
        @Override
        public void configure() {
            bindFactory(ObjectMapperFactory.class).to(ObjectMapper.class).in(Singleton.class);
            bindService(TaskRepository.class);
            bindService(ProjectRepository.class);
            bindService(TaskToProjectRepository.class);
        }

        private void bindService(Class<?> serviceType) {
            bind(serviceType).to(serviceType).proxy(true).in(RequestScoped.class);
        }
    });

}
 
开发者ID:katharsis-project,项目名称:katharsis-framework,代码行数:20,代码来源:JerseyApplication.java

示例12: Main

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
private Main() {
    packages("us.askplatyp.kb.lucene.http");

    register(JacksonFeature.class);
    register(EntityFilteringFeature.class);
    register(new AbstractBinder() {
        @Override
        protected void configure() {
            bindFactory(WikidataLuceneIndexFactory.class).to(LuceneIndex.class);
        }
    });
    register(CORSFilter.class);
    register(ApiListingResource.class);
    register(SwaggerSerializers.class);
    EncodingFilter.enableFor(this, GZipEncoder.class);
    EncodingFilter.enableFor(this, DeflateEncoder.class);

    configureSwagger();
}
 
开发者ID:askplatypus,项目名称:platypus-kb-lucene,代码行数:20,代码来源:Main.java

示例13: configure

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
protected Application configure() {
    ResourceConfig resourceConfig = new ResourceConfig()
            .register(LocatorFeature.class)
            .register(JacksonFeature.class)
            .register(RxJerseyClientFeature.class)
            .register(ServerResource.class)
            .register(new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(RxJerseyTest.this).to(JerseyTest.class);
                }
            });

    configure(resourceConfig);

    return resourceConfig;
}
 
开发者ID:alex-shpak,项目名称:rx-jersey,代码行数:19,代码来源:RxJerseyTest.java

示例14: DefaultApplication

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
/**
 * Default constructor.
 */
public DefaultApplication() {
    // Parsec default bindings and registers
    super();

    register(new AbstractBinder() {
        @Override
        protected void configure() {
            // Add additional binding here
            // bind(<implementation>.class).to(<interface>.class)
        }
    });

    // Add additional register here
    // register(<resource>.class)
}
 
开发者ID:yahoo,项目名称:parsec,代码行数:19,代码来源:DefaultApplication.java

示例15: initializeServer

import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
private void initializeServer() {
	ResourceConfig resourceConfig = new ResourceConfig();
	resourceConfig.packages(GridServices.class.getPackage().getName());
	resourceConfig.register(JacksonJaxbJsonProvider.class);
	final Grid grid = this;
	
	resourceConfig.register(new AbstractBinder() {	
		@Override
		protected void configure() {
			bind(grid).to(Grid.class);
			bind(fileManager).to(FileProvider.class);
		}
	});
	ServletContainer servletContainer = new ServletContainer(resourceConfig);
			
	ServletHolder sh = new ServletHolder(servletContainer);
	ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
	context.setContextPath("/");
	context.addServlet(sh, "/*");

	server = new Server(port);
	
	ContextHandlerCollection contexts = new ContextHandlerCollection();
       contexts.setHandlers(new Handler[] { context});
	server.setHandler(contexts);
}
 
开发者ID:denkbar,项目名称:step,代码行数:27,代码来源:Grid.java


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