mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-238: Remove unused swagger code
This commit is contained in:
parent
b4b4f5521a
commit
a2df01d368
9 changed files with 9 additions and 169 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,"
|
||||
|
|
|
|||
Loading…
Reference in a new issue