protected final MapDatastoreProvider getProvider(SessionImplementor session) {
   if (provider == null) {
     DatastoreProvider service =
         session.getFactory().getServiceRegistry().getService(DatastoreProvider.class);
     if (service instanceof MapDatastoreProvider) {
       provider = (MapDatastoreProvider) service;
     } else {
       log.unexpectedDatastoreProvider(service.getClass(), MapDatastoreProvider.class);
     }
   }
   return provider;
 }
  @Override
  public DatastoreProvider initiateService(
      SessionFactoryImplementor sessionFactory,
      Configuration configuration,
      ServiceRegistryImplementor registry) {
    ConfigurationPropertyReader propertyReader =
        new ConfigurationPropertyReader(
            configuration, registry.getService(ClassLoaderService.class));

    DatastoreProvider datastoreProvider =
        propertyReader
            .property(DATASTORE_PROVIDER, DatastoreProvider.class)
            .withDefaultImplementation(DEFAULT_DATASTORE_PROVIDER)
            .withShortNameResolver(DatastoreProviderShortNameResolver.INSTANCE)
            .getValue();

    log.useDatastoreProvider(datastoreProvider.getClass().getName());
    return datastoreProvider;
  }