Classification properties (#12764)

This commit is contained in:
YuFengLiu 2024-06-21 18:13:09 +08:00 committed by GitHub
parent bce9631e10
commit 7ee30fb631
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 1910 additions and 2081 deletions

View File

@ -57,15 +57,6 @@
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf</directory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/iotdb-system.properties</exclude>
</excludes>
</fileSet>
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf</directory>
</fileSet>
<fileSet>
<outputDirectory>sbin</outputDirectory>

View File

@ -54,15 +54,6 @@
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf</directory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/iotdb-system.properties</exclude>
</excludes>
</fileSet>
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf</directory>
</fileSet>
<!-- <fileSet>-->
<!-- <directory>${maven.multiModuleProjectDirectory}/confignode/src/assembly/resources/tools</directory>-->

View File

@ -45,15 +45,6 @@
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf</directory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/iotdb-system.properties</exclude>
</excludes>
</fileSet>
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf</directory>
</fileSet>
<fileSet>
<outputDirectory>sbin</outputDirectory>

View File

@ -188,7 +188,7 @@
<resource>
<directory>${project.basedir}/src/assembly/resources/conf</directory>
<includes>
<include>iotdb-system.properties</include>
<include>iotdb-system.properties.template</include>
</includes>
<filtering>false</filtering>
</resource>
@ -349,72 +349,5 @@
</plugins>
</build>
</profile>
<profile>
<id>generate-properties-unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Unix execution -->
<execution>
<id>generate-config-unix</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sh</executable>
<arguments>
<argument>${project.basedir}/src/assembly/resources/conf/generate_properties.sh</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>generate-properties-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Windows execution -->
<execution>
<id>generate-properties-windows</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>cmd</executable>
<arguments>
<argument>/c</argument>
<argument>${project.basedir}\src\assembly\resources\conf\generate_properties.bat</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,65 +0,0 @@
@REM
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM
@echo off
setlocal enabledelayedexpansion
set "source_file=src\assembly\resources\conf\iotdb-system.properties"
set "target_template_file=target\conf\iotdb-system.properties.template"
set "target_properties_file=target\conf\iotdb-system.properties"
if exist "%target_template_file%" (
del "%target_template_file%"
)
if exist "%target_properties_file%" (
del "%target_properties_file%"
)
mkdir "%target_template_file%\.."
copy "%source_file%" "%target_template_file%"
echo # >> "%target_properties_file%"
echo # Licensed to the Apache Software Foundation (ASF) under one >> "%target_properties_file%"
echo # or more contributor license agreements. See the NOTICE file >> "%target_properties_file%"
echo # distributed with this work for additional information >> "%target_properties_file%"
echo # regarding copyright ownership. The ASF licenses this file >> "%target_properties_file%"
echo # to you under the Apache License, Version 2.0 (the >> "%target_properties_file%"
echo # "License"); you may not use this file except in compliance >> "%target_properties_file%"
echo # with the License. You may obtain a copy of the License at >> "%target_properties_file%"
echo # >> "%target_properties_file%"
echo # http://www.apache.org/licenses/LICENSE-2.0 >> "%target_properties_file%"
echo # >> "%target_properties_file%"
echo # Unless required by applicable law or agreed to in writing, >> "%target_properties_file%"
echo # software distributed under the License is distributed on an >> "%target_properties_file%"
echo # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> "%target_properties_file%"
echo # KIND, either express or implied. See the License for the >> "%target_properties_file%"
echo # specific language governing permissions and limitations >> "%target_properties_file%"
echo # under the License. >> "%target_properties_file%"
echo # >> "%target_properties_file%"
for /f "usebackq tokens=*" %%i in ("%target_template_file%") do (
set "line=%%i"
setlocal enabledelayedexpansion
if not "!line!"=="" if "!line:~0,1!" NEQ "#" (
echo !line!>>"%target_properties_file%"
)
endlocal
)
powershell -Command "(Get-Content '%target_properties_file%') -join \"`n\" | Set-Content -NoNewline '%target_properties_file%'"

View File

@ -1,59 +0,0 @@
#!/bin/bash
#
# 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.
#
source_file="src/assembly/resources/conf/iotdb-system.properties"
target_template_file="target/conf/iotdb-system.properties.template"
target_properties_file="target/conf/iotdb-system.properties"
if [ -f "$target_template_file" ]; then
rm "$target_template_file"
fi
if [ -f "$target_properties_file" ]; then
rm "$target_properties_file"
fi
mkdir -p "$(dirname "$target_template_file")"
cp "$source_file" "$target_template_file"
# Add license header to the target properties file
cat <<EOL > "$target_properties_file"
#
# 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.
#
EOL
grep -v '^\s*#' "$target_template_file" | grep -v '^\s*$' >> "$target_properties_file"

View File

@ -41,6 +41,7 @@ public class CommonConfig {
public static final String OLD_DATA_NODE_CONFIG_NAME = "iotdb-datanode.properties";
public static final String OLD_COMMON_CONFIG_NAME = "iotdb-common.properties";
public static final String SYSTEM_CONFIG_NAME = "iotdb-system.properties";
public static final String SYSTEM_CONFIG_TEMPLATE_NAME = "iotdb-system.properties.template";
private static final Logger logger = LoggerFactory.getLogger(CommonConfig.class);
// Open ID Secret

View File

@ -160,7 +160,7 @@ public class ConfigurationFileUtils {
try (InputStream inputStream =
ConfigurationFileUtils.class
.getClassLoader()
.getResourceAsStream(CommonConfig.SYSTEM_CONFIG_NAME);
.getResourceAsStream(CommonConfig.SYSTEM_CONFIG_TEMPLATE_NAME);
InputStreamReader isr = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(isr)) {
String line;