diff --git a/.agents/server-interpreter-communication.md b/.agents/server-interpreter-communication.md index 09b2410209b..20408458101 100644 --- a/.agents/server-interpreter-communication.md +++ b/.agents/server-interpreter-communication.md @@ -55,7 +55,6 @@ registerInterpreterProcess(info) — register after process startup appendOutput(event) — stream execution output incrementally updateOutput(event) — replace output content sendParagraphInfo(info) — update paragraph metadata -updateAppStatus(event) — Zeppelin Application status runParagraphs(request) — trigger paragraph execution from interpreter getResource(resourceId) — access ResourcePool shared state getParagraphList(noteId) — query notebook structure diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index c032dfb4184..31b681d2978 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -19,7 +19,6 @@ env: -Dmaven.wagon.http.retryHandler.count=3 MAVEN_ARGS: >- -B --no-transfer-progress - ZEPPELIN_HELIUM_REGISTRY: helium SPARK_PRINT_LAUNCH_COMMAND: "true" SPARK_LOCAL_IP: 127.0.0.1 ZEPPELIN_LOCAL_IP: 127.0.0.1 @@ -76,7 +75,7 @@ jobs: restore-keys: | ${{ runner.os }}-${{ runner.arch }}-conda-python-3.9-v1- - name: install application with some interpreter - run: ./mvnw install -Pbuild-distr -DskipTests -pl zeppelin-server,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,angular,shell -am -Pweb-classic -Phelium-dev -Pexamples ${MAVEN_ARGS} + run: ./mvnw install -Pbuild-distr -DskipTests -pl zeppelin-server,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,angular,shell -am -Pweb-classic ${MAVEN_ARGS} - name: install and test plugins run: ./mvnw package -pl zeppelin-plugins -amd ${MAVEN_ARGS} - name: Setup conda environment with python 3.9 @@ -93,7 +92,7 @@ jobs: conda list conda info - name: run tests # skip spark test because we would run them in other CI - run: ./mvnw verify -Pusing-packaged-distr -pl zeppelin-server,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,angular,shell -am -Pweb-classic -Phelium-dev -Pexamples -Dtests.to.exclude=**/org/apache/zeppelin/spark/* -DfailIfNoTests=false + run: ./mvnw verify -Pusing-packaged-distr -pl zeppelin-server,zeppelin-web,spark-submit,spark/scala-2.12,spark/scala-2.13,markdown,angular,shell -am -Pweb-classic -Dtests.to.exclude=**/org/apache/zeppelin/spark/* -DfailIfNoTests=false # test interpreter modules except spark, flink, python, jupyter interpreter-test-non-core: diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 4d00b10243b..ecb500a3ca7 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -19,7 +19,6 @@ env: -Dmaven.wagon.http.retryHandler.count=3 MAVEN_ARGS: >- -B --no-transfer-progress - ZEPPELIN_HELIUM_REGISTRY: helium SPARK_PRINT_LAUNCH_COMMAND: "true" SPARK_LOCAL_IP: 127.0.0.1 ZEPPELIN_LOCAL_IP: 127.0.0.1 diff --git a/.gitignore b/.gitignore index 25319152ceb..e1dd258bc19 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,6 @@ conf/truststore conf/interpreter.json conf/notebook-authorization.json conf/credentials.json -conf/helium.json # other generated files spark/dependency-reduced-pom.xml @@ -129,8 +128,6 @@ tramp *.swp **/dependency-reduced-pom.xml -# Generated by zeppelin-examples -/helium # tmp files /tmp/ diff --git a/conf/zeppelin-env.cmd.template b/conf/zeppelin-env.cmd.template index 15c88fd4ca8..520cecdeb92 100644 --- a/conf/zeppelin-env.cmd.template +++ b/conf/zeppelin-env.cmd.template @@ -42,9 +42,6 @@ REM set ZEPPELIN_IDENT_STRING REM A string representing this in REM set ZEPPELIN_NICENESS REM The scheduling priority for daemons. Defaults to 0. REM set ZEPPELIN_INTERPRETER_LOCALREPO REM Local repository for interpreter's additional dependency loading REM set ZEPPELIN_INTERPRETER_DEP_MVNREPO REM Maven principal repository for interpreter's additional dependency loading -REM set ZEPPELIN_HELIUM_NODE_INSTALLER_URL REM Remote Node installer url for Helium dependency loader -REM set ZEPPELIN_HELIUM_NPM_INSTALLER_URL REM Remote Npm installer url for Helium dependency loader -REM set ZEPPELIN_HELIUM_YARNPKG_INSTALLER_URL REM Remote Yarn package installer url for Helium dependency loader REM set ZEPPELIN_NOTEBOOK_STORAGE REM Refers to pluggable notebook storage class, can have two classes simultaneously with a sync between them (e.g. local and remote). REM set ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC REM If there are multiple notebook storages, should we treat the first one as the only source of truth? diff --git a/conf/zeppelin-env.sh.template b/conf/zeppelin-env.sh.template index 38b60cfa4d7..af89323e825 100644 --- a/conf/zeppelin-env.sh.template +++ b/conf/zeppelin-env.sh.template @@ -58,9 +58,6 @@ # export ZEPPELIN_NICENESS # The scheduling priority for daemons. Defaults to 0. # export ZEPPELIN_INTERPRETER_LOCALREPO # Local repository for interpreter's additional dependency loading # export ZEPPELIN_INTERPRETER_DEP_MVNREPO # Remote principal repository for interpreter's additional dependency loading -# export ZEPPELIN_HELIUM_NODE_INSTALLER_URL # Remote Node installer url for Helium dependency loader -# export ZEPPELIN_HELIUM_NPM_INSTALLER_URL # Remote Npm installer url for Helium dependency loader -# export ZEPPELIN_HELIUM_YARNPKG_INSTALLER_URL # Remote Yarn package installer url for Helium dependency loader # export ZEPPELIN_NOTEBOOK_STORAGE # Refers to pluggable notebook storage class, can have two classes simultaneously with a sync between them (e.g. local and remote). # export ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC # If there are multiple notebook storages, should we treat the first one as the only source of truth? # export ZEPPELIN_NOTEBOOK_PUBLIC # Make notebook public by default when created, private otherwise diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template index f30b346d66a..46185e9a15a 100755 --- a/conf/zeppelin-site.xml.template +++ b/conf/zeppelin-site.xml.template @@ -395,30 +395,10 @@ Local repository for dependency loader - - zeppelin.helium.node.installer.url - https://nodejs.org/dist/ - Remote Node installer url for Helium dependency loader - - - zeppelin.helium.npm.installer.url - https://registry.npmjs.org/ - Remote Npm installer url for Helium dependency loader - - - zeppelin.helium.yarnpkg.installer.url - https://github.com/yarnpkg/yarn/releases/download/ - Remote Yarn package installer url for Helium dependency loader - diff --git a/dev/change_zeppelin_version.sh b/dev/change_zeppelin_version.sh index 0acebba586c..6ceb225751c 100755 --- a/dev/change_zeppelin_version.sh +++ b/dev/change_zeppelin_version.sh @@ -53,12 +53,6 @@ is_maintenance_version() { # Change version in pom.xml ./mvnw versions:set -DnewVersion="${TO_VERSION}" -DgenerateBackupPoms=false > /dev/null 2>&1 -# Change version in example and package files -sed -i '' 's/-'"${FROM_VERSION}"'.jar",/-'"${TO_VERSION}"'.jar",/g' zeppelin-examples/zeppelin-example-clock/zeppelin-example-clock.json -sed -i '' 's/"version": "'"${FROM_VERSION}"'",/"version": "'"${TO_VERSION}"'",/g' zeppelin-web/src/app/tabledata/package.json -sed -i '' 's/"version": "'"${FROM_VERSION}"'",/"version": "'"${TO_VERSION}"'",/g' zeppelin-web/src/app/visualization/package.json -sed -i '' 's/"version": "'"${FROM_VERSION}"'",/"version": "'"${TO_VERSION}"'",/g' zeppelin-web/src/app/spell/package.json - # Change version in Dockerfile sed -i '' 's/Z_VERSION="'"${FROM_VERSION}"'"/Z_VERSION="'"${TO_VERSION}"'"/g' scripts/docker/zeppelin/bin/Dockerfile sed -i '' 's/version="'"${FROM_VERSION}"'"/version="'"${TO_VERSION}"'"/g' scripts/docker/zeppelin-interpreter/Dockerfile diff --git a/docs/_includes/themes/zeppelin/_navigation.html b/docs/_includes/themes/zeppelin/_navigation.html index 4ed1a8d83a1..4e6ab185d13 100644 --- a/docs/_includes/themes/zeppelin/_navigation.html +++ b/docs/_includes/themes/zeppelin/_navigation.html @@ -78,7 +78,6 @@
  • Notebook Repository API
  • Configuration API
  • Credential API
  • -
  • Helium API
  • Zeppelin SDK
  • Client API
  • Session API
  • @@ -120,7 +119,6 @@
  • Operation
  • Configuration
  • Monitoring
  • -
  • Proxy Setting
  • Upgrading
  • Trouble Shooting
  • @@ -162,12 +160,6 @@
  • Extending Zeppelin
  • Writing Zeppelin Interpreter
  • -
  • Helium (Experimental)
  • -
  • Overview
  • -
  • Writing Helium Application
  • -
  • Writing Helium Spell
  • -
  • Writing Helium Visualization: Basics
  • -
  • Writing Helium Visualization: Transformation
  • Contributing to Zeppelin
  • How to Build Zeppelin
  • diff --git a/docs/assets/themes/zeppelin/img/docs-img/writing_spell_registered.png b/docs/assets/themes/zeppelin/img/docs-img/writing_spell_registered.png deleted file mode 100644 index e8bcd473088..00000000000 Binary files a/docs/assets/themes/zeppelin/img/docs-img/writing_spell_registered.png and /dev/null differ diff --git a/docs/assets/themes/zeppelin/img/docs-img/writing_spell_using.gif b/docs/assets/themes/zeppelin/img/docs-img/writing_spell_using.gif deleted file mode 100644 index ac73cefc13c..00000000000 Binary files a/docs/assets/themes/zeppelin/img/docs-img/writing_spell_using.gif and /dev/null differ diff --git a/docs/assets/themes/zeppelin/img/docs-img/writing_visualization_example.png b/docs/assets/themes/zeppelin/img/docs-img/writing_visualization_example.png deleted file mode 100644 index 219d7c8b4e5..00000000000 Binary files a/docs/assets/themes/zeppelin/img/docs-img/writing_visualization_example.png and /dev/null differ diff --git a/docs/assets/themes/zeppelin/img/docs-img/writing_visualization_helium_menu.png b/docs/assets/themes/zeppelin/img/docs-img/writing_visualization_helium_menu.png deleted file mode 100644 index 7e1ce20831b..00000000000 Binary files a/docs/assets/themes/zeppelin/img/docs-img/writing_visualization_helium_menu.png and /dev/null differ diff --git a/docs/development/contribution/useful_developer_tools.md b/docs/development/contribution/useful_developer_tools.md index 7e2dc3e7c8f..380d42cca29 100644 --- a/docs/development/contribution/useful_developer_tools.md +++ b/docs/development/contribution/useful_developer_tools.md @@ -80,8 +80,8 @@ you can use this function like `setjdk 1.8` / `setjdk 1.7` ### Running Individual Tests ```bash -# run the `HeliumBundleFactoryTest` test class -./mvnw test -pl 'zeppelin-server' --am -DfailIfNoTests=false -Dtest=HeliumBundleFactoryTest +# run the `NotebookServerTest` test class +./mvnw test -pl 'zeppelin-server' --am -DfailIfNoTests=false -Dtest=NotebookServerTest ``` ### Running Selenium Tests diff --git a/docs/development/helium/overview.md b/docs/development/helium/overview.md deleted file mode 100644 index 92da7e8a932..00000000000 --- a/docs/development/helium/overview.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: page -title: "Helium" -description: "" -group: development/helium ---- - -{% include JB/setup %} - -# Helium Overview - -
    - -## What is Helium? - -Helium is a plugin system that can extend Zeppelin a lot. -For example, you can write [custom display system](./writing_spell.html) or -install already published one in [Helium Online Registry](http://zeppelin.apache.org/helium_packages.html). - -Currently, Helium supports 4 types of package. - -- [Helium Visualization](./writing_visualization_basic.html): Adding a new chart type -- [Helium Spell](./writing_spell.html): Adding new interpreter, display system running on browser -- [Helium Application](./writing_application.html) -- [Helium Interpreter](../writing_zeppelin_interpreter.html): Adding a new custom interpreter - - -## Configuration - -Zeppelin ships with several builtin helium plugins which is located in $ZEPPELIN_HOME/heliums. If you want to try more types of heliums plugins, -you can configure `zeppelin.helium.registry` to be `helium,https://zeppelin.apache.org/helium.json` in zeppelin-site.xml. `https://zeppelin.apache.org/helium.json` will be updated regularly. diff --git a/docs/development/helium/writing_application.md b/docs/development/helium/writing_application.md deleted file mode 100644 index 0fa775dd6ef..00000000000 --- a/docs/development/helium/writing_application.md +++ /dev/null @@ -1,185 +0,0 @@ ---- -layout: page -title: "Writing a new Helium Application" -description: "Apache Zeppelin Application is a package that runs on Interpreter process and displays it's output inside of the notebook. Make your own Application in Apache Zeppelin is quite easy." -group: development/helium ---- - -{% include JB/setup %} - -# Writing a new Application - -
    - -## What is Apache Zeppelin Application - -Apache Zeppelin Application is a package that runs on Interpreter process and displays it's output inside of the notebook. While application runs on Interpreter process, it's able to access resources provided by Interpreter through ResourcePool. Output is always rendered by AngularDisplaySystem. Therefore application provides all the possibilities of making interactive graphical application that uses data and processing power of any Interpreter. - - -## Make your own Application - -Writing Application means extending `org.apache.zeppelin.helium.Application`. You can use your favorite IDE and language while Java class files are packaged into jar. `Application` class looks like - -```java - -/** - * Constructor. Invoked when application is loaded - */ -public Application(ApplicationContext context); - -/** - * Invoked when there're (possible) updates in required resource set. - * i.e. invoked after application load and after paragraph finishes. - */ -public abstract void run(ResourceSet args); - -/** - * Invoked before application unload. - * Application is automatically unloaded with paragraph/notebook removal - */ -public abstract void unload(); -``` - - -You can check example applications under [./zeppelin-examples](https://github.com/apache/incubator-zeppelin/tree/master/zeppelin-examples) directory. - - -## Development mode - -In the development mode, you can run your Application in your IDE as a normal java application and see the result inside of Zeppelin notebook. - -`org.apache.zeppelin.helium.ZeppelinApplicationDevServer` can run Zeppelin Application in development mode. - -```java - -// entry point for development mode -public static void main(String[] args) throws Exception { - - // add resources for development mode - LocalResourcePool pool = new LocalResourcePool("dev"); - pool.put("date", new Date()); - - // run application in devlopment mode with given resource - // in this case, Clock.class.getName() will be the application class name - org.apache.zeppelin.helium.ZeppelinApplicationDevServer devServer = new org.apache.zeppelin.helium.ZeppelinApplicationDevServer( - Clock.class.getName(), pool.getAll()); - - // start development mode - devServer.start(); - devServer.join(); -} -``` - - -In the Zeppelin notebook, run `%dev run` will connect to application running in development mode. - - -## Package file - -Package file is a json file that provides information about the application. -Json file contains the following information - -```json -{ - "name" : "[organization].[name]", - "description" : "Description", - "artifact" : "groupId:artifactId:version", - "className" : "your.package.name.YourApplicationClass", - "resources" : [ - ["resource.name", ":resource.class.name"], - ["alternative.resource.name", ":alternative.class.name"] - ], - "icon" : "" -} -``` - -#### name - -Name is a string in `[group].[name]` format. -`[group]` and `[name]` allow only `[A-Za-z0-9_]`. -Group is normally the name of an organization who creates this application. - -#### description - -A short description about the application - -#### artifact - -Location of the jar artifact. -`"groupId:artifactId:version"` will load artifact from maven repository. -If jar exists in the local filesystem, absolute/relative can be used. - -e.g. - -When artifact exists in Maven repository - -``` -artifact: "org.apache.zeppelin:zeppelin-examples:0.6.0" -``` - -When artifact exists in the local filesystem - -``` -artifact: "zeppelin-example/target/zeppelin-example-0.6.0.jar" -``` - -#### className - -Entry point. Class that extends `org.apache.zeppelin.helium.Application` - -#### resources - -Two dimensional array that defines required resources by name or by className. Helium Application launcher will compare resources in the ResourcePool with the information in this field and suggest application only when all required resources are available in the ResourcePool. - -Resource name is a string which will be compared with the name of objects in the ResourcePool. className is a string with ":" prepended, which will be compared with className of the objects in the ResourcePool. - -Application may require two or more resources. Required resources can be listed inside of the json array. For example, if the application requires object "name1", "name2" and "className1" type of object to run, resources field can be - -```json -resources: [ - [ "name1", "name2", ":className1", ...] -] -``` - -If Application can handle alternative combination of required resources, alternative set can be listed as below. - -```json -resources: [ - [ "name", ":className"], - [ "altName", ":altClassName1"], - ... -] -``` - -Easier way to understand this scheme is - -```json -resources: [ - [ 'resource' AND 'resource' AND ... ] OR - [ 'resource' AND 'resource' AND ... ] OR - ... -] -``` - - -#### icon - -Icon to be used on the application button. String in this field will be rendered as a HTML tag. - -e.g. - -``` -icon: "" -``` diff --git a/docs/development/helium/writing_spell.md b/docs/development/helium/writing_spell.md deleted file mode 100644 index b2988a90ae4..00000000000 --- a/docs/development/helium/writing_spell.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -layout: page -title: "Writing a new Helium Spell" -description: "Spell is a kind of interpreter that runs on browser not on backend. So, technically it's the frontend interpreter. " -group: development/helium ---- - -{% include JB/setup %} - -# Writing a new Spell - -
    - -## What is Apache Zeppelin Spell - -Spell is a kind of interpreter that runs on browser not on backend. So, technically it's the frontend interpreter. -It can provide many benefits. - -- Spell is pluggable frontend interpreter. So it can be installed and removed easily using helium registry. -- Every spell is written in javascript. It means you can use existing javascript libraries whatever you want. -- Spell runs on browser like display system (`%html`, `%table`). In other words, every spell can be used as display system as well. - -## How it works - -Helium Spell works like [Helium Visualization](./writing_visualization_basic.html). - -- Every helium packages are loaded from central (online) registry or local registry -- You can see loaded packages in `/helium` page. -- When you enable a spell, it's built from server and sent to client -- Finally it will be loaded into browser. - -## How to use spell - -### 1. Enabling - -Find a spell what you want to use in `/helium` package and click `Enable` button. - - - -### 2. Using - -Spell works like an interpreter. Use the `MAGIC` value to execute spell in a note. (you might need to refresh after enabling) -For example, Use `%echo` for the Echo Spell. - - - - -## Write a new Spell - -Making a new spell is similar to [Helium Visualization#write-new-visualization](./writing_visualization_basic.html#write-new-visualization). - -- Add framework dependency called zeppelin-spell into `package.json` -- Write code using framework -- Publish your spell to [npm](https://www.npmjs.com/) - -### 1. Create a npm package - -Create a [package.json](https://docs.npmjs.com/files/package.json) in new directory for spell. - -- You have to add a framework called `zeppelin-spell` as a dependency to create spell ([zeppelin-spell](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/spell)) -- Also, you can add any dependencies you want to utilise. - -Here's an example - -```json -{ - "name": "zeppelin-echo-spell", - "description": "Zeppelin Echo Spell (example)", - "version": "1.0.0", - "main": "index", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "zeppelin-spell": "*" - }, - "helium": { - "icon" : "", - "spell": { - "magic": "%echo", - "usage": "%echo " - } - } -} -``` - -### 2. Write spell using framework - -Here are some examples you can refer - -- [Echo Spell](https://github.com/apache/zeppelin/blob/master/zeppelin-examples/zeppelin-example-spell-echo/index.js) -- [Markdown Spell: Using library](https://github.com/apache/zeppelin/blob/master/zeppelin-examples/zeppelin-example-spell-markdown/index.js) -- [Flowchart Spell: Using DOM](https://github.com/apache/zeppelin/blob/master/zeppelin-examples/zeppelin-example-spell-flowchart/index.js) -- [Google Translation API Spell: Using API (returning promise)](https://github.com/apache/zeppelin/blob/master/zeppelin-examples/zeppelin-example-spell-translator/index.js) - -Now, you need to write code to create spell which processing text. - -```js -import { - SpellBase, - SpellResult, - DefaultDisplayType, -} from 'zeppelin-spell'; - -export default class EchoSpell extends SpellBase { - constructor() { - /** pass magic to super class's constructor parameter */ - super("%echo"); - } - - interpret(paragraphText) { - const processed = paragraphText + '!'; - - /** - * should return `SpellResult` which including `data` and `type` - * default type is `TEXT` if you don't specify. - */ - return new SpellResult(processed); - } -} -``` - -Here is another example. Let's say we want to create markdown spell. First of all, we should add a dependency for markdown in package.json - -```json -// package.json - "dependencies": { - "markdown": "0.5.0", - "zeppelin-spell": "*" - }, -``` - -And here is spell code. - -```js -import { - SpellBase, - SpellResult, - DefaultDisplayType, -} from 'zeppelin-spell'; - -import md from 'markdown'; - -const markdown = md.markdown; - -export default class MarkdownSpell extends SpellBase { - constructor() { - super("%markdown"); - } - - interpret(paragraphText) { - const parsed = markdown.toHTML(paragraphText); - - /** - * specify `DefaultDisplayType.HTML` since `parsed` will contain DOM - * otherwise it will be rendered as `DefaultDisplayType.TEXT` (default) - */ - return new SpellResult(parsed, DefaultDisplayType.HTML); - } -} -``` - -- You might want to manipulate DOM directly (e.g google d3.js), then refer [Flowchart Spell](https://github.com/apache/zeppelin/blob/master/zeppelin-examples/zeppelin-example-spell-flowchart/index.js) -- You might want to return promise not string (e.g API call), then refer [Google Translation API Spell](https://github.com/apache/zeppelin/blob/master/zeppelin-examples/zeppelin-example-spell-translator/index.js) - -### 3. Create __Helium package file__ for local deployment - -You don't want to publish your package every time you make a change in your spell. Zeppelin provides local deploy. -The only thing you need to do is creating a __Helium Package file__ (JSON) for local deploy. -It's automatically created when you publish to npm repository but in local case, you should make it by yourself. - -```json -{ - "type" : "SPELL", - "name" : "zeppelin-echo-spell", - "version": "1.0.0", - "description" : "Return just what receive (example)", - "artifact" : "./zeppelin-examples/zeppelin-example-spell-echo", - "license" : "Apache-2.0", - "spell": { - "magic": "%echo", - "usage": "%echo " - } -} -``` - -- Place this file in your local registry directory (default `$ZEPPELIN_HOME/helium`). -- `type` should be `SPELL` -- Make sure that `artifact` should be same as your spell directory. -- You can get information about other fields in [Helium Visualization#3-create-helium-package-file-and-locally-deploy](./writing_visualization_basic.html#3-create-helium-package-file-and-locally-deploy). - -### 4. Run in dev mode - -```bash -cd zeppelin-web -yarn run dev:helium -``` - -You can browse localhost:9000. Every time refresh your browser, Zeppelin will rebuild your spell and reload changes. - -### 5. Publish your spell to the npm repository - -See [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages) diff --git a/docs/development/helium/writing_visualization_basic.md b/docs/development/helium/writing_visualization_basic.md deleted file mode 100644 index c1dc6968b0c..00000000000 --- a/docs/development/helium/writing_visualization_basic.md +++ /dev/null @@ -1,212 +0,0 @@ ---- -layout: page -title: "Writing a new Helium Visualization: basic" -description: "Apache Zeppelin Visualization is a pluggable package that can be loaded/unloaded on runtime through Helium framework in Zeppelin. A Visualization is a javascript npm package and user can use them just like any other built-in visualization in a note." -group: development/helium ---- - -{% include JB/setup %} - -# Writing a new Visualization - -
    - -## What is Apache Zeppelin Visualization - -Apache Zeppelin Visualization is a pluggable package that can be loaded/unloaded on runtime through Helium framework in Zeppelin. A Visualization is a javascript npm package and user can use them just like any other built-in visualization in notebook. - - -## How it works - - -#### 1. Load Helium package files from registry - -Zeppelin needs to know what Visualization packages are available. Zeppelin will read information of packages from both online and local registry. -Registries are configurable through `ZEPPELIN_HELIUM_LOCALREGISTRY_DEFAULT` env variable or `zeppelin.helium.localregistry.default` property. - -#### 2. Enable packages -Once Zeppelin loads _Helium package files_ from registries, available packages are displayed in Helium menu. - -Click 'enable' button. - - - - -#### 3. Create and load visualization bundle on the fly - -Once a Visualization package is enabled, [HeliumBundleFactory](https://github.com/apache/zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java) creates a js bundle. The js bundle is served by `helium/bundle/load` rest api endpoint. - -#### 4. Run visualization - -Zeppelin shows additional button for loaded Visualizations. -User can use just like any other built-in visualizations. - - - - - -## Write new Visualization - -#### 1. Create a npm package - -Create a [package.json](https://docs.npmjs.com/files/package.json) in your new Visualization directory. You can add any dependencies in package.json, but you **must include two dependencies: [zeppelin-vis](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/visualization) and [zeppelin-tabledata](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/tabledata).** - -Here's an example - -```json -{ - "name": "zeppelin_horizontalbar", - "description" : "Horizontal Bar chart", - "version": "1.0.0", - "main": "horizontalbar", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "zeppelin-tabledata": "*", - "zeppelin-vis": "*" - } -} -``` - -#### 2. Create your own visualization - -To create your own visualization, you need to create a js file and import [Visualization](https://github.com/apache/zeppelin/blob/master/zeppelin-web/src/app/visualization/visualization.js) class from [zeppelin-vis](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/visualization) package and extend the class. [zeppelin-tabledata](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/tabledata) package provides some useful transformations, like pivot, you can use in your visualization. (you can create your own transformation, too). - -[Visualization](https://github.com/apache/zeppelin/blob/master/zeppelin-web/src/app/visualization/visualization.js) class, there're several methods that you need to override and implement. Here's simple visualization that just prints `Hello world`. - -```js -import Visualization from 'zeppelin-vis' -import PassthroughTransformation from 'zeppelin-tabledata/passthrough' - -export default class helloworld extends Visualization { - constructor(targetEl, config) { - super(targetEl, config) - this.passthrough = new PassthroughTransformation(config); - } - - render(tableData) { - this.targetEl.html('Hello world!') - } - - getTransformation() { - return this.passthrough - } -} -``` - -To learn more about `Visualization` class, check [visualization.js](https://github.com/apache/zeppelin/blob/master/zeppelin-web/src/app/visualization/visualization.js). - -You can check complete visualization package example [here](https://github.com/apache/zeppelin/tree/master/zeppelin-examples/zeppelin-example-horizontalbar). - -Zeppelin's built-in visualization uses the same API, so you can check [built-in visualizations](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/visualization/builtins) as additional examples. - - -#### 3. Create __Helium package file__ and locally deploy - -__Helium Package file__ is a json file that provides information about the application. -Json file contains the following information - -```json -{ - "type" : "VISUALIZATION", - "name" : "zeppelin_horizontalbar", - "description" : "Horizontal Bar chart (example)", - "license" : "Apache-2.0", - "artifact" : "./zeppelin-examples/zeppelin-example-horizontalbar", - "icon" : "" -} -``` - -Place this file in your local registry directory (default `./helium`). - - -##### type - -When you're creating a visualization, 'type' should be 'VISUALIZATION'. Check these types as well. - -- [Helium Application](./writing_application.html) -- [Helium Spell](./writing_spell.html) - -##### name - -Name of visualization. Should be unique. Allows `[A-Za-z90-9_]`. - - -##### description - -A short description about visualization. - -##### artifact - -Location of the visualization npm package. Support npm package with version or local filesystem path. - -e.g. - -When artifact exists in npm repository - -```json -"artifact": "my-visualiztion@1.0.0" -``` - - -When artifact exists in local file system - -```json -"artifact": "/path/to/my/visualization" -``` - -##### license - -License information. - -e.g. - -```json -"license": "Apache-2.0" -``` - -##### icon - -Icon to be used in visualization select button. String in this field will be rendered as a HTML tag. - -e.g. - -```json -"icon": "" -``` - - -#### 4. Run in dev mode - -Place your __Helium package file__ in local registry (`ZEPPELIN_HOME/helium`). -Run Zeppelin. And then run zeppelin-web in visualization dev mode. - -```bash -cd zeppelin-web -yarn run dev:helium -``` - -You can browse `localhost:9000`. Everytime refresh your browser, Zeppelin will rebuild your visualization and reload changes. - - -#### 5. Publish your visualization - -Once it's done, publish your visualization package using `npm publish`. -That's it. With in an hour, your visualization will be available in Zeppelin's helium menu. - -### See More - -Check [Helium Visualization: Transformation](./writing_visualization_transformation.html) for more complex examples. - diff --git a/docs/development/helium/writing_visualization_transformation.md b/docs/development/helium/writing_visualization_transformation.md deleted file mode 100644 index 273e3c727dc..00000000000 --- a/docs/development/helium/writing_visualization_transformation.md +++ /dev/null @@ -1,280 +0,0 @@ ---- -layout: page -title: "Transformations in Zeppelin Visualization" -description: "Description for Transformations" -group: development/helium ---- - -{% include JB/setup %} - -# Transformations for Zeppelin Visualization - -
    - -## Overview - -Transformations - -- **renders** setting which allows users to set columns and -- **transforms** table rows according to the configured columns. - -Zeppelin provides 4 types of transformations. - -## 1. PassthroughTransformation - -`PassthroughTransformation` is the simple transformation which does not convert original tabledata at all. - -See [passthrough.js](https://github.com/apache/zeppelin/blob/master/zeppelin-web/src/app/tabledata/passthrough.js) - -## 2. ColumnselectorTransformation - -`ColumnselectorTransformation` is uses when you need `N` axes but do not need aggregation. - -See [columnselector.js](https://github.com/apache/zeppelin/blob/master/zeppelin-web/src/app/tabledata/columnselector.js) - -## 3. PivotTransformation - -`PivotTransformation` provides group by and aggregation. Every chart using `PivotTransformation` has 3 axes. `Keys`, `Groups` and `Values`. - -See [pivot.js](https://github.com/apache/zeppelin/blob/master/zeppelin-web/src/app/tabledata/pivot.js) - -## 4. AdvancedTransformation - -`AdvancedTransformation` has more detailed options while providing existing features of `PivotTransformation` and `ColumnselectorTransformation` - -- multiple sub charts -- configurable chart axes -- parameter widgets: `input`, `checkbox`, `option`, `textarea` -- parsing parameters automatically based on their types -- expand / fold axis and parameter panels -- multiple transformation methods while supporting lazy converting -- re-initialize the whole configuration based on spec hash. - -### Spec - -`AdvancedTransformation` requires `spec` which includes axis and parameter details for charts. - -Let's create 2 sub-charts called `line` and `no-group`. Each sub chart can have different axis and parameter depending on their requirements. - -
    - -```js -class AwesomeVisualization extends Visualization { - constructor(targetEl, config) { - super(targetEl, config) - - const spec = { - charts: { - 'line': { - transform: { method: 'object', }, - sharedAxis: false, /** set if you want to share axes between sub charts, default is `false` */ - axis: { - 'xAxis': { dimension: 'multiple', axisType: 'key', description: 'serial', }, - 'yAxis': { dimension: 'multiple', axisType: 'aggregator', description: 'serial', }, - 'category': { dimension: 'multiple', axisType: 'group', description: 'categorical', }, - }, - parameter: { - 'xAxisUnit': { valueType: 'string', defaultValue: '', description: 'unit of xAxis', }, - 'yAxisUnit': { valueType: 'string', defaultValue: '', description: 'unit of yAxis', }, - 'lineWidth': { valueType: 'int', defaultValue: 0, description: 'width of line', }, - }, - }, - - 'no-group': { - transform: { method: 'object', }, - sharedAxis: false, - axis: { - 'xAxis': { dimension: 'single', axisType: 'key', }, - 'yAxis': { dimension: 'multiple', axisType: 'value', }, - }, - parameter: { - 'xAxisUnit': { valueType: 'string', defaultValue: '', description: 'unit of xAxis', }, - 'yAxisUnit': { valueType: 'string', defaultValue: '', description: 'unit of yAxis', }, - }, - }, - } - - this.transformation = new AdvancedTransformation(config, spec) - } - - ... - - // `render` will be called whenever `axis` or `parameter` is changed - render(data) { - const { chart, parameter, column, transformer, } = data - - if (chart === 'line') { - const transformed = transformer() - // draw line chart - } else if (chart === 'no-group') { - const transformed = transformer() - // draw no-group chart - } - } -} -``` - -
    - -### Spec: `axis` - -| Field Name | Available Values (type) | Description | -| --- | --- | --- | -|`dimension` | `single` | Axis can contains only 1 column | -|`dimension` | `multiple` | Axis can contains multiple columns | -|`axisType` | `key` | Column(s) in this axis will be used as `key` like in `PivotTransformation`. These columns will be served in `column.key` | -|`axisType` | `aggregator` | Column(s) in this axis will be used as `value` like in `PivotTransformation`. These columns will be served in `column.aggregator` | -|`axisType` | `group` | Column(s) in this axis will be used as `group` like in `PivotTransformation`. These columns will be served in `column.group` | -|`axisType` | (string) | Any string value can be used here. These columns will be served in `column.custom` | -|`maxAxisCount` (optional) | (int) | The max number of columns that this axis can contain. (unlimited if `undefined`) | -|`minAxisCount` (optional) | (int) | The min number of columns that this axis should contain to draw chart. (`1` in case of single dimension) | -|`description` (optional) | (string) | Description for the axis. | - -
    - -Here is an example. - -```js -axis: { - 'xAxis': { dimension: 'multiple', axisType: 'key', }, - 'yAxis': { dimension: 'multiple', axisType: 'aggregator'}, - 'category': { dimension: 'multiple', axisType: 'group', maxAxisCount: 2, valueType: 'string', }, -}, -``` - -
    - -### Spec: `sharedAxis` - -If you set `sharedAxis: false` for sub charts, then their axes are persisted in global space (shared). It's useful for when you creating multiple sub charts sharing their axes but have different parameters. For example, - -- `basic-column`, `stacked-column`, `percent-column` -- `pie` and `donut` - -
    - -Here is an example. - -```js - const spec = { - charts: { - 'column': { - transform: { method: 'array', }, - sharedAxis: true, - axis: { ... }, - parameter: { ... }, - }, - - 'stacked': { - transform: { method: 'array', }, - sharedAxis: true, - axis: { ... } - parameter: { ... }, - }, -``` - -
    - -### Spec: `parameter` - -| Field Name | Available Values (type) | Description | -| --- | --- | --- | -|`valueType` | `string` | Parameter which has string value | -|`valueType` | `int` | Parameter which has int value | -|`valueType` | `float` | Parameter which has float value | -|`valueType` | `boolean` | Parameter which has boolean value used with `checkbox` widget usually | -|`valueType` | `JSON` | Parameter which has JSON value used with `textarea` widget usually. `defaultValue` should be `""` (empty string). This ||`defaultValue` | (any) | Default value of this parameter. `JSON` type should have `""` (empty string) | -|`description` | (string) | Description of this parameter. This value will be parsed as HTML for pretty output | -|`widget` | `input` | Use [input](https://developer.mozilla.org/en/docs/Web/HTML/Element/input) widget. This is the default widget (if `widget` is undefined)| -|`widget` | `checkbox` | Use [checkbox](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox) widget. | -|`widget` | `textarea` | Use [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) widget. | -|`widget` | `option` | Use [select + option](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) widget. This parameter should have `optionValues` field as well. | -|`optionValues` | `(Array)` | Available option values used with the `option` widget | - -
    - -Here is an example. - -```js -parameter: { - // string type, input widget - 'xAxisUnit': { valueType: 'string', defaultValue: '', description: 'unit of xAxis', }, - - // boolean type, checkbox widget - 'inverted': { widget: 'checkbox', valueType: 'boolean', defaultValue: false, description: 'invert x and y axes', }, - - // string type, option widget with `optionValues` - 'graphType': { widget: 'option', valueType: 'string', defaultValue: 'line', description: 'graph type', optionValues: [ 'line', 'smoothedLine', 'step', ], }, - - // HTML in `description` - 'dateFormat': { valueType: 'string', defaultValue: '', description: 'format of date (doc) (e.g YYYY-MM-DD)', }, - - // JSON type, textarea widget - 'yAxisGuides': { widget: 'textarea', valueType: 'JSON', defaultValue: '', description: 'guides of yAxis ', }, -``` - -
    - -### Spec: `transform` - -| Field Name | Available Values (type) | Description | -| --- | --- | --- | -|`method` | `object` | designed for rows requiring object manipulation | -|`method` | `array` | designed for rows requiring array manipulation | -|`method` | `array:2-key` | designed for xyz charts (e.g bubble chart) | -|`method` | `drill-down` | designed for drill-down charts | -|`method` | `raw` | will return the original `tableData.rows` | - -
    - -Whatever you specified as `transform.method`, the `transformer` value will be always function for lazy computation. - -```js -// advanced-transformation.util#getTransformer - -if (transformSpec.method === 'raw') { - transformer = () => { return rows; } -} else if (transformSpec.method === 'array') { - transformer = () => { - ... - return { ... } - } -} -``` - -Here is actual usage. - -```js -class AwesomeVisualization extends Visualization { - constructor(...) { /** setup your spec */ } - - ... - - // `render` will be called whenever `axis` or `parameter` are changed - render(data) { - const { chart, parameter, column, transformer, } = data - - if (chart === 'line') { - const transformed = transformer() - // draw line chart - } else if (chart === 'no-group') { - const transformed = transformer() - // draw no-group chart - } - } - - ... -} -``` diff --git a/docs/index.md b/docs/index.md index b38f77bfada..e9d7540aa7a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -83,7 +83,6 @@ limitations under the License. * [Notebook Repository API](./usage/rest_api/notebook_repository.html) * [Configuration API](./usage/rest_api/configuration.html) * [Credential API](./usage/rest_api/credential.html) - * [Helium API](./usage/rest_api/helium.html) * Zeppelin SDK: Java API of Zeppelin Client * [Client API](./usage/zeppelin_sdk/client_api.html) * [Session API](./usage/zeppelin_sdk/session_api.html) @@ -115,18 +114,12 @@ limitations under the License. * Operation * [Configuration](./setup/operation/configuration.html): lists for Apache Zeppelin * [Monitoring](./setup/operation/monitoring.html): monitoring instructions for Apache Zeppelin - * [Proxy Setting](./setup/operation/proxy_setting.html) * [Upgrading](./setup/operation/upgrading.html): a manual procedure of upgrading Apache Zeppelin version * [Trouble Shooting](./setup/operation/trouble_shooting.html) #### Developer Guide * Extending Zeppelin * [Writing Zeppelin Interpreter](./development/writing_zeppelin_interpreter.html) - * [Helium: Overview](./development/helium/overview.html) - * [Helium: Writing Application](./development/helium/writing_application.html) - * [Helium: Writing Spell](./development/helium/writing_spell.html) - * [Helium: Writing Visualization: Basic](./development/helium/writing_visualization_basic.html) - * [Helium: Writing Visualization: Transformation](./development/helium/writing_visualization_transformation.html) * Contributing to Zeppelin * [How to Build Zeppelin](./setup/basics/how_to_build.html) * [Useful Developer Tools](./development/contribution/useful_developer_tools.html) diff --git a/docs/setup/basics/how_to_build.md b/docs/setup/basics/how_to_build.md index ea40a599874..30f6c61d3cf 100644 --- a/docs/setup/basics/how_to_build.md +++ b/docs/setup/basics/how_to_build.md @@ -126,11 +126,6 @@ Hadoop version can be adjusted by `-Dhadoop.version=x.x.x` enable 3rd party vendor repository (Cloudera, Hortonworks) -#### -Pexamples (optional) - -Build examples under zeppelin-examples directory - - ### Build command examples Here are some examples with several options: diff --git a/docs/setup/operation/configuration.md b/docs/setup/operation/configuration.md index a6debaaa12c..9c018389238 100644 --- a/docs/setup/operation/configuration.md +++ b/docs/setup/operation/configuration.md @@ -380,25 +380,7 @@ Sources descending by priority:
    ZEPPELIN_DEP_LOCALREPO
    zeppelin.dep.localrepo
    local-repo - Local repository for dependency loader.
    ex)visualiztion modules of npm. - - -
    ZEPPELIN_HELIUM_NODE_INSTALLER_URL
    -
    zeppelin.helium.node.installer.url
    - https://nodejs.org/dist/ - Remote Node installer url for Helium dependency loader - - -
    ZEPPELIN_HELIUM_NPM_INSTALLER_URL
    -
    zeppelin.helium.npm.installer.url
    - http://registry.npmjs.org/ - Remote Npm installer url for Helium dependency loader - - -
    ZEPPELIN_HELIUM_YARNPKG_INSTALLER_URL
    -
    zeppelin.helium.yarnpkg.installer.url
    - https://github.com/yarnpkg/yarn/releases/download/ - Remote Yarn package installer url for Helium dependency loader + Local repository for interpreter dependencies.
    ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE
    diff --git a/docs/setup/operation/proxy_setting.md b/docs/setup/operation/proxy_setting.md deleted file mode 100644 index 0767cd3af31..00000000000 --- a/docs/setup/operation/proxy_setting.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: page -title: "Proxy Setting in Apache Zeppelin" -description: "Apache Zeppelin supports Helium plugins which fetch required installer packages from remote registry/repositories" -group: security ---- - -{% include JB/setup %} - -# Proxy Setting - -
    - -## How to Configure Proxies? - -Set `http_proxy` and `https_proxy` env variables. (See [more](https://wiki.archlinux.org/index.php/proxy_settings)) - -Currently, Proxy is supported only for these features. - -- Helium: downloading `helium.json`, installing `npm`, `node`, `yarn` \ No newline at end of file diff --git a/docs/setup/operation/upgrading.md b/docs/setup/operation/upgrading.md index b34521ad122..ad13059f34e 100644 --- a/docs/setup/operation/upgrading.md +++ b/docs/setup/operation/upgrading.md @@ -35,6 +35,16 @@ So, copying `notebook` and `conf` directory should be enough. ## Migration Guide +### Upgrading to Zeppelin 0.13 + +Helium Applications, Spells, external visualization packages, and the Helium management API +have been removed. Built-in tables and charts and their saved settings remain available. +A saved external visualization falls back to a table; its original settings and legacy +Application metadata remain in the notebook file, but Applications and Spells no longer run. +Remove obsolete `zeppelin.helium.*` settings and `ZEPPELIN_HELIUM_*` environment variables. +Upgrade and restart the server and all interpreter processes together, since the Helium +RPC methods and events have also been removed. + ### Upgrading from Zeppelin 0.9, 0.10 to 0.11 - From 0.11, The type of `Pegdown` for parsing markdown was deprecated ([ZEPPELIN-5529](https://issues.apache.org/jira/browse/ZEPPELIN-2619)). It will use `Flexmark` instead. diff --git a/docs/usage/interpreter/dynamic_loading.md b/docs/usage/interpreter/dynamic_loading.md index 107d85b2734..811653546b2 100644 --- a/docs/usage/interpreter/dynamic_loading.md +++ b/docs/usage/interpreter/dynamic_loading.md @@ -23,7 +23,7 @@ limitations under the License.
    -Apache Zeppelin provides pluggable interpreter architecture which results in a wide and variety of the supported backend system. In this section, we will introduce **Dynamic interpreter loading** using **REST API**. This concept actually comes from [Zeppelin Helium Proposal](https://cwiki.apache.org/confluence/display/ZEPPELIN/Helium+proposal). +Apache Zeppelin provides pluggable interpreter architecture which results in a wide and variety of the supported backend system. In this section, we will introduce **Dynamic interpreter loading** using **REST API**. Before we start, if you are not familiar with the concept of **Zeppelin interpreter**, you can check out [Overview: Zeppelin Interpreter](./overview.html) first. ## Overview diff --git a/docs/usage/rest_api/helium.md b/docs/usage/rest_api/helium.md deleted file mode 100644 index 21d5d48262a..00000000000 --- a/docs/usage/rest_api/helium.md +++ /dev/null @@ -1,565 +0,0 @@ ---- -layout: page -title: "Apache Zeppelin Helium REST API" -description: "This page contains Apache Zeppelin Helium REST API information." -group: usage/rest_api ---- - -{% include JB/setup %} - -# Apache Zeppelin Helium REST API - -
    - -## Overview -Apache Zeppelin provides several REST APIs for interaction and remote activation of zeppelin functionality. -All REST APIs are available starting with the following endpoint `http://[zeppelin-server]:[zeppelin-port]/api`. -Note that Apache Zeppelin REST APIs receive or return JSON objects, it is recommended for you to install some JSON viewers such as [JSONView](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc). - -If you work with Apache Zeppelin and find a need for an additional REST API, please [file an issue or send us an email](http://zeppelin.apache.org/community.html). - -## Helium REST API List - -### Get all available helium packages - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns all the available helium packages in configured registries.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/package```
    Success code200
    Fail code 500
    Sample JSON response - -```json -{ - "status": "OK", - "message": "", - "body": { - "zeppelin.clock": [ - { - "registry": "local", - "pkg": { - "type": "APPLICATION", - "name": "zeppelin.clock", - "description": "Clock (example)", - "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example --clock-0.7.0-SNAPSHOT.jar", - "className": "org.apache.zeppelin.example.app.clock.Clock", - "resources": [ - [ - ":java.util.Date" - ] - ], - "icon": "icon" - }, - "enabled": false - } - ] - } -} -``` -
    -
    - -### Get all enabled helium packages - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns all enabled helium packages in configured registries.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/enabledPackage```
    Success code200
    Fail code 500
    Sample JSON response - -```json -{ - "status": "OK", - "message": "", - "body": { - "zeppelin.clock": [ - { - "registry": "local", - "pkg": { - "type": "APPLICATION", - "name": "zeppelin.clock", - "description": "Clock (example)", - "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example --clock-0.7.0-SNAPSHOT.jar", - "className": "org.apache.zeppelin.example.app.clock.Clock", - "resources": [ - [ - ":java.util.Date" - ] - ], - "icon": "icon" - }, - "enabled": false - } - ] - } -} -``` -
    -
    - -### Get single helium package - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns specified helium package information
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/package/[Package Name]```
    Success code200
    Fail code 500
    Sample JSON response - -```json -{ - "status": "OK", - "message": "", - "body": { - "zeppelin.clock": [ - { - "registry": "local", - "pkg": { - "type": "APPLICATION", - "name": "zeppelin.clock", - "description": "Clock (example)", - "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example --clock-0.7.0-SNAPSHOT.jar", - "className": "org.apache.zeppelin.example.app.clock.Clock", - "resources": [ - [ - ":java.util.Date" - ] - ], - "icon": "icon" - }, - "enabled": false - } - ] - } -} -``` -
    -
    - -### Suggest Helium package on a paragraph - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns suggested helium package for the paragraph.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/suggest/[Note ID]/[Paragraph ID]```
    Success code200
    Fail code - 404 on note or paragraph not exists
    - 500 -
    Sample JSON response - -```json -{ - "status": "OK", - "message": "", - "body": { - "available": [ - { - "registry": "local", - "pkg": { - "type": "APPLICATION", - "name": "zeppelin.clock", - "description": "Clock (example)", - "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example --clock-0.7.0-SNAPSHOT.jar", - "className": "org.apache.zeppelin.example.app.clock.Clock", - "resources": [ - [ - ":java.util.Date" - ] - ], - "icon": "icon" - }, - "enabled": true - } - ] - } -} -``` -
    -
    - -### Load Helium package on a paragraph - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```POST``` method loads helium package to target paragraph.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/load/[Note ID]/[Paragraph ID]```
    Success code200
    Fail code - 404 on note or paragraph not exists
    - 500 -
    Sample JSON response - -```json -{ - "status": "OK", - "message": "", - "body": "app_2C5FYRZ1E-20170108-040449_2068241472zeppelin_clock" -} -``` -
    -
    - -### Load bundled visualization script - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns bundled helium visualization javascript. When refresh=true (optional) is provided, Zeppelin rebuilds bundle. Otherwise, it's provided from cache
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/bundle/load/[Package Name][?refresh=true]```
    Success code200 response body is executable javascript
    Fail code - 200 response body is error message string starts with ERROR:
    -
    -
    - -### Enable package - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```POST``` method enables a helium package. Needs artifact name in input payload
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/enable/[Package Name]```
    Success code200
    Fail code 500
    Sample input -
    -zeppelin-examples/zeppelin-example-clock/target/zeppelin-example-clock-0.7.0-SNAPSHOT.jar
    -        
    -
    Sample JSON response - -```json -{"status":"OK"} -``` -
    -
    - -### Disable package - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```POST``` method disables a helium package.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/disable/[Package Name]```
    Success code200
    Fail code 500
    Sample JSON response - -```json -{"status":"OK"} -``` -
    -
    - -### Get visualization display order - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns display order of enabled visualization packages.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/order/visualization```
    Success code200
    Fail code 500
    Sample JSON response - -```json -{"status":"OK","body":["zeppelin_horizontalbar","zeppelin-bubblechart"]} -``` -
    -
    - -### Set visualization display order - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```POST``` method sets visualization packages display order.
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/order/visualization```
    Success code200
    Fail code 500
    Sample JSON input - -```json -["zeppelin-bubblechart", "zeppelin_horizontalbar"] -``` -
    Sample JSON response - -```json -{"status":"OK"} -``` -
    -
    - -### Get configuration for all Helium packages - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns configuration for all Helium packages
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/config```
    Success code200
    Fail code 500
    -
    - -### Get configuration for specific package - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns configuration for the specified package name and artifact
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/config/[Package Name]/[Artifact]```
    Success code200
    Fail code 500
    -
    - -### Set configuration for specific package - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```POST``` method updates configuration for specified package name and artifact
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/config/[Package Name]/[Artifact]```
    Success code200
    Fail code 500
    -
    - -### Get Spell configuration for single package - - - - - - - - - - - - - - - - - - - -
    DescriptionThis ```GET``` method returns specified package Spell configuration
    URL```http://[zeppelin-server]:[zeppelin-port]/api/helium/spell/config/[Package Name]```
    Success code200
    Fail code 500
    -
    - diff --git a/helium-dev/pom.xml b/helium-dev/pom.xml deleted file mode 100644 index 77bcef40b1a..00000000000 --- a/helium-dev/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-interpreter-parent - org.apache.zeppelin - 0.13.0-SNAPSHOT - ../zeppelin-interpreter-parent/pom.xml - - - helium-dev - Zeppelin: Helium development interpreter - - - dev - - - - - org.apache.zeppelin - zeppelin-interpreter - ${project.version} - provided - - - - - - - maven-enforcer-plugin - - - maven-resources-plugin - - - - diff --git a/helium-dev/src/main/java/org/apache/zeppelin/helium/DevInterpreter.java b/helium-dev/src/main/java/org/apache/zeppelin/helium/DevInterpreter.java deleted file mode 100644 index 00846dee658..00000000000 --- a/helium-dev/src/main/java/org/apache/zeppelin/helium/DevInterpreter.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.interpreter.Interpreter; -import org.apache.zeppelin.interpreter.InterpreterContext; -import org.apache.zeppelin.interpreter.InterpreterException; -import org.apache.zeppelin.interpreter.InterpreterResult; -import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; - -/** - * Dummy interpreter to support development mode for Zeppelin app - */ -public class DevInterpreter extends Interpreter { - - private InterpreterEvent interpreterEvent; - private InterpreterContext context; - private DevZeppelinContext z; - - public static boolean isInterpreterName(String replName) { - return replName.equals("dev"); - } - - /** - * event handler for org.apache.zeppelin.helium.ZeppelinApplicationDevServer - */ - public static interface InterpreterEvent { - public InterpreterResult interpret(String st, InterpreterContext context); - } - - public DevInterpreter(Properties property) { - super(property); - } - - public DevInterpreter(Properties property, InterpreterEvent interpreterEvent) { - super(property); - this.interpreterEvent = interpreterEvent; - } - - @Override - public void open() { - this.z = new DevZeppelinContext(null, 1000); - } - - @Override - public void close() { - } - - public void rerun() { - try { - z.run(context.getParagraphId()); - } catch (IOException e) { - throw new RuntimeException("Fail to rerun", e); - } - } - - @Override - public InterpreterResult interpret(String st, InterpreterContext context) - throws InterpreterException { - this.context = context; - this.z.setInterpreterContext(context); - try { - return interpreterEvent.interpret(st, context); - } catch (Exception e) { - throw new InterpreterException(e); - } - } - - @Override - public void cancel(InterpreterContext context) { - } - - @Override - public FormType getFormType() { - return FormType.NATIVE; - } - - @Override - public int getProgress(InterpreterContext context) { - return 0; - } - - @Override - public List completion(String buf, int cursor, - InterpreterContext interpreterContext) { - return new LinkedList<>(); - } - - public InterpreterContext getLastInterpretContext() { - return context; - } - - public void setInterpreterEvent(InterpreterEvent event) { - this.interpreterEvent = event; - } - - public InterpreterEvent getInterpreterEvent() { - return interpreterEvent; - } -} diff --git a/helium-dev/src/main/java/org/apache/zeppelin/helium/DevZeppelinContext.java b/helium-dev/src/main/java/org/apache/zeppelin/helium/DevZeppelinContext.java deleted file mode 100644 index 1ac4afe0ee0..00000000000 --- a/helium-dev/src/main/java/org/apache/zeppelin/helium/DevZeppelinContext.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.interpreter.ZeppelinContext; -import org.apache.zeppelin.interpreter.InterpreterHookRegistry; - -import java.util.List; -import java.util.Map; - -/** - * ZeppelinContext for DevInterpreter - */ -public class DevZeppelinContext extends ZeppelinContext { - public DevZeppelinContext(InterpreterHookRegistry hooks, int maxResult) { - super(hooks, maxResult); - } - - @Override - public Map getInterpreterClassMap() { - return null; - } - - @Override - public List getSupportedClasses() { - return null; - } - - @Override - public String showData(Object obj, int maxResult) { - return null; - } -} diff --git a/helium-dev/src/main/java/org/apache/zeppelin/helium/ZeppelinApplicationDevServer.java b/helium-dev/src/main/java/org/apache/zeppelin/helium/ZeppelinApplicationDevServer.java deleted file mode 100644 index 1c6ebcb16d2..00000000000 --- a/helium-dev/src/main/java/org/apache/zeppelin/helium/ZeppelinApplicationDevServer.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -import java.io.IOException; -import java.lang.reflect.Constructor; - -import com.google.gson.Gson; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.Level; -import org.apache.log4j.PatternLayout; -import org.apache.zeppelin.interpreter.*; -import org.apache.zeppelin.interpreter.InterpreterResult.Code; -import org.apache.zeppelin.interpreter.remote.RemoteInterpreterEventClient; -import org.apache.zeppelin.resource.ResourceSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Run this server for development mode. - */ -public class ZeppelinApplicationDevServer extends ZeppelinDevServer { - private static final Logger LOGGER = LoggerFactory.getLogger(ZeppelinApplicationDevServer.class); - - private final String className; - private final ResourceSet resourceSet; - private Application app; - private InterpreterOutput out; - - public ZeppelinApplicationDevServer(final String className, ResourceSet resourceSet) throws - Exception { - this(Constants.ZEPPELIN_INTERPRETER_DEFAUlT_PORT, className, resourceSet); - } - - public ZeppelinApplicationDevServer(int port, String className, ResourceSet resourceSet) throws - Exception { - super(port); - this.className = className; - this.resourceSet = resourceSet; - setLogger(); - }; - - void setLogger() { - ConsoleAppender console = new ConsoleAppender(); //create appender - //configure the appender - String PATTERN = "%d [%p|%c|%C{1}] %m%n"; - console.setLayout(new PatternLayout(PATTERN)); - console.setThreshold(Level.DEBUG); - console.activateOptions(); - //add appender to any Logger (here is root) - org.apache.log4j.Logger.getRootLogger().addAppender(console); - } - - - @Override - public InterpreterResult interpret(String st, InterpreterContext context) { - if (app == null) { - LOGGER.info("Create instance " + className); - try { - Class appClass = ClassLoader.getSystemClassLoader().loadClass(className); - Constructor constructor = appClass.getConstructor(ApplicationContext.class); - - // classPath will be ..../target/classes in dev mode most cases - String classPath = appClass.getProtectionDomain().getCodeSource().getLocation().getPath(); - - context.out.addResourceSearchPath(classPath + "../../src/main/resources/"); - context.out.addResourceSearchPath(classPath + "../../src/test/resources/"); - - ApplicationContext appContext = getApplicationContext(context); - app = (Application) constructor.newInstance(appContext); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - return new InterpreterResult(Code.ERROR, e.getMessage()); - } - } - - try { - LOGGER.info("Run " + className); - app.context().out.clear(); - app.context().out.setType(InterpreterResult.Type.ANGULAR); - transferTableResultDataToFrontend(); - app.run(resourceSet); - } catch (IOException | ApplicationException e) { - LOGGER.error(e.getMessage(), e); - return new InterpreterResult(Code.ERROR, e.getMessage()); - } - return new InterpreterResult(Code.SUCCESS, ""); - } - - private void transferTableResultDataToFrontend() throws IOException { - ResourceSet results = resourceSet.filterByClassname(InterpreterResult.class.getName()); - if (results.size() == 0) { - return; - } - - InterpreterResultMessage result = (InterpreterResultMessage) results.get(0).get(); - Gson gson = new Gson(); - String resultJson = gson.toJson(result); - StringBuffer transferResult = new StringBuffer(); - transferResult.append("$z.result = " + resultJson + ";\n"); - - if (result.getType() == InterpreterResult.Type.TABLE) { - transferResult.append("$z.scope.loadTableData($z.result);\n"); - } - - transferResult.append("$z.scope._devmodeResult = $z.result;\n"); - app.printStringAsJavascript(transferResult.toString()); - } - - ApplicationContext getApplicationContext(InterpreterContext interpreterContext) { - return new ApplicationContext( - interpreterContext.getNoteId(), - interpreterContext.getParagraphId(), - "app_" + this.hashCode(), - new HeliumAppAngularObjectRegistry( - interpreterContext.getAngularObjectRegistry(), - interpreterContext.getNoteId(), - interpreterContext.getParagraphId()), - interpreterContext.out); - } - - @Override - protected InterpreterOutput createInterpreterOutput( - final String noteId, final String paragraphId, final String executionOwner) { - if (out == null) { - final RemoteInterpreterEventClient eventClient = getIntpEventClient(); - try { - out = new InterpreterOutput(new InterpreterOutputListener() { - @Override - public void onUpdateAll(InterpreterOutput out) { - - } - - @Override - public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { - eventClient.onInterpreterOutputAppend( - noteId, paragraphId, index, executionOwner, new String(line)); - } - - @Override - public void onUpdate(int index, InterpreterResultMessageOutput out) { - try { - eventClient.onInterpreterOutputUpdate(noteId, paragraphId, - index, executionOwner, out.getType(), new String(out.toByteArray())); - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - } - } - - }, this); - } catch (IOException e) { - return null; - } - } - - return out; - } -} diff --git a/helium-dev/src/main/java/org/apache/zeppelin/helium/ZeppelinDevServer.java b/helium-dev/src/main/java/org/apache/zeppelin/helium/ZeppelinDevServer.java deleted file mode 100644 index 116f1adab14..00000000000 --- a/helium-dev/src/main/java/org/apache/zeppelin/helium/ZeppelinDevServer.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; - -import org.apache.thrift.TException; -import org.apache.zeppelin.helium.DevInterpreter.InterpreterEvent; -import org.apache.zeppelin.interpreter.*; -import org.apache.zeppelin.interpreter.remote.RemoteInterpreterEventClient; -import org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Interpreter development server - */ -public class ZeppelinDevServer extends - RemoteInterpreterServer implements InterpreterEvent, InterpreterOutputChangeListener { - private static final Logger LOGGER = LoggerFactory.getLogger(ZeppelinDevServer.class); - - private DevInterpreter interpreter = null; - private InterpreterOutput out; - public ZeppelinDevServer(int port) throws Exception { - super(null, port, null, ":"); - } - - @Override - protected Interpreter getInterpreter(String sessionId, String className) throws TException { - synchronized (this) { - InterpreterGroup interpreterGroup = getInterpreterGroup(); - if (interpreterGroup == null || interpreterGroup.isEmpty()) { - createInterpreter( - "dev", - sessionId, - DevInterpreter.class.getName(), - new HashMap(), - "anonymous"); - notify(); - } - } - - Interpreter intp = super.getInterpreter(sessionId, className); - interpreter = (DevInterpreter) ( - ((LazyOpenInterpreter) intp).getInnerInterpreter()); - interpreter.setInterpreterEvent(this); - return super.getInterpreter(sessionId, className); - } - - @Override - protected InterpreterOutput createInterpreterOutput( - final String noteId, final String paragraphId, final String executionOwner) { - if (out == null) { - final RemoteInterpreterEventClient eventClient = getIntpEventClient(); - try { - out = new InterpreterOutput(new InterpreterOutputListener() { - @Override - public void onUpdateAll(InterpreterOutput out) { - - } - - @Override - public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { - eventClient.onInterpreterOutputAppend( - noteId, paragraphId, index, executionOwner, new String(line)); - } - - @Override - public void onUpdate(int index, InterpreterResultMessageOutput out) { - try { - eventClient.onInterpreterOutputUpdate(noteId, paragraphId, - index, executionOwner, out.getType(), new String(out.toByteArray())); - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - } - } - }, this); - } catch (IOException e) { - return null; - } - } - - out.clear(); - return out; - } - - @Override - public void fileChanged(File file) { - refresh(); - } - - @Override - public InterpreterResult interpret(String st, InterpreterContext context) { - waitForConnected(); - return new InterpreterResult(InterpreterResult.Code.SUCCESS, ""); - } - - public void refresh() { - interpreter.rerun(); - } - - /** - * Wait until %dev paragraph is executed and connected to this process - */ - public void waitForConnected() { - synchronized (this) { - while (!isConnected()) { - try { - this.wait(10 * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - } - - public boolean isConnected() { - return !(interpreter == null || interpreter.getLastInterpretContext() == null); - } -} diff --git a/helium-dev/src/main/resources/interpreter-setting.json b/helium-dev/src/main/resources/interpreter-setting.json deleted file mode 100644 index 5146178d591..00000000000 --- a/helium-dev/src/main/resources/interpreter-setting.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "group": "dev", - "name": "dev", - "className": "org.apache.zeppelin.helium.DevInterpreter", - "properties": { - "port": { - "envName": "PORT", - "propertyName": "port", - "defaultValue": "jdbc:postgresql://localhost:5432/", - "description": "The URL for JDBC.", - "type": "string" - } - }, - "editor": { - "language": "helium", - "editOnDblClick": false - } - } -] diff --git a/pom.xml b/pom.xml index 0bfbc92018c..c755ad945d4 100644 --- a/pom.xml +++ b/pom.xml @@ -835,20 +835,6 @@ - - examples - - zeppelin-examples - - - - - helium-dev - - helium-dev - - - include-hadoop @@ -1011,7 +997,6 @@ conf/notebook-authorization.json conf/credentials.json conf/zeppelin-env.sh - conf/helium.json spark-*-bin*/** .spark-dist/** **/interpreter-setting.json diff --git a/zeppelin-common/src/main/java/org/apache/zeppelin/common/Message.java b/zeppelin-common/src/main/java/org/apache/zeppelin/common/Message.java index 04a3f79cc2b..b7d1ff1d4ab 100644 --- a/zeppelin-common/src/main/java/org/apache/zeppelin/common/Message.java +++ b/zeppelin-common/src/main/java/org/apache/zeppelin/common/Message.java @@ -168,10 +168,6 @@ public enum OP { // @param noteId // @param revisionId // @param position - APP_APPEND_OUTPUT, // [s-c] append output - APP_UPDATE_OUTPUT, // [s-c] update (replace) output - APP_LOAD, // [s-c] on app load - APP_STATUS_CHANGE, // [s-c] on app status change LIST_NOTE_JOBS, // [c-s] get note job management information LIST_UPDATE_NOTE_JOBS, // [s-c] update job management information @@ -193,8 +189,6 @@ public enum OP { NOTE_UPDATED, // [s-c] paragraph updated(name, config) RUN_ALL_PARAGRAPHS, // [c-s] run all paragraphs CANCEL_ALL_PARAGRAPHS, // [c-s] cancel(abort) all paragraphs - PARAGRAPH_EXECUTED_BY_SPELL, // [c-s] paragraph was executed by spell - RUN_PARAGRAPH_USING_SPELL, // [s-c] run paragraph using spell PARAS_INFO, // [s-c] paragraph runtime infos SAVE_NOTE_FORMS, // save note forms REMOVE_NOTE_FORMS, // remove note forms @@ -213,7 +207,6 @@ public enum OP { .unmodifiableSet(new HashSet<>(Arrays.asList( OP.COMMIT_PARAGRAPH, OP.RUN_PARAGRAPH, - OP.RUN_PARAGRAPH_USING_SPELL, OP.RUN_ALL_PARAGRAPHS, OP.PARAGRAPH_CLEAR_OUTPUT, OP.PARAGRAPH_CLEAR_ALL_OUTPUT, diff --git a/zeppelin-distribution/src/assemble/distribution.xml b/zeppelin-distribution/src/assemble/distribution.xml index 3529da3ddfa..feb7ae80744 100644 --- a/zeppelin-distribution/src/assemble/distribution.xml +++ b/zeppelin-distribution/src/assemble/distribution.xml @@ -92,17 +92,5 @@ ../scripts - - /lib/node_modules/zeppelin-vis - ../zeppelin-web/src/app/visualization - - - /lib/node_modules/zeppelin-tabledata - ../zeppelin-web/src/app/tabledata - - - /lib/node_modules/zeppelin-spell - ../zeppelin-web/src/app/spell - diff --git a/zeppelin-examples/pom.xml b/zeppelin-examples/pom.xml deleted file mode 100644 index fd2fdffb94d..00000000000 --- a/zeppelin-examples/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - 4.0.0 - - - zeppelin - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-examples - pom - Zeppelin: Examples - Zeppelin examples - - - zeppelin-example-clock - zeppelin-example-horizontalbar - zeppelin-example-spell-flowchart - zeppelin-example-spell-translator - zeppelin-example-spell-markdown - zeppelin-example-spell-echo - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-enforcer-plugin - - - enforce-dependency-convergence - none - - - - - - diff --git a/zeppelin-examples/zeppelin-example-clock/pom.xml b/zeppelin-examples/zeppelin-example-clock/pom.xml deleted file mode 100644 index f8bf362d5ec..00000000000 --- a/zeppelin-examples/zeppelin-example-clock/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-examples - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-example-clock - jar - 0.13.0-SNAPSHOT - Zeppelin: Example application - Clock - - - - org.apache.zeppelin - zeppelin-interpreter - ${project.version} - - - - org.apache.zeppelin - helium-dev - ${project.version} - - - - org.slf4j - slf4j-api - - - - org.slf4j - slf4j-reload4j - - - - ch.qos.reload4j - reload4j - - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-clean-plugin - - - - ${project.basedir}/../../helium - - ${project.artifactId}.json - - - - - - - - maven-resources-plugin - - - generate-resources - - copy-resources - - - - ${project.basedir}/../../helium/ - - - ${project.basedir} - - ${project.artifactId}.json - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-clock/src/main/java/org/apache/zeppelin/example/app/clock/Clock.java b/zeppelin-examples/zeppelin-example-clock/src/main/java/org/apache/zeppelin/example/app/clock/Clock.java deleted file mode 100644 index 63eaf164ecf..00000000000 --- a/zeppelin-examples/zeppelin-example-clock/src/main/java/org/apache/zeppelin/example/app/clock/Clock.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.example.app.clock; - -import org.apache.zeppelin.helium.Application; -import org.apache.zeppelin.helium.ApplicationContext; -import org.apache.zeppelin.helium.ApplicationException; -import org.apache.zeppelin.helium.ZeppelinApplicationDevServer; -import org.apache.zeppelin.resource.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * Basic example application. - * Get java.util.Date from resource pool and display it - */ -public class Clock extends Application { - private static final Logger LOGGER = LoggerFactory.getLogger(Clock.class); - - Date date; - boolean shutdown = false; - private Thread updateThread; - - public Clock(ApplicationContext context) { - super(context); - } - - @Override - public void run(ResourceSet resources) throws ApplicationException { - // Get data from resource args - date = (Date) resources.get(0).get(); - - // print view template - try { - context().out.writeResource("example/app/clock/clock.html"); - } catch (IOException e) { - throw new ApplicationException(e); - } - - if (updateThread == null) { - start(); - } - } - - - public void start() { - updateThread = new Thread() { - public void run() { - while (!shutdown) { - // format date - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - // put formatted string to angular object. - context().getAngularObjectRegistry().add("date", df.format(date)); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // nothing todo - } - date = new Date(date.getTime() + 1000); - } - } - }; - - updateThread.start(); - } - - - @Override - public void unload() throws ApplicationException { - shutdown = true; - try { - updateThread.join(); - } catch (InterruptedException e) { - // nothing to do - } - context().getAngularObjectRegistry().remove("date"); - } - - /** - * Development mode - */ - public static void main(String[] args) throws Exception { - LocalResourcePool pool = new LocalResourcePool("dev"); - pool.put("date", new Date()); - - ZeppelinApplicationDevServer devServer = new ZeppelinApplicationDevServer( - Clock.class.getName(), - pool.getAll()); - - devServer.start(); - devServer.join(); - } -} diff --git a/zeppelin-examples/zeppelin-example-clock/src/main/resources/example/app/clock/clock.html b/zeppelin-examples/zeppelin-example-clock/src/main/resources/example/app/clock/clock.html deleted file mode 100644 index ff492f03e5c..00000000000 --- a/zeppelin-examples/zeppelin-example-clock/src/main/resources/example/app/clock/clock.html +++ /dev/null @@ -1,14 +0,0 @@ - -

    {{date}}

    \ No newline at end of file diff --git a/zeppelin-examples/zeppelin-example-clock/zeppelin-example-clock.json b/zeppelin-examples/zeppelin-example-clock/zeppelin-example-clock.json deleted file mode 100644 index 34701ac0ec7..00000000000 --- a/zeppelin-examples/zeppelin-example-clock/zeppelin-example-clock.json +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ - "type" : "APPLICATION", - "name" : "zeppelin.clock", - "description" : "Clock (example)", - "artifact" : "zeppelin-examples/zeppelin-example-clock/target/zeppelin-example-clock-0.9.0-SNAPSHOT.jar", - "className" : "org.apache.zeppelin.example.app.clock.Clock", - "resources" : [[":java.util.Date"]], - "license" : "Apache-2.0", - "icon" : '' -} diff --git a/zeppelin-examples/zeppelin-example-horizontalbar/horizontalbar.js b/zeppelin-examples/zeppelin-example-horizontalbar/horizontalbar.js deleted file mode 100644 index d574a894b77..00000000000 --- a/zeppelin-examples/zeppelin-example-horizontalbar/horizontalbar.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import Nvd3ChartVisualization from 'zeppelin-vis/builtins/visualization-nvd3chart'; -import PivotTransformation from 'zeppelin-tabledata/pivot'; - -/** - * Base class for visualization - */ -export default class horizontalbar extends Nvd3ChartVisualization { - constructor(targetEl, config) { - super(targetEl, config) - this.pivot = new PivotTransformation(config); - } - - type() { - return 'multiBarHorizontalChart'; - }; - - render(pivot) { - var d3Data = this.d3DataFromPivot( - pivot.schema, - pivot.rows, - pivot.keys, - pivot.groups, - pivot.values, - true, - false, - true); - - super.render(d3Data); - } - - getTransformation() { - return this.pivot; - } - - /** - * Set new config - */ - setConfig(config) { - super.setConfig(config); - this.pivot.setConfig(config); - }; - - configureChart(chart) { - var self = this; - chart.yAxis.axisLabelDistance(50); - chart.yAxis.tickFormat(function(d) {return self.yAxisTickFormat(d);}); - - this.chart.stacked(this.config.stacked); - - var self = this; - this.chart.dispatch.on('stateChange', function(s) { - self.config.stacked = s.stacked; - - // give some time to animation finish - setTimeout(function() { - self.emitConfig(self.config); - }, 500); - }); - }; -} - diff --git a/zeppelin-examples/zeppelin-example-horizontalbar/package.json b/zeppelin-examples/zeppelin-example-horizontalbar/package.json deleted file mode 100644 index 60121d6e8cb..00000000000 --- a/zeppelin-examples/zeppelin-example-horizontalbar/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "zeppelin_horizontalbar", - "description" : "Horizontal Bar chart (example)", - "version": "1.0.0", - "main": "horizontalbar", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "zeppelin-tabledata": "*", - "zeppelin-vis": "*" - } -} diff --git a/zeppelin-examples/zeppelin-example-horizontalbar/pom.xml b/zeppelin-examples/zeppelin-example-horizontalbar/pom.xml deleted file mode 100644 index be1972c65b0..00000000000 --- a/zeppelin-examples/zeppelin-example-horizontalbar/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-examples - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-example-horizontalbar - jar - 0.13.0-SNAPSHOT - Zeppelin: Example application - Horizontal Bar chart - - - - ${project.groupId} - zeppelin-interpreter - ${project.version} - - - - ${project.groupId} - helium-dev - ${project.version} - - - - org.slf4j - slf4j-api - - - - org.slf4j - slf4j-reload4j - - - - ch.qos.reload4j - reload4j - - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-clean-plugin - - - - ${project.basedir}/../../helium - - ${project.artifactId}.json - - - - - - - - maven-resources-plugin - - - generate-resources - - copy-resources - - - - ${project.basedir}/../../helium/ - - - ${project.basedir} - - ${project.artifactId}.json - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-horizontalbar/zeppelin-example-horizontalbar.json b/zeppelin-examples/zeppelin-example-horizontalbar/zeppelin-example-horizontalbar.json deleted file mode 100644 index c8ac28cb501..00000000000 --- a/zeppelin-examples/zeppelin-example-horizontalbar/zeppelin-example-horizontalbar.json +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ - "type" : "VISUALIZATION", - "name" : "zeppelin_horizontalbar", - "description" : "Horizontal Bar chart (example)", - "artifact" : "./zeppelin-examples/zeppelin-example-horizontalbar", - "license" : "Apache-2.0", - "icon" : "" -} diff --git a/zeppelin-examples/zeppelin-example-spell-echo/index.js b/zeppelin-examples/zeppelin-example-spell-echo/index.js deleted file mode 100644 index 5b379e17137..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-echo/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - SpellBase, - SpellResult, - DefaultDisplayType, -} from 'zeppelin-spell'; - -export default class EchoSpell extends SpellBase { - constructor() { - super("%echo"); - } - - /** - * Consumes text and return `SpellResult`. - * - * @param paragraphText {string} which doesn't include magic - * @param config {Object} - * @return {SpellResult} - */ - interpret(paragraphText, config) { - let repeat = 1; - - try { - repeat = parseFloat(config.repeat); - } catch (error) { - /** ignore, use default value */ - } - - let repeated = ""; - - for (let i = 0; i < repeat; i++) { - repeated += `${paragraphText}\n`; - } - - return new SpellResult(repeated); - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-echo/package.json b/zeppelin-examples/zeppelin-example-spell-echo/package.json deleted file mode 100644 index 2d9710eb0d7..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-echo/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "echo-spell", - "description" : "Return just what receive (example)", - "version": "1.0.0", - "main": "index", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "zeppelin-spell": "*" - }, - "spell": { - "magic": "%echo", - "usage": "%echo " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-echo/pom.xml b/zeppelin-examples/zeppelin-example-spell-echo/pom.xml deleted file mode 100644 index 010197129fa..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-echo/pom.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-examples - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-example-spell-echo - jar - 0.13.0-SNAPSHOT - Zeppelin: Example Spell - Echo - - - - ${project.groupId} - zeppelin-interpreter - ${project.version} - - - - ${project.groupId} - helium-dev - ${project.version} - - - - org.slf4j - slf4j-api - - - - org.slf4j - slf4j-reload4j - - - - ch.qos.reload4j - reload4j - - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-clean-plugin - - - - ${project.basedir}/../../helium - - ${project.artifactId}.json - - - - - - - - maven-resources-plugin - - - generate-resources - - copy-resources - - - - ${project.basedir}/../../helium/ - - - ${project.basedir} - - ${project.artifactId}.json - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-spell-echo/zeppelin-example-spell-echo.json b/zeppelin-examples/zeppelin-example-spell-echo/zeppelin-example-spell-echo.json deleted file mode 100644 index fe1d06e27e1..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-echo/zeppelin-example-spell-echo.json +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ - "type" : "SPELL", - "name" : "echo-spell", - "description" : "Return just what receive (example)", - "artifact" : "./zeppelin-examples/zeppelin-example-spell-echo", - "license" : "Apache-2.0", - "icon" : "", - "config": { - "repeat": { - "type": "number", - "description": "How many times to repeat", - "defaultValue": 1 - } - }, - "spell": { - "magic": "%echo", - "usage": "%echo " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-flowchart/index.js b/zeppelin-examples/zeppelin-example-spell-flowchart/index.js deleted file mode 100644 index 655814a45c3..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-flowchart/index.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - SpellBase, - SpellResult, - DefaultDisplayType, -} from 'zeppelin-spell'; - -import flowchart from 'flowchart.js'; - -export default class FlowchartSpell extends SpellBase { - constructor() { - super("%flowchart"); - } - - interpret(paragraphText) { - /** - * `flowchart` library requires an existing DOM to render. - * but the DOM is not created yet when `interpret` is called. - * so Zeppelin allows to return callback function which accept a DOM element id. - * the callback function will executed when the DOM is ready. - */ - const callback = (targetElemId) => { - let diagram = flowchart.parse(paragraphText); - diagram.drawSVG(targetElemId, this.getOption()); - }; - - /** - * `interpret` method can return multiple results using `add()` - * but now, we return just 1 result - */ - return new SpellResult( - callback - ); - } - - getOption() { - return { - 'x': 0, - 'y': 0, - 'line-width': 3, - 'line-length': 50, - 'text-margin': 10, - 'font-size': 14, - 'font-color': 'black', - 'line-color': 'black', - 'element-color': 'black', - 'fill': 'white', - 'yes-text': 'yes', - 'no-text': 'no', - 'arrow-end': 'block', - 'scale': 1, - // style symbol types - 'symbols': { - 'start': { - 'font-color': 'red', - 'element-color': 'green', - 'fill': 'yellow' - }, - 'end':{ - 'class': 'end-element' - } - }, - // even flowstate support ;-) - 'flowstate' : { - 'past' : { 'fill' : '#CCCCCC', 'font-size' : 12}, - 'current' : {'fill' : 'yellow', 'font-color' : 'red', 'font-weight' : 'bold'}, - 'future' : { 'fill' : '#FFFF99'}, - 'request' : { 'fill' : 'blue'}, - 'invalid': {'fill' : '#444444'}, - 'approved' : { 'fill' : '#58C4A3', 'font-size' : 12, 'yes-text' : 'APPROVED', 'no-text' : 'n/a' }, - 'rejected' : { 'fill' : '#C45879', 'font-size' : 12, 'yes-text' : 'n/a', 'no-text' : 'REJECTED' } - } - } - } -} - - - - - - - - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-spell-flowchart/package.json b/zeppelin-examples/zeppelin-example-spell-flowchart/package.json deleted file mode 100644 index 24be73bc75b..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-flowchart/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "flowchart-spell", - "description" : "Draw flowchart using http://flowchart.js.org (example)", - "version": "1.0.0", - "main": "index", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "raphael": "2.2.0", - "flowchart.js": "^1.6.5", - "zeppelin-spell": "*" - }, - "spell": { - "magic": "%flowchart", - "usage": "%flowchart " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-flowchart/pom.xml b/zeppelin-examples/zeppelin-example-spell-flowchart/pom.xml deleted file mode 100644 index dd65f595014..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-flowchart/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-examples - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-example-spell-flowchart - jar - 0.13.0-SNAPSHOT - Zeppelin: Example Spell - Flowchart - - - - ${project.groupId} - zeppelin-interpreter - ${project.version} - - - - ${project.groupId} - helium-dev - ${project.version} - - - - org.slf4j - slf4j-api - - - - org.slf4j - slf4j-reload4j - - - - ch.qos.reload4j - reload4j - - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-clean-plugin - - - - ${project.basedir}/../../helium - - ${project.artifactId}.json - - - - - - - - maven-resources-plugin - - - generate-resources - - copy-resources - - - - ${project.basedir}/../../helium/ - - - ${project.basedir} - - ${project.artifactId}.json - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-spell-flowchart/zeppelin-example-spell-flowchart.json b/zeppelin-examples/zeppelin-example-spell-flowchart/zeppelin-example-spell-flowchart.json deleted file mode 100644 index 0ea6e41e3c5..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-flowchart/zeppelin-example-spell-flowchart.json +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ - "type" : "SPELL", - "name" : "flowchart-spell", - "description" : "Draw flowchart using http://flowchart.js.org (example)", - "artifact" : "./zeppelin-examples/zeppelin-example-spell-flowchart", - "license" : "Apache-2.0", - "icon" : "", - "spell": { - "magic": "%flowchart", - "usage": "%flowchart " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-markdown/index.js b/zeppelin-examples/zeppelin-example-spell-markdown/index.js deleted file mode 100644 index db7959f9a0c..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-markdown/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - SpellBase, - SpellResult, - DefaultDisplayType, -} from 'zeppelin-spell'; - -import md from 'markdown'; - -const markdown = md.markdown; - -export default class MarkdownSpell extends SpellBase { - constructor() { - super("%markdown"); - } - - interpret(paragraphText) { - const parsed = markdown.toHTML(paragraphText); - - /** - * specify `DefaultDisplayType.HTML` since `parsed` will contain DOM - * otherwise it will be rendered as `DefaultDisplayType.TEXT` (default) - */ - return new SpellResult(parsed, DefaultDisplayType.HTML); - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-markdown/package.json b/zeppelin-examples/zeppelin-example-spell-markdown/package.json deleted file mode 100644 index 997a2a26591..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-markdown/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "markdown-spell", - "description" : "Parse markdown using https://github.com/evilstreak/markdown-js (example)", - "version": "1.0.0", - "main": "index", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "markdown": "0.5.0", - "zeppelin-spell": "*" - }, - "spell": { - "magic": "%markdown", - "usage": "%markdown " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-markdown/pom.xml b/zeppelin-examples/zeppelin-example-spell-markdown/pom.xml deleted file mode 100644 index 1e522cf201c..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-markdown/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-examples - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-example-spell-markdown - jar - 0.13.0-SNAPSHOT - Zeppelin: Example Spell - Markdown - - - - ${project.groupId} - zeppelin-interpreter - ${project.version} - - - - ${project.groupId} - helium-dev - ${project.version} - - - - org.slf4j - slf4j-api - - - - org.slf4j - slf4j-reload4j - - - - ch.qos.reload4j - reload4j - - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-clean-plugin - - - - ${project.basedir}/../../helium - - ${project.artifactId}.json - - - - - - - - maven-resources-plugin - - - generate-resources - - copy-resources - - - - ${project.basedir}/../../helium/ - - - ${project.basedir} - - ${project.artifactId}.json - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-spell-markdown/zeppelin-example-spell-markdown.json b/zeppelin-examples/zeppelin-example-spell-markdown/zeppelin-example-spell-markdown.json deleted file mode 100644 index 48ad2463de9..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-markdown/zeppelin-example-spell-markdown.json +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ - "type" : "SPELL", - "name" : "markdown-spell", - "description" : "Parse markdown using https://github.com/evilstreak/markdown-js (example)", - "artifact" : "./zeppelin-examples/zeppelin-example-spell-markdown", - "license" : "Apache-2.0", - "icon" : "", - "spell": { - "magic": "%markdown", - "usage": "%markdown " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-translator/index.js b/zeppelin-examples/zeppelin-example-spell-translator/index.js deleted file mode 100644 index 284ce3ba29e..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-translator/index.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - SpellBase, - SpellResult, - DefaultDisplayType, -} from 'zeppelin-spell'; - -import 'whatwg-fetch'; - -export default class TranslatorSpell extends SpellBase { - constructor() { - super("%translator"); - } - - /** - * Consumes text and return `SpellResult`. - * - * @param paragraphText {string} which doesn't include magic - * @param config {Object} - * @return {SpellResult} - */ - interpret(paragraphText, config) { - const parsed = this.parseConfig(paragraphText); - const auth = config['access-token']; - const source = parsed.source; - const target = parsed.target; - const text = parsed.text; - - /** - * SpellResult.add() - * - accepts not only `string` but also `promise` as a parameter - * - allows to add multiple output using the `add()` function - */ - const result = new SpellResult() - .add('

    Translation Result

    ', DefaultDisplayType.HTML) - // or use display system implicitly like - // .add('%html

    Translation From English To Korean

    ') - .add(this.translate(source, target, auth, text)); - return result; - } - - parseConfig(text) { - const pattern = /^\s*(\S+)-(\S+)\s*([\S\s]*)/g; - const match = pattern.exec(text); - - if (!match) { - throw new Error(`Failed to parse configuration. See README`); - } - - return { - source: match[1], - target: match[2], - text: match[3], - } - } - - translate(source, target, auth, text) { - return fetch('https://translation.googleapis.com/language/translate/v2', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${auth}`, - }, - body: JSON.stringify({ - 'q': text, - 'source': source, - 'target': target, - 'format': 'text' - }) - }).then(response => { - if (response.status === 200) { - return response.json() - } - throw new Error(`https://translation.googleapis.com/language/translate/v2 ${response.status} (${response.statusText})`); - }).then((json) => { - const extracted = json.data.translations.map(t => { - return t.translatedText; - }); - return extracted.join('\n'); - }); - } -} - diff --git a/zeppelin-examples/zeppelin-example-spell-translator/package.json b/zeppelin-examples/zeppelin-example-spell-translator/package.json deleted file mode 100644 index 90624f8bf40..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-translator/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "translator-spell", - "description" : "Translate langauges using Google API (examaple)", - "version": "1.0.0", - "main": "index", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "whatwg-fetch": "^2.0.1", - "zeppelin-spell": "*" - }, - "spell": { - "magic": "%translator", - "usage": "%translator - " - } -} diff --git a/zeppelin-examples/zeppelin-example-spell-translator/pom.xml b/zeppelin-examples/zeppelin-example-spell-translator/pom.xml deleted file mode 100644 index b0a60516c10..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-translator/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - zeppelin-examples - org.apache.zeppelin - 0.13.0-SNAPSHOT - .. - - - zeppelin-example-spell-translator - jar - 0.13.0-SNAPSHOT - Zeppelin: Example Spell - Translator - - - - ${project.groupId} - zeppelin-interpreter - ${project.version} - - - - ${project.groupId} - helium-dev - ${project.version} - - - - org.slf4j - slf4j-api - - - - org.slf4j - slf4j-reload4j - - - - ch.qos.reload4j - reload4j - - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - maven-clean-plugin - - - - ${project.basedir}/../../helium - - ${project.artifactId}.json - - - - - - - - maven-resources-plugin - - - generate-resources - - copy-resources - - - - ${project.basedir}/../../helium/ - - - ${project.basedir} - - ${project.artifactId}.json - - - - - - - - - - diff --git a/zeppelin-examples/zeppelin-example-spell-translator/zeppelin-example-spell-translator.json b/zeppelin-examples/zeppelin-example-spell-translator/zeppelin-example-spell-translator.json deleted file mode 100644 index 965e90c34ec..00000000000 --- a/zeppelin-examples/zeppelin-example-spell-translator/zeppelin-example-spell-translator.json +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ - "type" : "SPELL", - "name" : "translator-spell", - "description" : "Translate langauges using Google API (examaple)", - "artifact" : "./zeppelin-examples/zeppelin-example-spell-translator", - "license" : "Apache-2.0", - "icon" : "", - "config": { - "access-token": { - "type": "string", - "description": "access token for Google Translation API", - "defaultValue": "EXAMPLE-TOKEN" - } - }, - "spell": { - "magic": "%translator", - "usage": "%translator - " - } -} diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ShellIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ShellIntegrationTest.java index 875835b599a..fb91a259f97 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ShellIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ShellIntegrationTest.java @@ -18,7 +18,6 @@ package org.apache.zeppelin.integration; import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.notebook.Notebook; import org.apache.zeppelin.notebook.Paragraph; import org.apache.zeppelin.rest.AbstractTestRestApi; @@ -42,8 +41,7 @@ static void init() throws Exception { zepServer = new MiniZeppelinServer(ShellIntegrationTest.class.getSimpleName()); zepServer.addInterpreter("sh"); zepServer.copyBinDir(); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.start(); } diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java index a3b1b4c2a7c..5b48a2bb147 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java @@ -28,7 +28,6 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.zeppelin.test.DownloadUtils; import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.ExecutionContext; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; @@ -90,8 +89,7 @@ static void init() throws Exception { zepServer.addInterpreter("spark-submit"); zepServer.copyBinDir(); zepServer.copyLogProperties(); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.start(); interpreterSettingManager = zepServer.getService(InterpreterSettingManager.class); interpreterFactory = zepServer.getService(InterpreterFactory.class); diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkSubmitIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkSubmitIntegrationTest.java index 97af763d31f..8e1d92737cc 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkSubmitIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkSubmitIntegrationTest.java @@ -27,7 +27,6 @@ import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.zeppelin.test.DownloadUtils; import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.ExecutionContext; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; @@ -73,8 +72,7 @@ static void init() throws Exception { zepServer.addInterpreter("sh"); zepServer.addInterpreter("spark-submit"); zepServer.copyBinDir(); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.start(); interpreterSettingManager = zepServer.getService(InterpreterSettingManager.class); interpreterFactory = zepServer.getService(InterpreterFactory.class); diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/YarnInterpreterLauncherIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/YarnInterpreterLauncherIntegrationTest.java index 46f8bc1267b..aff1be0c5ed 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/YarnInterpreterLauncherIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/YarnInterpreterLauncherIntegrationTest.java @@ -69,8 +69,7 @@ static void init() throws Exception { zepServer.addLauncher("YarnInterpreterLauncher"); zepServer.copyLogProperties(); zepServer.copyBinDir(); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_ALLOWED_ORIGINS.getVarName(), "*"); zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName(), "120000"); diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java index 5d491c49f82..d8b1b3815a2 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java @@ -67,12 +67,10 @@ static void init() throws Exception { zepServer.copyBinDir(); zepServer.addLauncher("FlinkInterpreterLauncher"); ZeppelinConfiguration zConf = zepServer.getZeppelinConfiguration(); - zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_ALLOWED_ORIGINS.getVarName(), "*"); zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SESSION_CHECK_INTERVAL.getVarName(), "5000"); - zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_LIFECYCLE_MANAGER_CLASS.getVarName(), TimeoutLifecycleManager.class.getName()); zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_LIFECYCLE_MANAGER_TIMEOUT_CHECK_INTERVAL.getVarName(), "5000"); zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_LIFECYCLE_MANAGER_TIMEOUT_THRESHOLD.getVarName(), "10000"); diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientIntegrationTest.java index e1e3bbf3319..c0c9d128150 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientIntegrationTest.java @@ -64,8 +64,7 @@ static void init() throws Exception { zepServer.copyBinDir(); zepServer.copyLogProperties(); ZeppelinConfiguration zConf = zepServer.getZeppelinConfiguration(); - zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_ALLOWED_ORIGINS.getVarName(), "*"); zepServer.start(); clientConfig = new ClientConfig("http://localhost:" + zepServer.getZeppelinConfiguration().getServerPort()); diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientWithAuthIntegrationTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientWithAuthIntegrationTest.java index bfe170916fe..3afa21c994f 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientWithAuthIntegrationTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinClientWithAuthIntegrationTest.java @@ -48,8 +48,7 @@ static void init() throws Exception { zepServer.addInterpreter("md"); zepServer.addConfigFile("shiro.ini", AbstractTestRestApi.ZEPPELIN_SHIRO); zepServer.copyBinDir(); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_ALLOWED_ORIGINS.getVarName(), "*"); zepServer.start(); clientConfig = new ClientConfig("http://localhost:" + zepServer.getZeppelinConfiguration().getServerPort()); diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinFlinkClusterTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinFlinkClusterTest.java index 8f61fbfb82e..8d1554be8e9 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinFlinkClusterTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinFlinkClusterTest.java @@ -20,7 +20,6 @@ import org.apache.commons.io.IOUtils; import org.apache.zeppelin.test.DownloadUtils; import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.notebook.Notebook; import org.apache.zeppelin.notebook.Paragraph; import org.apache.zeppelin.rest.AbstractTestRestApi; @@ -64,8 +63,7 @@ static void init() throws Exception { zepServer.addInterpreter("flink-cmd"); zepServer.copyBinDir(); zepServer.addLauncher("FlinkInterpreterLauncher"); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.start(); } diff --git a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinSparkClusterTest.java b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinSparkClusterTest.java index 06580746c33..f13598ddd8f 100644 --- a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinSparkClusterTest.java +++ b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinSparkClusterTest.java @@ -19,7 +19,6 @@ import org.apache.commons.io.IOUtils; import org.apache.zeppelin.test.DownloadUtils; import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.display.AngularObject; import org.apache.zeppelin.display.Input; import org.apache.zeppelin.display.ui.CheckBox; @@ -140,8 +139,7 @@ static void init() throws Exception { zepServer.addInterpreter("python"); zepServer.copyBinDir(); zepServer.copyLogProperties(); - zepServer.getZeppelinConfiguration().setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.start(); } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java deleted file mode 100644 index a2e87670c58..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.annotation.Experimental; -import org.apache.zeppelin.resource.ResourceSet; - -import java.io.IOException; - -/** - * Base class for pluggable application (e.g. visualization) - * Application can access resources from ResourcePool and interact with front-end using - * AngularDisplay system - */ -@Experimental -public abstract class Application { - - private final ApplicationContext context; - - protected Application(ApplicationContext context) { - this.context = context; - } - - public ApplicationContext context() { - return context; - } - - /** - * This method can be invoked multiple times before unload(), - * Either just after application selected or when paragraph re-run after application load - */ - @Experimental - public abstract void run(ResourceSet args) - throws ApplicationException, IOException; - - - /** - * this method is invoked just before application is removed - */ - @Experimental - public abstract void unload() throws ApplicationException; - - /** - * Print string on the notebook - * @param string - * @throws IOException - */ - @Experimental - public void print(String string) throws IOException { - context.out.write(string); - } - - /** - * Print string on the notebook with newline - * @param string - * @throws IOException - */ - @Experimental - public void println(String string) throws IOException { - print(string + "\n"); - } - - /** - * Print resource on the notebook - * @param resourceName - * @throws IOException - */ - @Experimental - public void printResource(String resourceName) throws IOException { - context.out.writeResource(resourceName); - } - - /** - * Print resource as a javascript - * - * Using this method does not require print javascript inside of tag. - * Javascript printed using this method will be run in the un-named function. - * i.e. each method call will creates different variable scope for the javascript code. - * - * This method inject '$z' into the variable scope for convenience. - * - * $z.scope : angularjs scope object for this application - * $z.id : unique id for this application instance - * - * @param resourceName - * @throws IOException - */ - @Experimental - public void printResourceAsJavascript(String resourceName) throws IOException { - beginJavascript(); - context.out.writeResource(resourceName); - endJavascript(); - } - - /** - * Print string as a javascript - * - * Using this method does not require print javascript inside of tag. - * Javascript printed using this method will be run in the un-named function. - * i.e. each method call will creates different variable scope for the javascript code. - * - * This method inject '$z' into the variable scope for convenience. - * - * $z.scope : angularjs scope object for this application - * $z.id : unique id for this application instance - * - * @param js - * @throws IOException - */ - @Experimental - public void printStringAsJavascript(String js) throws IOException { - beginJavascript(); - context.out.write(js); - endJavascript(); - } - - private void beginJavascript() throws IOException { - StringBuilder js = new StringBuilder(); - js.append("\n\n"); - context.out.write(js.toString()); - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationContext.java deleted file mode 100644 index 8d3f67e9912..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationContext.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.interpreter.InterpreterOutput; - -/** - * ApplicationContext - */ -public class ApplicationContext { - private final String noteId; - private final String paragraphId; - private final String applicationInstanceId; - private final HeliumAppAngularObjectRegistry angularObjectRegistry; - public final InterpreterOutput out; - - - public ApplicationContext(String noteId, - String paragraphId, - String applicationInstanceId, - HeliumAppAngularObjectRegistry angularObjectRegistry, - InterpreterOutput out) { - this.noteId = noteId; - this.paragraphId = paragraphId; - this.applicationInstanceId = applicationInstanceId; - this.angularObjectRegistry = angularObjectRegistry; - this.out = out; - } - - public String getNoteId() { - return noteId; - } - - public String getParagraphId() { - return paragraphId; - } - - public String getApplicationInstanceId() { - return applicationInstanceId; - } - - public HeliumAppAngularObjectRegistry getAngularObjectRegistry() { - return angularObjectRegistry; - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationEventListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationEventListener.java deleted file mode 100644 index ca971f5c32f..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationEventListener.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.interpreter.InterpreterResult; - -/** - * Event from HeliumApplication running on remote interpreter process - */ -public interface ApplicationEventListener { - void onOutputAppend( - String noteId, String paragraphId, int index, String appId, String output); - void onOutputUpdated( - String noteId, String paragraphId, int index, String appId, - InterpreterResult.Type type, String output); - void onLoad(String noteId, String paragraphId, String appId, HeliumPackage pkg); - void onStatusChange(String noteId, String paragraphId, String appId, String status); -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationException.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationException.java deleted file mode 100644 index d3c648886e8..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -/** - * Application exception - */ -public class ApplicationException extends Exception { - public ApplicationException(String s) { - super(s); - } - - public ApplicationException(Exception e) { - super(e); - } - - public ApplicationException() { - - } - - public ApplicationException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationLoader.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationLoader.java deleted file mode 100644 index 7ba68c60d21..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationLoader.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.dep.DependencyResolver; -import org.apache.zeppelin.resource.DistributedResourcePool; -import org.apache.zeppelin.resource.Resource; -import org.apache.zeppelin.resource.ResourcePool; -import org.apache.zeppelin.resource.ResourceSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * Load application - */ -public class ApplicationLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationLoader.class); - - private final DependencyResolver depResolver; - private final ResourcePool resourcePool; - private final Map> cached; - - public ApplicationLoader(ResourcePool resourcePool, DependencyResolver depResolver) { - this.depResolver = depResolver; - this.resourcePool = resourcePool; - cached = Collections.synchronizedMap( - new HashMap>()); - } - - /** - * Information of loaded application - */ - private static class RunningApplication { - HeliumPackage packageInfo; - String noteId; - String paragraphId; - - RunningApplication(HeliumPackage packageInfo, String noteId, String paragraphId) { - this.packageInfo = packageInfo; - this.noteId = noteId; - this.paragraphId = paragraphId; - } - - public HeliumPackage getPackageInfo() { - return packageInfo; - } - - public String getNoteId() { - return noteId; - } - - public String getParagraphId() { - return paragraphId; - } - - @Override - public int hashCode() { - return (paragraphId + noteId + packageInfo.getArtifact() + packageInfo.getClassName()) - .hashCode(); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof RunningApplication)) { - return false; - } - - RunningApplication r = (RunningApplication) o; - return packageInfo.equals(r.getPackageInfo()) && paragraphId.equals(r.getParagraphId()) && - noteId.equals(r.getNoteId()); - } - } - - /** - * - * Instantiate application - * - * @param packageInfo - * @param context - * @return - * @throws Exception - */ - public Application load(HeliumPackage packageInfo, ApplicationContext context) - throws Exception { - if (packageInfo.getType() != HeliumType.APPLICATION) { - throw new ApplicationException( - "Can't instantiate " + packageInfo.getType() + " package using ApplicationLoader"); - } - - // check if already loaded - RunningApplication key = - new RunningApplication(packageInfo, context.getNoteId(), context.getParagraphId()); - - // get resource required by this package - ResourceSet resources = findRequiredResourceSet(packageInfo.getResources(), - context.getNoteId(), context.getParagraphId()); - - // load class - Class appClass = loadClass(packageInfo); - - // instantiate - ClassLoader oldcl = Thread.currentThread().getContextClassLoader(); - ClassLoader cl = appClass.getClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - try { - Constructor constructor = appClass.getConstructor(ApplicationContext.class); - - Application app = new ClassLoaderApplication(constructor.newInstance(context), cl); - return app; - } catch (Exception e) { - throw new ApplicationException(e); - } finally { - Thread.currentThread().setContextClassLoader(oldcl); - } - } - - public ResourceSet findRequiredResourceSet( - String [][] requiredResources, String noteId, String paragraphId) { - if (requiredResources == null || requiredResources.length == 0) { - return new ResourceSet(); - } - - ResourceSet allResources; - if (resourcePool instanceof DistributedResourcePool) { - allResources = ((DistributedResourcePool) resourcePool).getAll(false); - } else { - allResources = resourcePool.getAll(); - } - - return findRequiredResourceSet(requiredResources, noteId, paragraphId, allResources); - } - - static ResourceSet findRequiredResourceSet(String [][] requiredResources, - String noteId, - String paragraphId, - ResourceSet resources) { - ResourceSet args = new ResourceSet(); - if (requiredResources == null || requiredResources.length == 0) { - return args; - } - - resources = resources.filterByNoteId(noteId).filterByParagraphId(paragraphId); - - for (String [] requires : requiredResources) { - args.clear(); - - for (String require : requires) { - boolean found = false; - - for (Resource r : resources) { - if (require.startsWith(":") && r.getClassName().equals(require.substring(1))) { - found = true; - } else if (r.getResourceId().getName().equals(require)) { - found = true; - } - - if (found) { - args.add(r); - break; - } - } - - if (found == false) { - break; - } - } - - if (args.size() == requires.length) { - return args; - } - } - - return null; - } - - - private Class loadClass(HeliumPackage packageInfo) throws Exception { - if (cached.containsKey(packageInfo)) { - return cached.get(packageInfo); - } - - // Create Application classloader - List urlList = new LinkedList<>(); - - // load artifact - if (packageInfo.getArtifact() != null) { - List paths = depResolver.load(packageInfo.getArtifact()); - - if (paths != null) { - - for (File path : paths) { - urlList.add(path.toURI().toURL()); - } - } - } - URLClassLoader applicationClassLoader = - new URLClassLoader( - urlList.toArray(new URL[]{}), - Thread.currentThread().getContextClassLoader()); - - Class cls = - (Class) applicationClassLoader.loadClass(packageInfo.getClassName()); - cached.put(packageInfo, cls); - return cls; - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ClassLoaderApplication.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ClassLoaderApplication.java deleted file mode 100644 index 272a152448e..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ClassLoaderApplication.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.resource.ResourceSet; - -/** - * Application wrapper - */ -public class ClassLoaderApplication extends Application { - Application app; - ClassLoader cl; - public ClassLoaderApplication(Application app, ClassLoader cl) throws ApplicationException { - super(app.context()); - this.app = app; - this.cl = cl; - } - - @Override - public void run(ResourceSet args) throws ApplicationException { - // instantiate - ClassLoader oldcl = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - try { - app.run(args); - } catch (ApplicationException e) { - throw e; - } catch (Exception e) { - throw new ApplicationException(e); - } finally { - Thread.currentThread().setContextClassLoader(oldcl); - } - } - - @Override - public void unload() throws ApplicationException { - // instantiate - ClassLoader oldcl = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - try { - app.unload(); - } catch (ApplicationException e) { - throw e; - } catch (Exception e) { - throw new ApplicationException(e); - } finally { - Thread.currentThread().setContextClassLoader(oldcl); - } - } - - public ClassLoader getClassLoader() { - return cl; - } - - public Application getInnerApplication() { - return app; - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumAppAngularObjectRegistry.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumAppAngularObjectRegistry.java deleted file mode 100644 index dedb603add8..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumAppAngularObjectRegistry.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.display.AngularObject; -import org.apache.zeppelin.display.AngularObjectRegistry; - -import java.util.List; - -/** - * Angular Registry for helium app - */ -public class HeliumAppAngularObjectRegistry { - private final String noteId; - private final String appId; - private final AngularObjectRegistry angularObjectRegistry; - - public HeliumAppAngularObjectRegistry(AngularObjectRegistry angularObjectRegistry, - String noteId, - String appId) { - this.angularObjectRegistry = angularObjectRegistry; - this.noteId = noteId; - this.appId = appId; - } - - public AngularObject add(String name, Object o) { - return angularObjectRegistry.add(name, o, noteId, appId); - } - - public AngularObject remove(String name) { - return angularObjectRegistry.remove(name, noteId, appId); - } - - public AngularObject get(String name) { - return angularObjectRegistry.get(name, noteId, appId); - } - - public List getAll() { - return angularObjectRegistry.getAll(noteId, appId); - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumPackage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumPackage.java deleted file mode 100644 index 51b0fcbe513..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumPackage.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import org.apache.commons.text.StringEscapeUtils; -import org.apache.zeppelin.annotation.Experimental; -import org.apache.zeppelin.common.JsonSerializable; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -import static org.apache.commons.text.StringEscapeUtils.escapeHtml4; - -/** - * Helium package definition - */ -@Experimental -public class HeliumPackage implements JsonSerializable { - private static final Gson gson = new Gson(); - - private HeliumType type; - private String name; // user friendly name of this application - private String description; // description - private String artifact; // artifact name e.g) groupId:artifactId:versionId - private String className; // entry point - // resource classnames that requires [[ .. and .. and .. ] or [ .. and .. and ..] ..] - private String [][] resources; - - private String license; - private String icon; - private String published; - - private String groupId; // get groupId of INTERPRETER type package - private String artifactId; // get artifactId of INTERPRETER type package - - private SpellPackageInfo spell; - private Map config; - - private HeliumPackage(HeliumType type, - String name, - String description, - String artifact, - String className, - String[][] resources, - String license, - String icon) { - this.type = type; - this.name = name; - this.description = description; - this.artifact = artifact; - this.className = className; - this.resources = resources; - this.license = license; - this.icon = icon; - } - - @Override - public int hashCode() { - return (type.toString() + artifact + className).hashCode(); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof HeliumPackage)) { - return false; - } - - HeliumPackage info = (HeliumPackage) o; - return type == info.type && artifact.equals(info.artifact) && className.equals(info.className); - } - - public HeliumType getType() { - return type; - } - - public static boolean isBundleType(HeliumType type) { - return (type == HeliumType.VISUALIZATION || - type == HeliumType.SPELL); - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getArtifact() { - return artifact; - } - - public String getClassName() { - return className; - } - - public String[][] getResources() { - return resources; - } - - public String getLicense() { - return license; - } - - public String getIcon() { - return icon; - } - - public String getPublishedDate() { - return published; - } - - public String getGroupId() { - return groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public SpellPackageInfo getSpellInfo() { - return spell; - } - - public Map getConfig() { return config; } - - public String toJson() { - return gson.toJson(this); - } - - public static HeliumPackage fromJson(String json) { - return preventXss(gson.fromJson(json, HeliumPackage.class)); - } - - // This is only for test - public static HeliumPackage newHeliumPackage(HeliumType type, - String name, - String description, - String artifact, - String className, - String[][] resources, - String license, - String icon) { - return preventXss(new HeliumPackage( - type, name, description, artifact, className, resources, license, icon)); - } - - private static HeliumPackage preventXss(HeliumPackage heliumPackage) { - heliumPackage.name = escapeHtml4(heliumPackage.name); - heliumPackage.description = escapeHtml4(heliumPackage.description); - heliumPackage.artifact = escapeHtml4(heliumPackage.artifact); - heliumPackage.className = escapeHtml4(heliumPackage.className); - heliumPackage.resources = - Optional.ofNullable(heliumPackage.getResources()).map(r -> Arrays.stream(r) - .map(resource -> Arrays.stream(resource).map(StringEscapeUtils::escapeHtml4) - .toArray(String[]::new)) - .toArray(String[][]::new)).orElse(null); - heliumPackage.license = escapeHtml4(heliumPackage.license); - heliumPackage.published = escapeHtml4(heliumPackage.published); - heliumPackage.groupId = escapeHtml4(heliumPackage.groupId); - heliumPackage.artifactId = escapeHtml4(heliumPackage.artifactId); - heliumPackage.spell = Optional.ofNullable(heliumPackage.getSpellInfo()) - .map(spellPackageInfo -> new SpellPackageInfo( - escapeHtml4(spellPackageInfo.getMagic()), - escapeHtml4(spellPackageInfo.getUsage()))) - .orElse(null); - return heliumPackage; - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumType.java deleted file mode 100644 index 53360a08b1c..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/HeliumType.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -/** - * Type of Helium Package - */ -public enum HeliumType { - INTERPRETER, - NOTEBOOK_REPO, - APPLICATION, - VISUALIZATION, - SPELL -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/SpellPackageInfo.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/SpellPackageInfo.java deleted file mode 100644 index 52e17dbd3fd..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/SpellPackageInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -/** - * Info for Helium Spell Package. - */ -public class SpellPackageInfo { - private String magic; - private String usage; - - public SpellPackageInfo(String magic, String usage) { - this.magic = magic; - this.usage = usage; - } - - public String getMagic() { - return magic; - } - - public String getUsage() { - return usage; - } -} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java index df281c84d44..31328c79386 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java @@ -25,9 +25,6 @@ import org.apache.zeppelin.display.AngularObjectRegistryListener; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterResultMessage; -import org.apache.zeppelin.interpreter.thrift.AppOutputAppendEvent; -import org.apache.zeppelin.interpreter.thrift.AppOutputUpdateEvent; -import org.apache.zeppelin.interpreter.thrift.AppStatusUpdateEvent; import org.apache.zeppelin.interpreter.thrift.LibraryMetadata; import org.apache.zeppelin.interpreter.thrift.OutputAppendEvent; import org.apache.zeppelin.interpreter.thrift.OutputUpdateAllEvent; @@ -226,7 +223,7 @@ public void onInterpreterOutputAppend( try { callRemoteFunction(client -> { client.appendOutput(new OutputAppendEvent( - noteId, paragraphId, outputIndex, output, null, executionOwner)); + noteId, paragraphId, outputIndex, output, executionOwner)); return null; }); } catch (Exception e) { @@ -240,7 +237,7 @@ public void onInterpreterOutputUpdate( try { callRemoteFunction(client -> { client.updateOutput(new OutputUpdateEvent( - noteId, paragraphId, outputIndex, type.name(), output, null, executionOwner)); + noteId, paragraphId, outputIndex, type.name(), output, executionOwner)); return null; }); @@ -304,49 +301,6 @@ public void checkpointOutput(String noteId, String paragraphId) { } } - public void onAppOutputAppend( - String noteId, String paragraphId, int index, String appId, String output) { - AppOutputAppendEvent event = - new AppOutputAppendEvent(noteId, paragraphId, appId, index, output); - try { - callRemoteFunction(client -> { - client.appendAppOutput(event); - return null; - }); - } catch (Exception e) { - LOGGER.warn("Fail to appendAppOutput: {}", event, e); - } - } - - - public void onAppOutputUpdate( - String noteId, String paragraphId, int index, String appId, - InterpreterResult.Type type, String output) { - AppOutputUpdateEvent event = - new AppOutputUpdateEvent(noteId, paragraphId, appId, index, type.name(), output); - try { - callRemoteFunction(client -> { - client.updateAppOutput(event); - return null; - }); - } catch (Exception e) { - LOGGER.warn("Fail to updateAppOutput: {}", event, e); - } - } - - public void onAppStatusUpdate(String noteId, String paragraphId, String appId, - String status) { - AppStatusUpdateEvent event = new AppStatusUpdateEvent(noteId, paragraphId, appId, status); - try { - callRemoteFunction(client -> { - client.updateAppStatus(event); - return null; - }); - } catch (Exception e) { - LOGGER.warn("Fail to updateAppStatus: {}", event, e); - } - } - public void onParaInfosReceived(Map infos) { try { callRemoteFunction(client -> { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java index 346a8641ea1..5ba372d8894 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java @@ -25,16 +25,9 @@ import org.apache.thrift.server.TThreadPoolServer; import org.apache.thrift.transport.TServerSocket; import org.apache.thrift.transport.TTransportException; -import org.apache.zeppelin.dep.DependencyResolver; import org.apache.zeppelin.display.AngularObject; import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.GUI; -import org.apache.zeppelin.helium.Application; -import org.apache.zeppelin.helium.ApplicationContext; -import org.apache.zeppelin.helium.ApplicationException; -import org.apache.zeppelin.helium.ApplicationLoader; -import org.apache.zeppelin.helium.HeliumAppAngularObjectRegistry; -import org.apache.zeppelin.helium.HeliumPackage; import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; @@ -54,7 +47,6 @@ import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.interpreter.thrift.InterpreterRPCException; import org.apache.zeppelin.interpreter.thrift.RegisterInfo; -import org.apache.zeppelin.interpreter.thrift.RemoteApplicationResult; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterContext; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResult; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage; @@ -79,7 +71,6 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -109,7 +100,6 @@ public class RemoteInterpreterServer extends Thread private AngularObjectRegistry angularObjectRegistry; private InterpreterHookRegistry hookRegistry; private DistributedResourcePool resourcePool; - private ApplicationLoader appLoader; private Gson gson = new Gson(); private String launcherEnv = System.getenv("ZEPPELIN_INTERPRETER_LAUNCHER"); @@ -119,12 +109,8 @@ public class RemoteInterpreterServer extends Thread private int port; private TThreadPoolServer server; RemoteInterpreterEventClient intpEventClient; - private DependencyResolver depLoader; private LifecycleManager lifecycleManager; - private final Map runningApplications = - Collections.synchronizedMap(new HashMap()); - // Hold information for manual progress update private ConcurrentMap progressMap = new ConcurrentHashMap<>(); @@ -328,19 +314,11 @@ public void createInterpreter(String interpreterGroupId, String sessionId, Strin interpreterGroup.setResourcePool(resourcePool); intpEventClient.setIntpGroupId(interpreterGroupId); - String localRepoPath = properties.get("zeppelin.interpreter.localRepo"); if (properties.containsKey("zeppelin.interpreter.output.limit")) { InterpreterOutput.LIMIT = Integer.parseInt( properties.get("zeppelin.interpreter.output.limit")); } - depLoader = new DependencyResolver(localRepoPath, - zProperties.getProperty("zeppelin.proxy.url"), - zProperties.getProperty("zeppelin.proxy.user"), - zProperties.getProperty("zeppelin.proxy.password"), - zProperties.getProperty("zeppelin.interpreter.dep.mvnRepo")); - appLoader = new ApplicationLoader(resourcePool, depLoader); - resultCacheInSeconds = Integer.parseInt(properties.getOrDefault("zeppelin.interpreter.result.cache", "0")); } @@ -430,23 +408,6 @@ public void open(String sessionId, String className) throws InterpreterRPCExcept @Override public void close(String sessionId, String className) throws InterpreterRPCException, TException { - // unload all applications - for (String appId : runningApplications.keySet()) { - RunningApplication appInfo = runningApplications.get(appId); - - // see NoteInterpreterLoader.SHARED_SESSION - if (appInfo.noteId.equals(sessionId) || sessionId.equals("shared_session")) { - try { - LOGGER.info("Unload App {} ", appInfo.pkg.getName()); - appInfo.app.unload(); - // see ApplicationState.Status.UNLOADED - intpEventClient.onAppStatusUpdate(appInfo.noteId, appInfo.paragraphId, appId, "UNLOADED"); - } catch (ApplicationException e) { - LOGGER.error(e.getMessage(), e); - } - } - } - // close interpreters if (interpreterGroup != null) { synchronized (interpreterGroup) { @@ -1272,144 +1233,4 @@ public void angularRegistryPush(String registryAsString) throws InterpreterRPCEx } } - protected InterpreterOutput createAppOutput(final String noteId, - final String paragraphId, - final String appId) { - return new InterpreterOutput(new InterpreterOutputListener() { - @Override - public void onUpdateAll(InterpreterOutput out) { - - } - - @Override - public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { - intpEventClient.onAppOutputAppend(noteId, paragraphId, index, appId, new String(line)); - } - - @Override - public void onUpdate(int index, InterpreterResultMessageOutput out) { - try { - intpEventClient.onAppOutputUpdate(noteId, paragraphId, index, appId, - out.getType(), new String(out.toByteArray())); - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - } - } - }); - - } - - private ApplicationContext getApplicationContext( - HeliumPackage packageInfo, String noteId, String paragraphId, String applicationInstanceId) { - InterpreterOutput out = createAppOutput(noteId, paragraphId, applicationInstanceId); - return new ApplicationContext( - noteId, - paragraphId, - applicationInstanceId, - new HeliumAppAngularObjectRegistry(angularObjectRegistry, noteId, applicationInstanceId), - out); - } - - @Override - public RemoteApplicationResult loadApplication( - String applicationInstanceId, String packageInfo, String noteId, String paragraphId) - throws InterpreterRPCException, TException{ - if (runningApplications.containsKey(applicationInstanceId)) { - LOGGER.warn("Application instance {} is already running", applicationInstanceId); - return new RemoteApplicationResult(true, ""); - } - HeliumPackage pkgInfo = HeliumPackage.fromJson(packageInfo); - ApplicationContext context = getApplicationContext( - pkgInfo, noteId, paragraphId, applicationInstanceId); - try { - Application app = null; - LOGGER.info( - "Loading application {}({}), artifact={}, className={} into note={}, paragraph={}", - pkgInfo.getName(), - applicationInstanceId, - pkgInfo.getArtifact(), - pkgInfo.getClassName(), - noteId, - paragraphId); - app = appLoader.load(pkgInfo, context); - runningApplications.put( - applicationInstanceId, - new RunningApplication(pkgInfo, app, noteId, paragraphId)); - return new RemoteApplicationResult(true, ""); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - return new RemoteApplicationResult(false, e.getMessage()); - } - } - - @Override - public RemoteApplicationResult unloadApplication(String applicationInstanceId) - throws InterpreterRPCException, TException{ - RunningApplication runningApplication = runningApplications.remove(applicationInstanceId); - if (runningApplication != null) { - try { - LOGGER.info("Unloading application {}", applicationInstanceId); - runningApplication.app.unload(); - } catch (ApplicationException e) { - LOGGER.error(e.getMessage(), e); - return new RemoteApplicationResult(false, e.getMessage()); - } - } - return new RemoteApplicationResult(true, ""); - } - - @Override - public RemoteApplicationResult runApplication(String applicationInstanceId) - throws InterpreterRPCException, TException{ - LOGGER.info("run application {}", applicationInstanceId); - - RunningApplication runningApp = runningApplications.get(applicationInstanceId); - if (runningApp == null) { - LOGGER.error("Application instance {} not exists", applicationInstanceId); - return new RemoteApplicationResult(false, "Application instance does not exists"); - } else { - ApplicationContext context = runningApp.app.context(); - try { - context.out.clear(); - context.out.setType(InterpreterResult.Type.ANGULAR); - ResourceSet resource = appLoader.findRequiredResourceSet( - runningApp.pkg.getResources(), - context.getNoteId(), - context.getParagraphId()); - for (Resource res : resource) { - System.err.println("Resource " + res.get()); - } - runningApp.app.run(resource); - context.out.flush(); - InterpreterResultMessageOutput out = context.out.getOutputAt(0); - intpEventClient.onAppOutputUpdate( - context.getNoteId(), - context.getParagraphId(), - 0, - applicationInstanceId, - out.getType(), - new String(out.toByteArray())); - return new RemoteApplicationResult(true, ""); - } catch (ApplicationException | IOException e) { - return new RemoteApplicationResult(false, e.getMessage()); - } - } - } - - private static class RunningApplication { - public final Application app; - public final HeliumPackage pkg; - public final String noteId; - public final String paragraphId; - - RunningApplication(HeliumPackage pkg, - Application app, - String noteId, - String paragraphId) { - this.app = app; - this.pkg = pkg; - this.noteId = noteId; - this.paragraphId = paragraphId; - } - } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java deleted file mode 100644 index 5e19d8d3154..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java +++ /dev/null @@ -1,809 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Autogenerated by Thrift Compiler (0.13.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.zeppelin.interpreter.thrift; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") -public class AppOutputAppendEvent implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AppOutputAppendEvent"); - - private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("noteId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField APP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("appId", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField INDEX_FIELD_DESC = new org.apache.thrift.protocol.TField("index", org.apache.thrift.protocol.TType.I32, (short)4); - private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)5); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new AppOutputAppendEventStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new AppOutputAppendEventTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String noteId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String paragraphId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String appId; // required - public int index; // required - public @org.apache.thrift.annotation.Nullable java.lang.String data; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - NOTE_ID((short)1, "noteId"), - PARAGRAPH_ID((short)2, "paragraphId"), - APP_ID((short)3, "appId"), - INDEX((short)4, "index"), - DATA((short)5, "data"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // NOTE_ID - return NOTE_ID; - case 2: // PARAGRAPH_ID - return PARAGRAPH_ID; - case 3: // APP_ID - return APP_ID; - case 4: // INDEX - return INDEX; - case 5: // DATA - return DATA; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __INDEX_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.APP_ID, new org.apache.thrift.meta_data.FieldMetaData("appId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.INDEX, new org.apache.thrift.meta_data.FieldMetaData("index", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AppOutputAppendEvent.class, metaDataMap); - } - - public AppOutputAppendEvent() { - } - - public AppOutputAppendEvent( - java.lang.String noteId, - java.lang.String paragraphId, - java.lang.String appId, - int index, - java.lang.String data) - { - this(); - this.noteId = noteId; - this.paragraphId = paragraphId; - this.appId = appId; - this.index = index; - setIndexIsSet(true); - this.data = data; - } - - /** - * Performs a deep copy on other. - */ - public AppOutputAppendEvent(AppOutputAppendEvent other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetNoteId()) { - this.noteId = other.noteId; - } - if (other.isSetParagraphId()) { - this.paragraphId = other.paragraphId; - } - if (other.isSetAppId()) { - this.appId = other.appId; - } - this.index = other.index; - if (other.isSetData()) { - this.data = other.data; - } - } - - public AppOutputAppendEvent deepCopy() { - return new AppOutputAppendEvent(this); - } - - @Override - public void clear() { - this.noteId = null; - this.paragraphId = null; - this.appId = null; - setIndexIsSet(false); - this.index = 0; - this.data = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getNoteId() { - return this.noteId; - } - - public AppOutputAppendEvent setNoteId(@org.apache.thrift.annotation.Nullable java.lang.String noteId) { - this.noteId = noteId; - return this; - } - - public void unsetNoteId() { - this.noteId = null; - } - - /** Returns true if field noteId is set (has been assigned a value) and false otherwise */ - public boolean isSetNoteId() { - return this.noteId != null; - } - - public void setNoteIdIsSet(boolean value) { - if (!value) { - this.noteId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getParagraphId() { - return this.paragraphId; - } - - public AppOutputAppendEvent setParagraphId(@org.apache.thrift.annotation.Nullable java.lang.String paragraphId) { - this.paragraphId = paragraphId; - return this; - } - - public void unsetParagraphId() { - this.paragraphId = null; - } - - /** Returns true if field paragraphId is set (has been assigned a value) and false otherwise */ - public boolean isSetParagraphId() { - return this.paragraphId != null; - } - - public void setParagraphIdIsSet(boolean value) { - if (!value) { - this.paragraphId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getAppId() { - return this.appId; - } - - public AppOutputAppendEvent setAppId(@org.apache.thrift.annotation.Nullable java.lang.String appId) { - this.appId = appId; - return this; - } - - public void unsetAppId() { - this.appId = null; - } - - /** Returns true if field appId is set (has been assigned a value) and false otherwise */ - public boolean isSetAppId() { - return this.appId != null; - } - - public void setAppIdIsSet(boolean value) { - if (!value) { - this.appId = null; - } - } - - public int getIndex() { - return this.index; - } - - public AppOutputAppendEvent setIndex(int index) { - this.index = index; - setIndexIsSet(true); - return this; - } - - public void unsetIndex() { - __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INDEX_ISSET_ID); - } - - /** Returns true if field index is set (has been assigned a value) and false otherwise */ - public boolean isSetIndex() { - return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INDEX_ISSET_ID); - } - - public void setIndexIsSet(boolean value) { - __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INDEX_ISSET_ID, value); - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getData() { - return this.data; - } - - public AppOutputAppendEvent setData(@org.apache.thrift.annotation.Nullable java.lang.String data) { - this.data = data; - return this; - } - - public void unsetData() { - this.data = null; - } - - /** Returns true if field data is set (has been assigned a value) and false otherwise */ - public boolean isSetData() { - return this.data != null; - } - - public void setDataIsSet(boolean value) { - if (!value) { - this.data = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case NOTE_ID: - if (value == null) { - unsetNoteId(); - } else { - setNoteId((java.lang.String)value); - } - break; - - case PARAGRAPH_ID: - if (value == null) { - unsetParagraphId(); - } else { - setParagraphId((java.lang.String)value); - } - break; - - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((java.lang.String)value); - } - break; - - case INDEX: - if (value == null) { - unsetIndex(); - } else { - setIndex((java.lang.Integer)value); - } - break; - - case DATA: - if (value == null) { - unsetData(); - } else { - setData((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case NOTE_ID: - return getNoteId(); - - case PARAGRAPH_ID: - return getParagraphId(); - - case APP_ID: - return getAppId(); - - case INDEX: - return getIndex(); - - case DATA: - return getData(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case NOTE_ID: - return isSetNoteId(); - case PARAGRAPH_ID: - return isSetParagraphId(); - case APP_ID: - return isSetAppId(); - case INDEX: - return isSetIndex(); - case DATA: - return isSetData(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof AppOutputAppendEvent) - return this.equals((AppOutputAppendEvent)that); - return false; - } - - public boolean equals(AppOutputAppendEvent that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_noteId = true && this.isSetNoteId(); - boolean that_present_noteId = true && that.isSetNoteId(); - if (this_present_noteId || that_present_noteId) { - if (!(this_present_noteId && that_present_noteId)) - return false; - if (!this.noteId.equals(that.noteId)) - return false; - } - - boolean this_present_paragraphId = true && this.isSetParagraphId(); - boolean that_present_paragraphId = true && that.isSetParagraphId(); - if (this_present_paragraphId || that_present_paragraphId) { - if (!(this_present_paragraphId && that_present_paragraphId)) - return false; - if (!this.paragraphId.equals(that.paragraphId)) - return false; - } - - boolean this_present_appId = true && this.isSetAppId(); - boolean that_present_appId = true && that.isSetAppId(); - if (this_present_appId || that_present_appId) { - if (!(this_present_appId && that_present_appId)) - return false; - if (!this.appId.equals(that.appId)) - return false; - } - - boolean this_present_index = true; - boolean that_present_index = true; - if (this_present_index || that_present_index) { - if (!(this_present_index && that_present_index)) - return false; - if (this.index != that.index) - return false; - } - - boolean this_present_data = true && this.isSetData(); - boolean that_present_data = true && that.isSetData(); - if (this_present_data || that_present_data) { - if (!(this_present_data && that_present_data)) - return false; - if (!this.data.equals(that.data)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetNoteId()) ? 131071 : 524287); - if (isSetNoteId()) - hashCode = hashCode * 8191 + noteId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetParagraphId()) ? 131071 : 524287); - if (isSetParagraphId()) - hashCode = hashCode * 8191 + paragraphId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetAppId()) ? 131071 : 524287); - if (isSetAppId()) - hashCode = hashCode * 8191 + appId.hashCode(); - - hashCode = hashCode * 8191 + index; - - hashCode = hashCode * 8191 + ((isSetData()) ? 131071 : 524287); - if (isSetData()) - hashCode = hashCode * 8191 + data.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(AppOutputAppendEvent other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetNoteId()).compareTo(other.isSetNoteId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetNoteId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.noteId, other.noteId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetParagraphId()).compareTo(other.isSetParagraphId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParagraphId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, other.paragraphId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetAppId()).compareTo(other.isSetAppId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAppId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appId, other.appId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetIndex()).compareTo(other.isSetIndex()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetIndex()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index, other.index); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetData()).compareTo(other.isSetData()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetData()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, other.data); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("AppOutputAppendEvent("); - boolean first = true; - - sb.append("noteId:"); - if (this.noteId == null) { - sb.append("null"); - } else { - sb.append(this.noteId); - } - first = false; - if (!first) sb.append(", "); - sb.append("paragraphId:"); - if (this.paragraphId == null) { - sb.append("null"); - } else { - sb.append(this.paragraphId); - } - first = false; - if (!first) sb.append(", "); - sb.append("appId:"); - if (this.appId == null) { - sb.append("null"); - } else { - sb.append(this.appId); - } - first = false; - if (!first) sb.append(", "); - sb.append("index:"); - sb.append(this.index); - first = false; - if (!first) sb.append(", "); - sb.append("data:"); - if (this.data == null) { - sb.append("null"); - } else { - sb.append(this.data); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class AppOutputAppendEventStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public AppOutputAppendEventStandardScheme getScheme() { - return new AppOutputAppendEventStandardScheme(); - } - } - - private static class AppOutputAppendEventStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // NOTE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.noteId = iprot.readString(); - struct.setNoteIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAGRAPH_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // APP_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // INDEX - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.index = iprot.readI32(); - struct.setIndexIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // DATA - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.data = iprot.readString(); - struct.setDataIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.noteId != null) { - oprot.writeFieldBegin(NOTE_ID_FIELD_DESC); - oprot.writeString(struct.noteId); - oprot.writeFieldEnd(); - } - if (struct.paragraphId != null) { - oprot.writeFieldBegin(PARAGRAPH_ID_FIELD_DESC); - oprot.writeString(struct.paragraphId); - oprot.writeFieldEnd(); - } - if (struct.appId != null) { - oprot.writeFieldBegin(APP_ID_FIELD_DESC); - oprot.writeString(struct.appId); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(INDEX_FIELD_DESC); - oprot.writeI32(struct.index); - oprot.writeFieldEnd(); - if (struct.data != null) { - oprot.writeFieldBegin(DATA_FIELD_DESC); - oprot.writeString(struct.data); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AppOutputAppendEventTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public AppOutputAppendEventTupleScheme getScheme() { - return new AppOutputAppendEventTupleScheme(); - } - } - - private static class AppOutputAppendEventTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetNoteId()) { - optionals.set(0); - } - if (struct.isSetParagraphId()) { - optionals.set(1); - } - if (struct.isSetAppId()) { - optionals.set(2); - } - if (struct.isSetIndex()) { - optionals.set(3); - } - if (struct.isSetData()) { - optionals.set(4); - } - oprot.writeBitSet(optionals, 5); - if (struct.isSetNoteId()) { - oprot.writeString(struct.noteId); - } - if (struct.isSetParagraphId()) { - oprot.writeString(struct.paragraphId); - } - if (struct.isSetAppId()) { - oprot.writeString(struct.appId); - } - if (struct.isSetIndex()) { - oprot.writeI32(struct.index); - } - if (struct.isSetData()) { - oprot.writeString(struct.data); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(5); - if (incoming.get(0)) { - struct.noteId = iprot.readString(); - struct.setNoteIdIsSet(true); - } - if (incoming.get(1)) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } - if (incoming.get(2)) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } - if (incoming.get(3)) { - struct.index = iprot.readI32(); - struct.setIndexIsSet(true); - } - if (incoming.get(4)) { - struct.data = iprot.readString(); - struct.setDataIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } -} - diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputUpdateEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputUpdateEvent.java deleted file mode 100644 index 6890bffa66f..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputUpdateEvent.java +++ /dev/null @@ -1,914 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Autogenerated by Thrift Compiler (0.13.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.zeppelin.interpreter.thrift; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") -public class AppOutputUpdateEvent implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AppOutputUpdateEvent"); - - private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("noteId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField APP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("appId", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField INDEX_FIELD_DESC = new org.apache.thrift.protocol.TField("index", org.apache.thrift.protocol.TType.I32, (short)4); - private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.STRING, (short)5); - private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)6); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new AppOutputUpdateEventStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new AppOutputUpdateEventTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String noteId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String paragraphId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String appId; // required - public int index; // required - public @org.apache.thrift.annotation.Nullable java.lang.String type; // required - public @org.apache.thrift.annotation.Nullable java.lang.String data; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - NOTE_ID((short)1, "noteId"), - PARAGRAPH_ID((short)2, "paragraphId"), - APP_ID((short)3, "appId"), - INDEX((short)4, "index"), - TYPE((short)5, "type"), - DATA((short)6, "data"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // NOTE_ID - return NOTE_ID; - case 2: // PARAGRAPH_ID - return PARAGRAPH_ID; - case 3: // APP_ID - return APP_ID; - case 4: // INDEX - return INDEX; - case 5: // TYPE - return TYPE; - case 6: // DATA - return DATA; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __INDEX_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.APP_ID, new org.apache.thrift.meta_data.FieldMetaData("appId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.INDEX, new org.apache.thrift.meta_data.FieldMetaData("index", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AppOutputUpdateEvent.class, metaDataMap); - } - - public AppOutputUpdateEvent() { - } - - public AppOutputUpdateEvent( - java.lang.String noteId, - java.lang.String paragraphId, - java.lang.String appId, - int index, - java.lang.String type, - java.lang.String data) - { - this(); - this.noteId = noteId; - this.paragraphId = paragraphId; - this.appId = appId; - this.index = index; - setIndexIsSet(true); - this.type = type; - this.data = data; - } - - /** - * Performs a deep copy on other. - */ - public AppOutputUpdateEvent(AppOutputUpdateEvent other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetNoteId()) { - this.noteId = other.noteId; - } - if (other.isSetParagraphId()) { - this.paragraphId = other.paragraphId; - } - if (other.isSetAppId()) { - this.appId = other.appId; - } - this.index = other.index; - if (other.isSetType()) { - this.type = other.type; - } - if (other.isSetData()) { - this.data = other.data; - } - } - - public AppOutputUpdateEvent deepCopy() { - return new AppOutputUpdateEvent(this); - } - - @Override - public void clear() { - this.noteId = null; - this.paragraphId = null; - this.appId = null; - setIndexIsSet(false); - this.index = 0; - this.type = null; - this.data = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getNoteId() { - return this.noteId; - } - - public AppOutputUpdateEvent setNoteId(@org.apache.thrift.annotation.Nullable java.lang.String noteId) { - this.noteId = noteId; - return this; - } - - public void unsetNoteId() { - this.noteId = null; - } - - /** Returns true if field noteId is set (has been assigned a value) and false otherwise */ - public boolean isSetNoteId() { - return this.noteId != null; - } - - public void setNoteIdIsSet(boolean value) { - if (!value) { - this.noteId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getParagraphId() { - return this.paragraphId; - } - - public AppOutputUpdateEvent setParagraphId(@org.apache.thrift.annotation.Nullable java.lang.String paragraphId) { - this.paragraphId = paragraphId; - return this; - } - - public void unsetParagraphId() { - this.paragraphId = null; - } - - /** Returns true if field paragraphId is set (has been assigned a value) and false otherwise */ - public boolean isSetParagraphId() { - return this.paragraphId != null; - } - - public void setParagraphIdIsSet(boolean value) { - if (!value) { - this.paragraphId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getAppId() { - return this.appId; - } - - public AppOutputUpdateEvent setAppId(@org.apache.thrift.annotation.Nullable java.lang.String appId) { - this.appId = appId; - return this; - } - - public void unsetAppId() { - this.appId = null; - } - - /** Returns true if field appId is set (has been assigned a value) and false otherwise */ - public boolean isSetAppId() { - return this.appId != null; - } - - public void setAppIdIsSet(boolean value) { - if (!value) { - this.appId = null; - } - } - - public int getIndex() { - return this.index; - } - - public AppOutputUpdateEvent setIndex(int index) { - this.index = index; - setIndexIsSet(true); - return this; - } - - public void unsetIndex() { - __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INDEX_ISSET_ID); - } - - /** Returns true if field index is set (has been assigned a value) and false otherwise */ - public boolean isSetIndex() { - return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INDEX_ISSET_ID); - } - - public void setIndexIsSet(boolean value) { - __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INDEX_ISSET_ID, value); - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getType() { - return this.type; - } - - public AppOutputUpdateEvent setType(@org.apache.thrift.annotation.Nullable java.lang.String type) { - this.type = type; - return this; - } - - public void unsetType() { - this.type = null; - } - - /** Returns true if field type is set (has been assigned a value) and false otherwise */ - public boolean isSetType() { - return this.type != null; - } - - public void setTypeIsSet(boolean value) { - if (!value) { - this.type = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getData() { - return this.data; - } - - public AppOutputUpdateEvent setData(@org.apache.thrift.annotation.Nullable java.lang.String data) { - this.data = data; - return this; - } - - public void unsetData() { - this.data = null; - } - - /** Returns true if field data is set (has been assigned a value) and false otherwise */ - public boolean isSetData() { - return this.data != null; - } - - public void setDataIsSet(boolean value) { - if (!value) { - this.data = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case NOTE_ID: - if (value == null) { - unsetNoteId(); - } else { - setNoteId((java.lang.String)value); - } - break; - - case PARAGRAPH_ID: - if (value == null) { - unsetParagraphId(); - } else { - setParagraphId((java.lang.String)value); - } - break; - - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((java.lang.String)value); - } - break; - - case INDEX: - if (value == null) { - unsetIndex(); - } else { - setIndex((java.lang.Integer)value); - } - break; - - case TYPE: - if (value == null) { - unsetType(); - } else { - setType((java.lang.String)value); - } - break; - - case DATA: - if (value == null) { - unsetData(); - } else { - setData((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case NOTE_ID: - return getNoteId(); - - case PARAGRAPH_ID: - return getParagraphId(); - - case APP_ID: - return getAppId(); - - case INDEX: - return getIndex(); - - case TYPE: - return getType(); - - case DATA: - return getData(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case NOTE_ID: - return isSetNoteId(); - case PARAGRAPH_ID: - return isSetParagraphId(); - case APP_ID: - return isSetAppId(); - case INDEX: - return isSetIndex(); - case TYPE: - return isSetType(); - case DATA: - return isSetData(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof AppOutputUpdateEvent) - return this.equals((AppOutputUpdateEvent)that); - return false; - } - - public boolean equals(AppOutputUpdateEvent that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_noteId = true && this.isSetNoteId(); - boolean that_present_noteId = true && that.isSetNoteId(); - if (this_present_noteId || that_present_noteId) { - if (!(this_present_noteId && that_present_noteId)) - return false; - if (!this.noteId.equals(that.noteId)) - return false; - } - - boolean this_present_paragraphId = true && this.isSetParagraphId(); - boolean that_present_paragraphId = true && that.isSetParagraphId(); - if (this_present_paragraphId || that_present_paragraphId) { - if (!(this_present_paragraphId && that_present_paragraphId)) - return false; - if (!this.paragraphId.equals(that.paragraphId)) - return false; - } - - boolean this_present_appId = true && this.isSetAppId(); - boolean that_present_appId = true && that.isSetAppId(); - if (this_present_appId || that_present_appId) { - if (!(this_present_appId && that_present_appId)) - return false; - if (!this.appId.equals(that.appId)) - return false; - } - - boolean this_present_index = true; - boolean that_present_index = true; - if (this_present_index || that_present_index) { - if (!(this_present_index && that_present_index)) - return false; - if (this.index != that.index) - return false; - } - - boolean this_present_type = true && this.isSetType(); - boolean that_present_type = true && that.isSetType(); - if (this_present_type || that_present_type) { - if (!(this_present_type && that_present_type)) - return false; - if (!this.type.equals(that.type)) - return false; - } - - boolean this_present_data = true && this.isSetData(); - boolean that_present_data = true && that.isSetData(); - if (this_present_data || that_present_data) { - if (!(this_present_data && that_present_data)) - return false; - if (!this.data.equals(that.data)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetNoteId()) ? 131071 : 524287); - if (isSetNoteId()) - hashCode = hashCode * 8191 + noteId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetParagraphId()) ? 131071 : 524287); - if (isSetParagraphId()) - hashCode = hashCode * 8191 + paragraphId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetAppId()) ? 131071 : 524287); - if (isSetAppId()) - hashCode = hashCode * 8191 + appId.hashCode(); - - hashCode = hashCode * 8191 + index; - - hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287); - if (isSetType()) - hashCode = hashCode * 8191 + type.hashCode(); - - hashCode = hashCode * 8191 + ((isSetData()) ? 131071 : 524287); - if (isSetData()) - hashCode = hashCode * 8191 + data.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(AppOutputUpdateEvent other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetNoteId()).compareTo(other.isSetNoteId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetNoteId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.noteId, other.noteId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetParagraphId()).compareTo(other.isSetParagraphId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParagraphId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, other.paragraphId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetAppId()).compareTo(other.isSetAppId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAppId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appId, other.appId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetIndex()).compareTo(other.isSetIndex()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetIndex()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index, other.index); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetType()).compareTo(other.isSetType()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetType()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetData()).compareTo(other.isSetData()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetData()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, other.data); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("AppOutputUpdateEvent("); - boolean first = true; - - sb.append("noteId:"); - if (this.noteId == null) { - sb.append("null"); - } else { - sb.append(this.noteId); - } - first = false; - if (!first) sb.append(", "); - sb.append("paragraphId:"); - if (this.paragraphId == null) { - sb.append("null"); - } else { - sb.append(this.paragraphId); - } - first = false; - if (!first) sb.append(", "); - sb.append("appId:"); - if (this.appId == null) { - sb.append("null"); - } else { - sb.append(this.appId); - } - first = false; - if (!first) sb.append(", "); - sb.append("index:"); - sb.append(this.index); - first = false; - if (!first) sb.append(", "); - sb.append("type:"); - if (this.type == null) { - sb.append("null"); - } else { - sb.append(this.type); - } - first = false; - if (!first) sb.append(", "); - sb.append("data:"); - if (this.data == null) { - sb.append("null"); - } else { - sb.append(this.data); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class AppOutputUpdateEventStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public AppOutputUpdateEventStandardScheme getScheme() { - return new AppOutputUpdateEventStandardScheme(); - } - } - - private static class AppOutputUpdateEventStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, AppOutputUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // NOTE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.noteId = iprot.readString(); - struct.setNoteIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAGRAPH_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // APP_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // INDEX - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.index = iprot.readI32(); - struct.setIndexIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // TYPE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.type = iprot.readString(); - struct.setTypeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 6: // DATA - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.data = iprot.readString(); - struct.setDataIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, AppOutputUpdateEvent struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.noteId != null) { - oprot.writeFieldBegin(NOTE_ID_FIELD_DESC); - oprot.writeString(struct.noteId); - oprot.writeFieldEnd(); - } - if (struct.paragraphId != null) { - oprot.writeFieldBegin(PARAGRAPH_ID_FIELD_DESC); - oprot.writeString(struct.paragraphId); - oprot.writeFieldEnd(); - } - if (struct.appId != null) { - oprot.writeFieldBegin(APP_ID_FIELD_DESC); - oprot.writeString(struct.appId); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(INDEX_FIELD_DESC); - oprot.writeI32(struct.index); - oprot.writeFieldEnd(); - if (struct.type != null) { - oprot.writeFieldBegin(TYPE_FIELD_DESC); - oprot.writeString(struct.type); - oprot.writeFieldEnd(); - } - if (struct.data != null) { - oprot.writeFieldBegin(DATA_FIELD_DESC); - oprot.writeString(struct.data); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AppOutputUpdateEventTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public AppOutputUpdateEventTupleScheme getScheme() { - return new AppOutputUpdateEventTupleScheme(); - } - } - - private static class AppOutputUpdateEventTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AppOutputUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetNoteId()) { - optionals.set(0); - } - if (struct.isSetParagraphId()) { - optionals.set(1); - } - if (struct.isSetAppId()) { - optionals.set(2); - } - if (struct.isSetIndex()) { - optionals.set(3); - } - if (struct.isSetType()) { - optionals.set(4); - } - if (struct.isSetData()) { - optionals.set(5); - } - oprot.writeBitSet(optionals, 6); - if (struct.isSetNoteId()) { - oprot.writeString(struct.noteId); - } - if (struct.isSetParagraphId()) { - oprot.writeString(struct.paragraphId); - } - if (struct.isSetAppId()) { - oprot.writeString(struct.appId); - } - if (struct.isSetIndex()) { - oprot.writeI32(struct.index); - } - if (struct.isSetType()) { - oprot.writeString(struct.type); - } - if (struct.isSetData()) { - oprot.writeString(struct.data); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AppOutputUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(6); - if (incoming.get(0)) { - struct.noteId = iprot.readString(); - struct.setNoteIdIsSet(true); - } - if (incoming.get(1)) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } - if (incoming.get(2)) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } - if (incoming.get(3)) { - struct.index = iprot.readI32(); - struct.setIndexIsSet(true); - } - if (incoming.get(4)) { - struct.type = iprot.readString(); - struct.setTypeIsSet(true); - } - if (incoming.get(5)) { - struct.data = iprot.readString(); - struct.setDataIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } -} - diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppStatusUpdateEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppStatusUpdateEvent.java deleted file mode 100644 index af9c8292725..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppStatusUpdateEvent.java +++ /dev/null @@ -1,709 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Autogenerated by Thrift Compiler (0.13.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.zeppelin.interpreter.thrift; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") -public class AppStatusUpdateEvent implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AppStatusUpdateEvent"); - - private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("noteId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField APP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("appId", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRING, (short)4); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new AppStatusUpdateEventStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new AppStatusUpdateEventTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String noteId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String paragraphId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String appId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String status; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - NOTE_ID((short)1, "noteId"), - PARAGRAPH_ID((short)2, "paragraphId"), - APP_ID((short)3, "appId"), - STATUS((short)4, "status"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // NOTE_ID - return NOTE_ID; - case 2: // PARAGRAPH_ID - return PARAGRAPH_ID; - case 3: // APP_ID - return APP_ID; - case 4: // STATUS - return STATUS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.APP_ID, new org.apache.thrift.meta_data.FieldMetaData("appId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AppStatusUpdateEvent.class, metaDataMap); - } - - public AppStatusUpdateEvent() { - } - - public AppStatusUpdateEvent( - java.lang.String noteId, - java.lang.String paragraphId, - java.lang.String appId, - java.lang.String status) - { - this(); - this.noteId = noteId; - this.paragraphId = paragraphId; - this.appId = appId; - this.status = status; - } - - /** - * Performs a deep copy on other. - */ - public AppStatusUpdateEvent(AppStatusUpdateEvent other) { - if (other.isSetNoteId()) { - this.noteId = other.noteId; - } - if (other.isSetParagraphId()) { - this.paragraphId = other.paragraphId; - } - if (other.isSetAppId()) { - this.appId = other.appId; - } - if (other.isSetStatus()) { - this.status = other.status; - } - } - - public AppStatusUpdateEvent deepCopy() { - return new AppStatusUpdateEvent(this); - } - - @Override - public void clear() { - this.noteId = null; - this.paragraphId = null; - this.appId = null; - this.status = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getNoteId() { - return this.noteId; - } - - public AppStatusUpdateEvent setNoteId(@org.apache.thrift.annotation.Nullable java.lang.String noteId) { - this.noteId = noteId; - return this; - } - - public void unsetNoteId() { - this.noteId = null; - } - - /** Returns true if field noteId is set (has been assigned a value) and false otherwise */ - public boolean isSetNoteId() { - return this.noteId != null; - } - - public void setNoteIdIsSet(boolean value) { - if (!value) { - this.noteId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getParagraphId() { - return this.paragraphId; - } - - public AppStatusUpdateEvent setParagraphId(@org.apache.thrift.annotation.Nullable java.lang.String paragraphId) { - this.paragraphId = paragraphId; - return this; - } - - public void unsetParagraphId() { - this.paragraphId = null; - } - - /** Returns true if field paragraphId is set (has been assigned a value) and false otherwise */ - public boolean isSetParagraphId() { - return this.paragraphId != null; - } - - public void setParagraphIdIsSet(boolean value) { - if (!value) { - this.paragraphId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getAppId() { - return this.appId; - } - - public AppStatusUpdateEvent setAppId(@org.apache.thrift.annotation.Nullable java.lang.String appId) { - this.appId = appId; - return this; - } - - public void unsetAppId() { - this.appId = null; - } - - /** Returns true if field appId is set (has been assigned a value) and false otherwise */ - public boolean isSetAppId() { - return this.appId != null; - } - - public void setAppIdIsSet(boolean value) { - if (!value) { - this.appId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getStatus() { - return this.status; - } - - public AppStatusUpdateEvent setStatus(@org.apache.thrift.annotation.Nullable java.lang.String status) { - this.status = status; - return this; - } - - public void unsetStatus() { - this.status = null; - } - - /** Returns true if field status is set (has been assigned a value) and false otherwise */ - public boolean isSetStatus() { - return this.status != null; - } - - public void setStatusIsSet(boolean value) { - if (!value) { - this.status = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case NOTE_ID: - if (value == null) { - unsetNoteId(); - } else { - setNoteId((java.lang.String)value); - } - break; - - case PARAGRAPH_ID: - if (value == null) { - unsetParagraphId(); - } else { - setParagraphId((java.lang.String)value); - } - break; - - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((java.lang.String)value); - } - break; - - case STATUS: - if (value == null) { - unsetStatus(); - } else { - setStatus((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case NOTE_ID: - return getNoteId(); - - case PARAGRAPH_ID: - return getParagraphId(); - - case APP_ID: - return getAppId(); - - case STATUS: - return getStatus(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case NOTE_ID: - return isSetNoteId(); - case PARAGRAPH_ID: - return isSetParagraphId(); - case APP_ID: - return isSetAppId(); - case STATUS: - return isSetStatus(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof AppStatusUpdateEvent) - return this.equals((AppStatusUpdateEvent)that); - return false; - } - - public boolean equals(AppStatusUpdateEvent that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_noteId = true && this.isSetNoteId(); - boolean that_present_noteId = true && that.isSetNoteId(); - if (this_present_noteId || that_present_noteId) { - if (!(this_present_noteId && that_present_noteId)) - return false; - if (!this.noteId.equals(that.noteId)) - return false; - } - - boolean this_present_paragraphId = true && this.isSetParagraphId(); - boolean that_present_paragraphId = true && that.isSetParagraphId(); - if (this_present_paragraphId || that_present_paragraphId) { - if (!(this_present_paragraphId && that_present_paragraphId)) - return false; - if (!this.paragraphId.equals(that.paragraphId)) - return false; - } - - boolean this_present_appId = true && this.isSetAppId(); - boolean that_present_appId = true && that.isSetAppId(); - if (this_present_appId || that_present_appId) { - if (!(this_present_appId && that_present_appId)) - return false; - if (!this.appId.equals(that.appId)) - return false; - } - - boolean this_present_status = true && this.isSetStatus(); - boolean that_present_status = true && that.isSetStatus(); - if (this_present_status || that_present_status) { - if (!(this_present_status && that_present_status)) - return false; - if (!this.status.equals(that.status)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetNoteId()) ? 131071 : 524287); - if (isSetNoteId()) - hashCode = hashCode * 8191 + noteId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetParagraphId()) ? 131071 : 524287); - if (isSetParagraphId()) - hashCode = hashCode * 8191 + paragraphId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetAppId()) ? 131071 : 524287); - if (isSetAppId()) - hashCode = hashCode * 8191 + appId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetStatus()) ? 131071 : 524287); - if (isSetStatus()) - hashCode = hashCode * 8191 + status.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(AppStatusUpdateEvent other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetNoteId()).compareTo(other.isSetNoteId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetNoteId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.noteId, other.noteId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetParagraphId()).compareTo(other.isSetParagraphId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParagraphId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, other.paragraphId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetAppId()).compareTo(other.isSetAppId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAppId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appId, other.appId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetStatus()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("AppStatusUpdateEvent("); - boolean first = true; - - sb.append("noteId:"); - if (this.noteId == null) { - sb.append("null"); - } else { - sb.append(this.noteId); - } - first = false; - if (!first) sb.append(", "); - sb.append("paragraphId:"); - if (this.paragraphId == null) { - sb.append("null"); - } else { - sb.append(this.paragraphId); - } - first = false; - if (!first) sb.append(", "); - sb.append("appId:"); - if (this.appId == null) { - sb.append("null"); - } else { - sb.append(this.appId); - } - first = false; - if (!first) sb.append(", "); - sb.append("status:"); - if (this.status == null) { - sb.append("null"); - } else { - sb.append(this.status); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class AppStatusUpdateEventStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public AppStatusUpdateEventStandardScheme getScheme() { - return new AppStatusUpdateEventStandardScheme(); - } - } - - private static class AppStatusUpdateEventStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, AppStatusUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // NOTE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.noteId = iprot.readString(); - struct.setNoteIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAGRAPH_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // APP_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // STATUS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.status = iprot.readString(); - struct.setStatusIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, AppStatusUpdateEvent struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.noteId != null) { - oprot.writeFieldBegin(NOTE_ID_FIELD_DESC); - oprot.writeString(struct.noteId); - oprot.writeFieldEnd(); - } - if (struct.paragraphId != null) { - oprot.writeFieldBegin(PARAGRAPH_ID_FIELD_DESC); - oprot.writeString(struct.paragraphId); - oprot.writeFieldEnd(); - } - if (struct.appId != null) { - oprot.writeFieldBegin(APP_ID_FIELD_DESC); - oprot.writeString(struct.appId); - oprot.writeFieldEnd(); - } - if (struct.status != null) { - oprot.writeFieldBegin(STATUS_FIELD_DESC); - oprot.writeString(struct.status); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AppStatusUpdateEventTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public AppStatusUpdateEventTupleScheme getScheme() { - return new AppStatusUpdateEventTupleScheme(); - } - } - - private static class AppStatusUpdateEventTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AppStatusUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetNoteId()) { - optionals.set(0); - } - if (struct.isSetParagraphId()) { - optionals.set(1); - } - if (struct.isSetAppId()) { - optionals.set(2); - } - if (struct.isSetStatus()) { - optionals.set(3); - } - oprot.writeBitSet(optionals, 4); - if (struct.isSetNoteId()) { - oprot.writeString(struct.noteId); - } - if (struct.isSetParagraphId()) { - oprot.writeString(struct.paragraphId); - } - if (struct.isSetAppId()) { - oprot.writeString(struct.appId); - } - if (struct.isSetStatus()) { - oprot.writeString(struct.status); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AppStatusUpdateEvent struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(4); - if (incoming.get(0)) { - struct.noteId = iprot.readString(); - struct.setNoteIdIsSet(true); - } - if (incoming.get(1)) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } - if (incoming.get(2)) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } - if (incoming.get(3)) { - struct.status = iprot.readString(); - struct.setStatusIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } -} - diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputAppendEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputAppendEvent.java index fbcf43da983..4b46cfdf4e1 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputAppendEvent.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputAppendEvent.java @@ -24,7 +24,7 @@ package org.apache.zeppelin.interpreter.thrift; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-20") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-10-21") public class OutputAppendEvent implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OutputAppendEvent"); @@ -32,7 +32,6 @@ public class OutputAppendEvent implements org.apache.thrift.TBase byName = new java.util.HashMap(); @@ -76,8 +73,6 @@ public static _Fields findByThriftId(int fieldId) { return INDEX; case 4: // DATA return DATA; - case 5: // APP_ID - return APP_ID; case 6: // EXECUTION_OWNER return EXECUTION_OWNER; default: @@ -134,8 +129,6 @@ public java.lang.String getFieldName() { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.APP_ID, new org.apache.thrift.meta_data.FieldMetaData("appId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.EXECUTION_OWNER, new org.apache.thrift.meta_data.FieldMetaData("executionOwner", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); @@ -150,7 +143,6 @@ public OutputAppendEvent( java.lang.String paragraphId, int index, java.lang.String data, - java.lang.String appId, java.lang.String executionOwner) { this(); @@ -159,7 +151,6 @@ public OutputAppendEvent( this.index = index; setIndexIsSet(true); this.data = data; - this.appId = appId; this.executionOwner = executionOwner; } @@ -178,9 +169,6 @@ public OutputAppendEvent(OutputAppendEvent other) { if (other.isSetData()) { this.data = other.data; } - if (other.isSetAppId()) { - this.appId = other.appId; - } if (other.isSetExecutionOwner()) { this.executionOwner = other.executionOwner; } @@ -197,7 +185,6 @@ public void clear() { setIndexIsSet(false); this.index = 0; this.data = null; - this.appId = null; this.executionOwner = null; } @@ -299,31 +286,6 @@ public void setDataIsSet(boolean value) { } } - @org.apache.thrift.annotation.Nullable - public java.lang.String getAppId() { - return this.appId; - } - - public OutputAppendEvent setAppId(@org.apache.thrift.annotation.Nullable java.lang.String appId) { - this.appId = appId; - return this; - } - - public void unsetAppId() { - this.appId = null; - } - - /** Returns true if field appId is set (has been assigned a value) and false otherwise */ - public boolean isSetAppId() { - return this.appId != null; - } - - public void setAppIdIsSet(boolean value) { - if (!value) { - this.appId = null; - } - } - @org.apache.thrift.annotation.Nullable public java.lang.String getExecutionOwner() { return this.executionOwner; @@ -383,14 +345,6 @@ public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable } break; - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((java.lang.String)value); - } - break; - case EXECUTION_OWNER: if (value == null) { unsetExecutionOwner(); @@ -417,9 +371,6 @@ public java.lang.Object getFieldValue(_Fields field) { case DATA: return getData(); - case APP_ID: - return getAppId(); - case EXECUTION_OWNER: return getExecutionOwner(); @@ -442,8 +393,6 @@ public boolean isSet(_Fields field) { return isSetIndex(); case DATA: return isSetData(); - case APP_ID: - return isSetAppId(); case EXECUTION_OWNER: return isSetExecutionOwner(); } @@ -501,15 +450,6 @@ public boolean equals(OutputAppendEvent that) { return false; } - boolean this_present_appId = true && this.isSetAppId(); - boolean that_present_appId = true && that.isSetAppId(); - if (this_present_appId || that_present_appId) { - if (!(this_present_appId && that_present_appId)) - return false; - if (!this.appId.equals(that.appId)) - return false; - } - boolean this_present_executionOwner = true && this.isSetExecutionOwner(); boolean that_present_executionOwner = true && that.isSetExecutionOwner(); if (this_present_executionOwner || that_present_executionOwner) { @@ -540,10 +480,6 @@ public int hashCode() { if (isSetData()) hashCode = hashCode * 8191 + data.hashCode(); - hashCode = hashCode * 8191 + ((isSetAppId()) ? 131071 : 524287); - if (isSetAppId()) - hashCode = hashCode * 8191 + appId.hashCode(); - hashCode = hashCode * 8191 + ((isSetExecutionOwner()) ? 131071 : 524287); if (isSetExecutionOwner()) hashCode = hashCode * 8191 + executionOwner.hashCode(); @@ -599,16 +535,6 @@ public int compareTo(OutputAppendEvent other) { return lastComparison; } } - lastComparison = java.lang.Boolean.valueOf(isSetAppId()).compareTo(other.isSetAppId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAppId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appId, other.appId); - if (lastComparison != 0) { - return lastComparison; - } - } lastComparison = java.lang.Boolean.valueOf(isSetExecutionOwner()).compareTo(other.isSetExecutionOwner()); if (lastComparison != 0) { return lastComparison; @@ -668,14 +594,6 @@ public java.lang.String toString() { } first = false; if (!first) sb.append(", "); - sb.append("appId:"); - if (this.appId == null) { - sb.append("null"); - } else { - sb.append(this.appId); - } - first = false; - if (!first) sb.append(", "); sb.append("executionOwner:"); if (this.executionOwner == null) { sb.append("null"); @@ -760,14 +678,6 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, OutputAppendEvent s org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 5: // APP_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; case 6: // EXECUTION_OWNER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.executionOwner = iprot.readString(); @@ -809,11 +719,6 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, OutputAppendEvent oprot.writeString(struct.data); oprot.writeFieldEnd(); } - if (struct.appId != null) { - oprot.writeFieldBegin(APP_ID_FIELD_DESC); - oprot.writeString(struct.appId); - oprot.writeFieldEnd(); - } if (struct.executionOwner != null) { oprot.writeFieldBegin(EXECUTION_OWNER_FIELD_DESC); oprot.writeString(struct.executionOwner); @@ -849,13 +754,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, OutputAppendEvent s if (struct.isSetData()) { optionals.set(3); } - if (struct.isSetAppId()) { - optionals.set(4); - } if (struct.isSetExecutionOwner()) { - optionals.set(5); + optionals.set(4); } - oprot.writeBitSet(optionals, 6); + oprot.writeBitSet(optionals, 5); if (struct.isSetNoteId()) { oprot.writeString(struct.noteId); } @@ -868,9 +770,6 @@ public void write(org.apache.thrift.protocol.TProtocol prot, OutputAppendEvent s if (struct.isSetData()) { oprot.writeString(struct.data); } - if (struct.isSetAppId()) { - oprot.writeString(struct.appId); - } if (struct.isSetExecutionOwner()) { oprot.writeString(struct.executionOwner); } @@ -879,7 +778,7 @@ public void write(org.apache.thrift.protocol.TProtocol prot, OutputAppendEvent s @Override public void read(org.apache.thrift.protocol.TProtocol prot, OutputAppendEvent struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(6); + java.util.BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.noteId = iprot.readString(); struct.setNoteIdIsSet(true); @@ -897,10 +796,6 @@ public void read(org.apache.thrift.protocol.TProtocol prot, OutputAppendEvent st struct.setDataIsSet(true); } if (incoming.get(4)) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } - if (incoming.get(5)) { struct.executionOwner = iprot.readString(); struct.setExecutionOwnerIsSet(true); } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputUpdateEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputUpdateEvent.java index 41b5327e5f3..fb10be25b12 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputUpdateEvent.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/OutputUpdateEvent.java @@ -24,7 +24,7 @@ package org.apache.zeppelin.interpreter.thrift; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-20") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-10-21") public class OutputUpdateEvent implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OutputUpdateEvent"); @@ -33,7 +33,6 @@ public class OutputUpdateEvent implements org.apache.thrift.TBase byName = new java.util.HashMap(); @@ -81,8 +78,6 @@ public static _Fields findByThriftId(int fieldId) { return TYPE; case 5: // DATA return DATA; - case 6: // APP_ID - return APP_ID; case 7: // EXECUTION_OWNER return EXECUTION_OWNER; default: @@ -141,8 +136,6 @@ public java.lang.String getFieldName() { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.APP_ID, new org.apache.thrift.meta_data.FieldMetaData("appId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.EXECUTION_OWNER, new org.apache.thrift.meta_data.FieldMetaData("executionOwner", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); @@ -158,7 +151,6 @@ public OutputUpdateEvent( int index, java.lang.String type, java.lang.String data, - java.lang.String appId, java.lang.String executionOwner) { this(); @@ -168,7 +160,6 @@ public OutputUpdateEvent( setIndexIsSet(true); this.type = type; this.data = data; - this.appId = appId; this.executionOwner = executionOwner; } @@ -190,9 +181,6 @@ public OutputUpdateEvent(OutputUpdateEvent other) { if (other.isSetData()) { this.data = other.data; } - if (other.isSetAppId()) { - this.appId = other.appId; - } if (other.isSetExecutionOwner()) { this.executionOwner = other.executionOwner; } @@ -210,7 +198,6 @@ public void clear() { this.index = 0; this.type = null; this.data = null; - this.appId = null; this.executionOwner = null; } @@ -337,31 +324,6 @@ public void setDataIsSet(boolean value) { } } - @org.apache.thrift.annotation.Nullable - public java.lang.String getAppId() { - return this.appId; - } - - public OutputUpdateEvent setAppId(@org.apache.thrift.annotation.Nullable java.lang.String appId) { - this.appId = appId; - return this; - } - - public void unsetAppId() { - this.appId = null; - } - - /** Returns true if field appId is set (has been assigned a value) and false otherwise */ - public boolean isSetAppId() { - return this.appId != null; - } - - public void setAppIdIsSet(boolean value) { - if (!value) { - this.appId = null; - } - } - @org.apache.thrift.annotation.Nullable public java.lang.String getExecutionOwner() { return this.executionOwner; @@ -429,14 +391,6 @@ public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable } break; - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((java.lang.String)value); - } - break; - case EXECUTION_OWNER: if (value == null) { unsetExecutionOwner(); @@ -466,9 +420,6 @@ public java.lang.Object getFieldValue(_Fields field) { case DATA: return getData(); - case APP_ID: - return getAppId(); - case EXECUTION_OWNER: return getExecutionOwner(); @@ -493,8 +444,6 @@ public boolean isSet(_Fields field) { return isSetType(); case DATA: return isSetData(); - case APP_ID: - return isSetAppId(); case EXECUTION_OWNER: return isSetExecutionOwner(); } @@ -561,15 +510,6 @@ public boolean equals(OutputUpdateEvent that) { return false; } - boolean this_present_appId = true && this.isSetAppId(); - boolean that_present_appId = true && that.isSetAppId(); - if (this_present_appId || that_present_appId) { - if (!(this_present_appId && that_present_appId)) - return false; - if (!this.appId.equals(that.appId)) - return false; - } - boolean this_present_executionOwner = true && this.isSetExecutionOwner(); boolean that_present_executionOwner = true && that.isSetExecutionOwner(); if (this_present_executionOwner || that_present_executionOwner) { @@ -604,10 +544,6 @@ public int hashCode() { if (isSetData()) hashCode = hashCode * 8191 + data.hashCode(); - hashCode = hashCode * 8191 + ((isSetAppId()) ? 131071 : 524287); - if (isSetAppId()) - hashCode = hashCode * 8191 + appId.hashCode(); - hashCode = hashCode * 8191 + ((isSetExecutionOwner()) ? 131071 : 524287); if (isSetExecutionOwner()) hashCode = hashCode * 8191 + executionOwner.hashCode(); @@ -673,16 +609,6 @@ public int compareTo(OutputUpdateEvent other) { return lastComparison; } } - lastComparison = java.lang.Boolean.valueOf(isSetAppId()).compareTo(other.isSetAppId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAppId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appId, other.appId); - if (lastComparison != 0) { - return lastComparison; - } - } lastComparison = java.lang.Boolean.valueOf(isSetExecutionOwner()).compareTo(other.isSetExecutionOwner()); if (lastComparison != 0) { return lastComparison; @@ -750,14 +676,6 @@ public java.lang.String toString() { } first = false; if (!first) sb.append(", "); - sb.append("appId:"); - if (this.appId == null) { - sb.append("null"); - } else { - sb.append(this.appId); - } - first = false; - if (!first) sb.append(", "); sb.append("executionOwner:"); if (this.executionOwner == null) { sb.append("null"); @@ -850,14 +768,6 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, OutputUpdateEvent s org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 6: // APP_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; case 7: // EXECUTION_OWNER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.executionOwner = iprot.readString(); @@ -904,11 +814,6 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, OutputUpdateEvent oprot.writeString(struct.data); oprot.writeFieldEnd(); } - if (struct.appId != null) { - oprot.writeFieldBegin(APP_ID_FIELD_DESC); - oprot.writeString(struct.appId); - oprot.writeFieldEnd(); - } if (struct.executionOwner != null) { oprot.writeFieldBegin(EXECUTION_OWNER_FIELD_DESC); oprot.writeString(struct.executionOwner); @@ -947,13 +852,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, OutputUpdateEvent s if (struct.isSetData()) { optionals.set(4); } - if (struct.isSetAppId()) { - optionals.set(5); - } if (struct.isSetExecutionOwner()) { - optionals.set(6); + optionals.set(5); } - oprot.writeBitSet(optionals, 7); + oprot.writeBitSet(optionals, 6); if (struct.isSetNoteId()) { oprot.writeString(struct.noteId); } @@ -969,9 +871,6 @@ public void write(org.apache.thrift.protocol.TProtocol prot, OutputUpdateEvent s if (struct.isSetData()) { oprot.writeString(struct.data); } - if (struct.isSetAppId()) { - oprot.writeString(struct.appId); - } if (struct.isSetExecutionOwner()) { oprot.writeString(struct.executionOwner); } @@ -980,7 +879,7 @@ public void write(org.apache.thrift.protocol.TProtocol prot, OutputUpdateEvent s @Override public void read(org.apache.thrift.protocol.TProtocol prot, OutputUpdateEvent struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(7); + java.util.BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { struct.noteId = iprot.readString(); struct.setNoteIdIsSet(true); @@ -1002,10 +901,6 @@ public void read(org.apache.thrift.protocol.TProtocol prot, OutputUpdateEvent st struct.setDataIsSet(true); } if (incoming.get(5)) { - struct.appId = iprot.readString(); - struct.setAppIdIsSet(true); - } - if (incoming.get(6)) { struct.executionOwner = iprot.readString(); struct.setExecutionOwnerIsSet(true); } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java deleted file mode 100644 index d3d4114eeed..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java +++ /dev/null @@ -1,494 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Autogenerated by Thrift Compiler (0.13.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.zeppelin.interpreter.thrift; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") -public class RemoteApplicationResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteApplicationResult"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)1); - private static final org.apache.thrift.protocol.TField MSG_FIELD_DESC = new org.apache.thrift.protocol.TField("msg", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new RemoteApplicationResultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new RemoteApplicationResultTupleSchemeFactory(); - - public boolean success; // required - public @org.apache.thrift.annotation.Nullable java.lang.String msg; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)1, "success"), - MSG((short)2, "msg"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // SUCCESS - return SUCCESS; - case 2: // MSG - return MSG; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - tmpMap.put(_Fields.MSG, new org.apache.thrift.meta_data.FieldMetaData("msg", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RemoteApplicationResult.class, metaDataMap); - } - - public RemoteApplicationResult() { - } - - public RemoteApplicationResult( - boolean success, - java.lang.String msg) - { - this(); - this.success = success; - setSuccessIsSet(true); - this.msg = msg; - } - - /** - * Performs a deep copy on other. - */ - public RemoteApplicationResult(RemoteApplicationResult other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - if (other.isSetMsg()) { - this.msg = other.msg; - } - } - - public RemoteApplicationResult deepCopy() { - return new RemoteApplicationResult(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = false; - this.msg = null; - } - - public boolean isSuccess() { - return this.success; - } - - public RemoteApplicationResult setSuccess(boolean success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getMsg() { - return this.msg; - } - - public RemoteApplicationResult setMsg(@org.apache.thrift.annotation.Nullable java.lang.String msg) { - this.msg = msg; - return this; - } - - public void unsetMsg() { - this.msg = null; - } - - /** Returns true if field msg is set (has been assigned a value) and false otherwise */ - public boolean isSetMsg() { - return this.msg != null; - } - - public void setMsgIsSet(boolean value) { - if (!value) { - this.msg = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((java.lang.Boolean)value); - } - break; - - case MSG: - if (value == null) { - unsetMsg(); - } else { - setMsg((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return isSuccess(); - - case MSG: - return getMsg(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case MSG: - return isSetMsg(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof RemoteApplicationResult) - return this.equals((RemoteApplicationResult)that); - return false; - } - - public boolean equals(RemoteApplicationResult that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - boolean this_present_msg = true && this.isSetMsg(); - boolean that_present_msg = true && that.isSetMsg(); - if (this_present_msg || that_present_msg) { - if (!(this_present_msg && that_present_msg)) - return false; - if (!this.msg.equals(that.msg)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((success) ? 131071 : 524287); - - hashCode = hashCode * 8191 + ((isSetMsg()) ? 131071 : 524287); - if (isSetMsg()) - hashCode = hashCode * 8191 + msg.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(RemoteApplicationResult other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetMsg()).compareTo(other.isSetMsg()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMsg()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msg, other.msg); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("RemoteApplicationResult("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - if (!first) sb.append(", "); - sb.append("msg:"); - if (this.msg == null) { - sb.append("null"); - } else { - sb.append(this.msg); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class RemoteApplicationResultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public RemoteApplicationResultStandardScheme getScheme() { - return new RemoteApplicationResultStandardScheme(); - } - } - - private static class RemoteApplicationResultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, RemoteApplicationResult struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.success = iprot.readBool(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // MSG - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.msg = iprot.readString(); - struct.setMsgIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, RemoteApplicationResult struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeBool(struct.success); - oprot.writeFieldEnd(); - if (struct.msg != null) { - oprot.writeFieldBegin(MSG_FIELD_DESC); - oprot.writeString(struct.msg); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class RemoteApplicationResultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public RemoteApplicationResultTupleScheme getScheme() { - return new RemoteApplicationResultTupleScheme(); - } - } - - private static class RemoteApplicationResultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, RemoteApplicationResult struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetMsg()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - oprot.writeBool(struct.success); - } - if (struct.isSetMsg()) { - oprot.writeString(struct.msg); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, RemoteApplicationResult struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = iprot.readBool(); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.msg = iprot.readString(); - struct.setMsgIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } -} - diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventService.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventService.java index 0ccd4f54227..0f307e539a2 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventService.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventService.java @@ -24,7 +24,7 @@ package org.apache.zeppelin.interpreter.thrift; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-10-21") public class RemoteInterpreterEventService { public interface Iface { @@ -39,12 +39,6 @@ public interface Iface { public void updateAllOutput(OutputUpdateAllEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException; - public void appendAppOutput(AppOutputAppendEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException; - - public void updateAppOutput(AppOutputUpdateEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException; - - public void updateAppStatus(AppStatusUpdateEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException; - public void checkpointOutput(java.lang.String noteId, java.lang.String paragraphId) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException; public void runParagraphs(RunParagraphsEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException; @@ -87,12 +81,6 @@ public interface AsyncIface { public void updateAllOutput(OutputUpdateAllEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void appendAppOutput(AppOutputAppendEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void updateAppOutput(AppOutputUpdateEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void updateAppStatus(AppStatusUpdateEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void checkpointOutput(java.lang.String noteId, java.lang.String paragraphId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void runParagraphs(RunParagraphsEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -258,75 +246,6 @@ public void recv_updateAllOutput() throws org.apache.zeppelin.interpreter.thrift return; } - public void appendAppOutput(AppOutputAppendEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException - { - send_appendAppOutput(event); - recv_appendAppOutput(); - } - - public void send_appendAppOutput(AppOutputAppendEvent event) throws org.apache.thrift.TException - { - appendAppOutput_args args = new appendAppOutput_args(); - args.setEvent(event); - sendBase("appendAppOutput", args); - } - - public void recv_appendAppOutput() throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException - { - appendAppOutput_result result = new appendAppOutput_result(); - receiveBase(result, "appendAppOutput"); - if (result.ex != null) { - throw result.ex; - } - return; - } - - public void updateAppOutput(AppOutputUpdateEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException - { - send_updateAppOutput(event); - recv_updateAppOutput(); - } - - public void send_updateAppOutput(AppOutputUpdateEvent event) throws org.apache.thrift.TException - { - updateAppOutput_args args = new updateAppOutput_args(); - args.setEvent(event); - sendBase("updateAppOutput", args); - } - - public void recv_updateAppOutput() throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException - { - updateAppOutput_result result = new updateAppOutput_result(); - receiveBase(result, "updateAppOutput"); - if (result.ex != null) { - throw result.ex; - } - return; - } - - public void updateAppStatus(AppStatusUpdateEvent event) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException - { - send_updateAppStatus(event); - recv_updateAppStatus(); - } - - public void send_updateAppStatus(AppStatusUpdateEvent event) throws org.apache.thrift.TException - { - updateAppStatus_args args = new updateAppStatus_args(); - args.setEvent(event); - sendBase("updateAppStatus", args); - } - - public void recv_updateAppStatus() throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException - { - updateAppStatus_result result = new updateAppStatus_result(); - receiveBase(result, "updateAppStatus"); - if (result.ex != null) { - throw result.ex; - } - return; - } - public void checkpointOutput(java.lang.String noteId, java.lang.String paragraphId) throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException { send_checkpointOutput(noteId, paragraphId); @@ -851,102 +770,6 @@ public Void getResult() throws org.apache.zeppelin.interpreter.thrift.Interprete } } - public void appendAppOutput(AppOutputAppendEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - appendAppOutput_call method_call = new appendAppOutput_call(event, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class appendAppOutput_call extends org.apache.thrift.async.TAsyncMethodCall { - private AppOutputAppendEvent event; - public appendAppOutput_call(AppOutputAppendEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.event = event; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("appendAppOutput", org.apache.thrift.protocol.TMessageType.CALL, 0)); - appendAppOutput_args args = new appendAppOutput_args(); - args.setEvent(event); - args.write(prot); - prot.writeMessageEnd(); - } - - public Void getResult() throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new java.lang.IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return null; - } - } - - public void updateAppOutput(AppOutputUpdateEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - updateAppOutput_call method_call = new updateAppOutput_call(event, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class updateAppOutput_call extends org.apache.thrift.async.TAsyncMethodCall { - private AppOutputUpdateEvent event; - public updateAppOutput_call(AppOutputUpdateEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.event = event; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("updateAppOutput", org.apache.thrift.protocol.TMessageType.CALL, 0)); - updateAppOutput_args args = new updateAppOutput_args(); - args.setEvent(event); - args.write(prot); - prot.writeMessageEnd(); - } - - public Void getResult() throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new java.lang.IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return null; - } - } - - public void updateAppStatus(AppStatusUpdateEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - updateAppStatus_call method_call = new updateAppStatus_call(event, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class updateAppStatus_call extends org.apache.thrift.async.TAsyncMethodCall { - private AppStatusUpdateEvent event; - public updateAppStatus_call(AppStatusUpdateEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.event = event; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("updateAppStatus", org.apache.thrift.protocol.TMessageType.CALL, 0)); - updateAppStatus_args args = new updateAppStatus_args(); - args.setEvent(event); - args.write(prot); - prot.writeMessageEnd(); - } - - public Void getResult() throws org.apache.zeppelin.interpreter.thrift.InterpreterRPCException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new java.lang.IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return null; - } - } - public void checkpointOutput(java.lang.String noteId, java.lang.String paragraphId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); checkpointOutput_call method_call = new checkpointOutput_call(noteId, paragraphId, resultHandler, this, ___protocolFactory, ___transport); @@ -1449,9 +1272,6 @@ protected Processor(I iface, java.util.Map extends org.apache.thrift.ProcessFunction { - public appendAppOutput() { - super("appendAppOutput"); - } - - public appendAppOutput_args getEmptyArgsInstance() { - return new appendAppOutput_args(); - } - - protected boolean isOneway() { - return false; - } - - @Override - protected boolean rethrowUnhandledExceptions() { - return false; - } - - public appendAppOutput_result getResult(I iface, appendAppOutput_args args) throws org.apache.thrift.TException { - appendAppOutput_result result = new appendAppOutput_result(); - try { - iface.appendAppOutput(args.event); - } catch (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) { - result.ex = ex; - } - return result; - } - } - - public static class updateAppOutput extends org.apache.thrift.ProcessFunction { - public updateAppOutput() { - super("updateAppOutput"); - } - - public updateAppOutput_args getEmptyArgsInstance() { - return new updateAppOutput_args(); - } - - protected boolean isOneway() { - return false; - } - - @Override - protected boolean rethrowUnhandledExceptions() { - return false; - } - - public updateAppOutput_result getResult(I iface, updateAppOutput_args args) throws org.apache.thrift.TException { - updateAppOutput_result result = new updateAppOutput_result(); - try { - iface.updateAppOutput(args.event); - } catch (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) { - result.ex = ex; - } - return result; - } - } - - public static class updateAppStatus extends org.apache.thrift.ProcessFunction { - public updateAppStatus() { - super("updateAppStatus"); - } - - public updateAppStatus_args getEmptyArgsInstance() { - return new updateAppStatus_args(); - } - - protected boolean isOneway() { - return false; - } - - @Override - protected boolean rethrowUnhandledExceptions() { - return false; - } - - public updateAppStatus_result getResult(I iface, updateAppStatus_args args) throws org.apache.thrift.TException { - updateAppStatus_result result = new updateAppStatus_result(); - try { - iface.updateAppStatus(args.event); - } catch (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) { - result.ex = ex; - } - return result; - } - } - public static class checkpointOutput extends org.apache.thrift.ProcessFunction { public checkpointOutput() { super("checkpointOutput"); @@ -2117,9 +1850,6 @@ protected AsyncProcessor(I iface, java.util.Map extends org.apache.thrift.AsyncProcessFunction { - public appendAppOutput() { - super("appendAppOutput"); + public static class checkpointOutput extends org.apache.thrift.AsyncProcessFunction { + public checkpointOutput() { + super("checkpointOutput"); } - public appendAppOutput_args getEmptyArgsInstance() { - return new appendAppOutput_args(); + public checkpointOutput_args getEmptyArgsInstance() { + return new checkpointOutput_args(); } public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new org.apache.thrift.async.AsyncMethodCallback() { public void onComplete(Void o) { - appendAppOutput_result result = new appendAppOutput_result(); + checkpointOutput_result result = new checkpointOutput_result(); try { fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); } catch (org.apache.thrift.transport.TTransportException e) { @@ -2484,7 +2214,7 @@ public void onComplete(Void o) { public void onError(java.lang.Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TSerializable msg; - appendAppOutput_result result = new appendAppOutput_result(); + checkpointOutput_result result = new checkpointOutput_result(); if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; result.setExIsSet(true); @@ -2516,25 +2246,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, appendAppOutput_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.appendAppOutput(args.event,resultHandler); + public void start(I iface, checkpointOutput_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + iface.checkpointOutput(args.noteId, args.paragraphId,resultHandler); } } - public static class updateAppOutput extends org.apache.thrift.AsyncProcessFunction { - public updateAppOutput() { - super("updateAppOutput"); + public static class runParagraphs extends org.apache.thrift.AsyncProcessFunction { + public runParagraphs() { + super("runParagraphs"); } - public updateAppOutput_args getEmptyArgsInstance() { - return new updateAppOutput_args(); + public runParagraphs_args getEmptyArgsInstance() { + return new runParagraphs_args(); } public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new org.apache.thrift.async.AsyncMethodCallback() { public void onComplete(Void o) { - updateAppOutput_result result = new updateAppOutput_result(); + runParagraphs_result result = new runParagraphs_result(); try { fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); } catch (org.apache.thrift.transport.TTransportException e) { @@ -2548,7 +2278,7 @@ public void onComplete(Void o) { public void onError(java.lang.Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TSerializable msg; - updateAppOutput_result result = new updateAppOutput_result(); + runParagraphs_result result = new runParagraphs_result(); if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; result.setExIsSet(true); @@ -2580,25 +2310,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, updateAppOutput_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.updateAppOutput(args.event,resultHandler); + public void start(I iface, runParagraphs_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + iface.runParagraphs(args.event,resultHandler); } } - public static class updateAppStatus extends org.apache.thrift.AsyncProcessFunction { - public updateAppStatus() { - super("updateAppStatus"); + public static class addAngularObject extends org.apache.thrift.AsyncProcessFunction { + public addAngularObject() { + super("addAngularObject"); } - public updateAppStatus_args getEmptyArgsInstance() { - return new updateAppStatus_args(); + public addAngularObject_args getEmptyArgsInstance() { + return new addAngularObject_args(); } public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new org.apache.thrift.async.AsyncMethodCallback() { public void onComplete(Void o) { - updateAppStatus_result result = new updateAppStatus_result(); + addAngularObject_result result = new addAngularObject_result(); try { fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); } catch (org.apache.thrift.transport.TTransportException e) { @@ -2612,7 +2342,7 @@ public void onComplete(Void o) { public void onError(java.lang.Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TSerializable msg; - updateAppStatus_result result = new updateAppStatus_result(); + addAngularObject_result result = new addAngularObject_result(); if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; result.setExIsSet(true); @@ -2644,25 +2374,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, updateAppStatus_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.updateAppStatus(args.event,resultHandler); + public void start(I iface, addAngularObject_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + iface.addAngularObject(args.intpGroupId, args.json,resultHandler); } } - public static class checkpointOutput extends org.apache.thrift.AsyncProcessFunction { - public checkpointOutput() { - super("checkpointOutput"); + public static class updateAngularObject extends org.apache.thrift.AsyncProcessFunction { + public updateAngularObject() { + super("updateAngularObject"); } - public checkpointOutput_args getEmptyArgsInstance() { - return new checkpointOutput_args(); + public updateAngularObject_args getEmptyArgsInstance() { + return new updateAngularObject_args(); } public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new org.apache.thrift.async.AsyncMethodCallback() { public void onComplete(Void o) { - checkpointOutput_result result = new checkpointOutput_result(); + updateAngularObject_result result = new updateAngularObject_result(); try { fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); } catch (org.apache.thrift.transport.TTransportException e) { @@ -2676,7 +2406,7 @@ public void onComplete(Void o) { public void onError(java.lang.Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TSerializable msg; - checkpointOutput_result result = new checkpointOutput_result(); + updateAngularObject_result result = new updateAngularObject_result(); if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; result.setExIsSet(true); @@ -2708,25 +2438,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, checkpointOutput_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.checkpointOutput(args.noteId, args.paragraphId,resultHandler); + public void start(I iface, updateAngularObject_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + iface.updateAngularObject(args.intpGroupId, args.json,resultHandler); } } - public static class runParagraphs extends org.apache.thrift.AsyncProcessFunction { - public runParagraphs() { - super("runParagraphs"); + public static class removeAngularObject extends org.apache.thrift.AsyncProcessFunction { + public removeAngularObject() { + super("removeAngularObject"); } - public runParagraphs_args getEmptyArgsInstance() { - return new runParagraphs_args(); + public removeAngularObject_args getEmptyArgsInstance() { + return new removeAngularObject_args(); } public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new org.apache.thrift.async.AsyncMethodCallback() { public void onComplete(Void o) { - runParagraphs_result result = new runParagraphs_result(); + removeAngularObject_result result = new removeAngularObject_result(); try { fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); } catch (org.apache.thrift.transport.TTransportException e) { @@ -2740,7 +2470,7 @@ public void onComplete(Void o) { public void onError(java.lang.Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TSerializable msg; - runParagraphs_result result = new runParagraphs_result(); + removeAngularObject_result result = new removeAngularObject_result(); if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; result.setExIsSet(true); @@ -2772,206 +2502,14 @@ protected boolean isOneway() { return false; } - public void start(I iface, runParagraphs_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.runParagraphs(args.event,resultHandler); + public void start(I iface, removeAngularObject_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + iface.removeAngularObject(args.intpGroupId, args.noteId, args.paragraphId, args.name,resultHandler); } } - public static class addAngularObject extends org.apache.thrift.AsyncProcessFunction { - public addAngularObject() { - super("addAngularObject"); - } - - public addAngularObject_args getEmptyArgsInstance() { - return new addAngularObject_args(); - } - - public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback() { - public void onComplete(Void o) { - addAngularObject_result result = new addAngularObject_result(); - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - } catch (org.apache.thrift.transport.TTransportException e) { - _LOGGER.error("TTransportException writing to internal frame buffer", e); - fb.close(); - } catch (java.lang.Exception e) { - _LOGGER.error("Exception writing to internal frame buffer", e); - onError(e); - } - } - public void onError(java.lang.Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TSerializable msg; - addAngularObject_result result = new addAngularObject_result(); - if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { - result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; - result.setExIsSet(true); - msg = result; - } else if (e instanceof org.apache.thrift.transport.TTransportException) { - _LOGGER.error("TTransportException inside handler", e); - fb.close(); - return; - } else if (e instanceof org.apache.thrift.TApplicationException) { - _LOGGER.error("TApplicationException inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TApplicationException)e; - } else { - _LOGGER.error("Exception inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - } catch (java.lang.Exception ex) { - _LOGGER.error("Exception writing to internal frame buffer", ex); - fb.close(); - } - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, addAngularObject_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.addAngularObject(args.intpGroupId, args.json,resultHandler); - } - } - - public static class updateAngularObject extends org.apache.thrift.AsyncProcessFunction { - public updateAngularObject() { - super("updateAngularObject"); - } - - public updateAngularObject_args getEmptyArgsInstance() { - return new updateAngularObject_args(); - } - - public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback() { - public void onComplete(Void o) { - updateAngularObject_result result = new updateAngularObject_result(); - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - } catch (org.apache.thrift.transport.TTransportException e) { - _LOGGER.error("TTransportException writing to internal frame buffer", e); - fb.close(); - } catch (java.lang.Exception e) { - _LOGGER.error("Exception writing to internal frame buffer", e); - onError(e); - } - } - public void onError(java.lang.Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TSerializable msg; - updateAngularObject_result result = new updateAngularObject_result(); - if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { - result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; - result.setExIsSet(true); - msg = result; - } else if (e instanceof org.apache.thrift.transport.TTransportException) { - _LOGGER.error("TTransportException inside handler", e); - fb.close(); - return; - } else if (e instanceof org.apache.thrift.TApplicationException) { - _LOGGER.error("TApplicationException inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TApplicationException)e; - } else { - _LOGGER.error("Exception inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - } catch (java.lang.Exception ex) { - _LOGGER.error("Exception writing to internal frame buffer", ex); - fb.close(); - } - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, updateAngularObject_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.updateAngularObject(args.intpGroupId, args.json,resultHandler); - } - } - - public static class removeAngularObject extends org.apache.thrift.AsyncProcessFunction { - public removeAngularObject() { - super("removeAngularObject"); - } - - public removeAngularObject_args getEmptyArgsInstance() { - return new removeAngularObject_args(); - } - - public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback() { - public void onComplete(Void o) { - removeAngularObject_result result = new removeAngularObject_result(); - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - } catch (org.apache.thrift.transport.TTransportException e) { - _LOGGER.error("TTransportException writing to internal frame buffer", e); - fb.close(); - } catch (java.lang.Exception e) { - _LOGGER.error("Exception writing to internal frame buffer", e); - onError(e); - } - } - public void onError(java.lang.Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TSerializable msg; - removeAngularObject_result result = new removeAngularObject_result(); - if (e instanceof org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) { - result.ex = (org.apache.zeppelin.interpreter.thrift.InterpreterRPCException) e; - result.setExIsSet(true); - msg = result; - } else if (e instanceof org.apache.thrift.transport.TTransportException) { - _LOGGER.error("TTransportException inside handler", e); - fb.close(); - return; - } else if (e instanceof org.apache.thrift.TApplicationException) { - _LOGGER.error("TApplicationException inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TApplicationException)e; - } else { - _LOGGER.error("Exception inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - } catch (java.lang.Exception ex) { - _LOGGER.error("Exception writing to internal frame buffer", ex); - fb.close(); - } - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, removeAngularObject_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.removeAngularObject(args.intpGroupId, args.noteId, args.paragraphId, args.name,resultHandler); - } - } - - public static class sendWebUrl extends org.apache.thrift.AsyncProcessFunction { - public sendWebUrl() { - super("sendWebUrl"); + public static class sendWebUrl extends org.apache.thrift.AsyncProcessFunction { + public sendWebUrl() { + super("sendWebUrl"); } public sendWebUrl_args getEmptyArgsInstance() { @@ -7245,2229 +6783,6 @@ private static S scheme(org.apache. } } - public static class appendAppOutput_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendAppOutput_args"); - - private static final org.apache.thrift.protocol.TField EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("event", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new appendAppOutput_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new appendAppOutput_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable AppOutputAppendEvent event; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - EVENT((short)1, "event"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // EVENT - return EVENT; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.EVENT, new org.apache.thrift.meta_data.FieldMetaData("event", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AppOutputAppendEvent.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(appendAppOutput_args.class, metaDataMap); - } - - public appendAppOutput_args() { - } - - public appendAppOutput_args( - AppOutputAppendEvent event) - { - this(); - this.event = event; - } - - /** - * Performs a deep copy on other. - */ - public appendAppOutput_args(appendAppOutput_args other) { - if (other.isSetEvent()) { - this.event = new AppOutputAppendEvent(other.event); - } - } - - public appendAppOutput_args deepCopy() { - return new appendAppOutput_args(this); - } - - @Override - public void clear() { - this.event = null; - } - - @org.apache.thrift.annotation.Nullable - public AppOutputAppendEvent getEvent() { - return this.event; - } - - public appendAppOutput_args setEvent(@org.apache.thrift.annotation.Nullable AppOutputAppendEvent event) { - this.event = event; - return this; - } - - public void unsetEvent() { - this.event = null; - } - - /** Returns true if field event is set (has been assigned a value) and false otherwise */ - public boolean isSetEvent() { - return this.event != null; - } - - public void setEventIsSet(boolean value) { - if (!value) { - this.event = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case EVENT: - if (value == null) { - unsetEvent(); - } else { - setEvent((AppOutputAppendEvent)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case EVENT: - return getEvent(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case EVENT: - return isSetEvent(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof appendAppOutput_args) - return this.equals((appendAppOutput_args)that); - return false; - } - - public boolean equals(appendAppOutput_args that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_event = true && this.isSetEvent(); - boolean that_present_event = true && that.isSetEvent(); - if (this_present_event || that_present_event) { - if (!(this_present_event && that_present_event)) - return false; - if (!this.event.equals(that.event)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetEvent()) ? 131071 : 524287); - if (isSetEvent()) - hashCode = hashCode * 8191 + event.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(appendAppOutput_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetEvent()).compareTo(other.isSetEvent()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEvent()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, other.event); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("appendAppOutput_args("); - boolean first = true; - - sb.append("event:"); - if (this.event == null) { - sb.append("null"); - } else { - sb.append(this.event); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (event != null) { - event.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class appendAppOutput_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public appendAppOutput_argsStandardScheme getScheme() { - return new appendAppOutput_argsStandardScheme(); - } - } - - private static class appendAppOutput_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, appendAppOutput_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // EVENT - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.event = new AppOutputAppendEvent(); - struct.event.read(iprot); - struct.setEventIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, appendAppOutput_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.event != null) { - oprot.writeFieldBegin(EVENT_FIELD_DESC); - struct.event.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class appendAppOutput_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public appendAppOutput_argsTupleScheme getScheme() { - return new appendAppOutput_argsTupleScheme(); - } - } - - private static class appendAppOutput_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, appendAppOutput_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetEvent()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetEvent()) { - struct.event.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, appendAppOutput_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.event = new AppOutputAppendEvent(); - struct.event.read(iprot); - struct.setEventIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class appendAppOutput_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendAppOutput_result"); - - private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField("ex", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new appendAppOutput_resultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new appendAppOutput_resultTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - EX((short)1, "ex"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // EX - return EX; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.zeppelin.interpreter.thrift.InterpreterRPCException.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(appendAppOutput_result.class, metaDataMap); - } - - public appendAppOutput_result() { - } - - public appendAppOutput_result( - org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) - { - this(); - this.ex = ex; - } - - /** - * Performs a deep copy on other. - */ - public appendAppOutput_result(appendAppOutput_result other) { - if (other.isSetEx()) { - this.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(other.ex); - } - } - - public appendAppOutput_result deepCopy() { - return new appendAppOutput_result(this); - } - - @Override - public void clear() { - this.ex = null; - } - - @org.apache.thrift.annotation.Nullable - public org.apache.zeppelin.interpreter.thrift.InterpreterRPCException getEx() { - return this.ex; - } - - public appendAppOutput_result setEx(@org.apache.thrift.annotation.Nullable org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) { - this.ex = ex; - return this; - } - - public void unsetEx() { - this.ex = null; - } - - /** Returns true if field ex is set (has been assigned a value) and false otherwise */ - public boolean isSetEx() { - return this.ex != null; - } - - public void setExIsSet(boolean value) { - if (!value) { - this.ex = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case EX: - if (value == null) { - unsetEx(); - } else { - setEx((org.apache.zeppelin.interpreter.thrift.InterpreterRPCException)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case EX: - return getEx(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case EX: - return isSetEx(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof appendAppOutput_result) - return this.equals((appendAppOutput_result)that); - return false; - } - - public boolean equals(appendAppOutput_result that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_ex = true && this.isSetEx(); - boolean that_present_ex = true && that.isSetEx(); - if (this_present_ex || that_present_ex) { - if (!(this_present_ex && that_present_ex)) - return false; - if (!this.ex.equals(that.ex)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetEx()) ? 131071 : 524287); - if (isSetEx()) - hashCode = hashCode * 8191 + ex.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(appendAppOutput_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEx()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("appendAppOutput_result("); - boolean first = true; - - sb.append("ex:"); - if (this.ex == null) { - sb.append("null"); - } else { - sb.append(this.ex); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class appendAppOutput_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public appendAppOutput_resultStandardScheme getScheme() { - return new appendAppOutput_resultStandardScheme(); - } - } - - private static class appendAppOutput_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, appendAppOutput_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // EX - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, appendAppOutput_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.ex != null) { - oprot.writeFieldBegin(EX_FIELD_DESC); - struct.ex.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class appendAppOutput_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public appendAppOutput_resultTupleScheme getScheme() { - return new appendAppOutput_resultTupleScheme(); - } - } - - private static class appendAppOutput_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, appendAppOutput_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetEx()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetEx()) { - struct.ex.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, appendAppOutput_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class updateAppOutput_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateAppOutput_args"); - - private static final org.apache.thrift.protocol.TField EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("event", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new updateAppOutput_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateAppOutput_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable AppOutputUpdateEvent event; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - EVENT((short)1, "event"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // EVENT - return EVENT; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.EVENT, new org.apache.thrift.meta_data.FieldMetaData("event", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AppOutputUpdateEvent.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateAppOutput_args.class, metaDataMap); - } - - public updateAppOutput_args() { - } - - public updateAppOutput_args( - AppOutputUpdateEvent event) - { - this(); - this.event = event; - } - - /** - * Performs a deep copy on other. - */ - public updateAppOutput_args(updateAppOutput_args other) { - if (other.isSetEvent()) { - this.event = new AppOutputUpdateEvent(other.event); - } - } - - public updateAppOutput_args deepCopy() { - return new updateAppOutput_args(this); - } - - @Override - public void clear() { - this.event = null; - } - - @org.apache.thrift.annotation.Nullable - public AppOutputUpdateEvent getEvent() { - return this.event; - } - - public updateAppOutput_args setEvent(@org.apache.thrift.annotation.Nullable AppOutputUpdateEvent event) { - this.event = event; - return this; - } - - public void unsetEvent() { - this.event = null; - } - - /** Returns true if field event is set (has been assigned a value) and false otherwise */ - public boolean isSetEvent() { - return this.event != null; - } - - public void setEventIsSet(boolean value) { - if (!value) { - this.event = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case EVENT: - if (value == null) { - unsetEvent(); - } else { - setEvent((AppOutputUpdateEvent)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case EVENT: - return getEvent(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case EVENT: - return isSetEvent(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof updateAppOutput_args) - return this.equals((updateAppOutput_args)that); - return false; - } - - public boolean equals(updateAppOutput_args that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_event = true && this.isSetEvent(); - boolean that_present_event = true && that.isSetEvent(); - if (this_present_event || that_present_event) { - if (!(this_present_event && that_present_event)) - return false; - if (!this.event.equals(that.event)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetEvent()) ? 131071 : 524287); - if (isSetEvent()) - hashCode = hashCode * 8191 + event.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(updateAppOutput_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetEvent()).compareTo(other.isSetEvent()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEvent()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, other.event); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("updateAppOutput_args("); - boolean first = true; - - sb.append("event:"); - if (this.event == null) { - sb.append("null"); - } else { - sb.append(this.event); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (event != null) { - event.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class updateAppOutput_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppOutput_argsStandardScheme getScheme() { - return new updateAppOutput_argsStandardScheme(); - } - } - - private static class updateAppOutput_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, updateAppOutput_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // EVENT - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.event = new AppOutputUpdateEvent(); - struct.event.read(iprot); - struct.setEventIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, updateAppOutput_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.event != null) { - oprot.writeFieldBegin(EVENT_FIELD_DESC); - struct.event.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class updateAppOutput_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppOutput_argsTupleScheme getScheme() { - return new updateAppOutput_argsTupleScheme(); - } - } - - private static class updateAppOutput_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, updateAppOutput_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetEvent()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetEvent()) { - struct.event.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, updateAppOutput_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.event = new AppOutputUpdateEvent(); - struct.event.read(iprot); - struct.setEventIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class updateAppOutput_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateAppOutput_result"); - - private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField("ex", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new updateAppOutput_resultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateAppOutput_resultTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - EX((short)1, "ex"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // EX - return EX; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.zeppelin.interpreter.thrift.InterpreterRPCException.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateAppOutput_result.class, metaDataMap); - } - - public updateAppOutput_result() { - } - - public updateAppOutput_result( - org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) - { - this(); - this.ex = ex; - } - - /** - * Performs a deep copy on other. - */ - public updateAppOutput_result(updateAppOutput_result other) { - if (other.isSetEx()) { - this.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(other.ex); - } - } - - public updateAppOutput_result deepCopy() { - return new updateAppOutput_result(this); - } - - @Override - public void clear() { - this.ex = null; - } - - @org.apache.thrift.annotation.Nullable - public org.apache.zeppelin.interpreter.thrift.InterpreterRPCException getEx() { - return this.ex; - } - - public updateAppOutput_result setEx(@org.apache.thrift.annotation.Nullable org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) { - this.ex = ex; - return this; - } - - public void unsetEx() { - this.ex = null; - } - - /** Returns true if field ex is set (has been assigned a value) and false otherwise */ - public boolean isSetEx() { - return this.ex != null; - } - - public void setExIsSet(boolean value) { - if (!value) { - this.ex = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case EX: - if (value == null) { - unsetEx(); - } else { - setEx((org.apache.zeppelin.interpreter.thrift.InterpreterRPCException)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case EX: - return getEx(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case EX: - return isSetEx(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof updateAppOutput_result) - return this.equals((updateAppOutput_result)that); - return false; - } - - public boolean equals(updateAppOutput_result that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_ex = true && this.isSetEx(); - boolean that_present_ex = true && that.isSetEx(); - if (this_present_ex || that_present_ex) { - if (!(this_present_ex && that_present_ex)) - return false; - if (!this.ex.equals(that.ex)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetEx()) ? 131071 : 524287); - if (isSetEx()) - hashCode = hashCode * 8191 + ex.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(updateAppOutput_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEx()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("updateAppOutput_result("); - boolean first = true; - - sb.append("ex:"); - if (this.ex == null) { - sb.append("null"); - } else { - sb.append(this.ex); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class updateAppOutput_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppOutput_resultStandardScheme getScheme() { - return new updateAppOutput_resultStandardScheme(); - } - } - - private static class updateAppOutput_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, updateAppOutput_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // EX - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, updateAppOutput_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.ex != null) { - oprot.writeFieldBegin(EX_FIELD_DESC); - struct.ex.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class updateAppOutput_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppOutput_resultTupleScheme getScheme() { - return new updateAppOutput_resultTupleScheme(); - } - } - - private static class updateAppOutput_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, updateAppOutput_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetEx()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetEx()) { - struct.ex.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, updateAppOutput_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class updateAppStatus_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateAppStatus_args"); - - private static final org.apache.thrift.protocol.TField EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("event", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new updateAppStatus_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateAppStatus_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable AppStatusUpdateEvent event; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - EVENT((short)1, "event"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // EVENT - return EVENT; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.EVENT, new org.apache.thrift.meta_data.FieldMetaData("event", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AppStatusUpdateEvent.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateAppStatus_args.class, metaDataMap); - } - - public updateAppStatus_args() { - } - - public updateAppStatus_args( - AppStatusUpdateEvent event) - { - this(); - this.event = event; - } - - /** - * Performs a deep copy on other. - */ - public updateAppStatus_args(updateAppStatus_args other) { - if (other.isSetEvent()) { - this.event = new AppStatusUpdateEvent(other.event); - } - } - - public updateAppStatus_args deepCopy() { - return new updateAppStatus_args(this); - } - - @Override - public void clear() { - this.event = null; - } - - @org.apache.thrift.annotation.Nullable - public AppStatusUpdateEvent getEvent() { - return this.event; - } - - public updateAppStatus_args setEvent(@org.apache.thrift.annotation.Nullable AppStatusUpdateEvent event) { - this.event = event; - return this; - } - - public void unsetEvent() { - this.event = null; - } - - /** Returns true if field event is set (has been assigned a value) and false otherwise */ - public boolean isSetEvent() { - return this.event != null; - } - - public void setEventIsSet(boolean value) { - if (!value) { - this.event = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case EVENT: - if (value == null) { - unsetEvent(); - } else { - setEvent((AppStatusUpdateEvent)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case EVENT: - return getEvent(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case EVENT: - return isSetEvent(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof updateAppStatus_args) - return this.equals((updateAppStatus_args)that); - return false; - } - - public boolean equals(updateAppStatus_args that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_event = true && this.isSetEvent(); - boolean that_present_event = true && that.isSetEvent(); - if (this_present_event || that_present_event) { - if (!(this_present_event && that_present_event)) - return false; - if (!this.event.equals(that.event)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetEvent()) ? 131071 : 524287); - if (isSetEvent()) - hashCode = hashCode * 8191 + event.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(updateAppStatus_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetEvent()).compareTo(other.isSetEvent()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEvent()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, other.event); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("updateAppStatus_args("); - boolean first = true; - - sb.append("event:"); - if (this.event == null) { - sb.append("null"); - } else { - sb.append(this.event); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (event != null) { - event.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class updateAppStatus_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppStatus_argsStandardScheme getScheme() { - return new updateAppStatus_argsStandardScheme(); - } - } - - private static class updateAppStatus_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, updateAppStatus_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // EVENT - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.event = new AppStatusUpdateEvent(); - struct.event.read(iprot); - struct.setEventIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, updateAppStatus_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.event != null) { - oprot.writeFieldBegin(EVENT_FIELD_DESC); - struct.event.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class updateAppStatus_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppStatus_argsTupleScheme getScheme() { - return new updateAppStatus_argsTupleScheme(); - } - } - - private static class updateAppStatus_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, updateAppStatus_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetEvent()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetEvent()) { - struct.event.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, updateAppStatus_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.event = new AppStatusUpdateEvent(); - struct.event.read(iprot); - struct.setEventIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class updateAppStatus_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateAppStatus_result"); - - private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField("ex", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new updateAppStatus_resultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateAppStatus_resultTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - EX((short)1, "ex"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // EX - return EX; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.zeppelin.interpreter.thrift.InterpreterRPCException.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateAppStatus_result.class, metaDataMap); - } - - public updateAppStatus_result() { - } - - public updateAppStatus_result( - org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) - { - this(); - this.ex = ex; - } - - /** - * Performs a deep copy on other. - */ - public updateAppStatus_result(updateAppStatus_result other) { - if (other.isSetEx()) { - this.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(other.ex); - } - } - - public updateAppStatus_result deepCopy() { - return new updateAppStatus_result(this); - } - - @Override - public void clear() { - this.ex = null; - } - - @org.apache.thrift.annotation.Nullable - public org.apache.zeppelin.interpreter.thrift.InterpreterRPCException getEx() { - return this.ex; - } - - public updateAppStatus_result setEx(@org.apache.thrift.annotation.Nullable org.apache.zeppelin.interpreter.thrift.InterpreterRPCException ex) { - this.ex = ex; - return this; - } - - public void unsetEx() { - this.ex = null; - } - - /** Returns true if field ex is set (has been assigned a value) and false otherwise */ - public boolean isSetEx() { - return this.ex != null; - } - - public void setExIsSet(boolean value) { - if (!value) { - this.ex = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case EX: - if (value == null) { - unsetEx(); - } else { - setEx((org.apache.zeppelin.interpreter.thrift.InterpreterRPCException)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case EX: - return getEx(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case EX: - return isSetEx(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof updateAppStatus_result) - return this.equals((updateAppStatus_result)that); - return false; - } - - public boolean equals(updateAppStatus_result that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_ex = true && this.isSetEx(); - boolean that_present_ex = true && that.isSetEx(); - if (this_present_ex || that_present_ex) { - if (!(this_present_ex && that_present_ex)) - return false; - if (!this.ex.equals(that.ex)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetEx()) ? 131071 : 524287); - if (isSetEx()) - hashCode = hashCode * 8191 + ex.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(updateAppStatus_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEx()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("updateAppStatus_result("); - boolean first = true; - - sb.append("ex:"); - if (this.ex == null) { - sb.append("null"); - } else { - sb.append(this.ex); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class updateAppStatus_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppStatus_resultStandardScheme getScheme() { - return new updateAppStatus_resultStandardScheme(); - } - } - - private static class updateAppStatus_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, updateAppStatus_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // EX - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, updateAppStatus_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.ex != null) { - oprot.writeFieldBegin(EX_FIELD_DESC); - struct.ex.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class updateAppStatus_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public updateAppStatus_resultTupleScheme getScheme() { - return new updateAppStatus_resultTupleScheme(); - } - } - - private static class updateAppStatus_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, updateAppStatus_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetEx()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetEx()) { - struct.ex.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, updateAppStatus_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.ex = new org.apache.zeppelin.interpreter.thrift.InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - public static class checkpointOutput_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkpointOutput_args"); diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java index 5d8244ae899..8eaaa181368 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java @@ -24,7 +24,7 @@ package org.apache.zeppelin.interpreter.thrift; -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-10-21") public enum RemoteInterpreterEventType implements org.apache.thrift.TEnum { NO_OP(1), ANGULAR_OBJECT_ADD(2), @@ -37,7 +37,6 @@ public enum RemoteInterpreterEventType implements org.apache.thrift.TEnum { OUTPUT_UPDATE(9), OUTPUT_UPDATE_ALL(10), ANGULAR_REGISTRY_PUSH(11), - APP_STATUS_UPDATE(12), META_INFOS(13), REMOTE_ZEPPELIN_SERVER_RESOURCE(14), RESOURCE_INVOKE_METHOD(15), @@ -85,8 +84,6 @@ public static RemoteInterpreterEventType findByValue(int value) { return OUTPUT_UPDATE_ALL; case 11: return ANGULAR_REGISTRY_PUSH; - case 12: - return APP_STATUS_UPDATE; case 13: return META_INFOS; case 14: diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java index a6ad9d5f976..6f6bfc7a9a7 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java @@ -24,7 +24,7 @@ package org.apache.zeppelin.interpreter.thrift; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-09-13") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2026-10-21") public class RemoteInterpreterService { public interface Iface { @@ -69,12 +69,6 @@ public interface Iface { public void angularRegistryPush(java.lang.String registry) throws InterpreterRPCException, org.apache.thrift.TException; - public RemoteApplicationResult loadApplication(java.lang.String applicationInstanceId, java.lang.String packageInfo, java.lang.String sessionId, java.lang.String paragraphId) throws InterpreterRPCException, org.apache.thrift.TException; - - public RemoteApplicationResult unloadApplication(java.lang.String applicationInstanceId) throws InterpreterRPCException, org.apache.thrift.TException; - - public RemoteApplicationResult runApplication(java.lang.String applicationInstanceId) throws InterpreterRPCException, org.apache.thrift.TException; - } public interface AsyncIface { @@ -119,12 +113,6 @@ public interface AsyncIface { public void angularRegistryPush(java.lang.String registry, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void loadApplication(java.lang.String applicationInstanceId, java.lang.String packageInfo, java.lang.String sessionId, java.lang.String paragraphId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void unloadApplication(java.lang.String applicationInstanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void runApplication(java.lang.String applicationInstanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -664,87 +652,6 @@ public void recv_angularRegistryPush() throws InterpreterRPCException, org.apach return; } - public RemoteApplicationResult loadApplication(java.lang.String applicationInstanceId, java.lang.String packageInfo, java.lang.String sessionId, java.lang.String paragraphId) throws InterpreterRPCException, org.apache.thrift.TException - { - send_loadApplication(applicationInstanceId, packageInfo, sessionId, paragraphId); - return recv_loadApplication(); - } - - public void send_loadApplication(java.lang.String applicationInstanceId, java.lang.String packageInfo, java.lang.String sessionId, java.lang.String paragraphId) throws org.apache.thrift.TException - { - loadApplication_args args = new loadApplication_args(); - args.setApplicationInstanceId(applicationInstanceId); - args.setPackageInfo(packageInfo); - args.setSessionId(sessionId); - args.setParagraphId(paragraphId); - sendBase("loadApplication", args); - } - - public RemoteApplicationResult recv_loadApplication() throws InterpreterRPCException, org.apache.thrift.TException - { - loadApplication_result result = new loadApplication_result(); - receiveBase(result, "loadApplication"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.ex != null) { - throw result.ex; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "loadApplication failed: unknown result"); - } - - public RemoteApplicationResult unloadApplication(java.lang.String applicationInstanceId) throws InterpreterRPCException, org.apache.thrift.TException - { - send_unloadApplication(applicationInstanceId); - return recv_unloadApplication(); - } - - public void send_unloadApplication(java.lang.String applicationInstanceId) throws org.apache.thrift.TException - { - unloadApplication_args args = new unloadApplication_args(); - args.setApplicationInstanceId(applicationInstanceId); - sendBase("unloadApplication", args); - } - - public RemoteApplicationResult recv_unloadApplication() throws InterpreterRPCException, org.apache.thrift.TException - { - unloadApplication_result result = new unloadApplication_result(); - receiveBase(result, "unloadApplication"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.ex != null) { - throw result.ex; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "unloadApplication failed: unknown result"); - } - - public RemoteApplicationResult runApplication(java.lang.String applicationInstanceId) throws InterpreterRPCException, org.apache.thrift.TException - { - send_runApplication(applicationInstanceId); - return recv_runApplication(); - } - - public void send_runApplication(java.lang.String applicationInstanceId) throws org.apache.thrift.TException - { - runApplication_args args = new runApplication_args(); - args.setApplicationInstanceId(applicationInstanceId); - sendBase("runApplication", args); - } - - public RemoteApplicationResult recv_runApplication() throws InterpreterRPCException, org.apache.thrift.TException - { - runApplication_result result = new runApplication_result(); - receiveBase(result, "runApplication"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.ex != null) { - throw result.ex; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "runApplication failed: unknown result"); - } - } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { @@ -1502,111 +1409,6 @@ public Void getResult() throws InterpreterRPCException, org.apache.thrift.TExcep } } - public void loadApplication(java.lang.String applicationInstanceId, java.lang.String packageInfo, java.lang.String sessionId, java.lang.String paragraphId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - loadApplication_call method_call = new loadApplication_call(applicationInstanceId, packageInfo, sessionId, paragraphId, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class loadApplication_call extends org.apache.thrift.async.TAsyncMethodCall { - private java.lang.String applicationInstanceId; - private java.lang.String packageInfo; - private java.lang.String sessionId; - private java.lang.String paragraphId; - public loadApplication_call(java.lang.String applicationInstanceId, java.lang.String packageInfo, java.lang.String sessionId, java.lang.String paragraphId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.applicationInstanceId = applicationInstanceId; - this.packageInfo = packageInfo; - this.sessionId = sessionId; - this.paragraphId = paragraphId; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("loadApplication", org.apache.thrift.protocol.TMessageType.CALL, 0)); - loadApplication_args args = new loadApplication_args(); - args.setApplicationInstanceId(applicationInstanceId); - args.setPackageInfo(packageInfo); - args.setSessionId(sessionId); - args.setParagraphId(paragraphId); - args.write(prot); - prot.writeMessageEnd(); - } - - public RemoteApplicationResult getResult() throws InterpreterRPCException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new java.lang.IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_loadApplication(); - } - } - - public void unloadApplication(java.lang.String applicationInstanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - unloadApplication_call method_call = new unloadApplication_call(applicationInstanceId, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class unloadApplication_call extends org.apache.thrift.async.TAsyncMethodCall { - private java.lang.String applicationInstanceId; - public unloadApplication_call(java.lang.String applicationInstanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.applicationInstanceId = applicationInstanceId; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("unloadApplication", org.apache.thrift.protocol.TMessageType.CALL, 0)); - unloadApplication_args args = new unloadApplication_args(); - args.setApplicationInstanceId(applicationInstanceId); - args.write(prot); - prot.writeMessageEnd(); - } - - public RemoteApplicationResult getResult() throws InterpreterRPCException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new java.lang.IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_unloadApplication(); - } - } - - public void runApplication(java.lang.String applicationInstanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - runApplication_call method_call = new runApplication_call(applicationInstanceId, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class runApplication_call extends org.apache.thrift.async.TAsyncMethodCall { - private java.lang.String applicationInstanceId; - public runApplication_call(java.lang.String applicationInstanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.applicationInstanceId = applicationInstanceId; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("runApplication", org.apache.thrift.protocol.TMessageType.CALL, 0)); - runApplication_args args = new runApplication_args(); - args.setApplicationInstanceId(applicationInstanceId); - args.write(prot); - prot.writeMessageEnd(); - } - - public RemoteApplicationResult getResult() throws InterpreterRPCException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new java.lang.IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_runApplication(); - } - } - } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -1640,9 +1442,6 @@ protected Processor(I iface, java.util.Map extends org.apache.thrift.ProcessFunction { - public loadApplication() { - super("loadApplication"); - } - - public loadApplication_args getEmptyArgsInstance() { - return new loadApplication_args(); - } - - protected boolean isOneway() { - return false; - } - - @Override - protected boolean rethrowUnhandledExceptions() { - return false; - } - - public loadApplication_result getResult(I iface, loadApplication_args args) throws org.apache.thrift.TException { - loadApplication_result result = new loadApplication_result(); - try { - result.success = iface.loadApplication(args.applicationInstanceId, args.packageInfo, args.sessionId, args.paragraphId); - } catch (InterpreterRPCException ex) { - result.ex = ex; - } - return result; - } - } - - public static class unloadApplication extends org.apache.thrift.ProcessFunction { - public unloadApplication() { - super("unloadApplication"); - } - - public unloadApplication_args getEmptyArgsInstance() { - return new unloadApplication_args(); - } - - protected boolean isOneway() { - return false; - } - - @Override - protected boolean rethrowUnhandledExceptions() { - return false; - } - - public unloadApplication_result getResult(I iface, unloadApplication_args args) throws org.apache.thrift.TException { - unloadApplication_result result = new unloadApplication_result(); - try { - result.success = iface.unloadApplication(args.applicationInstanceId); - } catch (InterpreterRPCException ex) { - result.ex = ex; - } - return result; - } - } - - public static class runApplication extends org.apache.thrift.ProcessFunction { - public runApplication() { - super("runApplication"); - } - - public runApplication_args getEmptyArgsInstance() { - return new runApplication_args(); - } - - protected boolean isOneway() { - return false; - } - - @Override - protected boolean rethrowUnhandledExceptions() { - return false; - } - - public runApplication_result getResult(I iface, runApplication_args args) throws org.apache.thrift.TException { - runApplication_result result = new runApplication_result(); - try { - result.success = iface.runApplication(args.applicationInstanceId); - } catch (InterpreterRPCException ex) { - result.ex = ex; - } - return result; - } - } - } public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { @@ -2344,9 +2056,6 @@ protected AsyncProcessor(I iface, java.util.Map extends org.apache.thrift.AsyncProcessFunction { - public loadApplication() { - super("loadApplication"); - } + } - public loadApplication_args getEmptyArgsInstance() { - return new loadApplication_args(); - } + public static class createInterpreter_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createInterpreter_args"); - public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback() { - public void onComplete(RemoteApplicationResult o) { - loadApplication_result result = new loadApplication_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - } catch (org.apache.thrift.transport.TTransportException e) { - _LOGGER.error("TTransportException writing to internal frame buffer", e); - fb.close(); - } catch (java.lang.Exception e) { - _LOGGER.error("Exception writing to internal frame buffer", e); - onError(e); - } - } - public void onError(java.lang.Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TSerializable msg; - loadApplication_result result = new loadApplication_result(); - if (e instanceof InterpreterRPCException) { - result.ex = (InterpreterRPCException) e; - result.setExIsSet(true); - msg = result; - } else if (e instanceof org.apache.thrift.transport.TTransportException) { - _LOGGER.error("TTransportException inside handler", e); - fb.close(); - return; - } else if (e instanceof org.apache.thrift.TApplicationException) { - _LOGGER.error("TApplicationException inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TApplicationException)e; - } else { - _LOGGER.error("Exception inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - } catch (java.lang.Exception ex) { - _LOGGER.error("Exception writing to internal frame buffer", ex); - fb.close(); - } - } - }; - } + private static final org.apache.thrift.protocol.TField INTP_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("intpGroupId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)4); + private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)5); - protected boolean isOneway() { - return false; - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new createInterpreter_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new createInterpreter_argsTupleSchemeFactory(); - public void start(I iface, loadApplication_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.loadApplication(args.applicationInstanceId, args.packageInfo, args.sessionId, args.paragraphId,resultHandler); - } - } + public @org.apache.thrift.annotation.Nullable java.lang.String intpGroupId; // required + public @org.apache.thrift.annotation.Nullable java.lang.String sessionId; // required + public @org.apache.thrift.annotation.Nullable java.lang.String className; // required + public @org.apache.thrift.annotation.Nullable java.util.Map properties; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userName; // required - public static class unloadApplication extends org.apache.thrift.AsyncProcessFunction { - public unloadApplication() { - super("unloadApplication"); - } - - public unloadApplication_args getEmptyArgsInstance() { - return new unloadApplication_args(); - } - - public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback() { - public void onComplete(RemoteApplicationResult o) { - unloadApplication_result result = new unloadApplication_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - } catch (org.apache.thrift.transport.TTransportException e) { - _LOGGER.error("TTransportException writing to internal frame buffer", e); - fb.close(); - } catch (java.lang.Exception e) { - _LOGGER.error("Exception writing to internal frame buffer", e); - onError(e); - } - } - public void onError(java.lang.Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TSerializable msg; - unloadApplication_result result = new unloadApplication_result(); - if (e instanceof InterpreterRPCException) { - result.ex = (InterpreterRPCException) e; - result.setExIsSet(true); - msg = result; - } else if (e instanceof org.apache.thrift.transport.TTransportException) { - _LOGGER.error("TTransportException inside handler", e); - fb.close(); - return; - } else if (e instanceof org.apache.thrift.TApplicationException) { - _LOGGER.error("TApplicationException inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TApplicationException)e; - } else { - _LOGGER.error("Exception inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - } catch (java.lang.Exception ex) { - _LOGGER.error("Exception writing to internal frame buffer", ex); - fb.close(); - } - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, unloadApplication_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.unloadApplication(args.applicationInstanceId,resultHandler); - } - } - - public static class runApplication extends org.apache.thrift.AsyncProcessFunction { - public runApplication() { - super("runApplication"); - } - - public runApplication_args getEmptyArgsInstance() { - return new runApplication_args(); - } - - public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback() { - public void onComplete(RemoteApplicationResult o) { - runApplication_result result = new runApplication_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - } catch (org.apache.thrift.transport.TTransportException e) { - _LOGGER.error("TTransportException writing to internal frame buffer", e); - fb.close(); - } catch (java.lang.Exception e) { - _LOGGER.error("Exception writing to internal frame buffer", e); - onError(e); - } - } - public void onError(java.lang.Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TSerializable msg; - runApplication_result result = new runApplication_result(); - if (e instanceof InterpreterRPCException) { - result.ex = (InterpreterRPCException) e; - result.setExIsSet(true); - msg = result; - } else if (e instanceof org.apache.thrift.transport.TTransportException) { - _LOGGER.error("TTransportException inside handler", e); - fb.close(); - return; - } else if (e instanceof org.apache.thrift.TApplicationException) { - _LOGGER.error("TApplicationException inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TApplicationException)e; - } else { - _LOGGER.error("Exception inside handler", e); - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - } catch (java.lang.Exception ex) { - _LOGGER.error("Exception writing to internal frame buffer", ex); - fb.close(); - } - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, runApplication_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - iface.runApplication(args.applicationInstanceId,resultHandler); - } - } - - } - - public static class createInterpreter_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createInterpreter_args"); - - private static final org.apache.thrift.protocol.TField INTP_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("intpGroupId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)4); - private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)5); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new createInterpreter_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new createInterpreter_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String intpGroupId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String sessionId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String className; // required - public @org.apache.thrift.annotation.Nullable java.util.Map properties; // required - public @org.apache.thrift.annotation.Nullable java.lang.String userName; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - INTP_GROUP_ID((short)1, "intpGroupId"), - SESSION_ID((short)2, "sessionId"), - CLASS_NAME((short)3, "className"), - PROPERTIES((short)4, "properties"), - USER_NAME((short)5, "userName"); + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INTP_GROUP_ID((short)1, "intpGroupId"), + SESSION_ID((short)2, "sessionId"), + CLASS_NAME((short)3, "className"), + PROPERTIES((short)4, "properties"), + USER_NAME((short)5, "userName"); private static final java.util.Map byName = new java.util.HashMap(); @@ -23077,2857 +22591,4 @@ private static S scheme(org.apache. } } - public static class loadApplication_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("loadApplication_args"); - - private static final org.apache.thrift.protocol.TField APPLICATION_INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationInstanceId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PACKAGE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("packageInfo", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)4); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new loadApplication_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new loadApplication_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String applicationInstanceId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String packageInfo; // required - public @org.apache.thrift.annotation.Nullable java.lang.String sessionId; // required - public @org.apache.thrift.annotation.Nullable java.lang.String paragraphId; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - APPLICATION_INSTANCE_ID((short)1, "applicationInstanceId"), - PACKAGE_INFO((short)2, "packageInfo"), - SESSION_ID((short)3, "sessionId"), - PARAGRAPH_ID((short)4, "paragraphId"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // APPLICATION_INSTANCE_ID - return APPLICATION_INSTANCE_ID; - case 2: // PACKAGE_INFO - return PACKAGE_INFO; - case 3: // SESSION_ID - return SESSION_ID; - case 4: // PARAGRAPH_ID - return PARAGRAPH_ID; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.APPLICATION_INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("applicationInstanceId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PACKAGE_INFO, new org.apache.thrift.meta_data.FieldMetaData("packageInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.SESSION_ID, new org.apache.thrift.meta_data.FieldMetaData("sessionId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(loadApplication_args.class, metaDataMap); - } - - public loadApplication_args() { - } - - public loadApplication_args( - java.lang.String applicationInstanceId, - java.lang.String packageInfo, - java.lang.String sessionId, - java.lang.String paragraphId) - { - this(); - this.applicationInstanceId = applicationInstanceId; - this.packageInfo = packageInfo; - this.sessionId = sessionId; - this.paragraphId = paragraphId; - } - - /** - * Performs a deep copy on other. - */ - public loadApplication_args(loadApplication_args other) { - if (other.isSetApplicationInstanceId()) { - this.applicationInstanceId = other.applicationInstanceId; - } - if (other.isSetPackageInfo()) { - this.packageInfo = other.packageInfo; - } - if (other.isSetSessionId()) { - this.sessionId = other.sessionId; - } - if (other.isSetParagraphId()) { - this.paragraphId = other.paragraphId; - } - } - - public loadApplication_args deepCopy() { - return new loadApplication_args(this); - } - - @Override - public void clear() { - this.applicationInstanceId = null; - this.packageInfo = null; - this.sessionId = null; - this.paragraphId = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getApplicationInstanceId() { - return this.applicationInstanceId; - } - - public loadApplication_args setApplicationInstanceId(@org.apache.thrift.annotation.Nullable java.lang.String applicationInstanceId) { - this.applicationInstanceId = applicationInstanceId; - return this; - } - - public void unsetApplicationInstanceId() { - this.applicationInstanceId = null; - } - - /** Returns true if field applicationInstanceId is set (has been assigned a value) and false otherwise */ - public boolean isSetApplicationInstanceId() { - return this.applicationInstanceId != null; - } - - public void setApplicationInstanceIdIsSet(boolean value) { - if (!value) { - this.applicationInstanceId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getPackageInfo() { - return this.packageInfo; - } - - public loadApplication_args setPackageInfo(@org.apache.thrift.annotation.Nullable java.lang.String packageInfo) { - this.packageInfo = packageInfo; - return this; - } - - public void unsetPackageInfo() { - this.packageInfo = null; - } - - /** Returns true if field packageInfo is set (has been assigned a value) and false otherwise */ - public boolean isSetPackageInfo() { - return this.packageInfo != null; - } - - public void setPackageInfoIsSet(boolean value) { - if (!value) { - this.packageInfo = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getSessionId() { - return this.sessionId; - } - - public loadApplication_args setSessionId(@org.apache.thrift.annotation.Nullable java.lang.String sessionId) { - this.sessionId = sessionId; - return this; - } - - public void unsetSessionId() { - this.sessionId = null; - } - - /** Returns true if field sessionId is set (has been assigned a value) and false otherwise */ - public boolean isSetSessionId() { - return this.sessionId != null; - } - - public void setSessionIdIsSet(boolean value) { - if (!value) { - this.sessionId = null; - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getParagraphId() { - return this.paragraphId; - } - - public loadApplication_args setParagraphId(@org.apache.thrift.annotation.Nullable java.lang.String paragraphId) { - this.paragraphId = paragraphId; - return this; - } - - public void unsetParagraphId() { - this.paragraphId = null; - } - - /** Returns true if field paragraphId is set (has been assigned a value) and false otherwise */ - public boolean isSetParagraphId() { - return this.paragraphId != null; - } - - public void setParagraphIdIsSet(boolean value) { - if (!value) { - this.paragraphId = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case APPLICATION_INSTANCE_ID: - if (value == null) { - unsetApplicationInstanceId(); - } else { - setApplicationInstanceId((java.lang.String)value); - } - break; - - case PACKAGE_INFO: - if (value == null) { - unsetPackageInfo(); - } else { - setPackageInfo((java.lang.String)value); - } - break; - - case SESSION_ID: - if (value == null) { - unsetSessionId(); - } else { - setSessionId((java.lang.String)value); - } - break; - - case PARAGRAPH_ID: - if (value == null) { - unsetParagraphId(); - } else { - setParagraphId((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case APPLICATION_INSTANCE_ID: - return getApplicationInstanceId(); - - case PACKAGE_INFO: - return getPackageInfo(); - - case SESSION_ID: - return getSessionId(); - - case PARAGRAPH_ID: - return getParagraphId(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case APPLICATION_INSTANCE_ID: - return isSetApplicationInstanceId(); - case PACKAGE_INFO: - return isSetPackageInfo(); - case SESSION_ID: - return isSetSessionId(); - case PARAGRAPH_ID: - return isSetParagraphId(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof loadApplication_args) - return this.equals((loadApplication_args)that); - return false; - } - - public boolean equals(loadApplication_args that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_applicationInstanceId = true && this.isSetApplicationInstanceId(); - boolean that_present_applicationInstanceId = true && that.isSetApplicationInstanceId(); - if (this_present_applicationInstanceId || that_present_applicationInstanceId) { - if (!(this_present_applicationInstanceId && that_present_applicationInstanceId)) - return false; - if (!this.applicationInstanceId.equals(that.applicationInstanceId)) - return false; - } - - boolean this_present_packageInfo = true && this.isSetPackageInfo(); - boolean that_present_packageInfo = true && that.isSetPackageInfo(); - if (this_present_packageInfo || that_present_packageInfo) { - if (!(this_present_packageInfo && that_present_packageInfo)) - return false; - if (!this.packageInfo.equals(that.packageInfo)) - return false; - } - - boolean this_present_sessionId = true && this.isSetSessionId(); - boolean that_present_sessionId = true && that.isSetSessionId(); - if (this_present_sessionId || that_present_sessionId) { - if (!(this_present_sessionId && that_present_sessionId)) - return false; - if (!this.sessionId.equals(that.sessionId)) - return false; - } - - boolean this_present_paragraphId = true && this.isSetParagraphId(); - boolean that_present_paragraphId = true && that.isSetParagraphId(); - if (this_present_paragraphId || that_present_paragraphId) { - if (!(this_present_paragraphId && that_present_paragraphId)) - return false; - if (!this.paragraphId.equals(that.paragraphId)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetApplicationInstanceId()) ? 131071 : 524287); - if (isSetApplicationInstanceId()) - hashCode = hashCode * 8191 + applicationInstanceId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetPackageInfo()) ? 131071 : 524287); - if (isSetPackageInfo()) - hashCode = hashCode * 8191 + packageInfo.hashCode(); - - hashCode = hashCode * 8191 + ((isSetSessionId()) ? 131071 : 524287); - if (isSetSessionId()) - hashCode = hashCode * 8191 + sessionId.hashCode(); - - hashCode = hashCode * 8191 + ((isSetParagraphId()) ? 131071 : 524287); - if (isSetParagraphId()) - hashCode = hashCode * 8191 + paragraphId.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(loadApplication_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetApplicationInstanceId()).compareTo(other.isSetApplicationInstanceId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetApplicationInstanceId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationInstanceId, other.applicationInstanceId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetPackageInfo()).compareTo(other.isSetPackageInfo()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetPackageInfo()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packageInfo, other.packageInfo); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetSessionId()).compareTo(other.isSetSessionId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSessionId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionId, other.sessionId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetParagraphId()).compareTo(other.isSetParagraphId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParagraphId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, other.paragraphId); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("loadApplication_args("); - boolean first = true; - - sb.append("applicationInstanceId:"); - if (this.applicationInstanceId == null) { - sb.append("null"); - } else { - sb.append(this.applicationInstanceId); - } - first = false; - if (!first) sb.append(", "); - sb.append("packageInfo:"); - if (this.packageInfo == null) { - sb.append("null"); - } else { - sb.append(this.packageInfo); - } - first = false; - if (!first) sb.append(", "); - sb.append("sessionId:"); - if (this.sessionId == null) { - sb.append("null"); - } else { - sb.append(this.sessionId); - } - first = false; - if (!first) sb.append(", "); - sb.append("paragraphId:"); - if (this.paragraphId == null) { - sb.append("null"); - } else { - sb.append(this.paragraphId); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class loadApplication_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public loadApplication_argsStandardScheme getScheme() { - return new loadApplication_argsStandardScheme(); - } - } - - private static class loadApplication_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, loadApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // APPLICATION_INSTANCE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.applicationInstanceId = iprot.readString(); - struct.setApplicationInstanceIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PACKAGE_INFO - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.packageInfo = iprot.readString(); - struct.setPackageInfoIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // SESSION_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.sessionId = iprot.readString(); - struct.setSessionIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // PARAGRAPH_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, loadApplication_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.applicationInstanceId != null) { - oprot.writeFieldBegin(APPLICATION_INSTANCE_ID_FIELD_DESC); - oprot.writeString(struct.applicationInstanceId); - oprot.writeFieldEnd(); - } - if (struct.packageInfo != null) { - oprot.writeFieldBegin(PACKAGE_INFO_FIELD_DESC); - oprot.writeString(struct.packageInfo); - oprot.writeFieldEnd(); - } - if (struct.sessionId != null) { - oprot.writeFieldBegin(SESSION_ID_FIELD_DESC); - oprot.writeString(struct.sessionId); - oprot.writeFieldEnd(); - } - if (struct.paragraphId != null) { - oprot.writeFieldBegin(PARAGRAPH_ID_FIELD_DESC); - oprot.writeString(struct.paragraphId); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class loadApplication_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public loadApplication_argsTupleScheme getScheme() { - return new loadApplication_argsTupleScheme(); - } - } - - private static class loadApplication_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, loadApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetApplicationInstanceId()) { - optionals.set(0); - } - if (struct.isSetPackageInfo()) { - optionals.set(1); - } - if (struct.isSetSessionId()) { - optionals.set(2); - } - if (struct.isSetParagraphId()) { - optionals.set(3); - } - oprot.writeBitSet(optionals, 4); - if (struct.isSetApplicationInstanceId()) { - oprot.writeString(struct.applicationInstanceId); - } - if (struct.isSetPackageInfo()) { - oprot.writeString(struct.packageInfo); - } - if (struct.isSetSessionId()) { - oprot.writeString(struct.sessionId); - } - if (struct.isSetParagraphId()) { - oprot.writeString(struct.paragraphId); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, loadApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(4); - if (incoming.get(0)) { - struct.applicationInstanceId = iprot.readString(); - struct.setApplicationInstanceIdIsSet(true); - } - if (incoming.get(1)) { - struct.packageInfo = iprot.readString(); - struct.setPackageInfoIsSet(true); - } - if (incoming.get(2)) { - struct.sessionId = iprot.readString(); - struct.setSessionIdIsSet(true); - } - if (incoming.get(3)) { - struct.paragraphId = iprot.readString(); - struct.setParagraphIdIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class loadApplication_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("loadApplication_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); - private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField("ex", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new loadApplication_resultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new loadApplication_resultTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable RemoteApplicationResult success; // required - public @org.apache.thrift.annotation.Nullable InterpreterRPCException ex; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - EX((short)1, "ex"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // EX - return EX; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteApplicationResult.class))); - tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InterpreterRPCException.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(loadApplication_result.class, metaDataMap); - } - - public loadApplication_result() { - } - - public loadApplication_result( - RemoteApplicationResult success, - InterpreterRPCException ex) - { - this(); - this.success = success; - this.ex = ex; - } - - /** - * Performs a deep copy on other. - */ - public loadApplication_result(loadApplication_result other) { - if (other.isSetSuccess()) { - this.success = new RemoteApplicationResult(other.success); - } - if (other.isSetEx()) { - this.ex = new InterpreterRPCException(other.ex); - } - } - - public loadApplication_result deepCopy() { - return new loadApplication_result(this); - } - - @Override - public void clear() { - this.success = null; - this.ex = null; - } - - @org.apache.thrift.annotation.Nullable - public RemoteApplicationResult getSuccess() { - return this.success; - } - - public loadApplication_result setSuccess(@org.apache.thrift.annotation.Nullable RemoteApplicationResult success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - @org.apache.thrift.annotation.Nullable - public InterpreterRPCException getEx() { - return this.ex; - } - - public loadApplication_result setEx(@org.apache.thrift.annotation.Nullable InterpreterRPCException ex) { - this.ex = ex; - return this; - } - - public void unsetEx() { - this.ex = null; - } - - /** Returns true if field ex is set (has been assigned a value) and false otherwise */ - public boolean isSetEx() { - return this.ex != null; - } - - public void setExIsSet(boolean value) { - if (!value) { - this.ex = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((RemoteApplicationResult)value); - } - break; - - case EX: - if (value == null) { - unsetEx(); - } else { - setEx((InterpreterRPCException)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case EX: - return getEx(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case EX: - return isSetEx(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof loadApplication_result) - return this.equals((loadApplication_result)that); - return false; - } - - public boolean equals(loadApplication_result that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_ex = true && this.isSetEx(); - boolean that_present_ex = true && that.isSetEx(); - if (this_present_ex || that_present_ex) { - if (!(this_present_ex && that_present_ex)) - return false; - if (!this.ex.equals(that.ex)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); - if (isSetSuccess()) - hashCode = hashCode * 8191 + success.hashCode(); - - hashCode = hashCode * 8191 + ((isSetEx()) ? 131071 : 524287); - if (isSetEx()) - hashCode = hashCode * 8191 + ex.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(loadApplication_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEx()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("loadApplication_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("ex:"); - if (this.ex == null) { - sb.append("null"); - } else { - sb.append(this.ex); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class loadApplication_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public loadApplication_resultStandardScheme getScheme() { - return new loadApplication_resultStandardScheme(); - } - } - - private static class loadApplication_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, loadApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new RemoteApplicationResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // EX - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.ex = new InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, loadApplication_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - if (struct.ex != null) { - oprot.writeFieldBegin(EX_FIELD_DESC); - struct.ex.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class loadApplication_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public loadApplication_resultTupleScheme getScheme() { - return new loadApplication_resultTupleScheme(); - } - } - - private static class loadApplication_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, loadApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetEx()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - if (struct.isSetEx()) { - struct.ex.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, loadApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = new RemoteApplicationResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.ex = new InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class unloadApplication_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("unloadApplication_args"); - - private static final org.apache.thrift.protocol.TField APPLICATION_INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationInstanceId", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new unloadApplication_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new unloadApplication_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String applicationInstanceId; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - APPLICATION_INSTANCE_ID((short)1, "applicationInstanceId"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // APPLICATION_INSTANCE_ID - return APPLICATION_INSTANCE_ID; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.APPLICATION_INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("applicationInstanceId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(unloadApplication_args.class, metaDataMap); - } - - public unloadApplication_args() { - } - - public unloadApplication_args( - java.lang.String applicationInstanceId) - { - this(); - this.applicationInstanceId = applicationInstanceId; - } - - /** - * Performs a deep copy on other. - */ - public unloadApplication_args(unloadApplication_args other) { - if (other.isSetApplicationInstanceId()) { - this.applicationInstanceId = other.applicationInstanceId; - } - } - - public unloadApplication_args deepCopy() { - return new unloadApplication_args(this); - } - - @Override - public void clear() { - this.applicationInstanceId = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getApplicationInstanceId() { - return this.applicationInstanceId; - } - - public unloadApplication_args setApplicationInstanceId(@org.apache.thrift.annotation.Nullable java.lang.String applicationInstanceId) { - this.applicationInstanceId = applicationInstanceId; - return this; - } - - public void unsetApplicationInstanceId() { - this.applicationInstanceId = null; - } - - /** Returns true if field applicationInstanceId is set (has been assigned a value) and false otherwise */ - public boolean isSetApplicationInstanceId() { - return this.applicationInstanceId != null; - } - - public void setApplicationInstanceIdIsSet(boolean value) { - if (!value) { - this.applicationInstanceId = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case APPLICATION_INSTANCE_ID: - if (value == null) { - unsetApplicationInstanceId(); - } else { - setApplicationInstanceId((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case APPLICATION_INSTANCE_ID: - return getApplicationInstanceId(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case APPLICATION_INSTANCE_ID: - return isSetApplicationInstanceId(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof unloadApplication_args) - return this.equals((unloadApplication_args)that); - return false; - } - - public boolean equals(unloadApplication_args that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_applicationInstanceId = true && this.isSetApplicationInstanceId(); - boolean that_present_applicationInstanceId = true && that.isSetApplicationInstanceId(); - if (this_present_applicationInstanceId || that_present_applicationInstanceId) { - if (!(this_present_applicationInstanceId && that_present_applicationInstanceId)) - return false; - if (!this.applicationInstanceId.equals(that.applicationInstanceId)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetApplicationInstanceId()) ? 131071 : 524287); - if (isSetApplicationInstanceId()) - hashCode = hashCode * 8191 + applicationInstanceId.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(unloadApplication_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetApplicationInstanceId()).compareTo(other.isSetApplicationInstanceId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetApplicationInstanceId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationInstanceId, other.applicationInstanceId); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("unloadApplication_args("); - boolean first = true; - - sb.append("applicationInstanceId:"); - if (this.applicationInstanceId == null) { - sb.append("null"); - } else { - sb.append(this.applicationInstanceId); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class unloadApplication_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public unloadApplication_argsStandardScheme getScheme() { - return new unloadApplication_argsStandardScheme(); - } - } - - private static class unloadApplication_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, unloadApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // APPLICATION_INSTANCE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.applicationInstanceId = iprot.readString(); - struct.setApplicationInstanceIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, unloadApplication_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.applicationInstanceId != null) { - oprot.writeFieldBegin(APPLICATION_INSTANCE_ID_FIELD_DESC); - oprot.writeString(struct.applicationInstanceId); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class unloadApplication_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public unloadApplication_argsTupleScheme getScheme() { - return new unloadApplication_argsTupleScheme(); - } - } - - private static class unloadApplication_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, unloadApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetApplicationInstanceId()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetApplicationInstanceId()) { - oprot.writeString(struct.applicationInstanceId); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, unloadApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.applicationInstanceId = iprot.readString(); - struct.setApplicationInstanceIdIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class unloadApplication_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("unloadApplication_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); - private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField("ex", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new unloadApplication_resultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new unloadApplication_resultTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable RemoteApplicationResult success; // required - public @org.apache.thrift.annotation.Nullable InterpreterRPCException ex; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - EX((short)1, "ex"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // EX - return EX; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteApplicationResult.class))); - tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InterpreterRPCException.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(unloadApplication_result.class, metaDataMap); - } - - public unloadApplication_result() { - } - - public unloadApplication_result( - RemoteApplicationResult success, - InterpreterRPCException ex) - { - this(); - this.success = success; - this.ex = ex; - } - - /** - * Performs a deep copy on other. - */ - public unloadApplication_result(unloadApplication_result other) { - if (other.isSetSuccess()) { - this.success = new RemoteApplicationResult(other.success); - } - if (other.isSetEx()) { - this.ex = new InterpreterRPCException(other.ex); - } - } - - public unloadApplication_result deepCopy() { - return new unloadApplication_result(this); - } - - @Override - public void clear() { - this.success = null; - this.ex = null; - } - - @org.apache.thrift.annotation.Nullable - public RemoteApplicationResult getSuccess() { - return this.success; - } - - public unloadApplication_result setSuccess(@org.apache.thrift.annotation.Nullable RemoteApplicationResult success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - @org.apache.thrift.annotation.Nullable - public InterpreterRPCException getEx() { - return this.ex; - } - - public unloadApplication_result setEx(@org.apache.thrift.annotation.Nullable InterpreterRPCException ex) { - this.ex = ex; - return this; - } - - public void unsetEx() { - this.ex = null; - } - - /** Returns true if field ex is set (has been assigned a value) and false otherwise */ - public boolean isSetEx() { - return this.ex != null; - } - - public void setExIsSet(boolean value) { - if (!value) { - this.ex = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((RemoteApplicationResult)value); - } - break; - - case EX: - if (value == null) { - unsetEx(); - } else { - setEx((InterpreterRPCException)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case EX: - return getEx(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case EX: - return isSetEx(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof unloadApplication_result) - return this.equals((unloadApplication_result)that); - return false; - } - - public boolean equals(unloadApplication_result that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_ex = true && this.isSetEx(); - boolean that_present_ex = true && that.isSetEx(); - if (this_present_ex || that_present_ex) { - if (!(this_present_ex && that_present_ex)) - return false; - if (!this.ex.equals(that.ex)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); - if (isSetSuccess()) - hashCode = hashCode * 8191 + success.hashCode(); - - hashCode = hashCode * 8191 + ((isSetEx()) ? 131071 : 524287); - if (isSetEx()) - hashCode = hashCode * 8191 + ex.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(unloadApplication_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEx()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("unloadApplication_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("ex:"); - if (this.ex == null) { - sb.append("null"); - } else { - sb.append(this.ex); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class unloadApplication_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public unloadApplication_resultStandardScheme getScheme() { - return new unloadApplication_resultStandardScheme(); - } - } - - private static class unloadApplication_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, unloadApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new RemoteApplicationResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // EX - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.ex = new InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, unloadApplication_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - if (struct.ex != null) { - oprot.writeFieldBegin(EX_FIELD_DESC); - struct.ex.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class unloadApplication_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public unloadApplication_resultTupleScheme getScheme() { - return new unloadApplication_resultTupleScheme(); - } - } - - private static class unloadApplication_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, unloadApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetEx()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - if (struct.isSetEx()) { - struct.ex.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, unloadApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = new RemoteApplicationResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.ex = new InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class runApplication_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("runApplication_args"); - - private static final org.apache.thrift.protocol.TField APPLICATION_INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationInstanceId", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new runApplication_argsStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new runApplication_argsTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable java.lang.String applicationInstanceId; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - APPLICATION_INSTANCE_ID((short)1, "applicationInstanceId"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // APPLICATION_INSTANCE_ID - return APPLICATION_INSTANCE_ID; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.APPLICATION_INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("applicationInstanceId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(runApplication_args.class, metaDataMap); - } - - public runApplication_args() { - } - - public runApplication_args( - java.lang.String applicationInstanceId) - { - this(); - this.applicationInstanceId = applicationInstanceId; - } - - /** - * Performs a deep copy on other. - */ - public runApplication_args(runApplication_args other) { - if (other.isSetApplicationInstanceId()) { - this.applicationInstanceId = other.applicationInstanceId; - } - } - - public runApplication_args deepCopy() { - return new runApplication_args(this); - } - - @Override - public void clear() { - this.applicationInstanceId = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getApplicationInstanceId() { - return this.applicationInstanceId; - } - - public runApplication_args setApplicationInstanceId(@org.apache.thrift.annotation.Nullable java.lang.String applicationInstanceId) { - this.applicationInstanceId = applicationInstanceId; - return this; - } - - public void unsetApplicationInstanceId() { - this.applicationInstanceId = null; - } - - /** Returns true if field applicationInstanceId is set (has been assigned a value) and false otherwise */ - public boolean isSetApplicationInstanceId() { - return this.applicationInstanceId != null; - } - - public void setApplicationInstanceIdIsSet(boolean value) { - if (!value) { - this.applicationInstanceId = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case APPLICATION_INSTANCE_ID: - if (value == null) { - unsetApplicationInstanceId(); - } else { - setApplicationInstanceId((java.lang.String)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case APPLICATION_INSTANCE_ID: - return getApplicationInstanceId(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case APPLICATION_INSTANCE_ID: - return isSetApplicationInstanceId(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof runApplication_args) - return this.equals((runApplication_args)that); - return false; - } - - public boolean equals(runApplication_args that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_applicationInstanceId = true && this.isSetApplicationInstanceId(); - boolean that_present_applicationInstanceId = true && that.isSetApplicationInstanceId(); - if (this_present_applicationInstanceId || that_present_applicationInstanceId) { - if (!(this_present_applicationInstanceId && that_present_applicationInstanceId)) - return false; - if (!this.applicationInstanceId.equals(that.applicationInstanceId)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetApplicationInstanceId()) ? 131071 : 524287); - if (isSetApplicationInstanceId()) - hashCode = hashCode * 8191 + applicationInstanceId.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(runApplication_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetApplicationInstanceId()).compareTo(other.isSetApplicationInstanceId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetApplicationInstanceId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationInstanceId, other.applicationInstanceId); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("runApplication_args("); - boolean first = true; - - sb.append("applicationInstanceId:"); - if (this.applicationInstanceId == null) { - sb.append("null"); - } else { - sb.append(this.applicationInstanceId); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class runApplication_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public runApplication_argsStandardScheme getScheme() { - return new runApplication_argsStandardScheme(); - } - } - - private static class runApplication_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, runApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // APPLICATION_INSTANCE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.applicationInstanceId = iprot.readString(); - struct.setApplicationInstanceIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, runApplication_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.applicationInstanceId != null) { - oprot.writeFieldBegin(APPLICATION_INSTANCE_ID_FIELD_DESC); - oprot.writeString(struct.applicationInstanceId); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class runApplication_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public runApplication_argsTupleScheme getScheme() { - return new runApplication_argsTupleScheme(); - } - } - - private static class runApplication_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, runApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetApplicationInstanceId()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetApplicationInstanceId()) { - oprot.writeString(struct.applicationInstanceId); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, runApplication_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.applicationInstanceId = iprot.readString(); - struct.setApplicationInstanceIdIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - - public static class runApplication_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("runApplication_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); - private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField("ex", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new runApplication_resultStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new runApplication_resultTupleSchemeFactory(); - - public @org.apache.thrift.annotation.Nullable RemoteApplicationResult success; // required - public @org.apache.thrift.annotation.Nullable InterpreterRPCException ex; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - EX((short)1, "ex"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // EX - return EX; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteApplicationResult.class))); - tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InterpreterRPCException.class))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(runApplication_result.class, metaDataMap); - } - - public runApplication_result() { - } - - public runApplication_result( - RemoteApplicationResult success, - InterpreterRPCException ex) - { - this(); - this.success = success; - this.ex = ex; - } - - /** - * Performs a deep copy on other. - */ - public runApplication_result(runApplication_result other) { - if (other.isSetSuccess()) { - this.success = new RemoteApplicationResult(other.success); - } - if (other.isSetEx()) { - this.ex = new InterpreterRPCException(other.ex); - } - } - - public runApplication_result deepCopy() { - return new runApplication_result(this); - } - - @Override - public void clear() { - this.success = null; - this.ex = null; - } - - @org.apache.thrift.annotation.Nullable - public RemoteApplicationResult getSuccess() { - return this.success; - } - - public runApplication_result setSuccess(@org.apache.thrift.annotation.Nullable RemoteApplicationResult success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - @org.apache.thrift.annotation.Nullable - public InterpreterRPCException getEx() { - return this.ex; - } - - public runApplication_result setEx(@org.apache.thrift.annotation.Nullable InterpreterRPCException ex) { - this.ex = ex; - return this; - } - - public void unsetEx() { - this.ex = null; - } - - /** Returns true if field ex is set (has been assigned a value) and false otherwise */ - public boolean isSetEx() { - return this.ex != null; - } - - public void setExIsSet(boolean value) { - if (!value) { - this.ex = null; - } - } - - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((RemoteApplicationResult)value); - } - break; - - case EX: - if (value == null) { - unsetEx(); - } else { - setEx((InterpreterRPCException)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case EX: - return getEx(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case EX: - return isSetEx(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that == null) - return false; - if (that instanceof runApplication_result) - return this.equals((runApplication_result)that); - return false; - } - - public boolean equals(runApplication_result that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_ex = true && this.isSetEx(); - boolean that_present_ex = true && that.isSetEx(); - if (this_present_ex || that_present_ex) { - if (!(this_present_ex && that_present_ex)) - return false; - if (!this.ex.equals(that.ex)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); - if (isSetSuccess()) - hashCode = hashCode * 8191 + success.hashCode(); - - hashCode = hashCode * 8191 + ((isSetEx()) ? 131071 : 524287); - if (isSetEx()) - hashCode = hashCode * 8191 + ex.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(runApplication_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEx()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("runApplication_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("ex:"); - if (this.ex == null) { - sb.append("null"); - } else { - sb.append(this.ex); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class runApplication_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public runApplication_resultStandardScheme getScheme() { - return new runApplication_resultStandardScheme(); - } - } - - private static class runApplication_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, runApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new RemoteApplicationResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // EX - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.ex = new InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, runApplication_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - if (struct.ex != null) { - oprot.writeFieldBegin(EX_FIELD_DESC); - struct.ex.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class runApplication_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - public runApplication_resultTupleScheme getScheme() { - return new runApplication_resultTupleScheme(); - } - } - - private static class runApplication_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, runApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetEx()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - if (struct.isSetEx()) { - struct.ex.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, runApplication_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = new RemoteApplicationResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.ex = new InterpreterRPCException(); - struct.ex.read(iprot); - struct.setExIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - } - } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java index d8b4a739b87..1ba2cf84737 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java @@ -139,7 +139,7 @@ public Status getStatus() { } /** - * just set status without notifying to listeners for spell. + * Set status without notifying listeners. */ public void setStatusWithoutNotification(Status status) { this.status = status; diff --git a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterEventService.thrift b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterEventService.thrift index c7c6e039f0c..bb2be3ebbb4 100644 --- a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterEventService.thrift +++ b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterEventService.thrift @@ -36,7 +36,6 @@ struct OutputAppendEvent { 2: string paragraphId, 3: i32 index, 4: string data, - 5: string appId, 6: string executionOwner } @@ -46,7 +45,6 @@ struct OutputUpdateEvent { 3: i32 index, 4: string type, 5: string data, - 6: string appId, 7: string executionOwner } @@ -70,30 +68,6 @@ struct AngularObjectId { 3: string name } -struct AppOutputAppendEvent { - 1: string noteId, - 2: string paragraphId, - 3: string appId, - 4: i32 index, - 5: string data -} - -struct AppOutputUpdateEvent { - 1: string noteId, - 2: string paragraphId, - 3: string appId, - 4: i32 index, - 5: string type, - 6: string data -} - -struct AppStatusUpdateEvent { - 1: string noteId, - 2: string paragraphId, - 3: string appId, - 4: string status -} - struct ParagraphInfo { 1: string noteId, 2: string paragraphId, @@ -119,10 +93,6 @@ service RemoteInterpreterEventService { void updateOutput(1: OutputUpdateEvent event) throws (1: RemoteInterpreterService.InterpreterRPCException ex); void updateAllOutput(1: OutputUpdateAllEvent event) throws (1: RemoteInterpreterService.InterpreterRPCException ex); - void appendAppOutput(1: AppOutputAppendEvent event) throws (1: RemoteInterpreterService.InterpreterRPCException ex); - void updateAppOutput(1: AppOutputUpdateEvent event) throws (1: RemoteInterpreterService.InterpreterRPCException ex); - void updateAppStatus(1: AppStatusUpdateEvent event) throws (1: RemoteInterpreterService.InterpreterRPCException ex); - void checkpointOutput(1: string noteId, 2: string paragraphId) throws (1: RemoteInterpreterService.InterpreterRPCException ex); void runParagraphs(1: RunParagraphsEvent event) throws (1: RemoteInterpreterService.InterpreterRPCException ex); diff --git a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift index 1532627d359..da0823e2d48 100644 --- a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift +++ b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift @@ -56,24 +56,17 @@ enum RemoteInterpreterEventType { OUTPUT_UPDATE = 9, OUTPUT_UPDATE_ALL = 10, ANGULAR_REGISTRY_PUSH = 11, - APP_STATUS_UPDATE = 12, META_INFOS = 13, REMOTE_ZEPPELIN_SERVER_RESOURCE = 14, RESOURCE_INVOKE_METHOD = 15, PARA_INFOS = 16 } - struct RemoteInterpreterEvent { 1: RemoteInterpreterEventType type, 2: string data // json serialized data } -struct RemoteApplicationResult { - 1: bool success, - 2: string msg -} - /* * The below variables(name, value) will be connected to getCompletions in paragraph.controller.js * @@ -119,10 +112,5 @@ service RemoteInterpreterService { void angularObjectRemove(1: string name, 2: string sessionId, 3: string paragraphId) throws (1: InterpreterRPCException ex); void angularRegistryPush(1: string registry) throws (1: InterpreterRPCException ex); - RemoteApplicationResult loadApplication(1: string applicationInstanceId, 2: string packageInfo, 3: string sessionId, 4: string paragraphId) throws (1: InterpreterRPCException ex); - RemoteApplicationResult unloadApplication(1: string applicationInstanceId) throws (1: InterpreterRPCException ex); - RemoteApplicationResult runApplication(1: string applicationInstanceId) throws (1: InterpreterRPCException ex); - } - diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/ApplicationLoaderTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/ApplicationLoaderTest.java deleted file mode 100644 index 39b392eb4aa..00000000000 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/ApplicationLoaderTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -import org.apache.commons.io.FileUtils; -import org.apache.zeppelin.dep.DependencyResolver; -import org.apache.zeppelin.interpreter.InterpreterOutput; -import org.apache.zeppelin.resource.LocalResourcePool; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; -import java.io.IOException; - -class ApplicationLoaderTest { - private File tmpDir; - - @BeforeEach - void setUp() { - tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + - System.currentTimeMillis()); - tmpDir.mkdirs(); - } - - @AfterEach - void tearDown() throws IOException { - FileUtils.deleteDirectory(tmpDir); - } - - @Test - void loadUnloadApplication() throws Exception { - // given - LocalResourcePool resourcePool = new LocalResourcePool("pool1"); - DependencyResolver dep = - new DependencyResolver(tmpDir.getAbsolutePath(), null, null, null, null); - ApplicationLoader appLoader = new ApplicationLoader(resourcePool, dep); - - HeliumPackage pkg1 = createPackageInfo(MockApplication1.class.getName(), "artifact1"); - ApplicationContext context1 = createContext("note1", "paragraph1", "app1"); - - // when load application - MockApplication1 app = (MockApplication1) ((ClassLoaderApplication) - appLoader.load(pkg1, context1)).getInnerApplication(); - - // then - assertFalse(app.isUnloaded()); - assertEquals(0, app.getNumRun()); - - // when unload - app.unload(); - - // then - assertTrue(app.isUnloaded()); - assertEquals(0, app.getNumRun()); - } - - public HeliumPackage createPackageInfo(String className, String artifact) { - HeliumPackage app1 = newHeliumPackage( - HeliumType.APPLICATION, - "name1", - "desc1", - artifact, - className, - new String[][]{{}}, - "license", - "icon"); - return app1; - } - - public ApplicationContext createContext(String noteId, String paragraphId, String appInstanceId) { - ApplicationContext context1 = new ApplicationContext( - noteId, - paragraphId, - appInstanceId, - null, - new InterpreterOutput()); - return context1; - } -} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/HeliumPackageTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/HeliumPackageTest.java deleted file mode 100644 index 737e0186566..00000000000 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/HeliumPackageTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -import static org.apache.commons.text.StringEscapeUtils.escapeHtml4; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -class HeliumPackageTest { - - @Test - void parseSpellPackageInfo() { - String examplePackage = "{\n" + - " \"type\" : \"SPELL\",\n" + - " \"name\" : \"echo-spell\",\n" + - " \"description\" : \"'%echo' - return just what receive (example)i\",\n" + - " \"artifact\" : \"./zeppelin-examples/zeppelin-example-spell-echo\",\n" + - " \"license\" : \"Apache-2.0\",\n" + - " \"icon\" : \"\",\n" + - " \"spell\": {\n" + - " \"magic\": \"%echo\",\n" + - " \"usage\": \"%echo \"\n" + - " }\n" + - "}"; - - HeliumPackage p = HeliumPackage.fromJson(examplePackage); - assertEquals("%echo", p.getSpellInfo().getMagic()); - assertEquals(escapeHtml4("%echo "), p.getSpellInfo().getUsage()); - assertNotEquals("'%echo' - return just what receive (example)i", p.getDescription()); - } - - @Test - void parseConfig() { - String examplePackage = "{\n" + - " \"type\" : \"SPELL\",\n" + - " \"name\" : \"translator-spell\",\n" + - " \"description\" : \"Translate langauges using Google API (examaple)\",\n" + - " \"artifact\" : \"./zeppelin-examples/zeppelin-example-spell-translator\",\n" + - " \"license\" : \"Apache-2.0\",\n" + - " \"icon\" : \"\",\n" + - " \"config\": {\n" + - " \"access-token\": {\n" + - " \"type\": \"string\",\n" + - " \"description\": \"access token for Google Translation API\",\n" + - " \"defaultValue\": \"EXAMPLE-TOKEN\"\n" + - " }\n" + - " },\n" + - " \"spell\": {\n" + - " \"magic\": \"%translator\",\n" + - " \"usage\": \"%translator - \"\n" + - " }\n" + - "}"; - - HeliumPackage p = HeliumPackage.fromJson(examplePackage); - Map config = p.getConfig(); - Map accessToken = (Map) config.get("access-token"); - - assertEquals("string", accessToken.get("type")); - assertEquals("access token for Google Translation API", accessToken.get("description")); - assertEquals("EXAMPLE-TOKEN", accessToken.get("defaultValue")); - } -} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/MockApplication1.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/MockApplication1.java deleted file mode 100644 index c962d8447a6..00000000000 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/helium/MockApplication1.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.resource.ResourceSet; - -/** - * Mock application - */ -public class MockApplication1 extends Application { - boolean unloaded; - int run; - - public MockApplication1(ApplicationContext context) { - super(context); - unloaded = false; - run = 0; - } - - @Override - public void run(ResourceSet args) { - run++; - } - - @Override - public void unload() { - unloaded = true; - } - - public boolean isUnloaded() { - return unloaded; - } - - public int getNumRun() { - return run; - } -} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServerTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServerTest.java index 58ef866a744..ed80b6e5322 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServerTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServerTest.java @@ -62,7 +62,7 @@ void testStartStopWithQueuedEvents() throws Exception { server.intpEventClient = mock(RemoteInterpreterEventClient.class); startRemoteInterpreterServer(server, 10 * 1000); - server.intpEventClient.onAppStatusUpdate("", "", "", ""); + server.intpEventClient.onInterpreterOutputAppend("note", "paragraph", 0, "owner", "output"); stopRemoteInterpreterServer(server, 10 * 10000); } diff --git a/zeppelin-server/pom.xml b/zeppelin-server/pom.xml index 12699c9ce38..4136bcffc8e 100644 --- a/zeppelin-server/pom.xml +++ b/zeppelin-server/pom.xml @@ -204,22 +204,6 @@ - - com.github.eirslett - frontend-plugin-core - ${eirslett.version} - - - org.codehaus.plexus - plexus-utils - - - org.apache.commons - commons-compress - - - - org.apache.commons commons-vfs2 diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-server/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index 781e7d9f573..f32d126791f 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -581,26 +581,6 @@ public String getInterpreterSettingPath(boolean absolute) { return getConfigFSDir(absolute) + "/interpreter.json"; } - public String getHeliumConfPath() { - return getAbsoluteDir(String.format("%s/helium.json", getConfDir())); - } - - public String getHeliumRegistry() { - return getAbsoluteDir(ConfVars.ZEPPELIN_HELIUM_REGISTRY); - } - - public String getHeliumNodeInstallerUrl() { - return getString(ConfVars.ZEPPELIN_HELIUM_NODE_INSTALLER_URL); - } - - public String getHeliumNpmInstallerUrl() { - return getString(ConfVars.ZEPPELIN_HELIUM_NPM_INSTALLER_URL); - } - - public String getHeliumYarnInstallerUrl() { - return getString(ConfVars.ZEPPELIN_HELIUM_YARNPKG_INSTALLER_URL); - } - public String getNotebookAuthorizationPath(boolean absolute) { return getConfigFSDir(absolute) + "/notebook-authorization.json"; } @@ -1108,13 +1088,6 @@ public enum ConfVars { ZEPPELIN_CONFIG_STORAGE_CLASS("zeppelin.config.storage.class", "org.apache.zeppelin.storage.LocalConfigStorage"), ZEPPELIN_DEP_LOCALREPO("zeppelin.dep.localrepo", "local-repo"), - ZEPPELIN_HELIUM_REGISTRY("zeppelin.helium.registry", "helium"), - ZEPPELIN_HELIUM_NODE_INSTALLER_URL("zeppelin.helium.node.installer.url", - "https://nodejs.org/dist/"), - ZEPPELIN_HELIUM_NPM_INSTALLER_URL("zeppelin.helium.npm.installer.url", - "https://registry.npmjs.org/"), - ZEPPELIN_HELIUM_YARNPKG_INSTALLER_URL("zeppelin.helium.yarnpkg.installer.url", - "https://github.com/yarnpkg/yarn/releases/download/"), // Allows a way to specify a ',' separated list of allowed origins for rest and websockets // i.e. http://localhost:8080 // Default is empty (no cross-origin requests permitted). Operators that need cross-origin diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/Helium.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/Helium.java deleted file mode 100644 index f5edf270494..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/Helium.java +++ /dev/null @@ -1,560 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.common.annotations.VisibleForTesting; -import com.google.gson.Gson; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import jakarta.inject.Inject; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; -import org.apache.zeppelin.interpreter.Interpreter; -import org.apache.zeppelin.interpreter.InterpreterNotFoundException; -import org.apache.zeppelin.interpreter.InterpreterSettingManager; -import org.apache.zeppelin.interpreter.ManagedInterpreterGroup; -import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess; -import org.apache.zeppelin.notebook.Paragraph; -import org.apache.zeppelin.resource.DistributedResourcePool; -import org.apache.zeppelin.resource.Resource; -import org.apache.zeppelin.resource.ResourcePool; -import org.apache.zeppelin.resource.ResourceSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Manages helium packages - */ -public class Helium { - private static final Logger LOGGER = LoggerFactory.getLogger(Helium.class); - private List registry = new LinkedList<>(); - - private HeliumConf heliumConf; - private Map> allPackages = new HashMap<>(); - - private final String heliumConfPath; - private final String registryPaths; - private final File registryCacheDir; - - private final HeliumBundleFactory bundleFactory; - private final HeliumApplicationFactory applicationFactory; - private final InterpreterSettingManager interpreterSettingManager; - - private final ZeppelinConfiguration zConf; - - @Inject - public Helium( - ZeppelinConfiguration zConf, - HeliumBundleFactory heliumBundleFactory, - HeliumApplicationFactory heliumApplicationFactory, - InterpreterSettingManager interpreterSettingManager) throws IOException { - this( - zConf.getHeliumConfPath(), - zConf.getHeliumRegistry(), - new File(zConf.getAbsoluteDir(ConfVars.ZEPPELIN_DEP_LOCALREPO), "helium-registry-cache"), - heliumBundleFactory, - heliumApplicationFactory, - interpreterSettingManager, - zConf); - } - - @VisibleForTesting - public Helium( - String heliumConfPath, - String registryPaths, - File registryCacheDir, - HeliumBundleFactory bundleFactory, - HeliumApplicationFactory applicationFactory, - InterpreterSettingManager interpreterSettingManager, - ZeppelinConfiguration zConf) - throws IOException { - this.heliumConfPath = heliumConfPath; - this.registryPaths = registryPaths; - this.registryCacheDir = registryCacheDir; - this.bundleFactory = bundleFactory; - this.applicationFactory = applicationFactory; - this.interpreterSettingManager = interpreterSettingManager; - this.zConf = zConf; - heliumConf = loadConf(heliumConfPath); - allPackages = getAllPackageInfo(); - - // TODO(jl): Refactor it - try { - bundleFactory.buildAllPackages(getBundlePackagesToBundle()); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - } - } - - /** - * Add HeliumRegistry - * - * @param registry - */ - public void addRegistry(HeliumRegistry registry) { - synchronized (this.registry) { - this.registry.add(registry); - } - } - - public void clear() { - this.registry.clear(); - this.heliumConf = new HeliumConf(); - this.allPackages = new HashMap<>(); - } - - public HeliumApplicationFactory getApplicationFactory() { - return applicationFactory; - } - - private synchronized HeliumConf loadConf(String path) throws IOException { - // add registry - if (registryPaths != null && !registryPaths.isEmpty()) { - String[] paths = registryPaths.split(","); - for (String uri : paths) { - if (uri.startsWith("http://") || uri.startsWith("https://")) { - LOGGER.info("Add helium online registry {}", uri); - registry.add(new HeliumOnlineRegistry(uri, uri, registryCacheDir, zConf)); - } else { - LOGGER.info("Add helium local registry {}", uri); - registry.add(new HeliumLocalRegistry(uri, uri)); - } - } - } - - File heliumConfFile = new File(path); - if (!heliumConfFile.isFile()) { - LOGGER.warn("{} does not exists", path); - return new HeliumConf(); - } else { - String jsonString = FileUtils.readFileToString(heliumConfFile); - return HeliumConf.fromJson(jsonString); - } - } - - public synchronized void saveConfig() throws IOException { - String jsonString; - synchronized (registry) { - clearNotExistsPackages(); - jsonString = heliumConf.toJson(); - } - - File heliumConfFile = new File(heliumConfPath); - if (!heliumConfFile.exists()) { - heliumConfFile.createNewFile(); - } - - FileUtils.writeStringToFile(heliumConfFile, jsonString); - } - - private void clearNotExistsPackages() { - // clear visualization display order - List packageOrder = heliumConf.getBundleDisplayOrder(); - List clearedOrder = new LinkedList<>(); - for (String pkgName : packageOrder) { - if (allPackages.containsKey(pkgName)) { - clearedOrder.add(pkgName); - } - } - heliumConf.setBundleDisplayOrder(clearedOrder); - - // clear enabled package - Map enabledPackages = heliumConf.getEnabledPackages(); - for (String pkgName : enabledPackages.keySet()) { - if (!allPackages.containsKey(pkgName)) { - heliumConf.disablePackage(pkgName); - } - } - } - - public Map> getAllPackageInfo() { - return getAllPackageInfo(true, null); - } - - /** - * @param refresh - * @param packageName - */ - public Map> getAllPackageInfo(boolean refresh, - String packageName) { - Map enabledPackageInfo = heliumConf.getEnabledPackages(); - - synchronized (registry) { - if (refresh || !allPackages.containsKey(packageName)) { - for (HeliumRegistry r : registry) { - try { - for (HeliumPackage pkg : r.getAll()) { - String name = pkg.getName(); - - if (!StringUtils.isEmpty(packageName) && - !name.equals(packageName)) { - continue; - } - - if (allPackages.containsKey(name)) { - allPackages.remove(name); - } - allPackages.put(name, new LinkedList()); - boolean enabled = enabledPackageInfo.containsKey(pkg.getName()); - allPackages.get(name).add(new HeliumPackageSearchResult(r.name(), pkg, enabled)); - } - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - } - } - } else { - for (String name : allPackages.keySet()) { - if (!StringUtils.isEmpty(packageName) && - !name.equals(packageName)) { - continue; - } - - List pkgs = allPackages.get(name); - LinkedList newResults = new LinkedList<>(); - - for (HeliumPackageSearchResult pkg : pkgs) { - boolean enabled = enabledPackageInfo.containsKey(pkg.getPkg().getName()); - newResults.add(new HeliumPackageSearchResult(pkg.getRegistry(), pkg.getPkg(), enabled)); - } - - allPackages.put(name, newResults); - } - } - - // sort version (artifact) - for (String name : allPackages.keySet()) { - List packages = allPackages.get(name); - Collections.sort(packages, new Comparator() { - @Override - public int compare(HeliumPackageSearchResult o1, HeliumPackageSearchResult o2) { - return o2.getPkg().getArtifact().compareTo(o1.getPkg().getArtifact()); - } - }); - } - return allPackages; - } - } - - public List getAllEnabledPackages() { - Map enabledInfo = heliumConf.getEnabledPackages(); - List enabledPackages = new ArrayList<>(); - - for (List versionedPackages : allPackages.values()) { - for (HeliumPackageSearchResult psr : versionedPackages) { - if (enabledInfo.containsKey(psr.getPkg().getName())) { - enabledPackages.add(psr); - break; - } - } - } - return enabledPackages; - } - - public List getSinglePackageInfo(String packageName) { - Map> result = getAllPackageInfo(true, packageName); - - if (!result.containsKey(packageName)) { - return new ArrayList<>(); - } - return result.get(packageName); - } - - private HeliumPackageSearchResult getEnabledPackageInfo(String packageName) { - List packages = allPackages.get(packageName); - - for (HeliumPackageSearchResult pkgSearchResult : packages) { - if (pkgSearchResult.isEnabled()) { - return pkgSearchResult; - } - } - - return null; - } - - private HeliumPackageSearchResult getPackageInfo(String pkgName, String artifact) { - Map> infos = getAllPackageInfo(false, pkgName); - List packages = infos.get(pkgName); - if (StringUtils.isBlank(artifact)) { - return packages.get(0); /** return the FIRST package */ - } else { - for (HeliumPackageSearchResult pkg : packages) { - if (pkg.getPkg().getArtifact().equals(artifact)) { - return pkg; - } - } - } - return null; - } - - public File getBundle(HeliumPackage pkg, boolean rebuild) throws IOException { - return bundleFactory.buildPackage(pkg, rebuild, true); - } - - public boolean enable(String name, String artifact) throws IOException { - HeliumPackageSearchResult pkgInfo = getPackageInfo(name, artifact); - - if (pkgInfo == null) { - LOGGER.info("Package {} not found", name); - return false; - } - - // if package is bundle, rebuild bundle - if (HeliumPackage.isBundleType(pkgInfo.getPkg().getType())) { - bundleFactory.buildPackage(pkgInfo.getPkg(), true, true); - } - - // set `enable` field - heliumConf.enablePackage(name, artifact); - // set display order - if (pkgInfo.getPkg().getType() == HeliumType.VISUALIZATION) { - List currentDisplayOrder = heliumConf.getBundleDisplayOrder(); - if (!currentDisplayOrder.contains(name)) { - currentDisplayOrder.add(name); - } - } - - saveConfig(); - return true; - } - - public boolean disable(String name) throws IOException { - String pkg = heliumConf.getEnabledPackages().get(name); - - if (pkg == null) { - LOGGER.info("Package {} not found", name); - return false; - } - - HeliumPackageSearchResult pkgInfo = getPackageInfo(name, pkg); - - // set `enable` field - heliumConf.disablePackage(name); - if (pkgInfo.getPkg().getType() == HeliumType.VISUALIZATION) { - List currentDisplayOrder = heliumConf.getBundleDisplayOrder(); - if (currentDisplayOrder.contains(name)) { - currentDisplayOrder.remove(name); - } - } - saveConfig(); - return true; - } - - public void updatePackageConfig(String artifact, Map pkgConfig) - throws IOException { - - heliumConf.updatePackageConfig(artifact, pkgConfig); - saveConfig(); - } - - public Map> getAllPackageConfig() { - return heliumConf.getAllPackageConfigs(); - } - - private Map getPackagePersistedConfig(String artifact) { - return heliumConf.getPackagePersistedConfig(artifact); - } - - public HeliumPackageSuggestion suggestApp(Paragraph paragraph) { - HeliumPackageSuggestion suggestion = new HeliumPackageSuggestion(); - - Interpreter intp = null; - try { - intp = paragraph.getBindedInterpreter(); - } catch (InterpreterNotFoundException e) { - return suggestion; - } - - ResourcePool resourcePool = intp.getInterpreterGroup().getResourcePool(); - ResourceSet allResources; - - if (resourcePool != null) { - if (resourcePool instanceof DistributedResourcePool) { - allResources = ((DistributedResourcePool) resourcePool).getAll(true); - } else { - allResources = resourcePool.getAll(); - } - } else { - allResources = interpreterSettingManager.getAllResources(); - } - - for (List pkgs : allPackages.values()) { - for (HeliumPackageSearchResult pkg : pkgs) { - if (pkg.getPkg().getType() == HeliumType.APPLICATION && pkg.isEnabled()) { - ResourceSet resources = ApplicationLoader.findRequiredResourceSet( - pkg.getPkg().getResources(), - paragraph.getNote().getId(), - paragraph.getId(), - allResources); - if (resources == null) { - continue; - } else { - suggestion.addAvailablePackage(pkg); - } - break; - } - } - } - - suggestion.sort(); - return suggestion; - } - - /** - * Get enabled buildBundle packages - * - * @return ordered list of enabled buildBundle package - */ - public List getBundlePackagesToBundle() { - List visOrder = heliumConf.getBundleDisplayOrder(); - - Set orderedBundlePackages = new HashSet<>(); - List output = new LinkedList<>(); - - // add enabled packages in visOrder - for (String name : visOrder) { - List versions = allPackages.get(name); - if (versions == null) { - continue; - } - for (HeliumPackageSearchResult pkgInfo : versions) { - if (canBundle(pkgInfo)) { - orderedBundlePackages.add(pkgInfo.getPkg()); - break; - } - } - } - - // add enabled packages not in visOrder - for (List pkgInfos : allPackages.values()) { - for (HeliumPackageSearchResult pkgInfo : pkgInfos) { - if (canBundle(pkgInfo)) { - orderedBundlePackages.add(pkgInfo.getPkg()); - break; - } - } - } - output.addAll(orderedBundlePackages); - return output; - } - - private boolean canBundle(HeliumPackageSearchResult pkgInfo) { - return (pkgInfo.isEnabled() && - HeliumPackage.isBundleType(pkgInfo.getPkg().getType())); - } - - /** - * Get enabled package list in order - * @return - */ - public List getVisualizationPackageOrder() { - return heliumConf.getBundleDisplayOrder(); - } - - public void setVisualizationPackageOrder(List orderedPackageList) - throws IOException { - heliumConf.setBundleDisplayOrder(orderedPackageList); - saveConfig(); - } - - /** - * @param packageName - * @return { "confPersisted", "confSpec" } or return null if failed to found enabled package - */ - public Map> getSpellConfig(String packageName) { - HeliumPackageSearchResult result = getEnabledPackageInfo(packageName); - - if (result == null) { - return null; - } - - HeliumPackage enabledPackage = result.getPkg(); - - Map configSpec = enabledPackage.getConfig(); - Map configPersisted = - getPackagePersistedConfig(enabledPackage.getArtifact()); - - return createMixedConfig(configPersisted, configSpec); - } - - public Map> getPackageConfig(String pkgName, - String artifact) { - - HeliumPackageSearchResult result = getPackageInfo(pkgName, artifact); - - if (result == null) { - return null; - } - - HeliumPackage requestedPackage = result.getPkg(); - - Map configSpec = requestedPackage.getConfig(); - Map configPersisted = - getPackagePersistedConfig(artifact); - - return createMixedConfig(configPersisted, configSpec); - } - - private static Map> createMixedConfig(Map persisted, - Map spec) { - Map> mixed = new HashMap<>(); - mixed.put("confPersisted", persisted); - mixed.put("confSpec", spec); - - return mixed; - } - - public ResourceSet getAllResources() { - return getAllResourcesExcept(null); - } - - private ResourceSet getAllResourcesExcept(String interpreterGroupExcludsion) { - ResourceSet resourceSet = new ResourceSet(); - for (ManagedInterpreterGroup intpGroup : interpreterSettingManager.getAllInterpreterGroup()) { - if (interpreterGroupExcludsion != null && - intpGroup.getId().equals(interpreterGroupExcludsion)) { - continue; - } - - RemoteInterpreterProcess remoteInterpreterProcess = intpGroup.getRemoteInterpreterProcess(); - if (remoteInterpreterProcess == null) { - ResourcePool localPool = intpGroup.getResourcePool(); - if (localPool != null) { - resourceSet.addAll(localPool.getAll()); - } - } else if (remoteInterpreterProcess.isRunning()) { - List resourceList = remoteInterpreterProcess.callRemoteFunction(client -> - client.resourcePoolGetAll()); - Gson gson = new Gson(); - for (String res : resourceList) { - resourceSet.add(gson.fromJson(res, Resource.class)); - } - } - } - return resourceSet; - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumApplicationFactory.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumApplicationFactory.java deleted file mode 100644 index 5ec0a761826..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumApplicationFactory.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import java.io.IOException; -import java.util.List; -import java.util.concurrent.ExecutorService; -import jakarta.inject.Inject; -import org.apache.zeppelin.interpreter.Interpreter; -import org.apache.zeppelin.interpreter.InterpreterException; -import org.apache.zeppelin.interpreter.InterpreterGroup; -import org.apache.zeppelin.interpreter.InterpreterResult; -import org.apache.zeppelin.interpreter.ManagedInterpreterGroup; -import org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry; -import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess; -import org.apache.zeppelin.interpreter.thrift.RemoteApplicationResult; -import org.apache.zeppelin.notebook.ApplicationState; -import org.apache.zeppelin.notebook.Note; -import org.apache.zeppelin.notebook.NoteEventListener; -import org.apache.zeppelin.notebook.Notebook; -import org.apache.zeppelin.notebook.Paragraph; -import org.apache.zeppelin.scheduler.ExecutorFactory; -import org.apache.zeppelin.scheduler.Job; -import org.apache.zeppelin.user.AuthenticationInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * HeliumApplicationFactory - */ -public class HeliumApplicationFactory implements ApplicationEventListener, NoteEventListener { - private static final Logger LOGGER = LoggerFactory.getLogger(HeliumApplicationFactory.class); - private final ExecutorService executor; - private Notebook notebook; - private ApplicationEventListener applicationEventListener; - - @Inject - public HeliumApplicationFactory( - Notebook notebook, ApplicationEventListener applicationEventListener) { - this.executor = - ExecutorFactory.singleton().createOrGet(HeliumApplicationFactory.class.getName(), 10); - this.notebook = notebook; - this.applicationEventListener = applicationEventListener; - - // TODO(jl): Hmmmmmmmm... - this.notebook.addNotebookEventListener(this); - } - - private boolean isRemote(InterpreterGroup group) { - return group.getAngularObjectRegistry() instanceof RemoteAngularObjectRegistry; - } - - - /** - * Load pkg and run task - */ - public String loadAndRun(HeliumPackage pkg, Paragraph paragraph) { - ApplicationState appState = paragraph.createOrGetApplicationState(pkg); - onLoad(paragraph.getNote().getId(), paragraph.getId(), appState.getId(), - appState.getHeliumPackage()); - executor.submit(new LoadApplication(appState, pkg, paragraph)); - return appState.getId(); - } - - /** - * Load application and run in the remote process - */ - private class LoadApplication implements Runnable { - private final HeliumPackage pkg; - private final Paragraph paragraph; - private final ApplicationState appState; - - public LoadApplication(ApplicationState appState, HeliumPackage pkg, Paragraph paragraph) { - this.appState = appState; - this.pkg = pkg; - this.paragraph = paragraph; - } - - @Override - public void run() { - try { - // get interpreter process - Interpreter intp = paragraph.getBindedInterpreter(); - ManagedInterpreterGroup intpGroup = (ManagedInterpreterGroup) intp.getInterpreterGroup(); - RemoteInterpreterProcess intpProcess = intpGroup.getRemoteInterpreterProcess(); - if (intpProcess == null) { - throw new ApplicationException("Target interpreter process is not running"); - } - - // load application - load(intpProcess, appState); - - // run application - RunApplication runTask = new RunApplication(paragraph, appState.getId()); - runTask.run(); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - - if (appState != null) { - appStatusChange(paragraph, appState.getId(), ApplicationState.Status.ERROR); - appState.setOutput(e.getMessage()); - } - } - } - - private void load(RemoteInterpreterProcess intpProcess, ApplicationState appState) - throws Exception { - - synchronized (appState) { - if (appState.getStatus() == ApplicationState.Status.LOADED) { - // already loaded - return; - } - - appStatusChange(paragraph, appState.getId(), ApplicationState.Status.LOADING); - final String pkgInfo = pkg.toJson(); - final String appId = appState.getId(); - - RemoteApplicationResult ret = intpProcess.callRemoteFunction(client -> - client.loadApplication( - appId, - pkgInfo, - paragraph.getNote().getId(), - paragraph.getId())); - if (ret.isSuccess()) { - appStatusChange(paragraph, appState.getId(), ApplicationState.Status.LOADED); - } else { - throw new ApplicationException(ret.getMsg()); - } - } - } - } - - /** - * Get ApplicationState - * @param paragraph - * @param appId - * @return - */ - public ApplicationState get(Paragraph paragraph, String appId) { - return paragraph.getApplicationState(appId); - } - - /** - * Unload application - * It does not remove ApplicationState - * - * @param paragraph - * @param appId - */ - public void unload(Paragraph paragraph, String appId) { - executor.execute(new UnloadApplication(paragraph, appId)); - } - - /** - * Unload application task - */ - private class UnloadApplication implements Runnable { - private final Paragraph paragraph; - private final String appId; - - public UnloadApplication(Paragraph paragraph, String appId) { - this.paragraph = paragraph; - this.appId = appId; - } - - @Override - public void run() { - ApplicationState appState = null; - try { - appState = paragraph.getApplicationState(appId); - - if (appState == null) { - LOGGER.warn("Can not find {} to unload from {}", appId, paragraph.getId()); - return; - } - if (appState.getStatus() == ApplicationState.Status.UNLOADED) { - // not loaded - return; - } - unload(appState); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - if (appState != null) { - appStatusChange(paragraph, appId, ApplicationState.Status.ERROR); - appState.setOutput(e.getMessage()); - } - } - } - - private void unload(final ApplicationState appsToUnload) throws ApplicationException { - synchronized (appsToUnload) { - if (appsToUnload.getStatus() != ApplicationState.Status.LOADED) { - throw new ApplicationException( - "Can't unload application status " + appsToUnload.getStatus()); - } - appStatusChange(paragraph, appsToUnload.getId(), ApplicationState.Status.UNLOADING); - Interpreter intp = null; - try { - intp = paragraph.getBindedInterpreter(); - } catch (InterpreterException e) { - throw new ApplicationException("No interpreter found", e); - } - - RemoteInterpreterProcess intpProcess = - ((ManagedInterpreterGroup) intp.getInterpreterGroup()).getRemoteInterpreterProcess(); - if (intpProcess == null) { - throw new ApplicationException("Target interpreter process is not running"); - } - - RemoteApplicationResult ret = intpProcess.callRemoteFunction(client -> - client.unloadApplication(appsToUnload.getId())); - if (ret.isSuccess()) { - appStatusChange(paragraph, appsToUnload.getId(), ApplicationState.Status.UNLOADED); - } else { - throw new ApplicationException(ret.getMsg()); - } - } - } - } - - /** - * Run application - * It does not remove ApplicationState - * - * @param paragraph - * @param appId - */ - public void run(Paragraph paragraph, String appId) { - executor.execute(new RunApplication(paragraph, appId)); - } - - /** - * Run application task - */ - private class RunApplication implements Runnable { - private final Paragraph paragraph; - private final String appId; - - public RunApplication(Paragraph paragraph, String appId) { - this.paragraph = paragraph; - this.appId = appId; - } - - @Override - public void run() { - ApplicationState appState = null; - try { - appState = paragraph.getApplicationState(appId); - - if (appState == null) { - LOGGER.warn("Can not find {} to unload from {}", appId, paragraph.getId()); - return; - } - - run(appState); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - if (appState != null) { - appStatusChange(paragraph, appId, ApplicationState.Status.UNLOADED); - appState.setOutput(e.getMessage()); - } - } - } - - private void run(final ApplicationState app) throws ApplicationException { - synchronized (app) { - if (app.getStatus() != ApplicationState.Status.LOADED) { - throw new ApplicationException( - "Can't run application status " + app.getStatus()); - } - - Interpreter intp = null; - try { - intp = paragraph.getBindedInterpreter(); - } catch (InterpreterException e) { - throw new ApplicationException("No interpreter found", e); - } - - RemoteInterpreterProcess intpProcess = - ((ManagedInterpreterGroup) intp.getInterpreterGroup()).getRemoteInterpreterProcess(); - if (intpProcess == null) { - throw new ApplicationException("Target interpreter process is not running"); - } - RemoteApplicationResult ret = intpProcess.callRemoteFunction(client -> - client.runApplication(app.getId())); - if (ret.isSuccess()) { - // success - } else { - throw new ApplicationException(ret.getMsg()); - } - } - } - } - - @Override - public void onOutputAppend( - String noteId, String paragraphId, int index, String appId, String output) { - ApplicationState appToUpdate = getAppState(noteId, paragraphId, appId); - - if (appToUpdate != null) { - appToUpdate.appendOutput(output); - } else { - LOGGER.error("Can't find app {}", appId); - } - - if (applicationEventListener != null) { - applicationEventListener.onOutputAppend(noteId, paragraphId, index, appId, output); - } - } - - @Override - public void onOutputUpdated( - String noteId, String paragraphId, int index, String appId, - InterpreterResult.Type type, String output) { - ApplicationState appToUpdate = getAppState(noteId, paragraphId, appId); - - if (appToUpdate != null) { - appToUpdate.setOutput(output); - } else { - LOGGER.error("Can't find app {}", appId); - } - - if (applicationEventListener != null) { - applicationEventListener.onOutputUpdated(noteId, paragraphId, index, appId, type, output); - } - } - - @Override - public void onLoad(String noteId, String paragraphId, String appId, HeliumPackage pkg) { - if (applicationEventListener != null) { - applicationEventListener.onLoad(noteId, paragraphId, appId, pkg); - } - } - - @Override - public void onStatusChange(String noteId, String paragraphId, String appId, String status) { - ApplicationState appToUpdate = getAppState(noteId, paragraphId, appId); - if (appToUpdate != null) { - appToUpdate.setStatus(ApplicationState.Status.valueOf(status)); - } - - if (applicationEventListener != null) { - applicationEventListener.onStatusChange(noteId, paragraphId, appId, status); - } - } - - private void appStatusChange(Paragraph paragraph, - String appId, - ApplicationState.Status status) { - ApplicationState app = paragraph.getApplicationState(appId); - app.setStatus(status); - onStatusChange(paragraph.getNote().getId(), paragraph.getId(), appId, status.toString()); - } - - private ApplicationState getAppState(String noteId, String paragraphId, String appId) { - if (notebook == null) { - return null; - } - try { - return notebook.processNote(noteId, - note -> { - if (note == null) { - LOGGER.warn("Note {} not found", noteId); - return null; - } - Paragraph paragraph = note.getParagraph(paragraphId); - if (paragraph == null) { - LOGGER.error("Can't get paragraph {}", paragraphId); - return null; - } - return paragraph.getApplicationState(appId); - }); - } catch (IOException e) { - LOGGER.error("Can't get note {}", noteId); - return null; - } - } - - @Override - public void onNoteRemove(Note note, AuthenticationInfo subject) { - // do nothing - } - - @Override - public void onNoteCreate(Note note, AuthenticationInfo subject) { - // do nothing - } - - @Override - public void onNoteUpdate(Note note, AuthenticationInfo subject) { - // do nothing - } - - @Override - public void onParagraphRemove(Paragraph paragraph) { - List appStates = paragraph.getAllApplicationStates(); - for (ApplicationState app : appStates) { - UnloadApplication unloadJob = new UnloadApplication(paragraph, app.getId()); - unloadJob.run(); - } - } - - @Override - public void onParagraphCreate(Paragraph p) { - // do nothing - } - - @Override - public void onParagraphUpdate(Paragraph p) { - // do nothing - } - - @Override - public void onParagraphStatusChange(Paragraph p, Job.Status status) { - if (status == Job.Status.FINISHED) { - // refresh application - List appStates = p.getAllApplicationStates(); - - for (ApplicationState app : appStates) { - loadAndRun(app.getHeliumPackage(), p); - } - } - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java deleted file mode 100644 index f6e9389633f..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java +++ /dev/null @@ -1,726 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.github.eirslett.maven.plugins.frontend.lib.FrontendPluginFactory; -import com.github.eirslett.maven.plugins.frontend.lib.InstallationException; -import com.github.eirslett.maven.plugins.frontend.lib.NPMInstaller; -import com.github.eirslett.maven.plugins.frontend.lib.NodeInstaller; -import com.github.eirslett.maven.plugins.frontend.lib.NpmRunner; -import com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig; -import com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException; -import com.github.eirslett.maven.plugins.frontend.lib.YarnInstaller; -import com.github.eirslett.maven.plugins.frontend.lib.YarnRunner; -import com.google.common.io.Resources; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.StringReader; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import jakarta.inject.Inject; -import org.apache.commons.compress.archivers.tar.TarArchiveEntry; -import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; -import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Appender; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.WriterAppender; -import org.apache.log4j.spi.Filter; -import org.apache.log4j.spi.LoggingEvent; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Load helium visualization & spell - */ -public class HeliumBundleFactory { - private static final Logger LOGGER = LoggerFactory.getLogger(HeliumBundleFactory.class); - private static final String NODE_VERSION = "v16.16.0"; - private static final String NPM_VERSION = "8.11.0"; - private static final String YARN_VERSION = "v1.22.0"; - private static final String NPM_PACKAGE_NAME = "npm"; - protected static final String HELIUM_LOCAL_REPO = "helium-bundle"; - private static final String HELIUM_BUNDLES_DIR = "bundles"; - private static final String HELIUM_LOCAL_MODULE_DIR = "local_modules"; - private static final String HELIUM_BUNDLES_SRC_DIR = "src"; - private static final String HELIUM_BUNDLES_SRC = "load.js"; - private static final String YARN_CACHE_DIR = "yarn-cache"; - private static final String PACKAGE_JSON = "package.json"; - private static final String HELIUM_BUNDLE_CACHE = "helium.bundle.cache.js"; - private static final String HELIUM_BUNDLE = "helium.bundle.js"; - private static final String HELIUM_BUNDLES_VAR = "window._heliumBundles"; - private static final int FETCH_RETRY_COUNT = 2; - private static final int FETCH_RETRY_FACTOR_COUNT = 1; - private static final int FETCH_RETRY_MIN_TIMEOUT = 5000; // Milliseconds - - private final FrontendPluginFactory frontEndPluginFactory; - private final File nodeInstallationDirectory; - private final File heliumLocalRepoDirectory; - private final File heliumBundleDirectory; - private final File heliumLocalModuleDirectory; - private final File yarnCacheDir; - private File tabledataModulePath; - private File visualizationModulePath; - private File spellModulePath; - private String defaultNodeInstallerUrl; - private String defaultNpmInstallerUrl; - private String defaultYarnInstallerUrl; - private Gson gson; - private boolean nodeAndNpmInstalled = false; - - private ByteArrayOutputStream out = new ByteArrayOutputStream(); - - @Inject - public HeliumBundleFactory(ZeppelinConfiguration zConf) { - this.heliumLocalRepoDirectory = - new File(zConf.getAbsoluteDir(ConfVars.ZEPPELIN_DEP_LOCALREPO), HELIUM_LOCAL_REPO); - this.heliumBundleDirectory = new File(heliumLocalRepoDirectory, HELIUM_BUNDLES_DIR); - this.heliumLocalModuleDirectory = new File(heliumLocalRepoDirectory, HELIUM_LOCAL_MODULE_DIR); - this.yarnCacheDir = new File(heliumLocalRepoDirectory, YARN_CACHE_DIR); - this.defaultNodeInstallerUrl = zConf.getHeliumNodeInstallerUrl(); - this.defaultNpmInstallerUrl = zConf.getHeliumNpmInstallerUrl(); - this.defaultYarnInstallerUrl = zConf.getHeliumYarnInstallerUrl(); - this.nodeInstallationDirectory = this.heliumLocalRepoDirectory; - - this.frontEndPluginFactory = - new FrontendPluginFactory(heliumLocalRepoDirectory, nodeInstallationDirectory); - - this.gson = new Gson(); - - File zeppelinWebPath = new File(zConf.getAbsoluteDir("zeppelin-web")); - if (!zeppelinWebPath.isDirectory()) { - this.tabledataModulePath = - new File(zConf.getAbsoluteDir("lib/node_modules/zeppelin-tabledata")); - this.visualizationModulePath = new File(zConf.getAbsoluteDir("lib/node_modules/zeppelin-vis")); - this.spellModulePath = new File(zConf.getAbsoluteDir("lib/node_modules/zeppelin-spell")); - } else { - this.tabledataModulePath = new File(zConf.getAbsoluteDir("zeppelin-web/src/app/tabledata")); - this.visualizationModulePath = - new File(zConf.getAbsoluteDir("zeppelin-web/src/app/visualization")); - this.spellModulePath = new File(zConf.getAbsoluteDir("zeppelin-web/src/app/spell")); - } - } - - void installNodeAndNpm() throws TaskRunnerException { - if (nodeAndNpmInstalled) { - return; - } - try { - NodeInstaller nodeInstaller = frontEndPluginFactory - .getNodeInstaller(getProxyConfig(isSecure(defaultNodeInstallerUrl))); - nodeInstaller.setNodeVersion(NODE_VERSION); - nodeInstaller.setNodeDownloadRoot(defaultNodeInstallerUrl); - nodeInstaller.install(); - - NPMInstaller npmInstaller = frontEndPluginFactory - .getNPMInstaller(getProxyConfig(isSecure(defaultNpmInstallerUrl))); - npmInstaller.setNpmVersion(NPM_VERSION); - npmInstaller.setNpmDownloadRoot(defaultNpmInstallerUrl + "/" + NPM_PACKAGE_NAME + "/-/"); - npmInstaller.install(); - - YarnInstaller yarnInstaller = frontEndPluginFactory - .getYarnInstaller(getProxyConfig(isSecure(defaultYarnInstallerUrl))); - yarnInstaller.setYarnVersion(YARN_VERSION); - yarnInstaller.setYarnDownloadRoot(defaultYarnInstallerUrl); - yarnInstaller.install(); - yarnCacheDir.mkdirs(); - String yarnCacheDirPath = yarnCacheDir.getAbsolutePath(); - yarnCommand(frontEndPluginFactory, "config set cache-folder " + yarnCacheDirPath); - - configureLogger(); - nodeAndNpmInstalled = true; - } catch (InstallationException e) { - LOGGER.error(e.getMessage(), e); - } - } - - private ProxyConfig getProxyConfig(boolean isSecure) { - List proxies = new LinkedList<>(); - - String httpProxy = StringUtils.isBlank(System.getenv("http_proxy")) ? - System.getenv("HTTP_PROXY") : System.getenv("http_proxy"); - - String httpsProxy = StringUtils.isBlank(System.getenv("https_proxy")) ? - System.getenv("HTTPS_PROXY") : System.getenv("https_proxy"); - - try { - if (isSecure && StringUtils.isNotBlank(httpsProxy)) - proxies.add(generateProxy("secure", new URI(httpsProxy))); - else if (!isSecure && StringUtils.isNotBlank(httpProxy)) - proxies.add(generateProxy("insecure", new URI(httpProxy))); - } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); - } - return new ProxyConfig(proxies); - } - - private ProxyConfig.Proxy generateProxy(String proxyId, URI uri) { - - String protocol = uri.getScheme(); - String host = uri.getHost(); - int port = uri.getPort() <= 0 ? 80 : uri.getPort(); - - String username = null; - String password = null; - if (uri.getUserInfo() != null) { - String[] authority = uri.getUserInfo().split(":"); - if (authority.length == 2) { - username = authority[0]; - password = authority[1]; - } else if (authority.length == 1) { - username = authority[0]; - } - } - String nonProxyHosts = StringUtils.isBlank(System.getenv("no_proxy")) ? - System.getenv("NO_PROXY") : System.getenv("no_proxy"); - return new ProxyConfig.Proxy(proxyId, protocol, host, port, username, password, nonProxyHosts); - } - - private boolean isSecure(String url) { - return url.toLowerCase().startsWith("https"); - } - - public void buildAllPackages(List pkgs) throws IOException { - buildAllPackages(pkgs, false); - } - - private File getHeliumPackageDirectory(String pkgName) { - return new File(heliumBundleDirectory, pkgName); - } - - private File getHeliumPackageSourceDirectory(String pkgName) { - return new File(heliumBundleDirectory, pkgName + "/" + HELIUM_BUNDLES_SRC_DIR); - } - - private File getHeliumPackageBundleCache(String pkgName) { - return new File(heliumBundleDirectory, pkgName + "/" + HELIUM_BUNDLE_CACHE); - } - - private static List unTgz(File tarFile, File directory) throws IOException { - List result = new ArrayList<>(); - try (TarArchiveInputStream in = new TarArchiveInputStream( - new GzipCompressorInputStream(new FileInputStream(tarFile)))) { - TarArchiveEntry entry = in.getNextTarEntry(); - while (entry != null) { - if (entry.isDirectory()) { - entry = in.getNextTarEntry(); - continue; - } - File curfile = new File(directory, entry.getName()); - File parent = curfile.getParentFile(); - if (!parent.exists()) { - parent.mkdirs(); - } - try (OutputStream out = new FileOutputStream(curfile)) { - IOUtils.copy(in, out); - } - result.add(entry.getName()); - entry = in.getNextTarEntry(); - } - } - return result; - } - - /** - * @return main file name of this helium package (relative path) - */ - private String downloadPackage(HeliumPackage pkg, String[] nameAndVersion, File bundleDir, - String templateWebpackConfig, String templatePackageJson, - FrontendPluginFactory fpf) throws IOException, TaskRunnerException { - if (bundleDir.exists()) { - FileUtils.deleteQuietly(bundleDir); - } - FileUtils.forceMkdir(bundleDir); - - FileFilter copyFilter = new FileFilter() { - @Override - public boolean accept(File pathname) { - String fileName = pathname.getName(); - if (fileName.startsWith(".") || fileName.startsWith("#") || fileName.startsWith("~")) { - return false; - } else { - return true; - } - } - }; - - if (isLocalPackage(pkg)) { - FileUtils.copyDirectory( - new File(pkg.getArtifact()), - bundleDir, - copyFilter); - } else { - // if online package - String version = nameAndVersion[1]; - File tgz = new File(heliumLocalRepoDirectory, pkg.getName() + "-" + version + ".tgz"); - FileUtils.deleteQuietly(tgz); - - // wget, extract and move dir to `bundles/${pkg.getName()}`, and remove tgz - npmCommand(fpf, "pack " + pkg.getArtifact()); - File extracted = new File(heliumBundleDirectory, "package"); - FileUtils.deleteDirectory(extracted); - List entries = unTgz(tgz, heliumBundleDirectory); - for (String entry : entries) { - LOGGER.debug("Extracted {}", entry); - } - FileUtils.deleteQuietly(tgz); - FileUtils.copyDirectory(extracted, bundleDir); - FileUtils.deleteDirectory(extracted); - } - - // 1. setup package.json - File existingPackageJson = new File(bundleDir, "package.json"); - Map packageJson; - try (JsonReader reader = new JsonReader(new FileReader(existingPackageJson))) { - packageJson = gson.fromJson(reader, - new TypeToken>(){}.getType()); - } - Map existingDeps = (Map) packageJson.get("dependencies"); - String mainFileName = (String) packageJson.get("main"); - - StringBuilder dependencies = new StringBuilder(); - int index = 0; - for (Map.Entry e: existingDeps.entrySet()) { - dependencies.append(" \"").append(e.getKey()).append("\": "); - if (e.getKey().equals("zeppelin-vis") || - e.getKey().equals("zeppelin-tabledata") || - e.getKey().equals("zeppelin-spell")) { - dependencies.append("\"file:../../" + HELIUM_LOCAL_MODULE_DIR + "/") - .append(e.getKey()).append("\""); - } else { - dependencies.append("\"").append(e.getValue()).append("\""); - } - - if (index < existingDeps.size() - 1) { - dependencies.append(",\n"); - } - index = index + 1; - } - - FileUtils.deleteQuietly(new File(bundleDir, PACKAGE_JSON)); - templatePackageJson = templatePackageJson.replaceFirst("PACKAGE_NAME", pkg.getName()); - templatePackageJson = templatePackageJson.replaceFirst("MAIN_FILE", mainFileName); - templatePackageJson = templatePackageJson.replaceFirst("DEPENDENCIES", dependencies.toString()); - FileUtils.write(new File(bundleDir, PACKAGE_JSON), templatePackageJson, StandardCharsets.UTF_8); - - // 2. setup webpack.config - FileUtils.write(new File(bundleDir, "webpack.config.js"), templateWebpackConfig, StandardCharsets.UTF_8); - - return mainFileName; - } - - private void prepareSource(HeliumPackage pkg, String[] moduleNameVersion, - String mainFileName) throws IOException { - StringBuilder loadJsImport = new StringBuilder(); - StringBuilder loadJsRegister = new StringBuilder(); - String className = "bundles" + pkg.getName().replaceAll("[-_]", ""); - - // remove postfix `.js` for ES6 import - if (mainFileName.endsWith(".js")) { - mainFileName = mainFileName.substring(0, mainFileName.length() - 3); - } - - loadJsImport - .append("import ") - .append(className) - .append(" from \"../" + mainFileName + "\"\n"); - - loadJsRegister.append(HELIUM_BUNDLES_VAR).append(".push({\n"); - loadJsRegister.append("id: \"").append(moduleNameVersion[0]).append("\",\n"); - loadJsRegister.append("name: \"").append(pkg.getName()).append("\",\n"); - loadJsRegister.append("icon: ").append(gson.toJson(pkg.getIcon())).append(",\n"); - loadJsRegister.append("type: \"").append(pkg.getType()).append("\",\n"); - loadJsRegister.append("class: ").append(className).append("\n"); - loadJsRegister.append("})\n"); - - File srcDir = getHeliumPackageSourceDirectory(pkg.getName()); - FileUtils.forceMkdir(srcDir); - FileUtils.write(new File(srcDir, HELIUM_BUNDLES_SRC), - loadJsImport.append(loadJsRegister).toString(), StandardCharsets.UTF_8); - } - - private synchronized void installNodeModules(FrontendPluginFactory fpf) throws IOException { - try { - out.reset(); - String commandForNpmInstall = - String.format("install --fetch-retries=%d --fetch-retry-factor=%d " + - "--fetch-retry-mintimeout=%d", - FETCH_RETRY_COUNT, FETCH_RETRY_FACTOR_COUNT, FETCH_RETRY_MIN_TIMEOUT); - LOGGER.info("Installing required node modules"); - yarnCommand(fpf, commandForNpmInstall); - LOGGER.info("Installed required node modules"); - } catch (TaskRunnerException e) { - throw new IOException(e); - } - } - - private synchronized File bundleHeliumPackage(FrontendPluginFactory fpf, - File bundleDir) throws IOException { - try { - out.reset(); - LOGGER.info("Bundling helium packages"); - yarnCommand(fpf, "run bundle"); - LOGGER.info("Bundled helium packages"); - } catch (TaskRunnerException e) { - throw new IOException(new String(out.toByteArray())); - } - - String bundleStdoutResult = new String(out.toByteArray()); - File heliumBundle = new File(bundleDir, HELIUM_BUNDLE); - if (!heliumBundle.isFile()) { - throw new IOException( - "Can't create bundle: \n" + bundleStdoutResult); - } - - WebpackResult result = getWebpackResultFromOutput(bundleStdoutResult); - if (result.errors.length > 0) { - FileUtils.deleteQuietly(heliumBundle); - throw new IOException(result.errors[0]); - } - - return heliumBundle; - } - - public synchronized File buildPackage(HeliumPackage pkg, - boolean rebuild, - boolean recopyLocalModule) throws IOException { - if (pkg == null) { - return null; - } - - String[] moduleNameVersion = getNpmModuleNameAndVersion(pkg); - if (moduleNameVersion == null) { - LOGGER.warn("Can't get module name and version of package {}", pkg.getName()); - return null; - } - - String pkgName = pkg.getName(); - File bundleDir = getHeliumPackageDirectory(pkgName); - File bundleCache = getHeliumPackageBundleCache(pkgName); - - if (!rebuild && bundleCache.exists() && !bundleCache.isDirectory()) { - return bundleCache; - } - - // 0. install node, npm (should be called before `downloadPackage` - try { - installNodeAndNpm(); - } catch (TaskRunnerException e) { - throw new IOException(e); - } - - // 1. prepare directories - if (!heliumLocalRepoDirectory.exists() || !heliumLocalRepoDirectory.isDirectory()) { - FileUtils.deleteQuietly(heliumLocalRepoDirectory); - FileUtils.forceMkdir(heliumLocalRepoDirectory); - } - FrontendPluginFactory fpf = new FrontendPluginFactory( - bundleDir, nodeInstallationDirectory); - - // resources: webpack.js, package.json - String templateWebpackConfig = Resources.toString( - Resources.getResource("helium/webpack.config.js"), StandardCharsets.UTF_8); - String templatePackageJson = Resources.toString( - Resources.getResource("helium/" + PACKAGE_JSON), StandardCharsets.UTF_8); - - // 2. download helium package using `npm pack` - String mainFileName = null; - try { - mainFileName = downloadPackage(pkg, moduleNameVersion, bundleDir, - templateWebpackConfig, templatePackageJson, fpf); - } catch (TaskRunnerException e) { - throw new IOException(e); - } - - // 3. prepare bundle source - prepareSource(pkg, moduleNameVersion, mainFileName); - - // 4. install node and local modules for a bundle - copyFrameworkModulesToInstallPath(recopyLocalModule); // should copy local modules first - installNodeModules(fpf); - - // 5. let's bundle and update cache - File heliumBundle = bundleHeliumPackage(fpf, bundleDir); - bundleCache.delete(); - FileUtils.moveFile(heliumBundle, bundleCache); - - return bundleCache; - } - - private synchronized void buildAllPackages(List pkgs, boolean rebuild) - throws IOException { - - if (pkgs == null || pkgs.isEmpty()) { - return; - } - - // DON't recopy local modules when build all packages to avoid duplicated copies. - boolean recopyLocalModules = false; - - for (HeliumPackage pkg : pkgs) { - try { - buildPackage(pkg, rebuild, recopyLocalModules); - } catch (IOException e) { - LOGGER.error("Failed to build helium package: {}", pkg.getArtifact(), e); - } - } - } - - private void copyFrameworkModule(boolean recopy, FileFilter filter, - File src, File dest) throws IOException { - if (src != null) { - if (recopy && dest.exists()) { - FileUtils.deleteDirectory(dest); - } - - if (!dest.exists()) { - FileUtils.copyDirectory( - src, - dest, - filter); - } - } - } - - private void deleteYarnCache() { - FilenameFilter filter = new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - if ((name.startsWith("npm-zeppelin-vis-") || - name.startsWith("npm-zeppelin-tabledata-") || - name.startsWith("npm-zeppelin-spell-")) && - dir.isDirectory()) { - return true; - } - - return false; - } - }; - - File[] localModuleCaches = yarnCacheDir.listFiles(filter); - if (localModuleCaches != null) { - for (File f : localModuleCaches) { - FileUtils.deleteQuietly(f); - } - } - } - - void copyFrameworkModulesToInstallPath(boolean recopy) - throws IOException { - - FileFilter npmPackageCopyFilter = new FileFilter() { - @Override - public boolean accept(File pathname) { - String fileName = pathname.getName(); - if (fileName.startsWith(".") || fileName.startsWith("#") || fileName.startsWith("~")) { - return false; - } else { - return true; - } - } - }; - - FileUtils.forceMkdir(heliumLocalModuleDirectory); - // should delete yarn caches for local modules since they might be updated - deleteYarnCache(); - - // install tabledata module - File tabledataModuleInstallPath = new File(heliumLocalModuleDirectory, - "zeppelin-tabledata"); - copyFrameworkModule(recopy, npmPackageCopyFilter, - tabledataModulePath, tabledataModuleInstallPath); - - // install visualization module - File visModuleInstallPath = new File(heliumLocalModuleDirectory, - "zeppelin-vis"); - copyFrameworkModule(recopy, npmPackageCopyFilter, - visualizationModulePath, visModuleInstallPath); - - // install spell module - File spellModuleInstallPath = new File(heliumLocalModuleDirectory, - "zeppelin-spell"); - copyFrameworkModule(recopy, npmPackageCopyFilter, - spellModulePath, spellModuleInstallPath); - } - - private WebpackResult getWebpackResultFromOutput(String output) { - BufferedReader reader = new BufferedReader(new StringReader(output)); - - boolean webpackRunDetected = false; - boolean resultJsonDetected = false; - StringBuilder sb = new StringBuilder(); - try { - String next, line = reader.readLine(); - for (boolean last = (line == null); !last; line = next) { - last = ((next = reader.readLine()) == null); - - if (!webpackRunDetected) { - String trimed = line.trim(); - if (trimed.contains("webpack") - && trimed.endsWith("--json --registry=https://registry.npmjs.org/")) { - webpackRunDetected = true; - } - continue; - } - - if (!resultJsonDetected) { - if (line.trim().equals("{")) { - sb.append(line); - resultJsonDetected = true; - } - continue; - } - - if (resultJsonDetected && webpackRunDetected) { - // yarn command always ends with `Done in ... seconds ` - if (!last) { - sb.append(line); - } - } - } - return WebpackResult.fromJson(sb.toString()); - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - return new WebpackResult(); - } - } - - private boolean isLocalPackage(HeliumPackage pkg) { - return (pkg.getArtifact().startsWith(".") || pkg.getArtifact().startsWith("/")); - } - - private String[] getNpmModuleNameAndVersion(HeliumPackage pkg) { - String artifact = pkg.getArtifact(); - - if (isLocalPackage(pkg)) { - File packageJson = new File(artifact, "package.json"); - if (!packageJson.isFile()) { - return null; - } - try { - NpmPackage npmPackage = NpmPackage.fromJson( - FileUtils.readFileToString(packageJson, StandardCharsets.UTF_8)); - - String[] nameVersion = new String[2]; - nameVersion[0] = npmPackage.name; - nameVersion[1] = npmPackage.version; - return nameVersion; - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - return null; - } - } else { - String[] nameVersion = new String[2]; - - int pos; - if ((pos = artifact.indexOf('@')) > 0) { - nameVersion[0] = artifact.substring(0, pos); - nameVersion[1] = artifact.substring(pos + 1); - } else if ( - (pos = artifact.indexOf('^')) > 0 || - (pos = artifact.indexOf('~')) > 0) { - nameVersion[0] = artifact.substring(0, pos); - nameVersion[1] = artifact.substring(pos); - } else { - nameVersion[0] = artifact; - nameVersion[1] = ""; - } - return nameVersion; - } - } - - synchronized void install(HeliumPackage pkg) throws TaskRunnerException { - String commandForNpmInstallArtifact = - String.format("install %s --fetch-retries=%d --fetch-retry-factor=%d " + - "--fetch-retry-mintimeout=%d", pkg.getArtifact(), - FETCH_RETRY_COUNT, FETCH_RETRY_FACTOR_COUNT, FETCH_RETRY_MIN_TIMEOUT); - npmCommand(commandForNpmInstallArtifact); - } - - private void npmCommand(String args) throws TaskRunnerException { - npmCommand(args, new HashMap<>()); - } - - private void npmCommand(String args, Map env) throws TaskRunnerException { - NpmRunner npm = frontEndPluginFactory.getNpmRunner( - getProxyConfig(isSecure(defaultNpmInstallerUrl)), defaultNpmInstallerUrl); - npm.execute(args, env); - } - - private void npmCommand(FrontendPluginFactory fpf, String args) throws TaskRunnerException { - npmCommand(args, new HashMap<>()); - } - - private void yarnCommand(FrontendPluginFactory fpf, String args) throws TaskRunnerException { - yarnCommand(fpf, args, new HashMap<>()); - } - - private void yarnCommand(FrontendPluginFactory fpf, - String args, Map env) throws TaskRunnerException { - YarnRunner yarn = fpf.getYarnRunner( - getProxyConfig(isSecure(defaultNpmInstallerUrl)), defaultNpmInstallerUrl); - yarn.execute(args, env); - } - - private synchronized void configureLogger() { - org.apache.log4j.Logger npmLogger = org.apache.log4j.Logger.getLogger( - "com.github.eirslett.maven.plugins.frontend.lib.DefaultYarnRunner"); - Enumeration appenders = org.apache.log4j.Logger.getRootLogger().getAllAppenders(); - - if (appenders != null) { - while (appenders.hasMoreElements()) { - Appender appender = (Appender) appenders.nextElement(); - appender.addFilter(new Filter() { - - @Override - public int decide(LoggingEvent loggingEvent) { - if (loggingEvent.getLoggerName().contains("DefaultYarnRunner")) { - return DENY; - } else { - return NEUTRAL; - } - } - }); - } - } - npmLogger.addAppender(new WriterAppender( - new PatternLayout("%m%n"), - out - )); - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumConf.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumConf.java deleted file mode 100644 index a7f81677f8e..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumConf.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import org.apache.zeppelin.common.JsonSerializable; - -import java.util.*; - -/** - * Helium config. This object will be persisted to conf/helium.conf - */ -public class HeliumConf implements JsonSerializable { - private static final Gson gson = new GsonBuilder() - .setPrettyPrinting() - .registerTypeAdapter(HeliumRegistry.class, new HeliumRegistrySerializer()) - .create(); - - // enabled packages {name, version} - private Map enabled = Collections.synchronizedMap(new HashMap()); - - // {artifact, {configKey, configValue}} - private Map> packageConfig = - Collections.synchronizedMap( - new HashMap>()); - - // enabled visualization package display order - private List bundleDisplayOrder = - Collections.synchronizedList(new LinkedList()); - - public Map getEnabledPackages() { - return new HashMap<>(enabled); - } - - public void enablePackage(String name, String artifact) { - enabled.put(name, artifact); - } - - public void updatePackageConfig(String artifact, - Map newConfig) { - if (!packageConfig.containsKey(artifact)) { - packageConfig.put(artifact, - Collections.synchronizedMap(new HashMap())); - } - packageConfig.put(artifact, newConfig); - } - - /** - * @return versioned package config `{artifact, {configKey, configVal}}` - */ - public Map> getAllPackageConfigs () { - return packageConfig; - } - - public Map getPackagePersistedConfig(String artifact) { - if (!packageConfig.containsKey(artifact)) { - packageConfig.put(artifact, - Collections.synchronizedMap(new HashMap())); - } - - return packageConfig.get(artifact); - } - - public void disablePackage(HeliumPackage pkg) { - disablePackage(pkg.getName()); - } - - public void disablePackage(String name) { - enabled.remove(name); - } - - public List getBundleDisplayOrder() { - if (bundleDisplayOrder == null) { - return new LinkedList<>(); - } else { - return bundleDisplayOrder; - } - } - - public void setBundleDisplayOrder(List orderedPackageList) { - bundleDisplayOrder = Collections.synchronizedList(orderedPackageList); - } - - @Override - public String toJson() { - return gson.toJson(this); - } - - public static HeliumConf fromJson(String json) { - return gson.fromJson(json, HeliumConf.class); - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumLocalRegistry.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumLocalRegistry.java deleted file mode 100644 index 31db3e4d018..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumLocalRegistry.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import com.google.gson.stream.JsonReader; -import org.apache.commons.io.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; -import java.nio.charset.StandardCharsets; -import java.util.LinkedList; -import java.util.List; - -/** - * Simple Helium registry on local filesystem - */ -public class HeliumLocalRegistry extends HeliumRegistry { - private static final Logger LOGGER = LoggerFactory.getLogger(HeliumLocalRegistry.class); - - private static final Gson gson = new Gson(); - - public HeliumLocalRegistry(String name, String uri) { - super(name, uri); - } - - @Override - public synchronized List getAll() throws IOException { - List result = new LinkedList<>(); - - File file = new File(uri()); - File [] files = file.listFiles(); - if (files == null) { - return result; - } - - for (File f : files) { - if (f.getName().startsWith(".")) { - continue; - } - - HeliumPackage pkgInfo = readPackageInfo(f); - if (pkgInfo != null) { - result.add(pkgInfo); - } - } - return result; - } - - private HeliumPackage readPackageInfo(File f) { - try { - JsonReader reader = new JsonReader(new StringReader(FileUtils.readFileToString(f, StandardCharsets.UTF_8))); - reader.setLenient(true); - - return gson.fromJson(reader, HeliumPackage.class); - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - return null; - } - } - -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java deleted file mode 100644 index c7de0321059..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.util.Util; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URI; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** - * This registry reads helium package json data - * from specified url. - * - * File should be look like - * [ - * "packageName": { - * "0.0.1": json serialized HeliumPackage class, - * "0.0.2": json serialized HeliumPackage class, - * ... - * }, - * ... - * ] - */ -public class HeliumOnlineRegistry extends HeliumRegistry { - private static final Logger LOGGER = LoggerFactory.getLogger(HeliumOnlineRegistry.class); - private final Gson gson; - private final File registryCacheFile; - private final ZeppelinConfiguration zConf; - - public HeliumOnlineRegistry(String name, String uri, File registryCacheDir, - ZeppelinConfiguration zConf) { - super(name, uri); - this.zConf = zConf; - registryCacheDir.mkdirs(); - UUID registryCacheFileUuid = UUID.nameUUIDFromBytes(uri.getBytes()); - this.registryCacheFile = new File(registryCacheDir, registryCacheFileUuid.toString()); - - gson = new Gson(); - } - - @Override - public synchronized List getAll() throws IOException { - HttpClient client = HttpClientBuilder.create() - .setUserAgent("ApacheZeppelin/" + Util.getVersion()) - .setProxy(getProxy(uri())) - .build(); - HttpGet get = new HttpGet(uri()); - HttpResponse response; - try { - if ((get.getURI().getHost().equals(zConf.getS3Endpoint()))) { - if (zConf.getS3Timeout() != null) { - int timeout = Integer.parseInt(zConf.getS3Timeout()); - RequestConfig requestCfg = RequestConfig.custom() - .setConnectTimeout(timeout) - .setSocketTimeout(timeout) - .build(); - get.setConfig(requestCfg); - } - } - response = client.execute(get); - } catch (Exception e) { - LOGGER.error(e.getMessage()); - return readFromCache(); - } - - if (response.getStatusLine().getStatusCode() != 200) { - // try read from cache - if (LOGGER.isErrorEnabled()) { - LOGGER.error("{} returned {}", uri(), response.getStatusLine()); - } - return readFromCache(); - } else { - List packageList = new LinkedList<>(); - - BufferedReader reader; - reader = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); - - List>> packages = gson.fromJson( - reader, - new TypeToken>>>() { - }.getType()); - reader.close(); - - for (Map> pkg : packages) { - for (Map versions : pkg.values()) { - packageList.addAll(versions.values()); - } - } - - writeToCache(packageList); - return packageList; - } - } - - private HttpHost getProxy(String uri) { - String httpProxy = StringUtils.isBlank(System.getenv("http_proxy")) ? - System.getenv("HTTP_PROXY") : System.getenv("http_proxy"); - - String httpsProxy = StringUtils.isBlank(System.getenv("https_proxy")) ? - System.getenv("HTTPS_PROXY") : System.getenv("https_proxy"); - - try { - String scheme = new URI(uri).getScheme(); - if (scheme.toLowerCase().startsWith("https") && StringUtils.isNotBlank(httpsProxy)) { - URI httpsProxyUri = new URI(httpsProxy); - return new HttpHost(httpsProxyUri.getHost(), - httpsProxyUri.getPort(), httpsProxyUri.getScheme()); - } - else if (scheme.toLowerCase().startsWith("http") && StringUtils.isNotBlank(httpProxy)){ - URI httpProxyUri = new URI(httpProxy); - return new HttpHost(httpProxyUri.getHost(), - httpProxyUri.getPort(), httpProxyUri.getScheme()); - } - else return null; - } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); - return null; - } - } - - private List readFromCache() { - synchronized (registryCacheFile) { - if (registryCacheFile.isFile()) { - try { - return gson.fromJson( - new FileReader(registryCacheFile), - new TypeToken>() { - }.getType()); - } catch (FileNotFoundException e) { - LOGGER.error(e.getMessage(), e); - return new LinkedList<>(); - } - } else { - return new LinkedList<>(); - } - } - } - - private void writeToCache(List pkg) throws IOException { - synchronized (registryCacheFile) { - if (registryCacheFile.exists()) { - registryCacheFile.delete(); - } - String jsonToCache = gson.toJson(pkg); - FileUtils.writeStringToFile(registryCacheFile, jsonToCache); - } - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumPackageSearchResult.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumPackageSearchResult.java deleted file mode 100644 index 36b61154f6c..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumPackageSearchResult.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -/** - * search result - */ -public class HeliumPackageSearchResult { - private final String registry; - private final HeliumPackage pkg; - private final boolean enabled; - - /** - * Create search result item - * @param registry registry name - * @param pkg package information - */ - public HeliumPackageSearchResult(String registry, HeliumPackage pkg, boolean enabled) { - this.registry = registry; - this.pkg = pkg; - this.enabled = enabled; - } - - public String getRegistry() { - return registry; - } - - public HeliumPackage getPkg() { - return pkg; - } - - public boolean isEnabled() { - return enabled; - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumPackageSuggestion.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumPackageSuggestion.java deleted file mode 100644 index 9df6abcb9b8..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumPackageSuggestion.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedList; -import java.util.List; - -/** - * Suggested apps - */ -public class HeliumPackageSuggestion { - private final List available = new LinkedList<>(); - - /* - * possible future improvement - * provides n - 'favorite' list, based on occurrence of apps in notebook - */ - - public HeliumPackageSuggestion() { - - } - - public void addAvailablePackage(HeliumPackageSearchResult r) { - available.add(r); - - } - - public void sort() { - Collections.sort(available, new Comparator() { - @Override - public int compare(HeliumPackageSearchResult o1, HeliumPackageSearchResult o2) { - return o1.getPkg().getName().compareTo(o2.getPkg().getName()); - } - }); - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java deleted file mode 100644 index 4971063ee04..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import java.io.IOException; -import java.util.List; - -/** - * Helium package registry - */ -public abstract class HeliumRegistry { - private final String name; - private final String uri; - - protected HeliumRegistry(String name, String uri) { - this.name = name; - this.uri = uri; - } - public String name() { - return name; - } - public String uri() { - return uri; - } - public abstract List getAll() throws IOException; -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumRegistrySerializer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumRegistrySerializer.java deleted file mode 100644 index 7ce27b38fdb..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/HeliumRegistrySerializer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Type; - -/** - * HeliumRegistrySerializer (and deserializer) for gson - */ -public class HeliumRegistrySerializer - implements JsonSerializer, JsonDeserializer { - private static final Logger LOGGER = LoggerFactory.getLogger(HeliumRegistrySerializer.class); - - @Override - public HeliumRegistry deserialize(JsonElement json, - Type type, - JsonDeserializationContext jsonDeserializationContext) - throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); - String className = jsonObject.get("class").getAsString(); - String uri = jsonObject.get("uri").getAsString(); - String name = jsonObject.get("name").getAsString(); - - try { - LOGGER.info("Restore helium registry {} {} {}", name, className, uri); - Class cls = - (Class) getClass().getClassLoader().loadClass(className); - Constructor constructor = cls.getConstructor(String.class, String.class); - return constructor.newInstance(name, uri); - } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | - InstantiationException | InvocationTargetException e) { - LOGGER.error(e.getMessage(), e); - return null; - } - } - - @Override - public JsonElement serialize(HeliumRegistry heliumRegistry, - Type type, - JsonSerializationContext jsonSerializationContext) { - JsonObject json = new JsonObject(); - json.addProperty("class", heliumRegistry.getClass().getName()); - json.addProperty("uri", heliumRegistry.uri()); - json.addProperty("name", heliumRegistry.name()); - return json; - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/NpmPackage.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/NpmPackage.java deleted file mode 100644 index 73fc788fbc7..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/NpmPackage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import org.apache.zeppelin.common.JsonSerializable; - -import java.util.Map; - -/** - * To read package.json - */ -public class NpmPackage implements JsonSerializable { - private static final Gson gson = new Gson(); - - public String name; - public String version; - public Map dependencies; - - @Override - public String toJson() { - return gson.toJson(this); - } - - public static NpmPackage fromJson(String json) { - return gson.fromJson(json, NpmPackage.class); - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/WebpackResult.java b/zeppelin-server/src/main/java/org/apache/zeppelin/helium/WebpackResult.java deleted file mode 100644 index 3fa33a24ad8..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/helium/WebpackResult.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import org.apache.zeppelin.common.JsonSerializable; - -/** - * Represetns webpack json format result - */ -public class WebpackResult implements JsonSerializable { - private static final Gson gson = new Gson(); - - public final String [] errors = new String[0]; - public final String [] warnings = new String[0]; - - @Override - public String toJson() { - return gson.toJson(this); - } - - public static WebpackResult fromJson(String json) { - return gson.fromJson(json, WebpackResult.class); - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index f26bc54f0e7..6631a2a36e5 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -36,7 +36,6 @@ import org.apache.zeppelin.dep.DependencyResolver; import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.AngularObjectRegistryListener; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.launcher.InterpreterLaunchContext; import org.apache.zeppelin.interpreter.launcher.InterpreterLauncher; import org.apache.zeppelin.interpreter.recovery.NullRecoveryStorage; @@ -129,7 +128,6 @@ public class InterpreterSetting { private transient AngularObjectRegistryListener angularObjectRegistryListener; private transient RemoteInterpreterProcessListener remoteInterpreterProcessListener; - private transient ApplicationEventListener appEventListener; private transient DependencyResolver dependencyResolver; private transient ZeppelinConfiguration zConf; @@ -239,11 +237,6 @@ public Builder setAngularObjectRegistryListener( return this; } - public Builder setApplicationEventListener(ApplicationEventListener applicationEventListener) { - interpreterSetting.appEventListener = applicationEventListener; - return this; - } - public Builder setRecoveryStorage(RecoveryStorage recoveryStorage) { interpreterSetting.recoveryStorage = recoveryStorage; return this; @@ -308,10 +301,6 @@ public RemoteInterpreterProcessListener getRemoteInterpreterProcessListener() { return remoteInterpreterProcessListener; } - public ApplicationEventListener getAppEventListener() { - return appEventListener; - } - public DependencyResolver getDependencyResolver() { return dependencyResolver; } @@ -326,11 +315,6 @@ public InterpreterSetting setAngularObjectRegistryListener(AngularObjectRegistry return this; } - public InterpreterSetting setAppEventListener(ApplicationEventListener appEventListener) { - this.appEventListener = appEventListener; - return this; - } - public InterpreterSetting setRemoteInterpreterProcessListener(RemoteInterpreterProcessListener remoteInterpreterProcessListener) { this.remoteInterpreterProcessListener = remoteInterpreterProcessListener; diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java index 1a85f82d5d6..52918bef750 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java @@ -45,14 +45,12 @@ import org.apache.zeppelin.dep.DependencyResolver; import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.AngularObjectRegistryListener; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.Interpreter.RegisteredInterpreter; import org.apache.zeppelin.interpreter.lifecycle.IdleInterpreterReclaimer; import org.apache.zeppelin.interpreter.recovery.RecoveryStorage; import org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; -import org.apache.zeppelin.notebook.ApplicationState; import org.apache.zeppelin.notebook.Note; import org.apache.zeppelin.notebook.NoteEventListener; import org.apache.zeppelin.notebook.Notebook; @@ -142,7 +140,6 @@ public class InterpreterSettingManager implements NoteEventListener { private Notebook notebook; private AngularObjectRegistryListener angularObjectRegistryListener; private RemoteInterpreterProcessListener remoteInterpreterProcessListener; - private ApplicationEventListener appEventListener; private DependencyResolver dependencyResolver; private RecoveryStorage recoveryStorage; private ConfigStorage configStorage; @@ -157,14 +154,12 @@ public InterpreterSettingManager(ZeppelinConfiguration zConf, AngularObjectRegistryListener angularObjectRegistryListener, RemoteInterpreterProcessListener remoteInterpreterProcessListener, - ApplicationEventListener appEventListener, ConfigStorage storage, PluginManager pluginManager) throws IOException { this(zConf, new InterpreterOption(), angularObjectRegistryListener, remoteInterpreterProcessListener, - appEventListener, storage, pluginManager); } @@ -173,7 +168,6 @@ public InterpreterSettingManager(ZeppelinConfiguration zConf, InterpreterOption defaultOption, AngularObjectRegistryListener angularObjectRegistryListener, RemoteInterpreterProcessListener remoteInterpreterProcessListener, - ApplicationEventListener appEventListener, ConfigStorage configStorage, PluginManager pluginManager) throws IOException { @@ -196,7 +190,6 @@ public InterpreterSettingManager(ZeppelinConfiguration zConf, this.angularObjectRegistryListener = angularObjectRegistryListener; this.remoteInterpreterProcessListener = remoteInterpreterProcessListener; - this.appEventListener = appEventListener; this.interpreterEventServer = new RemoteInterpreterEventServer(zConf, this); this.interpreterEventServer.start(); @@ -241,13 +234,11 @@ public void refreshInterpreterTemplates() { } } - private void initInterpreterSetting(InterpreterSetting interpreterSetting) { interpreterSetting.setConf(zConf) .setInterpreterSettingManager(this) .setAngularObjectRegistryListener(angularObjectRegistryListener) .setRemoteInterpreterProcessListener(remoteInterpreterProcessListener) - .setAppEventListener(appEventListener) .setDependencyResolver(dependencyResolver) .setRecoveryStorage(recoveryStorage) .setInterpreterEventServer(interpreterEventServer) @@ -492,10 +483,6 @@ public RemoteInterpreterProcessListener getRemoteInterpreterProcessListener() { return remoteInterpreterProcessListener; } - public ApplicationEventListener getAppEventListener() { - return appEventListener; - } - private boolean registerInterpreterFromResource(ClassLoader cl, String interpreterDir, String interpreterJson, boolean override) throws IOException { URL[] urls = recursiveBuildLibList(new File(interpreterDir)); @@ -1216,15 +1203,6 @@ public void onNoteRemove(Note note, AuthenticationInfo subject) { // remove paragraph scope object for (Paragraph p : note.getParagraphs()) { ((RemoteAngularObjectRegistry) registry).removeAllAndNotifyRemoteProcess(note.getId(), p.getId()); - - // remove app scope object - List appStates = p.getAllApplicationStates(); - if (appStates != null) { - for (ApplicationState app : appStates) { - ((RemoteAngularObjectRegistry) registry) - .removeAllAndNotifyRemoteProcess(note.getId(), app.getId()); - } - } } // remove note scope object ((RemoteAngularObjectRegistry) registry).removeAllAndNotifyRemoteProcess(note.getId(), null); @@ -1232,14 +1210,6 @@ public void onNoteRemove(Note note, AuthenticationInfo subject) { // remove paragraph scope object for (Paragraph p : note.getParagraphs()) { registry.removeAll(note.getId(), p.getId()); - - // remove app scope object - List appStates = p.getAllApplicationStates(); - if (appStates != null) { - for (ApplicationState app : appStates) { - registry.removeAll(note.getId(), app.getId()); - } - } } // remove note scope object registry.removeAll(note.getId(), null); diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java index 5504283308b..a1341fac062 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java @@ -26,16 +26,12 @@ import org.apache.thrift.transport.TTransportException; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.display.AngularObject; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.remote.AppendOutputRunner; import org.apache.zeppelin.interpreter.remote.InvokeResourceMethodEventMessage; import org.apache.zeppelin.interpreter.remote.RemoteAngularObject; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils; -import org.apache.zeppelin.interpreter.thrift.AppOutputAppendEvent; -import org.apache.zeppelin.interpreter.thrift.AppOutputUpdateEvent; -import org.apache.zeppelin.interpreter.thrift.AppStatusUpdateEvent; import org.apache.zeppelin.interpreter.thrift.InterpreterRPCException; import org.apache.zeppelin.interpreter.thrift.LibraryMetadata; import org.apache.zeppelin.interpreter.thrift.ParagraphInfo; @@ -90,15 +86,12 @@ public class RemoteInterpreterEventServer implements RemoteInterpreterEventServi private ScheduledFuture appendFuture; private AppendOutputRunner runner; private final RemoteInterpreterProcessListener listener; - private final ApplicationEventListener appListener; - public RemoteInterpreterEventServer(ZeppelinConfiguration zConf, InterpreterSettingManager interpreterSettingManager) { this.zConf = zConf; this.interpreterSettingManager = interpreterSettingManager; this.listener = interpreterSettingManager.getRemoteInterpreterProcessListener(); - this.appListener = interpreterSettingManager.getAppEventListener(); } public void start() throws IOException { @@ -217,27 +210,16 @@ public void sendWebUrl(WebUrlInfo weburlInfo) throws InterpreterRPCException, TE @Override public void appendOutput(OutputAppendEvent event) throws InterpreterRPCException, TException { - if (event.getAppId() == null) { - runner.appendBuffer(event.getNoteId(), event.getParagraphId(), event.getIndex(), - event.getExecutionOwner(), event.getData()); - } else { - appListener.onOutputAppend(event.getNoteId(), event.getParagraphId(), event.getIndex(), - event.getAppId(), event.getData()); - } + runner.appendBuffer(event.getNoteId(), event.getParagraphId(), event.getIndex(), + event.getExecutionOwner(), event.getData()); } @Override public void updateOutput(OutputUpdateEvent event) throws InterpreterRPCException, TException { - if (event.getAppId() == null) { - runner.updateBuffer(event.getNoteId(), event.getParagraphId(), event.getIndex(), - event.getExecutionOwner(), InterpreterResult.Type.valueOf(event.getType()), - event.getData()); - // Complete replacements before the interpreter can publish its terminal result. - runner.run(); - } else { - appListener.onOutputUpdated(event.getNoteId(), event.getParagraphId(), event.getIndex(), - event.getAppId(), InterpreterResult.Type.valueOf(event.getType()), event.getData()); - } + runner.updateBuffer(event.getNoteId(), event.getParagraphId(), event.getIndex(), + event.getExecutionOwner(), InterpreterResult.Type.valueOf(event.getType()), event.getData()); + // Complete replacements before the interpreter can publish its terminal result. + runner.run(); } @Override @@ -256,23 +238,6 @@ public void updateAllOutput(OutputUpdateAllEvent event) throws InterpreterRPCExc } } - @Override - public void appendAppOutput(AppOutputAppendEvent event) throws InterpreterRPCException, TException { - appListener.onOutputAppend(event.noteId, event.paragraphId, event.index, event.appId, - event.data); - } - - @Override - public void updateAppOutput(AppOutputUpdateEvent event) throws InterpreterRPCException, TException { - appListener.onOutputUpdated(event.noteId, event.paragraphId, event.index, event.appId, - InterpreterResult.Type.valueOf(event.type), event.data); - } - - @Override - public void updateAppStatus(AppStatusUpdateEvent event) throws InterpreterRPCException, TException { - appListener.onStatusChange(event.noteId, event.paragraphId, event.appId, event.status); - } - @Override public void checkpointOutput(String noteId, String paragraphId) throws InterpreterRPCException, TException { // Drain replacements before checkpointing. diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/recovery/StopInterpreter.java b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/recovery/StopInterpreter.java index d7b710a1305..83130a90d59 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/recovery/StopInterpreter.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/recovery/StopInterpreter.java @@ -44,7 +44,7 @@ public StopInterpreter(ZeppelinConfiguration zConf) throws IOException { ConfigStorage storage = ConfigStorage.createConfigStorage(zConf); PluginManager pluginManager = new PluginManager(zConf); InterpreterSettingManager interpreterSettingManager = - new InterpreterSettingManager(zConf, null, null, null, storage, pluginManager); + new InterpreterSettingManager(zConf, null, null, storage, pluginManager); RecoveryStorage recoveryStorage = ReflectionUtils.createClazzInstance(zConf.getRecoveryStorageClass(), diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/ApplicationState.java b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/ApplicationState.java deleted file mode 100644 index 6969c5b764f..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/ApplicationState.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.notebook; - -import org.apache.zeppelin.helium.HeliumPackage; - -/** - * Current state of application - */ -public class ApplicationState { - - /** - * Status of Application - */ - public enum Status { - LOADING, - LOADED, - UNLOADING, - UNLOADED, - ERROR - } - - Status status = Status.UNLOADED; - - String id; // unique id for this instance. Similar to note id or paragraph id - HeliumPackage pkg; - String output; - - public ApplicationState(String id, HeliumPackage pkg) { - this.id = id; - this.pkg = pkg; - } - - /** - * After ApplicationState is restored from NotebookRepo, - * such as after Zeppelin daemon starts or Notebook import, - * Application status need to be reset. - */ - public void resetStatus() { - if (status != Status.ERROR) { - status = Status.UNLOADED; - } - } - - - @Override - public boolean equals(Object o) { - if (o instanceof ApplicationState) { - return pkg.equals(((ApplicationState) o).getHeliumPackage()); - } else if (o instanceof HeliumPackage) { - return pkg.equals(o); - } else { - return false; - } - } - - @Override - public int hashCode() { - return pkg.hashCode(); - } - - public String getId() { - return id; - } - - public void setStatus(Status status) { - this.status = status; - } - - public Status getStatus() { - return status; - } - - public String getOutput() { - return output; - } - - public void setOutput(String output) { - this.output = output; - } - - public synchronized void appendOutput(String output) { - if (this.output == null) { - this.output = output; - } else { - this.output += output; - } - } - - public HeliumPackage getHeliumPackage() { - return pkg; - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Note.java b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Note.java index 22c49dffb11..ea6f40af554 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Note.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Note.java @@ -862,25 +862,8 @@ private void removeAllAngularObjectInParagraph(String user, String paragraphId) if (registry instanceof RemoteAngularObjectRegistry) { // remove paragraph scope object ((RemoteAngularObjectRegistry) registry).removeAllAndNotifyRemoteProcess(id, paragraphId); - - // remove app scope object - List appStates = getParagraph(paragraphId).getAllApplicationStates(); - if (appStates != null) { - for (ApplicationState app : appStates) { - ((RemoteAngularObjectRegistry) registry) - .removeAllAndNotifyRemoteProcess(id, app.getId()); - } - } } else { registry.removeAll(id, paragraphId); - - // remove app scope object - List appStates = getParagraph(paragraphId).getAllApplicationStates(); - if (appStates != null) { - for (ApplicationState app : appStates) { - registry.removeAll(id, app.getId()); - } - } } } } @@ -1068,15 +1051,6 @@ public void postProcessParagraphs() { if (p.getStatus() == Status.RUNNING && !zConf.isRecoveryEnabled()) { p.setStatus(Status.ABORT); } - - List appStates = p.getAllApplicationStates(); - if (appStates != null) { - for (ApplicationState app : appStates) { - if (app.getStatus() != ApplicationState.Status.ERROR) { - app.setStatus(ApplicationState.Status.UNLOADED); - } - } - } } } diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java index deb5dd401f5..26cd8ffad4a 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java @@ -17,6 +17,8 @@ package org.apache.zeppelin.notebook; +import com.google.gson.JsonArray; + import java.io.IOException; import java.security.SecureRandom; import java.util.ArrayList; @@ -24,7 +26,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -36,7 +37,6 @@ import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.GUI; import org.apache.zeppelin.display.Input; -import org.apache.zeppelin.helium.HeliumPackage; import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.ExecutionContext; import org.apache.zeppelin.interpreter.Interpreter; @@ -81,8 +81,8 @@ public class Paragraph extends JobWithProgressPoller implemen // form and parameter settings public GUI settings = new GUI(); private InterpreterResult results; - // Application states in this paragraph - private final List apps = new LinkedList<>(); + // Preserve legacy application metadata when a notebook is read and saved. + private JsonArray apps; /************** Transient fields which are not serializabled into note json **************/ private transient String intpText; @@ -596,44 +596,6 @@ public void setReturn(InterpreterResult value, Throwable t) { setException(t); } - private String getApplicationId(HeliumPackage pkg) { - return "app_" + getNote().getId() + "-" + getId() + pkg.getName().replaceAll("\\.", "_"); - } - - public ApplicationState createOrGetApplicationState(HeliumPackage pkg) { - synchronized (apps) { - for (ApplicationState as : apps) { - if (as.equals(pkg)) { - return as; - } - } - - String appId = getApplicationId(pkg); - ApplicationState appState = new ApplicationState(appId, pkg); - apps.add(appState); - return appState; - } - } - - - public ApplicationState getApplicationState(String appId) { - synchronized (apps) { - for (ApplicationState as : apps) { - if (as.getId().equals(appId)) { - return as; - } - } - } - - return null; - } - - public List getAllApplicationStates() { - synchronized (apps) { - return new LinkedList<>(apps); - } - } - String extractVariablesFromAngularRegistry(String scriptBody, Map inputs, AngularObjectRegistry angularRegistry) { diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/HeliumRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/HeliumRestApi.java deleted file mode 100644 index b67ad1f9f04..00000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/HeliumRestApi.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.rest; - -import com.google.gson.Gson; -import com.google.gson.JsonParseException; -import com.google.gson.reflect.TypeToken; - -import jakarta.inject.Inject; -import jakarta.inject.Singleton; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.Response; - -import org.apache.zeppelin.helium.Helium; -import org.apache.zeppelin.helium.HeliumPackage; -import org.apache.zeppelin.helium.HeliumPackageSearchResult; -import org.apache.zeppelin.notebook.Notebook; -import org.apache.zeppelin.notebook.Paragraph; -import org.apache.zeppelin.server.JsonResponse; - -/** - * Helium Rest Api. - */ -@Path("/helium") -@Produces("application/json") -@Singleton -public class HeliumRestApi { - private static final Logger LOGGER = LoggerFactory.getLogger(HeliumRestApi.class); - - private final Helium helium; - private final Notebook notebook; - private final Gson gson = new Gson(); - - @Inject - public HeliumRestApi(Helium helium, Notebook notebook) { - this.helium = helium; - this.notebook = notebook; - } - - /** - * Get all packages info. - */ - @GET - @Path("package") - public Response getAllPackageInfo() { - try { - return new JsonResponse<>(Response.Status.OK, "", helium.getAllPackageInfo()).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - /** - * Get all enabled packages info. - */ - @GET - @Path("enabledPackage") - public Response getAllEnabledPackageInfo() { - try { - return new JsonResponse<>(Response.Status.OK, "", helium.getAllEnabledPackages()).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - /** - * Get single package info. - */ - @GET - @Path("package/{packageName}") - public Response getSinglePackageInfo(@PathParam("packageName") String packageName) { - if (StringUtils.isEmpty(packageName)) { - return new JsonResponse<>(Response.Status.BAD_REQUEST, - "Can't get package info for empty name").build(); - } - - try { - return new JsonResponse<>( - Response.Status.OK, "", helium.getSinglePackageInfo(packageName)).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @GET - @Path("suggest/{noteId}/{paragraphId}") - public Response suggest(@PathParam("noteId") String noteId, - @PathParam("paragraphId") String paragraphId) { - try { - return notebook.processNote(noteId, - note -> { - if (note == null) { - return new JsonResponse<>(Response.Status.NOT_FOUND, "Note " + noteId + " not found").build(); - } - - Paragraph paragraph = note.getParagraph(paragraphId); - if (paragraph == null) { - return new JsonResponse<>(Response.Status.NOT_FOUND, "Paragraph " + paragraphId + " not found") - .build(); - } - try { - return new JsonResponse<>(Response.Status.OK, "", helium.suggestApp(paragraph)).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - }); - } catch (IOException e) { - return new JsonResponse<>(Response.Status.NOT_FOUND, - "Fail to get note: " + noteId + "\n" + ExceptionUtils.getStackTrace(e)).build(); - } - } - - @POST - @Path("load/{noteId}/{paragraphId}") - public Response load(@PathParam("noteId") String noteId, - @PathParam("paragraphId") String paragraphId, String heliumPackage) { - try { - return notebook.processNote(noteId, - note -> { - if (note == null) { - return new JsonResponse<>(Response.Status.NOT_FOUND, "Note " + noteId + " not found").build(); - } - Paragraph paragraph = note.getParagraph(paragraphId); - if (paragraph == null) { - return new JsonResponse<>(Response.Status.NOT_FOUND, "Paragraph " + paragraphId + " not found") - .build(); - } - HeliumPackage pkg = HeliumPackage.fromJson(heliumPackage); - try { - return new JsonResponse<>(Response.Status.OK, "", - helium.getApplicationFactory().loadAndRun(pkg, paragraph)).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - }); - } catch (IOException e) { - return new JsonResponse<>(Response.Status.NOT_FOUND, - "Fail to get note: " + noteId + "\n" + ExceptionUtils.getStackTrace(e)).build(); - } - - - - } - - @GET - @Path("bundle/load/{packageName}") - @Produces("text/javascript") - public Response bundleLoad(@QueryParam("refresh") String refresh, - @PathParam("packageName") String packageName) { - if (StringUtils.isEmpty(packageName)) { - return new JsonResponse<>( - Response.Status.BAD_REQUEST, - "Can't get bundle due to empty package name").build(); - } - - HeliumPackageSearchResult psr = null; - List enabledPackages = helium.getAllEnabledPackages(); - for (HeliumPackageSearchResult e : enabledPackages) { - if (e.getPkg().getName().equals(packageName)) { - psr = e; - break; - } - } - - if (psr == null) { - // return empty to specify - return Response.ok().build(); - } - - try { - File bundle; - boolean rebuild = (refresh != null && refresh.equals("true")); - bundle = helium.getBundle(psr.getPkg(), rebuild); - - if (bundle == null) { - return Response.ok().build(); - } else { - String stringified = FileUtils.readFileToString(bundle, StandardCharsets.UTF_8); - return Response.ok(stringified).build(); - } - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - // returning error will prevent zeppelin front-end render any notebook. - // visualization load fail doesn't need to block notebook rendering work. - // so it's better return ok instead of any error. - return Response.ok("ERROR: " + e.getMessage()).build(); - } - } - - @POST - @Path("enable/{packageName}") - public Response enablePackage(@PathParam("packageName") String packageName, String artifact) { - try { - if (helium.enable(packageName, artifact)) { - return new JsonResponse<>(Response.Status.OK).build(); - } else { - return new JsonResponse<>(Response.Status.NOT_FOUND).build(); - } - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @POST - @Path("disable/{packageName}") - public Response disablePackage(@PathParam("packageName") String packageName) { - try { - if (helium.disable(packageName)) { - return new JsonResponse<>(Response.Status.OK).build(); - } else { - return new JsonResponse<>(Response.Status.NOT_FOUND).build(); - } - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @GET - @Path("spell/config/{packageName}") - public Response getSpellConfigUsingMagic(@PathParam("packageName") String packageName) { - if (StringUtils.isEmpty(packageName)) { - return new JsonResponse<>(Response.Status.BAD_REQUEST, "packageName is empty").build(); - } - - try { - Map> config = - helium.getSpellConfig(packageName); - - if (config == null) { - return new JsonResponse<>(Response.Status.BAD_REQUEST, - "Failed to find enabled package for " + packageName).build(); - } - - return new JsonResponse<>(Response.Status.OK, config).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @GET - @Path("config") - public Response getAllPackageConfigs() { - try { - Map> config = helium.getAllPackageConfig(); - return new JsonResponse<>(Response.Status.OK, config).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @GET - @Path("config/{packageName}/{artifact}") - public Response getPackageConfig(@PathParam("packageName") String packageName, - @PathParam("artifact") String artifact) { - if (StringUtils.isEmpty(packageName) || StringUtils.isEmpty(artifact)) { - return new JsonResponse<>(Response.Status.BAD_REQUEST, - "package name or artifact is empty" - ).build(); - } - - try { - Map> config = - helium.getPackageConfig(packageName, artifact); - - if (config == null) { - return new JsonResponse<>(Response.Status.BAD_REQUEST, - "Failed to find package for " + artifact).build(); - } - - return new JsonResponse<>(Response.Status.OK, config).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @POST - @Path("config/{packageName}/{artifact}") - public Response updatePackageConfig(@PathParam("packageName") String packageName, - @PathParam("artifact") String artifact, String rawConfig) { - if (StringUtils.isEmpty(packageName) || StringUtils.isEmpty(artifact)) { - return new JsonResponse<>(Response.Status.BAD_REQUEST, - "package name or artifact is empty" - ).build(); - } - - try { - Map packageConfig = gson.fromJson( - rawConfig, new TypeToken>(){}.getType()); - helium.updatePackageConfig(artifact, packageConfig); - return new JsonResponse<>(Response.Status.OK, packageConfig).build(); - } catch (JsonParseException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.BAD_REQUEST, - e.getMessage()).build(); - } catch (IOException | RuntimeException e) { - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, - e.getMessage()).build(); - } - } - - @GET - @Path("order/visualization") - public Response getVisualizationPackageOrder() { - try { - List order = helium.getVisualizationPackageOrder(); - return new JsonResponse<>(Response.Status.OK, order).build(); - } catch (RuntimeException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } - - @POST - @Path("order/visualization") - public Response setVisualizationPackageOrder(String orderedPackageNameList) { - List orderedList = gson.fromJson( - orderedPackageNameList, new TypeToken>(){}.getType()); - try { - helium.setVisualizationPackageOrder(orderedList); - return new JsonResponse<>(Response.Status.OK).build(); - } catch (IOException e) { - LOGGER.error(e.getMessage(), e); - return new JsonResponse<>(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); - } - } -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/server/RestApiApplication.java b/zeppelin-server/src/main/java/org/apache/zeppelin/server/RestApiApplication.java index 79ecf80f84d..173117f8833 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/server/RestApiApplication.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/server/RestApiApplication.java @@ -28,7 +28,6 @@ import org.apache.zeppelin.rest.AdminRestApi; import org.apache.zeppelin.rest.ConfigurationsRestApi; import org.apache.zeppelin.rest.CredentialRestApi; -import org.apache.zeppelin.rest.HeliumRestApi; import org.apache.zeppelin.rest.InterpreterRestApi; import org.apache.zeppelin.rest.LoginRestApi; import org.apache.zeppelin.rest.NotebookRepoRestApi; @@ -50,7 +49,6 @@ public Set> getClasses() { s.add(AdminRestApi.class); s.add(ConfigurationsRestApi.class); s.add(CredentialRestApi.class); - s.add(HeliumRestApi.class); s.add(InterpreterRestApi.class); s.add(LoginRestApi.class); s.add(NotebookRepoRestApi.class); 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 06924121b47..402cecc1101 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 @@ -68,10 +68,6 @@ import org.apache.zeppelin.eventbus.NoOpEventBus; import org.apache.zeppelin.eventbus.ZeppelinEventBus; import org.apache.zeppelin.healthcheck.HealthChecks; -import org.apache.zeppelin.helium.ApplicationEventListener; -import org.apache.zeppelin.helium.Helium; -import org.apache.zeppelin.helium.HeliumApplicationFactory; -import org.apache.zeppelin.helium.HeliumBundleFactory; import org.apache.zeppelin.interpreter.InterpreterFactory; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; @@ -192,7 +188,6 @@ protected void configure() { } bindAsContract(InterpreterFactory.class).in(Singleton.class); bindAsContract(NotebookRepoSync.class).to(NotebookRepo.class).in(Singleton.class); - bindAsContract(Helium.class).in(Singleton.class); bind(zConf).to(ZeppelinConfiguration.class); bindAsContract(InterpreterSettingManager.class).in(Singleton.class); bindAsContract(InterpreterService.class).in(Singleton.class); @@ -204,8 +199,6 @@ protected void configure() { bind(AuthenticationServiceFactory.getAuthServiceClass(zConf)) .to(AuthenticationService.class) .in(Singleton.class); - bindAsContract(HeliumBundleFactory.class).in(Singleton.class); - bindAsContract(HeliumApplicationFactory.class).in(Singleton.class); bindAsContract(ConfigurationService.class).in(Singleton.class); bindAsContract(NotebookService.class).in(Singleton.class); bindAsContract(JobManagerService.class).in(Singleton.class); @@ -213,7 +206,6 @@ protected void configure() { bindAsContract(NotebookServer.class) .to(AngularObjectRegistryListener.class) .to(RemoteInterpreterProcessListener.class) - .to(ApplicationEventListener.class) .to(NoteEventListener.class) .in(Singleton.class); if (zConf.isZeppelinNotebookCronEnable()) { 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 0e1cdfcdabe..7b509e8bda2 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 @@ -15,18 +15,14 @@ * limitations under the License. */ - package org.apache.zeppelin.service; - import static org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_HOMESCREEN; import static org.apache.zeppelin.interpreter.InterpreterResult.Code.ERROR; import static org.apache.zeppelin.scheduler.Job.Status.ABORT; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; @@ -1371,63 +1367,6 @@ public List renameFolder(String folderPath, } } - public void spell(String noteId, - Message message, - ServiceContext context, - ServiceCallback callback) throws IOException { - - try { - if (!checkPermission(noteId, Permission.RUNNER, Message.OP.RUN_PARAGRAPH_USING_SPELL, context, - callback)) { - return; - } - - String paragraphId = (String) message.get("id"); - if (paragraphId == null) { - return; - } - - String text = (String) message.get("paragraph"); - String title = (String) message.get("title"); - Job.Status status = Job.Status.valueOf((String) message.get("status")); - Map params = (Map) message.get("params"); - Map config = (Map) message.get("config"); - notebook.processNote(noteId, - note -> { - Paragraph p = setParagraphUsingMessage(note, message, paragraphId, - text, title, params, config); - p.setResult((InterpreterResult) message.get("results")); - p.setErrorMessage((String) message.get("errorMessage")); - p.setStatusWithoutNotification(status); - - // Spell uses ISO 8601 formatted string generated from moment - String dateStarted = (String) message.get("dateStarted"); - String dateFinished = (String) message.get("dateFinished"); - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); - - try { - p.setDateStarted(df.parse(dateStarted)); - } catch (ParseException e) { - LOGGER.error("Failed parse dateStarted", e); - } - - try { - p.setDateFinished(df.parse(dateFinished)); - } catch (ParseException e) { - LOGGER.error("Failed parse dateFinished", e); - } - - addNewParagraphIfLastParagraphIsExecuted(note, p); - notebook.saveNote(note, context.getAutheInfo()); - callback.onSuccess(p, context); - return null; - }); - } catch (IOException e) { - callback.onFailure(new IOException("Fail to run spell", e), context); - } - - } - private void addNewParagraphIfLastParagraphIsExecuted(Note note, Paragraph p) { // if it's the last paragraph and not empty, let's add a new one boolean isTheLastParagraph = note.isLastParagraph(p.getId()); diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java index ca1c1756f11..d7a853982eb 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java @@ -70,8 +70,6 @@ import org.apache.zeppelin.display.Input; import org.apache.zeppelin.eventbus.EventBus; import org.apache.zeppelin.eventbus.NoteRemovedEvent; -import org.apache.zeppelin.helium.ApplicationEventListener; -import org.apache.zeppelin.helium.HeliumPackage; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterSetting; @@ -125,7 +123,6 @@ @ServerEndpoint(value = "/ws") public class NotebookServer implements AngularObjectRegistryListener, RemoteInterpreterProcessListener, - ApplicationEventListener, ParagraphJobListener, NoteEventListener, AutoCloseable { @@ -511,9 +508,6 @@ public void onMessage(NotebookSocket conn, String msg) { case RUN_PARAGRAPH: runParagraph(conn, context, receivedMessage); break; - case PARAGRAPH_EXECUTED_BY_SPELL: - broadcastSpellExecution(conn, context, receivedMessage); - break; case RUN_ALL_PARAGRAPHS: runAllParagraphs(conn, context, receivedMessage); break; @@ -1703,23 +1697,6 @@ private void runAllParagraphs(NotebookSocket conn, }); } - private void broadcastSpellExecution(NotebookSocket conn, - ServiceContext context, - Message fromMessage) throws IOException { - - String noteId = connectionManager.getAssociatedNoteId(conn); - getNotebookService().spell(noteId, fromMessage, - context, new WebSocketServiceCallback(conn) { - @Override - public void onSuccess(Paragraph p, ServiceContext context) throws IOException { - super.onSuccess(p, context); - // broadcast to other clients only - connectionManager.broadcastExcept(p.getNote().getId(), - new Message(OP.RUN_PARAGRAPH_USING_SPELL).put("paragraph", p), conn); - } - }); - } - private void runParagraph(NotebookSocket conn, ServiceContext context, Message fromMessage) throws IOException { @@ -1993,50 +1970,6 @@ public void onParagraphOutputClear(String noteId, String paragraphId, String exe } } - /** - * When application append output. - */ - @Override - public void onOutputAppend(String noteId, String paragraphId, int index, String appId, - String output) { - Message msg = - new Message(OP.APP_APPEND_OUTPUT).put("noteId", noteId).put("paragraphId", paragraphId) - .put("index", index).put("appId", appId).put("data", output); - connectionManager.broadcast(noteId, msg); - } - - /** - * When application update output. - */ - @Override - public void onOutputUpdated(String noteId, String paragraphId, int index, String appId, - InterpreterResult.Type type, String output) { - Message msg = - new Message(OP.APP_UPDATE_OUTPUT) - .put("noteId", noteId) - .put("paragraphId", paragraphId) - .put("index", index) - .put("type", type) - .put("appId", appId) - .put("data", output); - connectionManager.broadcast(noteId, msg); - } - - @Override - public void onLoad(String noteId, String paragraphId, String appId, HeliumPackage pkg) { - Message msg = new Message(OP.APP_LOAD).put("noteId", noteId).put("paragraphId", paragraphId) - .put("appId", appId).put("pkg", pkg); - connectionManager.broadcast(noteId, msg); - } - - @Override - public void onStatusChange(String noteId, String paragraphId, String appId, String status) { - Message msg = - new Message(OP.APP_STATUS_CHANGE).put("noteId", noteId).put("paragraphId", paragraphId) - .put("appId", appId).put("status", status); - connectionManager.broadcast(noteId, msg); - } - @Override public void runParagraphs(String noteId, List paragraphIndices, diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java b/zeppelin-server/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java index 6c9692dd8ff..d25fe954f68 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java @@ -33,9 +33,8 @@ * Interface for storing zeppelin configuration. * * 1. interpreter-setting.json - * 2. helium.json - * 3. notebook-authorization.json - * 4. credentials.json + * 2. notebook-authorization.json + * 3. credentials.json * */ public abstract class ConfigStorage { diff --git a/zeppelin-server/src/main/resources/helium/package.json b/zeppelin-server/src/main/resources/helium/package.json deleted file mode 100644 index 610beeb8001..00000000000 --- a/zeppelin-server/src/main/resources/helium/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "PACKAGE_NAME", - "main": "MAIN_FILE", - "scripts": { - "bundle": "webpack --display-error-details --json" - }, - "dependencies": { -DEPENDENCIES - }, - "devDependencies": { - "webpack": "^1.12.2", - "babel-core": "^6.23.1", - "babel-loader": "^6.3.2", - "babel-preset-env": "^1.4.0", - "css-loader": "^0.26.2", - "style-loader": "^0.13.2", - "url-loader": "^0.5.8", - "file-loader": "^0.10.1", - "json-loader": "^0.5.4" - } -} diff --git a/zeppelin-server/src/main/resources/helium/webpack.config.js b/zeppelin-server/src/main/resources/helium/webpack.config.js deleted file mode 100644 index e897a162e63..00000000000 --- a/zeppelin-server/src/main/resources/helium/webpack.config.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -module.exports = { - entry: './src/load.js', - output: { path: './', filename: 'helium.bundle.js', }, - module: { - loaders: [ - { - test: /\.js$/, - loader: 'babel-loader', - exclude: /node_modules\/(?!(zeppelin-spell|zeppelin-vis|zeppelin-tabledata)\/).*/, - query: { - presets: [ - [ - "env", - { - "targets": { - "browsers": ["last 5 version", "> 5%", "edge >= 12", "ie >= 9", "safari 7", "chrome 47", "firefox 31"] - } - } - ] - ] - }, - }, - { test: /(\.css)$/, loaders: ['style', 'css?sourceMap&importLoaders=1'], }, - { test: /\.woff(\?\S*)?$/, loader: 'url-loader?limit=10000&minetype=application/font-woff', }, - { test: /\.woff2(\?\S*)?$/, loader: 'url-loader?limit=10000&minetype=application/font-woff', }, - { test: /\.eot(\?\S*)?$/, loader: 'url-loader', }, { - test: /\.ttf(\?\S*)?$/, loader: 'url-loader', }, { - test: /\.svg(\?\S*)?$/, loader: 'url-loader', }, { - test: /\.png(\?\S*)?$/, loader: 'url-loader', }, { - test: /\.jpg(\?\S*)?$/, loader: 'url-loader', }, { - test: /\.json$/, loader: 'json-loader' }, ], - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java deleted file mode 100644 index d66662ebfad..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.Mockito.mock; - -import java.io.IOException; -import java.util.ArrayList; - -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.interpreter.AbstractInterpreterTest; -import org.apache.zeppelin.interpreter.InterpreterException; -import org.apache.zeppelin.interpreter.InterpreterNotFoundException; -import org.apache.zeppelin.interpreter.InterpreterSetting; -import org.apache.zeppelin.notebook.ApplicationState; -import org.apache.zeppelin.notebook.AuthorizationService; -import org.apache.zeppelin.notebook.Note; -import org.apache.zeppelin.notebook.NoteManager; -import org.apache.zeppelin.notebook.Notebook; -import org.apache.zeppelin.notebook.Paragraph; -import org.apache.zeppelin.notebook.repo.NotebookRepo; -import org.apache.zeppelin.user.AuthenticationInfo; -import org.apache.zeppelin.user.Credentials; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -class HeliumApplicationFactoryTest extends AbstractInterpreterTest { - - private NotebookRepo notebookRepo; - private Notebook notebook; - private HeliumApplicationFactory heliumAppFactory; - private AuthenticationInfo anonymous; - - @Override - @BeforeEach - public void setUp() throws Exception { - super.setUp(); - - // set AppEventListener properly - for (InterpreterSetting interpreterSetting : interpreterSettingManager.get()) { - interpreterSetting.setAppEventListener(heliumAppFactory); - } - - AuthorizationService authorizationService = mock(AuthorizationService.class); - notebookRepo = mock(NotebookRepo.class); - notebook = - new Notebook( - zConf, - authorizationService, - notebookRepo, - new NoteManager(notebookRepo, ZeppelinConfiguration.load()), - interpreterFactory, - interpreterSettingManager, - new Credentials(), - eventBus); - - heliumAppFactory = new HeliumApplicationFactory(notebook, null); - - notebook.addNotebookEventListener(heliumAppFactory); - - anonymous = new AuthenticationInfo("anonymous"); - } - - @Override - @AfterEach - public void tearDown() throws Exception { - super.tearDown(); - } - - - @Test - @Disabled - void testLoadRunUnloadApplication() - throws IOException, ApplicationException, InterruptedException { - // given - HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, - "name1", - "desc1", - "", - HeliumTestApplication.class.getName(), - new String[][]{}, - "", ""); - - String note1Id = notebook.createNote("note1", anonymous); - Note note1 = notebook.processNote(note1Id, - note1Tmp -> { - return note1Tmp; - }); - Paragraph p1 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); - // make sure interpreter process running - p1.setText("%mock1 job"); - p1.setAuthenticationInfo(anonymous); - note1.run(p1.getId()); - - while(p1.isTerminated()==false || p1.getReturn()==null) Thread.yield(); - - assertEquals("repl1: job", p1.getReturn().message().get(0).getData()); - - // when - assertEquals(0, p1.getAllApplicationStates().size()); - String appId = heliumAppFactory.loadAndRun(pkg1, p1); - assertEquals(1, p1.getAllApplicationStates().size()); - ApplicationState app = p1.getApplicationState(appId); - Thread.sleep(500); // wait for enough time - - // then - assertEquals("Hello world 1", app.getOutput()); - - // when - heliumAppFactory.run(p1, appId); - Thread.sleep(500); // wait for enough time - - // then - assertEquals("Hello world 2", app.getOutput()); - - // clean - heliumAppFactory.unload(p1, appId); - notebook.removeNote(note1.getId(), anonymous); - } - - @Test - @Disabled - void testUnloadOnParagraphRemove() throws IOException { - // given - HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, - "name1", - "desc1", - "", - HeliumTestApplication.class.getName(), - new String[][]{}, - "", ""); - - String note1Id = notebook.createNote("note1", anonymous); - Note note1 = notebook.processNote(note1Id, - note1Tmp -> { - return note1Tmp; - }); - Paragraph p1 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); - - // make sure interpreter process running - p1.setText("%mock1 job"); - p1.setAuthenticationInfo(anonymous); - note1.run(p1.getId()); - while(p1.isTerminated()==false || p1.getReturn()==null) Thread.yield(); - - assertEquals(0, p1.getAllApplicationStates().size()); - String appId = heliumAppFactory.loadAndRun(pkg1, p1); - ApplicationState app = p1.getApplicationState(appId); - while (app.getStatus() != ApplicationState.Status.LOADED) { - Thread.yield(); - } - - // when remove paragraph - note1.removeParagraph("user", p1.getId()); - - // then - assertEquals(ApplicationState.Status.UNLOADED, app.getStatus()); - - // clean - notebook.removeNote(note1.getId(), anonymous); - } - - - @Test - @Disabled - void testUnloadOnInterpreterUnbind() throws IOException { - // given - HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, - "name1", - "desc1", - "", - HeliumTestApplication.class.getName(), - new String[][]{}, - "", ""); - - String note1Id = notebook.createNote("note1", anonymous); - Note note1 = notebook.processNote(note1Id, - note1Tmp -> { - return note1Tmp; - }); - - Paragraph p1 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); - - // make sure interpreter process running - p1.setText("%mock1 job"); - p1.setAuthenticationInfo(anonymous); - note1.run(p1.getId()); - while(p1.isTerminated()==false || p1.getReturn()==null) Thread.yield(); - - assertEquals(0, p1.getAllApplicationStates().size()); - String appId = heliumAppFactory.loadAndRun(pkg1, p1); - ApplicationState app = p1.getApplicationState(appId); - while (app.getStatus() != ApplicationState.Status.LOADED) { - Thread.yield(); - } - - // then - assertEquals(ApplicationState.Status.UNLOADED, app.getStatus()); - - // clean - notebook.removeNote(note1.getId(), anonymous); - } - - @Test - @Disabled - void testInterpreterUnbindOfNullReplParagraph() throws IOException { - // create note - String note1Id = notebook.createNote("note1", anonymous); - Note note1 = notebook.processNote(note1Id, - note1Tmp -> { - return note1Tmp; - }); - - // add paragraph with invalid magic - Paragraph p1 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); - p1.setText("%fake "); - - // make sure that p1's repl is null - try { - p1.getBindedInterpreter(); - fail("Should throw InterpreterNotFoundException"); - } catch (InterpreterNotFoundException e) { - - } - - // remove note - notebook.removeNote(note1.getId(), anonymous); - } - - - @Test - @Disabled - void testUnloadOnInterpreterRestart() throws IOException, InterpreterException { - // given - HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, - "name1", - "desc1", - "", - HeliumTestApplication.class.getName(), - new String[][]{}, - "", ""); - - String note1Id = notebook.createNote("note1", anonymous); - Note note1 = notebook.processNote(note1Id, - note1Tmp -> { - return note1Tmp; - }); - String mock1IntpSettingId = null; - for (InterpreterSetting setting : note1.getBindedInterpreterSettings(new ArrayList<>())) { - if (setting.getName().equals("mock1")) { - mock1IntpSettingId = setting.getId(); - break; - } - } - - Paragraph p1 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); - - // make sure interpreter process running - p1.setText("%mock1 job"); - p1.setAuthenticationInfo(anonymous); - note1.run(p1.getId()); - while(p1.isTerminated()==false || p1.getReturn()==null) Thread.yield(); - assertEquals(0, p1.getAllApplicationStates().size()); - String appId = heliumAppFactory.loadAndRun(pkg1, p1); - ApplicationState app = p1.getApplicationState(appId); - while (app.getStatus() != ApplicationState.Status.LOADED) { - Thread.yield(); - } - // wait until application is executed - while (!"Hello world 1".equals(app.getOutput())) { - Thread.yield(); - } - // when restart interpreter - interpreterSettingManager.restart(mock1IntpSettingId); - while (app.getStatus() == ApplicationState.Status.LOADED) { - Thread.yield(); - } - // then - assertEquals(ApplicationState.Status.UNLOADED, app.getStatus()); - - // clean - notebook.removeNote(note1.getId(), anonymous); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java deleted file mode 100644 index 0776b34b562..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import static org.apache.zeppelin.helium.HeliumBundleFactory.HELIUM_LOCAL_REPO; -import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.github.eirslett.maven.plugins.frontend.lib.InstallationException; -import com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException; -import com.google.common.io.Resources; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.LinkedList; -import java.util.List; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -class HeliumBundleFactoryTest { - private HeliumBundleFactory hbf; - private File nodeInstallationDir; - - @BeforeEach - public void setUp() throws InstallationException, TaskRunnerException, IOException { - ZeppelinConfiguration zConf = ZeppelinConfiguration.load(); - zConf.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), - new File("../").getAbsolutePath().toString()); - nodeInstallationDir = - new File(zConf.getAbsoluteDir(ConfVars.ZEPPELIN_DEP_LOCALREPO), HELIUM_LOCAL_REPO); - - hbf = new HeliumBundleFactory(zConf); - hbf.installNodeAndNpm(); - hbf.copyFrameworkModulesToInstallPath(true); - } - - - - @Test - void testInstallNpm() throws InstallationException { - assertTrue(new File(nodeInstallationDir, "/node/npm").isFile()); - assertTrue(new File(nodeInstallationDir, "/node/node").isFile()); - assertTrue(new File(nodeInstallationDir, "/node/yarn/dist/bin/yarn").isFile()); - } - - @Test - void downloadPackage() throws TaskRunnerException { - HeliumPackage pkg = - newHeliumPackage( - HeliumType.VISUALIZATION, - "lodash", - "lodash", - "lodash@3.9.3", - "", - null, - "license", - "icon"); - hbf.install(pkg); - System.out.println(new File(nodeInstallationDir, "/node_modules/lodash")); - assertTrue(new File(nodeInstallationDir, "/node_modules/lodash").isDirectory()); - } - - @Test - void bundlePackage() throws IOException, TaskRunnerException { - HeliumPackage pkg = - newHeliumPackage( - HeliumType.VISUALIZATION, - "zeppelin-bubblechart", - "zeppelin-bubblechart", - "zeppelin-bubblechart@0.0.3", - "", - null, - "license", - "icon"); - File bundle = hbf.buildPackage(pkg, true, true); - assertTrue(bundle.isFile()); - long lastModified = bundle.lastModified(); - - // buildBundle again and check if it served from cache - bundle = hbf.buildPackage(pkg, false, true); - assertEquals(lastModified, bundle.lastModified()); - } - - @Test - void bundleLocalPackage() throws IOException, TaskRunnerException { - URL res = Resources.getResource("helium/webpack.config.js"); - String resDir = new File(res.getFile()).getParent(); - String localPkg = resDir + "/../../../src/test/resources/helium/vis1"; - - HeliumPackage pkg = - newHeliumPackage( - HeliumType.VISUALIZATION, - "vis1", - "vis1", - localPkg, - "", - null, - "license", - "fa fa-coffee"); - File bundle = hbf.buildPackage(pkg, true, true); - assertTrue(bundle.isFile()); - } - - // TODO(zjffdu) Ignore flaky test, enable it later after fixing this flaky test - // @Test - public void bundleErrorPropagation() throws IOException, TaskRunnerException { - URL res = Resources.getResource("helium/webpack.config.js"); - String resDir = new File(res.getFile()).getParent(); - String localPkg = resDir + "/../../../src/test/resources/helium/vis2"; - - HeliumPackage pkg = - newHeliumPackage( - HeliumType.VISUALIZATION, - "vis2", - "vis2", - localPkg, - "", - null, - "license", - "fa fa-coffee"); - File bundle = null; - try { - bundle = hbf.buildPackage(pkg, true, true); - // should throw exception - assertTrue(false); - } catch (IOException e) { - assertTrue(e.getMessage().contains("error in the package")); - } - assertNull(bundle); - } - - @Test - void switchVersion() throws IOException, TaskRunnerException { - URL res = Resources.getResource("helium/webpack.config.js"); - String resDir = new File(res.getFile()).getParent(); - - HeliumPackage pkgV1 = - newHeliumPackage( - HeliumType.VISUALIZATION, - "zeppelin-bubblechart", - "zeppelin-bubblechart", - "zeppelin-bubblechart@0.0.3", - "", - null, - "license", - "icon"); - - HeliumPackage pkgV2 = - newHeliumPackage( - HeliumType.VISUALIZATION, - "zeppelin-bubblechart", - "zeppelin-bubblechart", - "zeppelin-bubblechart@0.0.1", - "", - null, - "license", - "icon"); - List pkgsV1 = new LinkedList<>(); - pkgsV1.add(pkgV1); - - List pkgsV2 = new LinkedList<>(); - pkgsV2.add(pkgV2); - - File bundle1 = hbf.buildPackage(pkgV1, true, true); - File bundle2 = hbf.buildPackage(pkgV2, true, true); - - assertNotSame(bundle1.lastModified(), bundle2.lastModified()); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java deleted file mode 100644 index d36727fbd18..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.google.gson.Gson; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; - -import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; -import static org.junit.jupiter.api.Assertions.assertEquals; - -class HeliumLocalRegistryTest { - private File tmpDir; - - @BeforeEach - public void setUp() throws Exception { - tmpDir = Files.createTempDirectory("ZeppelinLTest_").toFile(); - } - - @AfterEach - public void tearDown() throws IOException { - FileUtils.deleteDirectory(tmpDir); - } - - @Test - void testGetAllPackage() throws IOException { - // given - File r1Path = new File(tmpDir, "r1"); - HeliumLocalRegistry r1 = new HeliumLocalRegistry("r1", r1Path.getAbsolutePath()); - assertEquals(0, r1.getAll().size()); - - // when - Gson gson = new Gson(); - HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, - "app1", - "desc1", - "artifact1", - "classname1", - new String[][]{}, - "license", - ""); - FileUtils.writeStringToFile(new File(r1Path, "pkg1.json"), gson.toJson(pkg1), - StandardCharsets.UTF_8); - - // then - assertEquals(1, r1.getAll().size()); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java deleted file mode 100644 index 94c40a4e346..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.helium; - -import static org.junit.jupiter.api.Assertions.assertTrue; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; - -import org.apache.zeppelin.conf.ZeppelinConfiguration; - - -class HeliumOnlineRegistryTest { - // ip 192.168.65.17 belongs to private network - // request will be ended with connection time out error - private static final String IP = "192.168.65.17"; - private static final String TIMEOUT = "2000"; - - private File tmpDir; - - @BeforeEach - public void setUp() throws Exception { - tmpDir = Files.createTempDirectory("ZeppelinLTest").toFile(); - } - - @AfterEach - public void tearDown() throws IOException { - FileUtils.deleteDirectory(tmpDir); - } - - @Test - void zeppelinNotebookS3TimeoutPropertyTest() throws IOException { - ZeppelinConfiguration zConf = ZeppelinConfiguration.load(); - zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_TIMEOUT.getVarName(), TIMEOUT); - zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_ENDPOINT.getVarName(), IP); - HeliumOnlineRegistry heliumOnlineRegistry = new HeliumOnlineRegistry( - "https://" + IP, - "https://" + IP, - tmpDir, zConf - ); - - long start = System.currentTimeMillis(); - heliumOnlineRegistry.getAll(); - long processTime = System.currentTimeMillis() - start; - - long basicTimeout = Long.valueOf( - ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_TIMEOUT.getStringValue() - ); - assertTrue( - basicTimeout > processTime, - String.format( - "Wrong timeout during connection: expected %s, actual is about %d", - TIMEOUT, - processTime - ) - ); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTest.java deleted file mode 100644 index 199da95d7ce..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException; -import org.apache.commons.io.FileUtils; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.nio.file.Files; - -import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class HeliumTest { - private File tmpDir; - private File localRegistryPath; - private ZeppelinConfiguration zConf; - - @BeforeEach - public void setUp() throws Exception { - tmpDir = Files.createTempDirectory("ZeppelinLTest").toFile(); - zConf = ZeppelinConfiguration.load(); - tmpDir.mkdirs(); - localRegistryPath = new File(tmpDir, "helium"); - localRegistryPath.mkdirs(); - } - - @AfterEach - public void tearDown() throws IOException { - FileUtils.deleteDirectory(tmpDir); - } - - @Test - void testSaveLoadConf() throws IOException, URISyntaxException, TaskRunnerException { - // given - File heliumConf = new File(tmpDir, "helium.conf"); - Helium helium = new Helium(heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), - null, null, null, null, zConf); - assertFalse(heliumConf.exists()); - - // when - helium.saveConfig(); - - // then - assertTrue(heliumConf.exists()); - - // then load without exception - new Helium(heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), null, null, null, - null, zConf); - } - - @Test - void testRestoreRegistryInstances() throws IOException, URISyntaxException, TaskRunnerException { - File heliumConf = new File(tmpDir, "helium.conf"); - Helium helium = new Helium( - heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), null, null, null, null, - zConf); - HeliumTestRegistry registry1 = new HeliumTestRegistry("r1", "r1"); - HeliumTestRegistry registry2 = new HeliumTestRegistry("r2", "r2"); - helium.addRegistry(registry1); - helium.addRegistry(registry2); - - // when - registry1.add(newHeliumPackage( - HeliumType.APPLICATION, - "name1", - "desc1", - "artifact1", - "className1", - new String[][]{}, - "", - "")); - - registry2.add(newHeliumPackage( - HeliumType.APPLICATION, - "name2", - "desc2", - "artifact2", - "className2", - new String[][]{}, - "", - "")); - - // then - assertEquals(2, helium.getAllPackageInfo().size()); - } - - @Test - void testRefresh() throws IOException, URISyntaxException, TaskRunnerException { - File heliumConf = new File(tmpDir, "helium.conf"); - Helium helium = new Helium( - heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), null, null, null, null, - zConf); - HeliumTestRegistry registry1 = new HeliumTestRegistry("r1", "r1"); - helium.addRegistry(registry1); - - // when - registry1.add(newHeliumPackage( - HeliumType.APPLICATION, - "name1", - "desc1", - "artifact1", - "className1", - new String[][]{}, - "", - "")); - - // then - assertEquals(1, helium.getAllPackageInfo().size()); - - // when - registry1.add(newHeliumPackage( - HeliumType.APPLICATION, - "name2", - "desc2", - "artifact2", - "className2", - new String[][]{}, - "", - "")); - - // then - assertEquals(2, helium.getAllPackageInfo(true, null).size()); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTestApplication.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTestApplication.java deleted file mode 100644 index 2e66a3f0291..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTestApplication.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import org.apache.zeppelin.resource.ResourceSet; - -import java.io.IOException; -import java.util.concurrent.atomic.AtomicInteger; - -public class HeliumTestApplication extends Application { - private AtomicInteger numRun = new AtomicInteger(0); - public HeliumTestApplication(ApplicationContext context) { - super(context); - } - - @Override - public void run(ResourceSet args) throws ApplicationException { - try { - context().out.clear(); - context().out.write("Hello world " + numRun.incrementAndGet()); - context().out.flush(); - } catch (IOException e) { - throw new ApplicationException(e); - } - } - - @Override - public void unload() throws ApplicationException { - - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java b/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java deleted file mode 100644 index e8ab9c1baab..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.helium; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; - -public class HeliumTestRegistry extends HeliumRegistry { - private List infos = new LinkedList<>(); - - public HeliumTestRegistry(String name, String uri) { - super(name, uri); - } - - @Override - public List getAll() throws IOException { - return infos; - } - - public void add(HeliumPackage info) { - infos.add(info); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/AbstractInterpreterTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/AbstractInterpreterTest.java index 2f7b6a65cba..8be3609a39e 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/AbstractInterpreterTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/AbstractInterpreterTest.java @@ -22,7 +22,6 @@ import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.display.AngularObjectRegistryListener; import org.apache.zeppelin.eventbus.ZeppelinEventBus; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; import org.apache.zeppelin.notebook.AuthorizationService; import org.apache.zeppelin.notebook.GsonNoteParser; @@ -113,7 +112,7 @@ public void setUp() throws Exception { interpreterSettingManager = new InterpreterSettingManager(zConf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), - mock(ApplicationEventListener.class), storage, pluginManager); + storage, pluginManager); interpreterFactory = new InterpreterFactory(interpreterSettingManager); Credentials credentials = new Credentials(zConf, storage); notebook = new Notebook(zConf, authorizationService, notebookRepo, noteManager, interpreterFactory, interpreterSettingManager, credentials, eventBus); diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerSaveRaceTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerSaveRaceTest.java index 270c9b488ff..a08c62ae7f8 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerSaveRaceTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerSaveRaceTest.java @@ -20,7 +20,6 @@ import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.dep.Dependency; import org.apache.zeppelin.display.AngularObjectRegistryListener; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; import org.apache.zeppelin.notebook.NotebookAuthorizationInfoSaving; import org.apache.zeppelin.storage.ConfigStorage; @@ -60,7 +59,7 @@ void testSaveDuringAnotherSaveIsNotOverwritten() throws Exception { RecordingConfigStorage storage = new RecordingConfigStorage(zConf); InterpreterSettingManager manager = new InterpreterSettingManager(zConf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), - mock(ApplicationEventListener.class), storage, pluginManager); + storage, pluginManager); try { storage.observe(); diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java index ab489c278cd..ad6d41a83f4 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java @@ -25,7 +25,6 @@ import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.dep.Dependency; import org.apache.zeppelin.display.AngularObjectRegistryListener; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; import org.apache.zeppelin.user.AuthenticationInfo; import org.junit.jupiter.api.BeforeEach; @@ -83,7 +82,6 @@ void testInitInterpreterSettingManager() throws IOException, RepositoryException assertEquals(0, interpreterSetting.getDependencies().size()); assertNotNull(interpreterSetting.getAngularObjectRegistryListener()); assertNotNull(interpreterSetting.getRemoteInterpreterProcessListener()); - assertNotNull(interpreterSetting.getAppEventListener()); assertNotNull(interpreterSetting.getDependencyResolver()); assertNotNull(interpreterSetting.getInterpreterSettingManager()); @@ -96,7 +94,7 @@ void testInitInterpreterSettingManager() throws IOException, RepositoryException // Load it again InterpreterSettingManager interpreterSettingManager2 = new InterpreterSettingManager(zConf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), - mock(ApplicationEventListener.class), storage, pluginManager); + storage, pluginManager); assertEquals(6, interpreterSettingManager2.get().size()); interpreterSetting = interpreterSettingManager2.getByName("test"); assertEquals("test", interpreterSetting.getName()); @@ -150,14 +148,13 @@ void testCreateUpdateRemoveSetting() throws IOException, InterpreterException { assertEquals(0, interpreterSetting.getDependencies().size()); assertNotNull(interpreterSetting.getAngularObjectRegistryListener()); assertNotNull(interpreterSetting.getRemoteInterpreterProcessListener()); - assertNotNull(interpreterSetting.getAppEventListener()); assertNotNull(interpreterSetting.getDependencyResolver()); assertNotNull(interpreterSetting.getInterpreterSettingManager()); // load it again, it should be saved in interpreter-setting.json. So we can restore it properly InterpreterSettingManager interpreterSettingManager2 = new InterpreterSettingManager(zConf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), - mock(ApplicationEventListener.class), storage, pluginManager); + storage, pluginManager); assertEquals(7, interpreterSettingManager2.get().size()); interpreterSetting = interpreterSettingManager2.getByName("test3"); assertEquals("test3", interpreterSetting.getName()); @@ -187,7 +184,6 @@ void testCreateUpdateRemoveSetting() throws IOException, InterpreterException { assertEquals(1, interpreterSetting.getDependencies().size()); assertNotNull(interpreterSetting.getAngularObjectRegistryListener()); assertNotNull(interpreterSetting.getRemoteInterpreterProcessListener()); - assertNotNull(interpreterSetting.getAppEventListener()); assertNotNull(interpreterSetting.getDependencyResolver()); assertNotNull(interpreterSetting.getInterpreterSettingManager()); @@ -210,7 +206,7 @@ void testCreateUpdateRemoveSetting() throws IOException, InterpreterException { // load it again InterpreterSettingManager interpreterSettingManager3 = new InterpreterSettingManager(zConf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), - mock(ApplicationEventListener.class), storage, pluginManager); + storage, pluginManager); assertEquals(6, interpreterSettingManager3.get().size()); } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServerTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServerTest.java index 8fac268b9e5..77680cf4dbf 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServerTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServerTest.java @@ -63,10 +63,10 @@ void updateOutputCompletesBeforeReturning() throws Exception { RemoteInterpreterEventServer server = serverWithRunner(listener, new AppendOutputRunner(listener)); try { - server.updateOutput(new OutputUpdateEvent("note", "para", 0, "TEXT", "final", null, null)); + server.updateOutput(new OutputUpdateEvent("note", "para", 0, "TEXT", "final", "owner")); // A caller may publish terminal status as soon as the RPC returns. verify(listener).onParagraphOutputUpdated( - "note", "para", 0, null, InterpreterResult.Type.TEXT, "final"); + "note", "para", 0, "owner", InterpreterResult.Type.TEXT, "final"); } finally { server.stop(); } @@ -78,10 +78,10 @@ void checkpointDrainsPendingOutputBeforeSaving() throws Exception { RemoteInterpreterEventServer server = serverWithRunner(listener, new AppendOutputRunner(listener)); try { - server.appendOutput(new OutputAppendEvent("note", "para", 0, "pending", null, null)); + server.appendOutput(new OutputAppendEvent("note", "para", 0, "pending", "owner")); server.checkpointOutput("note", "para"); InOrder order = inOrder(listener); - order.verify(listener).onParagraphOutputAppend("note", "para", 0, null, "pending"); + order.verify(listener).onParagraphOutputAppend("note", "para", 0, "owner", "pending"); order.verify(listener).checkpointOutput("note", "para"); } finally { server.stop(); diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/GsonNoteParserTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/GsonNoteParserTest.java new file mode 100644 index 00000000000..d6c8fde6f1c --- /dev/null +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/GsonNoteParserTest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zeppelin.notebook; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.junit.jupiter.api.Test; + +class GsonNoteParserTest { + private final GsonNoteParser parser = new GsonNoteParser(ZeppelinConfiguration.load()); + + @Test + void preservesLegacyApplicationMetadataAndChartDataWhenSavingNote() throws Exception { + String json = "{\"id\":\"note\",\"name\":\"legacy\",\"paragraphs\":[{" + + "\"id\":\"paragraph\",\"text\":\"%sql select 1\",\"status\":\"FINISHED\"," + + "\"apps\":[{\"id\":\"app_note-paragraph\",\"status\":\"LOADED\"," + + "\"pkg\":{\"type\":\"APPLICATION\",\"name\":\"legacy-app\"}," + + "\"output\":\"saved output\",\"customMetadata\":{\"version\":1}}]," + + "\"config\":{\"results\":[{\"graph\":{\"mode\":\"external-chart\"," + + "\"height\":420,\"setting\":{\"external-chart\":{\"color\":\"red\"}}}," + + "\"helium\":{\"activeApp\":\"app_note-paragraph\"}}]}," + + "\"results\":{\"code\":\"SUCCESS\",\"msg\":[{\"type\":\"TABLE\"," + + "\"data\":\"value\\n1\"}]}}]}"; + JsonObject original = JsonParser.parseString(json).getAsJsonObject() + .getAsJsonArray("paragraphs").get(0).getAsJsonObject(); + + Note note = parser.fromJson("note", json); + note.getParagraph("paragraph").setText("%sql select 2"); + Note reloaded = parser.fromJson("note", parser.toJson(note)); + JsonObject saved = JsonParser.parseString(parser.toJson(reloaded)).getAsJsonObject() + .getAsJsonArray("paragraphs").get(0).getAsJsonObject(); + + assertEquals("%sql select 2", reloaded.getParagraph("paragraph").getText()); + assertEquals(original.get("apps"), saved.get("apps")); + assertEquals(original.get("config"), saved.get("config")); + assertEquals(original.get("results"), saved.get("results")); + } + + @Test + void doesNotAddApplicationMetadataToOrdinaryParagraphs() { + Paragraph paragraph = parser.fromJson("{\"id\":\"paragraph\",\"text\":\"%sql select 1\"}"); + JsonObject saved = JsonParser.parseString(parser.toJson(paragraph)).getAsJsonObject(); + + assertEquals("%sql select 1", paragraph.getText()); + assertFalse(saved.has("apps")); + } +} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java index b7cb75729ea..5603f884075 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java @@ -41,7 +41,6 @@ import org.apache.zeppelin.display.AngularObjectRegistryListener; import org.apache.zeppelin.eventbus.EventBus; import org.apache.zeppelin.eventbus.ZeppelinEventBus; -import org.apache.zeppelin.helium.ApplicationEventListener; import org.apache.zeppelin.interpreter.InterpreterFactory; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; @@ -111,7 +110,7 @@ public void setUp() throws Exception { pluginManager = new PluginManager(zConf); interpreterSettingManager = new InterpreterSettingManager(zConf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), - mock(ApplicationEventListener.class), storage, pluginManager); + storage, pluginManager); factory = new InterpreterFactory(interpreterSettingManager); notebookRepoSync = new NotebookRepoSync(pluginManager); diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/HeliumRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/HeliumRestApiTest.java deleted file mode 100644 index ab71266ac64..00000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/HeliumRestApiTest.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.rest; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.util.EntityUtils; -import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.helium.Helium; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.apache.zeppelin.helium.HeliumPackage; -import org.apache.zeppelin.helium.HeliumRegistry; -import org.apache.zeppelin.helium.HeliumType; - -class HeliumRestApiTest extends AbstractTestRestApi { - private Gson gson = new Gson(); - private static MiniZeppelinServer zepServer; - private static Helium helium; - - @BeforeAll - static void init() throws Exception { - zepServer = new MiniZeppelinServer(HeliumRestApi.class.getSimpleName()); - zepServer.start(); - helium = zepServer.getService(Helium.class); - } - - @BeforeEach - void setup() { - zConf = zepServer.getZeppelinConfiguration(); - } - - @AfterAll - static void destroy() throws Exception { - zepServer.destroy(); - } - - @BeforeEach - void setUp() throws IOException { - HeliumTestRegistry registry = new HeliumTestRegistry("r1", "r1"); - helium.clear(); - - registry.add(newHeliumPackage( - HeliumType.APPLICATION, - "name1", - "desc1", - "artifact1", - "className1", - new String[][]{}, - "", - "")); - - registry.add(newHeliumPackage( - HeliumType.APPLICATION, - "name2", - "desc2", - "artifact2", - "className2", - new String[][]{}, - "", - "")); - - helium.addRegistry(registry); - } - - @AfterEach - public void tearDown() { - helium.clear(); - } - - @Test - void testGetAllPackageInfo() throws IOException { - CloseableHttpResponse get = httpGet("/helium/package"); - assertThat(get, isAllowed()); - Map resp = gson.fromJson(EntityUtils.toString(get.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - Map> body = (Map>) resp.get("body"); - - assertEquals(2, body.size()); - assertTrue(body.containsKey("name1")); - assertTrue(body.containsKey("name2")); - get.close(); - } - - @Test - void testGetAllEnabledPackageInfo() throws IOException { - // No enabled packages initially - CloseableHttpResponse get1 = httpGet("/helium/enabledPackage"); - assertThat(get1, isAllowed()); - Map resp1 = gson.fromJson(EntityUtils.toString(get1.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body1 = (List) resp1.get("body"); - assertEquals(0, body1.size()); - - // Enable "name1" package - helium.enable("name1", "artifact1"); - - CloseableHttpResponse get2 = httpGet("/helium/enabledPackage"); - assertThat(get2, isAllowed()); - Map resp2 = gson.fromJson(EntityUtils.toString(get2.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body2 = (List) resp2.get("body"); - - assertEquals(1, body2.size()); - Map pkg = (Map) body2.get(0).get("pkg"); - assertEquals("name1", pkg.get("name")); - get1.close(); - get2.close(); - } - - @Test - void testGetSinglePackageInfo() throws IOException { - String packageName = "name1"; - CloseableHttpResponse get = httpGet("/helium/package/" + packageName); - assertThat(get, isAllowed()); - Map resp = gson.fromJson(EntityUtils.toString(get.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body = (List) resp.get("body"); - - assertEquals(1, body.size()); - Map pkg = (Map) body.get(0).get("pkg"); - assertEquals("name1", pkg.get("name")); - get.close(); - } - - @Test - void testGetAllPackageConfigs() throws IOException { - CloseableHttpResponse get = httpGet("/helium/config/"); - assertThat(get, isAllowed()); - Map resp = gson.fromJson(EntityUtils.toString(get.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - Map body = (Map) resp.get("body"); - // ToDo: Apply config with POST command and check update - assertEquals(0, body.size()); - get.close(); - } - - @Test - void testGetPackageConfig() throws IOException { - String packageName = "name1"; - String artifact = "artifact1"; - CloseableHttpResponse get = httpGet("/helium/config/" + packageName + "/" + artifact); - assertThat(get, isAllowed()); - Map resp = gson.fromJson(EntityUtils.toString(get.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - Map body = (Map) resp.get("body"); - assertTrue(body.containsKey("confPersisted")); - get.close(); - } - - @Test - void testEnableDisablePackage() throws IOException { - String packageName = "name1"; - CloseableHttpResponse post1 = httpPost("/helium/enable/" + packageName, ""); - assertThat(post1, isAllowed()); - post1.close(); - - CloseableHttpResponse get1 = httpGet("/helium/package/" + packageName); - Map resp1 = gson.fromJson(EntityUtils.toString(get1.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body1 = (List) resp1.get("body"); - assertEquals(true, body1.get(0).get("enabled")); - get1.close(); - - CloseableHttpResponse post2 = httpPost("/helium/disable/" + packageName, ""); - assertThat(post2, isAllowed()); - post2.close(); - - CloseableHttpResponse get2 = httpGet("/helium/package/" + packageName); - Map resp2 = gson.fromJson(EntityUtils.toString(get2.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body2 = (List) resp2.get("body"); - assertEquals(false, body2.get(0).get("enabled")); - get2.close(); - } - - @Test - void testVisualizationPackageOrder() throws IOException { - CloseableHttpResponse get1 = httpGet("/helium/order/visualization"); - assertThat(get1, isAllowed()); - Map resp1 = gson.fromJson(EntityUtils.toString(get1.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body1 = (List) resp1.get("body"); - assertEquals(0, body1.size()); - get1.close(); - - //We assume allPackages list has been refreshed before sorting - helium.getAllPackageInfo(); - - String postRequestJson = "[name2, name1]"; - CloseableHttpResponse post = httpPost("/helium/order/visualization", postRequestJson); - assertThat(post, isAllowed()); - post.close(); - - CloseableHttpResponse get2 = httpGet("/helium/order/visualization"); - assertThat(get2, isAllowed()); - Map resp2 = gson.fromJson(EntityUtils.toString(get2.getEntity(), StandardCharsets.UTF_8), - new TypeToken>() { }.getType()); - List body2 = (List) resp2.get("body"); - assertEquals(2, body2.size()); - assertEquals("name2", body2.get(0)); - assertEquals("name1", body2.get(1)); - get2.close(); - } -} - -class HeliumTestRegistry extends HeliumRegistry { - private List infos = new LinkedList<>(); - - HeliumTestRegistry(String name, String uri) { - super(name, uri); - } - - @Override - public List getAll() throws IOException { - return infos; - } - - public void add(HeliumPackage info) { - infos.add(info); - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java index 5df2a72c3f1..4bf39f64d90 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java @@ -15,11 +15,9 @@ * limitations under the License. */ - package org.apache.zeppelin.service; import org.apache.zeppelin.MiniZeppelinServer; -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.rest.AbstractTestRestApi; import org.apache.zeppelin.user.AuthenticationInfo; import org.junit.jupiter.api.AfterAll; @@ -51,9 +49,7 @@ class ConfigurationServiceTest extends AbstractTestRestApi { @BeforeAll public static void init() throws Exception { zepServer = new MiniZeppelinServer(ConfigurationServiceTest.class.getSimpleName()); - zepServer.getZeppelinConfiguration().setProperty( - ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), - "helium"); + zepServer.start(); configurationService = zepServer.getService(ConfigurationService.class); } diff --git a/zeppelin-server/src/test/resources/helium/vis1/package.json b/zeppelin-server/src/test/resources/helium/vis1/package.json deleted file mode 100644 index 481ad58a3c3..00000000000 --- a/zeppelin-server/src/test/resources/helium/vis1/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "vis1", - "version": "1.0.0", - "description": "", - "main": "vis1", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "zeppelin-tabledata": "*", - "zeppelin-vis": "*" - } -} \ No newline at end of file diff --git a/zeppelin-server/src/test/resources/helium/vis1/vis1.js b/zeppelin-server/src/test/resources/helium/vis1/vis1.js deleted file mode 100644 index 98bd552cd4f..00000000000 --- a/zeppelin-server/src/test/resources/helium/vis1/vis1.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import Visualization from 'zeppelin-vis' -import PassthroughTransformation from 'zeppelin-tabledata/passthrough' - -/** - * Base class for visualization - */ -export default class vis1 extends Visualization { - constructor(targetEl, config) { - super(targetEl, config) - this.passthrough = new PassthroughTransformation(config); - console.log('passthrough %o', this.passthrough); - } - - render(tableData) { - this.targetEl.html('Vis1') - } - - getTransformation() { - return this.passthrough - } -} diff --git a/zeppelin-server/src/test/resources/helium/vis2/package.json b/zeppelin-server/src/test/resources/helium/vis2/package.json deleted file mode 100644 index b45ee6b4a5f..00000000000 --- a/zeppelin-server/src/test/resources/helium/vis2/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "vis2", - "version": "1.0.0", - "description": "", - "main": "vis2", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "zeppelin-tabledata": "*", - "zeppelin-vis": "*" - } -} \ No newline at end of file diff --git a/zeppelin-server/src/test/resources/helium/vis2/vis2.js b/zeppelin-server/src/test/resources/helium/vis2/vis2.js deleted file mode 100644 index e9cd324bfb0..00000000000 --- a/zeppelin-server/src/test/resources/helium/vis2/vis2.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import Visualization from 'zeppelin-vis' -import PassthroughTransformation from 'zeppelin-tabledata/passthrough' - -/** - * Base class for visualization - */ -export default class vis2 extends Visualization { - constructor(targetEl, config) { - super(targetEl, config) - this.passthrough = new PassthroughTransformation(config); - - } - - render(tableData) { - this.targetEl.html('Vis2') - error in the package - } - - getTransformation() { - return this.passthrough - } -} diff --git a/zeppelin-web-angular/README.md b/zeppelin-web-angular/README.md index 64b8de30c37..9819fcc357a 100644 --- a/zeppelin-web-angular/README.md +++ b/zeppelin-web-angular/README.md @@ -72,7 +72,6 @@ The React remote has a separate jsdom suite: run `npm test --prefix projects/zep | Notebook | `/notebook/{id}` | NotebookModule | Y | | Notebook Repos | `/notebookRepos` | | | | Credential | `/credential` | | | -| Helium | `/helium` | | WIP | | Configuration | `/configuration` | | | ### Notebook Features @@ -113,15 +112,6 @@ The React remote has a separate jsdom suite: run `npm test --prefix projects/zep | Area Chart | Y | | Scatter Chart | Y | -### Helium Visualization - -| Type | Description | Status | -| ------ | ---- | ---- | -| Prototype | To verify the implementable prototype | Y | -| Publish Dependencies | Just like [zeppelin-vis](https://github.com/apache/zeppelin/tree/master/zeppelin-web/src/app/visualization) | WIP | -| Example Projects | | Y | -| Development Documents | | WIP | - ## Contributing ### Dev Mode diff --git a/zeppelin-web-angular/angular.json b/zeppelin-web-angular/angular.json index c380697f25d..cc16c32b699 100644 --- a/zeppelin-web-angular/angular.json +++ b/zeppelin-web-angular/angular.json @@ -79,23 +79,12 @@ "src/styles.less", "./node_modules/highlight.js/styles/github.css", "./node_modules/monaco-editor/min/vs/editor/editor.main.css", - "./node_modules/github-markdown-css/github-markdown.css", - "./node_modules/nvd3/build/nv.d3.css" + "./node_modules/github-markdown-css/github-markdown.css" ], "stylePreprocessorOptions": { "includePaths": ["src/styles/theme", "src/styles/theme/dark", "src/styles/theme/light"] }, - "scripts": [ - "node_modules/jquery/dist/jquery.min.js", - "node_modules/jquery-ui/dist/jquery-ui.js", - "node_modules/d3/d3.js", - "node_modules/nvd3/build/nv.d3.js", - "node_modules/mathjax/MathJax.js", - "node_modules/systemjs/dist/s.js", - "node_modules/systemjs/dist/extras/amd.js", - "node_modules/systemjs/dist/extras/named-register.js", - "node_modules/systemjs/dist/extras/use-default.js" - ] + "scripts": ["node_modules/mathjax/MathJax.js"] }, "configurations": { "production": { diff --git a/zeppelin-web-angular/e2e/core-contract/port-proof/angular-host/main.ts b/zeppelin-web-angular/e2e/core-contract/port-proof/angular-host/main.ts index 1cb944de117..de405078cf4 100644 --- a/zeppelin-web-angular/e2e/core-contract/port-proof/angular-host/main.ts +++ b/zeppelin-web-angular/e2e/core-contract/port-proof/angular-host/main.ts @@ -24,7 +24,6 @@ import { } from '@zeppelin/pages/workspace/notebook/notebook-route-boundary'; import { WorkspaceGuard } from '@zeppelin/pages/workspace/workspace.guard'; import { MessageService, ReactFeatureService } from '@zeppelin/services'; -import { HeliumService } from '@zeppelin/services/helium.service'; import { ThemeService } from '@zeppelin/services/theme.service'; import { TicketService } from '@zeppelin/services/ticket.service'; import { ShareModule } from '@zeppelin/share'; @@ -259,7 +258,6 @@ class ProofWorkspaceGuard { providers: [ { provide: WorkspaceGuard, useClass: ProofWorkspaceGuard }, { provide: MessageService, useClass: ProofMessageService }, - { provide: HeliumService, useValue: { initPackages: () => undefined } }, { provide: NzMessageService, useValue: { loading: () => ({ messageId: 'proof' }), remove: () => undefined } }, { provide: ReactFeatureService, useValue: { isEnabled: () => false } }, { diff --git a/zeppelin-web-angular/package-lock.json b/zeppelin-web-angular/package-lock.json index d59bed52eec..fb3cf0ed3d4 100644 --- a/zeppelin-web-angular/package-lock.json +++ b/zeppelin-web-angular/package-lock.json @@ -20,24 +20,18 @@ "@antv/data-set": "^0.10.2", "@antv/g2": "^3.5.4", "@ctrl/tinycolor": "^3.6.1", - "angular": "^1.8.2", "ansi_up": "^6.0.6", "core-js": "^2.5.4", - "d3": "3.5.17", "date-fns": "^3.6.0", "diff-match-patch": "^1.0.4", "github-markdown-css": "^3.0.1", "highlight.js": "^10.7.3", - "jquery": "3.7.1", - "jquery-ui": "1.14.0", "lodash": "^4.17.21", "mathjax": "2.7.5", "monaco-editor": "0.52.2", "ng-zorro-antd": "^21.3.0", - "nvd3": "1.8.6", "parse5": "^5.1.1", "rxjs": "~7.8.2", - "systemjs": "^5.0.0", "tslib": "^2.0.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", "zone.js": "~0.15.1" @@ -51,10 +45,8 @@ "@angular/compiler-cli": "^21.2.25", "@angular/language-service": "^21.2.25", "@playwright/test": "1.55.1", - "@types/angular": "^1.8.0", "@types/diff-match-patch": "^1.0.36", "@types/highlight.js": "^9.12.3", - "@types/jquery": "3.5.16", "@types/lodash": "4.14.144", "@types/mathjax": "^0.0.35", "@types/node": "22.12.0", @@ -7577,13 +7569,6 @@ "tslib": "^2.4.0" } }, - "node_modules/@types/angular": { - "version": "1.8.9", - "resolved": "https://registry.npmjs.org/@types/angular/-/angular-1.8.9.tgz", - "integrity": "sha512-Z0HukqZkx0fotsV3QO00yqU9NzcQI+tMcrum+8MvfB4ePqCawZctF/gz6QiuII+T1ax+LitNoPx/eICTgnF4sg==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/body-parser": { "version": "1.19.6", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", @@ -7737,16 +7722,6 @@ "@types/node": "*" } }, - "node_modules/@types/jquery": { - "version": "3.5.16", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.16.tgz", - "integrity": "sha512-bsI7y4ZgeMkmpG9OM710RRzDFp+w4P1RGiIt30C1mSBT+ExCleeh4HObwgArnDFELmRrOpXgSYN9VF1hj+f1lw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/sizzle": "*" - } - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -7863,13 +7838,6 @@ "@types/node": "*" } }, - "node_modules/@types/sizzle": { - "version": "2.3.10", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.10.tgz", - "integrity": "sha512-TC0dmN0K8YcWEAEfiPi5gJP14eJe30TTGjkvek3iM/1NdHHsdCA/Td6GvNndMOo/iSnIsZ4HuuhrYPDAmbxzww==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/sockjs": { "version": "0.3.36", "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", @@ -8689,13 +8657,6 @@ "node": ">= 14.0.0" } }, - "node_modules/angular": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/angular/-/angular-1.8.3.tgz", - "integrity": "sha512-5qjkWIQQVsHj4Sb5TcEs4WZWpFeVFHXwxEBHUhrny41D8UrBAd6T/6nPPAsLngJCReIOqi95W3mxdveveutpZw==", - "deprecated": "For the actively supported Angular, see https://www.npmjs.com/package/@angular/core. AngularJS support has officially ended. For extended AngularJS support options, see https://goo.gle/angularjs-path-forward.", - "license": "MIT" - }, "node_modules/angular-eslint": { "version": "21.4.0", "resolved": "https://registry.npmjs.org/angular-eslint/-/angular-eslint-21.4.0.tgz", @@ -10351,12 +10312,6 @@ "node": ">=4" } }, - "node_modules/d3": { - "version": "3.5.17", - "resolved": "https://registry.npmjs.org/d3/-/d3-3.5.17.tgz", - "integrity": "sha512-yFk/2idb8OHPKkbAL8QaOaqENNoMhIaSHZerk3oQsECwkObkCpJyjYwCe+OHiq6UEdhe1m8ZGARRRO3ljFjlKg==", - "license": "BSD-3-Clause" - }, "node_modules/d3-array": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz", @@ -13929,21 +13884,6 @@ "url": "https://github.com/sponsors/panva" } }, - "node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", - "license": "MIT" - }, - "node_modules/jquery-ui": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.14.0.tgz", - "integrity": "sha512-mPfYKBoRCf0MzaT2cyW5i3IuZ7PfTITaasO5OFLAQxrHuI+ZxruPa+4/K1OMNT8oElLWGtIxc9aRbyw20BKr8g==", - "license": "MIT", - "dependencies": { - "jquery": ">=1.12.0 <5.0.0" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -16190,15 +16130,6 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, - "node_modules/nvd3": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/nvd3/-/nvd3-1.8.6.tgz", - "integrity": "sha512-YGQ9hAQHuQCF0JmYkT2GhNMHb5pA+vDfQj6C2GdpQPzdRPj/srPG3mh/3fZzUFt+at1NusLk/RqICUWkxm4viQ==", - "license": "Apache-2.0", - "peerDependencies": { - "d3": "^3.4.4" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -19062,12 +18993,6 @@ "dev": true, "license": "MIT" }, - "node_modules/systemjs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-5.0.0.tgz", - "integrity": "sha512-hnD/IMQhH0UmawiIGlYVnkCPUbbO/WDQjOC+Q4PewHBdsagI1OHH1re1sg1AYFqq7p9ps6b1Bsx4xCeoeIZSCw==", - "license": "MIT" - }, "node_modules/tapable": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", diff --git a/zeppelin-web-angular/package.json b/zeppelin-web-angular/package.json index 67838599f29..edf98bb22d3 100644 --- a/zeppelin-web-angular/package.json +++ b/zeppelin-web-angular/package.json @@ -68,24 +68,18 @@ "@antv/data-set": "^0.10.2", "@antv/g2": "^3.5.4", "@ctrl/tinycolor": "^3.6.1", - "angular": "^1.8.2", "ansi_up": "^6.0.6", "core-js": "^2.5.4", - "d3": "3.5.17", "date-fns": "^3.6.0", "diff-match-patch": "^1.0.4", "github-markdown-css": "^3.0.1", "highlight.js": "^10.7.3", - "jquery": "3.7.1", - "jquery-ui": "1.14.0", "lodash": "^4.17.21", "mathjax": "2.7.5", "monaco-editor": "0.52.2", "ng-zorro-antd": "^21.3.0", - "nvd3": "1.8.6", "parse5": "^5.1.1", "rxjs": "~7.8.2", - "systemjs": "^5.0.0", "tslib": "^2.0.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", "zone.js": "~0.15.1" @@ -99,10 +93,8 @@ "@angular/compiler-cli": "^21.2.25", "@angular/language-service": "^21.2.25", "@playwright/test": "1.55.1", - "@types/angular": "^1.8.0", "@types/diff-match-patch": "^1.0.36", "@types/highlight.js": "^9.12.3", - "@types/jquery": "3.5.16", "@types/lodash": "4.14.144", "@types/mathjax": "^0.0.35", "@types/node": "22.12.0", diff --git a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-data-type-map.interface.ts b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-data-type-map.interface.ts index 9fcfe7205c9..dfa7913375b 100644 --- a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-data-type-map.interface.ts +++ b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-data-type-map.interface.ts @@ -71,7 +71,6 @@ import { ParagraphAppendOutput, ParagraphClearAllOutput, ParagraphClearOutput, - ParagraphExecutedBySpell, ParagraphRemove, ParagraphRemoved, ParagraphStatus, @@ -157,7 +156,6 @@ export interface MessageSendDataTypeMap { [OP.ANGULAR_OBJECT_CLIENT_BIND]: AngularObjectClientBind; [OP.ANGULAR_OBJECT_CLIENT_UNBIND]: AngularObjectClientUnbind; [OP.CANCEL_PARAGRAPH]: CancelParagraph; - [OP.PARAGRAPH_EXECUTED_BY_SPELL]: ParagraphExecutedBySpell; [OP.RUN_PARAGRAPH]: RunParagraph; [OP.RUN_ALL_PARAGRAPHS]: RunAllParagraphs; [OP.CANCEL_ALL_PARAGRAPHS]: CancelAllParagraphs; diff --git a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-operator.interface.ts b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-operator.interface.ts index a87527623ab..a72942b1b97 100644 --- a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-operator.interface.ts +++ b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-operator.interface.ts @@ -320,30 +320,6 @@ export enum OP { */ NOTE_REVISION_FOR_COMPARE = 'NOTE_REVISION_FOR_COMPARE', - /** - * [s-c] - * append output - */ - APP_APPEND_OUTPUT = 'APP_APPEND_OUTPUT', - - /** - * [s-c] - * update (replace) output - */ - APP_UPDATE_OUTPUT = 'APP_UPDATE_OUTPUT', - - /** - * [s-c] - * on app load - */ - APP_LOAD = 'APP_LOAD', - - /** - * [s-c] - * on app status change - */ - APP_STATUS_CHANGE = 'APP_STATUS_CHANGE', - /** * [s-c] * get note job management information @@ -453,18 +429,6 @@ export enum OP { */ CANCEL_ALL_PARAGRAPHS = 'CANCEL_ALL_PARAGRAPHS', - /** - * [c-s] - * paragraph was executed by spell - */ - PARAGRAPH_EXECUTED_BY_SPELL = 'PARAGRAPH_EXECUTED_BY_SPELL', - - /** - * [s-c] - * run paragraph using spell - */ - RUN_PARAGRAPH_USING_SPELL = 'RUN_PARAGRAPH_USING_SPELL', - /** * [s-c] * paragraph runtime infos diff --git a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts index 9d0d703008d..88a4c06f095 100644 --- a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts +++ b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts @@ -162,8 +162,8 @@ export interface ParagraphItem { config: ParagraphConfig; settings: ParagraphSettings; results?: ParagraphResults; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - apps: any[]; + // Legacy application metadata is preserved as opaque notebook data. + apps?: unknown[]; progressUpdateIntervalMs: number; progress: number; jobName: string; @@ -329,25 +329,6 @@ export interface ParagraphRemoved { id: string; } -export interface ParagraphExecutedBySpell { - id: string; - title: string; - paragraph: string; - results: { - code: string; - msg: Array<{ - type: string; - serializedData: string; - }>; - }; - status: string; - errorMessage: string; - config: ParagraphConfig; - params: DynamicFormParams; - dateStarted: string; - dateFinished: string; -} - export type VisualizationMode = 'table' | 'lineChart' | 'stackedAreaChart' | 'multiBarChart' | 'scatterChart' | 'pieChart' | string; diff --git a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/notebook-wire-fields.spec.ts b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/notebook-wire-fields.spec.ts index 142f90c0870..f35ec59b52e 100644 --- a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/notebook-wire-fields.spec.ts +++ b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/notebook-wire-fields.spec.ts @@ -35,7 +35,6 @@ it('separates received wire fields from backward-compatible import input', () => dateUpdated: '2026-09-14T00:00:00.000Z', config: {}, settings: { params: {}, forms: {} }, - apps: [], progressUpdateIntervalMs: 500, jobName: 'paragraph', id: 'paragraph-1', @@ -65,6 +64,7 @@ it('separates received wire fields from backward-compatible import input', () => } }); + expectTypeOf().toHaveProperty('apps').toEqualTypeOf(); expectTypeOf().toHaveProperty('version').toEqualTypeOf(); expectTypeOf() .toHaveProperty('progress') diff --git a/zeppelin-web-angular/projects/zeppelin-sdk/src/message.ts b/zeppelin-web-angular/projects/zeppelin-sdk/src/message.ts index 705977835a6..79e27e3e9a6 100644 --- a/zeppelin-web-angular/projects/zeppelin-sdk/src/message.ts +++ b/zeppelin-web-angular/projects/zeppelin-sdk/src/message.ts @@ -22,12 +22,7 @@ import { } from './interfaces/message-data-type-map.interface'; import { ImportNote, Note, NoteConfig, PersonalizedMode, SendNote } from './interfaces/message-notebook.interface'; import { OP } from './interfaces/message-operator.interface'; -import { - DynamicFormParams, - ParagraphConfig, - ParagraphParams, - SendParagraph -} from './interfaces/message-paragraph.interface'; +import { ParagraphConfig, ParagraphParams, SendParagraph } from './interfaces/message-paragraph.interface'; import { WebSocketMessage } from './interfaces/websocket-message.interface'; import { getMessagePayloadGuard } from './message-payload-guards'; @@ -357,38 +352,6 @@ export class Message { this.send(OP.CANCEL_PARAGRAPH, { id: paragraphId }); } - paragraphExecutedBySpell( - paragraphId: string, - paragraphTitle: string, - paragraphText: string, - paragraphResultsMsg: Array<{ data: string; type: string }>, - paragraphStatus: string, - paragraphErrorMessage: string, - paragraphConfig: ParagraphConfig, - paragraphParams: DynamicFormParams, - paragraphDateStarted: string, - paragraphDateFinished: string - ): void { - this.send(OP.PARAGRAPH_EXECUTED_BY_SPELL, { - id: paragraphId, - title: paragraphTitle, - paragraph: paragraphText, - results: { - code: paragraphStatus, - msg: paragraphResultsMsg.map(dataWithType => { - const serializedData = dataWithType.data; - return { type: dataWithType.type, serializedData }; - }) - }, - status: paragraphStatus, - errorMessage: paragraphErrorMessage, - config: paragraphConfig, - params: paragraphParams, - dateStarted: paragraphDateStarted, - dateFinished: paragraphDateFinished - }); - } - runParagraph( paragraphId: string, paragraphTitle: string | undefined, diff --git a/zeppelin-web-angular/src/app/core/paragraph-base/paragraph-base.ts b/zeppelin-web-angular/src/app/core/paragraph-base/paragraph-base.ts index 7b87aea9836..75a2a81dba3 100644 --- a/zeppelin-web-angular/src/app/core/paragraph-base/paragraph-base.ts +++ b/zeppelin-web-angular/src/app/core/paragraph-base/paragraph-base.ts @@ -439,10 +439,6 @@ export abstract class ParagraphBase extends MessageListenersManager { } } - runParagraphUsingSpell(_paragraphText: string, _magic: string, _propagated: boolean) { - // TODO(hsuanxyz) - } - runParagraphUsingBackendInterpreter(paragraphText: string) { if (!this.paragraph) { throw new Error('paragraph is not defined'); diff --git a/zeppelin-web-angular/src/app/interfaces/helium.ts b/zeppelin-web-angular/src/app/interfaces/helium.ts deleted file mode 100644 index c8d274178f1..00000000000 --- a/zeppelin-web-angular/src/app/interfaces/helium.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { GraphConfig, ParagraphIResultsMsgItem } from '@zeppelin/sdk'; -import * as angular from 'angular'; -import * as JQuery from 'jquery'; - -export type HeliumType = 'VISUALIZATION'; - -enum HeliumPackageType { - Visualization -} - -interface HeliumPackage { - name: string; - artifact: string; - description: string; - icon: string; - type: HeliumPackageType; - license: string; - published: string; -} - -export interface HeliumPackageSearchResult { - registry: string; - pkg: HeliumPackage; - enabled: boolean; -} - -export interface HeliumBundle { - id: string; - name: string; - icon: string; - type: HeliumType; - class: unknown; -} - -export interface HeliumVisualizationBundle extends HeliumBundle { - type: 'VISUALIZATION'; - class: HeliumClassicVisualizationConstructor; -} - -/** - * Interface representing the legacy `Visualization` class from the original `zeppelin-web` implementation. - * - * Since Helium packages are dynamically loaded and evaluated at runtime, classes extended by these packages - * do not inherit from the same parent `Visualization` class instance. This interface provides a contract - * that mimics the structure and behavior of the original `Visualization` class to ensure type safety - * and compatibility across different visualization implementations. - * - * This interface is used for classic AngularJS-based visualizations that rely on jQuery and Angular 1.x APIs. - */ -export interface HeliumClassicVisualization { - _compile: angular.ICompileService; - _createNewScope(): angular.IScope; - _emitter(config: unknown): void; - _templateRequest(tpl: string, ignoreRequestError?: boolean): Promise | angular.IPromise; - setConfig(config: unknown): void; - getTransformation(): HeliumClassicTransformation; - render(transformedTableData: unknown): void; - refresh(): void; - destroy(): void; - renderSetting(elem: JQuery): void; - activate(): void; - deactivate(): void; - resize(): void; -} - -/** - * Constructor type for creating instances of classic Helium visualizations. - * - * @param targetEl - jQuery-wrapped HTML element where the visualization will be rendered - * @param config - Graph configuration object containing visualization settings - * @returns A new instance of HeliumClassicVisualization - */ -export interface HeliumClassicVisualizationConstructor { - prototype: Record; - new (targetEl: JQuery, config: GraphConfig): HeliumClassicVisualization; -} - -/** - * Interface for the transformation component of classic Helium visualizations. - * - * This interface represents the data transformation layer that processes raw table data - * before it's rendered by the visualization. It includes methods for data transformation, - * configuration management, and settings rendering. - */ -export interface HeliumClassicTransformation { - _compile: angular.ICompileService; - _scope?: angular.IScope; - _createNewScope(): angular.IScope; - _emitter(config: unknown): void; - _templateRequest(tpl: string, ignoreRequestError?: boolean): Promise | angular.IPromise; - setConfig(config: unknown): void; - transform(tableData: HeliumClassicTableData): unknown; - renderSetting(elem: JQuery): void; -} - -export interface HeliumClassicTableData { - columns: Array<{ name: string; index: number; aggr: 'sum' }>; - rows: string[][]; - comment: string; - loadParagraphResult(paragraphResult: ParagraphIResultsMsgItem): void; - refresh(): void; -} diff --git a/zeppelin-web-angular/src/app/interfaces/public-api.ts b/zeppelin-web-angular/src/app/interfaces/public-api.ts index e75b53c6867..f5d5ae5e251 100644 --- a/zeppelin-web-angular/src/app/interfaces/public-api.ts +++ b/zeppelin-web-angular/src/app/interfaces/public-api.ts @@ -11,7 +11,6 @@ */ export * from './credential'; -export * from './helium'; export * from './interpreter'; export * from './message-interceptor'; export * from './node-list'; diff --git a/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts b/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts index a1d0e1e4c33..72c293e9602 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts @@ -44,14 +44,12 @@ import { ParagraphIResultsMsgItem } from '@zeppelin/sdk'; import { - HeliumService, MessageService, NgZService, NoteStatusService, NoteVarShareService, ShortcutService } from '@zeppelin/services'; -import { SpellResult } from '@zeppelin/spell'; import { AngularKeyboardEventHandler, @@ -400,18 +398,11 @@ export class NotebookParagraphComponent this.editorSetting.isOutputHidden = this.paragraph.config.editorSetting.editOnDblClick; } - runParagraph(paragraphText?: string, propagated: boolean = false) { + runParagraph(paragraphText?: string) { const text = paragraphText || this.paragraph.text; if (text && !this.isParagraphRunning) { - const magic = SpellResult.extractMagic(text); - - if (magic && this.heliumService.getSpellByMagic(magic)) { - this.runParagraphUsingSpell(text, magic, propagated); - this.runParagraphAfter(text); - } else { - this.runParagraphUsingBackendInterpreter(text); - this.runParagraphAfter(text); - } + this.runParagraphUsingBackendInterpreter(text); + this.runParagraphAfter(text); } } @@ -590,7 +581,6 @@ export class NotebookParagraphComponent constructor( public messageService: MessageService, - private heliumService: HeliumService, private host: ElementRef, private noteVarShareService: NoteVarShareService, private nzModalService: NzModalService, diff --git a/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.spec.ts b/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.spec.ts index 30490196bb4..461c88955e0 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.spec.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.spec.ts @@ -18,7 +18,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; vi.mock('@zeppelin/services', () => ({ MessageService: class {}, - HeliumService: class {}, NgZService: class {}, NoteStatusService: class {}, ReactFeatureService: class {} @@ -59,7 +58,6 @@ const setup = (useReact = false) => { { params, queryParamMap: of(convertToParamMap({})) } as never, {} as never, {} as never, - {} as never, { isEnabled: () => useReact } as never, { isParagraphRunning: (p: ParagraphItem) => p.status === 'RUNNING' } as never, {} as never, diff --git a/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts b/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts index 07d0439710e..bf925cb5eca 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts @@ -27,8 +27,7 @@ import { ParagraphItem, ParagraphIResultsMsgItem } from '@zeppelin/sdk'; -import { HeliumService, MessageService, NgZService, NoteStatusService, ReactFeatureService } from '@zeppelin/services'; -import { SpellResult } from '@zeppelin/spell'; +import { MessageService, NgZService, NoteStatusService, ReactFeatureService } from '@zeppelin/services'; import { isNil } from 'lodash'; import { NzModalService } from 'ng-zorro-antd/modal'; import { NotebookParagraphResultComponent } from '../../share/result/result.component'; @@ -65,7 +64,6 @@ export class PublishedParagraphComponent extends ParagraphBase implements Publis constructor( public messageService: MessageService, private activatedRoute: ActivatedRoute, - private heliumService: HeliumService, private router: Router, private nzModalService: NzModalService, private reactFeature: ReactFeatureService, @@ -146,12 +144,7 @@ export class PublishedParagraphComponent extends ParagraphBase implements Publis } const text = this.paragraph.text; if (text && !this.isParagraphRunning) { - const magic = SpellResult.extractMagic(this.paragraph.text); - if (magic && this.heliumService.getSpellByMagic(magic)) { - this.runParagraphUsingSpell(text, magic, false); - } else { - this.runParagraphUsingBackendInterpreter(text); - } + this.runParagraphUsingBackendInterpreter(text); } } diff --git a/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.html b/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.html index 0d0804e814d..0b745a39a53 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.html +++ b/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.html @@ -13,15 +13,14 @@ @if (result.type === datasetType.TABLE && !published) {
    - + @for (item of visualizations; track item) { } @@ -68,25 +67,6 @@ } - - @if (result.type !== datasetType.SVG && result.type !== datasetType.NULL && getCurrentVisualization()?.isClassic) { -
    - } - - @if (result.type !== datasetType.SVG && result.type !== datasetType.NULL && getCurrentVisualization()?.isClassic) { -
    - } - @if (result.type !== datasetType.SVG && result.type !== datasetType.NULL && getCurrentVisualization()?.isClassic) { -
    - } @switch (result?.type) { @case (datasetType.HTML) {
    ({ - ClassicVisualizationService: class {}, - HeliumService: class {}, NgZService: class {}, RuntimeCompilerService: class {} })); @@ -42,29 +30,17 @@ vi.mock('@zeppelin/visualizations', () => ({ TableVisualization: class {} })); -import { - ClassicVisualizationService, - DynamicTemplate, - HeliumService, - NgZService, - RuntimeCompilerService -} from '@zeppelin/services'; +import { DynamicTemplate, NgZService, RuntimeCompilerService } from '@zeppelin/services'; import { NotebookParagraphResultComponent } from './result.component'; -import template from './result.component.html?raw'; -const component = ( - compiler: Partial = {}, - classic: Partial = {} -) => +const component = (compiler: Partial = {}) => new NotebookParagraphResultComponent( {} as Injector, {} as ViewContainerRef, { detectChanges: vi.fn(), markForCheck: vi.fn() } as unknown as ChangeDetectorRef, compiler as RuntimeCompilerService, {} as DomSanitizer, - {} as NgZService, - {} as HeliumService, - { destroyAllInstances: vi.fn(), ...classic } as unknown as ClassicVisualizationService + {} as NgZService ); const pendingResult = () => { @@ -145,195 +121,6 @@ describe('SVG and NULL invalidate pending Angular output', () => { expect(result.angularComponent).toBeNull(); expect(result.frontEndError).toBe(''); }); - - it('reports errors from the current Angular compilation', async () => { - const pending = pendingCompilation(); - const result = component({ createAndCompileTemplate: vi.fn().mockReturnValue(pending.promise) }); - result.result = { type: DatasetType.ANGULAR, data: '

    current

    ' }; - result.renderDefaultDisplay(); - - pending.reject(new Error('current compilation failed')); - await flushCompilation(); - - expect(result.angularComponent).toBeNull(); - expect(result.frontEndError).toBe('current compilation failed'); - }); -}); - -describe('result type transitions', () => { - it.each([DatasetType.SVG, DatasetType.NULL])('destroys an attached modern visualization for %s', type => { - const result = component(); - const destroy = vi.fn(); - const detach = vi.fn(); - const unsubscribe = vi.fn(); - const subscription = new Subscription(unsubscribe); - result.visualizations[0].instance = { destroy } as unknown as Visualization; - result.visualizations[0].changeSubscription = subscription; - result.portalOutlet = { hasAttached: () => true, detach } as unknown as CdkPortalOutlet; - result.result = { type, data: '' }; - - result.renderDefaultDisplay(); - - expect(destroy).toHaveBeenCalledOnce(); - expect(detach).toHaveBeenCalledOnce(); - expect(unsubscribe).toHaveBeenCalledOnce(); - expect(result.visualizations[0].instance).toBeUndefined(); - expect(result.visualizations[0].changeSubscription).toBeNull(); - }); - - it.each([DatasetType.SVG, DatasetType.NULL])('destroys a previous classic visualization for %s', type => { - const destroyInstance = vi.fn(); - const result = component({}, { destroyInstance }); - result.id = 'paragraph'; - result.visualizations.push({ - id: 'classic', - name: 'classic', - isClassic: true, - icon: {}, - Class: vi.fn() as unknown as HeliumClassicVisualizationConstructor, - instance: {} as HeliumClassicVisualization, - changeSubscription: null - }); - result.result = { type, data: '' }; - - result.renderDefaultDisplay(); - - expect(destroyInstance).toHaveBeenCalledExactlyOnceWith('pparagraph_classic'); - expect(result.visualizations.at(-1)?.instance).toBeUndefined(); - }); - - it('preserves an existing visualization during a TABLE refresh', () => { - const result = component(); - const destroy = vi.fn(); - const instance = { destroy } as unknown as Visualization; - result.visualizations[0].instance = instance; - result.result = { type: DatasetType.TABLE, data: 'column\nvalue' }; - const renderGraph = vi.spyOn(result, 'renderGraph').mockImplementation(() => {}); - - result.renderDefaultDisplay(); - - expect(renderGraph).toHaveBeenCalledOnce(); - expect(destroy).not.toHaveBeenCalled(); - expect(result.visualizations[0].instance).toBe(instance); - }); - - it.each([DatasetType.SVG, DatasetType.NULL])('cancels a pending classic visualization after %s', async type => { - const pending = pendingResult(); - const createClassicVisualization = vi.fn().mockReturnValue(pending.promise); - const result = component({}, { createClassicVisualization }); - result.id = 'paragraph'; - result.visualizations.push({ - id: 'classic', - name: 'classic', - isClassic: true, - icon: {}, - Class: vi.fn() as unknown as HeliumClassicVisualizationConstructor, - instance: undefined, - changeSubscription: null - }); - result.config = { graph: { ...new GraphConfig(), mode: 'classic' } }; - result.result = { type: DatasetType.TABLE, data: 'column\nvalue' }; - result.renderDefaultDisplay(); - const isCurrentRender = createClassicVisualization.mock.calls[0][5] as () => boolean; - expect(isCurrentRender()).toBe(true); - - result.result = { type, data: '' }; - result.renderDefaultDisplay(); - expect(isCurrentRender()).toBe(false); - pending.resolve(undefined); - await flushCompilation(); - - expect(result.visualizations.at(-1)?.instance).toBeUndefined(); - expect(result.frontEndError).toBe(''); - }); - - it('keeps the current classic instance when an obsolete render completes after returning to TABLE', async () => { - const previous = pendingResult(); - const current = pendingResult(); - const destroyInstance = vi.fn(); - const result = component( - {}, - { - createClassicVisualization: vi.fn().mockReturnValueOnce(previous.promise).mockReturnValueOnce(current.promise), - destroyInstance - } - ); - result.id = 'paragraph'; - result.visualizations.push({ - id: 'classic', - name: 'classic', - isClassic: true, - icon: {}, - Class: vi.fn() as unknown as HeliumClassicVisualizationConstructor, - instance: undefined, - changeSubscription: null - }); - result.config = { graph: { ...new GraphConfig(), mode: 'classic' } }; - result.result = { type: DatasetType.TABLE, data: 'column\nprevious' }; - result.renderDefaultDisplay(); - result.result = { type: DatasetType.NULL, data: '' }; - result.renderDefaultDisplay(); - result.result = { type: DatasetType.TABLE, data: 'column\ncurrent' }; - result.renderDefaultDisplay(); - const currentInstance = {} as HeliumClassicVisualization; - const previousInstance = {} as HeliumClassicVisualization; - - current.resolve(currentInstance); - await flushCompilation(); - previous.resolve(previousInstance); - await flushCompilation(); - - expect(result.visualizations.at(-1)?.instance).toBe(currentInstance); - expect(destroyInstance).toHaveBeenCalledExactlyOnceWith('pparagraph_classic', false, previousInstance); - }); - - it.each([DatasetType.SVG, DatasetType.NULL])( - 'removes classic visualization containers for %s in the template', - async type => { - await TestBed.configureTestingModule({ - declarations: [NotebookParagraphResultComponent], - imports: [CommonModule, PortalModule], - schemas: [NO_ERRORS_SCHEMA], - providers: [ - provideZoneChangeDetection(), - { provide: RuntimeCompilerService, useValue: {} }, - { provide: NgZService, useValue: { contextChanged: () => EMPTY } }, - { provide: HeliumService, useValue: { visualizationBundles: () => EMPTY } }, - { provide: ClassicVisualizationService, useValue: { destroyAllInstances: vi.fn() } } - ] - }) - .overrideComponent(NotebookParagraphResultComponent, { - set: { template, templateUrl: undefined, styles: [], styleUrls: [] } - }) - .compileComponents(); - const fixture = TestBed.createComponent(NotebookParagraphResultComponent); - const result = fixture.componentInstance; - result.published = true; - result.id = 'paragraph'; - result.visualizations.push({ - id: 'classic', - name: 'classic', - isClassic: true, - icon: {}, - Class: vi.fn() as unknown as HeliumClassicVisualizationConstructor, - instance: undefined, - changeSubscription: null - }); - result.config = { graph: { ...new GraphConfig(), mode: 'classic' } }; - result.result = { type: DatasetType.TABLE, data: 'column\nvalue' }; - vi.spyOn(result, 'renderGraph').mockImplementation(() => {}); - fixture.detectChanges(); - const element = fixture.nativeElement as HTMLElement; - const containers = '.classic-visualization-container, .transformation-setting, .visualization-setting'; - expect(element.querySelectorAll(containers)).toHaveLength(3); - - result.updateResult(result.config, { type, data: '' }); - fixture.detectChanges(); - - expect(element.querySelectorAll(containers)).toHaveLength(0); - expect(element.querySelectorAll('img')).toHaveLength(type === DatasetType.SVG ? 1 : 0); - } - ); }); describe('NotebookParagraphResultComponent HTML highlighting', () => { @@ -345,9 +132,7 @@ describe('NotebookParagraphResultComponent HTML highlighting', () => { {} as ChangeDetectorRef, {} as RuntimeCompilerService, sanitizer, - {} as NgZService, - {} as HeliumService, - {} as ClassicVisualizationService + {} as NgZService ); component.result = { type: DatasetType.HTML, @@ -363,3 +148,76 @@ describe('NotebookParagraphResultComponent HTML highlighting', () => { expect(output.querySelector('.hljs-keyword')?.textContent).toBe('const'); }); }); + +describe('built-in visualizations without external bundles', () => { + class TestVisualization extends Visualization { + render = vi.fn(); + refresh = vi.fn(); + destroy = vi.fn(); + + constructor(_outlet: CdkPortalOutlet, _container: ViewContainerRef, config: GraphConfig) { + super(config); + } + + getTransformation() { + return new TableTransformation(this.getConfig()); + } + } + + const tableResult = (mode: string) => { + const result = component(); + result.result = { type: DatasetType.TABLE, data: 'column\nvalue' }; + result.config = { graph: { ...new GraphConfig(), mode } }; + result.visualizations.forEach(item => (item.Class = TestVisualization)); + return result; + }; + + it.each(['table', 'multiBarChart', 'pieChart', 'lineChart', 'stackedAreaChart', 'scatterChart'])( + 'renders saved %s settings with the built-in visualization', + mode => { + const result = tableResult(mode); + result.config!.graph.height = 420; + result.renderDefaultDisplay(); + const instance = result.getCurrentVisualization().instance!; + + expect(instance.getConfig()).toBe(result.config!.graph); + expect(instance.getConfig().height).toBe(420); + expect(result.tableData.columns).toEqual(['column']); + expect(result.tableData.rows).toEqual([{ column: 'value' }]); + expect(result.frontEndError).toBe(''); + } + ); + + it('falls back to table data while preserving saved external visualization settings', () => { + const result = tableResult('external-chart'); + const original = JSON.parse(JSON.stringify(result.config)); + const configChange = vi.spyOn(result.configChange, 'emit'); + result.renderDefaultDisplay(); + + expect(result.getCurrentVisualization().id).toBe('table'); + expect(result.getCurrentVisualization().instance!.getConfig().mode).toBe('table'); + expect(result.tableData.rows).toEqual([{ column: 'value' }]); + expect(result.config).toEqual(original); + expect(configChange).not.toHaveBeenCalled(); + expect(result.frontEndError).toContain('external-chart'); + + result.switchMode('table'); + expect(result.config!.graph.mode).toBe('table'); + expect(result.frontEndError).toBe(''); + }); + + it('persists user chart changes and destroys the previous visualization', () => { + const result = tableResult('table'); + result.renderDefaultDisplay(); + const previous = result.getCurrentVisualization().instance as TestVisualization; + const configChange = vi.spyOn(result.configChange, 'emit'); + result.switchMode('lineChart'); + const graph = { ...result.config!.graph, height: 420 }; + result.getCurrentVisualization().instance!.configChange$!.next(graph); + + expect(previous.destroy).toHaveBeenCalledOnce(); + expect(result.config!.graph).toBe(graph); + expect(configChange).toHaveBeenLastCalledWith({ graph }); + expect(result.frontEndError).toBe(''); + }); +}); diff --git a/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.ts b/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.ts index e2a09068c2b..23d1a242ed1 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/share/result/result.component.ts @@ -28,7 +28,6 @@ import { import { DomSanitizer, SafeHtml, SafeUrl } from '@angular/platform-browser'; import { AnsiUp } from 'ansi_up'; import * as hljs from 'highlight.js'; -import { cloneDeep, isEqual } from 'lodash'; import { NzResizeEvent } from 'ng-zorro-antd/resizable'; import { Subject, Subscription } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -46,18 +45,7 @@ import { VisualizationStackedAreaChart } from '@zeppelin/sdk'; -import { - HeliumClassicVisualization, - HeliumClassicVisualizationConstructor, - HeliumVisualizationBundle -} from '@zeppelin/interfaces'; -import { - ClassicVisualizationService, - DynamicTemplate, - HeliumService, - NgZService, - RuntimeCompilerService -} from '@zeppelin/services'; +import { DynamicTemplate, NgZService, RuntimeCompilerService } from '@zeppelin/services'; import { TableData, Visualization, VisualizationConstructor } from '@zeppelin/visualization'; import { AreaChartVisualization, @@ -71,25 +59,12 @@ import { interface VisualizationItem { id: string; name: string; - changeSubscription: Subscription | null; -} - -interface ClassicVisualizationItem extends VisualizationItem { - isClassic: true; - icon: SafeHtml; - Class: HeliumClassicVisualizationConstructor; - instance: HeliumClassicVisualization | undefined; -} - -interface ModernVisualizationItem extends VisualizationItem { - isClassic: false; icon: string; Class: VisualizationConstructor; instance: Visualization | undefined; + changeSubscription: Subscription | null; } -type VisualizationItemType = ClassicVisualizationItem | ModernVisualizationItem; - @Component({ selector: 'zeppelin-notebook-paragraph-result', templateUrl: './result.component.html', @@ -110,7 +85,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, private destroy$ = new Subject(); private outputResetVersion = 0; - private destroyed = false; datasetType = DatasetType; angularComponent: DynamicTemplate | null = null; innerHTML: string | SafeHtml = ''; @@ -118,13 +92,12 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, imgData: string | SafeUrl = ''; tableData = new TableData(); frontEndError?: string; - visualizations: VisualizationItemType[] = [ + visualizations: VisualizationItem[] = [ { id: 'table', name: 'Table', icon: 'table', Class: TableVisualization, - isClassic: false, changeSubscription: null, instance: undefined }, @@ -133,7 +106,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, name: 'Bar Chart', icon: 'bar-chart', Class: BarChartVisualization, - isClassic: false, changeSubscription: null, instance: undefined }, @@ -142,7 +114,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, name: 'Pie Chart', icon: 'pie-chart', Class: PieChartVisualization, - isClassic: false, changeSubscription: null, instance: undefined }, @@ -151,7 +122,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, name: 'Line Chart', icon: 'line-chart', Class: LineChartVisualization, - isClassic: false, changeSubscription: null, instance: undefined }, @@ -160,7 +130,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, name: 'Area Chart', icon: 'area-chart', Class: AreaChartVisualization, - isClassic: false, changeSubscription: null, instance: undefined }, @@ -169,7 +138,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, name: 'Scatter Chart', icon: 'dot-chart', Class: ScatterChartVisualization, - isClassic: false, changeSubscription: null, instance: undefined } @@ -181,9 +149,7 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, private cdr: ChangeDetectorRef, private runtimeCompilerService: RuntimeCompilerService, private sanitizer: DomSanitizer, - private ngZService: NgZService, - private heliumService: HeliumService, - private classicVisualizationService: ClassicVisualizationService + private ngZService: NgZService ) {} ngOnInit() { @@ -195,70 +161,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, this.cdr.markForCheck(); } }); - this.heliumService - .visualizationBundles() - .pipe(takeUntil(this.destroy$)) - .subscribe(bundles => { - this.handleVisualizationBundles(bundles); - }); - } - - private handleVisualizationBundles(bundles: HeliumVisualizationBundle[]): void { - const newlyAddedBundleIds = this.addNewVisualizationBundles(bundles); - - this.checkAndTriggerReRender(newlyAddedBundleIds); - this.cdr.markForCheck(); - } - - private addNewVisualizationBundles(bundles: HeliumVisualizationBundle[]): string[] { - const newlyAddedBundleIds: string[] = []; - - bundles.forEach(bundle => { - // Check if this bundle is already in our visualizations array - const existingVisualization = this.visualizations.find(v => v.id === bundle.id); - if (!existingVisualization) { - // This is a new bundle - newlyAddedBundleIds.push(bundle.id); - const isClassic = !Visualization.prototype.isPrototypeOf(bundle.class.prototype); - if (isClassic) { - this.visualizations.push({ - id: bundle.id, - name: bundle.name, - icon: this.sanitizer.bypassSecurityTrustHtml(bundle.icon), - Class: bundle.class, - changeSubscription: null, - isClassic, - instance: undefined - }); - } - } - }); - - return newlyAddedBundleIds; - } - - private checkAndTriggerReRender(newlyAddedBundleIds: string[]): void { - // Re-render only if the current mode is one of the newly loaded bundles - if ( - this.result && - this.result.type === DatasetType.TABLE && - this.config && - this.config.graph && - newlyAddedBundleIds.length > 0 - ) { - const currentMode = this.config.graph.mode; - const isCurrentModeNewlyAdded = newlyAddedBundleIds.includes(currentMode); - - if (isCurrentModeNewlyAdded) { - const currentVisualization = this.visualizations.find(v => v.id === currentMode); - if (currentVisualization && currentVisualization.isClassic) { - // Trigger re-rendering for the specific classic visualization that just loaded - setTimeout(() => { - this.renderDefaultDisplay(); - }, 0); - } - } - } } exportFile(type: 'csv' | 'tsv'): void { @@ -444,142 +346,57 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, } setGraphConfig() { - const config = this.config; - if (!config || !config.graph) { - return; - } - const visualizationItem = this.visualizations.find(v => v.id === config.graph.mode); - if (!visualizationItem || !visualizationItem.instance) { - return; - } - if (visualizationItem.isClassic) { - const targetElementId = `p${this.id}_${config.graph.mode}`; - this.classicVisualizationService.setClassicVisualizationConfig(targetElementId, config.graph); - } else { - visualizationItem.instance.setConfig(config.graph); + if (this.config?.graph) { + this.getCurrentVisualization().instance?.setConfig(this.getDisplayGraphConfig()); } } - getCurrentVisualization() { - return this.visualizations.find(v => v.id === this.config?.graph.mode) ?? null; + getCurrentVisualization(): VisualizationItem { + return this.visualizations.find(v => v.id === this.config?.graph.mode) ?? this.visualizations[0]; + } + + private getDisplayGraphConfig(): GraphConfig { + const graph = this.config!.graph; + const mode = this.getCurrentVisualization().id; + return mode === graph.mode ? graph : { ...graph, mode }; } renderGraph() { this.setDefaultConfig(); - - const config = this.config!; - const visualizationItem = this.visualizations.find(v => v.id === config.graph.mode); - if (!visualizationItem) { - return; - } - this.destroyVisualizations(config.graph.mode); - - // Load tableData first - this is needed for both classic and modern visualizations + const visualizationItem = this.getCurrentVisualization(); + const graph = this.getDisplayGraphConfig(); + this.frontEndError = + graph.mode !== this.config!.graph.mode + ? `Visualization "${this.config!.graph.mode}" is unavailable. Showing table data.` + : ''; + this.destroyVisualizations(visualizationItem.id); this.tableData.loadParagraphResult(this.result); if (!visualizationItem.instance) { - if (visualizationItem.isClassic) { - // Classic visualization - delegate to ClassicVisualizationService - const targetElementId = `p${this.id}_${config.graph.mode}`; - const resetVersion = this.outputResetVersion; - const isCurrentRender = () => - !this.destroyed && - resetVersion === this.outputResetVersion && - targetElementId === `p${this.id}_${this.config?.graph?.mode}`; - const emitter = (c: GraphConfig) => { - if (!this.config) { - throw new Error('config is not defined'); - } - this.commitClassicVizConfigChange(c, this.config.graph.mode); - this.renderGraph(); - }; - - this.classicVisualizationService - .createClassicVisualization( - visualizationItem.Class, - targetElementId, - config.graph, - this.tableData, - emitter, - isCurrentRender - ) - .then(classicInstance => { - if (!classicInstance) { - return; - } - if (!isCurrentRender()) { - this.classicVisualizationService.destroyInstance(targetElementId, false, classicInstance); - return; - } - visualizationItem.instance = classicInstance; - this.cdr.markForCheck(); - }) - .catch(error => { - console.error('Failed to create classic visualization:', error); - }); - return; // Exit early for classic visualizations - } else { - // Modern visualization - const classicVisInstance = new visualizationItem.Class(this.portalOutlet, this.viewContainerRef, config.graph); - visualizationItem.instance = classicVisInstance; - visualizationItem.changeSubscription = classicVisInstance.configChanged().subscribe(c => { - if (!this.config) { - throw new Error('config is not defined'); - } - this.config.graph = c; - this.renderGraph(); - this.configChange.emit({ - graph: c - }); - }); - } + const instance = new visualizationItem.Class(this.portalOutlet, this.viewContainerRef, graph); + visualizationItem.instance = instance; + visualizationItem.changeSubscription = instance.configChanged().subscribe(c => { + this.config!.graph = c; + this.renderGraph(); + this.configChange.emit({ graph: c }); + }); } else { - if (visualizationItem.isClassic) { - // Update existing classic visualization - const targetElementId = `p${this.id}_${config.graph.mode}`; - this.classicVisualizationService.updateClassicVisualization(targetElementId, config.graph, this.tableData); - return; // Exit early for classic visualizations - } else { - visualizationItem.instance.setConfig(config.graph); - } + visualizationItem.instance.setConfig(graph); } - // For classic visualizations, rendering is already handled in the service - if (visualizationItem.isClassic) { - return; - } - - // TypeScript's control flow analysis doesn't properly narrow the discriminated union type - // after the early return above. This may be due to the TypeScript version (3.8) or the - // complexity of the union type. Using explicit type assertion to ensure type safety. - const modernVisualizationItem = visualizationItem as ModernVisualizationItem; - - // For modern visualizations, continue with standard rendering - const transformation = modernVisualizationItem.instance!.getTransformation(); - transformation.setConfig(config.graph); + const transformation = visualizationItem.instance.getTransformation(); + transformation.setConfig(graph); transformation.setTableData(this.tableData); - const transformed = transformation.transform(this.tableData); - modernVisualizationItem.instance!.render(transformed); + visualizationItem.instance.render(transformation.transform(this.tableData)); } destroyVisualizations(omit?: string) { this.visualizations.forEach(v => { if (v.id !== omit && v.instance) { - if (v.isClassic) { - // Destroy classic visualization through service - const targetElementId = `p${this.id}_${v.id}`; - this.classicVisualizationService.destroyInstance(targetElementId); - v.instance = undefined; - } else { - if (v.changeSubscription instanceof Subscription) { - v.changeSubscription.unsubscribe(); - v.changeSubscription = null; - } - if (typeof v.instance.destroy === 'function') { - v.instance.destroy(); - } - v.instance = undefined; - } + v.changeSubscription?.unsubscribe(); + v.changeSubscription = null; + v.instance.destroy(); + v.instance = undefined; } }); } @@ -626,13 +443,6 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, if (this.result.type === DatasetType.TABLE) { config.graph.height = height; this.setGraphConfig(); - - // Handle classic visualization resize - const visualizationItem = this.visualizations.find(v => v.id === config.graph.mode); - if (visualizationItem && visualizationItem.isClassic) { - const targetElementId = `p${this.id}_${this.config.graph.mode}`; - this.classicVisualizationService.resizeClassicVisualization(targetElementId); - } } this.sizeChange.emit({ width, height, col }); } @@ -642,52 +452,8 @@ export class NotebookParagraphResultComponent implements OnInit, AfterViewInit, } ngOnDestroy(): void { - this.destroyed = true; this.destroyVisualizations(); - this.classicVisualizationService.destroyAllInstances(true); this.destroy$.next(); this.destroy$.complete(); } - - private commitClassicVizConfigChange(configForMode: GraphConfig, mode: string) { - if (this.isPending) { - return; - } - - if (!this.config) { - throw new Error('config is not defined'); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const newConfigGraph: any = cloneDeep(this.config.graph) || {}; - - // copy setting for mode - if (!newConfigGraph.setting) { - newConfigGraph.setting = {}; - } - newConfigGraph.setting[mode] = cloneDeep(configForMode); - - // copy common setting - if (newConfigGraph.setting[mode]) { - newConfigGraph.commonSetting = newConfigGraph.setting[mode].common; - delete newConfigGraph.setting[mode].common; - } - // copy pivot setting - if (newConfigGraph.commonSetting?.pivot) { - newConfigGraph.keys = newConfigGraph.commonSetting.pivot.keys; - newConfigGraph.groups = newConfigGraph.commonSetting.pivot.groups; - newConfigGraph.values = newConfigGraph.commonSetting.pivot.values; - delete newConfigGraph.commonSetting.pivot; - } - - // don't send commitParagraphResult when config is the same. - // see https://issues.apache.org/jira/browse/ZEPPELIN-4280. - if (isEqual(this.config.graph, newConfigGraph)) { - return; - } - - this.configChange.emit({ graph: newConfigGraph }); - // Update local graph config - this.config.graph = newConfigGraph; - } } diff --git a/zeppelin-web-angular/src/app/pages/workspace/workspace.component.ts b/zeppelin-web-angular/src/app/pages/workspace/workspace.component.ts index e7623040170..ca2b8b9a3f3 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/workspace.component.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/workspace.component.ts @@ -16,7 +16,7 @@ import { isRecord } from '@zeppelin/utility'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { HeliumService, MessageService } from '@zeppelin/services'; +import { MessageService } from '@zeppelin/services'; import { setTheme } from '@zeppelin/visualizations'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -35,8 +35,7 @@ export class WorkspaceComponent implements OnInit, OnDestroy { constructor( public messageService: MessageService, private cdr: ChangeDetectorRef, - private nzMessageService: NzMessageService, - private heliumService: HeliumService + private nzMessageService: NzMessageService ) {} onActivate(component: unknown) { @@ -72,7 +71,6 @@ export class WorkspaceComponent implements OnInit, OnDestroy { ngOnInit() { setTheme(); this.setUpWebsocketReconnectMessage(); - this.heliumService.initPackages(); } ngOnDestroy(): void { diff --git a/zeppelin-web-angular/src/app/services/angular-drag-drop.service.spec.ts b/zeppelin-web-angular/src/app/services/angular-drag-drop.service.spec.ts deleted file mode 100644 index 98b0c8392bf..00000000000 --- a/zeppelin-web-angular/src/app/services/angular-drag-drop.service.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as angular from 'angular'; -import { describe, expect, it, vi } from 'vitest'; - -import { AngularDragDropService } from './angular-drag-drop.service'; - -type TestScope = angular.IScope & Record; - -interface CallbackService { - callEventCallback(scope: angular.IScope, callbackName: string, event: DragEvent): void; -} - -type DragDropFactory = ($parse: angular.IParseService) => CallbackService; -type AnnotatedDragDropFactory = ['$parse', DragDropFactory]; - -const createCallbackService = (): CallbackService => { - let registeredFactory: DragDropFactory | undefined; - const moduleStub = { - factory: (_name: string, definition: AnnotatedDragDropFactory) => { - registeredFactory = definition[1]; - return moduleStub; - }, - directive: () => { - return moduleStub; - } - }; - - new AngularDragDropService().addDragDropDirectives(moduleStub as unknown as angular.IModule); - - const $parse = ((expression: string) => (scope: angular.IScope) => { - return (scope as TestScope)[expression]; - }) as angular.IParseService; - - if (!registeredFactory) { - throw new Error('customDragDropService factory was not registered'); - } - return registeredFactory($parse); -}; - -describe('AngularDragDropService', () => { - it('invokes a scope callback with the drag event, UI value, and parsed arguments', () => { - const callbackService = createCallbackService(); - const callback = vi.fn(); - const argument = { name: 'axis' }; - const scope = { save: callback, axisSpec: argument } as unknown as TestScope; - const event = {} as DragEvent; - - callbackService.callEventCallback(scope, 'save(axisSpec)', event); - - expect(callback).toHaveBeenCalledWith(event, undefined, argument); - expect(callback.mock.instances[0]).toBe(scope); - }); - - it('ignores a missing callback', () => { - const callbackService = createCallbackService(); - const scope = {} as TestScope; - - expect(() => callbackService.callEventCallback(scope, 'missing()', {} as DragEvent)).not.toThrow(); - }); -}); diff --git a/zeppelin-web-angular/src/app/services/angular-drag-drop.service.ts b/zeppelin-web-angular/src/app/services/angular-drag-drop.service.ts deleted file mode 100644 index dcb63fc232f..00000000000 --- a/zeppelin-web-angular/src/app/services/angular-drag-drop.service.ts +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import * as angular from 'angular'; -import * as JQuery from 'jquery'; - -interface CustomDragDropService { - draggableScope: angular.IScope | null; - dragData: unknown | null; - dragIndex: number | null; - dragModelPath: null | string; - dragSettings: { placeholder?: string } | null; - draggableElement: HTMLElement | null; - - callEventCallback(scope: angular.IScope, callbackName: string, event: DragEvent, ui?: UI): void; - updateModel(scope: angular.IScope, modelPath: string, newValue: unknown, index?: number): void; - removeFromModel(scope: angular.IScope, modelPath: string, index?: number): void; -} - -interface UI { - draggable: JQuery | null; - helper: null; - position: { top: number; left: number }; - offset: { top: number; left: number }; -} - -type LegacyScope = angular.IScope & Record; - -interface LegacyCallbackOwner extends Record { - length?: number; -} - -type LegacyCallback = (...args: unknown[]) => unknown; - -const isLegacyCallbackOwner = (value: unknown): value is LegacyCallbackOwner => { - return typeof value === 'object' && value !== null && typeof value.constructor === 'function'; -}; - -const isLegacyCallback = (value: unknown): value is LegacyCallback => typeof value === 'function'; - -@Injectable({ - providedIn: 'root' -}) -export class AngularDragDropService { - constructor() {} - - addDragDropDirectives(module: angular.IModule): void { - // Drag and drop service to maintain state across directives - module.factory('customDragDropService', [ - '$parse', - function ($parse: angular.IParseService): CustomDragDropService { - return { - draggableScope: null, - dragData: null, - dragIndex: null, - dragModelPath: null, - dragSettings: null, - draggableElement: null, - - callEventCallback(scope, callbackStr, event, ui) { - if (!callbackStr) { - return; - } - - const { targetCallback, targetScope, args: extractedArgs } = extract(callbackStr); - const fullArgs = [event, ui].concat(extractedArgs); - - if (isLegacyCallback(targetCallback)) { - return targetCallback.apply(targetScope, fullArgs); - } - - function extract(_callbackStr: string) { - const legacyScope = scope as LegacyScope; - const atStartBracket = _callbackStr.indexOf('(') !== -1 ? _callbackStr.indexOf('(') : _callbackStr.length; - const atEndBracket = - _callbackStr.lastIndexOf(')') !== -1 ? _callbackStr.lastIndexOf(')') : _callbackStr.length; - - const argsString = _callbackStr.substring(atStartBracket + 1, atEndBracket); - const identifierTokens = argsString ? argsString.split(',') : []; - const args = identifierTokens.map(item => $parse(item.trim())(scope)); - - const dotIndex = _callbackStr.indexOf('.'); - const constructorName = dotIndex !== -1 ? _callbackStr.slice(0, dotIndex) : null; - const constructorCandidate = constructorName ? legacyScope[constructorName] : null; - const constructor = isLegacyCallbackOwner(constructorCandidate) ? constructorCandidate : null; - - const callbackOffset = typeof constructor?.length === 'number' ? constructor.length + 1 : 0; - const callbackName = _callbackStr.substring(callbackOffset, atStartBracket); - const callbackCandidate = legacyScope[callbackName]; - // If the expression is a method call, then the parsed constructor becomes its bound scope. - const _scope = callbackCandidate ? scope : constructor; - const callback = callbackCandidate || constructor?.[callbackName]; - - return { - args, - targetScope: _scope, - targetCallback: callback - }; - } - }, - - updateModel(scope, modelPath, newValue, index) { - const getter = $parse(modelPath); - const setter = getter.assign; - const modelValue = getter(scope); - - if (angular.isArray(modelValue)) { - if (typeof index === 'number') { - modelValue[index] = newValue; - } else { - modelValue.push(newValue); - } - } else { - if (setter) { - setter(scope, newValue); - } - } - - scope.$apply(); - }, - - removeFromModel(scope, modelPath, index) { - const getter = $parse(modelPath); - const modelValue = getter(scope); - - if (angular.isArray(modelValue) && typeof index === 'number') { - modelValue.splice(index, 1); - scope.$apply(); - } - } - }; - } - ]); - - // jqyoui-draggable directive - module.directive('jqyouiDraggable', [ - 'customDragDropService', - function (dragDropService: CustomDragDropService) { - return { - restrict: 'A', - link(scope, element, attrs) { - const el = element[0]; - - // Check if dragging is enabled - const isDragEnabled = function () { - return attrs.drag === 'true' || scope.$eval(attrs.drag) === true; - }; - - // Make element draggable when enabled - const updateDraggable = function () { - el.draggable = isDragEnabled(); - }; - - updateDraggable(); - - // Watch for changes in drag attribute - scope.$watch(function () { - return scope.$eval(attrs.drag); - }, updateDraggable); - - el.addEventListener('dragstart', function (event) { - if (!isDragEnabled()) { - event.preventDefault(); - return; - } - - const dragSettings = scope.$eval(attrs.jqyouiDraggable) || {}; - const ngModel = attrs.ngModel; - - if (ngModel) { - dragDropService.draggableScope = scope; - dragDropService.dragIndex = dragSettings.index; - dragDropService.dragModelPath = ngModel; - dragDropService.dragSettings = dragSettings; - dragDropService.draggableElement = el; - - const modelValue = scope.$eval(ngModel); - if (angular.isArray(modelValue) && typeof dragSettings.index === 'number') { - dragDropService.dragData = angular.copy(modelValue[dragSettings.index]); - } else { - dragDropService.dragData = angular.copy(modelValue); - } - - // Store data in dataTransfer for compatibility - if (event.dataTransfer) { - event.dataTransfer.setData( - 'text/plain', - JSON.stringify({ - data: dragDropService.dragData, - index: dragDropService.dragIndex, - modelPath: ngModel - }) - ); - event.dataTransfer.effectAllowed = 'move'; - } - } - - // Add visual feedback - el.style.opacity = '0.5'; - - // Call onStart callback if provided - if (dragSettings.onStart) { - const ui: UI = { - draggable: angular.element(el), - helper: null, - position: { top: event.clientY, left: event.clientX }, - offset: { top: event.pageY, left: event.pageX } - }; - dragDropService.callEventCallback(scope, dragSettings.onStart, event, ui); - } - }); - - el.addEventListener('dragend', function (event) { - // Remove visual feedback - el.style.opacity = ''; - - const dragSettings = scope.$eval(attrs.jqyouiDraggable) || {}; - - // Call onStop callback if provided - if (dragSettings.onStop) { - const ui = { - draggable: angular.element(el), - helper: null, - position: { top: event.clientY, left: event.clientX }, - offset: { top: event.pageY, left: event.pageX } - }; - dragDropService.callEventCallback(scope, dragSettings.onStop, event, ui); - } - }); - } - }; - } - ]); - - // jqyoui-droppable directive - module.directive('jqyouiDroppable', [ - 'customDragDropService', - function (dragDropService: CustomDragDropService) { - return { - restrict: 'A', - link(scope, element, attrs) { - const el = element[0]; - - // Check if dropping is enabled - const isDropEnabled = function () { - return attrs.drop === 'true' || scope.$eval(attrs.drop) === true; - }; - - el.addEventListener('dragover', function (event) { - if (!isDropEnabled()) { - return; - } - - event.preventDefault(); - if (event.dataTransfer) { - event.dataTransfer.dropEffect = 'move'; - } - - // Add visual feedback - el.style.backgroundColor = '#f0f0f0'; - }); - - el.addEventListener('dragleave', function () { - // Remove visual feedback - el.style.backgroundColor = ''; - }); - - el.addEventListener('drop', function (event) { - if (!isDropEnabled()) { - return; - } - - event.preventDefault(); - - // Remove visual feedback - el.style.backgroundColor = ''; - - const dropSettings = scope.$eval(attrs.jqyouiDroppable) || {}; - const dropModel = attrs.ngModel; - - if (!dropModel || !dragDropService.dragData) { - return; - } - - // Get drag data - const dragData = dragDropService.dragData; - const dragIndex = dragDropService.dragIndex; - const draggableScope = dragDropService.draggableScope; - const dragModelPath = dragDropService.dragModelPath; - - // Handle different drop scenarios - if (dropSettings.multiple) { - // Multiple items can be dropped - add to array - dragDropService.updateModel(scope, dropModel, dragData); - } else { - // Single item drop - replace existing value - const dropIndex = dropSettings.index; - if (typeof dropIndex === 'number') { - dragDropService.updateModel(scope, dropModel, dragData, dropIndex); - } else { - dragDropService.updateModel(scope, dropModel, dragData); - } - } - - // Remove from source if it's a move operation (not copy) - // Check placeholder setting to determine if we should remove from source - const dragSettings: CustomDragDropService['dragSettings'] = dragDropService.dragSettings || {}; - const shouldRemoveFromSource = - draggableScope && - typeof dragIndex === 'number' && - dragModelPath && - dragSettings.placeholder !== 'keep' && - !dropSettings.deepCopy; - - if (shouldRemoveFromSource && draggableScope) { - dragDropService.removeFromModel(draggableScope, dragModelPath ?? '', dragIndex ?? undefined); - } - - // Call onDrop callback if provided - if (dropSettings.onDrop) { - // Create ui object similar to jQuery UI for compatibility - const ui = { - draggable: dragDropService.draggableElement - ? angular.element(dragDropService.draggableElement) - : null, - helper: null, // HTML5 drag doesn't have helper concept - position: { top: event.clientY, left: event.clientX }, - offset: { top: event.pageY, left: event.pageX } - }; - - dragDropService.callEventCallback(scope, dropSettings.onDrop, event, ui); - } - - // Clear drag data - dragDropService.dragData = null; - dragDropService.dragIndex = null; - dragDropService.draggableScope = null; - dragDropService.dragModelPath = null; - dragDropService.dragSettings = null; - dragDropService.draggableElement = null; - }); - } - }; - } - ]); - } -} diff --git a/zeppelin-web-angular/src/app/services/bootstrap-compatibility.service.ts b/zeppelin-web-angular/src/app/services/bootstrap-compatibility.service.ts deleted file mode 100644 index 1e189025d0b..00000000000 --- a/zeppelin-web-angular/src/app/services/bootstrap-compatibility.service.ts +++ /dev/null @@ -1,490 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class BootstrapCompatibilityService { - private bootstrapStylesInjected = false; - private readonly styleId = 'zeppelin-bootstrap-compat-styles'; - - // Bootstrap compatibility styles for classic visualizations - private readonly bootstrapCompatStyles = ` - /* Bootstrap compatibility styles for classic visualization templates */ - .panel { - margin-bottom: 20px; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); - } - .panel-heading { - padding: 10px 15px; - border-bottom: 1px solid #ddd; - border-top-left-radius: 3px; - border-top-right-radius: 3px; - background-color: #f5f5f5; - } - .panel-body { - padding: 15px; - } - .btn { - display: inline-block; - margin-bottom: 0; - font-weight: 400; - text-align: center; - white-space: nowrap; - vertical-align: middle; - cursor: pointer; - user-select: none; - background-image: none; - border: 1px solid transparent; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - border-radius: 4px; - text-decoration: none; - } - .btn:hover, .btn:focus { - color: #333; - text-decoration: none; - } - .btn:active { - background-image: none; - outline: 0; - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - } - .btn-default { - color: #333; - background-color: #fff; - border-color: #ccc; - } - .btn-default:hover, .btn-default:focus { - color: #333; - background-color: #e6e6e6; - border-color: #adadad; - } - .btn-default:active { - color: #333; - background-color: #e6e6e6; - border-color: #adadad; - } - .btn-primary { - color: #fff; - background-color: #337ab7; - border-color: #2e6da4; - } - .btn-primary:hover, .btn-primary:focus { - color: #fff; - background-color: #286090; - border-color: #204d74; - } - .btn-xs { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; - } - .btn-sm { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; - } - .btn-group { - position: relative; - display: inline-block; - vertical-align: middle; - } - .btn-group > .btn { - position: relative; - float: left; - } - .btn-group > .btn:hover, .btn-group > .btn:focus, .btn-group > .btn:active { - z-index: 2; - } - .btn-group .btn + .btn { - margin-left: -1px; - } - .btn-group > .btn:not(:first-child):not(:last-child) { - border-radius: 0; - } - .btn-group > .btn:first-child:not(:last-child) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } - .btn-group > .btn:last-child:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } - .dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - font-size: 14px; - text-align: left; - list-style: none; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 4px; - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - } - .dropdown-menu > li > a { - display: block; - padding: 3px 20px; - clear: both; - font-weight: 400; - line-height: 1.42857143; - color: #333; - white-space: nowrap; - text-decoration: none; - } - .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { - color: #262626; - background-color: #f5f5f5; - } - .caret { - display: inline-block; - width: 0; - height: 0; - margin-left: 2px; - vertical-align: middle; - border-top: 4px solid; - border-right: 4px solid transparent; - border-left: 4px solid transparent; - } - .label { - display: inline; - padding: 0.2em 0.6em 0.3em; - font-size: 75%; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: 0.25em; - } - .label-default { - background-color: #777; - } - .row { - margin-right: -15px; - margin-left: -15px; - } - .row:before, .row:after { - display: table; - content: " "; - } - .row:after { - clear: both; - } - .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, - .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, - .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, - .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, - .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, - .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, - .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, - .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, - .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, - .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, - .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, - .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { - position: relative; - min-height: 1px; - padding-right: 15px; - padding-left: 15px; - } - .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { - float: left; - } - .col-xs-12 { width: 100%; } - .col-xs-11 { width: 91.66666667%; } - .col-xs-10 { width: 83.33333333%; } - .col-xs-9 { width: 75%; } - .col-xs-8 { width: 66.66666667%; } - .col-xs-7 { width: 58.33333333%; } - .col-xs-6 { width: 50%; } - .col-xs-5 { width: 41.66666667%; } - .col-xs-4 { width: 33.33333333%; } - .col-xs-3 { width: 25%; } - .col-xs-2 { width: 16.66666667%; } - .col-xs-1 { width: 8.33333333%; } - @media (min-width: 768px) { - .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { - float: left; - } - .col-sm-12 { width: 100%; } - .col-sm-11 { width: 91.66666667%; } - .col-sm-10 { width: 83.33333333%; } - .col-sm-9 { width: 75%; } - .col-sm-8 { width: 66.66666667%; } - .col-sm-7 { width: 58.33333333%; } - .col-sm-6 { width: 50%; } - .col-sm-5 { width: 41.66666667%; } - .col-sm-4 { width: 33.33333333%; } - .col-sm-3 { width: 25%; } - .col-sm-2 { width: 16.66666667%; } - .col-sm-1 { width: 8.33333333%; } - } - @media (min-width: 992px) { - .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { - float: left; - } - .col-md-12 { width: 100%; } - .col-md-11 { width: 91.66666667%; } - .col-md-10 { width: 83.33333333%; } - .col-md-9 { width: 75%; } - .col-md-8 { width: 66.66666667%; } - .col-md-7 { width: 58.33333333%; } - .col-md-6 { width: 50%; } - .col-md-5 { width: 41.66666667%; } - .col-md-4 { width: 33.33333333%; } - .col-md-3 { width: 25%; } - .col-md-2 { width: 16.66666667%; } - .col-md-1 { width: 8.33333333%; } - } - .list-unstyled { - padding-left: 0; - list-style: none; - } - .form-group { - margin-bottom: 15px; - } - .form-control { - display: block; - width: 100%; - height: 34px; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - color: #555; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 4px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; - } - .form-control:focus { - border-color: #66afe9; - outline: 0; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); - } - .input-sm { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; - } - .input-group { - position: relative; - display: table; - border-collapse: separate; - } - .input-group .form-control { - position: relative; - z-index: 2; - float: left; - width: 100%; - margin-bottom: 0; - } - .input-group-addon { - padding: 6px 12px; - font-size: 14px; - font-weight: 400; - line-height: 1; - color: #555; - text-align: center; - background-color: #eee; - border: 1px solid #ccc; - border-radius: 4px; - display: table-cell; - white-space: nowrap; - vertical-align: middle; - } - .table { - width: 100%; - max-width: 100%; - margin-bottom: 20px; - background-color: transparent; - } - .table > thead > tr > th, - .table > tbody > tr > th, - .table > tfoot > tr > th, - .table > thead > tr > td, - .table > tbody > tr > td, - .table > tfoot > tr > td { - padding: 8px; - line-height: 1.42857143; - vertical-align: top; - border-top: 1px solid #ddd; - } - .table > thead > tr > th { - vertical-align: bottom; - border-bottom: 2px solid #ddd; - } - .table-striped > tbody > tr:nth-of-type(odd) { - background-color: #f9f9f9; - } - .radio-inline { - position: relative; - display: inline-block; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - vertical-align: middle; - cursor: pointer; - } - .radio-inline input[type="radio"] { - position: absolute; - margin-left: -20px; - } - .form-check { - position: relative; - display: block; - margin-bottom: 0.5rem; - } - .glyphicon { - position: relative; - top: 1px; - display: inline-block; - font-style: normal; - font-weight: 400; - line-height: 1; - } - .glyphicon-ok:before { content: "✓"; } - .glyphicon-floppy-disk:before { content: "💾"; } - .noDot { - list-style: none; - padding: 0; - margin: 0; - } - .liVertical { - display: inline-block; - margin: 2px; - } - .columns { - display: block; - height: 100%; - } - .lightBold { - font-weight: 500; - } - .network-labels { - margin: 5px; - } - .network-badge-settings { - margin-bottom: 10px; - } - - /* Table Display styles from paragraph.css */ - .tableDisplay { - margin-top: 2px; - } - .tableDisplay img { - display: block; - max-width: 100%; - height: auto; - } - .tableDisplay .btn-group span { - margin: 10px 0 0 10px; - font-size: 12px; - } - .tableDisplay .btn-group span a { - cursor: pointer; - } - .tableDisplay .option { - padding: 5px 5px 5px 5px; - font-size: 12px; - height: auto; - overflow: auto; - border-top: 1px solid #ecf0f1; - } - .tableDisplay .option .columns { - height: 100%; - } - .tableDisplay .option .columns ul { - background: white; - overflow: auto; - width: auto; - padding: 3px 3px 3px 3px; - height: 150px; - border: 1px solid #CCC; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - } - .tableDisplay .option .columns ul li { - margin: 3px 3px 3px 3px; - } - .tableDisplay .option .columns ul li span { - cursor: pointer; - margin-left: 3px; - margin-top: 3px; - } - .tableDisplay .option .columns ul li div ul { - width: auto; - height: auto; - } - .tableDisplay .option .columns ul li div ul li a { - padding: 0; - margin: 0; - cursor: pointer; - } - .tableDisplay .option .columns a:focus, - .tableDisplay .option .columns a:hover { - text-decoration: none; - outline: 0; - outline-offset: 0; - } - .paragraph .tableDisplay .hljs { - background: none; - } - `; - - /** - * Inject Bootstrap compatibility styles into the document head - * This ensures that external AngularJS templates can use Bootstrap classes - */ - injectBootstrapStyles(): void { - if (this.bootstrapStylesInjected) { - return; // Already injected - } - - // Check if styles already exist in DOM - if (document.getElementById(this.styleId)) { - this.bootstrapStylesInjected = true; - return; - } - - const styleElement = document.createElement('style'); - styleElement.id = this.styleId; - styleElement.appendChild(document.createTextNode(this.bootstrapCompatStyles)); - - // Insert at the beginning of head to allow overrides - const head = document.getElementsByTagName('head')[0]; - head.insertBefore(styleElement, head.firstChild); - - this.bootstrapStylesInjected = true; - } -} diff --git a/zeppelin-web-angular/src/app/services/classic-visualization.service.spec.ts b/zeppelin-web-angular/src/app/services/classic-visualization.service.spec.ts deleted file mode 100644 index cd27b4ca55b..00000000000 --- a/zeppelin-web-angular/src/app/services/classic-visualization.service.spec.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { HttpClient } from '@angular/common/http'; -import { Injector } from '@angular/core'; -import { HeliumClassicVisualization, HeliumClassicVisualizationConstructor } from '@zeppelin/interfaces'; -import { GraphConfig } from '@zeppelin/sdk'; -import { TableData } from '@zeppelin/visualization'; -import { afterEach, describe, expect, it, vi } from 'vitest'; - -import { AngularDragDropService } from './angular-drag-drop.service'; -import { BootstrapCompatibilityService } from './bootstrap-compatibility.service'; -import { ClassicVisualizationService } from './classic-visualization.service'; -import { TableDataAdapterService } from './table-data-adapter.service'; - -const service = () => { - const injectBootstrapStyles = vi.fn(); - const instance = new ClassicVisualizationService( - {} as Injector, - {} as TableDataAdapterService, - {} as HttpClient, - {} as AngularDragDropService, - { injectBootstrapStyles } as unknown as BootstrapCompatibilityService - ); - return { instance, injectBootstrapStyles }; -}; - -afterEach(() => { - document.body.replaceChildren(); - vi.useRealTimers(); -}); - -describe('classic visualization cancellation', () => { - it('does not destroy a newer instance when an obsolete completion cleans up the same target', () => { - const { instance } = service(); - const destroy = vi.fn(); - const current = { destroy } as unknown as HeliumClassicVisualization; - const registry = instance as unknown as { - activeInstanceInfos: Map; - }; - registry.activeInstanceInfos.set('visualization', { instance: current }); - - instance.destroyInstance('visualization', false, {} as HeliumClassicVisualization); - - expect(destroy).not.toHaveBeenCalled(); - expect(registry.activeInstanceInfos.get('visualization')?.instance).toBe(current); - }); - it('cancels before allocation when its resolved target is removed before the await resumes', async () => { - const { instance, injectBootstrapStyles } = service(); - const target = document.createElement('div'); - target.id = 'visualization'; - document.body.appendChild(target); - let active = true; - const constructor = vi.fn() as unknown as HeliumClassicVisualizationConstructor; - const pending = instance.createClassicVisualization( - constructor, - target.id, - new GraphConfig(), - new TableData(), - vi.fn(), - () => active - ); - - target.remove(); - active = false; - - await expect(pending).resolves.toBeUndefined(); - expect(injectBootstrapStyles).not.toHaveBeenCalled(); - expect(constructor).not.toHaveBeenCalled(); - }); - - it('stops polling without an error when a pending target is cancelled', async () => { - vi.useFakeTimers(); - const { instance, injectBootstrapStyles } = service(); - let active = true; - const pending = instance.createClassicVisualization( - vi.fn() as unknown as HeliumClassicVisualizationConstructor, - 'missing-target', - new GraphConfig(), - new TableData(), - vi.fn(), - () => active - ); - - active = false; - await vi.advanceTimersByTimeAsync(100); - - await expect(pending).resolves.toBeUndefined(); - expect(vi.getTimerCount()).toBe(0); - expect(injectBootstrapStyles).not.toHaveBeenCalled(); - }); -}); diff --git a/zeppelin-web-angular/src/app/services/classic-visualization.service.ts b/zeppelin-web-angular/src/app/services/classic-visualization.service.ts deleted file mode 100644 index dd011532a3e..00000000000 --- a/zeppelin-web-angular/src/app/services/classic-visualization.service.ts +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { HttpClient } from '@angular/common/http'; -import { Injectable, Injector } from '@angular/core'; -import { lastValueFrom } from 'rxjs'; -import { - HeliumClassicTransformation, - HeliumClassicVisualization, - HeliumClassicVisualizationConstructor -} from '@zeppelin/interfaces'; -import { GraphConfig, ParagraphConfigResult } from '@zeppelin/sdk'; -import { TableData } from '@zeppelin/visualization'; -import * as angular from 'angular'; -import { cloneDeep } from 'lodash'; - -import { AngularDragDropService } from './angular-drag-drop.service'; -import { BootstrapCompatibilityService } from './bootstrap-compatibility.service'; -import { TableDataAdapterService } from './table-data-adapter.service'; - -interface ClassicVisualizationInstanceInfo { - instance: HeliumClassicVisualization; - targetEl: HTMLElement; - scope: angular.IScope; - appName: string; - injector: angular.auto.IInjectorService; -} - -@Injectable({ - providedIn: 'root' -}) -export class ClassicVisualizationService { - private appCounter = 0; - private activeInstanceInfos = new Map(); - - // Template cache for known HTML templates - private templateCache = new Map(); - - constructor( - private injector: Injector, - private tableDataAdapter: TableDataAdapterService, - private http: HttpClient, - private angularDragDropService: AngularDragDropService, - private bootstrapCompatibilityService: BootstrapCompatibilityService - ) {} - - // Map of template URLs to asset file paths - private templateAssetMapping = new Map([ - [ - 'app/tabledata/advanced-transformation-setting.html', - 'assets/classic-visualization-templates/advanced-transformation-setting.html' - ], - [ - 'app/tabledata/columnselector_settings.html', - 'assets/classic-visualization-templates/columnselector_settings.html' - ], - ['app/tabledata/network_settings.html', 'assets/classic-visualization-templates/network_settings.html'], - ['app/tabledata/pivot_settings.html', 'assets/classic-visualization-templates/pivot_settings.html'] - ]); - - // Custom $templateRequest implementation that intercepts known template paths - private createCustomTemplateRequest( - originalTemplateRequest: angular.ITemplateRequestService - ): (tpl: string, ignorRequestError?: boolean) => Promise | angular.IPromise { - return (templateUrl: string, ignorRequestError?: boolean) => { - // Check if we have a cached template for this URL - if (this.templateCache.has(templateUrl)) { - // Return a promise that resolves with the cached template - return Promise.resolve(this.templateCache.get(templateUrl) ?? ''); - } - - // Check if this is a known template that should be loaded from assets - const assetPath = this.templateAssetMapping.get(templateUrl); - if (assetPath) { - // Load from assets and cache the result - return lastValueFrom(this.http.get(assetPath, { responseType: 'text' })) - .then((templateContent: string) => { - // Cache the loaded template - this.templateCache.set(templateUrl, templateContent); - return templateContent; - }) - .catch(error => { - console.error(`Failed to load template from ${assetPath}:`, error); - // Fallback to original $templateRequest - return originalTemplateRequest(templateUrl, ignorRequestError); - }); - } - - // For unknown templates, delegate to the original $templateRequest - return originalTemplateRequest(templateUrl, ignorRequestError); - }; - } - - private waitForElement( - elementId: string, - isCurrentRender: () => boolean, - maxRetries = 50, - interval = 100 - ): Promise { - return new Promise((resolve, reject) => { - let retries = 0; - - const checkElement = () => { - if (!isCurrentRender()) { - resolve(undefined); - return; - } - const element = document.getElementById(elementId); - if (element) { - resolve(element); - return; - } - - retries++; - if (retries >= maxRetries) { - reject(new Error(`Element not found after ${maxRetries} retries: ${elementId}`)); - return; - } - - setTimeout(checkElement, interval); - }; - - checkElement(); - }); - } - - private getTransformationSettingElement(targetElementId: string): HTMLElement | null { - // Extract the base ID from targetElementId (e.g., "p123_table" -> "123_table") - const baseId = targetElementId.replace(/^p/, ''); - const trSettingId = `trsetting${baseId}`; - const element = document.getElementById(trSettingId); - return element; - } - - private getVisualizationSettingElement(targetElementId: string): HTMLElement | null { - // Extract the base ID from targetElementId (e.g., "p123_table" -> "123_table") - const baseId = targetElementId.replace(/^p/, ''); - const vizSettingId = `vizsetting${baseId}`; - const element = document.getElementById(vizSettingId); - return element; - } - - private waitForTransformationScopeAndApply( - transformation: HeliumClassicTransformation, - timeout: angular.ITimeoutService - ): void { - const waitForTransformationScope = () => { - if (transformation._scope) { - transformation._scope.$apply(); - } else { - timeout(waitForTransformationScope, 10); - } - }; - timeout(waitForTransformationScope, 0); - } - - async createClassicVisualization( - visConstructor: HeliumClassicVisualizationConstructor, - targetElementId: string, - config: GraphConfig, - tableData: TableData, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - emitter: (config: any) => void, - isCurrentRender: () => boolean - ): Promise { - // Wait for DOM element to be available - const targetElement = await this.waitForElement(targetElementId, isCurrentRender); - if (!targetElement || !isCurrentRender()) { - return undefined; - } - - // Inject Bootstrap compatibility styles before creating visualization - this.bootstrapCompatibilityService.injectBootstrapStyles(); - - // Clean up any existing instance for this element - this.destroyInstance(targetElementId); - - const { injector, appName } = this.getOrCreateInjector(targetElement); - - const rootScope = injector.get('$rootScope'); - const compile = injector.get('$compile'); - const originalTemplateRequest = injector.get('$templateRequest'); - - // Create custom templateRequest that intercepts known template paths - const templateRequest = this.createCustomTemplateRequest(originalTemplateRequest); - const timeout = injector.get('$timeout'); - - // Create scope for this visualization - const scope = rootScope.$new(true); - - // Create angular element wrapper - const angularElement = angular.element(targetElement); - - // Convert modern TableData to classic format - const classicTableData = this.tableDataAdapter.createClassicTableDataProxy(tableData); - - // Instantiate the classic visualization - const configForMode = this.getClassicVizConfig(config); - const vizInstance = new visConstructor(angularElement, configForMode); - - // Inject AngularJS dependencies that classic visualizations expect - vizInstance._emitter = emitter; - vizInstance._compile = compile; - vizInstance._createNewScope = () => rootScope.$new(true); - vizInstance._templateRequest = templateRequest; - - // Get or create setting elements - const transformationSettingEl = this.getTransformationSettingElement(targetElementId); - const visualizationSettingEl = this.getVisualizationSettingElement(targetElementId); - if (!transformationSettingEl || !visualizationSettingEl) { - throw new Error('Failed to find setting elements for classic visualization'); - } - - // Setup transformation if available - const transformation = vizInstance.getTransformation(); - if (transformation) { - transformation._emitter = emitter; - transformation._templateRequest = templateRequest; - transformation._compile = compile; - transformation._createNewScope = () => rootScope.$new(true); - - // Set config and transform data - transformation.setConfig(configForMode); - const transformed = transformation.transform(classicTableData); - - // Render transformation setting - transformation.renderSetting(angular.element(transformationSettingEl)); - - // Wait for transformation rendering to complete (including async template loading) - this.waitForTransformationScopeAndApply(transformation, timeout); - - // Render the visualization - vizInstance.render(transformed); - } else { - // If no transformation, render directly - vizInstance.render(classicTableData); - } - - // Render visualization setting - vizInstance.renderSetting(angular.element(visualizationSettingEl)); - - // Activate the visualization - vizInstance.activate(); - - // Store the instance for cleanup later - this.activeInstanceInfos.set(targetElementId, { - instance: vizInstance, - targetEl: targetElement, - scope, - appName, - injector - }); - - return vizInstance; - } - - private getOrCreateInjector(targetElement: HTMLElement): { - injector: angular.auto.IInjectorService; - appName: string; - } { - // Check if element is already bootstrapped - const existingInjector = angular.element(targetElement).injector(); - - if (existingInjector) { - // Reuse existing bootstrap - return { - injector: existingInjector, - appName: 'existingApp' // We don't need the actual name for reuse - }; - } else { - // Create unique app name - const appName = `classicVizApp_${this.appCounter++}`; - - // Create AngularJS module - const module = angular.module(appName, []); - - // Add custom drag and drop directives - this.angularDragDropService.addDragDropDirectives(module); - - // Create AngularJS app and bootstrap - const injector = angular.bootstrap(targetElement, [appName]); - - return { - injector, - appName - }; - } - } - - updateClassicVisualization(targetElementId: string, config: GraphConfig, tableData: TableData): void { - const instanceInfo = this.activeInstanceInfos.get(targetElementId); - if (!instanceInfo) { - return; - } - - const { instance } = instanceInfo; - - const configForMode = this.getClassicVizConfig(config); - - try { - // Convert modern TableData to classic format - const classicTableData = this.tableDataAdapter.createClassicTableDataProxy(tableData); - - // Get or create setting elements - const transformationSettingEl = this.getTransformationSettingElement(targetElementId); - const visualizationSettingEl = this.getVisualizationSettingElement(targetElementId); - if (!transformationSettingEl || !visualizationSettingEl) { - throw new Error('Failed to find setting elements for classic visualization'); - } - - instance.setConfig(configForMode); - - // Update transformation and re-render - const transformation = instance.getTransformation(); - if (transformation) { - transformation.setConfig(configForMode); - const transformed = transformation.transform(classicTableData); - - // Re-render transformation setting - transformation.renderSetting(angular.element(transformationSettingEl)); - - // Wait for transformation rendering to complete (including async template loading) - const { injector } = instanceInfo; - const timeout = injector.get('$timeout'); - this.waitForTransformationScopeAndApply(transformation, timeout); - - instance.render(transformed); - } else { - instance.render(classicTableData); - } - - // Re-render visualization setting - instance.renderSetting(angular.element(visualizationSettingEl)); - - // Refresh if available - instance.refresh(); - } catch (error) { - console.error('Error updating classic visualization:', error); - } - } - - setClassicVisualizationConfig(targetElementId: string, config: GraphConfig): void { - const instanceInfo = this.activeInstanceInfos.get(targetElementId); - if (!instanceInfo) { - return; - } - - const { instance } = instanceInfo; - - try { - instance.setConfig(config); - - instance.refresh(); - } catch (error) { - console.error('Error setting classic visualization config:', error); - } - } - - resizeClassicVisualization(targetElementId: string): void { - const instanceInfo = this.activeInstanceInfos.get(targetElementId); - if (!instanceInfo) { - return; - } - - const { instance } = instanceInfo; - - try { - instance.resize(); - } catch (error) { - console.error('Error resizing classic visualization:', error); - } - } - - destroyInstance( - targetElementId: string, - forceCleanBootstrap = false, - expectedInstance?: HeliumClassicVisualization - ): void { - const instanceInfo = this.activeInstanceInfos.get(targetElementId); - if (!instanceInfo || (expectedInstance && instanceInfo.instance !== expectedInstance)) { - return; - } - - const { instance, targetEl, scope } = instanceInfo; - - try { - // Destroy the visualization instance - instance.destroy(); - - // Destroy the scope - scope.$destroy(); - - // Clean up the DOM content but preserve the element - angular.element(targetEl).empty(); - - // If forceCleanBootstrap is true, completely remove AngularJS data - if (forceCleanBootstrap) { - // Remove all AngularJS data from the element - angular.element(targetEl).removeData(); - // Remove all classes added by AngularJS - angular.element(targetEl).removeClass('ng-scope'); - } - - this.activeInstanceInfos.delete(targetElementId); - } catch (error) { - console.error('Error destroying classic visualization:', error); - } - } - - destroyAllInstances(forceCleanBootstrap = false): void { - const elementIds = Array.from(this.activeInstanceInfos.keys()); - elementIds.forEach(elementId => { - this.destroyInstance(elementId, forceCleanBootstrap); - }); - } - - private getClassicVizConfig(graph: GraphConfig) { - const mode = graph.mode; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const configForMode: any = graph?.setting?.[mode as keyof ParagraphConfigResult['graph']['setting']] - ? cloneDeep(graph.setting[mode as keyof ParagraphConfigResult['graph']['setting']]) - : {}; - - // copy common setting - configForMode.common = cloneDeep(graph.commonSetting) || {}; - - // copy pivot setting - if (graph.keys) { - configForMode.common.pivot = { - keys: cloneDeep(graph.keys), - groups: cloneDeep(graph.groups), - values: cloneDeep(graph.values) - }; - } - - return configForMode; - } -} diff --git a/zeppelin-web-angular/src/app/services/helium.service.ts b/zeppelin-web-angular/src/app/services/helium.service.ts deleted file mode 100644 index f120bc120da..00000000000 --- a/zeppelin-web-angular/src/app/services/helium.service.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { HeliumBundle, HeliumPackageSearchResult, HeliumVisualizationBundle } from '@zeppelin/interfaces/helium'; -import { BaseRest } from '@zeppelin/services/base-rest'; -import { BaseUrlService } from '@zeppelin/services/base-url.service'; -import { forkJoin, of, BehaviorSubject, Observable } from 'rxjs'; -import { catchError, map, switchMap } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root' -}) -export class HeliumService extends BaseRest { - private visualizationBundles$ = new BehaviorSubject([]); - - constructor( - private http: HttpClient, - baseUrlService: BaseUrlService - ) { - super(baseUrlService); - } - - visualizationBundles() { - return this.visualizationBundles$.asObservable(); - } - - getSpellByMagic(_magic: string): string | null { - return null; - } - - private getAllEnabledPackages() { - return this.http.get(this.restUrl`/helium/enabledPackage`); - } - - private getSingleBundle(pkgName: string) { - return this.http - .get(this.restUrl`/helium/bundle/load/${pkgName}`, { - responseType: 'text' - }) - .pipe( - map(bundle => { - if (typeof bundle === 'string' && bundle.substring(0, 'ERROR:'.length) === 'ERROR:') { - console.error(`Failed to get bundle: ${pkgName}`, bundle); - } - return bundle; - }), - catchError(error => { - console.error(`Failed to get single bundle: ${pkgName}`, error); - return of(''); - }) - ); - } - - private getBundlesParallel(): Observable { - return this.getAllEnabledPackages().pipe( - switchMap(packages => { - if (!packages || packages.length === 0) { - return of([]); - } - - const bundleRequests = packages.map(helium => this.getSingleBundle(helium.pkg.name)); - - return forkJoin(bundleRequests); - }), - map(bundles => - bundles.reduce((acc, bundle) => { - if (bundle === '') { - return acc; - } - acc.push(bundle); - return acc; - }, [] as string[]) - ) - ); - } - - initPackages() { - const bundles$ = this.getBundlesParallel(); - bundles$.subscribe(availableBundles => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (window as any)._heliumBundles = [] as HeliumBundle[]; - availableBundles.forEach(bundle => { - eval(bundle); - }); - - const visualizationBundles = [] as HeliumVisualizationBundle[]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ((window as any)._heliumBundles as HeliumBundle[]).forEach(bundle => { - switch (bundle.type) { - case 'VISUALIZATION': - visualizationBundles.push(bundle as HeliumVisualizationBundle); - } - }); - this.visualizationBundles$.next(visualizationBundles); - - try { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - delete (window as any)._heliumBundles; - } catch (e) { - console.error('Failed to delete window.heliumBundles', e); - } - }); - } -} diff --git a/zeppelin-web-angular/src/app/services/message.service.ts b/zeppelin-web-angular/src/app/services/message.service.ts index e04238b2f75..7f714585105 100644 --- a/zeppelin-web-angular/src/app/services/message.service.ts +++ b/zeppelin-web-angular/src/app/services/message.service.ts @@ -15,7 +15,6 @@ import { Observable } from 'rxjs'; import { MessageInterceptor, MESSAGE_INTERCEPTOR } from '@zeppelin/interfaces'; import { - DynamicFormParams, ImportNote, Message, MessageReceiveDataTypeMap, @@ -216,32 +215,6 @@ export class MessageService extends Message implements OnDestroy { super.cancelParagraph(paragraphId); } - paragraphExecutedBySpell( - paragraphId: string, - paragraphTitle: string, - paragraphText: string, - paragraphResultsMsg: Array<{ data: string; type: string }>, - paragraphStatus: string, - paragraphErrorMessage: string, - paragraphConfig: ParagraphConfig, - paragraphParams: DynamicFormParams, - paragraphDateStarted: string, - paragraphDateFinished: string - ): void { - super.paragraphExecutedBySpell( - paragraphId, - paragraphTitle, - paragraphText, - paragraphResultsMsg, - paragraphStatus, - paragraphErrorMessage, - paragraphConfig, - paragraphParams, - paragraphDateStarted, - paragraphDateFinished - ); - } - runParagraph( paragraphId: string, paragraphTitle: string | undefined, diff --git a/zeppelin-web-angular/src/app/services/public-api.ts b/zeppelin-web-angular/src/app/services/public-api.ts index 19bf9b5c8d1..d8e27620d44 100644 --- a/zeppelin-web-angular/src/app/services/public-api.ts +++ b/zeppelin-web-angular/src/app/services/public-api.ts @@ -10,14 +10,11 @@ * limitations under the License. */ -export * from './angular-drag-drop.service'; export * from './array-ordering.service'; export * from './base-url.service'; -export * from './classic-visualization.service'; export * from './completion.service'; export * from './configuration.service'; export * from './credential.service'; -export * from './helium.service'; export * from './inline-completion.service'; export * from './interpreter.service'; export * from './job-manager.service'; diff --git a/zeppelin-web-angular/src/app/services/table-data-adapter.service.ts b/zeppelin-web-angular/src/app/services/table-data-adapter.service.ts deleted file mode 100644 index ee8ceee5176..00000000000 --- a/zeppelin-web-angular/src/app/services/table-data-adapter.service.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { HeliumClassicTableData } from '@zeppelin/interfaces'; -import { TableData } from '@zeppelin/visualization'; - -@Injectable({ - providedIn: 'root' -}) -export class TableDataAdapterService { - constructor() {} - - /** - * Convert modern TableData to classic format expected by AngularJS visualizations - */ - convertToClassicFormat(modernTableData: TableData): Omit { - const classicColumns: HeliumClassicTableData['columns'] = modernTableData.columns.map((columnName, index) => ({ - name: columnName, - index, - aggr: 'sum' // Default aggregation - })); - - // Convert rows from modern format (objects) to classic format (arrays) - const classicRows: string[][] = []; - - if (modernTableData.rows && modernTableData.rows.length > 0) { - // Check if rows are objects (modern format) or arrays (already classic format) - const firstRow = modernTableData.rows[0]; - - if (Array.isArray(firstRow)) { - // Already in classic format (array of arrays) - for (const row of modernTableData.rows) { - classicRows.push(row); - } - } else if (typeof firstRow === 'object' && firstRow !== null) { - // Modern format (array of objects) - convert to classic format - modernTableData.rows.forEach(rowObj => { - const rowArray: string[] = []; - modernTableData.columns.forEach(columnName => { - rowArray.push(rowObj[columnName]); - }); - classicRows.push(rowArray); - }); - } - } - - return { - columns: classicColumns, - rows: classicRows, - comment: '' // Modern TableData doesn't have comment field - }; - } - - /** - * Create a classic TableData-like object with the required methods - */ - createClassicTableDataProxy(modernTableData: TableData): HeliumClassicTableData { - const classicData = this.convertToClassicFormat(modernTableData); - - // Create a proxy object that mimics the classic TableData interface - const proxy: HeliumClassicTableData = { - columns: classicData.columns, - rows: classicData.rows, - comment: classicData.comment, - - loadParagraphResult: paragraphResult => { - // Delegate to modern TableData's method - modernTableData.loadParagraphResult(paragraphResult); - - // Update proxy data after loading - const updatedClassicData = this.convertToClassicFormat(modernTableData); - proxy.columns = updatedClassicData.columns; - proxy.rows = updatedClassicData.rows; - proxy.comment = updatedClassicData.comment; - }, - - refresh: () => { - const updatedClassicData = this.convertToClassicFormat(modernTableData); - proxy.columns = updatedClassicData.columns; - proxy.rows = updatedClassicData.rows; - proxy.comment = updatedClassicData.comment; - } - }; - - return proxy; - } -} diff --git a/zeppelin-web-angular/src/app/share/header/header.component.html b/zeppelin-web-angular/src/app/share/header/header.component.html index bb0c706bc4f..b05ffc03b66 100644 --- a/zeppelin-web-angular/src/app/share/header/header.component.html +++ b/zeppelin-web-angular/src/app/share/header/header.component.html @@ -68,7 +68,6 @@ Credential -
  • Configuration diff --git a/zeppelin-web-angular/src/app/spell/index.ts b/zeppelin-web-angular/src/app/spell/index.ts deleted file mode 100644 index 49e47404422..00000000000 --- a/zeppelin-web-angular/src/app/spell/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export * from './public-api'; diff --git a/zeppelin-web-angular/src/app/spell/public-api.ts b/zeppelin-web-angular/src/app/spell/public-api.ts deleted file mode 100644 index 3cbe3b146f5..00000000000 --- a/zeppelin-web-angular/src/app/spell/public-api.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export * from './spell-result'; diff --git a/zeppelin-web-angular/src/app/spell/spell-result.ts b/zeppelin-web-angular/src/app/spell/spell-result.ts deleted file mode 100644 index d2e9fb92735..00000000000 --- a/zeppelin-web-angular/src/app/spell/spell-result.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export class SpellResult { - static extractMagic(allParagraphText: string): string | null { - const pattern = /^\s*%(\S+)\s*/g; - try { - const match = pattern.exec(allParagraphText); - if (match) { - return `%${match[1].trim()}`; - } - } catch { - // failed to parse, ignore - } - - return null; - } -} diff --git a/zeppelin-web-angular/src/assets/classic-visualization-templates/advanced-transformation-setting.html b/zeppelin-web-angular/src/assets/classic-visualization-templates/advanced-transformation-setting.html deleted file mode 100644 index 093c2ccf5d9..00000000000 --- a/zeppelin-web-angular/src/assets/classic-visualization-templates/advanced-transformation-setting.html +++ /dev/null @@ -1,939 +0,0 @@ - -
    - -
    - Charts - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    -
      -
    • - -
    • -
    -
    - - -
    - Available Columns -
    -
    -
      -
    • -
      - {{column.name | limitTo: 30}}{{column.name.length > 30 ? '...' : ''}} -
      -
    • -
    -
    - - -
    -
    -
    -
    -
    - - - {{getAxisAnnotation(axisSpec)}} - - - -
      -
    • - -
      - {{ getSingleDimensionAxis(axisSpec).name }} - -
      - - -
      -
      - {{getSingleDimensionAxis(axisSpec).name | limitTo: 30}}{{getSingleDimensionAxis(axisSpec).name > 30 ? - '...' : ''}} - - - {{getSingleDimensionAxis(axisSpec).aggr}} - - - -
      - -
      -
    • -
    - - - -
    -
    -
    - -
    -
    -
    - - -
    -
    - Parameters - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - -
    - Name - - Type - - Description - - Value -
    - {{paramSpec.name}} - - {{paramSpec.valueType}} - - {{paramSpec.description}} - -
    - -
    -
    - -
    - -
    - -
    - -
    - -
    -
    -
    -
    diff --git a/zeppelin-web-angular/src/assets/classic-visualization-templates/columnselector_settings.html b/zeppelin-web-angular/src/assets/classic-visualization-templates/columnselector_settings.html deleted file mode 100644 index 080496e2cb3..00000000000 --- a/zeppelin-web-angular/src/assets/classic-visualization-templates/columnselector_settings.html +++ /dev/null @@ -1,172 +0,0 @@ - -
    -
    - Available Fields -
    - -
    - -
    -
      -
    • -
      - {{col.name | limitTo: 30}}{{col.name.length > 30 ? '...' : ''}} -
      -
    • -
    -
    - - -
    -
    -
    - - - {{prop.name}} - - -
      -
    • -
      - {{config[prop.name].name}} - -
      -
    • -
    -
    -
    -
    -
    - -
    - diff --git a/zeppelin-web-angular/src/assets/classic-visualization-templates/network_settings.html b/zeppelin-web-angular/src/assets/classic-visualization-templates/network_settings.html deleted file mode 100644 index 4fa154e4369..00000000000 --- a/zeppelin-web-angular/src/assets/classic-visualization-templates/network_settings.html +++ /dev/null @@ -1,89 +0,0 @@ - -
    -
    -
    -

    Force Layout settings

    -
    - -
    - - ms -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    - -
    -

    Globals

    -
    -
    - - -
    -
    -
    - -
    -

    Choose node labels

    -
    No labels to set
    -
    - - -
    -
    -
    - -
    -
    -
    diff --git a/zeppelin-web-angular/src/assets/classic-visualization-templates/pivot_settings.html b/zeppelin-web-angular/src/assets/classic-visualization-templates/pivot_settings.html deleted file mode 100644 index c21f1c2be28..00000000000 --- a/zeppelin-web-angular/src/assets/classic-visualization-templates/pivot_settings.html +++ /dev/null @@ -1,435 +0,0 @@ - -
    -
    - Available Fields -
    - -
    - - -
    -
      -
    • -
      - {{col.name | limitTo: 30}}{{col.name.length > 30 ? '...' : ''}} -
      -
    • -
    -
    - - -
    -
    - -
    -
    - - keys - -
      -
    • -
      - {{item.name}} - -
      -
    • -
    -
    -
    - -
    -
    - - groups - -
      -
    • -
      - {{item.name}} - -
      -
    • -
    -
    -
    - -
    -
    - - values - -
      -
    • -
      -
      - {{item.name | limitTo: 30}}{{item.name.length > 30 ? '...' : ''}} - {{item.aggr}} - -
      -
        -
      • - sum -
      • -
      • - count -
      • -
      • - avg -
      • -
      • - min -
      • -
      • - max -
      • -
      -
      -
    • -
    -
    -
    -
    -
    - -
    - - - diff --git a/zeppelin-web/package.json b/zeppelin-web/package.json index 484fe4a4318..2b2d2ca5b21 100644 --- a/zeppelin-web/package.json +++ b/zeppelin-web/package.json @@ -15,7 +15,6 @@ "lint:once": "eslint src", "predev": "grunt pre-webpack-dev", "dev:server": "webpack-dev-server --hot", - "dev:helium": "HELIUM_BUNDLE_DEV=true webpack-dev-server --hot", "dev:watch": "grunt watch-webpack-dev", "dev": "npm-run-all --parallel dev:server lint:watch dev:watch", "test:watch": "karma start karma.conf.js --single-run=false", diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index f310e93e92c..e5a1554bc8f 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -77,12 +77,6 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules) // withCredentials when running locally via grunt $httpProvider.defaults.withCredentials = true; - let visBundleLoad = { - load: ['heliumService', function(heliumService) { - return heliumService.load; - }], - }; - $routeProvider .when('/', { templateUrl: 'app/home/home.html', @@ -90,22 +84,18 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules) .when('/notebook/:noteId', { templateUrl: 'app/notebook/notebook.html', controller: 'NotebookCtrl', - resolve: visBundleLoad, }) .when('/notebook/:noteId/paragraph?=:paragraphId', { templateUrl: 'app/notebook/notebook.html', controller: 'NotebookCtrl', - resolve: visBundleLoad, }) .when('/notebook/:noteId/paragraph/:paragraphId?', { templateUrl: 'app/notebook/notebook.html', controller: 'NotebookCtrl', - resolve: visBundleLoad, }) .when('/notebook/:noteId/revision/:revisionId', { templateUrl: 'app/notebook/notebook.html', controller: 'NotebookCtrl', - resolve: visBundleLoad, }) .when('/jobmanager', { templateUrl: 'app/jobmanager/jobmanager.html', @@ -124,10 +114,6 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules) templateUrl: 'app/credential/credential.html', controller: 'CredentialCtrl', }) - .when('/helium', { - templateUrl: 'app/helium/helium.html', - controller: 'HeliumCtrl', - }) .when('/configuration', { templateUrl: 'app/configuration/configuration.html', controller: 'ConfigurationCtrl', diff --git a/zeppelin-web/src/app/helium/helium-conf.js b/zeppelin-web/src/app/helium/helium-conf.js deleted file mode 100644 index 05a58cf4f67..00000000000 --- a/zeppelin-web/src/app/helium/helium-conf.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const HeliumConfFieldType = { - NUMBER: 'number', - JSON: 'json', - STRING: 'string', -}; - -/** - * @param persisted including `type`, `description`, `defaultValue` for each conf key - * @param spec including `value` for each conf key - */ -export function mergePersistedConfWithSpec(persisted, spec) { - const confs = []; - - for (let name in spec) { - if (spec.hasOwnProperty(name)) { - const specField = spec[name]; - const persistedValue = persisted[name]; - - const value = (persistedValue) ? persistedValue : specField.defaultValue; - const merged = { - name: name, - type: specField.type, - description: specField.description, - value: value, - defaultValue: specField.defaultValue, - }; - - confs.push(merged); - } - } - - return confs; -} - -export function createAllPackageConfigs(defaultPackages, persistedConfs) { - let packageConfs = {}; - - for (let name in defaultPackages) { - if (defaultPackages.hasOwnProperty(name)) { - const pkgSearchResult = defaultPackages[name]; - - const spec = pkgSearchResult.pkg.config; - if (!spec) { - continue; - } - - const artifact = pkgSearchResult.pkg.artifact; - if (!artifact) { - continue; - } - - let persistedConf = {}; - if (persistedConfs[artifact]) { - persistedConf = persistedConfs[artifact]; - } - - const confs = mergePersistedConfWithSpec(persistedConf, spec); - packageConfs[name] = confs; - } - } - - return packageConfs; -} - -export function parseConfigValue(type, stringified) { - let value = stringified; - - try { - if (HeliumConfFieldType.NUMBER === type) { - value = parseFloat(stringified); - } else if (HeliumConfFieldType.JSON === type) { - value = JSON.parse(stringified); - } - } catch (error) { - // return just the stringified one - console.error(`Failed to parse conf type ${type}, value ${value}`); - } - - return value; -} - -/** - * persist key-value only - * since other info (e.g type, desc) can be provided by default config - */ -export function createPersistableConfig(currentConfs) { - const filtered = currentConfs.reduce((acc, c) => { - acc[c.name] = parseConfigValue(c.type, c.value); - return acc; - }, {}); - - return filtered; -} diff --git a/zeppelin-web/src/app/helium/helium-package.js b/zeppelin-web/src/app/helium/helium-package.js deleted file mode 100644 index 2fe9bf58964..00000000000 --- a/zeppelin-web/src/app/helium/helium-package.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export function createDefaultPackage(pkgSearchResult, sce) { - for (let pkgIdx in pkgSearchResult) { - if (pkgSearchResult.hasOwnProperty(pkgIdx)) { - const pkg = pkgSearchResult[pkgIdx]; - pkg.pkg.icon = sce.trustAsHtml(pkg.pkg.icon); - if (pkg.enabled) { - pkgSearchResult.splice(pkgIdx, 1); - return pkg; - } - } - } - - // show first available version if package is not enabled - const result = pkgSearchResult[0]; - pkgSearchResult.splice(0, 1); - return result; -} - -/** - * create default packages based on `enabled` field and `latest` version. - * - * @param pkgSearchResults - * @param sce angular `$sce` object - * @returns {Object} including {name, pkgInfo} - */ -export function createDefaultPackages(pkgSearchResults, sce) { - const defaultPackages = {}; - // show enabled version if any version of package is enabled - for (let name in pkgSearchResults) { - if (pkgSearchResults.hasOwnProperty(name)) { - const pkgSearchResult = pkgSearchResults[name]; - defaultPackages[name] = createDefaultPackage(pkgSearchResult, sce); - } - } - - return defaultPackages; -} diff --git a/zeppelin-web/src/app/helium/helium-type.js b/zeppelin-web/src/app/helium/helium-type.js deleted file mode 100644 index 0b37a418837..00000000000 --- a/zeppelin-web/src/app/helium/helium-type.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const HeliumType = { - VISUALIZATION: 'VISUALIZATION', - SPELL: 'SPELL', - INTERPRETER: 'INTERPRETER', - APPLICATION: 'APPLICATION', -}; diff --git a/zeppelin-web/src/app/helium/helium.controller.js b/zeppelin-web/src/app/helium/helium.controller.js deleted file mode 100644 index e8a0eafa7fc..00000000000 --- a/zeppelin-web/src/app/helium/helium.controller.js +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {HeliumType} from './helium-type'; - -export default function HeliumCtrl($scope, $rootScope, $sce, - baseUrlSrv, ngToast, heliumService) { - 'ngInject'; - - $scope.pkgSearchResults = {}; - $scope.defaultPackages = {}; - $scope.showVersions = {}; - $scope.bundleOrder = []; - $scope.bundleOrderChanged = false; - $scope.vizTypePkg = {}; - $scope.spellTypePkg = {}; - $scope.intpTypePkg = {}; - $scope.appTypePkg = {}; - $scope.numberOfEachPackageByType = {}; - $scope.allPackageTypes = [HeliumType][0]; - $scope.pkgListByType = 'VISUALIZATION'; - $scope.defaultPackageConfigs = {}; // { pkgName, [{name, type, desc, value, defaultValue}] } - $scope.intpDefaultIcon = $sce.trustAsHtml(''); - - function init() { - // get all package info and set config - heliumService.getAllPackageInfoAndDefaultPackages() - .then(({pkgSearchResults, defaultPackages}) => { - // pagination - $scope.itemsPerPage = 10; - $scope.currentPage = 1; - $scope.maxSize = 5; - - $scope.pkgSearchResults = pkgSearchResults; - $scope.defaultPackages = defaultPackages; - classifyPkgType($scope.defaultPackages); - - return heliumService.getAllPackageConfigs(); - }) - .then((defaultPackageConfigs) => { - $scope.defaultPackageConfigs = defaultPackageConfigs; - return heliumService.getVisualizationPackageOrder(); - }) - .then((visPackageOrder) => { - setVisPackageOrder(visPackageOrder); - }); - } - - const setVisPackageOrder = function(visPackageOrder) { - $scope.bundleOrder = visPackageOrder; - $scope.bundleOrderChanged = false; - }; - - let orderPackageByPubDate = function(a, b) { - if (!a.pkg.published) { - // Because local registry pkgs don't have 'published' field, put current time instead to show them first - a.pkg.published = new Date().getTime(); - } - - return new Date(a.pkg.published).getTime() - new Date(b.pkg.published).getTime(); - }; - - const classifyPkgType = function(packageInfo) { - let allTypesOfPkg = {}; - let vizTypePkg = []; - let spellTypePkg = []; - let intpTypePkg = []; - let appTypePkg = []; - - let packageInfoArr = Object.keys(packageInfo).map((key) => packageInfo[key]); - packageInfoArr = packageInfoArr.sort(orderPackageByPubDate).reverse(); - - for (let name in packageInfoArr) { - if (packageInfoArr.hasOwnProperty(name)) { - let pkgs = packageInfoArr[name]; - let pkgType = pkgs.pkg.type; - - switch (pkgType) { - case HeliumType.VISUALIZATION: - vizTypePkg.push(pkgs); - break; - case HeliumType.SPELL: - spellTypePkg.push(pkgs); - break; - case HeliumType.INTERPRETER: - intpTypePkg.push(pkgs); - break; - case HeliumType.APPLICATION: - appTypePkg.push(pkgs); - break; - } - } - } - - let pkgsArr = [ - vizTypePkg, - spellTypePkg, - intpTypePkg, - appTypePkg, - ]; - for (let idx in _.keys(HeliumType)) { - if (_.keys(HeliumType).hasOwnProperty(idx)) { - allTypesOfPkg[_.keys(HeliumType)[idx]] = pkgsArr[idx]; - } - } - - $scope.allTypesOfPkg = allTypesOfPkg; - }; - - $scope.bundleOrderListeners = { - accept: function(sourceItemHandleScope, destSortableScope) { - return true; - }, - itemMoved: function(event) {}, - orderChanged: function(event) { - $scope.bundleOrderChanged = true; - }, - }; - - $scope.saveBundleOrder = function() { - const confirm = BootstrapDialog.confirm({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: '', - message: 'Save changes?', - callback: function(result) { - if (result) { - confirm.$modalFooter.find('button').addClass('disabled'); - confirm.$modalFooter.find('button:contains("OK")') - .html(' Enabling'); - heliumService.setVisualizationPackageOrder($scope.bundleOrder) - .success(function(data, status) { - setVisPackageOrder($scope.bundleOrder); - confirm.close(); - }) - .error(function(data, status) { - confirm.close(); - console.log('Failed to save order'); - BootstrapDialog.show({ - title: 'Error on saving order ', - message: _.escape(data.message), - }); - }); - return false; - } - }, - }); - }; - - let getLicense = function(name, artifact) { - let filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function(p) { - return p.artifact === artifact; - }); - - let license; - if (filteredPkgSearchResults.length === 0) { - filteredPkgSearchResults = _.filter($scope.pkgSearchResults[name], function(p) { - return p.pkg.artifact === artifact; - }); - - if (filteredPkgSearchResults.length > 0) { - license = filteredPkgSearchResults[0].pkg.license; - } - } else { - license = filteredPkgSearchResults[0].license; - } - - if (!license) { - license = 'Unknown'; - } - return license; - }; - - const getHeliumTypeText = function(type) { - if (type === HeliumType.VISUALIZATION) { - return `${type}`; // eslint-disable-line max-len - } else if (type === HeliumType.SPELL) { - return `${type}`; // eslint-disable-line max-len - } else { - return type; - } - }; - - $scope.enable = function(name, artifact, type, groupId, description) { - let license = getLicense(name, artifact); - let mavenArtifactInfoToHTML = groupId + ':' + artifact.split('@')[0] + ':' + artifact.split('@')[1]; - - let confirm = ''; - if (type === HeliumType.INTERPRETER) { - confirm = BootstrapDialog.confirm({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: '
    Do you want to download an interpreter?
    ', - message: '
    Name
    ' + - `
    ${name}
    ` + - '
    ' + - '
    Artifact
    ' + - `
    ${mavenArtifactInfoToHTML}
    `, - callback: function(result) { - if (result) { - heliumService.installInterpreter({'name': name, 'artifact': mavenArtifactInfoToHTML}) - .success(function(data, status) { - confirm.close(); - }).error(function(data, status) { - confirm.close(); - console.log('Failed to install an interpreter %o %o', name, artifact); - BootstrapDialog.show({ - title: 'Error while starting to install ' + _.escape(name) + ' interpreter', - message: _.escape(data.message), - }); - }); - return false; - } - }, - }); - } else { - confirm = BootstrapDialog.confirm({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: '
    Do you want to enable Helium Package?
    ', - message: - '
    Artifact
    ' + - `
    ${artifact}
    ` + - '
    ' + - '
    Type
    ' + - `
    ${getHeliumTypeText(type)}
    ` + - '
    ' + - '
    Description
    ' + - `
    ${_.escape(description)}
    ` + - '
    ' + - '
    License
    ' + - `
    ${_.escape(license)}
    `, - callback: function(result) { - if (result) { - confirm.$modalFooter.find('button').addClass('disabled'); - confirm.$modalFooter.find('button:contains("OK")') - .html(' Enabling'); - heliumService.enable(name, artifact, type).success(function(data, status) { - init(); - confirm.close(); - }).error(function(data, status) { - confirm.close(); - console.log('Failed to enable package %o %o. %o', name, artifact, data); - BootstrapDialog.show({ - title: 'Error on enabling ' + _.escape(name), - message: _.escape(data.message), - }); - }); - return false; - } - }, - }); - } - }; - - $scope.disable = function(name, artifact) { - const confirm = BootstrapDialog.confirm({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: '
    Do you want to disable Helium Package?
    ', - message: _.escape(artifact), - callback: function(result) { - if (result) { - confirm.$modalFooter.find('button').addClass('disabled'); - confirm.$modalFooter.find('button:contains("OK")') - .html(' Disabling'); - heliumService.disable(name) - .success(function(data, status) { - init(); - confirm.close(); - }) - .error(function(data, status) { - confirm.close(); - console.log('Failed to disable package %o. %o', name, data); - BootstrapDialog.show({ - title: 'Error on disabling ' + _.escape(name), - message: _.escape(data.message), - }); - }); - return false; - } - }, - }); - }; - - $scope.toggleVersions = function(pkgName) { - if ($scope.showVersions[pkgName]) { - $scope.showVersions[pkgName] = false; - } else { - $scope.showVersions[pkgName] = true; - } - }; - - $scope.isLocalPackage = function(pkgSearchResult) { - const pkg = pkgSearchResult.pkg; - return pkg.artifact && !pkg.artifact.includes('@'); - }; - - $scope.hasNpmLink = function(pkgSearchResult) { - const pkg = pkgSearchResult.pkg; - return (pkg.type === HeliumType.SPELL || pkg.type === HeliumType.VISUALIZATION) && - !$scope.isLocalPackage(pkgSearchResult); - }; - - $scope.hasMavenLink = function(pkgSearchResult) { - const pkg = pkgSearchResult.pkg; - return (pkg.type === HeliumType.APPLICATION || pkg.type === HeliumType.INTERPRETER) && - !$scope.isLocalPackage(pkgSearchResult); - }; - - $scope.getPackageSize = function(pkgSearchResult, targetPkgType) { - let result = []; - _.map(pkgSearchResult, function(pkg) { - result.push(_.find(pkg, {type: targetPkgType})); - }); - return _.compact(result).length; - }; - - $scope.configExists = function(pkgSearchResult) { - // helium package config is persisted per version - return pkgSearchResult.pkg.config && pkgSearchResult.pkg.artifact; - }; - - $scope.configOpened = function(pkgSearchResult) { - return pkgSearchResult.configOpened && !pkgSearchResult.configFetching; - }; - - $scope.getConfigButtonClass = function(pkgSearchResult) { - return (pkgSearchResult.configOpened && pkgSearchResult.configFetching) - ? 'disabled' : ''; - }; - - $scope.toggleConfigButton = function(pkgSearchResult) { - if (pkgSearchResult.configOpened) { - pkgSearchResult.configOpened = false; - return; - } - - const pkg = pkgSearchResult.pkg; - const pkgName = pkg.name; - pkgSearchResult.configFetching = true; - pkgSearchResult.configOpened = true; - - heliumService.getSinglePackageConfigs(pkg) - .then((confs) => { - $scope.defaultPackageConfigs[pkgName] = confs; - pkgSearchResult.configFetching = false; - }); - }; - - $scope.saveConfig = function(pkgSearchResult) { - const pkgName = pkgSearchResult.pkg.name; - const currentConf = $scope.defaultPackageConfigs[pkgName]; - - heliumService.saveConfig(pkgSearchResult.pkg, currentConf, () => { - // close after config is saved - pkgSearchResult.configOpened = false; - }); - }; - - $scope.getDescriptionText = function(pkgSearchResult) { - return pkgSearchResult.pkg.description; - }; - - init(); -} diff --git a/zeppelin-web/src/app/helium/helium.css b/zeppelin-web/src/app/helium/helium.css deleted file mode 100644 index f44258c8676..00000000000 --- a/zeppelin-web/src/app/helium/helium.css +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.heliumHead { - padding-bottom: 34px !important; -} - -.heliumPackageContainer { - padding-bottom: 0px; - margin-bottom: 0px; -} - -.heliumPackageList { - min-height: 25px; - margin-bottom: 15px; - border-bottom: 1px solid #EFEFEF; - padding-bottom: 13px; -} - -.heliumPackageList:last-child { - border-bottom: none; -} - -.heliumPackageList .heliumPackageHead { - height: 30px; -} - -.heliumPackageList .heliumPackageHead .btn { - margin-top: 5px; -} - -.heliumPackageList .heliumPackageIcon { - float: left; - width: 28px; - height: 22px; - padding: 5px 2px 0px 2px; -} - -.heliumPackageList .heliumPackageName { - font-size: 20px; - font-weight: bold; - color: #3071a9; - float: left; - margin-top: 0; -} - -.heliumPackageList .heliumPackageName .heliumType { - font-size: 13px; - color: #AAAAAA; -} - -.spellInfo { - margin-top: 15px; - font-size: 20px; - font-weight: bold; -} - -.spellInfo .spellInfoDesc { - font-size: 13px; - color: #AAAAAA; -} - -.spellInfo .spellInfoValue { - font-size: 13px; - font-style: italic; - color: #444444; -} - -.spellInfo .spellUsage { - margin-top: 8px; - margin-bottom: 4px; - width: 500px; -} - -.spellConfigButton { - background-color: #FEFEFE; -} - -.heliumPackageList .heliumPackageDisabledArtifact { - color:gray; -} - -.heliumPackageList .heliumPackageEnabledArtifact { - color:#444444; -} - -.heliumPackageList .heliumPackageEnabledArtifact span, -.heliumPackageList .heliumPackageDisabledArtifact span { - margin-left:3px; - cursor:pointer; - text-decoration: - underline;color:#3071a9 -} - -.heliumPackageList .heliumPackageDescription { - margin-top: 10px; -} - -.heliumBundleOrder { - display: inline-block; -} - -.heliumBundleOrder .as-sortable-item, -.heliumBundleOrder .as-sortable-placeholder { - display: inline-block; - float: left; -} - -.heliumBundleOrder p { - margin:0 0 5px 15px -} - -.sortable-row .as-sortable-item-handle { - width: 35px; - height: 30px; -} - -.sortable-row .as-sortable-item svg { - width: 100%; - height: 100%; -} - -.heliumBundleOrder .saveLink { - margin-left:10px; - margin-top:5px; - cursor:pointer; - text-decoration: - underline;color:#3071a9; - display: inline-block; -} - -.heliumVisIconButton > img { - display: block; - max-width: 100%; - height: auto; -} - -.heliumLocalPackage { - color: #636363; -} - -.heliumLearnMore { - margin-top:10px; -} - -.heliumLearnMore a { - cursor:pointer; - margin-right:10px; - text-decoration:none; -} - -.heliumRepoBtn { - margin-right: 8px; -} - -.heliumRepoBtn:hover, .heliumRepoBtn:focus { - margin-right: 8px; - outline: 0; -} - -.heliumRepoBtnToggled { - color: #333; - background-color: #e6e6e6; - border-color:#adadad; -} - -.localPkgInfo { - margin-right: 0; -} - -.localPkgInfo p { - margin: 10px 12px 0 0; - font-size: 11px; - font-style: italic; - color: #aaaaaa; - text-align: right; -} - -.heliumConfig { - margin-top: 30px; - margin-bottom: 10px; -} - -.heliumConfigTable { - margin-top: 15px; - vertical-align:middle; - margin-bottom: 15px; -} - -.heliumConfigValueText { - vertical-align: top; -} - - -/* hide arrows when current page is on first & last */ -.hide-first-boundaries.pagination > .disabled > a, -.hide-first-boundaries.pagination > li:first-child > a, -.hide-first-boundaries.pagination > li:first-child > span { - display: none; -} - -.hide-first-boundaries.pagination > .active > a { - border-top-left-radius: 3px; - border-bottom-left-radius: 3px; -} - -.hide-last-boundaries.pagination > .disabled > a, -.hide-last-boundaries.pagination > li:last-child > a, -.hide-last-boundaries.pagination > li:last-child > span { - display: none; -} - -.hide-last-boundaries.pagination > .active > a { - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; -} diff --git a/zeppelin-web/src/app/helium/helium.html b/zeppelin-web/src/app/helium/helium.html deleted file mode 100644 index a28d8b81bed..00000000000 --- a/zeppelin-web/src/app/helium/helium.html +++ /dev/null @@ -1,199 +0,0 @@ - -
    -
    -
    -
    -

    - Helium -

    -
    - - - - -
    -
    -
    -
    -

    Bundle package display order (drag and drop to reorder)

    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -

    * Local registry package's name is gray colored.

    -
    -
    -
    -
    - -
    -
    -
    - Currently there is no available package to be listed -
    -
    -
    -
    -
    -
    -
    -
    -
    - - {{pkgSearchResult.pkg.name}} - - - {{pkgSearchResult.pkg.name}} - - - - {{pkgSearchResult.pkg.name}} - - - {{pkgSearchResult.pkg.type}} -
    -
    Enable
    -
    Disable
    -
    Config
    -
    -
    - {{pkgSearchResult.pkg.artifact}} - - versions - -
    -
      -
    • - {{pkgSearchResult.pkg.artifact}} - - - enable - -
    • -
    -
    -
    -
    - MAGIC - {{pkgSearchResult.pkg.spell.magic}} -
    -
    - USAGE -
    {{pkgSearchResult.pkg.spell.usage}} 
    -
    -
    - - -
    -
    Configuration
    - - - - - - - - - - - - - - - -
    NameTypeDescriptionValue
    {{cfg.name}}{{cfg.type}}{{cfg.description}} -
    - -
    -
    - -
    - - -
    -
    - - -
    -
    -
    -
      -
      -
      -
      diff --git a/zeppelin-web/src/app/helium/helium.service.js b/zeppelin-web/src/app/helium/helium.service.js deleted file mode 100644 index af9e93ae9c4..00000000000 --- a/zeppelin-web/src/app/helium/helium.service.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {HeliumType} from './helium-type'; -import { - createAllPackageConfigs, - createPersistableConfig, - mergePersistedConfWithSpec, -} from './helium-conf'; -import { - createDefaultPackages, -} from './helium-package'; - -angular.module('zeppelinWebApp').service('heliumService', HeliumService); - -export default function HeliumService($http, $sce, baseUrlSrv) { - 'ngInject'; - - let visualizationBundles = []; - let visualizationPackageOrder = []; - // map for `{ magic: interpreter }` - let spellPerMagic = {}; - // map for `{ magic: package-name }` - let pkgNamePerMagic = {}; - - /** - * @param magic {string} e.g `%flowchart` - * @returns {SpellBase} undefined if magic is not registered - */ - this.getSpellByMagic = function(magic) { - return spellPerMagic[magic]; - }; - - this.executeSpell = function(magic, textWithoutMagic) { - const promisedConf = this.getSinglePackageConfigUsingMagic(magic) - .then((confs) => createPersistableConfig(confs)); - - return promisedConf.then((conf) => { - const spell = this.getSpellByMagic(magic); - const spellResult = spell.interpret(textWithoutMagic, conf); - const parsed = spellResult.getAllParsedDataWithTypes( - spellPerMagic, magic, textWithoutMagic); - - return parsed; - }); - }; - - this.executeSpellAsDisplaySystem = function(magic, textWithoutMagic) { - const promisedConf = this.getSinglePackageConfigUsingMagic(magic) - .then((confs) => createPersistableConfig(confs)); - - return promisedConf.then((conf) => { - const spell = this.getSpellByMagic(magic); - const spellResult = spell.interpret(textWithoutMagic.trim(), conf); - const parsed = spellResult.getAllParsedDataWithTypes(spellPerMagic); - - return parsed; - }); - }; - - this.getVisualizationCachedPackages = function() { - return visualizationBundles; - }; - - this.getVisualizationCachedPackageOrder = function() { - return visualizationPackageOrder; - }; - - /** - * @returns {Promise} which returns bundleOrder and cache it in `visualizationPackageOrder` - */ - this.getVisualizationPackageOrder = function() { - return $http.get(baseUrlSrv.getRestApiBase() + '/helium/order/visualization') - .then(function(response, status) { - const order = response.data.body; - visualizationPackageOrder = order; - return order; - }) - .catch(function(error) { - console.error('Can not get bundle order', error); - }); - }; - - this.setVisualizationPackageOrder = function(list) { - return $http.post(baseUrlSrv.getRestApiBase() + '/helium/order/visualization', list); - }; - - this.enable = function(name, artifact) { - return $http.post(baseUrlSrv.getRestApiBase() + '/helium/enable/' + name, artifact); - }; - - this.disable = function(name) { - return $http.post(baseUrlSrv.getRestApiBase() + '/helium/disable/' + name); - }; - - this.installInterpreter = function(installRequest) { - return $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/install', installRequest); - }; - - this.saveConfig = function(pkg, defaultPackageConfig, closeConfigPanelCallback) { - // in case of local package, it will include `/` - const pkgArtifact = encodeURIComponent(pkg.artifact); - const pkgName = pkg.name; - const filtered = createPersistableConfig(defaultPackageConfig); - - if (!pkgName || !pkgArtifact || !filtered) { - console.error( - `Can't save config for helium package '${pkgArtifact}'`, filtered); - return; - } - - const url = `${baseUrlSrv.getRestApiBase()}/helium/config/${pkgName}/${pkgArtifact}`; - return $http.post(url, filtered) - .then(() => { - if (closeConfigPanelCallback) { - closeConfigPanelCallback(); - } - }).catch((error) => { - console.error(`Failed to save config for ${pkgArtifact}`, error); - }); - }; - - /** - * @returns {Promise} which including {name, Array} - */ - this.getAllPackageInfo = function() { - return $http.get(`${baseUrlSrv.getRestApiBase()}/helium/package`) - .then(function(response, status) { - return response.data.body; - }) - .catch(function(error) { - console.error('Failed to get all package infos', error); - }); - }; - - this.getAllEnabledPackages = function() { - return $http.get(`${baseUrlSrv.getRestApiBase()}/helium/enabledPackage`) - .then(function(response, status) { - return response.data.body; - }) - .catch(function(error) { - console.error('Failed to get all enabled package infos', error); - }); - }; - - this.getSingleBundle = function(pkgName) { - let url = `${baseUrlSrv.getRestApiBase()}/helium/bundle/load/${pkgName}`; - if (process.env.HELIUM_BUNDLE_DEV) { - url = url + '?refresh=true'; - } - - return $http.get(url) - .then(function(response, status) { - const bundle = response.data; - if (bundle.substring(0, 'ERROR:'.length) === 'ERROR:') { - console.error(`Failed to get bundle: ${pkgName}`, bundle); - return ''; // empty bundle will be filtered later - } - - return bundle; - }) - .catch(function(error) { - console.error(`Failed to get single bundle: ${pkgName}`, error); - }); - }; - - this.getDefaultPackages = function() { - return this.getAllPackageInfo() - .then((pkgSearchResults) => { - return createDefaultPackages(pkgSearchResults, $sce); - }); - }; - - this.getAllPackageInfoAndDefaultPackages = function() { - return this.getAllPackageInfo() - .then((pkgSearchResults) => { - return { - pkgSearchResults: pkgSearchResults, - defaultPackages: createDefaultPackages(pkgSearchResults, $sce), - }; - }); - }; - - /** - * get all package configs. - * @return { Promise<{name, Array}> } - */ - this.getAllPackageConfigs = function() { - const promisedDefaultPackages = this.getDefaultPackages(); - const promisedPersistedConfs = - $http.get(`${baseUrlSrv.getRestApiBase()}/helium/config`) - .then(function(response, status) { - return response.data.body; - }); - - return Promise.all([promisedDefaultPackages, promisedPersistedConfs]) - .then((values) => { - const defaultPackages = values[0]; - const persistedConfs = values[1]; - - return createAllPackageConfigs(defaultPackages, persistedConfs); - }) - .catch(function(error) { - console.error('Failed to get all package configs', error); - }); - }; - - /** - * get the package config which is persisted in server. - * @return { Promise> } - */ - this.getSinglePackageConfigs = function(pkg) { - const pkgName = pkg.name; - // in case of local package, it will include `/` - const pkgArtifact = encodeURIComponent(pkg.artifact); - - if (!pkgName || !pkgArtifact) { - console.error('Failed to fetch config for\n', pkg); - return Promise.resolve([]); - } - - const confUrl = `${baseUrlSrv.getRestApiBase()}/helium/config/${pkgName}/${pkgArtifact}`; - const promisedConf = $http.get(confUrl) - .then(function(response, status) { - return response.data.body; - }); - - return promisedConf.then(({confSpec, confPersisted}) => { - const merged = mergePersistedConfWithSpec(confPersisted, confSpec); - return merged; - }); - }; - - this.getSinglePackageConfigUsingMagic = function(magic) { - const pkgName = pkgNamePerMagic[magic]; - - const confUrl = `${baseUrlSrv.getRestApiBase()}/helium/spell/config/${pkgName}`; - const promisedConf = $http.get(confUrl) - .then(function(response, status) { - return response.data.body; - }); - - return promisedConf.then(({confSpec, confPersisted}) => { - const merged = mergePersistedConfWithSpec(confPersisted, confSpec); - return merged; - }); - }; - - const p = this.getAllEnabledPackages() - .then((enabledPackageSearchResults) => { - const promises = enabledPackageSearchResults.map((packageSearchResult) => { - const pkgName = packageSearchResult.pkg.name; - return this.getSingleBundle(pkgName); - }); - - return Promise.all(promises); - }) - .then((bundles) => { - return bundles.reduce((acc, b) => { - // filter out empty bundle - if (b === '') { - return acc; - } - acc.push(b); - return acc; - }, []); - }); - - // load should be promise - this.load = p.then((availableBundles) => { - // Property name `_heliumBundles` should be same as `HeliumBundleFactory.HELIUM_BUNDLES_VAR` - window._heliumBundles = []; - // evaluate bundles - availableBundles.map((b) => { - // eslint-disable-next-line no-eval - eval(b); - }); - - // extract bundles by type - window._heliumBundles.forEach((b) => { - if (b.type === HeliumType.SPELL) { - const spell = new b.class(); // eslint-disable-line new-cap - const pkgName = b.id; - spellPerMagic[spell.getMagic()] = spell; - pkgNamePerMagic[spell.getMagic()] = pkgName; - } else if (b.type === HeliumType.VISUALIZATION) { - visualizationBundles.push(b); - } - }); - delete window._heliumBundles; - }); - - this.init = function() { - this.getVisualizationPackageOrder(); - }; - - // init - this.init(); -} diff --git a/zeppelin-web/src/app/helium/index.js b/zeppelin-web/src/app/helium/index.js deleted file mode 100644 index 754c9499f4f..00000000000 --- a/zeppelin-web/src/app/helium/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import HeliumController from './helium.controller'; - -angular.module('zeppelinWebApp') - .controller('HeliumCtrl', HeliumController); diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js index 3abe8dfe7ea..8e57c558e8b 100644 --- a/zeppelin-web/src/app/notebook/notebook.controller.js +++ b/zeppelin-web/src/app/notebook/notebook.controller.js @@ -20,8 +20,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', NotebookCtrl); function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope, $http, websocketMsgSrv, baseUrlSrv, $timeout, saveAsService, - ngToast, noteActionService, noteVarShareService, TRASH_FOLDER_ID, - heliumService) { + ngToast, noteActionService, noteVarShareService, TRASH_FOLDER_ID) { 'ngInject'; ngToast.dismiss(); diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html index 1621a174100..23ed90a4289 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html @@ -43,7 +43,7 @@ {{paragraph.status}} - + {{getProgress()}}% diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 51acc75f5f3..b6b4fa7e848 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -12,7 +12,6 @@ * limitations under the License. */ -import {SpellResult} from '../../spell'; import {isParagraphRunning, ParagraphStatus} from './paragraph.status'; import moment from 'moment'; @@ -20,18 +19,11 @@ import DiffMatchPatch from 'diff-match-patch'; require('moment-duration-format'); -const ParagraphExecutor = { - SPELL: 'SPELL', - INTERPRETER: 'INTERPRETER', - NONE: '', /** meaning `DONE` */ -}; - angular.module('zeppelinWebApp').controller('ParagraphCtrl', ParagraphCtrl); function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $location, $timeout, $compile, $http, $q, websocketMsgSrv, - baseUrlSrv, ngToast, noteVarShareService, - heliumService) { + baseUrlSrv, ngToast, noteVarShareService) { 'ngInject'; let ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_'; @@ -47,15 +39,6 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat $scope.diffMatchPatch = new DiffMatchPatch(); $scope.isNoteRunning = false; - // transactional info for spell execution - $scope.spellTransaction = { - totalResultCount: 0, - renderedResultCount: 0, - propagated: false, - resultsMsg: [], - paragraphText: '', - }; - let searchRanges = []; const getCurrentRangeDefault = function() { return {id: -1, markerId: -1}; @@ -291,123 +274,6 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat websocketMsgSrv.cancelParagraphRun(paragraph.id); }; - $scope.propagateSpellResult = function(paragraphId, paragraphTitle, - paragraphText, paragraphResults, - paragraphStatus, paragraphErrorMessage, - paragraphConfig, paragraphSettingsParam, - paragraphDateStarted, paragraphDateFinished) { - websocketMsgSrv.paragraphExecutedBySpell( - paragraphId, paragraphTitle, - paragraphText, paragraphResults, - paragraphStatus, paragraphErrorMessage, - paragraphConfig, paragraphSettingsParam, - paragraphDateStarted, paragraphDateFinished - ); - }; - - $scope.handleSpellError = function(paragraphText, error, - digestRequired, propagated) { - const errorMessage = error.stack; - $scope.paragraph.status = ParagraphStatus.ERROR; - $scope.paragraph.errorMessage = errorMessage; - console.error('Failed to execute interpret() in spell\n', error); - - if (!propagated) { - $scope.paragraph.dateFinished = $scope.getFormattedParagraphTime(); - } - - if (!propagated) { - $scope.propagateSpellResult( - $scope.paragraph.id, $scope.paragraph.title, - paragraphText, [], $scope.paragraph.status, errorMessage, - $scope.paragraph.config, $scope.paragraph.settings.params, - $scope.paragraph.dateStarted, $scope.paragraph.dateFinished); - } - }; - - $scope.prepareSpellTransaction = function(resultsMsg, propagated, paragraphText) { - $scope.spellTransaction.totalResultCount = resultsMsg.length; - $scope.spellTransaction.renderedResultCount = 0; - $scope.spellTransaction.propagated = propagated; - $scope.spellTransaction.resultsMsg = resultsMsg; - $scope.spellTransaction.paragraphText = paragraphText; - }; - - /** - * - update spell transaction count and - * - check transaction is finished based on the result count - * @returns {boolean} - */ - $scope.increaseSpellTransactionResultCount = function() { - $scope.spellTransaction.renderedResultCount += 1; - - const total = $scope.spellTransaction.totalResultCount; - const current = $scope.spellTransaction.renderedResultCount; - return total === current; - }; - - $scope.cleanupSpellTransaction = function() { - const status = ParagraphStatus.FINISHED; - $scope.paragraph.executor = ParagraphExecutor.NONE; - $scope.paragraph.status = status; - $scope.paragraph.results.code = status; - - const propagated = $scope.spellTransaction.propagated; - const resultsMsg = $scope.spellTransaction.resultsMsg; - const paragraphText = $scope.spellTransaction.paragraphText; - - if (!propagated) { - $scope.paragraph.dateFinished = $scope.getFormattedParagraphTime(); - } - - if (!propagated) { - const propagable = SpellResult.createPropagable(resultsMsg); - $scope.propagateSpellResult( - $scope.paragraph.id, $scope.paragraph.title, - paragraphText, propagable, status, '', - $scope.paragraph.config, $scope.paragraph.settings.params, - $scope.paragraph.dateStarted, $scope.paragraph.dateFinished); - } - }; - - $scope.runParagraphUsingSpell = function(paragraphText, - magic, digestRequired, propagated) { - $scope.paragraph.status = 'RUNNING'; - $scope.paragraph.executor = ParagraphExecutor.SPELL; - $scope.paragraph.results = {}; - $scope.paragraph.errorMessage = ''; - if (digestRequired) { - $scope.$digest(); - } - - try { - // remove magic from paragraphText - const splited = paragraphText.slice(paragraphText.indexOf(magic) + magic.length); - // remove leading spaces - const textWithoutMagic = splited.replace(/^\s+/g, ''); - - if (!propagated) { - $scope.paragraph.dateStarted = $scope.getFormattedParagraphTime(); - } - - // handle actual result message in promise - heliumService.executeSpell(magic, textWithoutMagic) - .then((resultsMsg) => { - $scope.prepareSpellTransaction(resultsMsg, propagated, paragraphText); - - $scope.paragraph.results.msg = resultsMsg; - $scope.paragraph.config.tableHide = false; - }) - .catch((error) => { - $scope.handleSpellError(paragraphText, error, - digestRequired, propagated); - }); - } catch (error) { - $scope.handleSpellError(paragraphText, error, - digestRequired, propagated); - } - }; - $scope.runParagraphUsingBackendInterpreter = function(paragraphText) { websocketMsgSrv.runParagraph($scope.paragraph.id, $scope.paragraph.title, paragraphText, $scope.paragraph.config, $scope.paragraph.settings.params); @@ -460,21 +326,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat /** * @param paragraphText to be parsed - * @param digestRequired true if calling `$digest` is required - * @param propagated true if update request is sent from other client */ - $scope.runParagraph = function(paragraphText, digestRequired, propagated) { + $scope.runParagraph = function(paragraphText) { if (!paragraphText || $scope.isRunning($scope.paragraph)) { return; } - const magic = SpellResult.extractMagic(paragraphText); - - if (heliumService.getSpellByMagic(magic)) { - $scope.runParagraphUsingSpell(paragraphText, magic, digestRequired, propagated); - } else { - $scope.runParagraphUsingBackendInterpreter(paragraphText); - } + $scope.runParagraphUsingBackendInterpreter(paragraphText); $scope.originalText = angular.copy(paragraphText); $scope.dirtyText = undefined; @@ -491,17 +349,14 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat }; $scope.runParagraphFromShortcut = function(paragraphText) { - // passing `digestRequired` as true to update view immediately - // without this, results cannot be rendered in view more than once - $scope.runParagraph(paragraphText, true, false); + $scope.runParagraph(paragraphText); }; $scope.runParagraphFromButton = function() { if ($scope.isNoteRunning) { return; } - // we come here from the view, so we don't need to call `$digest()` - $scope.runParagraph($scope.getEditorValue(), false, false); + $scope.runParagraph($scope.getEditorValue()); }; $scope.runAllToThis = function(paragraph) { @@ -1594,20 +1449,6 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat /** $scope.$on */ - $scope.$on('runParagraphUsingSpell', function(event, data) { - const oldPara = $scope.paragraph; - let newPara = data.paragraph; - const updateCallback = () => { - $scope.runParagraph(newPara.text, true, true); - }; - - if (!isUpdateRequired(oldPara, newPara)) { - return; - } - - $scope.updateParagraph(oldPara, newPara, updateCallback); - }); - $scope.$on('updateParagraph', function(event, data) { const oldPara = $scope.paragraph; const newPara = data.paragraph; @@ -1844,19 +1685,6 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat } }); - $scope.$on('resultRendered', function(event, paragraphId) { - if ($scope.paragraph.id !== paragraphId) { - return; - } - - /** increase spell result count and return if not finished */ - if (!$scope.increaseSpellTransactionResultCount()) { - return; - } - - $scope.cleanupSpellTransaction(); - }); - $scope.$on('fontSizeChanged', function(event, fontSize) { if ($scope.editor) { $scope.editor.setOptions({ diff --git a/zeppelin-web/src/app/notebook/paragraph/result/result-chart-selector.html b/zeppelin-web/src/app/notebook/paragraph/result/result-chart-selector.html index 1e78a6e3ee4..0b128dc21c4 100644 --- a/zeppelin-web/src/app/notebook/paragraph/result/result-chart-selector.html +++ b/zeppelin-web/src/app/notebook/paragraph/result/result-chart-selector.html @@ -13,64 +13,20 @@ -->
      -
      - - - -
      -
      - -
      - -
      settings diff --git a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js index 5028c7a97d1..61fd3b5b0d6 100644 --- a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js @@ -22,10 +22,11 @@ import AreachartVisualization from '../../../visualization/builtins/visualizatio import LinechartVisualization from '../../../visualization/builtins/visualization-linechart'; import ScatterchartVisualization from '../../../visualization/builtins/visualization-scatterchart'; import NetworkVisualization from '../../../visualization/builtins/visualization-d3network'; -import {DefaultDisplayType, SpellResult} from '../../../spell'; import {ParagraphStatus} from '../paragraph.status'; import Result from './result'; +const DefaultDisplayType = {TABLE: 'TABLE', HTML: 'HTML', ANGULAR: 'ANGULAR', TEXT: 'TEXT', NETWORK: 'NETWORK'}; + const AnsiUp = require('ansi_up'); const AnsiUpConverter = new AnsiUp.default; // eslint-disable-line new-parens,new-cap const TableGridFilterTemplate = require('../../../visualization/builtins/visualization-table-grid-filter.html'); @@ -34,7 +35,7 @@ angular.module('zeppelinWebApp').controller('ResultCtrl', ResultCtrl); function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location, $timeout, $compile, $http, $q, $templateCache, $templateRequest, $sce, websocketMsgSrv, - baseUrlSrv, ngToast, saveAsService, noteVarShareService, heliumService, + baseUrlSrv, ngToast, saveAsService, noteVarShareService, uiGridConstants) { 'ngInject'; @@ -148,9 +149,6 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location // available columns in tabledata $scope.tableDataColumns = []; - // enable helium - let enableHelium = false; - // graphMode $scope.graphMode = null; @@ -175,28 +173,6 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location }; $scope.init = function(result, config, paragraph, index) { - // register helium plugin vis packages - let visPackages = heliumService.getVisualizationCachedPackages(); - const visPackageOrder = heliumService.getVisualizationCachedPackageOrder(); - - // push the helium vis packages following the order - visPackageOrder.map((visName) => { - visPackages.map((vis) => { - if (vis.name !== visName) { - return; - } - $scope.builtInTableDataVisualizationList.push({ - id: vis.id, - name: vis.name, - icon: $sce.trustAsHtml(vis.icon), - supports: [DefaultDisplayType.TABLE, DefaultDisplayType.NETWORK], - }); - builtInVisualizations[vis.id] = { - class: vis.class, - }; - }); - }); - updateData(result, config, paragraph, index); renderResult($scope.type); }; @@ -316,9 +292,6 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location $scope.graphMode = config.graph.mode; $scope.config = angular.copy(config); - // enable only when it is last result - enableHelium = (index === paragraphRef.results.msg.length - 1); - if ($scope.type === 'TABLE' || $scope.type === 'NETWORK') { tableData = new DatasetFactory().createDataset($scope.type); tableData.loadParagraphResult({type: $scope.type, msg: data}); @@ -343,8 +316,6 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location return `${baseDOMId}_angular`; } else if (type === DefaultDisplayType.TEXT) { return `${baseDOMId}_text`; - } else if (type === DefaultDisplayType.ELEMENT) { - return `${baseDOMId}_elem`; } else { console.error(`Cannot create display DOM Id due to unknown display type: ${type}`); } @@ -360,123 +331,30 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location renderAngular(targetElemId, data); } else if (type === DefaultDisplayType.TEXT) { renderText(targetElemId, data, refresh); - } else if (type === DefaultDisplayType.ELEMENT) { - renderElem(targetElemId, data); } else { console.error(`Unknown Display Type: ${type}`); } }; retryUntilElemIsLoaded(targetElemId, afterLoaded); - - // send message to parent that this result is rendered - const paragraphId = $scope.$parent.paragraph.id; - $scope.$emit('resultRendered', paragraphId); }; const renderResult = function(type, refresh) { - let activeApp; - if (enableHelium) { - getSuggestions(); - getApplicationStates(); - activeApp = _.get($scope.config, 'helium.activeApp'); - } - - if (activeApp) { - const appState = _.find($scope.apps, {id: activeApp}); - renderApp(`p${appState.id}`, appState); - } else { - if (!DefaultDisplayType[type]) { - $scope.renderCustomDisplay(type, data); - } else { - const targetElemId = $scope.createDisplayDOMId(`p${$scope.id}`, type); - $scope.renderDefaultDisplay(targetElemId, type, data, refresh); - } + if (DefaultDisplayType[type]) { + const targetElemId = $scope.createDisplayDOMId(`p${$scope.id}`, type); + $scope.renderDefaultDisplay(targetElemId, type, data, refresh); } }; - $scope.isDefaultDisplay = function() { - return DefaultDisplayType[$scope.type]; - }; - - /** - * Render multiple sub results for custom display - */ - $scope.renderCustomDisplay = function(type, data) { - // get result from intp - if (!heliumService.getSpellByMagic(type)) { - console.error(`Can't execute spell due to unknown display type: ${type}`); - return; - } - - // custom display result can include multiple subset results - heliumService.executeSpellAsDisplaySystem(type, data) - .then((dataWithTypes) => { - const containerDOMId = `p${$scope.id}_custom`; - const afterLoaded = () => { - const containerDOM = angular.element(`#${containerDOMId}`); - // Spell.interpret() can create multiple outputs - for (let i = 0; i < dataWithTypes.length; i++) { - const dt = dataWithTypes[i]; - const data = dt.data; - const type = dt.type; - - // prepare each DOM to be filled - const subResultDOMId = $scope.createDisplayDOMId(`p${$scope.id}_custom_${i}`, type); - const subResultDOM = document.createElement('div'); - containerDOM.append(subResultDOM); - subResultDOM.setAttribute('id', subResultDOMId); - - $scope.renderDefaultDisplay(subResultDOMId, type, data, true); - } - }; - - retryUntilElemIsLoaded(containerDOMId, afterLoaded); - }) - .catch((error) => { - console.error(`Failed to render custom display: ${$scope.type}\n` + error); - }); - }; - - /** - * generates actually object which will be consumed from `data` property - * feed it to the success callback. - * if error occurs, the error is passed to the failure callback - * - * @param data {Object or Function} - * @param type {string} Display Type - * @param successCallback - * @param failureCallback - */ const handleData = function(data, type, successCallback, failureCallback) { - if (SpellResult.isFunction(data)) { - try { - successCallback(data()); - } catch (error) { - failureCallback(error); - console.error(`Failed to handle ${type} type, function data\n`, error); - } - } else if (SpellResult.isObject(data)) { - try { - successCallback(data); - } catch (error) { - console.error(`Failed to handle ${type} type, object data\n`, error); - } + try { + successCallback(data); + } catch (error) { + failureCallback(error); + console.error(`Failed to render ${type}`, error); } }; - const renderElem = function(targetElemId, data) { - const elem = angular.element(`#${targetElemId}`); - handleData(() => { - data(targetElemId); - }, DefaultDisplayType.ELEMENT, - () => {}, /** HTML element will be filled with data. thus pass empty success callback */ - (error) => { - elem.html(`${error.stack}`); - } - ); - }; - const renderHtml = function(targetElemId, data) { const elem = angular.element(`#${targetElemId}`); handleData(data, DefaultDisplayType.HTML, @@ -633,7 +511,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location let builtInViz = builtInVisualizations[graphMode]; if (!builtInViz) { - /** helium package is not available, fallback to table vis */ + // Fall back to the table when a saved visualization is unavailable. graphMode = 'table'; $scope.graphMode = graphMode; /** html depends on this scope value */ builtInViz = builtInVisualizations[graphMode]; @@ -748,9 +626,6 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location // graph options newConfig.graph.mode = newMode; - // see switchApp() - _.set(newConfig, 'helium.activeApp', undefined); - commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams); }; @@ -962,282 +837,4 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location $scope.getBase64ImageSrc = function(base64Data) { return 'data:image/png;base64,' + base64Data; }; - - // Helium ---------------- - let ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_'; - - // app states - $scope.apps = []; - - // suggested apps - $scope.suggestion = {}; - - $scope.switchApp = function(appId) { - let newConfig = angular.copy($scope.config); - let newParams = angular.copy(paragraph.settings.params); - - // 'helium.activeApp' can be cleared by switchViz() - _.set(newConfig, 'helium.activeApp', appId); - - commitConfig(newConfig, newParams); - }; - - $scope.loadApp = function(heliumPackage) { - let noteId = $route.current.pathParams.noteId; - $http.post(baseUrlSrv.getRestApiBase() + '/helium/load/' + noteId + '/' + paragraph.id, heliumPackage) - .success(function(data, status, headers, config) { - console.log('Load app %o', data); - }) - .error(function(err, status, headers, config) { - console.log('Error %o', err); - }); - }; - - const commitConfig = function(config, params) { - commitParagraphResult(paragraph.title, paragraph.text, config, params); - }; - - const getApplicationStates = function() { - let appStates = []; - - // Display ApplicationState - if (paragraph.apps) { - _.forEach(paragraph.apps, function(app) { - appStates.push({ - id: app.id, - pkg: app.pkg, - status: app.status, - output: app.output, - }); - }); - } - - // update or remove app states no longer exists - _.forEach($scope.apps, function(currentAppState, idx) { - let newAppState = _.find(appStates, {id: currentAppState.id}); - if (newAppState) { - angular.extend($scope.apps[idx], newAppState); - } else { - $scope.apps.splice(idx, 1); - } - }); - - // add new app states - _.forEach(appStates, function(app, idx) { - if ($scope.apps.length <= idx || $scope.apps[idx].id !== app.id) { - $scope.apps.splice(idx, 0, app); - } - }); - }; - - const getSuggestions = function() { - // Get suggested apps - let noteId = $route.current.pathParams.noteId; - if (!noteId) { - return; - } - $http.get(baseUrlSrv.getRestApiBase() + '/helium/suggest/' + noteId + '/' + paragraph.id) - .success(function(data, status, headers, config) { - $scope.suggestion = data.body; - }) - .error(function(err, status, headers, config) { - console.log('Error %o', err); - }); - }; - - const renderApp = function(targetElemId, appState) { - const afterLoaded = (loadedElem) => { - try { - console.log('renderApp %o', appState); - loadedElem.html(appState.output); - $compile(loadedElem.contents())(getAppScope(appState)); - } catch (err) { - console.log('App rendering error %o', err); - } - }; - retryUntilElemIsLoaded(targetElemId, afterLoaded); - }; - - /* - ** $scope.$on functions below - */ - $scope.$on('appendAppOutput', function(event, data) { - if (paragraph.id === data.paragraphId) { - let app = _.find($scope.apps, {id: data.appId}); - if (app) { - app.output += data.data; - - let paragraphAppState = _.find(paragraph.apps, {id: data.appId}); - paragraphAppState.output = app.output; - - let targetEl = angular.element(document.getElementById('p' + app.id)); - targetEl.html(app.output); - $compile(targetEl.contents())(getAppScope(app)); - console.log('append app output %o', $scope.apps); - } - } - }); - - $scope.$on('updateAppOutput', function(event, data) { - if (paragraph.id === data.paragraphId) { - let app = _.find($scope.apps, {id: data.appId}); - if (app) { - app.output = data.data; - - let paragraphAppState = _.find(paragraph.apps, {id: data.appId}); - paragraphAppState.output = app.output; - - let targetEl = angular.element(document.getElementById('p' + app.id)); - targetEl.html(app.output); - $compile(targetEl.contents())(getAppScope(app)); - console.log('append app output'); - } - } - }); - - $scope.$on('appLoad', function(event, data) { - if (paragraph.id === data.paragraphId) { - let app = _.find($scope.apps, {id: data.appId}); - if (!app) { - app = { - id: data.appId, - pkg: data.pkg, - status: 'UNLOADED', - output: '', - }; - - $scope.apps.push(app); - paragraph.apps.push(app); - $scope.switchApp(app.id); - } - } - }); - - $scope.$on('appStatusChange', function(event, data) { - if (paragraph.id === data.paragraphId) { - let app = _.find($scope.apps, {id: data.appId}); - if (app) { - app.status = data.status; - let paragraphAppState = _.find(paragraph.apps, {id: data.appId}); - paragraphAppState.status = app.status; - } - } - }); - - let getAppRegistry = function(appState) { - if (!appState.registry) { - appState.registry = {}; - } - - return appState.registry; - }; - - const getAppScope = function(appState) { - if (!appState.scope) { - appState.scope = $rootScope.$new(true, $rootScope); - } - return appState.scope; - }; - - $scope.$on('angularObjectUpdate', function(event, data) { - let noteId = $route.current.pathParams.noteId; - if (!data.noteId || data.noteId === noteId) { - let scope; - let registry; - - let app = _.find($scope.apps, {id: data.paragraphId}); - if (app) { - scope = getAppScope(app); - registry = getAppRegistry(app); - } else { - // no matching app in this paragraph - return; - } - - let varName = data.angularObject.name; - - if (angular.equals(data.angularObject.object, scope[varName])) { - // return when update has no change - return; - } - - if (!registry[varName]) { - registry[varName] = { - interpreterGroupId: data.interpreterGroupId, - noteId: data.noteId, - paragraphId: data.paragraphId, - }; - } else { - registry[varName].noteId = registry[varName].noteId || data.noteId; - registry[varName].paragraphId = registry[varName].paragraphId || data.paragraphId; - } - - registry[varName].skipEmit = true; - - if (!registry[varName].clearWatcher) { - registry[varName].clearWatcher = scope.$watch(varName, function(newValue, oldValue) { - console.log('angular object (paragraph) updated %o %o', varName, registry[varName]); - if (registry[varName].skipEmit) { - registry[varName].skipEmit = false; - return; - } - websocketMsgSrv.updateAngularObject( - registry[varName].noteId, - registry[varName].paragraphId, - varName, - newValue, - registry[varName].interpreterGroupId); - }); - } - console.log('angular object (paragraph) created %o', varName); - scope[varName] = data.angularObject.object; - - // create proxy for AngularFunction - if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) { - let funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length); - scope[funcName] = function() { - // eslint-disable-next-line prefer-rest-params - scope[varName] = arguments; - // eslint-disable-next-line prefer-rest-params - console.log('angular function (paragraph) invoked %o', arguments); - }; - - console.log('angular function (paragraph) created %o', scope[funcName]); - } - } - }); - - $scope.$on('angularObjectRemove', function(event, data) { - let noteId = $route.current.pathParams.noteId; - if (!data.noteId || data.noteId === noteId) { - let scope; - let registry; - - let app = _.find($scope.apps, {id: data.paragraphId}); - if (app) { - scope = getAppScope(app); - registry = getAppRegistry(app); - } else { - // no matching app in this paragraph - return; - } - - let varName = data.name; - - // clear watcher - if (registry[varName]) { - registry[varName].clearWatcher(); - registry[varName] = undefined; - } - - // remove scope variable - scope[varName] = undefined; - - // remove proxy for AngularFunction - if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) { - let funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length); - scope[funcName] = undefined; - } - } - }); } diff --git a/zeppelin-web/src/app/notebook/paragraph/result/result.html b/zeppelin-web/src/app/notebook/paragraph/result/result.html index 964475d08d5..62f1462f4ee 100644 --- a/zeppelin-web/src/app/notebook/paragraph/result/result.html +++ b/zeppelin-web/src/app/notebook/paragraph/result/result.html @@ -18,7 +18,6 @@ ng-mouseout="onMouseOut()" ng-mouseover="onMouseOver()" id="p{{id}}_resize" - ng-if="!config.helium.activeApp" style="padding-bottom: 5px;" resize='{"allowresize": "{{!asIframe && !viewOnly}}", "graphType": "{{type}}"}' resizable on-resize="resize(width, height);"> @@ -95,18 +94,6 @@ uib-tooltip="Scroll Top">
      -
      -
      - -
      -
      -
      -
      -
      -
      -
      + diff --git a/zeppelin-web/src/app/spell/.npmignore b/zeppelin-web/src/app/spell/.npmignore deleted file mode 100644 index 0b84df0f025..00000000000 --- a/zeppelin-web/src/app/spell/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*.html \ No newline at end of file diff --git a/zeppelin-web/src/app/spell/index.js b/zeppelin-web/src/app/spell/index.js deleted file mode 100644 index 8ec47532316..00000000000 --- a/zeppelin-web/src/app/spell/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export { - DefaultDisplayType, - SpellResult, -} from './spell-result'; - -export { - SpellBase, -} from './spell-base'; diff --git a/zeppelin-web/src/app/spell/package.json b/zeppelin-web/src/app/spell/package.json deleted file mode 100644 index 3962887f552..00000000000 --- a/zeppelin-web/src/app/spell/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "zeppelin-spell", - "description": "Zeppelin Spell Framework", - "version": "0.9.0-SNAPSHOT", - "main": "index", - "dependencies": { - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apache/zeppelin" - }, - "license": "Apache-2.0" -} diff --git a/zeppelin-web/src/app/spell/spell-base.js b/zeppelin-web/src/app/spell/spell-base.js deleted file mode 100644 index 16e0553edc7..00000000000 --- a/zeppelin-web/src/app/spell/spell-base.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* eslint-disable no-unused-vars */ -import { - DefaultDisplayType, - SpellResult, -} from './spell-result'; -/* eslint-enable no-unused-vars */ - -export class SpellBase { - constructor(magic) { - this.magic = magic; - } - - /** - * Consumes text and return `SpellResult`. - * - * @param paragraphText {string} which doesn't include magic - * @param config {Object} - * @return {SpellResult} - */ - interpret(paragraphText, config) { - throw new Error('SpellBase.interpret() should be overrided'); - } - - /** - * return magic for this spell. - * (e.g `%flowchart`) - * @return {string} - */ - getMagic() { - return this.magic; - } -} diff --git a/zeppelin-web/src/app/spell/spell-result.js b/zeppelin-web/src/app/spell/spell-result.js deleted file mode 100644 index 93d71ed876b..00000000000 --- a/zeppelin-web/src/app/spell/spell-result.js +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const DefaultDisplayType = { - ELEMENT: 'ELEMENT', - TABLE: 'TABLE', - HTML: 'HTML', - ANGULAR: 'ANGULAR', - TEXT: 'TEXT', - NETWORK: 'NETWORK', -}; - -export const DefaultDisplayMagic = { - '%element': DefaultDisplayType.ELEMENT, - '%table': DefaultDisplayType.TABLE, - '%html': DefaultDisplayType.HTML, - '%angular': DefaultDisplayType.ANGULAR, - '%text': DefaultDisplayType.TEXT, - '%network': DefaultDisplayType.NETWORK, -}; - -export class DataWithType { - constructor(data, type, magic, text) { - this.data = data; - this.type = type; - - /** - * keep for `DefaultDisplayType.ELEMENT` (function data type) - * to propagate a result to other client. - * - * otherwise we will send function as `data` and it will not work - * since they don't have context where they are created. - */ - - this.magic = magic; - this.text = text; - } - - static handleDefaultMagic(m) { - // let's use default display type instead of magic in case of default - // to keep consistency with backend interpreter - if (DefaultDisplayMagic[m]) { - return DefaultDisplayMagic[m]; - } else { - return m; - } - } - - static createPropagable(dataWithType) { - if (!SpellResult.isFunction(dataWithType.data)) { - return dataWithType; - } - - const data = dataWithType.getText(); - const type = dataWithType.getMagic(); - - return new DataWithType(data, type); - } - - /** - * consume 1 data and produce multiple - * @param data {string} - * @param customDisplayType - * @return {Array} - */ - static parseStringData(data, customDisplayMagic) { - function availableMagic(magic) { - return magic && (DefaultDisplayMagic[magic] || customDisplayMagic[magic]); - } - - const splited = data.split('\n'); - - const gensWithTypes = []; - let mergedGens = []; - let previousMagic = DefaultDisplayType.TEXT; - - // create `DataWithType` whenever see available display type. - for (let i = 0; i < splited.length; i++) { - const g = splited[i]; - const magic = SpellResult.extractMagic(g); - - // create `DataWithType` only if see new magic - if (availableMagic(magic) && mergedGens.length > 0) { - gensWithTypes.push(new DataWithType(mergedGens.join(''), previousMagic)); - mergedGens = []; - } - - // accumulate `data` to mergedGens - if (availableMagic(magic)) { - const withoutMagic = g.split(magic)[1]; - mergedGens.push(`${withoutMagic}\n`); - previousMagic = DataWithType.handleDefaultMagic(magic); - } else { - mergedGens.push(`${g}\n`); - } - } - - // cleanup the last `DataWithType` - if (mergedGens.length > 0) { - previousMagic = DataWithType.handleDefaultMagic(previousMagic); - gensWithTypes.push(new DataWithType(mergedGens.join(''), previousMagic)); - } - - return gensWithTypes; - } - - /** - * get 1 `DataWithType` and produce multiples using available displays - * return an wrapped with a promise to generalize result output which can be - * object, function or promise - * @param dataWithType {DataWithType} - * @param availableDisplays {Object} Map for available displays - * @param magic - * @param textWithoutMagic - * @return {Promise>} - */ - static produceMultipleData(dataWithType, customDisplayType, - magic, textWithoutMagic) { - const data = dataWithType.getData(); - const type = dataWithType.getType(); - - // if the type is specified, just return it - // handle non-specified dataWithTypes only - if (type) { - return new Promise((resolve) => { - resolve([dataWithType]); - }); - } - - let wrapped; - - if (SpellResult.isFunction(data)) { - // if data is a function, we consider it as ELEMENT type. - wrapped = new Promise((resolve) => { - const dt = new DataWithType( - data, DefaultDisplayType.ELEMENT, magic, textWithoutMagic); - const result = [dt]; - return resolve(result); - }); - } else if (SpellResult.isPromise(data)) { - // if data is a promise, - wrapped = data.then((generated) => { - const result = - DataWithType.parseStringData(generated, customDisplayType); - return result; - }); - } else { - // if data is a object, parse it to multiples - wrapped = new Promise((resolve) => { - const result = - DataWithType.parseStringData(data, customDisplayType); - return resolve(result); - }); - } - - return wrapped; - } - - /** - * `data` can be promise, function or just object - * - if data is an object, it will be used directly. - * - if data is a function, it will be called with DOM element id - * where the final output is rendered. - * - if data is a promise, the post processing logic - * will be called in `then()` of this promise. - * @returns {*} `data` which can be object, function or promise. - */ - getData() { - return this.data; - } - - /** - * Value of `type` might be empty which means - * data can be separated into multiples - * by `SpellResult.parseStringData()` - * @returns {string} - */ - getType() { - return this.type; - } - - getMagic() { - return this.magic; - } - - getText() { - return this.text; - } -} - -export class SpellResult { - constructor(resultData, resultType) { - this.dataWithTypes = []; - this.add(resultData, resultType); - } - - static isFunction(data) { - return (data && typeof data === 'function'); - } - - static isPromise(data) { - return (data && typeof data.then === 'function'); - } - - static isObject(data) { - return (typeof data !== 'undefined' && - !SpellResult.isFunction(data) && - !SpellResult.isPromise(data)); - } - - static extractMagic(allParagraphText) { - const pattern = /^\s*%(\S+)\s*/g; - try { - let match = pattern.exec(allParagraphText); - if (match) { - return `%${match[1].trim()}`; - } - } catch (error) { - // failed to parse, ignore - } - - return undefined; - } - - static createPropagable(resultMsg) { - return resultMsg.map((dt) => { - return DataWithType.createPropagable(dt); - }); - } - - add(resultData, resultType) { - if (resultData) { - this.dataWithTypes.push( - new DataWithType(resultData, resultType)); - } - - return this; - } - - /** - * @param customDisplayType - * @param textWithoutMagic - * @return {Promise>} - */ - getAllParsedDataWithTypes(customDisplayType, magic, textWithoutMagic) { - const promises = this.dataWithTypes.map((dt) => { - return DataWithType.produceMultipleData( - dt, customDisplayType, magic, textWithoutMagic); - }); - - // some promises can include an array so we need to flatten them - const flatten = Promise.all(promises).then((values) => { - return values.reduce((acc, cur) => { - if (Array.isArray(cur)) { - return acc.concat(cur); - } else { - return acc.concat([cur]); - } - }); - }); - - return flatten; - } -} diff --git a/zeppelin-web/src/app/tabledata/.npmignore b/zeppelin-web/src/app/tabledata/.npmignore deleted file mode 100644 index 0b84df0f025..00000000000 --- a/zeppelin-web/src/app/tabledata/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*.html \ No newline at end of file diff --git a/zeppelin-web/src/app/tabledata/package.json b/zeppelin-web/src/app/tabledata/package.json deleted file mode 100644 index a4d062e4502..00000000000 --- a/zeppelin-web/src/app/tabledata/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "zeppelin-tabledata", - "description": "tabledata api", - "version": "0.9.0-SNAPSHOT", - "main": "tabledata", - "dependencies": { - "json3": "~3.3.1", - "lodash": "~4.17.15" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apache/zeppelin" - }, - "license": "Apache-2.0" -} diff --git a/zeppelin-web/src/app/visualization/.npmignore b/zeppelin-web/src/app/visualization/.npmignore deleted file mode 100644 index 2d19fc766d9..00000000000 --- a/zeppelin-web/src/app/visualization/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*.html diff --git a/zeppelin-web/src/app/visualization/package.json b/zeppelin-web/src/app/visualization/package.json deleted file mode 100644 index 661eb823cc7..00000000000 --- a/zeppelin-web/src/app/visualization/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "zeppelin-vis", - "description": "Visualization API", - "version": "0.9.0-SNAPSHOT", - "main": "visualization", - "dependencies": { - "json3": "~3.3.1", - "nvd3": "~1.7.1", - "lodash": "~4.17.15" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apache/zeppelin" - }, - "license": "Apache-2.0" -} diff --git a/zeppelin-web/src/components/navbar/navbar.html b/zeppelin-web/src/components/navbar/navbar.html index 8da547bb1a3..c9c71ea5004 100644 --- a/zeppelin-web/src/components/navbar/navbar.html +++ b/zeppelin-web/src/components/navbar/navbar.html @@ -100,7 +100,6 @@
    • Interpreter
    • Notebook Repos
    • Credential
    • -
    • Helium
    • Configuration
    • Cluster
    • diff --git a/zeppelin-web/src/components/websocket/websocket-event.factory.js b/zeppelin-web/src/components/websocket/websocket-event.factory.js index 61ef7fd45cf..00929df5a0f 100644 --- a/zeppelin-web/src/components/websocket/websocket-event.factory.js +++ b/zeppelin-web/src/components/websocket/websocket-event.factory.js @@ -136,8 +136,6 @@ function WebsocketEventFactory($rootScope, $websocket, $location, baseUrlSrv, sa $rootScope.$broadcast('patchReceived', data); } else if (op === 'COLLABORATIVE_MODE_STATUS') { $rootScope.$broadcast('collaborativeModeStatus', data); - } else if (op === 'RUN_PARAGRAPH_USING_SPELL') { - $rootScope.$broadcast('runParagraphUsingSpell', data); } else if (op === 'PARAGRAPH_APPEND_OUTPUT') { $rootScope.$broadcast('appendParagraphOutput', data); } else if (op === 'PARAGRAPH_UPDATE_OUTPUT') { @@ -152,14 +150,6 @@ function WebsocketEventFactory($rootScope, $websocket, $location, baseUrlSrv, sa $rootScope.$broadcast('angularObjectUpdate', data); } else if (op === 'ANGULAR_OBJECT_REMOVE') { $rootScope.$broadcast('angularObjectRemove', data); - } else if (op === 'APP_APPEND_OUTPUT') { - $rootScope.$broadcast('appendAppOutput', data); - } else if (op === 'APP_UPDATE_OUTPUT') { - $rootScope.$broadcast('updateAppOutput', data); - } else if (op === 'APP_LOAD') { - $rootScope.$broadcast('appLoad', data); - } else if (op === 'APP_STATUS_CHANGE') { - $rootScope.$broadcast('appStatusChange', data); } else if (op === 'LIST_REVISION_HISTORY') { $rootScope.$broadcast('listRevisionHistory', data); } else if (op === 'NOTE_REVISION') { diff --git a/zeppelin-web/src/components/websocket/websocket-message.service.js b/zeppelin-web/src/components/websocket/websocket-message.service.js index 786553b630e..fa2a4ed93f2 100644 --- a/zeppelin-web/src/components/websocket/websocket-message.service.js +++ b/zeppelin-web/src/components/websocket/websocket-message.service.js @@ -163,34 +163,6 @@ function WebsocketMessageService($rootScope, websocketEvents) { websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}}); }, - paragraphExecutedBySpell: function(paragraphId, paragraphTitle, - paragraphText, paragraphResultsMsg, - paragraphStatus, paragraphErrorMessage, - paragraphConfig, paragraphParams, - paragraphDateStarted, paragraphDateFinished) { - websocketEvents.sendNewEvent({ - op: 'PARAGRAPH_EXECUTED_BY_SPELL', - data: { - id: paragraphId, - title: paragraphTitle, - paragraph: paragraphText, - results: { - code: paragraphStatus, - msg: paragraphResultsMsg.map((dataWithType) => { - let serializedData = dataWithType.data; - return {type: dataWithType.type, data: serializedData}; - }), - }, - status: paragraphStatus, - errorMessage: paragraphErrorMessage, - config: paragraphConfig, - params: paragraphParams, - dateStarted: paragraphDateStarted, - dateFinished: paragraphDateFinished, - }, - }); - }, - runParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { // short circuit update paragraph status for immediate visual feedback without waiting for server response $rootScope.$broadcast('updateStatus', { diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index 9cb60c3f829..1c8a5e65cb1 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -59,7 +59,6 @@ - diff --git a/zeppelin-web/src/index.js b/zeppelin-web/src/index.js index 1aee71f9d6e..8a7a553ec0d 100644 --- a/zeppelin-web/src/index.js +++ b/zeppelin-web/src/index.js @@ -58,8 +58,6 @@ import './app/notebook/note-var-share.service.js'; import './app/notebook-repository/notebook-repository.controller.js'; import './app/search/result-list.controller.js'; import './app/search/search.service.js'; -import './app/helium'; -import './app/helium/helium.service.js'; import './app/notebook/dynamic-forms/dynamic-forms.directive.js'; import './components/array-ordering/array-ordering.service.js'; import './components/navbar/navbar.controller.js'; diff --git a/zeppelin-web/webpack.config.js b/zeppelin-web/webpack.config.js index 5894ca9e7f7..38d1f2b89dc 100644 --- a/zeppelin-web/webpack.config.js +++ b/zeppelin-web/webpack.config.js @@ -231,7 +231,6 @@ module.exports = function makeWebpackConfig () { // Reference: https://webpack.github.io/docs/list-of-plugins.html#defineplugin new webpack.DefinePlugin({ 'process.env': { - HELIUM_BUNDLE_DEV: process.env.HELIUM_BUNDLE_DEV, SERVER_PORT: serverPort, WEB_PORT: webPort, PROD: isProd,