ServiceImplementationConstructor constructor = _servicePoint.getServiceConstructor();
Object result = constructor.constructCoreServiceImplementation();
if (result == null)
throw new ApplicationRuntimeException(ServiceModelMessages
.factoryReturnedNull(_servicePoint), constructor.getLocation(), null);
// The factory should provice something that either implements the service interface
// or the declared interface. Again, they are normally the same, but with services
// defined in terms of a class (not an interface), the service interface is
// synthetic, and the declared interface is the actual class.
if (!(serviceInterface.isInstance(result) || declaredInterface.isInstance(result)))
throw new ApplicationRuntimeException(ServiceModelMessages.factoryWrongInterface(
_servicePoint,
result,
serviceInterface), constructor.getLocation(), null);
HiveMind.setLocation(result, constructor.getLocation());