Repository: incubator-zeppelin Updated Branches: refs/heads/master 223f8720b -> b929b34b5
ZEPPELIN-238: Remove unused swagger code Author: Rohit Agarwal <[email protected]> Closes #226 from mindprince/ZEPPELIN-238 and squashes the following commits: a2df01d [Rohit Agarwal] ZEPPELIN-238: Remove unused swagger code Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/b929b34b Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/b929b34b Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/b929b34b Branch: refs/heads/master Commit: b929b34b5082d36f6795822e6f93cddf9fc4fe4f Parents: 223f872 Author: Rohit Agarwal <[email protected]> Authored: Tue Aug 18 12:20:21 2015 -0700 Committer: Lee moon soo <[email protected]> Committed: Thu Sep 10 16:00:08 2015 -0700 ---------------------------------------------------------------------- bin/common.sh | 8 --- zeppelin-distribution/pom.xml | 8 --- .../src/assemble/distribution.xml | 2 - zeppelin-server/pom.xml | 58 ------------------ .../zeppelin/rest/InterpreterRestApi.java | 25 +++----- .../apache/zeppelin/rest/ZeppelinRestApi.java | 7 --- .../apache/zeppelin/server/ZeppelinServer.java | 62 +------------------- zeppelin-web/src/WEB-INF/web.xml | 7 +-- .../zeppelin/conf/ZeppelinConfiguration.java | 1 - 9 files changed, 9 insertions(+), 169 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/bin/common.sh ---------------------------------------------------------------------- diff --git a/bin/common.sh b/bin/common.sh index 188ff86..2ed2d00 100644 --- a/bin/common.sh +++ b/bin/common.sh @@ -52,14 +52,6 @@ if [[ -z "${ZEPPELIN_WAR}" ]]; then fi fi -if [[ -z "${ZEPPELIN_API_WAR}" ]]; then - if [[ -d "${ZEPPELIN_HOME}/zeppelin-docs/src/main/swagger" ]]; then - export ZEPPELIN_API_WAR="${ZEPPELIN_HOME}/zeppelin-docs/src/main/swagger" - else - export ZEPPELIN_API_WAR=$(find -L "${ZEPPELIN_HOME}" -name "zeppelin-api-ui*.war") - fi -fi - if [[ -z "$ZEPPELIN_INTERPRETER_DIR" ]]; then export ZEPPELIN_INTERPRETER_DIR="${ZEPPELIN_HOME}/interpreter" fi http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-distribution/pom.xml ---------------------------------------------------------------------- diff --git a/zeppelin-distribution/pom.xml b/zeppelin-distribution/pom.xml index 6c7b3f0..df44898 100644 --- a/zeppelin-distribution/pom.xml +++ b/zeppelin-distribution/pom.xml @@ -57,14 +57,6 @@ <version>${project.version}</version> <type>war</type> </dependency> - <!-- - <dependency> - <artifactId>zeppelin-api-ui</artifactId> - <groupId>${project.groupId}</groupId> - <version>${project.version}</version> - <type>war</type> - </dependency> - --> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-distribution/src/assemble/distribution.xml ---------------------------------------------------------------------- diff --git a/zeppelin-distribution/src/assemble/distribution.xml b/zeppelin-distribution/src/assemble/distribution.xml index dae34c4..5135fbb 100644 --- a/zeppelin-distribution/src/assemble/distribution.xml +++ b/zeppelin-distribution/src/assemble/distribution.xml @@ -33,7 +33,6 @@ <useAllReactorProjects>true</useAllReactorProjects> --> <!-- Now, select which projects to include in this module-set. --> <includes> - <include>org.apache.zeppelin:zeppelin-api-ui</include> <include>org.apache.zeppelin:zeppelin-server</include> <include>org.apache.zeppelin:zeppelin-web</include> </includes> @@ -45,7 +44,6 @@ <useProjectArtifact>false</useProjectArtifact> <excludes> <exclude>${project.groupId}:zeppelin-web</exclude> - <exclude>${project.groupId}:zeppelin-api-ui</exclude> <exclude>${project.groupId}:zeppelin-server</exclude> </excludes> </dependencySet> http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-server/pom.xml ---------------------------------------------------------------------- diff --git a/zeppelin-server/pom.xml b/zeppelin-server/pom.xml index 03f0ad0..fe80540 100644 --- a/zeppelin-server/pom.xml +++ b/zeppelin-server/pom.xml @@ -96,64 +96,6 @@ <version>${cxf.version}</version> </dependency> - <!-- Swagger --> - <dependency> - <groupId>com.wordnik</groupId> - <artifactId>swagger-jersey-jaxrs_2.10</artifactId> - <version>1.3.0</version> - <exclusions> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-scala_2.10</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-scala_2.10</artifactId> - </exclusion> - <exclusion> - <groupId>com.thoughtworks.paranamer</groupId> - <artifactId>paranamer</artifactId> - </exclusion> - <exclusion> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </exclusion> - <exclusion> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-servlet</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scala-library</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scala-compiler</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scalap</artifactId> - </exclusion> - <exclusion> - <artifactId>joda-time</artifactId> - <groupId>joda-time</groupId> - </exclusion> - </exclusions> - </dependency> - - <!-- Deps for Swagger: brings multiple --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-jetty</artifactId> http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java index fdbfd39..5401543 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java @@ -42,10 +42,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiResponse; -import com.wordnik.swagger.annotations.ApiResponses; /** * Interpreter Rest API @@ -53,7 +49,6 @@ import com.wordnik.swagger.annotations.ApiResponses; */ @Path("/interpreter") @Produces("application/json") -@Api(value = "/interpreter", description = "Zeppelin Interpreter REST API") public class InterpreterRestApi { Logger logger = LoggerFactory.getLogger(InterpreterRestApi.class); @@ -71,12 +66,10 @@ public class InterpreterRestApi { /** * List all interpreter settings - * @return + * @return */ @GET @Path("setting") - @ApiOperation(httpMethod = "GET", value = "List all interpreter setting") - @ApiResponses(value = {@ApiResponse(code = 500, message = "When something goes wrong")}) public Response listSettings() { List<InterpreterSetting> interpreterSettings = null; interpreterSettings = interpreterFactory.get(); @@ -92,8 +85,6 @@ public class InterpreterRestApi { */ @POST @Path("setting") - @ApiOperation(httpMethod = "GET", value = "Create new interpreter setting") - @ApiResponses(value = {@ApiResponse(code = 201, message = "On success")}) public Response newSettings(String message) throws InterpreterException, IOException { NewInterpreterSettingRequest request = gson.fromJson(message, NewInterpreterSettingRequest.class); @@ -132,21 +123,22 @@ public class InterpreterRestApi { return new JsonResponse(Status.OK, "", setting).build(); } + /** + * Remove interpreter setting + */ @DELETE @Path("setting/{settingId}") - @ApiOperation(httpMethod = "GET", value = "Remove interpreter setting") - @ApiResponses(value = {@ApiResponse(code = 500, message = "When something goes wrong")}) public Response removeSetting(@PathParam("settingId") String settingId) throws IOException { logger.info("Remove interpreterSetting {}", settingId); interpreterFactory.remove(settingId); return new JsonResponse(Status.OK).build(); } + /** + * Restart interpreter setting + */ @PUT @Path("setting/restart/{settingId}") - @ApiOperation(httpMethod = "GET", value = "restart interpreter setting") - @ApiResponses(value = { - @ApiResponse(code = 404, message = "Not found")}) public Response restartSetting(@PathParam("settingId") String settingId) { logger.info("Restart interpreterSetting {}", settingId); try { @@ -166,9 +158,6 @@ public class InterpreterRestApi { * List all available interpreters by group */ @GET - @ApiOperation(httpMethod = "GET", value = "List all available interpreters") - @ApiResponses(value = { - @ApiResponse(code = 500, message = "When something goes wrong")}) public Response listInterpreter(String message) { Map<String, RegisteredInterpreter> m = Interpreter.registeredInterpreters; return new JsonResponse(Status.OK, "", m).build(); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/ZeppelinRestApi.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/ZeppelinRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/ZeppelinRestApi.java index 4fc47a4..367f923 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/ZeppelinRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/ZeppelinRestApi.java @@ -21,8 +21,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; -import com.wordnik.swagger.annotations.Api; - /** * Zeppelin root rest api endpoint. * @@ -30,14 +28,9 @@ import com.wordnik.swagger.annotations.Api; * @since 0.3.4 */ @Path("/") -@Api(value = "/", description = "Zeppelin REST API root") public class ZeppelinRestApi { - /** - * Required by Swagger. - */ public ZeppelinRestApi() { - super(); } /** http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java ---------------------------------------------------------------------- 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 ad1d907..a37fc22 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 @@ -57,8 +57,6 @@ import org.eclipse.jetty.webapp.WebAppContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.wordnik.swagger.jersey.config.JerseyJaxrsConfig; - /** * Main class of Zeppelin. * @@ -88,23 +86,16 @@ public class ZeppelinServer extends Application { // REST api final ServletContextHandler restApi = setupRestApiContextHandler(); - /** NOTE: Swagger-core is included via the web.xml in zeppelin-web - * But the rest of swagger is configured here - */ - final ServletContextHandler swagger = setupSwaggerContextHandler(conf); // Notebook server final ServletContextHandler notebook = setupNotebookServer(conf); // Web UI final WebAppContext webApp = setupWebAppContext(conf); - //Below is commented since zeppelin-docs module is removed. - //final WebAppContext webAppSwagg = setupWebAppSwagger(conf); // add all handlers ContextHandlerCollection contexts = new ContextHandlerCollection(); - //contexts.setHandlers(new Handler[]{swagger, restApi, webApp, webAppSwagg}); - contexts.setHandlers(new Handler[]{swagger, restApi, notebook, webApp}); + contexts.setHandlers(new Handler[]{restApi, notebook, webApp}); jettyServer.setHandler(contexts); LOG.info("Start zeppelin server"); @@ -228,34 +219,6 @@ public class ZeppelinServer extends Application { return cxfContext; } - /** - * Swagger core handler - Needed for the RestFul api documentation. - * - * @return ServletContextHandler of Swagger - */ - private static ServletContextHandler setupSwaggerContextHandler( - ZeppelinConfiguration conf) { - - // Configure Swagger-core - final ServletHolder swaggerServlet = - new ServletHolder(new JerseyJaxrsConfig()); - swaggerServlet.setName("JerseyJaxrsConfig"); - swaggerServlet.setInitParameter("api.version", "1.0.0"); - swaggerServlet.setInitParameter( - "swagger.api.basepath", - "http://" + conf.getServerAddress() + ":" + conf.getServerPort() + "/api"); - swaggerServlet.setInitOrder(2); - - // Setup the handler - final ServletContextHandler handler = new ServletContextHandler(); - handler.setSessionHandler(new SessionHandler()); - // Bind Swagger-core to the url HOST/api-docs - handler.addServlet(swaggerServlet, "/api-docs/*"); - - // And we are done - return handler; - } - private static WebAppContext setupWebAppContext( ZeppelinConfiguration conf) { @@ -279,29 +242,6 @@ public class ZeppelinServer extends Application { return webApp; } - /** - * Handles the WebApplication for Swagger-ui. - * - * @return WebAppContext with swagger ui context - */ - /*private static WebAppContext setupWebAppSwagger( - ZeppelinConfiguration conf) { - - WebAppContext webApp = new WebAppContext(); - File warPath = new File(conf.getString(ConfVars.ZEPPELIN_API_WAR)); - - if (warPath.isDirectory()) { - webApp.setResourceBase(warPath.getPath()); - } else { - webApp.setWar(warPath.getAbsolutePath()); - } - webApp.setContextPath("/docs"); - webApp.setParentLoaderPriority(true); - // Bind swagger-ui to the path HOST/docs - webApp.addServlet(new ServletHolder(new DefaultServlet()), "/docs/*"); - return webApp; - }*/ - public ZeppelinServer() throws Exception { ZeppelinConfiguration conf = ZeppelinConfiguration.create(); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-web/src/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/WEB-INF/web.xml b/zeppelin-web/src/WEB-INF/web.xml index 08c2639..e2514c9 100644 --- a/zeppelin-web/src/WEB-INF/web.xml +++ b/zeppelin-web/src/WEB-INF/web.xml @@ -26,15 +26,10 @@ <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> - <param-value>org.apache.zeppelin.rest;com.wordnik.swagger.jersey.listing</param-value> + <param-value>org.apache.zeppelin.rest</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> - <!-- This route is for swagger, must be different than root --> - <servlet-mapping> - <servlet-name>default</servlet-name> - <url-pattern>/rest/*</url-pattern> - </servlet-mapping> <context-param> <param-name>configuration</param-name> http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b929b34b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index 0d71b1a..1027f3d 100755 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -393,7 +393,6 @@ public class ZeppelinConfiguration extends XMLConfiguration { ZEPPELIN_SSL_TRUSTSTORE_TYPE("zeppelin.ssl.truststore.type", null), ZEPPELIN_SSL_TRUSTSTORE_PASSWORD("zeppelin.ssl.truststore.password", null), ZEPPELIN_WAR("zeppelin.war", "../zeppelin-web/dist"), - ZEPPELIN_API_WAR("zeppelin.api.war", "../zeppelin-docs/src/main/swagger"), ZEPPELIN_INTERPRETERS("zeppelin.interpreters", "org.apache.zeppelin.spark.SparkInterpreter," + "org.apache.zeppelin.spark.PySparkInterpreter," + "org.apache.zeppelin.spark.SparkSqlInterpreter,"
