Search in sources :

Example 1 with DynamicConfigurationImpl

use of org.jvnet.hk2.internal.DynamicConfigurationImpl in project jersey by jersey.

the class ServiceLocatorGenerator method create.

@Override
public ServiceLocator create(final String name, final ServiceLocator parent) {
    if (parent != null && !(parent instanceof ServiceLocatorImpl)) {
        throw new AssertionError("parent must be a " + ServiceLocatorImpl.class.getName() + " instead it is a " + parent.getClass().getName());
    }
    final ServiceLocatorImpl sli = new CustomServiceLocator(name, (ServiceLocatorImpl) parent);
    final DynamicConfigurationImpl dci = new DynamicConfigurationImpl(sli);
    // The service locator itself
    dci.bind(Utilities.getLocatorDescriptor(sli));
    // The injection resolver for three thirty
    dci.addActiveDescriptor(Utilities.getThreeThirtyDescriptor(sli));
    // The dynamic configuration utility
    dci.bind(BuilderHelper.link(DynamicConfigurationServiceImpl.class, false).to(DynamicConfigurationService.class).in(Singleton.class.getName()).localOnly().build());
    dci.bind(BuilderHelper.createConstantDescriptor(new DefaultClassAnalyzer(sli)));
    dci.commit();
    return sli;
}
Also used : DynamicConfigurationImpl(org.jvnet.hk2.internal.DynamicConfigurationImpl) DefaultClassAnalyzer(org.jvnet.hk2.internal.DefaultClassAnalyzer) DynamicConfigurationServiceImpl(org.jvnet.hk2.internal.DynamicConfigurationServiceImpl) ServiceLocatorImpl(org.jvnet.hk2.internal.ServiceLocatorImpl)

Aggregations

DefaultClassAnalyzer (org.jvnet.hk2.internal.DefaultClassAnalyzer)1 DynamicConfigurationImpl (org.jvnet.hk2.internal.DynamicConfigurationImpl)1 DynamicConfigurationServiceImpl (org.jvnet.hk2.internal.DynamicConfigurationServiceImpl)1 ServiceLocatorImpl (org.jvnet.hk2.internal.ServiceLocatorImpl)1