當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。