/** * Binds a new instance {@link Binding} using the information from the Jersey descriptor {@link InstanceBinding}. * <p> * Along with a new instance, the method is able to register aliases belonging to the new service. * * @param locator HK2 injection manager. * @param dc HK2 Dynamic configuration to bind the object. * @param activeDescriptor HK2 active descriptor. * @param aliases aliases belonging to the given descriptor. */ private static void bindBinding(ServiceLocator locator, DynamicConfiguration dc, ActiveDescriptor<?> activeDescriptor, Set<AliasBinding> aliases) { ActiveDescriptor<Object> boundDescriptor = dc.bind(activeDescriptor); for (AliasBinding alias : aliases) { dc.bind(createAlias(locator, boundDescriptor, alias)); } }
/** * Binds a new instance {@link Binding} using the information from the Jersey descriptor {@link InstanceBinding}. * <p> * Along with a new instance, the method is able to register aliases belonging to the new service. * * @param locator HK2 injection manager. * @param dc HK2 Dynamic configuration to bind the object. * @param activeDescriptor HK2 active descriptor. * @param aliases aliases belonging to the given descriptor. */ private static void bindBinding(ServiceLocator locator, DynamicConfiguration dc, ActiveDescriptor<?> activeDescriptor, Set<AliasBinding> aliases) { ActiveDescriptor<Object> boundDescriptor = dc.bind(activeDescriptor); for (AliasBinding alias : aliases) { dc.bind(createAlias(locator, boundDescriptor, alias)); } }
private static boolean addIfNotThere(ServiceLocator locator, DynamicConfiguration config, DescriptorImpl desc, HK2Loader loader) { IndexedFilter filter = BuilderHelper.createContractFilter(desc.getImplementation()); if (locator.getBestDescriptor(filter) != null) return false; if (loader != null) { desc.setLoader(loader); } config.bind(desc); return true; }
configurator.bind(BuilderHelper.link(ConfigSupport.class) .in(Singleton.class.getName()) .build()); configurator.bind(BuilderHelper.link(Transactions.class) .in(Singleton.class.getName()) .build()); configurator.bind(BuilderHelper.link(SimpleConfigBeanDomDecorator.class) .to(DomDecorator.class).in(Singleton.class.getName()) .build()); configurator.bind(BuilderHelper.link(ConfigurationPopulator.class) .in(Singleton.class.getName()) .build()); configurator.bind(BuilderHelper.link(DummyPopulator.class) .to(Populator.class).in(Singleton.class.getName()) .build());
/** * Binds a new instance {@link Binding} using the information from the Jersey descriptor {@link InstanceBinding}. * <p> * Along with a new instance, the method is able to register aliases belonging to the new service. * * @param locator HK2 injection manager. * @param dc HK2 Dynamic configuration to bind the object. * @param activeDescriptor HK2 active descriptor. * @param aliases aliases belonging to the given descriptor. */ private static void bindBinding(ServiceLocator locator, DynamicConfiguration dc, ActiveDescriptor<?> activeDescriptor, Set<AliasBinding> aliases) { ActiveDescriptor<Object> boundDescriptor = dc.bind(activeDescriptor); for (AliasBinding alias : aliases) { dc.bind(createAlias(locator, boundDescriptor, alias)); } }
@Override public <T> ActiveDescriptor<T> bind(Descriptor descriptor, boolean requiresDeepCopy) { setLoader(descriptor); return configuration().bind(descriptor, requiresDeepCopy); }
@Override public <T> ActiveDescriptor<T> bind(Descriptor descriptor, boolean requiresDeepCopy) { setLoader(descriptor); return configuration().bind(descriptor, requiresDeepCopy); }
@Override public <T> ActiveDescriptor<T> bind(Descriptor descriptor, boolean requiresDeepCopy) { setLoader(descriptor); return configuration().bind(descriptor, requiresDeepCopy); }
@Override public <T> ActiveDescriptor<T> bind(Descriptor descriptor, boolean requiresDeepCopy) { setLoader(descriptor); return configuration().bind(descriptor, requiresDeepCopy); }
protected void initializeServiceLocator(ServiceLocator serviceLocator) throws MultiException { DynamicConfigurationService dcs = serviceLocator .getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(Logger.getAnonymousLogger())); // default modules registry is the one that created the habitat config.bind(BuilderHelper.createConstantDescriptor(this)); ContextDuplicatePostProcessor processor = serviceLocator.getService(ContextDuplicatePostProcessor.class); if (processor == null) { config.addActiveDescriptor(ContextDuplicatePostProcessor.class); } config.commit(); }
protected void initializeServiceLocator(ServiceLocator serviceLocator) throws MultiException { DynamicConfigurationService dcs = serviceLocator .getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(Logger.getAnonymousLogger())); // default modules registry is the one that created the habitat config.bind(BuilderHelper.createConstantDescriptor(this)); ContextDuplicatePostProcessor processor = serviceLocator.getService(ContextDuplicatePostProcessor.class); if (processor == null) { config.addActiveDescriptor(ContextDuplicatePostProcessor.class); } config.commit(); }
@Override public ServiceLocator createServiceLocator(String name) throws MultiException { ServiceLocator serviceLocator = super.createServiceLocator(name); StartupContext sc = startupContext; if (startupContext==null) { sc = new StartupContext(new Properties()); } DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(sc)); config.commit(); return serviceLocator; }
@Override public ServiceLocator createServiceLocator(String name) throws MultiException { ServiceLocator serviceLocator = super.createServiceLocator(name); StartupContext sc = startupContext; if (startupContext==null) { sc = new StartupContext(new Properties()); } DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(sc)); config.commit(); return serviceLocator; }
private static boolean addIfNotThere(ServiceLocator locator, DynamicConfiguration config, DescriptorImpl desc, HK2Loader loader) { IndexedFilter filter = BuilderHelper.createContractFilter(desc.getImplementation()); if (locator.getBestDescriptor(filter) != null) return false; if (loader != null) { desc.setLoader(loader); } config.bind(desc); return true; }
private static boolean addIfNotThere(ServiceLocator locator, DynamicConfiguration config, DescriptorImpl desc, HK2Loader loader) { IndexedFilter filter = BuilderHelper.createContractFilter(desc.getImplementation()); if (locator.getBestDescriptor(filter) != null) return false; if (loader != null) { desc.setLoader(loader); } config.bind(desc); return true; }
@Override public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors, boolean requiresDeepCopy) { setLoader(factoryDescriptors.getFactoryAsAService()); setLoader(factoryDescriptors.getFactoryAsAFactory()); return configuration().bind(factoryDescriptors, requiresDeepCopy); }
@Override public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors, boolean requiresDeepCopy) { setLoader(factoryDescriptors.getFactoryAsAService()); setLoader(factoryDescriptors.getFactoryAsAFactory()); return configuration().bind(factoryDescriptors, requiresDeepCopy); }
@Override public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors, boolean requiresDeepCopy) { setLoader(factoryDescriptors.getFactoryAsAService()); setLoader(factoryDescriptors.getFactoryAsAFactory()); return configuration().bind(factoryDescriptors, requiresDeepCopy); }
@Override public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors, boolean requiresDeepCopy) { setLoader(factoryDescriptors.getFactoryAsAService()); setLoader(factoryDescriptors.getFactoryAsAFactory()); return configuration().bind(factoryDescriptors, requiresDeepCopy); }