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 ServiceLocatorImpl(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();
GuiceBridge.getGuiceBridge().initializeGuiceBridge(sli);
GuiceIntoHK2Bridge guiceBridge = sli.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(GuiceInjectorHolder.getInjector());
return sli;
}