[
https://issues.apache.org/jira/browse/KNOX-2156?focusedWorklogId=361832&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-361832
]
ASF GitHub Bot logged work on KNOX-2156:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Dec/19 19:50
Start Date: 20/Dec/19 19:50
Worklog Time Spent: 10m
Work Description: risdenk commented on pull request #228: KNOX-2156 - CM
discovery - KUDUUI discovery
URL: https://github.com/apache/knox/pull/228#discussion_r360547979
##########
File path:
gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/kudu/KuduUIServiceModelGenerator.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.knox.gateway.topology.discovery.cm.model.kudu;
+
+import com.cloudera.api.swagger.client.ApiException;
+import com.cloudera.api.swagger.model.ApiConfigList;
+import com.cloudera.api.swagger.model.ApiRole;
+import com.cloudera.api.swagger.model.ApiService;
+import com.cloudera.api.swagger.model.ApiServiceConfig;
+import org.apache.knox.gateway.topology.discovery.cm.ServiceModel;
+import
org.apache.knox.gateway.topology.discovery.cm.model.AbstractServiceModelGenerator;
+
+import java.util.Locale;
+
+public class KuduUIServiceModelGenerator extends AbstractServiceModelGenerator
{
+
+ public static final String SERVICE = "KUDUUI";
+ public static final String SERVICE_TYPE = "KUDU";
+ public static final String ROLE_TYPE = "KUDU_MASTER";
+
+
+ @Override
+ public String getService() {
+ return SERVICE;
+ }
+
+ @Override
+ public String getServiceType() {
+ return SERVICE_TYPE;
+ }
+
+ @Override
+ public String getRoleType() {
+ return ROLE_TYPE;
+ }
+
+ @Override
+ public ServiceModel.Type getModelType() {
+ return ServiceModel.Type.UI;
+ }
+
+ @Override
+ public ServiceModel generateService(ApiService service, ApiServiceConfig
serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
+ String hostname = role.getHostRef().getHostname();
+
+ boolean sslEnabled = Boolean.parseBoolean(getRoleConfigValue(roleConfig,
"ssl_enabled"));
+ String scheme = sslEnabled ? "https" : "http";
+
+ String port = getRoleConfigValue(roleConfig, "webserver_port");
+ return createServiceModel(String.format(Locale.getDefault(),
"%s://%s:%s/", scheme, hostname, port));
Review comment:
I'm not sure if this is in others and I missed it. I think `Locale.ROOT` is
probably better here. I don't think we need to use localization for any of the
parameters here. We should just plop in as is.
Note 99% sure we won't easily run into this since there are only a few
locales where there is a differences.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 361832)
Time Spent: 20m (was: 10m)
> CM discovery - KUDUUI discovery
> -------------------------------
>
> Key: KNOX-2156
> URL: https://issues.apache.org/jira/browse/KNOX-2156
> Project: Apache Knox
> Issue Type: Sub-task
> Components: Server
> Affects Versions: 1.3.0
> Reporter: Philip Zampino
> Assignee: Philip Zampino
> Priority: Major
> Fix For: 1.4.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Apache Kudu UI URL(s) should be discovered from ClouderaManager-managed
> clusters.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)