[zeppelin] branch master updated (c26ed1a -> bea51d1)

2022-03-14 Thread zjffdu
This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git.


from c26ed1a  [ZEPPELIN-5661] Support clone a specific revision of a note 
(#4299)
 add bea51d1  rework xml factory (#4302)

No new revisions were added by this update.

Summary of changes:
 .../zeppelin/sap/universe/UniverseClient.java  | 44 ++
 1 file changed, 36 insertions(+), 8 deletions(-)


[zeppelin] 01/01: Try to solve surefire update

2022-03-14 Thread pdallig
This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch surefire
in repository https://gitbox.apache.org/repos/asf/zeppelin.git

commit a0aa4fb9ac796b4371472758dc17ceec88765aa4
Author: Philipp Dallig 
AuthorDate: Fri Mar 11 17:30:50 2022 +0100

Try to solve surefire update
---
 .../zeppelin/server/ImmediateErrorHandlerImpl.java |  14 +-
 .../org/apache/zeppelin/server/ZeppelinServer.java | 141 +++--
 .../zeppelin/socket/SessionConfigurator.java   |   3 +-
 .../java/org/apache/zeppelin/utils/TestUtils.java  |   4 +-
 .../zeppelin/cluster/ZeppelinServerMock.java   |   3 +-
 .../org/apache/zeppelin/recovery/RecoveryTest.java |   3 +-
 .../apache/zeppelin/rest/AbstractTestRestApi.java  |   8 +-
 .../apache/zeppelin/rest/NotebookRestApiTest.java  |   4 +-
 8 files changed, 93 insertions(+), 87 deletions(-)

diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ImmediateErrorHandlerImpl.java
 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ImmediateErrorHandlerImpl.java
index 5d0ec17..27f4e6d 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ImmediateErrorHandlerImpl.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ImmediateErrorHandlerImpl.java
@@ -33,25 +33,25 @@ public class ImmediateErrorHandlerImpl implements 
ImmediateErrorHandler {
 
   @Override
   public void postConstructFailed(ActiveDescriptor immediateService, 
Throwable exception) {
-synchronized (this) {
+synchronized (constructionErrors) {
   constructionErrors.add(new ErrorData(immediateService, exception));
-  this.notifyAll();
+  constructionErrors.notifyAll();
 }
   }
 
   @Override
   public void preDestroyFailed(ActiveDescriptor immediateService, Throwable 
exception) {
-synchronized (this) {
+synchronized (constructionErrors) {
   destructionErrors.add(new ErrorData(immediateService, exception));
-  this.notifyAll();
+  constructionErrors.notifyAll();
 }
   }
 
   List waitForAtLeastOneConstructionError(long waitTime) throws 
InterruptedException {
-synchronized (this) {
-  while (constructionErrors.size() <= 0 && waitTime > 0) {
+synchronized (constructionErrors) {
+  while (constructionErrors.isEmpty() && waitTime > 0) {
 long currentTime = System.currentTimeMillis();
-wait(waitTime);
+constructionErrors.wait(waitTime);
 long elapsedTime = System.currentTimeMillis() - currentTime;
 waitTime -= elapsedTime;
   }
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
index 428cdd9..836257f 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
@@ -135,30 +135,26 @@ public class ZeppelinServer extends ResourceConfig {
   private static final Logger LOG = 
LoggerFactory.getLogger(ZeppelinServer.class);
   private static final String WEB_APP_CONTEXT_NEXT = "/next";
 
-  public static Server jettyWebServer;
-  public static ServiceLocator sharedServiceLocator;
-
-  private static ZeppelinConfiguration conf;
-  private static PrometheusMeterRegistry promMetricRegistry;
-
-  public static void reset() {
-conf = null;
-jettyWebServer = null;
-sharedServiceLocator = null;
-  }
+  public static final String SERVICE_LOCATOR_NAME= "shared-locator";
 
   @Inject
-  public ZeppelinServer() {
+  public ZeppelinServer(ZeppelinConfiguration conf) {
 LOG.info("Instantiated ZeppelinServer");
 InterpreterOutput.LIMIT = 
conf.getInt(ConfVars.ZEPPELIN_INTERPRETER_OUTPUT_LIMIT);
 
 packages("org.apache.zeppelin.rest");
   }
 
-  public static void main(String[] args) throws InterruptedException, 
IOException {
-ZeppelinServer.conf = ZeppelinConfiguration.create();
+  public static void main(String[] args) throws IOException {
+ZeppelinConfiguration conf = ZeppelinConfiguration.create();
 
-jettyWebServer = setupJettyServer(conf);
+Server jettyWebServer = setupJettyServer(conf);
+
+PrometheusMeterRegistry promMetricRegistry = null;
+if (conf.isPrometheusMetricEnabled()) {
+  promMetricRegistry = new 
PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
+  Metrics.addRegistry(promMetricRegistry);
+}
 initMetrics(conf);
 
 TimedHandler timedHandler = new TimedHandler(Metrics.globalRegistry, 
Tags.empty());
@@ -167,7 +163,7 @@ public class ZeppelinServer extends ResourceConfig {
 ContextHandlerCollection contexts = new ContextHandlerCollection();
 timedHandler.setHandler(contexts);
 
-sharedServiceLocator = 
ServiceLocatorFactory.getInstance().create("shared-locator");
+ServiceLocator sharedServiceLocator = 
ServiceLocatorFactory.getInstance().create(SERVICE_LOCATOR_NAME);
 

[zeppelin] branch surefire updated (1e9a7f5 -> a0aa4fb)

2022-03-14 Thread pdallig
This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a change to branch surefire
in repository https://gitbox.apache.org/repos/asf/zeppelin.git.


 discard 1e9a7f5  Try to solve surefire update
 new a0aa4fb  Try to solve surefire update

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1e9a7f5)
\
 N -- N -- N   refs/heads/surefire (a0aa4fb)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../zeppelin/server/ImmediateErrorHandlerImpl.java | 14 ++---
 .../org/apache/zeppelin/server/ZeppelinServer.java | 24 --
 .../java/org/apache/zeppelin/utils/TestUtils.java  |  4 ++--
 .../zeppelin/cluster/ZeppelinServerMock.java   |  3 +--
 .../apache/zeppelin/rest/AbstractTestRestApi.java  |  1 -
 5 files changed, 19 insertions(+), 27 deletions(-)


[zeppelin] 01/01: Try to solve surefire update

2022-03-14 Thread pdallig
This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch surefire
in repository https://gitbox.apache.org/repos/asf/zeppelin.git

commit 1e9a7f56919f1fdaca429f71ed5e00853238a6a4
Author: Philipp Dallig 
AuthorDate: Fri Mar 11 17:30:50 2022 +0100

Try to solve surefire update
---
 .../org/apache/zeppelin/server/ZeppelinServer.java | 133 +++--
 .../zeppelin/socket/SessionConfigurator.java   |   3 +-
 .../java/org/apache/zeppelin/utils/TestUtils.java  |   2 +-
 .../zeppelin/cluster/ZeppelinServerMock.java   |   2 +-
 .../org/apache/zeppelin/recovery/RecoveryTest.java |   3 +-
 .../apache/zeppelin/rest/AbstractTestRestApi.java  |   7 +-
 .../apache/zeppelin/rest/NotebookRestApiTest.java  |   4 +-
 7 files changed, 84 insertions(+), 70 deletions(-)

diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
index 428cdd9..fb7baa7 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
@@ -135,30 +135,36 @@ public class ZeppelinServer extends ResourceConfig {
   private static final Logger LOG = 
LoggerFactory.getLogger(ZeppelinServer.class);
   private static final String WEB_APP_CONTEXT_NEXT = "/next";
 
-  public static Server jettyWebServer;
-  public static ServiceLocator sharedServiceLocator;
+  //private static Server jettyWebServer;
+  //public static ServiceLocator sharedServiceLocator;
 
-  private static ZeppelinConfiguration conf;
-  private static PrometheusMeterRegistry promMetricRegistry;
+  //private static ZeppelinConfiguration conf;
+  //private static PrometheusMeterRegistry promMetricRegistry;
 
   public static void reset() {
-conf = null;
-jettyWebServer = null;
-sharedServiceLocator = null;
+//conf = null;
+//jettyWebServer = null;
+//sharedServiceLocator = null;
   }
 
   @Inject
-  public ZeppelinServer() {
+  public ZeppelinServer(ZeppelinConfiguration conf) {
 LOG.info("Instantiated ZeppelinServer");
 InterpreterOutput.LIMIT = 
conf.getInt(ConfVars.ZEPPELIN_INTERPRETER_OUTPUT_LIMIT);
 
 packages("org.apache.zeppelin.rest");
   }
 
-  public static void main(String[] args) throws InterruptedException, 
IOException {
-ZeppelinServer.conf = ZeppelinConfiguration.create();
+  public static void main(String[] args) throws IOException {
+ZeppelinConfiguration conf = ZeppelinConfiguration.create();
 
-jettyWebServer = setupJettyServer(conf);
+Server jettyWebServer = setupJettyServer(conf);
+
+PrometheusMeterRegistry promMetricRegistry = null;
+if (conf.isPrometheusMetricEnabled()) {
+  promMetricRegistry = new 
PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
+  Metrics.addRegistry(promMetricRegistry);
+}
 initMetrics(conf);
 
 TimedHandler timedHandler = new TimedHandler(Metrics.globalRegistry, 
Tags.empty());
@@ -167,7 +173,7 @@ public class ZeppelinServer extends ResourceConfig {
 ContextHandlerCollection contexts = new ContextHandlerCollection();
 timedHandler.setHandler(contexts);
 
-sharedServiceLocator = 
ServiceLocatorFactory.getInstance().create("shared-locator");
+ServiceLocator sharedServiceLocator = 
ServiceLocatorFactory.getInstance().create("shared-locator");
 ServiceLocatorUtilities.enableImmediateScope(sharedServiceLocator);
 ServiceLocatorUtilities.addClasses(sharedServiceLocator,
   NotebookRepoSync.class,
@@ -230,10 +236,10 @@ public class ZeppelinServer extends ResourceConfig {
 final WebAppContext defaultWebApp = setupWebAppContext(contexts, conf, 
conf.getString(ConfVars.ZEPPELIN_WAR), conf.getServerContextPath());
 final WebAppContext nextWebApp = setupWebAppContext(contexts, conf, 
conf.getString(ConfVars.ZEPPELIN_ANGULAR_WAR), WEB_APP_CONTEXT_NEXT);
 
-initWebApp(defaultWebApp);
-initWebApp(nextWebApp);
+initWebApp(defaultWebApp, conf, sharedServiceLocator, promMetricRegistry);
+initWebApp(nextWebApp, conf, sharedServiceLocator, promMetricRegistry);
 // Cluster Manager Server
-setupClusterManagerServer(sharedServiceLocator);
+setupClusterManagerServer(sharedServiceLocator, conf);
 
 // JMX Enable
 if (conf.isJMXEnabled()) {
@@ -251,25 +257,9 @@ public class ZeppelinServer extends ResourceConfig {
   LOG.info("JMX Enabled with port: {}", port);
 }
 
-LOG.info("Starting zeppelin server");
-try {
-  jettyWebServer.start(); // Instantiates ZeppelinServer
-  List errorData = handler.waitForAtLeastOneConstructionError(5 
* 1000);
-  if(errorData.size() > 0 && errorData.get(0).getThrowable() != null) {
-throw new Exception(errorData.get(0).getThrowable());
-  }
-  if (conf.getJettyName() != null) {
-
org.eclipse.jetty.http.HttpGenerator.setJettyVersion(conf.getJettyName());

[zeppelin] branch surefire created (now 1e9a7f5)

2022-03-14 Thread pdallig
This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a change to branch surefire
in repository https://gitbox.apache.org/repos/asf/zeppelin.git.


  at 1e9a7f5  Try to solve surefire update

This branch includes the following new commits:

 new 1e9a7f5  Try to solve surefire update

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[zeppelin] branch master updated: [ZEPPELIN-5661] Support clone a specific revision of a note (#4299)

2022-03-14 Thread zjffdu
This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
 new c26ed1a  [ZEPPELIN-5661] Support clone a specific revision of a note 
(#4299)
c26ed1a is described below

commit c26ed1a0bc0221141d8d216c54507a72a6580e2a
Author: nihua 
AuthorDate: Mon Mar 14 16:11:09 2022 +0800

[ZEPPELIN-5661] Support clone a specific revision of a note (#4299)
---
 docs/usage/rest_api/notebook.md|  8 ++-
 .../org/apache/zeppelin/rest/NotebookRestApi.java  |  4 +-
 .../zeppelin/rest/message/NewNoteRequest.java  |  5 ++
 .../apache/zeppelin/service/NotebookService.java   | 23 +--
 .../apache/zeppelin/rest/NotebookRestApiTest.java  | 79 +++---
 .../org/apache/zeppelin/notebook/Notebook.java | 32 ++---
 6 files changed, 113 insertions(+), 38 deletions(-)

diff --git a/docs/usage/rest_api/notebook.md b/docs/usage/rest_api/notebook.md
index c49d805..b669213 100644
--- a/docs/usage/rest_api/notebook.md
+++ b/docs/usage/rest_api/notebook.md
@@ -352,7 +352,8 @@ Notebooks REST API supports the following operations: List, 
Create, Get, Delete,
 
   Description
   This ```POST``` method clones a note by the given id and create a 
new note using the given name
-  or default name if none given.
+  or default name if none given. If what you want to copy is a certain 
version of note, you need 
+  to specify the revisionId.
   The body field of the returned JSON contains the new note id.
   
 
@@ -373,7 +374,10 @@ Notebooks REST API supports the following operations: 
List, Create, Get, Delete,
   
 
 ```json
-{"name": "name of new note"}
+{
+  "name": "name of new note",
+  "revisionId": "revisionId of note to be copied (optional)"
+}
 ```
 
 
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
index 40ad46a..88004f4 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
@@ -555,11 +555,13 @@ public class NotebookRestApi extends AbstractRestApi {
 checkIfUserCanWrite(noteId, "Insufficient privileges you cannot clone this 
note");
 NewNoteRequest request = NewNoteRequest.fromJson(message);
 String newNoteName = null;
+String revisionId = null;
 if (request != null) {
   newNoteName = request.getName();
+  revisionId = request.getRevisionId();
 }
 AuthenticationInfo subject = new 
AuthenticationInfo(authenticationService.getPrincipal());
-String newNoteId = notebookService.cloneNote(noteId, newNoteName, 
getServiceContext(),
+String newNoteId = notebookService.cloneNote(noteId, revisionId, 
newNoteName, getServiceContext(),
 new RestServiceCallback() {
   @Override
   public void onSuccess(Note newNote, ServiceContext context) 
throws IOException {
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewNoteRequest.java
 
b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewNoteRequest.java
index 85744dc..1ef9da3 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewNoteRequest.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewNoteRequest.java
@@ -33,6 +33,7 @@ public class NewNoteRequest implements JsonSerializable {
   private String defaultInterpreterGroup;
   private boolean addingEmptyParagraph = false;
   private List paragraphs;
+  private String revisionId;
 
   public NewNoteRequest (){
   }
@@ -53,6 +54,10 @@ public class NewNoteRequest implements JsonSerializable {
 return paragraphs;
   }
 
+  public String getRevisionId() {
+return revisionId;
+  }
+
   public String toJson() {
 return GSON.toJson(this);
   }
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 02a4bbd..dfc75eb 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
@@ -317,15 +317,30 @@ public class NotebookService {
   }
 
   public String cloneNote(String noteId,
-String newNotePath,
-ServiceContext context,
-ServiceCallback callback) throws IOException {
+  String newNotePath,
+  ServiceContext context,
+  ServiceCallback callback) throws IOException {
+return cloneNote(noteId, "", newNotePath, context, callback);
+  }
+
+
+  public String 

[zeppelin] branch master updated: [ZEPPELIN-5663] Provide REST API about notebook version control (#4300)

2022-03-14 Thread zjffdu
This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
 new 60ddde6  [ZEPPELIN-5663] Provide REST API about notebook version 
control (#4300)
60ddde6 is described below

commit 60ddde694681f2071e60b21dfd600c4831b0aad4
Author: nihua 
AuthorDate: Mon Mar 14 16:09:56 2022 +0800

[ZEPPELIN-5663] Provide REST API about notebook version control (#4300)

* [ZEPPELIN-5663] Provide REST API about notebook version control

* change RESTFUL API method checkpointNote(...) to return revisionId like 
that addParagraph return paragraphId
---
 docs/usage/rest_api/notebook.md| 238 +
 .../org/apache/zeppelin/rest/NotebookRestApi.java  |  88 +++-
 .../rest/message/CheckpointNoteRequest.java|  28 +++
 .../apache/zeppelin/service/NotebookService.java   |  10 +-
 .../apache/zeppelin/rest/NotebookRestApiTest.java  | 200 +
 5 files changed, 559 insertions(+), 5 deletions(-)

diff --git a/docs/usage/rest_api/notebook.md b/docs/usage/rest_api/notebook.md
index b0dcd46..c49d805 100644
--- a/docs/usage/rest_api/notebook.md
+++ b/docs/usage/rest_api/notebook.md
@@ -1574,3 +1574,241 @@ Notebooks REST API supports the following operations: 
List, Create, Get, Delete,
   
 
 
+## Version control
+
+
+
+### Get revisions of a note
+
+  
+
+
+  Description
+  This ```GET``` method gets the revisions of a note.
+  
+
+
+  URL
+  
```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/revision```
+
+
+  Success code
+  200
+
+
+  Fail code
+  500
+
+
+   sample JSON response 
+  
+
+```json
+{
+"status": "OK",
+"body": [
+{
+"id": "f97ce5c7f076783023d33623ad52ca994277e5c1",
+"message": "first commit",
+"time": 1645712061
+},
+{
+"id": "e9b964bebdecec6a59efe085f97db4040ae333aa",
+"message": "second commit",
+"time": 1645693163
+}
+]
+}
+```
+
+
+  
+
+
+### Save a revision for a note
+  
+
+
+  Description
+  This ```POST``` method saves a revision for a note.
+  
+
+
+  URL
+  
```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/revision```
+
+
+  Success code
+  200
+
+
+  Bad Request code
+  400
+
+
+  Fail code
+  500
+
+
+   sample JSON input 
+  
+
+```json
+{
+  "commitMessage": "first commit"
+}
+```
+
+
+
+   sample JSON response 
+  
+
+```json
+{
+  "status": "OK",
+  "message": "",
+  "body": "6a5879218dfb797b013bcd24a594808045e34875"
+}
+```
+
+
+  
+### Get a revision of a note
+  
+
+
+  Description
+  This ```GET``` method gets a revision of a note.
+  
+
+
+  URL
+  
```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/revision/{revisionId}```
+
+
+  Success code
+  200
+
+
+  Fail code
+  500
+
+
+   sample JSON response 
+  
+
+```json
+{
+  "status": "OK",
+  "message": "",
+  "body": {
+"paragraphs": [
+  {
+"text": "%sql \nselect age, count(1) value\nfrom bank \nwhere age < 30 
\ngroup by
+ age \norder by age",
+"config": {
+  "colWidth": 4,
+  "graph": {
+"mode": "multiBarChart",
+"height": 300,
+"optionOpen": false,
+"keys": [
+  {
+"name": "age",
+"index": 0,
+"aggr": "sum"
+  }
+],
+"values": [
+  {
+"name": "value",
+"index": 1,
+"aggr": "sum"
+  }
+],
+"groups": [],
+"scatter": {
+  "xAxis": {
+"name": "age",
+"index": 0,
+"aggr": "sum"
+  },
+  "yAxis": {
+"name": "value",
+"index": 1,
+"aggr": "sum"
+  }
+}
+  }
+},
+"settings": {
+  "params": {},
+  "forms": {}
+},
+"jobName": "paragraph\_1423500782552\_-1439281894",
+"id": "20150210-015302\_1492795503",
+"results": {
+  "code": "SUCCESS",
+  "msg": [
+{
+  "type": "TABLE",
+  "data": 
"age\tvalue\n19\t4\n20\t3\n21\t7\n22\t9\n23\t20\n24\t24\n25\t44\n26
+\t77\n27\t94\n28\t103\n29\t97\n"
+}
+  ]
+},
+"dateCreated": "Feb 10, 2015 1:53:02 AM",
+"dateStarted": "Jul 3, 2015 1:43:17 PM",
+"dateFinished": "Jul 3, 2015 1:43:23 PM",
+