Repository: asterixdb Updated Branches: refs/heads/master 38553c04d -> 2343e1c13
ASTERIXDB-1785: Remove servlet dependencies Change-Id: I12bbd0754755982c95b522a9ade19e9f9690d95a Reviewed-on: https://asterix-gerrit.ics.uci.edu/1484 Reviewed-by: abdullah alamoudi <[email protected]> Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> BAD: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/2343e1c1 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/2343e1c1 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/2343e1c1 Branch: refs/heads/master Commit: 2343e1c13f03f9f04f50229d883e84c2ec82bada Parents: 38553c0 Author: Till Westmann <[email protected]> Authored: Fri Feb 3 22:47:52 2017 -0800 Committer: Till Westmann <[email protected]> Committed: Sat Feb 4 07:20:57 2017 -0800 ---------------------------------------------------------------------- asterixdb/asterix-app/pom.xml | 8 --- .../bootstrap/CCApplicationEntryPoint.java | 19 +----- .../asterix/hyracks/bootstrap/WebManager.java | 69 -------------------- asterixdb/asterix-client-helper/pom.xml | 5 -- .../commands/GetClusterStateCommand.java | 8 +-- .../clienthelper/commands/ShutdownCommand.java | 5 +- .../commands/WaitForClusterCommand.java | 18 ++--- asterixdb/asterix-common/pom.xml | 32 ++++----- .../asterix/test/server/RSSFeedServlet.java | 51 ++++++++++----- .../asterix/test/server/RSSTestServer.java | 21 +++--- asterixdb/pom.xml | 16 ----- .../hyracks-control/hyracks-control-cc/pom.xml | 40 ++++++------ .../apache/hyracks/http/server/WebManager.java | 67 +++++++++++++++++++ 13 files changed, 159 insertions(+), 200 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-app/pom.xml ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/pom.xml b/asterixdb/asterix-app/pom.xml index 282181c..597e328 100644 --- a/asterixdb/asterix-app/pom.xml +++ b/asterixdb/asterix-app/pom.xml @@ -191,14 +191,6 @@ </build> <dependencies> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlet</artifactId> - </dependency> - <dependency> <groupId>org.apache.hyracks</groupId> <artifactId>hyracks-control-cc</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java index 7955ad6..92f3501 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java @@ -25,8 +25,6 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import javax.servlet.Servlet; - import org.apache.asterix.active.ActiveLifecycleListener; import org.apache.asterix.api.http.server.ApiServlet; import org.apache.asterix.api.http.server.ClusterApiServlet; @@ -76,9 +74,7 @@ import org.apache.hyracks.control.cc.ClusterControllerService; import org.apache.hyracks.control.common.controllers.CCConfig; import org.apache.hyracks.http.api.IServlet; import org.apache.hyracks.http.server.HttpServer; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.servlet.ServletMapping; +import org.apache.hyracks.http.server.WebManager; public class CCApplicationEntryPoint implements ICCApplicationEntryPoint { @@ -208,7 +204,7 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint { } protected void addLet(HttpServer server, Lets let) { - server.addLet(createServLet(server, let, let.getPath())); + server.addLet(createServlet(server, let, let.getPath())); } protected HttpServer setupQueryWebServer(ExternalProperties externalProperties) throws Exception { @@ -220,15 +216,6 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint { return queryWebServer; } - protected void addServlet(ServletContextHandler context, Servlet servlet, String... paths) { - final ServletHolder holder = new ServletHolder(servlet); - context.getServletHandler().addServlet(holder); - ServletMapping mapping = new ServletMapping(); - mapping.setServletName(holder.getName()); - mapping.setPathSpecs(paths); - context.getServletHandler().addServletMapping(mapping); - } - protected HttpServer setupFeedServer(ExternalProperties externalProperties) throws Exception { HttpServer feedServer = new HttpServer(webManager.getBosses(), webManager.getWorkers(), externalProperties.getFeedServerPort()); @@ -237,7 +224,7 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint { return feedServer; } - protected IServlet createServLet(HttpServer server, Lets key, String... paths) { + protected IServlet createServlet(HttpServer server, Lets key, String... paths) { switch (key) { case AQL: return new FullApiServlet(server.ctx(), paths, ccExtensionManager.getAqlCompilationProvider(), http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/WebManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/WebManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/WebManager.java deleted file mode 100644 index 070a530..0000000 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/WebManager.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.asterix.hyracks.bootstrap; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.hyracks.http.server.HttpServer; - -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; - -public class WebManager { - private final List<HttpServer> servers; - private final EventLoopGroup bosses; - private final EventLoopGroup workers; - - public WebManager() { - servers = new ArrayList<>(); - bosses = new NioEventLoopGroup(1); - workers = new NioEventLoopGroup(); - } - - public List<HttpServer> getServers() { - return servers; - } - - public EventLoopGroup getBosses() { - return bosses; - } - - public EventLoopGroup getWorkers() { - return workers; - } - - public void start() throws Exception { - for (HttpServer server : servers) { - server.start(); - } - } - - public void stop() throws Exception { - for (HttpServer server : servers) { - server.stop(); - } - workers.shutdownGracefully().sync(); - bosses.shutdownGracefully().sync(); - } - - public void add(HttpServer server) { - servers.add(server); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-client-helper/pom.xml ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml index be9693f..9a7bb64 100644 --- a/asterixdb/asterix-client-helper/pom.xml +++ b/asterixdb/asterix-client-helper/pom.xml @@ -129,7 +129,6 @@ <configuration> <usedDependencies> <usedDependency>org.codehaus.mojo.appassembler:appassembler-booter</usedDependency> - <usedDependency>javax.servlet:javax.servlet-api</usedDependency> </usedDependencies> </configuration> </plugin> @@ -169,10 +168,6 @@ <artifactId>args4j</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> <groupId>org.codehaus.mojo.appassembler</groupId> <artifactId>appassembler-booter</artifactId> <version>1.10</version> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java index e0fcb06..197df25 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java @@ -22,13 +22,11 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; -import javax.servlet.http.HttpServletResponse; +import org.apache.asterix.clienthelper.Args; +import org.apache.commons.io.IOUtils; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.asterix.clienthelper.Args; -import org.apache.commons.io.IOUtils; -import com.fasterxml.jackson.databind.node.ObjectNode; public class GetClusterStateCommand extends RemoteCommand { @@ -48,7 +46,7 @@ public class GetClusterStateCommand extends RemoteCommand { // 0 = ACTIVE, 1 = DOWN, 2 = UNUSABLE, 3 = OTHER try { conn = openConnection(args.getClusterStatePath(), Method.GET); - if (conn.getResponseCode() == HttpServletResponse.SC_OK) { + if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { String result = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8.name()); ObjectMapper om = new ObjectMapper(); JsonNode json = om.readTree(result); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java index 688f4ad..8010b39 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java @@ -19,8 +19,7 @@ package org.apache.asterix.clienthelper.commands; import java.io.IOException; - -import javax.servlet.http.HttpServletResponse; +import java.net.HttpURLConnection; import org.apache.asterix.clienthelper.Args; @@ -46,7 +45,7 @@ public class ShutdownCommand extends RemoteCommand { int statusCode = tryPost(shutdownPath); // TODO (mblow): interrogate result to determine acceptance, not rely on HTTP 200 switch (statusCode) { - case HttpServletResponse.SC_ACCEPTED: + case HttpURLConnection.HTTP_ACCEPTED: clusterLog("accepted shutdown request."); return 0; case -1: http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java index dad9f8c..96193ce 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java @@ -23,13 +23,11 @@ import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; -import javax.servlet.http.HttpServletResponse; +import org.apache.asterix.clienthelper.Args; +import org.apache.commons.io.IOUtils; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.asterix.clienthelper.Args; -import org.apache.commons.io.IOUtils; -import com.fasterxml.jackson.databind.node.ObjectNode; public class WaitForClusterCommand extends RemoteCommand { @@ -41,9 +39,8 @@ public class WaitForClusterCommand extends RemoteCommand { @SuppressWarnings("squid:S2142") // interrupted exception public int execute() throws IOException { final int timeoutSecs = args.getTimeoutSecs(); - log("Waiting " - + (timeoutSecs > 0 ? "up to " + timeoutSecs + " seconds " : "") - + "for cluster " + hostPort + " to be available."); + log("Waiting " + (timeoutSecs > 0 ? "up to " + timeoutSecs + " seconds " : "") + "for cluster " + hostPort + + " to be available."); long startTime = System.currentTimeMillis(); long timeoutMillis = TimeUnit.SECONDS.toMillis(timeoutSecs); @@ -65,7 +62,7 @@ public class WaitForClusterCommand extends RemoteCommand { HttpURLConnection conn; try { conn = openConnection(args.getClusterStatePath(), Method.GET); - if (conn.getResponseCode() == HttpServletResponse.SC_OK) { + if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { String result = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8.name()); ObjectMapper om = new ObjectMapper(); JsonNode json = om.readTree(result); @@ -79,9 +76,8 @@ public class WaitForClusterCommand extends RemoteCommand { // ignore exception, try again } } - log("Cluster " + hostPort + " was not available before timeout of " + timeoutSecs - + " seconds was exhausted" + (lastState != null ? " (state: " + lastState + ")" : "") - + "; check logs for more information"); + log("Cluster " + hostPort + " was not available before timeout of " + timeoutSecs + " seconds was exhausted" + + (lastState != null ? " (state: " + lastState + ")" : "") + "; check logs for more information"); return 1; } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-common/pom.xml ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/pom.xml b/asterixdb/asterix-common/pom.xml index 731ac14..c2f1c6a 100644 --- a/asterixdb/asterix-common/pom.xml +++ b/asterixdb/asterix-common/pom.xml @@ -264,21 +264,6 @@ <artifactId>log4j</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-server</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlet</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.rometools</groupId> <artifactId>rome</artifactId> <version>1.5.1</version> @@ -300,6 +285,19 @@ <artifactId>guava</artifactId> </dependency> <dependency> + <groupId>org.apache.hyracks</groupId> + <artifactId>hyracks-data-std</artifactId> + </dependency> + <dependency> + <groupId>org.apache.hyracks</groupId> + <artifactId>hyracks-http</artifactId> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + <version>4.1.6.Final</version> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> @@ -308,10 +306,6 @@ <artifactId>jackson-core</artifactId> </dependency> <dependency> - <groupId>org.apache.hyracks</groupId> - <artifactId>hyracks-data-std</artifactId> - </dependency> - <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSFeedServlet.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSFeedServlet.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSFeedServlet.java index f025017..6d8e2f2 100644 --- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSFeedServlet.java +++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSFeedServlet.java @@ -24,10 +24,14 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ConcurrentMap; +import java.util.logging.Level; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import org.apache.asterix.common.config.GlobalConfig; +import org.apache.hyracks.http.api.IServletRequest; +import org.apache.hyracks.http.api.IServletResponse; +import org.apache.hyracks.http.server.AbstractServlet; +import org.apache.hyracks.http.server.util.ServletUtils; import com.rometools.rome.feed.synd.SyndContent; import com.rometools.rome.feed.synd.SyndContentImpl; @@ -38,9 +42,11 @@ import com.rometools.rome.feed.synd.SyndFeedImpl; import com.rometools.rome.io.FeedException; import com.rometools.rome.io.SyndFeedOutput; -public class RSSFeedServlet extends HttpServlet { +import io.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpResponseStatus; + +public class RSSFeedServlet extends AbstractServlet { - private static final long serialVersionUID = 1L; private static final String DEFAULT_FEED_TYPE = "default.feed.type"; private static final String FEED_TYPE = "type"; private static final String MIME_TYPE = "application/xml; charset=UTF-8"; @@ -49,30 +55,45 @@ public class RSSFeedServlet extends HttpServlet { private static final DateFormat DATE_PARSER = new SimpleDateFormat("yyyy-MM-dd"); private String defaultFeedType; - @Override - public void init() { - defaultFeedType = getServletConfig().getInitParameter(DEFAULT_FEED_TYPE); + public RSSFeedServlet(ConcurrentMap<String, Object> ctx, String[] paths) { + super(ctx, paths); + defaultFeedType = (String) ctx.get(DEFAULT_FEED_TYPE); defaultFeedType = (defaultFeedType != null) ? defaultFeedType : "atom_0.3"; } - @Override - public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { + protected void doGet(IServletRequest req, IServletResponse res) throws IOException { try { SyndFeed feed = getFeed(req); String feedType = req.getParameter(FEED_TYPE); feedType = (feedType != null) ? feedType : defaultFeedType; feed.setFeedType(feedType); - res.setContentType(MIME_TYPE); + ServletUtils.setContentType(res, MIME_TYPE); SyndFeedOutput output = new SyndFeedOutput(); - output.output(feed, res.getWriter()); + output.output(feed, res.writer()); } catch (FeedException | ParseException ex) { + GlobalConfig.ASTERIX_LOGGER.log(Level.WARNING, ex.getMessage(), ex); String msg = COULD_NOT_GENERATE_FEED_ERROR; - log(msg, ex); - res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); + res.writer().print(msg); + res.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); + } + } + + @Override + public void handle(IServletRequest req, IServletResponse res) { + if (req.getHttpRequest().method() == HttpMethod.GET) { + try { + doGet(req, res); + } catch (IOException e) { + // Servlet methods should not throw exceptions + // http://cwe.mitre.org/data/definitions/600.html + GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, e.getMessage(), e); + } + } else { + res.setStatus(HttpResponseStatus.METHOD_NOT_ALLOWED); } } - protected SyndFeed getFeed(HttpServletRequest req) throws IOException, FeedException, ParseException { + protected SyndFeed getFeed(IServletRequest req) throws IOException, FeedException, ParseException { SyndFeed feed = new SyndFeedImpl(); feed.setTitle("Sample Feed (created with ROME)"); feed.setLink("http://rome.dev.java.net"); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSTestServer.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSTestServer.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSTestServer.java index 5855e1e..f40999b 100644 --- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSTestServer.java +++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/server/RSSTestServer.java @@ -18,20 +18,18 @@ */ package org.apache.asterix.test.server; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; +import org.apache.hyracks.http.server.HttpServer; +import org.apache.hyracks.http.server.WebManager; public class RSSTestServer implements ITestServer { - private Server rssServer; + private WebManager webManager; public RSSTestServer(int port) { - rssServer = new Server(port); - ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); - context.setContextPath("/"); - rssServer.setHandler(context); - context.addServlet(new ServletHolder(new RSSFeedServlet()), "/"); + webManager = new WebManager(); + HttpServer rssServer = new HttpServer(webManager.getBosses(), webManager.getWorkers(), port); + rssServer.addLet(new RSSFeedServlet(null, new String[] { "/" })); + webManager.add(rssServer); } @Override @@ -40,13 +38,12 @@ public class RSSTestServer implements ITestServer { @Override public void start() throws Exception { - rssServer.start(); + webManager.start(); } @Override public void stop() throws Exception { - rssServer.stop(); - rssServer.join(); + webManager.stop(); } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/asterixdb/pom.xml ---------------------------------------------------------------------- diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml index 3133231..c684539 100644 --- a/asterixdb/pom.xml +++ b/asterixdb/pom.xml @@ -67,7 +67,6 @@ <algebricks.version>0.3.1-SNAPSHOT</algebricks.version> <hyracks.version>0.3.1-SNAPSHOT</hyracks.version> <hadoop.version>2.2.0</hadoop.version> - <jetty.version>9.3.11.v20160721</jetty.version> <jacoco.version>0.7.6.201602180812</jacoco.version> </properties> @@ -652,16 +651,6 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-server</artifactId> - <version>${jetty.version}</version> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlet</artifactId> - <version>${jetty.version}</version> - </dependency> - <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> @@ -966,11 +955,6 @@ <type>test-jar</type> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - </dependency> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml index 0b8d6fe..c960da9 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml @@ -77,14 +77,25 @@ <groupId>org.apache.hyracks</groupId> <artifactId>hyracks-control-common</artifactId> <version>${project.version}</version> - <type>jar</type> - <scope>compile</scope> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> </dependency> <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.1.0</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-http</artifactId> + </dependency> + <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket-core</artifactId> <version>1.5.2</version> @@ -96,26 +107,18 @@ </exclusions> </dependency> <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlet</artifactId> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-request</artifactId> + <version>1.5.2</version> </dependency> <dependency> <groupId>org.apache.wicket</groupId> - <artifactId>wicket-request</artifactId> + <artifactId>wicket-util</artifactId> <version>1.5.2</version> </dependency> <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-http</artifactId> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> </dependency> <dependency> <groupId>org.ini4j</groupId> @@ -128,11 +131,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket-util</artifactId> - <version>1.5.2</version> - </dependency> - <dependency> <groupId>args4j</groupId> <artifactId>args4j</artifactId> <version>2.0.12</version> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2343e1c1/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/WebManager.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/WebManager.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/WebManager.java new file mode 100644 index 0000000..235e1ea --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/WebManager.java @@ -0,0 +1,67 @@ +/* + * 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.hyracks.http.server; + +import java.util.ArrayList; +import java.util.List; + +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; + +public class WebManager { + private final List<HttpServer> servers; + private final EventLoopGroup bosses; + private final EventLoopGroup workers; + + public WebManager() { + servers = new ArrayList<>(); + bosses = new NioEventLoopGroup(1); + workers = new NioEventLoopGroup(); + } + + public List<HttpServer> getServers() { + return servers; + } + + public EventLoopGroup getBosses() { + return bosses; + } + + public EventLoopGroup getWorkers() { + return workers; + } + + public void start() throws Exception { + for (HttpServer server : servers) { + server.start(); + } + } + + public void stop() throws Exception { + for (HttpServer server : servers) { + server.stop(); + } + workers.shutdownGracefully().sync(); + bosses.shutdownGracefully().sync(); + } + + public void add(HttpServer server) { + servers.add(server); + } +}
