@Override public void dropDatabase() throws DataAccessException { final ArangoDatabase db = db(); try { db.drop(); } catch (final ArangoDBException e) { throw translateExceptionIfPossible(e); } databaseCache.remove(db.name()); collectionCache.keySet().stream().filter(key -> key.getDb().equals(db.name())) .forEach(key -> collectionCache.remove(key)); }
@Override public void dropDatabase() throws DataAccessException { final ArangoDatabase db = db(); try { db.drop(); } catch (final ArangoDBException e) { throw translateExceptionIfPossible(e); } databaseCache.remove(db.name()); collectionCache.keySet().stream().filter(key -> key.getDb().equals(db.name())) .forEach(key -> collectionCache.remove(key)); }
@Override public UserEntity createUser(final String user, final String passwd, final UserCreateOptions options) throws ArangoDBException { return executor.execute(createUserRequest(db().name(), user, passwd, options), UserEntity.class); }
@Override public UserEntity updateUser(final String user, final UserUpdateOptions options) throws ArangoDBException { return executor.execute(updateUserRequest(db().name(), user, options), UserEntity.class); }
@Override public void deleteUser(final String user) throws ArangoDBException { executor.execute(deleteUserRequest(db().name(), user), Void.class); }
@Override public UserEntity getUser(final String user) throws ArangoDBException { return executor.execute(getUserRequest(db().name(), user), UserEntity.class); }
@Override public UserEntity replaceUser(final String user, final UserUpdateOptions options) throws ArangoDBException { return executor.execute(replaceUserRequest(db().name(), user, options), UserEntity.class); }
@Override public void drop() throws DataAccessException { collectionCache.remove(new CollectionCacheKey(collection.db().name(), collection.name())); try { collection.drop(); } catch (final ArangoDBException e) { throw translateExceptionIfPossible(e); } }
@Override public void drop() throws DataAccessException { collectionCache.remove(new CollectionCacheKey(collection.db().name(), collection.name())); try { collection.drop(); } catch (final ArangoDBException e) { throw translateExceptionIfPossible(e); } }
@Override public Collection<String> getAccessibleDatabasesFor(final String user) throws ArangoDBException { return executor.execute(getAccessibleDatabasesForRequest(db().name(), user), getAccessibleDatabasesForResponseDeserializer()); }
@Override public UserEntity createUser(final String user, final String passwd) throws ArangoDBException { return executor.execute(createUserRequest(db().name(), user, passwd, new UserCreateOptions()), UserEntity.class); }
@Override public Collection<String> getDatabases() throws ArangoDBException { return executor.execute(getDatabasesRequest(db().name()), getDatabaseResponseDeserializer()); }
@Override public Collection<UserEntity> getUsers() throws ArangoDBException { return executor.execute(getUsersRequest(db().name()), getUsersResponseDeserializer()); }
private ArangoCollection _collection( final String name, final ArangoPersistentEntity<?> persistentEntity, final CollectionCreateOptions options) { final ArangoDatabase db = db(); final Class<?> entityClass = persistentEntity != null ? persistentEntity.getType() : null; final CollectionCacheValue value = collectionCache.computeIfAbsent(new CollectionCacheKey(db.name(), name), key -> { final ArangoCollection collection = db.collection(name); if (!collection.exists()) { collection.create(options); } return new CollectionCacheValue(collection); }); final Collection<Class<?>> entities = value.getEntities(); final ArangoCollection collection = value.getCollection(); if (persistentEntity != null && !entities.contains(entityClass)) { value.addEntityClass(entityClass); ensureCollectionIndexes(collection(collection), persistentEntity); } return collection; }
private ArangoCollection _collection( final String name, final ArangoPersistentEntity<?> persistentEntity, final CollectionCreateOptions options) { final ArangoDatabase db = db(); final Class<?> entityClass = persistentEntity != null ? persistentEntity.getType() : null; final CollectionCacheValue value = collectionCache.computeIfAbsent(new CollectionCacheKey(db.name(), name), key -> { final ArangoCollection collection = db.collection(name); if (!collection.exists()) { collection.create(options); } return new CollectionCacheValue(collection); }); final Collection<Class<?>> entities = value.getEntities(); final ArangoCollection collection = value.getCollection(); if (persistentEntity != null && !entities.contains(entityClass)) { value.addEntityClass(entityClass); ensureCollectionIndexes(collection(collection), persistentEntity); } return collection; }