Fix details & convention to camel

This commit is contained in:
hyonzin 2016-10-18 18:31:00 +09:00
parent 5fa270da51
commit 429203d314
9 changed files with 63 additions and 63 deletions

View file

@ -76,7 +76,7 @@ public class LensInterpreter extends Interpreter {
private static Pattern s_queryExecutePattern = Pattern.compile(".*query\\s+execute\\s+(.*)");
private static Map<String, ExecutionDetail> s_paraToQH =
new ConcurrentHashMap<String, ExecutionDetail> (); //tracks paragraphID -> Lens QueryHandle
new ConcurrentHashMap<String, ExecutionDetail> (); //tracks paragraphId -> Lens QueryHandle
private static Map<LensClient, Boolean> s_clientMap =
new ConcurrentHashMap<LensClient, Boolean>();

View file

@ -70,7 +70,7 @@ public class NotebookRestApi {
Gson gson = new Gson();
private Notebook notebook;
private NotebookServer notebookServer;
private SearchService noteIndex;
private SearchService noteSearchService;
private NotebookAuthorization notebookAuthorization;
public NotebookRestApi() {
@ -79,7 +79,7 @@ public class NotebookRestApi {
public NotebookRestApi(Notebook notebook, NotebookServer notebookServer, SearchService search) {
this.notebook = notebook;
this.notebookServer = notebookServer;
this.noteIndex = search;
this.noteSearchService = search;
this.notebookAuthorization = notebook.getNotebookAuthorization();
}
@ -505,7 +505,7 @@ public class NotebookRestApi {
@ZeppelinApi
public Response stopNoteJobs(@PathParam("noteId") String noteId)
throws IOException, IllegalArgumentException {
LOG.info("stop notebook jobs {} ", noteId);
LOG.info("stop note jobs {} ", noteId);
Note note = notebook.getNote(noteId);
if (note == null) {
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build();
@ -554,7 +554,7 @@ public class NotebookRestApi {
public Response getNoteParagraphJobStatus(@PathParam("noteId") String noteId,
@PathParam("paragraphId") String paragraphId)
throws IOException, IllegalArgumentException {
LOG.info("get notebook paragraph job status.");
LOG.info("get note paragraph job status.");
Note note = notebook.getNote(noteId);
if (note == null) {
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build();
@ -829,7 +829,7 @@ public class NotebookRestApi {
HashSet<String> userAndRoles = new HashSet<>();
userAndRoles.add(principal);
userAndRoles.addAll(roles);
List<Map<String, String>> notes = noteIndex.query(queryTerm);
List<Map<String, String>> notes = noteSearchService.query(queryTerm);
for (int i = 0; i < notes.size(); i++) {
String[] Id = notes.get(i).get("id").split("/", 2);
String noteId = Id[0];

View file

@ -467,7 +467,7 @@ public class NotebookServer extends WebSocketServlet implements
}
public void saveInterpreterBindings(NotebookSocket conn, Message fromMessage) {
String noteId = (String) fromMessage.data.get("noteID");
String noteId = (String) fromMessage.data.get("noteId");
try {
List<String> settingIdList = gson.fromJson(String.valueOf(
fromMessage.data.get("selectedSettingIds")), new TypeToken<ArrayList<String>>() {
@ -482,9 +482,9 @@ public class NotebookServer extends WebSocketServlet implements
public void getInterpreterBindings(NotebookSocket conn, Message fromMessage)
throws IOException {
String noteID = (String) fromMessage.data.get("noteID");
String noteId = (String) fromMessage.data.get("noteId");
List<InterpreterSettingsList> settingList =
InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID);
InterpreterBindingUtils.getInterpreterBindings(notebook(), noteId);
conn.send(serializeMessage(new Message(OP.INTERPRETER_BINDINGS)
.put("interpreterBindings", settingList)));
}

View file

@ -89,8 +89,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setText(paragraphText);
note.persist(null);
String sourceNoteID = note.getId();
GetMethod get = httpGet("/notebook/" + sourceNoteID);
String sourceNoteId = note.getId();
GetMethod get = httpGet("/notebook/" + sourceNoteId);
LOG.info("testGetNotebookInfo \n" + get.getResponseBodyAsString());
assertThat("test notebook get method:", get, isAllowed());
@ -215,9 +215,9 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setConfig(config);
paragraph.setText("%md This is my new paragraph in my new note");
note.persist(null);
String sourceNoteID = note.getId();
String sourceNoteId = note.getId();
// Call export Notebook REST API
GetMethod get = httpGet("/notebook/export/" + sourceNoteID);
GetMethod get = httpGet("/notebook/export/" + sourceNoteId);
LOG.info("testNotebookExport \n" + get.getResponseBodyAsString());
assertThat("test notebook export method:", get, isAllowed());
@ -228,7 +228,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String exportJSON = (String) resp.get("body");
assertNotNull("Can not find new notejson", exportJSON);
LOG.info("export JSON:=" + exportJSON);
ZeppelinServer.notebook.removeNote(sourceNoteID, null);
ZeppelinServer.notebook.removeNote(sourceNoteId, null);
get.releaseConnection();
}
@ -248,9 +248,9 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setConfig(config);
paragraph.setText("%md This is my new paragraph in my new note");
note.persist(null);
String sourceNoteID = note.getId();
String sourceNoteId = note.getId();
// get note content as JSON
String oldJson = getNoteContent(sourceNoteID);
String oldJson = getNoteContent(sourceNoteId);
// call notebook post
PostMethod importPost = httpPost("/notebook/import/", oldJson);
assertThat(importPost, isCreated());
@ -310,12 +310,12 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setConfig(config);
paragraph.setText("%md This is my new paragraph in my new note");
note.persist(null);
String sourceNoteID = note.getId();
String sourceNoteId = note.getId();
String noteName = "clone Note Name";
// Call Clone Notebook REST API
String jsonRequest = "{\"name\":\"" + noteName + "\"}";
PostMethod post = httpPost("/notebook/" + sourceNoteID, jsonRequest);
PostMethod post = httpPost("/notebook/" + sourceNoteId, jsonRequest);
LOG.info("testNotebookClone \n" + post.getResponseBodyAsString());
assertThat("test notebook clone method:", post, isCreated());
@ -363,7 +363,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setText("%md This is test paragraph.");
note.persist(null);
String noteID = note.getId();
String noteId = note.getId();
note.runAll();
// wait until job is finished or timeout.
@ -377,24 +377,24 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
}
// Call Run Notebook Jobs REST API
PostMethod postNoteJobs = httpPost("/notebook/job/" + noteID, "");
PostMethod postNoteJobs = httpPost("/notebook/job/" + noteId, "");
assertThat("test notebook jobs run:", postNoteJobs, isAllowed());
postNoteJobs.releaseConnection();
// Call Stop Notebook Jobs REST API
DeleteMethod deleteNoteJobs = httpDelete("/notebook/job/" + noteID);
DeleteMethod deleteNoteJobs = httpDelete("/notebook/job/" + noteId);
assertThat("test notebook stop:", deleteNoteJobs, isAllowed());
deleteNoteJobs.releaseConnection();
Thread.sleep(1000);
// Call Run paragraph REST API
PostMethod postParagraph = httpPost("/notebook/job/" + noteID + "/" + paragraph.getId(), "");
PostMethod postParagraph = httpPost("/notebook/job/" + noteId + "/" + paragraph.getId(), "");
assertThat("test paragraph run:", postParagraph, isAllowed());
postParagraph.releaseConnection();
Thread.sleep(1000);
// Call Stop paragraph REST API
DeleteMethod deleteParagraph = httpDelete("/notebook/job/" + noteID + "/" + paragraph.getId());
DeleteMethod deleteParagraph = httpDelete("/notebook/job/" + noteId + "/" + paragraph.getId());
assertThat("test paragraph stop:", deleteParagraph, isAllowed());
deleteParagraph.releaseConnection();
Thread.sleep(1000);
@ -418,7 +418,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setText("%sh sleep 1");
note.persist(null);
String noteID = note.getId();
String noteId = note.getId();
note.runAll();
@ -428,7 +428,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
}
// assume that status of the paragraph is running
GetMethod get = httpGet("/notebook/job/" + noteID);
GetMethod get = httpGet("/notebook/job/" + noteId);
assertThat("test get notebook job: ", get, isAllowed());
String responseBody = get.getResponseBodyAsString();
get.releaseConnection();
@ -471,7 +471,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setText("%spark\nval param = z.input(\"param\").toString\nprintln(param)");
note.persist(null);
String noteID = note.getId();
String noteId = note.getId();
note.runAll();
// wait until job is finished or timeout.
@ -485,13 +485,13 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
}
// Call Run paragraph REST API
PostMethod postParagraph = httpPost("/notebook/job/" + noteID + "/" + paragraph.getId(),
PostMethod postParagraph = httpPost("/notebook/job/" + noteId + "/" + paragraph.getId(),
"{\"params\": {\"param\": \"hello\", \"param2\": \"world\"}}");
assertThat("test paragraph run:", postParagraph, isAllowed());
postParagraph.releaseConnection();
Thread.sleep(1000);
Note retrNote = ZeppelinServer.notebook.getNote(noteID);
Note retrNote = ZeppelinServer.notebook.getNote(noteId);
Paragraph retrParagraph = retrNote.getParagraph(paragraph.getId());
Map<String, Object> params = retrParagraph.settings.getParams();
assertEquals("hello", params.get("param"));

View file

@ -212,13 +212,13 @@
websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS'});
},
getInterpreterBindings: function(noteID) {
websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteID: noteID}});
getInterpreterBindings: function(noteId) {
websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteId: noteId}});
},
saveInterpreterBindings: function(noteID, selectedSettingIds) {
saveInterpreterBindings: function(noteId, selectedSettingIds) {
websocketEvents.sendNewEvent({op: 'SAVE_INTERPRETER_BINDINGS',
data: {noteID: noteID, selectedSettingIds: selectedSettingIds}});
data: {noteId: noteId, selectedSettingIds: selectedSettingIds}});
},
listConfigurations: function() {

View file

@ -232,17 +232,17 @@ public class Notebook implements NoteEventListener {
/**
* Clone existing note.
*
* @param sourceNoteID - the note ID to clone
* @param sourceNoteId - the note ID to clone
* @param newNoteName - the name of the new note
* @return noteId
* @throws IOException, CloneNotSupportedException, IllegalArgumentException
*/
public Note cloneNote(String sourceNoteID, String newNoteName, AuthenticationInfo subject)
public Note cloneNote(String sourceNoteId, String newNoteName, AuthenticationInfo subject)
throws IOException, CloneNotSupportedException, IllegalArgumentException {
Note sourceNote = getNote(sourceNoteID);
Note sourceNote = getNote(sourceNoteId);
if (sourceNote == null) {
throw new IllegalArgumentException(sourceNoteID + "not found");
throw new IllegalArgumentException(sourceNoteId + "not found");
}
Note newNote = createNote(subject);
if (newNoteName != null) {
@ -612,11 +612,11 @@ public class Notebook implements NoteEventListener {
return lastRunningUnixTime;
}
public List<Map<String, Object>> getJobListByParagraphId(String paragraphID) {
public List<Map<String, Object>> getJobListByParagraphId(String paragraphId) {
String gotNoteId = null;
List<Note> notes = getAllNotes();
for (Note note : notes) {
Paragraph p = note.getParagraph(paragraphID);
Paragraph p = note.getParagraph(paragraphId);
if (p != null) {
gotNoteId = note.getId();
}
@ -624,11 +624,11 @@ public class Notebook implements NoteEventListener {
return getJobListByNoteId(gotNoteId);
}
public List<Map<String, Object>> getJobListByNoteId(String noteID) {
public List<Map<String, Object>> getJobListByNoteId(String noteId) {
final String CRON_TYPE_NOTEBOOK_KEYWORD = "cron";
long lastRunningUnixTime = 0;
boolean isNotebookRunning = false;
Note jobNote = getNote(noteID);
boolean isNoteRunning = false;
Note jobNote = getNote(noteId);
List<Map<String, Object>> notesInfo = new LinkedList<>();
if (jobNote == null) {
return notesInfo;
@ -656,7 +656,7 @@ public class Notebook implements NoteEventListener {
for (Paragraph paragraph : jobNote.getParagraphs()) {
// check paragraph's status.
if (paragraph.getStatus().isRunning()) {
isNotebookRunning = true;
isNoteRunning = true;
}
// get data for the job manager.
@ -675,7 +675,7 @@ public class Notebook implements NoteEventListener {
// notebook json object root information.
info.put("interpreter", interpreterGroupName);
info.put("isRunningJob", isNotebookRunning);
info.put("isRunningJob", isNoteRunning);
info.put("unixTimeLastRun", lastRunningUnixTime);
info.put("paragraphs", paragraphsInfo);
notesInfo.add(info);

View file

@ -43,9 +43,9 @@ import org.slf4j.LoggerFactory;
public class NotebookRepoSync implements NotebookRepo {
private static final Logger LOG = LoggerFactory.getLogger(NotebookRepoSync.class);
private static final int maxRepoNum = 2;
private static final String pushKey = "pushNoteIDs";
private static final String pullKey = "pullNoteIDs";
private static final String delDstKey = "delDstNoteIDs";
private static final String pushKey = "pushNoteIds";
private static final String pullKey = "pullNoteIds";
private static final String delDstKey = "delDstNoteIds";
private static ZeppelinConfiguration config;
private static final String defaultStorage = "org.apache.zeppelin.notebook.repo.VFSNotebookRepo";
@ -186,38 +186,38 @@ public class NotebookRepoSync implements NotebookRepo {
List <NoteInfo> srcNotes = auth.filterByUser(allSrcNotes, subject);
List <NoteInfo> dstNotes = dstRepo.list(subject);
Map<String, List<String>> noteIDs = notesCheckDiff(srcNotes, srcRepo, dstNotes, dstRepo,
Map<String, List<String>> noteIds = notesCheckDiff(srcNotes, srcRepo, dstNotes, dstRepo,
subject);
List<String> pushNoteIDs = noteIDs.get(pushKey);
List<String> pullNoteIDs = noteIDs.get(pullKey);
List<String> delDstNoteIDs = noteIDs.get(delDstKey);
List<String> pushNoteIds = noteIds.get(pushKey);
List<String> pullNoteIds = noteIds.get(pullKey);
List<String> delDstNoteIds = noteIds.get(delDstKey);
if (!pushNoteIDs.isEmpty()) {
if (!pushNoteIds.isEmpty()) {
LOG.info("Notes with the following IDs will be pushed");
for (String id : pushNoteIDs) {
for (String id : pushNoteIds) {
LOG.info("ID : " + id);
}
pushNotes(subject, pushNoteIDs, srcRepo, dstRepo);
pushNotes(subject, pushNoteIds, srcRepo, dstRepo);
} else {
LOG.info("Nothing to push");
}
if (!pullNoteIDs.isEmpty()) {
if (!pullNoteIds.isEmpty()) {
LOG.info("Notes with the following IDs will be pulled");
for (String id : pullNoteIDs) {
for (String id : pullNoteIds) {
LOG.info("ID : " + id);
}
pushNotes(subject, pullNoteIDs, dstRepo, srcRepo);
pushNotes(subject, pullNoteIds, dstRepo, srcRepo);
} else {
LOG.info("Nothing to pull");
}
if (!delDstNoteIDs.isEmpty()) {
if (!delDstNoteIds.isEmpty()) {
LOG.info("Notes with the following IDs will be deleted from dest");
for (String id : delDstNoteIDs) {
for (String id : delDstNoteIds) {
LOG.info("ID : " + id);
}
deleteNotes(subject, delDstNoteIDs, dstRepo);
deleteNotes(subject, delDstNoteIds, dstRepo);
} else {
LOG.info("Nothing to delete from dest");
}

View file

@ -135,9 +135,9 @@ public class Message {
UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS, // [c-s] unsubscribe job information for job management
// @param unixTime
GET_INTERPRETER_BINDINGS, // [c-s] get interpreter bindings
// @param noteID
// @param noteId
SAVE_INTERPRETER_BINDINGS, // [c-s] save interpreter bindings
// @param noteID
// @param noteId
// @param selectedSettingIds
INTERPRETER_BINDINGS, // [s-c] interpreter bindings
ERROR_INFO // [s-c] error information to be sent

View file

@ -415,7 +415,7 @@ public class NotebookTest implements JobListenerFactory{
Paragraph cp = cloneNote.paragraphs.get(0);
assertEquals(cp.getStatus(), Status.READY);
// Keep same ParagraphID
// Keep same ParagraphId
assertEquals(cp.getId(), p.getId());
assertEquals(cp.text, p.text);
assertEquals(cp.getResult().message(), p.getResult().message());
@ -458,7 +458,7 @@ public class NotebookTest implements JobListenerFactory{
Note cloneNote = notebook.cloneNote(note.getId(), "clone note with Exception result", null);
Paragraph cp = cloneNote.paragraphs.get(0);
// Keep same ParagraphID
// Keep same ParagraphId
assertEquals(cp.getId(), p.getId());
assertEquals(cp.text, p.text);
assertNull(cp.getResult());