@Override
  public Endpoint loadEndpoint(RepositoryInformation repoInfo) throws FedXException {

    File store = FileUtil.getFileLocation(repoInfo.getLocation());

    if (!store.exists()) {
      throw new FedXRuntimeException(
          "Store does not exist at '"
              + repoInfo.getLocation()
              + ": "
              + store.getAbsolutePath()
              + "'.");
    }

    try {
      NativeStore ns = new NativeStoreExt(store);
      SailRepository repo = new SailRepository(ns);
      repo.initialize();

      ProviderUtil.checkConnectionIfConfigured(repo);

      Endpoint res =
          new Endpoint(
              repoInfo.getId(),
              repoInfo.getName(),
              repoInfo.getLocation(),
              repoInfo.getType(),
              EndpointClassification.Local);
      res.setEndpointConfiguration(repoInfo.getEndpointConfiguration());
      res.setRepo(repo);

      // register a federated service manager to deal with this endpoint
      SAILFederatedService federatedService = new SAILFederatedService(res);
      federatedService.initialize();
      FederatedServiceManager.getInstance().registerService(repoInfo.getName(), federatedService);

      return res;
    } catch (RepositoryException e) {
      throw new FedXException(
          "Repository " + repoInfo.getId() + " could not be initialized: " + e.getMessage(), e);
    }
  }