Michael Blow has submitted this change and it was merged. Change subject: [NO ISSUE] Load asterix-dashboard via service provider ......................................................................
[NO ISSUE] Load asterix-dashboard via service provider Change-Id: I0a5005cb8cfedf7ce2f59e76636f9dd21a0cc151 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2664 Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> --- M asterixdb/asterix-app/pom.xml M asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java A asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IQueryWebServerRegistrant.java A asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IServletRegistrant.java A asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/QueryWebServerRegistrant.java M asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServlet.java A asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServletRegistrant.java A asterixdb/asterix-dashboard/src/main/resources/META-INF/services/org.apache.asterix.api.http.IQueryWebServerRegistrant M asterixdb/asterix-server/pom.xml 9 files changed, 132 insertions(+), 8 deletions(-) Approvals: Anon. E. Moose #1000171: Till Westmann: Looks good to me, approved Jenkins: Verified; Verified Objections: Jenkins: Violations found diff --git a/asterixdb/asterix-app/pom.xml b/asterixdb/asterix-app/pom.xml index 020bc6c..f06b6d2 100644 --- a/asterixdb/asterix-app/pom.xml +++ b/asterixdb/asterix-app/pom.xml @@ -387,11 +387,6 @@ </dependency> <dependency> <groupId>org.apache.asterix</groupId> - <artifactId>asterix-dashboard</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.asterix</groupId> <artifactId>asterix-common</artifactId> <version>${project.version}</version> <type>test-jar</type> diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java index 699892e..7224526 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java @@ -29,8 +29,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.ServiceLoader; import java.util.concurrent.ConcurrentMap; +import org.apache.asterix.api.http.IQueryWebServerRegistrant; import org.apache.asterix.api.http.ctx.StatementExecutorContext; import org.apache.asterix.api.http.server.ActiveStatsApiServlet; import org.apache.asterix.api.http.server.ApiServlet; @@ -46,7 +48,6 @@ import org.apache.asterix.api.http.server.QueryResultApiServlet; import org.apache.asterix.api.http.server.QueryServiceServlet; import org.apache.asterix.api.http.server.QueryStatusApiServlet; -import org.apache.asterix.api.http.server.QueryWebInterfaceServlet; import org.apache.asterix.api.http.server.RebalanceApiServlet; import org.apache.asterix.api.http.server.ServletConstants; import org.apache.asterix.api.http.server.ShutdownApiServlet; @@ -272,7 +273,9 @@ HttpServer queryWebServer = new HttpServer(webManager.getBosses(), webManager.getWorkers(), externalProperties.getQueryWebInterfacePort()); queryWebServer.setAttribute(HYRACKS_CONNECTION_ATTR, hcc); - queryWebServer.addServlet(new QueryWebInterfaceServlet(appCtx, queryWebServer.ctx(), new String[] { "/*" })); + ServiceLoader.load(IQueryWebServerRegistrant.class).iterator() + .forEachRemaining(c -> c.register(appCtx, queryWebServer)); + return queryWebServer; } diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IQueryWebServerRegistrant.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IQueryWebServerRegistrant.java new file mode 100644 index 0000000..c05396a --- /dev/null +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IQueryWebServerRegistrant.java @@ -0,0 +1,22 @@ +/* + * 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.api.http; + +public interface IQueryWebServerRegistrant extends IServletRegistrant { +} diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IServletRegistrant.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IServletRegistrant.java new file mode 100644 index 0000000..f6f2b3e --- /dev/null +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/IServletRegistrant.java @@ -0,0 +1,26 @@ +/* + * 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.api.http; + +import org.apache.asterix.common.dataflow.ICcApplicationContext; +import org.apache.hyracks.http.server.HttpServer; + +public interface IServletRegistrant { + void register(ICcApplicationContext appCtx, HttpServer webServer); +} diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/QueryWebServerRegistrant.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/QueryWebServerRegistrant.java new file mode 100644 index 0000000..a33d6ce --- /dev/null +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/api/http/QueryWebServerRegistrant.java @@ -0,0 +1,22 @@ +/* + * 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.api.http; + +public interface QueryWebServerRegistrant extends IServletRegistrant { +} diff --git a/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServlet.java b/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServlet.java index 598d802..91b22e9 100644 --- a/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServlet.java +++ b/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServlet.java @@ -40,7 +40,7 @@ private static final Logger LOGGER = LogManager.getLogger(); private ICcApplicationContext appCtx; - public QueryWebInterfaceServlet(ICcApplicationContext appCtx, ConcurrentMap<String, Object> ctx, String[] paths) { + QueryWebInterfaceServlet(ICcApplicationContext appCtx, ConcurrentMap<String, Object> ctx, String... paths) { super(ctx, paths); this.appCtx = appCtx; } diff --git a/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServletRegistrant.java b/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServletRegistrant.java new file mode 100644 index 0000000..5cc462e --- /dev/null +++ b/asterixdb/asterix-dashboard/src/main/java/org/apache/asterix/api/http/server/QueryWebInterfaceServletRegistrant.java @@ -0,0 +1,31 @@ +/* + * 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.api.http.server; + +import org.apache.asterix.api.http.IQueryWebServerRegistrant; +import org.apache.asterix.common.dataflow.ICcApplicationContext; +import org.apache.hyracks.http.server.HttpServer; + +public class QueryWebInterfaceServletRegistrant implements IQueryWebServerRegistrant { + + @Override + public void register(ICcApplicationContext appCtx, HttpServer webServer) { + webServer.addServlet(new QueryWebInterfaceServlet(appCtx, webServer.ctx(), "/*")); + } +} diff --git a/asterixdb/asterix-dashboard/src/main/resources/META-INF/services/org.apache.asterix.api.http.IQueryWebServerRegistrant b/asterixdb/asterix-dashboard/src/main/resources/META-INF/services/org.apache.asterix.api.http.IQueryWebServerRegistrant new file mode 100644 index 0000000..7d23f78 --- /dev/null +++ b/asterixdb/asterix-dashboard/src/main/resources/META-INF/services/org.apache.asterix.api.http.IQueryWebServerRegistrant @@ -0,0 +1,19 @@ +# +# 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. +# +org.apache.asterix.api.http.server.QueryWebInterfaceServletRegistrant \ No newline at end of file diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml index d014d2b..71bd35e 100644 --- a/asterixdb/asterix-server/pom.xml +++ b/asterixdb/asterix-server/pom.xml @@ -402,6 +402,7 @@ <usedDependency>org.apache.asterix:asterix-external-data</usedDependency> <usedDependency>org.codehaus.mojo.appassembler:appassembler-booter</usedDependency> <usedDependency>org.apache.asterix:asterix-fuzzyjoin</usedDependency> + <usedDependency>org.apache.asterix:asterix-dashboard</usedDependency> </usedDependencies> </configuration> </plugin> @@ -655,5 +656,10 @@ <artifactId>hyracks-test-support</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.asterix</groupId> + <artifactId>asterix-dashboard</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> -- To view, visit https://asterix-gerrit.ics.uci.edu/2664 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0a5005cb8cfedf7ce2f59e76636f9dd21a0cc151 Gerrit-PatchSet: 6 Gerrit-Project: asterixdb Gerrit-Branch: release-0.9.4-pre-rc Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]>
