diff --git a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html
index 69b54692fb..810abd22e1 100644
--- a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html
+++ b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html
@@ -32,7 +32,7 @@
-
Unable to connect to selected data source.
+
{{databaseConnectionErrorMessage}}
diff --git a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts
index bf67bd7349..93504e417c 100644
--- a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts
+++ b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts
@@ -87,6 +87,8 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
*/
databaseConnectionError = false;
+ databaseConnectionErrorMessage: string;
+
dbConnectionProperty: any;
deleteSourceProperty: any;
@@ -232,12 +234,12 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
const hintSuffix = ". ** indicates an existing catalog data source";
if(this.dbConnectionProperty) {
let desc = this.dbConnectionProperty.propertyDescriptor.origDescription || this.dbConnectionProperty.propertyDescriptor.description;
- if (!this.processor.form.disabled) {
+ if (desc != undefined && !this.processor.form.disabled) {
if(desc.indexOf(hintSuffix) == -1){
this.dbConnectionProperty.propertyDescriptor.origDescription = desc;
this.dbConnectionProperty.propertyDescriptor.description = desc+hintSuffix;
}
- } else {
+ } else if(desc != undefined){
this.dbConnectionProperty.propertyDescriptor.description = desc;
}
}
@@ -464,7 +466,11 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
}
}
+ console.log("get ",this.tableSchemaService.LIST_TABLES_URL(this.dbConnectionProperty.value), 'with ',httpOptions.params)
return this.http.get(this.tableSchemaService.LIST_TABLES_URL(this.dbConnectionProperty.value), httpOptions).pipe(
+ catchError((error: any) => {
+ return Observable.throw(error);
+ }),
map((data: any) => {
if (Array.isArray(data)) {
return data;
@@ -481,6 +487,15 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
}),
catchError((error: any) => {
this.databaseConnectionError = true;
+ if(error && error.error && error.error.message){
+ this.databaseConnectionErrorMessage = error.error.message;
+ }
+ else if(error && error.message ){
+ this.databaseConnectionErrorMessage = error.message;
+ }
+ else {
+ this.databaseConnectionErrorMessage = "Unable to connecto to data source";
+ }
throw error;
})
);
@@ -540,8 +555,9 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
this.tableSchema = response;
this.tableFields = this.tableSchema.fields;
this.filteredFieldDates = this.tableFields.filter(this.filterFieldDates);
- }, () => {
+ }, (error:any) => {
this.databaseConnectionError = true;
+ console.error("error",error)
});
}
}
diff --git a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/DBCPConnectionPoolService.java b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/DBCPConnectionPoolService.java
index 4f0c0c7d6c..f91918c46d 100644
--- a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/DBCPConnectionPoolService.java
+++ b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/DBCPConnectionPoolService.java
@@ -272,7 +272,6 @@ public QueryResult executeQueryForDatasource(@Nonnull final JdbcDatasource datas
* Executes the specified SELECT query in the context of the specified data source.
*
* @param datasource the JDBC datasource
- * @param query the query to execute
* @return the query results
* @throws DataAccessException if the query cannot be executed
* @throws IllegalArgumentException if the datasource is invalid
@@ -492,7 +491,7 @@ private List getTableNamesForControllerService(DescribeTableControllerSe
return null;
}
- private boolean evaluateWithUserDefinedDatasources(PoolingDataSourceService.DataSourceProperties dataSourceProperties, AbstractControllerServiceRequest serviceProperties) {
+ private boolean evaluateWithUserDefinedDatasources(PoolingDataSourceService.DataSourceProperties dataSourceProperties, AbstractControllerServiceRequest serviceProperties) throws InvalidControllerServiceLookupException {
boolean valid = !isMasked(dataSourceProperties.getPassword());
if (!valid) {
List matchingDatasources = metadataAccess.read(() -> {
@@ -523,6 +522,8 @@ private boolean evaluateWithUserDefinedDatasources(PoolingDataSourceService.Data
String example = propertyKey + "=PASSWORD";
log.error("Unable to connect to Controller Service {}, {}. You need to specify a configuration property as {} with the password for user: {}. ",
serviceProperties.getControllerServiceName(), serviceProperties.getControllerServiceId(), example, dataSourceProperties.getUser());
+
+ throw new InvalidControllerServiceLookupException("Unable to connect to Controller Service "+serviceProperties.getControllerServiceName()+". Please ensure Kylo has a configuration property matching ["+example+"] to connect to this source ");
}
}
return valid;
@@ -569,7 +570,7 @@ public PoolingDataSourceService.DataSourceProperties parseControllerService(Cont
}
- private TableSchema describeTableForControllerService(DescribeTableControllerServiceRequest serviceProperties) {
+ private TableSchema describeTableForControllerService(DescribeTableControllerServiceRequest serviceProperties) throws InvalidControllerServiceLookupException {
String type = serviceProperties.getControllerServiceType();
if (serviceProperties.getControllerServiceType() != null && serviceProperties.getControllerServiceType().equalsIgnoreCase(type)) {
@@ -586,8 +587,6 @@ private TableSchema describeTableForControllerService(DescribeTableControllerSer
DataSource dataSource = PoolingDataSourceService.getDataSource(dataSourceProperties);
DBSchemaParser schemaParser = new DBSchemaParser(dataSource, kerberosHiveConfiguration);
return schemaParser.describeTable(serviceProperties.getSchemaName(), serviceProperties.getTableName());
- } else {
- return null;
}
}
return null;
diff --git a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/InvalidControllerServiceLookupException.java b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/InvalidControllerServiceLookupException.java
new file mode 100644
index 0000000000..ccccaf28e7
--- /dev/null
+++ b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/nifi/controllerservice/InvalidControllerServiceLookupException.java
@@ -0,0 +1,32 @@
+package com.thinkbiganalytics.feedmgr.nifi.controllerservice;
+
+/*-
+ * #%L
+ * kylo-feed-manager-controller
+ * %%
+ * Copyright (C) 2017 ThinkBig Analytics
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+public class InvalidControllerServiceLookupException extends RuntimeException {
+
+ public InvalidControllerServiceLookupException() {
+ super();
+ }
+
+ public InvalidControllerServiceLookupException(String message) {
+ super(message);
+ }
+}
diff --git a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java
index c2307ba4f3..8ba9033486 100644
--- a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java
+++ b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java
@@ -28,6 +28,7 @@
import com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver;
import com.thinkbiganalytics.feedmgr.nifi.TemplateConnectionUtil;
import com.thinkbiganalytics.feedmgr.nifi.controllerservice.DBCPConnectionPoolService;
+import com.thinkbiganalytics.feedmgr.nifi.controllerservice.InvalidControllerServiceLookupException;
import com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl;
import com.thinkbiganalytics.feedmgr.service.datasource.DatasourceService;
import com.thinkbiganalytics.feedmgr.service.template.FeedManagerTemplateService;
@@ -461,13 +462,18 @@ public Response getTableNames(@PathParam("serviceId") String serviceId, @QueryPa
log.info("Query for Table Names against data source: {}", dataSource.get().getId());
try {
tables = catalogTableManager.getTableNames(dataSource.get(), schema, tableName);
- } catch (final SQLException e) {
+ } catch (final SQLException | InvalidControllerServiceLookupException e) {
log.error("Unable to list table names for data source: {}", dataSource.get().getId(), e);
- throw new InternalServerErrorException("Unable to connect to data source. " + e.getMessage(), e);
+ throw new InternalServerErrorException(e.getMessage(), e);
}
} else {
log.info("Query for Table Names against service: {}({})", serviceName, serviceId);
+ try {
tables = dbcpConnectionPoolTableInfo.getTableNamesForControllerService(serviceId, serviceName, schema, tableName);
+ } catch (final InvalidControllerServiceLookupException e) {
+ log.error("Unable to list table names for controller service: {}", serviceName, e);
+ throw new InternalServerErrorException(e.getMessage(), e);
+ }
}
return Response.ok(tables).build();