Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. rename ConfigurationPrinter.printConfiguration() to ConfigurationL…
…ogger.log() 2. move configuration log statement from XXXRule to XXXDataBase for JDBC 3. move configuration log statement from XXXRule to Bootstrap and XXXSchema's renew() for Proxy
- Loading branch information
Showing
31 changed files
with
396 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
...ng-core-common/src/main/java/org/apache/shardingsphere/core/util/ConfigurationLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
* 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.shardingsphere.core.util; | ||
|
||
import java.util.Properties; | ||
|
||
import org.apache.shardingsphere.api.config.RuleConfiguration; | ||
import org.apache.shardingsphere.api.config.encryptor.EncryptRuleConfiguration; | ||
import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration; | ||
import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration; | ||
import org.apache.shardingsphere.core.rule.Authentication; | ||
import org.apache.shardingsphere.core.yaml.engine.YamlEngine; | ||
import org.apache.shardingsphere.core.yaml.swapper.impl.AuthenticationYamlSwapper; | ||
import org.apache.shardingsphere.core.yaml.swapper.impl.EncryptRuleConfigurationYamlSwapper; | ||
import org.apache.shardingsphere.core.yaml.swapper.impl.MasterSlaveRuleConfigurationYamlSwapper; | ||
import org.apache.shardingsphere.core.yaml.swapper.impl.ShardingRuleConfigurationYamlSwapper; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* Configuration printer class. | ||
* | ||
* @author sunbufu | ||
*/ | ||
@Slf4j | ||
public final class ConfigurationLogger { | ||
|
||
private ConfigurationLogger() { } | ||
|
||
/** | ||
* log properties configuration. | ||
* | ||
* @param propsConfiguration properties configuration | ||
*/ | ||
public static void log(final Properties propsConfiguration) { | ||
if (null != propsConfiguration) { | ||
log(propsConfiguration.getClass().getSimpleName(), YamlEngine.marshal(propsConfiguration)); | ||
} | ||
} | ||
|
||
/** | ||
* log EncryptRuleConfiguration. | ||
* | ||
* @param encryptRuleConfiguration encryptRule configuration | ||
*/ | ||
public static void log(final EncryptRuleConfiguration encryptRuleConfiguration) { | ||
if (null != encryptRuleConfiguration) { | ||
log(encryptRuleConfiguration.getClass().getSimpleName(), | ||
YamlEngine.marshal(new EncryptRuleConfigurationYamlSwapper().swap(encryptRuleConfiguration))); | ||
} | ||
} | ||
|
||
/** | ||
* log ruleConfiguration. | ||
* | ||
* @param ruleConfiguration ruleConfiguration | ||
*/ | ||
public static void log(final RuleConfiguration ruleConfiguration) { | ||
if (null != ruleConfiguration) { | ||
if (ruleConfiguration instanceof ShardingRuleConfiguration) { | ||
ConfigurationLogger.log((ShardingRuleConfiguration) ruleConfiguration); | ||
} else if (ruleConfiguration instanceof MasterSlaveRuleConfiguration) { | ||
ConfigurationLogger.log((MasterSlaveRuleConfiguration) ruleConfiguration); | ||
} else if (ruleConfiguration instanceof EncryptRuleConfiguration) { | ||
ConfigurationLogger.log((EncryptRuleConfiguration) ruleConfiguration); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* log ShardingRuleConfiguration. | ||
* | ||
* @param shardingRuleConfiguration shardingRule configuration | ||
*/ | ||
public static void log(final ShardingRuleConfiguration shardingRuleConfiguration) { | ||
if (null != shardingRuleConfiguration) { | ||
log(shardingRuleConfiguration.getClass().getSimpleName(), | ||
YamlEngine.marshal(new ShardingRuleConfigurationYamlSwapper().swap(shardingRuleConfiguration))); | ||
} | ||
} | ||
|
||
/** | ||
* log MasterSlaveRuleConfiguration. | ||
* | ||
* @param masterSlaveRuleConfiguration masterSlaveRule configuration | ||
*/ | ||
public static void log(final MasterSlaveRuleConfiguration masterSlaveRuleConfiguration) { | ||
if (null != masterSlaveRuleConfiguration) { | ||
log(masterSlaveRuleConfiguration.getClass().getSimpleName(), | ||
YamlEngine.marshal(new MasterSlaveRuleConfigurationYamlSwapper().swap(masterSlaveRuleConfiguration))); | ||
} | ||
} | ||
|
||
/** | ||
* log AuthenticationConfiguration. | ||
* | ||
* @param authenticationConfiguration authentication configuration | ||
*/ | ||
public static void log(final Authentication authenticationConfiguration) { | ||
if (null != authenticationConfiguration) { | ||
log(authenticationConfiguration.getClass().getSimpleName(), | ||
YamlEngine.marshal(new AuthenticationYamlSwapper().swap(authenticationConfiguration))); | ||
} | ||
} | ||
|
||
/** | ||
* log configuration log. | ||
* | ||
* @param base base node name | ||
* @param yamlStr yaml string | ||
*/ | ||
public static void log(final String base, final String yamlStr) { | ||
log.info("{}\n{}", base, yamlStr); | ||
} | ||
|
||
} |
111 changes: 0 additions & 111 deletions
111
...g-core-common/src/main/java/org/apache/shardingsphere/core/util/ConfigurationPrinter.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.