[GitHub] [zeppelin] alexott commented on issue #3473: [ZEPPELIN-4360] Always use Scala 2.11 for Ignite
alexott commented on issue #3473: [ZEPPELIN-4360] Always use Scala 2.11 for Ignite URL: https://github.com/apache/zeppelin/pull/3473#issuecomment-543024791 https://travis-ci.org/alexott/zeppelin/builds/595481396 - it's failing in PythonDocker code 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] alexott commented on issue #3483: [ZEPPELIN-4377] Interpreter doesn't start if name has space
alexott commented on issue #3483: [ZEPPELIN-4377] Interpreter doesn't start if name has space URL: https://github.com/apache/zeppelin/pull/3483#issuecomment-543024537 https://travis-ci.org/alexott/zeppelin/builds/597228348 - please notice that it's failing in other's code. I can of course rebase, but we need to make sure that Docker launcher is fixed. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] zjffdu commented on a change in pull request #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ
zjffdu commented on a change in pull request #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ URL: https://github.com/apache/zeppelin/pull/3480#discussion_r335782416 ## File path: sparql/src/main/java/org/apache/zeppelin/fuseki/SparqlInterpreter.java ## @@ -0,0 +1,163 @@ +/* + * 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.zeppelin.sparql; + +import org.apache.commons.lang3.StringUtils; + +import org.apache.http.HttpStatus; + +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QueryFactory; +import org.apache.jena.query.QueryParseException; +import org.apache.jena.query.ResultSet; +import org.apache.jena.query.ResultSetFormatter; +import org.apache.jena.shared.PrefixMapping; +import org.apache.jena.sparql.engine.http.QueryExceptionHTTP; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayOutputStream; +import java.util.Map; +import java.util.Properties; + +import org.apache.zeppelin.interpreter.Interpreter; +import org.apache.zeppelin.interpreter.InterpreterContext; +import org.apache.zeppelin.interpreter.InterpreterResult; + + +/** + * Interpreter for SPARQL-Query via Apache Jena ARQ. + */ +public class SparqlInterpreter extends Interpreter { + private static final Logger LOGGER = LoggerFactory.getLogger(SparqlInterpreter.class); + + public static final String SPARQL_SERVICE_ENDPOINT = "sparql.endpoint"; + public static final String SPARQL_REPLACE_URIS = "sparql.replaceURIs"; + public static final String SPARQL_REMOVE_DATATYPES = "sparql.removeDatatypes"; + + public SparqlInterpreter(Properties properties) { +super(properties); + } + + @Override + public void open() { +LOGGER.info("Properties: {}", getProperties()); + } + + @Override + public void close() { + } + + @Override + public InterpreterResult interpret(String queryString, InterpreterContext context) { +final String serviceEndpoint = getProperty(SPARQL_SERVICE_ENDPOINT); +final String replaceURIs = getProperty(SPARQL_REPLACE_URIS); +final String removeDatatypes = getProperty(SPARQL_REMOVE_DATATYPES); + +LOGGER.info("SPARQL: Run Query '" + queryString + "' against " + serviceEndpoint); + +if (StringUtils.isEmpty(queryString) || StringUtils.isEmpty(queryString.trim())) { + return new InterpreterResult(InterpreterResult.Code.SUCCESS); +} + +Query query = null; +PrefixMapping prefixMapping = null; +try { + query = QueryFactory.create(queryString); + prefixMapping = query.getPrologue().getPrefixMapping(); +} catch (QueryParseException e) { + LOGGER.error(e.toString()); + return new InterpreterResult( +InterpreterResult.Code.ERROR, +"Error: " + e.getMessage()); +} + +try (QueryExecution qe = + QueryExecutionFactory.sparqlService(serviceEndpoint, query)) { + // execute query and get Results + ResultSet results = qe.execSelect(); + + // transform ResultSet to TSV-String + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ResultSetFormatter.outputAsTSV(outputStream, results); + String tsv = new String(outputStream.toByteArray()); + + if (replaceURIs != null && replaceURIs.equals("true")) { +LOGGER.info("SPARQL: Replacing URIs"); +tsv = replaceURIs(tsv, prefixMapping); + } + + if (removeDatatypes != null && removeDatatypes.equals("true")) { +LOGGER.info("SPARQL: Removing datatypes"); +tsv = removeDatatypes(tsv); + } + + return new InterpreterResult( + InterpreterResult.Code.SUCCESS, + InterpreterResult.Type.TABLE, + tsv); +} catch (QueryExceptionHTTP e) { + LOGGER.error(e.toString()); + int responseCode = e.getResponseCode(); + + if (responseCode == HttpStatus.SC_UNAUTHORIZED) { +return new InterpreterResult( + InterpreterResult.Code.ERROR, +"Unauthorized."); + } else if (responseCode == HttpStatus.SC_NOT_FOUND) { +return new InterpreterResult( + InterpreterResult
[GitHub] [zeppelin] zjffdu commented on a change in pull request #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ
zjffdu commented on a change in pull request #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ URL: https://github.com/apache/zeppelin/pull/3480#discussion_r335782244 ## File path: sparql/src/main/java/org/apache/zeppelin/fuseki/SparqlInterpreter.java ## @@ -0,0 +1,163 @@ +/* + * 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.zeppelin.sparql; + +import org.apache.commons.lang3.StringUtils; + +import org.apache.http.HttpStatus; + +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QueryFactory; +import org.apache.jena.query.QueryParseException; +import org.apache.jena.query.ResultSet; +import org.apache.jena.query.ResultSetFormatter; +import org.apache.jena.shared.PrefixMapping; +import org.apache.jena.sparql.engine.http.QueryExceptionHTTP; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayOutputStream; +import java.util.Map; +import java.util.Properties; + +import org.apache.zeppelin.interpreter.Interpreter; +import org.apache.zeppelin.interpreter.InterpreterContext; +import org.apache.zeppelin.interpreter.InterpreterResult; + + +/** + * Interpreter for SPARQL-Query via Apache Jena ARQ. + */ +public class SparqlInterpreter extends Interpreter { + private static final Logger LOGGER = LoggerFactory.getLogger(SparqlInterpreter.class); + + public static final String SPARQL_SERVICE_ENDPOINT = "sparql.endpoint"; + public static final String SPARQL_REPLACE_URIS = "sparql.replaceURIs"; + public static final String SPARQL_REMOVE_DATATYPES = "sparql.removeDatatypes"; + + public SparqlInterpreter(Properties properties) { +super(properties); + } + + @Override + public void open() { +LOGGER.info("Properties: {}", getProperties()); + } + + @Override + public void close() { + } + + @Override + public InterpreterResult interpret(String queryString, InterpreterContext context) { +final String serviceEndpoint = getProperty(SPARQL_SERVICE_ENDPOINT); +final String replaceURIs = getProperty(SPARQL_REPLACE_URIS); +final String removeDatatypes = getProperty(SPARQL_REMOVE_DATATYPES); Review comment: These variables should be initialized in `open` method 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] zjffdu commented on a change in pull request #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ
zjffdu commented on a change in pull request #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ URL: https://github.com/apache/zeppelin/pull/3480#discussion_r335782244 ## File path: sparql/src/main/java/org/apache/zeppelin/fuseki/SparqlInterpreter.java ## @@ -0,0 +1,163 @@ +/* + * 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.zeppelin.sparql; + +import org.apache.commons.lang3.StringUtils; + +import org.apache.http.HttpStatus; + +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QueryFactory; +import org.apache.jena.query.QueryParseException; +import org.apache.jena.query.ResultSet; +import org.apache.jena.query.ResultSetFormatter; +import org.apache.jena.shared.PrefixMapping; +import org.apache.jena.sparql.engine.http.QueryExceptionHTTP; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayOutputStream; +import java.util.Map; +import java.util.Properties; + +import org.apache.zeppelin.interpreter.Interpreter; +import org.apache.zeppelin.interpreter.InterpreterContext; +import org.apache.zeppelin.interpreter.InterpreterResult; + + +/** + * Interpreter for SPARQL-Query via Apache Jena ARQ. + */ +public class SparqlInterpreter extends Interpreter { + private static final Logger LOGGER = LoggerFactory.getLogger(SparqlInterpreter.class); + + public static final String SPARQL_SERVICE_ENDPOINT = "sparql.endpoint"; + public static final String SPARQL_REPLACE_URIS = "sparql.replaceURIs"; + public static final String SPARQL_REMOVE_DATATYPES = "sparql.removeDatatypes"; + + public SparqlInterpreter(Properties properties) { +super(properties); + } + + @Override + public void open() { +LOGGER.info("Properties: {}", getProperties()); + } + + @Override + public void close() { + } + + @Override + public InterpreterResult interpret(String queryString, InterpreterContext context) { +final String serviceEndpoint = getProperty(SPARQL_SERVICE_ENDPOINT); +final String replaceURIs = getProperty(SPARQL_REPLACE_URIS); +final String removeDatatypes = getProperty(SPARQL_REMOVE_DATATYPES); Review comment: These variables should be initialized in open method 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] zjffdu commented on issue #3416: [ZEPPELIN-1070]: Inject Credentials in any Interpreter-Code - Master
zjffdu commented on issue #3416: [ZEPPELIN-1070]: Inject Credentials in any Interpreter-Code - Master URL: https://github.com/apache/zeppelin/pull/3416#issuecomment-542963753 @jpmcmu sorry for response, Could you paste the travis build link here ? Need to make sure CI pass before merging. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] zjffdu commented on issue #3473: [ZEPPELIN-4360] Always use Scala 2.11 for Ignite
zjffdu commented on issue #3473: [ZEPPELIN-4360] Always use Scala 2.11 for Ignite URL: https://github.com/apache/zeppelin/pull/3473#issuecomment-542963375 @alexott Could you paste the travis build link here ? Need to make sure CI pass before merging. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] zjffdu commented on issue #3466: [Zeppelin-4341] fix role setting when using multiple realms
zjffdu commented on issue #3466: [Zeppelin-4341] fix role setting when using multiple realms URL: https://github.com/apache/zeppelin/pull/3466#issuecomment-542963314 @primerano Could you paste the travis build link here ? Need to make sure CI pass before merging. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] zjffdu commented on issue #3483: [ZEPPELIN-4377] Interpreter doesn't start if name has space
zjffdu commented on issue #3483: [ZEPPELIN-4377] Interpreter doesn't start if name has space URL: https://github.com/apache/zeppelin/pull/3483#issuecomment-542962959 @alexott Could you paste the travis build link here ? Need to make sure CI pass before merging. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] malayhm commented on a change in pull request #3487: ZEPPELIN-4376, ZEPPELIN-4379 Zeppelin Web Vue - Design as per Mocks and Recycle Bin
malayhm commented on a change in pull request #3487: ZEPPELIN-4376, ZEPPELIN-4379 Zeppelin Web Vue - Design as per Mocks and Recycle Bin URL: https://github.com/apache/zeppelin/pull/3487#discussion_r335700645 ## File path: zeppelin-web-vue/src/components/Notebook/Controls.vue ## @@ -52,52 +56,73 @@ -Delete +Move to Recycle Bin Review comment: Renamed Recycle Bin to Trash. 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: us...@infra.apache.org With regards, Apache Git Services
[jira] [Created] (ZEPPELIN-4385) Move CI to Github Action from Jenkins + Travis
Lee Moon Soo created ZEPPELIN-4385: -- Summary: Move CI to Github Action from Jenkins + Travis Key: ZEPPELIN-4385 URL: https://issues.apache.org/jira/browse/ZEPPELIN-4385 Project: Zeppelin Issue Type: Task Reporter: Lee Moon Soo Currently, when a new pull request is created, 1. Individual contributor's travis integration build branch 2. Jenkins (managed by ASF infra) triggered and check individual contributor's travis build status 3. Pull request build status is displayed based on Jenkins's check result There was two reasons why Zeppelin project uses Jenkins + Individual contributor's travis integration. * Travis build slots in ASF organization is limited and couldn't get enough slot to build pullrequest and often PR waits more than 12h to be scheduled * Restarting individual flaky tests is not possible. while individual contributor doesn't have permission to access ASF's travis integration. Therefore, Flaky test fail require full test matrix restart and that was quite painful. While full test matrix run again produce other flaky test fails. However, Jenkins now only triggered by pullrequest from comitters. https://issues.apache.org/jira/browse/INFRA-19249 Lack of integration test on pull requests really make collative development difficult, in the community. Recently, Github added CI functionality through [Github Actions.|https://github.com/features/actions] I think we need to consider this. Reasons are - Can build all pull requests - Non shared build slots (Build slot is not shared with other ASF project, unlike Travis) - Individual contributor also able to run CI build their branch before making PR -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [zeppelin] bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo
bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo URL: https://github.com/apache/zeppelin/pull/3488#discussion_r335319441 ## File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroValidationService.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.zeppelin.service; + +import org.apache.shiro.UnavailableSecurityManagerException; +import org.apache.shiro.realm.Realm; +import org.apache.shiro.realm.text.IniRealm; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import java.util.*; + +/** + * ShiroValidationService to validate shiro config + */ +public class ShiroValidationService { + + private final Logger LOGGER = LoggerFactory.getLogger(ShiroValidationService.class); + + private final ZeppelinConfiguration conf; + + @Inject + public ShiroValidationService(ZeppelinConfiguration conf) throws Exception { +LOGGER.info("ShiroValidationService is initialized"); +this.conf = conf; +if (conf.getShiroPath().length() > 0) { + try { +Collection realms = +((DefaultWebSecurityManager) org.apache.shiro.SecurityUtils.getSecurityManager()) +.getRealms(); +if (realms != null && realms.size() > 1) { Review comment: When realms are null than application should not start. also added retry logic when "UnavailableSecurityManagerException" is thrown. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] prabhjyotsingh commented on a change in pull request #3487: ZEPPELIN-4376, ZEPPELIN-4379 Zeppelin Web Vue - Design as per Mocks and Recycle Bin
prabhjyotsingh commented on a change in pull request #3487: ZEPPELIN-4376, ZEPPELIN-4379 Zeppelin Web Vue - Design as per Mocks and Recycle Bin URL: https://github.com/apache/zeppelin/pull/3487#discussion_r335343388 ## File path: zeppelin-web-vue/src/components/Notebook/Controls.vue ## @@ -52,52 +56,73 @@ -Delete +Move to Recycle Bin Review comment: `Recycle Bin` is very windows specific, should we call it trash? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo
bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo URL: https://github.com/apache/zeppelin/pull/3488#discussion_r335319441 ## File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroValidationService.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.zeppelin.service; + +import org.apache.shiro.UnavailableSecurityManagerException; +import org.apache.shiro.realm.Realm; +import org.apache.shiro.realm.text.IniRealm; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import java.util.*; + +/** + * ShiroValidationService to validate shiro config + */ +public class ShiroValidationService { + + private final Logger LOGGER = LoggerFactory.getLogger(ShiroValidationService.class); + + private final ZeppelinConfiguration conf; + + @Inject + public ShiroValidationService(ZeppelinConfiguration conf) throws Exception { +LOGGER.info("ShiroValidationService is initialized"); +this.conf = conf; +if (conf.getShiroPath().length() > 0) { + try { +Collection realms = +((DefaultWebSecurityManager) org.apache.shiro.SecurityUtils.getSecurityManager()) +.getRealms(); +if (realms != null && realms.size() > 1) { Review comment: When SecurityManager is not accessible then it will be null and yes application will start by logging the error message, but sometimes only SecurityManager is not accessible so planning to add 3sec delay so it will be always accessible or by adding retry(2-3 time) logic. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo
bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo URL: https://github.com/apache/zeppelin/pull/3488#discussion_r335319441 ## File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroValidationService.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.zeppelin.service; + +import org.apache.shiro.UnavailableSecurityManagerException; +import org.apache.shiro.realm.Realm; +import org.apache.shiro.realm.text.IniRealm; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import java.util.*; + +/** + * ShiroValidationService to validate shiro config + */ +public class ShiroValidationService { + + private final Logger LOGGER = LoggerFactory.getLogger(ShiroValidationService.class); + + private final ZeppelinConfiguration conf; + + @Inject + public ShiroValidationService(ZeppelinConfiguration conf) throws Exception { +LOGGER.info("ShiroValidationService is initialized"); +this.conf = conf; +if (conf.getShiroPath().length() > 0) { + try { +Collection realms = +((DefaultWebSecurityManager) org.apache.shiro.SecurityUtils.getSecurityManager()) +.getRealms(); +if (realms != null && realms.size() > 1) { Review comment: When SecurityManager is not accessible then it will be null and yes application will start by logging the error message, but sometimes only it is SecurityManager is not accessible so planning to add 3sec delay so it will be always accessible or by adding retry(2-3 time) logic. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zeppelin] bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo
bhavikpatel9977 commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin should stop/die/etc when can't create/access notebook repo URL: https://github.com/apache/zeppelin/pull/3488#discussion_r335319441 ## File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroValidationService.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.zeppelin.service; + +import org.apache.shiro.UnavailableSecurityManagerException; +import org.apache.shiro.realm.Realm; +import org.apache.shiro.realm.text.IniRealm; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import java.util.*; + +/** + * ShiroValidationService to validate shiro config + */ +public class ShiroValidationService { + + private final Logger LOGGER = LoggerFactory.getLogger(ShiroValidationService.class); + + private final ZeppelinConfiguration conf; + + @Inject + public ShiroValidationService(ZeppelinConfiguration conf) throws Exception { +LOGGER.info("ShiroValidationService is initialized"); +this.conf = conf; +if (conf.getShiroPath().length() > 0) { + try { +Collection realms = +((DefaultWebSecurityManager) org.apache.shiro.SecurityUtils.getSecurityManager()) +.getRealms(); +if (realms != null && realms.size() > 1) { Review comment: When SecurityManager is not accessible then it will be null and yes application will start by logging the error message. 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: us...@infra.apache.org With regards, Apache Git Services