http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/RunParagraphWithParametersRequest.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/RunParagraphWithParametersRequest.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/RunParagraphWithParametersRequest.java index be703da..48401d8 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/RunParagraphWithParametersRequest.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/RunParagraphWithParametersRequest.java @@ -17,21 +17,16 @@ package org.apache.zeppelin.rest.message; import com.google.gson.Gson; - import java.util.Map; - import org.apache.zeppelin.common.JsonSerializable; -/** - * RunParagraphWithParametersRequest rest api request message. - */ +/** RunParagraphWithParametersRequest rest api request message. */ public class RunParagraphWithParametersRequest implements JsonSerializable { private static final Gson gson = new Gson(); Map<String, Object> params; - public RunParagraphWithParametersRequest() { - } + public RunParagraphWithParametersRequest() {} public Map<String, Object> getParams() { return params;
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java index cc446e2..2a12c89 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java @@ -17,18 +17,14 @@ package org.apache.zeppelin.rest.message; import com.google.gson.Gson; - import java.util.List; import java.util.Map; - import org.apache.zeppelin.common.JsonSerializable; import org.apache.zeppelin.dep.Dependency; import org.apache.zeppelin.interpreter.InterpreterOption; import org.apache.zeppelin.interpreter.InterpreterProperty; -/** - * UpdateInterpreterSetting rest api request message. - */ +/** UpdateInterpreterSetting rest api request message. */ public class UpdateInterpreterSettingRequest implements JsonSerializable { private static final Gson gson = new Gson(); @@ -36,8 +32,10 @@ public class UpdateInterpreterSettingRequest implements JsonSerializable { List<Dependency> dependencies; InterpreterOption option; - public UpdateInterpreterSettingRequest(Map<String, InterpreterProperty> properties, - List<Dependency> dependencies, InterpreterOption option) { + public UpdateInterpreterSettingRequest( + Map<String, InterpreterProperty> properties, + List<Dependency> dependencies, + InterpreterOption option) { this.properties = properties; this.dependencies = dependencies; this.option = option; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateParagraphRequest.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateParagraphRequest.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateParagraphRequest.java index 9b0db40..5e343d0 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateParagraphRequest.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateParagraphRequest.java @@ -16,15 +16,12 @@ */ package org.apache.zeppelin.rest.message; -/** - * UpdateParagraphRequest. - */ +/** UpdateParagraphRequest. */ public class UpdateParagraphRequest { String title; String text; - public UpdateParagraphRequest() { - } + public UpdateParagraphRequest() {} public String getTitle() { return title; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/server/CorsFilter.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/server/CorsFilter.java b/zeppelin-server/src/main/java/org/apache/zeppelin/server/CorsFilter.java index efbd8c5..da30187 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/server/CorsFilter.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/server/CorsFilter.java @@ -16,12 +16,8 @@ */ package org.apache.zeppelin.server; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.net.URISyntaxException; - import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -30,13 +26,12 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.utils.SecurityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -/** - * Cors filter. - */ +/** Cors filter. */ public class CorsFilter implements Filter { private static final Logger LOGGER = LoggerFactory.getLogger(CorsFilter.class); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/server/JsonResponse.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/server/JsonResponse.java b/zeppelin-server/src/main/java/org/apache/zeppelin/server/JsonResponse.java index fcb4ea8..b7fe773 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/server/JsonResponse.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/server/JsonResponse.java @@ -18,9 +18,7 @@ package org.apache.zeppelin.server; import com.google.gson.Gson; import com.google.gson.GsonBuilder; - import java.util.ArrayList; - import javax.ws.rs.core.NewCookie; import javax.ws.rs.core.Response.ResponseBuilder; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/ConfigurationService.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/ConfigurationService.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/ConfigurationService.java index 280449b..40a27ff 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/ConfigurationService.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/ConfigurationService.java @@ -15,17 +15,15 @@ * limitations under the License. */ - package org.apache.zeppelin.service; +import java.io.IOException; +import java.util.Map; import javax.inject.Inject; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.Map; - public class ConfigurationService { private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationService.class); @@ -37,27 +35,30 @@ public class ConfigurationService { this.zConf = zConf; } - public Map<String, String> getAllProperties(ServiceContext context, - ServiceCallback<Map<String, String>> callback) - throws IOException { - Map<String, String> properties = zConf.dumpConfigurations(key -> - !key.contains("password") && - !key.equals(ZeppelinConfiguration.ConfVars - .ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING.getVarName())); + public Map<String, String> getAllProperties( + ServiceContext context, ServiceCallback<Map<String, String>> callback) throws IOException { + Map<String, String> properties = + zConf.dumpConfigurations( + key -> + !key.contains("password") + && !key.equals( + ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING + .getVarName())); callback.onSuccess(properties, context); return properties; } - public Map<String, String> getPropertiesWithPrefix(String prefix, - ServiceContext context, - ServiceCallback<Map<String, String>> callback) + public Map<String, String> getPropertiesWithPrefix( + String prefix, ServiceContext context, ServiceCallback<Map<String, String>> callback) throws IOException { - Map<String, String> properties = zConf.dumpConfigurations(key -> - !key.contains("password") && - !key.equals(ZeppelinConfiguration.ConfVars - .ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING - .getVarName()) && - key.startsWith(prefix)); + Map<String, String> properties = + zConf.dumpConfigurations( + key -> + !key.contains("password") + && !key.equals( + ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING + .getVarName()) + && key.startsWith(prefix)); callback.onSuccess(properties, context); return properties; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/InterpreterService.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/InterpreterService.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/InterpreterService.java index 331f838..e97cc09 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/InterpreterService.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/InterpreterService.java @@ -154,8 +154,9 @@ public class InterpreterService { if (null != serviceCallback) { try { serviceCallback.onFailure( - new Exception("Error while downloading " + request.getName() + " as " + - e.getMessage()), null); + new Exception( + "Error while downloading " + request.getName() + " as " + e.getMessage()), + null); } catch (IOException e1) { logger.error("ServiceCallback failure", e1); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java index 374d8ff..95628c2 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java @@ -17,6 +17,10 @@ package org.apache.zeppelin.service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.zeppelin.notebook.Note; import org.apache.zeppelin.notebook.Notebook; @@ -25,14 +29,7 @@ import org.apache.zeppelin.scheduler.Job; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * Service class for JobManager Page - */ +/** Service class for JobManager Page */ public class JobManagerService { private static final Logger LOGGER = LoggerFactory.getLogger(JobManagerService.class); @@ -43,9 +40,8 @@ public class JobManagerService { this.notebook = notebook; } - public List<NoteJobInfo> getNoteJobInfo(String noteId, - ServiceContext context, - ServiceCallback<List<NoteJobInfo>> callback) + public List<NoteJobInfo> getNoteJobInfo( + String noteId, ServiceContext context, ServiceCallback<List<NoteJobInfo>> callback) throws IOException { List<NoteJobInfo> notesJobInfo = new ArrayList<>(); Note jobNote = notebook.getNote(noteId); @@ -54,12 +50,11 @@ public class JobManagerService { return notesJobInfo; } - /** - * Get all NoteJobInfo after lastUpdateServerUnixTime - */ - public List<NoteJobInfo> getNoteJobInfoByUnixTime(long lastUpdateServerUnixTime, - ServiceContext context, - ServiceCallback<List<NoteJobInfo>> callback) + /** Get all NoteJobInfo after lastUpdateServerUnixTime */ + public List<NoteJobInfo> getNoteJobInfoByUnixTime( + long lastUpdateServerUnixTime, + ServiceContext context, + ServiceCallback<List<NoteJobInfo>> callback) throws IOException { List<Note> notes = notebook.getAllNotes(); List<NoteJobInfo> notesJobInfo = new ArrayList<>(); @@ -73,9 +68,9 @@ public class JobManagerService { return notesJobInfo; } - public void removeNoteJobInfo(String noteId, - ServiceContext context, - ServiceCallback<List<NoteJobInfo>> callback) throws IOException { + public void removeNoteJobInfo( + String noteId, ServiceContext context, ServiceCallback<List<NoteJobInfo>> callback) + throws IOException { List<NoteJobInfo> notesJobInfo = new ArrayList<>(); notesJobInfo.add(new NoteJobInfo(noteId, true)); callback.onSuccess(notesJobInfo, context); @@ -91,7 +86,6 @@ public class JobManagerService { } } - public static class ParagraphJobInfo { private String id; private String name; @@ -149,8 +143,8 @@ public class JobManagerService { } private boolean isCron(Note note) { - return note.getConfig().containsKey("cron") && - !StringUtils.isBlank(note.getConfig().get("cron").toString()); + return note.getConfig().containsKey("cron") + && !StringUtils.isBlank(note.getConfig().get("cron").toString()); } public NoteJobInfo(String noteId, boolean isRemoved) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java index e7a5f03..f59fe8b 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java @@ -17,6 +17,14 @@ package org.apache.zeppelin.service; +import static org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_HOMESCREEN; + +import java.io.IOException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.Interpreter; @@ -38,18 +46,7 @@ import org.apache.zeppelin.scheduler.Job; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_HOMESCREEN; - -/** - * Service class for Notebook related operations. - */ +/** Service class for Notebook related operations. */ public class NotebookService { private static final Logger LOGGER = LoggerFactory.getLogger(NotebookService.class); @@ -64,15 +61,15 @@ public class NotebookService { this.zConf = notebook.getConf(); } - public Note getHomeNote(ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public Note getHomeNote(ServiceContext context, ServiceCallback<Note> callback) + throws IOException { String noteId = notebook.getConf().getString(ZEPPELIN_NOTEBOOK_HOMESCREEN); Note note = null; if (noteId != null) { note = notebook.getNote(noteId); if (note != null) { - if (!checkPermission(noteId, Permission.READER, Message.OP.GET_HOME_NOTE, context, - callback)) { + if (!checkPermission( + noteId, Permission.READER, Message.OP.GET_HOME_NOTE, context, callback)) { return null; } } @@ -81,17 +78,15 @@ public class NotebookService { return note; } - public Note getNote(String noteId, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public Note getNote(String noteId, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { callback.onFailure(new NoteNotFoundException(noteId), context); return null; } - if (!checkPermission(noteId, Permission.READER, Message.OP.GET_NOTE, context, - callback)) { + if (!checkPermission(noteId, Permission.READER, Message.OP.GET_NOTE, context, callback)) { return null; } if (note.isPersonalizedMode()) { @@ -101,14 +96,15 @@ public class NotebookService { return note; } - - public Note createNote(String noteName, - String defaultInterpreterGroup, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public Note createNote( + String noteName, + String defaultInterpreterGroup, + ServiceContext context, + ServiceCallback<Note> callback) + throws IOException { if (defaultInterpreterGroup == null) { - defaultInterpreterGroup = zConf.getString( - ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_GROUP_DEFAULT); + defaultInterpreterGroup = + zConf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_GROUP_DEFAULT); } if (StringUtils.isBlank(noteName)) { noteName = "Untitled Note"; @@ -127,10 +123,8 @@ public class NotebookService { } } - - public void removeNote(String noteId, - ServiceContext context, - ServiceCallback<String> callback) throws IOException { + public void removeNote(String noteId, ServiceContext context, ServiceCallback<String> callback) + throws IOException { if (!checkPermission(noteId, Permission.OWNER, Message.OP.DEL_NOTE, context, callback)) { return; } @@ -142,9 +136,10 @@ public class NotebookService { } } - public List<Map<String, String>> listNotes(boolean needsReload, - ServiceContext context, - ServiceCallback<List<Map<String, String>>> callback) + public List<Map<String, String>> listNotes( + boolean needsReload, + ServiceContext context, + ServiceCallback<List<Map<String, String>>> callback) throws IOException { ZeppelinConfiguration conf = notebook.getConf(); @@ -175,10 +170,9 @@ public class NotebookService { return notesInfo; } - public void renameNote(String noteId, - String newNoteName, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public void renameNote( + String noteId, String newNoteName, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { if (!checkPermission(noteId, Permission.WRITER, Message.OP.NOTE_RENAME, context, callback)) { return; } @@ -192,38 +186,37 @@ public class NotebookService { } else { callback.onFailure(new NoteNotFoundException(noteId), context); } - } - public Note cloneNote(String noteId, - String newNoteName, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public Note cloneNote( + String noteId, String newNoteName, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note newNote = notebook.cloneNote(noteId, newNoteName, context.getAutheInfo()); callback.onSuccess(newNote, context); return newNote; } - public Note importNote(String noteName, - String noteJson, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public Note importNote( + String noteName, String noteJson, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note note = notebook.importNote(noteJson, noteName, context.getAutheInfo()); note.persist(context.getAutheInfo()); callback.onSuccess(note, context); return note; } - public boolean runParagraph(String noteId, - String paragraphId, - String title, - String text, - Map<String, Object> params, - Map<String, Object> config, - boolean failIfDisabled, - boolean blocking, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { + public boolean runParagraph( + String noteId, + String paragraphId, + String title, + String text, + Map<String, Object> params, + Map<String, Object> config, + boolean failIfDisabled, + boolean blocking, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { if (!checkPermission(noteId, Permission.RUNNER, Message.OP.RUN_PARAGRAPH, context, callback)) { return false; @@ -272,12 +265,14 @@ public class NotebookService { } } - public void runAllParagraphs(String noteId, - List<Map<String, Object>> paragraphs, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.RUNNER, Message.OP.RUN_ALL_PARAGRAPHS, context, - callback)) { + public void runAllParagraphs( + String noteId, + List<Map<String, Object>> paragraphs, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.RUNNER, Message.OP.RUN_ALL_PARAGRAPHS, context, callback)) { return; } @@ -297,20 +292,22 @@ public class NotebookService { Map<String, Object> params = (Map<String, Object>) raw.get("params"); Map<String, Object> config = (Map<String, Object>) raw.get("config"); - if (runParagraph(noteId, paragraphId, title, text, params, config, false, true, - context, callback)) { + if (runParagraph( + noteId, paragraphId, title, text, params, config, false, true, context, callback)) { // stop execution when one paragraph fails. break; } } } - public void cancelParagraph(String noteId, - String paragraphId, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.RUNNER, Message.OP.CANCEL_PARAGRAPH, context, - callback)) { + public void cancelParagraph( + String noteId, + String paragraphId, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.RUNNER, Message.OP.CANCEL_PARAGRAPH, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -325,13 +322,14 @@ public class NotebookService { callback.onSuccess(p, context); } - public void moveParagraph(String noteId, - String paragraphId, - int newIndex, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.MOVE_PARAGRAPH, context, - callback)) { + public void moveParagraph( + String noteId, + String paragraphId, + int newIndex, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission(noteId, Permission.WRITER, Message.OP.MOVE_PARAGRAPH, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -342,8 +340,8 @@ public class NotebookService { throw new ParagraphNotFoundException(paragraphId); } if (newIndex >= note.getParagraphCount()) { - callback.onFailure(new BadRequestException("newIndex " + newIndex + " is out of bounds"), - context); + callback.onFailure( + new BadRequestException("newIndex " + newIndex + " is out of bounds"), context); return; } note.moveParagraph(paragraphId, newIndex); @@ -351,12 +349,14 @@ public class NotebookService { callback.onSuccess(note.getParagraph(newIndex), context); } - public void removeParagraph(String noteId, - String paragraphId, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.PARAGRAPH_REMOVE, context, - callback)) { + public void removeParagraph( + String noteId, + String paragraphId, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.PARAGRAPH_REMOVE, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -371,13 +371,15 @@ public class NotebookService { callback.onSuccess(p, context); } - public Paragraph insertParagraph(String noteId, - int index, - Map<String, Object> config, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.INSERT_PARAGRAPH, context, - callback)) { + public Paragraph insertParagraph( + String noteId, + int index, + Map<String, Object> config, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.INSERT_PARAGRAPH, context, callback)) { return null; } Note note = notebook.getNote(noteId); @@ -391,11 +393,9 @@ public class NotebookService { return newPara; } - public void restoreNote(String noteId, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.RESTORE_NOTE, context, - callback)) { + public void restoreNote(String noteId, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { + if (!checkPermission(noteId, Permission.WRITER, Message.OP.RESTORE_NOTE, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -403,7 +403,7 @@ public class NotebookService { callback.onFailure(new NoteNotFoundException(noteId), context); return; } - //restore cron + // restore cron Map<String, Object> config = note.getConfig(); if (config.get("cron") != null) { notebook.refreshCron(note.getId()); @@ -413,21 +413,25 @@ public class NotebookService { String newName = note.getName().replaceFirst(Folder.TRASH_FOLDER_ID + "/", ""); renameNote(noteId, newName, context, callback); } else { - callback.onFailure(new IOException(String.format("Trying to restore a note {} " + - "which is not in Trash", noteId)), context); + callback.onFailure( + new IOException( + String.format("Trying to restore a note {} " + "which is not in Trash", noteId)), + context); } } - public void updateParagraph(String noteId, - String paragraphId, - String title, - String text, - Map<String, Object> params, - Map<String, Object> config, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.COMMIT_PARAGRAPH, context, - callback)) { + public void updateParagraph( + String noteId, + String paragraphId, + String title, + String text, + Map<String, Object> params, + Map<String, Object> config, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.COMMIT_PARAGRAPH, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -456,12 +460,14 @@ public class NotebookService { callback.onSuccess(p, context); } - public void clearParagraphOutput(String noteId, - String paragraphId, - ServiceContext context, - ServiceCallback<Paragraph> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.PARAGRAPH_CLEAR_OUTPUT, context, - callback)) { + public void clearParagraphOutput( + String noteId, + String paragraphId, + ServiceContext context, + ServiceCallback<Paragraph> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.PARAGRAPH_CLEAR_OUTPUT, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -476,8 +482,8 @@ public class NotebookService { } Paragraph returnedParagraph = null; if (note.isPersonalizedMode()) { - returnedParagraph = note.clearPersonalizedParagraphOutput(paragraphId, - context.getAutheInfo().getUser()); + returnedParagraph = + note.clearPersonalizedParagraphOutput(paragraphId, context.getAutheInfo().getUser()); } else { note.clearParagraphOutput(paragraphId); returnedParagraph = note.getParagraph(paragraphId); @@ -485,11 +491,10 @@ public class NotebookService { callback.onSuccess(returnedParagraph, context); } - public void clearAllParagraphOutput(String noteId, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.PARAGRAPH_CLEAR_ALL_OUTPUT, context, - callback)) { + public void clearAllParagraphOutput( + String noteId, ServiceContext context, ServiceCallback<Note> callback) throws IOException { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.PARAGRAPH_CLEAR_ALL_OUTPUT, context, callback)) { return; } Note note = notebook.getNote(noteId); @@ -502,15 +507,14 @@ public class NotebookService { callback.onSuccess(note, context); } - - - public void updateNote(String noteId, - String name, - Map<String, Object> config, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.NOTE_UPDATE, context, - callback)) { + public void updateNote( + String noteId, + String name, + Map<String, Object> config, + ServiceContext context, + ServiceCallback<Note> callback) + throws IOException { + if (!checkPermission(noteId, Permission.WRITER, Message.OP.NOTE_UPDATE, context, callback)) { return; } @@ -536,11 +540,11 @@ public class NotebookService { callback.onSuccess(note, context); } - private boolean isCronUpdated(Map<String, Object> configA, Map<String, Object> configB) { boolean cronUpdated = false; - if (configA.get("cron") != null && configB.get("cron") != null && configA.get("cron") - .equals(configB.get("cron"))) { + if (configA.get("cron") != null + && configB.get("cron") != null + && configA.get("cron").equals(configB.get("cron"))) { cronUpdated = true; } else if (configA.get("cron") == null && configB.get("cron") == null) { cronUpdated = false; @@ -551,12 +555,14 @@ public class NotebookService { return cronUpdated; } - public void saveNoteForms(String noteId, - Map<String, Object> noteParams, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { - if (!checkPermission(noteId, Permission.WRITER, Message.OP.SAVE_NOTE_FORMS, context, - callback)) { + public void saveNoteForms( + String noteId, + Map<String, Object> noteParams, + ServiceContext context, + ServiceCallback<Note> callback) + throws IOException { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.SAVE_NOTE_FORMS, context, callback)) { return; } @@ -571,18 +577,17 @@ public class NotebookService { callback.onSuccess(note, context); } - public void removeNoteForms(String noteId, - String formName, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public void removeNoteForms( + String noteId, String formName, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { callback.onFailure(new NoteNotFoundException(noteId), context); return; } - if (!checkPermission(noteId, Permission.WRITER, Message.OP.REMOVE_NOTE_FORMS, context, - callback)) { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.REMOVE_NOTE_FORMS, context, callback)) { return; } @@ -596,7 +601,8 @@ public class NotebookService { String noteId, String commitMessage, ServiceContext context, - ServiceCallback<NotebookRepoWithVersionControl.Revision> callback) throws IOException { + ServiceCallback<NotebookRepoWithVersionControl.Revision> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { @@ -604,8 +610,8 @@ public class NotebookService { return null; } - if (!checkPermission(noteId, Permission.WRITER, Message.OP.REMOVE_NOTE_FORMS, context, - callback)) { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.REMOVE_NOTE_FORMS, context, callback)) { return null; } @@ -618,7 +624,8 @@ public class NotebookService { public List<NotebookRepoWithVersionControl.Revision> listRevisionHistory( String noteId, ServiceContext context, - ServiceCallback<List<NotebookRepoWithVersionControl.Revision>> callback) throws IOException { + ServiceCallback<List<NotebookRepoWithVersionControl.Revision>> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { @@ -638,19 +645,17 @@ public class NotebookService { return revisions; } - - public Note setNoteRevision(String noteId, - String revisionId, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public Note setNoteRevision( + String noteId, String revisionId, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { callback.onFailure(new NoteNotFoundException(noteId), context); return null; } - if (!checkPermission(noteId, Permission.WRITER, Message.OP.SET_NOTE_REVISION, context, - callback)) { + if (!checkPermission( + noteId, Permission.WRITER, Message.OP.SET_NOTE_REVISION, context, callback)) { return null; } @@ -664,10 +669,9 @@ public class NotebookService { } } - public void getNotebyRevision(String noteId, - String revisionId, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public void getNotebyRevision( + String noteId, String revisionId, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { @@ -675,18 +679,16 @@ public class NotebookService { return; } - if (!checkPermission(noteId, Permission.READER, Message.OP.NOTE_REVISION, context, - callback)) { + if (!checkPermission(noteId, Permission.READER, Message.OP.NOTE_REVISION, context, callback)) { return; } Note revisionNote = notebook.getNoteByRevision(noteId, revisionId, context.getAutheInfo()); callback.onSuccess(revisionNote, context); } - public void getNoteByRevisionForCompare(String noteId, - String revisionId, - ServiceContext context, - ServiceCallback<Note> callback) throws IOException { + public void getNoteByRevisionForCompare( + String noteId, String revisionId, ServiceContext context, ServiceCallback<Note> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { @@ -694,8 +696,8 @@ public class NotebookService { return; } - if (!checkPermission(noteId, Permission.READER, Message.OP.NOTE_REVISION_FOR_COMPARE, context, - callback)) { + if (!checkPermission( + noteId, Permission.READER, Message.OP.NOTE_REVISION_FOR_COMPARE, context, callback)) { return; } Note revisionNote = null; @@ -713,7 +715,8 @@ public class NotebookService { String buffer, int cursor, ServiceContext context, - ServiceCallback<List<InterpreterCompletion>> callback) throws IOException { + ServiceCallback<List<InterpreterCompletion>> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { @@ -721,8 +724,7 @@ public class NotebookService { return null; } - if (!checkPermission(noteId, Permission.WRITER, Message.OP.COMPLETION, context, - callback)) { + if (!checkPermission(noteId, Permission.WRITER, Message.OP.COMPLETION, context, callback)) { return null; } @@ -736,10 +738,12 @@ public class NotebookService { } } - public void getEditorSetting(String noteId, - String replName, - ServiceContext context, - ServiceCallback<Map<String, Object>> callback) throws IOException { + public void getEditorSetting( + String noteId, + String replName, + ServiceContext context, + ServiceCallback<Map<String, Object>> callback) + throws IOException { Note note = notebook.getNote(noteId); if (note == null) { @@ -747,11 +751,18 @@ public class NotebookService { return; } try { - Interpreter intp = notebook.getInterpreterFactory().getInterpreter( - context.getAutheInfo().getUser(), noteId, replName, - notebook.getNote(noteId).getDefaultInterpreterGroup()); - Map<String, Object> settings = notebook.getInterpreterSettingManager(). - getEditorSetting(intp, context.getAutheInfo().getUser(), noteId, replName); + Interpreter intp = + notebook + .getInterpreterFactory() + .getInterpreter( + context.getAutheInfo().getUser(), + noteId, + replName, + notebook.getNote(noteId).getDefaultInterpreterGroup()); + Map<String, Object> settings = + notebook + .getInterpreterSettingManager() + .getEditorSetting(intp, context.getAutheInfo().getUser(), noteId, replName); callback.onSuccess(settings, context); } catch (InterpreterNotFoundException e) { callback.onFailure(new IOException("Fail to find interpreter", e), context); @@ -759,7 +770,6 @@ public class NotebookService { } } - enum Permission { READER, WRITER, @@ -768,8 +778,8 @@ public class NotebookService { } /** - * Return null when it is allowed, otherwise return the error message which could be - * propagated to frontend + * Return null when it is allowed, otherwise return the error message which could be propagated to + * frontend * * @param noteId * @param context @@ -777,11 +787,13 @@ public class NotebookService { * @param op * @return */ - private <T> boolean checkPermission(String noteId, - Permission permission, - Message.OP op, - ServiceContext context, - ServiceCallback<T> callback) throws IOException { + private <T> boolean checkPermission( + String noteId, + Permission permission, + Message.OP op, + ServiceContext context, + ServiceCallback<T> callback) + throws IOException { boolean isAllowed = false; Set<String> allowed = null; switch (permission) { @@ -805,9 +817,17 @@ public class NotebookService { if (isAllowed) { return true; } else { - String errorMsg = "Insufficient privileges to " + permission + " note.\n" + - "Allowed users or roles: " + allowed + "\n" + "But the user " + - context.getAutheInfo().getUser() + " belongs to: " + context.getUserAndRoles(); + String errorMsg = + "Insufficient privileges to " + + permission + + " note.\n" + + "Allowed users or roles: " + + allowed + + "\n" + + "But the user " + + context.getAutheInfo().getUser() + + " belongs to: " + + context.getUserAndRoles(); callback.onFailure(new ForbiddenException(errorMsg), context); return false; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceCallback.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceCallback.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceCallback.java index fd5af9e..a1ab090 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceCallback.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceCallback.java @@ -19,13 +19,12 @@ package org.apache.zeppelin.service; import java.io.IOException; -/** - * This will be used by service classes as callback mechanism. - */ +/** This will be used by service classes as callback mechanism. */ public interface ServiceCallback<T> { /** * Called when this service call is starting + * * @param message * @param context * @throws IOException @@ -34,6 +33,7 @@ public interface ServiceCallback<T> { /** * Called when this service call is succeed + * * @param result * @param context * @throws IOException @@ -41,11 +41,11 @@ public interface ServiceCallback<T> { void onSuccess(T result, ServiceContext context) throws IOException; /** - * Called when this service call is failed + * Called when this service call is failed + * * @param ex * @param context * @throws IOException */ void onFailure(Exception ex, ServiceContext context) throws IOException; - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceContext.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceContext.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceContext.java index 3db8bf8..390801c 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceContext.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/ServiceContext.java @@ -15,16 +15,12 @@ * limitations under the License. */ - package org.apache.zeppelin.service; -import org.apache.zeppelin.user.AuthenticationInfo; - import java.util.Set; +import org.apache.zeppelin.user.AuthenticationInfo; -/** - * Context info for Service call - */ +/** Context info for Service call */ public class ServiceContext { private AuthenticationInfo autheInfo; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/service/SimpleServiceCallback.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/SimpleServiceCallback.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/SimpleServiceCallback.java index 6957707..699f3e2 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/SimpleServiceCallback.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/SimpleServiceCallback.java @@ -15,18 +15,13 @@ * limitations under the License. */ - package org.apache.zeppelin.service; +import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; - -/** - * - * @param <T> - */ +/** @param <T> */ public class SimpleServiceCallback<T> implements ServiceCallback<T> { private static Logger LOGGER = LoggerFactory.getLogger(SimpleServiceCallback.class); @@ -45,5 +40,4 @@ public class SimpleServiceCallback<T> implements ServiceCallback<T> { public void onFailure(Exception ex, ServiceContext context) throws IOException { LOGGER.warn(ex.getMessage()); } - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-server/src/main/java/org/apache/zeppelin/socket/ConnectionManager.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/ConnectionManager.java b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/ConnectionManager.java index 5d02d9f..34351b5 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/ConnectionManager.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/ConnectionManager.java @@ -17,11 +17,22 @@ package org.apache.zeppelin.socket; - import com.google.common.collect.Queues; import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.commons.lang.StringUtils; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.display.GUI; @@ -37,30 +48,17 @@ import org.apache.zeppelin.util.WatcherSecurityKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; - -/** - * Manager class for managing websocket connections - */ +/** Manager class for managing websocket connections */ public class ConnectionManager { private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionManager.class); - private static Gson gson = new GsonBuilder() - .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") - .registerTypeAdapter(Date.class, new NotebookImportDeserializer()) - .setPrettyPrinting() - .registerTypeAdapterFactory(Input.TypeAdapterFactory).create(); + private static Gson gson = + new GsonBuilder() + .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") + .registerTypeAdapter(Date.class, new NotebookImportDeserializer()) + .setPrettyPrinting() + .registerTypeAdapterFactory(Input.TypeAdapterFactory) + .create(); final Queue<NotebookSocket> connectedSockets = new ConcurrentLinkedQueue<>(); // noteId -> connection @@ -69,18 +67,15 @@ public class ConnectionManager { final Map<String, Queue<NotebookSocket>> userSocketMap = new ConcurrentHashMap<>(); /** - * This is a special endpoint in the notebook websoket, Every connection in this Queue - * will be able to watch every websocket event, it doesnt need to be listed into the map of - * noteSocketMap. This can be used to get information about websocket traffic and watch what - * is going on. + * This is a special endpoint in the notebook websoket, Every connection in this Queue will be + * able to watch every websocket event, it doesnt need to be listed into the map of noteSocketMap. + * This can be used to get information about websocket traffic and watch what is going on. */ final Queue<NotebookSocket> watcherSockets = Queues.newConcurrentLinkedQueue(); private HashSet<String> collaborativeModeList = new HashSet<>(); - private Boolean collaborativeModeEnable = ZeppelinConfiguration - .create() - .isZeppelinNotebookCollaborativeModeEnable(); - + private Boolean collaborativeModeEnable = + ZeppelinConfiguration.create().isZeppelinNotebookCollaborativeModeEnable(); public void addConnection(NotebookSocket conn) { connectedSockets.add(conn); @@ -203,7 +198,6 @@ public class ConnectionManager { broadcast(noteId, message); } - protected String serializeMessage(Message m) { return gson.toJson(m); } @@ -245,8 +239,11 @@ public class ConnectionManager { for (NotebookSocket watcher : watcherSockets) { try { watcher.send( - WatcherMessage.builder(noteId).subject(subject).message(serializeMessage(message)) - .build().toJson()); + WatcherMessage.builder(noteId) + .subject(subject) + .message(serializeMessage(message)) + .build() + .toJson()); } catch (IOException e) { LOGGER.error("Cannot broadcast message to watcher", e); } @@ -278,9 +275,7 @@ public class ConnectionManager { } } - /** - * Send websocket message to all connections regardless of notebook id. - */ + /** Send websocket message to all connections regardless of notebook id. */ public void broadcastToAllConnections(String serialized) { broadcastToAllConnectionsExcept(null, serialized); } @@ -309,7 +304,6 @@ public class ConnectionManager { return connectedUsers; } - public void multicastToUser(String user, Message m) { if (!userSocketMap.containsKey(user)) { LOGGER.warn("Multicasting to user {} that is not in connections map", user); @@ -346,15 +340,15 @@ public class ConnectionManager { } } - public void broadcastNoteListExcept(List<Map<String, String>> notesInfo, - AuthenticationInfo subject) { + public void broadcastNoteListExcept( + List<Map<String, String>> notesInfo, AuthenticationInfo subject) { Set<String> userAndRoles; NotebookAuthorization authInfo = NotebookAuthorization.getInstance(); for (String user : userSocketMap.keySet()) { if (subject.getUser().equals(user)) { continue; } - //reloaded already above; parameter - false + // reloaded already above; parameter - false userAndRoles = authInfo.getRoles(user); userAndRoles.add(user); // TODO(zjffdu) is it ok for comment the following line ? @@ -377,12 +371,12 @@ public class ConnectionManager { } } - public void broadcastParagraphs(Map<String, Paragraph> userParagraphMap, - Paragraph defaultParagraph) { + public void broadcastParagraphs( + Map<String, Paragraph> userParagraphMap, Paragraph defaultParagraph) { if (null != userParagraphMap) { for (String user : userParagraphMap.keySet()) { - multicastToUser(user, - new Message(Message.OP.PARAGRAPH).put("paragraph", userParagraphMap.get(user))); + multicastToUser( + user, new Message(Message.OP.PARAGRAPH).put("paragraph", userParagraphMap.get(user))); } } } @@ -390,7 +384,8 @@ public class ConnectionManager { private void broadcastNewParagraph(Note note, Paragraph para) { LOGGER.info("Broadcasting paragraph on run call instead of note."); int paraIndex = note.getParagraphs().indexOf(para); - broadcast(note.getId(), + broadcast( + note.getId(), new Message(Message.OP.PARAGRAPH_ADDED).put("paragraph", para).put("index", paraIndex)); } @@ -406,13 +401,12 @@ public class ConnectionManager { // broadcastNoteListExcept(notesInfo, subject); // } - private void broadcastNoteForms(Note note) { GUI formsSettings = new GUI(); formsSettings.setForms(note.getNoteForms()); formsSettings.setParams(note.getNoteParams()); - broadcast(note.getId(), new Message(Message.OP.SAVE_NOTE_FORMS) - .put("formsData", formsSettings)); + broadcast( + note.getId(), new Message(Message.OP.SAVE_NOTE_FORMS).put("formsData", formsSettings)); } public void switchConnectionToWatcher(NotebookSocket conn) { @@ -436,7 +430,7 @@ public class ConnectionManager { private boolean isSessionAllowedToSwitchToWatcher(NotebookSocket session) { String watcherSecurityKey = session.getRequest().getHeader(WatcherSecurityKey.HTTP_HEADER); - return !(StringUtils.isBlank(watcherSecurityKey) || !watcherSecurityKey - .equals(WatcherSecurityKey.getKey())); + return !(StringUtils.isBlank(watcherSecurityKey) + || !watcherSecurityKey.equals(WatcherSecurityKey.getKey())); } }
