mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Added 2 new methos in notebookRepoSync, exposed get and update notebook repo
This commit is contained in:
parent
8e890d3fec
commit
5a13e62ae0
1 changed files with 35 additions and 0 deletions
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.zeppelin.notebook.repo;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
|
@ -109,6 +111,39 @@ public class NotebookRepoSync implements NotebookRepo {
|
|||
}
|
||||
}
|
||||
|
||||
public List<NotebookRepoWithSettings> getNotebookRepos(AuthenticationInfo subject) {
|
||||
List<NotebookRepoWithSettings> reposSetting = Lists.newArrayList();
|
||||
|
||||
NotebookRepoWithSettings repoWithSettings;
|
||||
for (NotebookRepo repo : repos) {
|
||||
repoWithSettings = NotebookRepoWithSettings
|
||||
.builder(repo.getClass().getSimpleName())
|
||||
.className(repo.getClass().getName())
|
||||
.settings(repo.getSettings(subject))
|
||||
.build();
|
||||
reposSetting.add(repoWithSettings);
|
||||
}
|
||||
|
||||
return reposSetting;
|
||||
}
|
||||
|
||||
public NotebookRepoWithSettings updateNotebookRepo(String name, Map<String, String> settings,
|
||||
AuthenticationInfo subject) {
|
||||
NotebookRepoWithSettings updatedSettings = NotebookRepoWithSettings.EMPTY;
|
||||
for (NotebookRepo repo : repos) {
|
||||
if (repo.getClass().getName().equals(name)) {
|
||||
repo.updateSettings(settings, subject);
|
||||
updatedSettings = NotebookRepoWithSettings
|
||||
.builder(repo.getClass().getSimpleName())
|
||||
.className(repo.getClass().getName())
|
||||
.settings(repo.getSettings(subject))
|
||||
.build();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return updatedSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists Notebooks from the first repository
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue