Esempio n. 1
0
 @Override
 public User accessUser(Object opaqueUser) {
   User user = new User(opaqueUser);
   for (DataStore dataStore : multiplexManager.dataStores) {
     DataStoreTransaction transaction = transactions.get(dataStore);
     user = transaction.accessUser(user.getOpaqueUser());
   }
   return user;
 }
Esempio n. 2
0
 @Override
 public <T> Object getRelation(
     Object entity,
     RelationshipType relationshipType,
     String relationName,
     Class<T> relationClass,
     EntityDictionary dictionary,
     Set<Predicate> filters) {
   DataStoreTransaction transaction = getTransaction(entity.getClass());
   return transaction.getRelation(
       entity, relationshipType, relationName, relationClass, dictionary, filters);
 }
Esempio n. 3
0
 @Override
 public <T> Object getRelation(
     Object entity,
     RelationshipType relationshipType,
     String relationName,
     Class<T> relationClass,
     EntityDictionary dictionary,
     Optional<FilterExpression> filterExpression,
     Sorting sorting,
     Pagination pagination) {
   DataStoreTransaction transaction = getTransaction(entity.getClass());
   return transaction.getRelation(
       entity,
       relationshipType,
       relationName,
       relationClass,
       dictionary,
       filterExpression,
       sorting,
       pagination);
 }
Esempio n. 4
0
  @Override
  public void close() throws IOException {

    IOException cause = null;
    for (DataStoreTransaction transaction : transactions.values()) {
      try {
        transaction.close();
      } catch (IOException | Error | RuntimeException e) {
        if (cause != null) {
          cause.addSuppressed(e);
        } else if (e instanceof IOException) {
          cause = (IOException) e;
        } else {
          cause = new IOException(e);
        }
      }
    }
    transactions.clear();
    if (cause != null) {
      throw cause;
    }
  }