You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by cd...@apache.org on 2020/08/30 17:48:47 UTC
[incubator-iotdb] branch feature/classpath-config created (now
6bd28d4)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a change to branch feature/classpath-config
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.
at 6bd28d4 - Made it possible to load the config from the classpath
This branch includes the following new commits:
new 6bd28d4 - Made it possible to load the config from the classpath
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-iotdb] 01/01: - Made it possible to load the config from
the classpath
Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/classpath-config
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 6bd28d4c2e0125a29174c65afd230f812e8f6604
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Sun Aug 30 19:48:30 2020 +0200
- Made it possible to load the config from the classpath
---
pom.xml | 5 +++
.../org/apache/iotdb/db/conf/IoTDBDescriptor.java | 37 ++++++++++++++++++----
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8a97954..77d1255 100644
--- a/pom.xml
+++ b/pom.xml
@@ -256,6 +256,11 @@
<version>1.2.17</version>
</dependency>
<dependency>
+ <groupId>net.jpountz.lz4</groupId>
+ <artifactId>lz4</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 1ad30bd..8ca1773 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -19,10 +19,10 @@
package org.apache.iotdb.db.conf;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.time.ZoneId;
import java.util.Properties;
@@ -119,12 +119,23 @@ public class IoTDBDescriptor {
* load an property file and set TsfileDBConfig variables.
*/
private void loadProps() {
- String url = getPropsUrl();
- if (url == null) {
+ URL url;
+ try {
+ String propsUrl = getPropsUrl();
+ if(propsUrl == null) {
+ return;
+ }
+ // If the url doesn't contain a ":" it's provided as a normal path.
+ // So we need to add the prefix "file:" to make it a real URL.
+ if(!propsUrl.contains(":")) {
+ propsUrl = "file:" + propsUrl;
+ }
+ url = new URL(propsUrl);
+ } catch (MalformedURLException e) {
return;
}
- try (InputStream inputStream = new FileInputStream(new File(url))) {
+ try (InputStream inputStream = url.openStream()) {
logger.info("Start to read config file {}", url);
Properties properties = new Properties();
@@ -660,11 +671,23 @@ public class IoTDBDescriptor {
}
public void loadHotModifiedProps() throws QueryProcessException {
- String url = getPropsUrl();
- if (url == null) {
+ URL url;
+ try {
+ String propsUrl = getPropsUrl();
+ if(propsUrl == null) {
+ return;
+ }
+ // If the url doesn't contain a ":" it's provided as a normal path.
+ // So we need to add the prefix "file:" to make it a real URL.
+ if(!propsUrl.contains(":")) {
+ propsUrl = "file:" + propsUrl;
+ }
+ url = new URL(propsUrl);
+ } catch (MalformedURLException e) {
return;
}
- try (InputStream inputStream = new FileInputStream(new File(url))) {
+
+ try (InputStream inputStream = url.openStream()) {
logger.info("Start to reload config file {}", url);
Properties properties = new Properties();
properties.load(inputStream);