Loading sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/YamlConfigurationExample.java +6 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import org.apache.shardingsphere.example.common.service.CommonService; import org.apache.shardingsphere.example.type.RegistryCenterType; import org.apache.shardingsphere.example.type.ShardingType; import org.apache.shardingsphere.shardingjdbc.jdbc.adapter.AbstractDataSourceAdapter; import org.apache.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationEncryptDataSourceFactory; import org.apache.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationMasterSlaveDataSourceFactory; import org.apache.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationShardingDataSourceFactory; Loading @@ -39,8 +40,9 @@ import java.sql.SQLException; */ public class YamlConfigurationExample { private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES; // private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES; // private static ShardingType shardingType = ShardingType.MASTER_SLAVE; private static ShardingType shardingType = ShardingType.ENCRYPT; private static boolean loadConfigFromRegCenter = false; // private static boolean loadConfigFromRegCenter = true; Loading @@ -66,6 +68,9 @@ public class YamlConfigurationExample { case MASTER_SLAVE: yamlFilePath = String.format("/META-INF/%s/%s/master-slave.yaml", registryCenterType.name().toLowerCase(), loadConfigFromRegCenter ? "cloud" : "local"); return YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource(getFile(yamlFilePath)); case ENCRYPT: yamlFilePath = String.format("/META-INF/%s/%s/encrypt.yaml", registryCenterType.name().toLowerCase(), loadConfigFromRegCenter ? "cloud" : "local"); return YamlOrchestrationEncryptDataSourceFactory.createDataSource(getFile(yamlFilePath)); default: throw new UnsupportedOperationException(shardingType.name()); } Loading sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml 0 → 100644 +7 −0 Original line number Diff line number Diff line orchestration: name: demo_yaml_ds_encrypt overwrite: false registry: type: zookeeper serverLists: localhost:2181 namespace: orchestration-yaml-demo sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml 0 → 100644 +24 −0 Original line number Diff line number Diff line orchestration: name: demo_yaml_ds_encrypt overwrite: true registry: type: zookeeper serverLists: localhost:2181 namespace: orchestration-yaml-demo dataSource: !!com.zaxxer.hikari.HikariDataSource driverClassName: com.mysql.jdbc.Driver jdbcUrl: jdbc:mysql://localhost:3306/demo_ds username: root password: encryptRule: encryptors: order_encryptor: type: aes qualifiedColumns: t_order.status props: aes.key.value: 123456 props: sql.show: true No newline at end of file Loading
sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/YamlConfigurationExample.java +6 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import org.apache.shardingsphere.example.common.service.CommonService; import org.apache.shardingsphere.example.type.RegistryCenterType; import org.apache.shardingsphere.example.type.ShardingType; import org.apache.shardingsphere.shardingjdbc.jdbc.adapter.AbstractDataSourceAdapter; import org.apache.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationEncryptDataSourceFactory; import org.apache.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationMasterSlaveDataSourceFactory; import org.apache.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationShardingDataSourceFactory; Loading @@ -39,8 +40,9 @@ import java.sql.SQLException; */ public class YamlConfigurationExample { private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES; // private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES; // private static ShardingType shardingType = ShardingType.MASTER_SLAVE; private static ShardingType shardingType = ShardingType.ENCRYPT; private static boolean loadConfigFromRegCenter = false; // private static boolean loadConfigFromRegCenter = true; Loading @@ -66,6 +68,9 @@ public class YamlConfigurationExample { case MASTER_SLAVE: yamlFilePath = String.format("/META-INF/%s/%s/master-slave.yaml", registryCenterType.name().toLowerCase(), loadConfigFromRegCenter ? "cloud" : "local"); return YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource(getFile(yamlFilePath)); case ENCRYPT: yamlFilePath = String.format("/META-INF/%s/%s/encrypt.yaml", registryCenterType.name().toLowerCase(), loadConfigFromRegCenter ? "cloud" : "local"); return YamlOrchestrationEncryptDataSourceFactory.createDataSource(getFile(yamlFilePath)); default: throw new UnsupportedOperationException(shardingType.name()); } Loading
sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml 0 → 100644 +7 −0 Original line number Diff line number Diff line orchestration: name: demo_yaml_ds_encrypt overwrite: false registry: type: zookeeper serverLists: localhost:2181 namespace: orchestration-yaml-demo
sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml 0 → 100644 +24 −0 Original line number Diff line number Diff line orchestration: name: demo_yaml_ds_encrypt overwrite: true registry: type: zookeeper serverLists: localhost:2181 namespace: orchestration-yaml-demo dataSource: !!com.zaxxer.hikari.HikariDataSource driverClassName: com.mysql.jdbc.Driver jdbcUrl: jdbc:mysql://localhost:3306/demo_ds username: root password: encryptRule: encryptors: order_encryptor: type: aes qualifiedColumns: t_order.status props: aes.key.value: 123456 props: sql.show: true No newline at end of file