未验证 提交 cf5ac7e2 编写于 作者: L Liang Zhang 提交者: GitHub

Revise exapmles (#5656)

* fix example pom

* rename sharding-jdbc-example to shardingsphere-jdbc-example

* rename sharding-proxy-example to shardingsphere-proxy-example

* for code style

* fix log

* revise code with sharding-proxy
上级 02b6c14d
......@@ -55,7 +55,7 @@ shardingsphere-example
│   ├── example-raw-jdbc
│   ├── example-spring-jpa
│   └── example-spring-mybatis
├── sharding-jdbc-example
├── shardingsphere-jdbc-example
│   ├── sharding-example
│   │   ├── sharding-raw-jdbc-example
│   │   ├── sharding-spring-boot-jpa-example
......@@ -72,8 +72,9 @@ shardingsphere-example
│   ├── other-feature-example
│   │   ├── hint-example
│   │   └── encrypt-example
├── sharding-proxy-example
│   └── sharding-proxy-boot-mybatis-example
├── shardingsphere-proxy-example
│   ├── shardingsphere-proxy-boot-mybatis-example
│   └── shardingsphere-proxy-hint-example
└── src/resources
  └── manual_schema.sql
```
......@@ -86,29 +87,29 @@ shardingsphere-example
* master-slave
* sharding & master-slave
You can get more detail from **[sharding-example](./sharding-jdbc-example/sharding-example)**
You can get more detail from **[sharding-example](sharding-jdbc-example/sharding-example)**
### Best practice for sharding + orchestration
* using local configuration file for zookeeper/etcd & sharding
* using register center(zookeeper/etcd)'s configuration for sharding
You can get more detail from **[orchestration-example](./sharding-jdbc-example/orchestration-example)**
You can get more detail from **[orchestration-example](sharding-jdbc-example/orchestration-example)**
### Best Practice for sharding + distribution-transaction
* 2pc-xa transaction
* base-seata transaction
You can get more detail from **[transaction-example](./sharding-jdbc-example/transaction-example)**
You can get more detail from **[transaction-example](sharding-jdbc-example/transaction-example)**
### Best Practice for hint routing
You can get more detail from **[hint-example](./sharding-jdbc-example/other-feature-example/hint-example)**
You can get more detail from **[hint-example](sharding-jdbc-example/other-feature-example/hint-example)**
### Best Practice for data encrypt
You can get more detail from **[encrypt-example](./sharding-jdbc-example/other-feature-example/encrypt-example)**
You can get more detail from **[encrypt-example](sharding-jdbc-example/other-feature-example/encrypt-example)**
### Best Practice for APM Integration
......
......@@ -54,7 +54,7 @@ shardingsphere-example
│   ├── example-raw-jdbc
│   ├── example-spring-jpa
│   └── example-spring-mybatis
├── sharding-jdbc-example
├── shardingsphere-jdbc-example
│   ├── sharding-example
│   │   ├── sharding-raw-jdbc-example
│   │   ├── sharding-spring-boot-jpa-example
......@@ -71,8 +71,9 @@ shardingsphere-example
│   ├── other-feature-example
│   │   ├── hint-example
│   │   └── encrypt-example
├── sharding-proxy-example
│   └── sharding-proxy-boot-mybatis-example
├── shardingsphere-proxy-example
│   ├── shardingsphere-proxy-boot-mybatis-example
│   └── shardingsphere-proxy-hint-example
└── src/resources
  └── manual_schema.sql
```
......@@ -85,29 +86,29 @@ shardingsphere-example
* 主从
* 分片和主从
您可以从[sharding-example](./sharding-jdbc-example/sharding-example)中获取更多详细信息
您可以从[sharding-example](sharding-jdbc-example/sharding-example)中获取更多详细信息
### 分片与编排的最佳实践
* 使用本地配置文件和zookeeper/etcd配置分片
* 使用注册中心(zookeeper/etcd)的配置进行分片
您可以从业务[orchestration-example](./sharding-jdbc-example/orchestration-example)中获取更多细节
您可以从业务[orchestration-example](sharding-jdbc-example/orchestration-example)中获取更多细节
### 分片+分布式事务的最佳实践
* 2pc-xa事务
* base-seata事务
您可以从[transaction-example](./sharding-jdbc-example/transaction-example)中获取更多详细信息
您可以从[transaction-example](sharding-jdbc-example/transaction-example)中获取更多详细信息
### 提示路由的最佳实践
您可以从[hint-example](./sharding-jdbc-example/other-feature-example/hint-example)中获取更多细节
您可以从[hint-example](sharding-jdbc-example/other-feature-example/hint-example)中获取更多细节
### 数据加密的最佳实践
您可以从[encrypt-example](./sharding-jdbc-example/other-feature-example/encrypt-example)中获取更多详细信息
您可以从[encrypt-example](sharding-jdbc-example/other-feature-example/encrypt-example)中获取更多详细信息
### APM集成的最佳实践
......
......@@ -25,9 +25,8 @@
<artifactId>example-core</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>config-utility</artifactId>
<name>common::config-utility</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,5 +26,5 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>example-api</artifactId>
<name>common::example-core::example-api</name>
<name>${project.artifactId}</name>
</project>
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>example-raw-jdbc</artifactId>
<name>common::example-raw-jdbc</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>example-spring-jpa</artifactId>
<name>common::example-spring-jpa</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......@@ -39,6 +39,7 @@
<artifactId>example-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
......
......@@ -26,8 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>example-core</artifactId>
<name>common::root</name>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
......
......@@ -23,17 +23,15 @@
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>shardingsphere-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
<module>example-core</module>
<module>sharding-jdbc-example</module>
<module>sharding-proxy-example</module>
<module>shardingsphere-jdbc-example</module>
<module>shardingsphere-proxy-example</module>
</modules>
<name>Example::root</name>
<packaging>pom</packaging>
<properties>
<java.version>1.8</java.version>
<maven.version.range>[3.0.4,)</maven.version.range>
......@@ -55,13 +53,13 @@
<mybatis-spring.version>1.3.0</mybatis-spring.version>
<jpa.version>1.0.0.Final</jpa.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<seata.version>1.0.0</seata.version>
<junit.version>4.12</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<mockito.version>2.7.21</mockito.version>
<apache-rat-plugin.version>0.12</apache-rat-plugin.version>
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="sharding-jdbc-spring-namespace-mybatis-example" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="sharding-jdbc-spring-namespace-jpa-quickstart" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="sharding-jdbc-spring-namespace-mybatis-quickstart" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="sharding-proxy-hint-example" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>orchestration-raw-jdbc-example</artifactId>
<name>Example::orchestration::raw-jdbc</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>orchestration-spring-boot-example</artifactId>
<name>Example::orchestration::spring-boot</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>orchestration-spring-namespace-example</artifactId>
<name>Example::orchestration::spring-namespace</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -22,11 +22,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>sharding-jdbc-example</artifactId>
<artifactId>shardingsphere-jdbc-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>orchestration-example</artifactId>
<name>Example::orchestration</name>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>encrypt-raw-jdbc-example</artifactId>
<name>Example::encrypt::raw-jdbc</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>encrypt-spring-boot-example</artifactId>
<name>Example::encrypt::spring-boot</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>encrypt-spring-namespace-example</artifactId>
<name>Example::encrypt::spring-namespace</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>encrypt-example</artifactId>
<name>Example::encrypt::root</name>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>hint-raw-jdbc-example</artifactId>
<name>Example::hint::raw-jdbc</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>hint-example</artifactId>
<name>Example::hint::root</name>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
......
......@@ -22,11 +22,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>sharding-jdbc-example</artifactId>
<artifactId>shardingsphere-jdbc-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>other-feature-example</artifactId>
<name>Example::other-feature::root</name>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
......
......@@ -19,16 +19,16 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>other-feature-example</artifactId>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>other-feature-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>Example::shadow::root</name>
<artifactId>shadow-example</artifactId>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
<module>shadow-raw-jdbc-example</module>
<module>shadow-spring-boot-example</module>
......
......@@ -19,26 +19,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>shadow-example</artifactId>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>shadow-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>Example::shadow::raw-jdbc</name>
<artifactId>shadow-raw-jdbc-example</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>example-raw-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
</dependency>
</dependencies>
</project>
......@@ -19,25 +19,27 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>shadow-example</artifactId>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>shadow-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>Example::shadow::spring-boot</name>
<artifactId>shadow-spring-boot-example</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>example-spring-jpa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
......
......@@ -25,9 +25,8 @@
<artifactId>shardingsphere-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-jdbc-example</artifactId>
<name>Example::jdbc::root</name>
<artifactId>shardingsphere-jdbc-example</artifactId>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
......
......@@ -22,12 +22,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>sharding-jdbc-example</artifactId>
<artifactId>shardingsphere-jdbc-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-example</artifactId>
<name>Example::sharding::root</name>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-raw-jdbc-example</artifactId>
<name>Example::sharding::raw-jdbc</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="shardingsphere-jdbc-api-quickstart" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
......@@ -26,8 +26,8 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-spring-boot-jpa-example</artifactId>
<name>Example::sharding::spring-boot-jpa</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere.example</groupId>
......
......@@ -26,7 +26,7 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-spring-boot-mybatis-example</artifactId>
<name>Example::sharding::spring-boot-mybatis</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......@@ -34,12 +34,12 @@
<artifactId>example-spring-mybatis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="shardingsphere-jdbc-spring-namespace-mybatis-example" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
......@@ -26,15 +26,15 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-spring-namespace-jpa-example</artifactId>
<name>Example::sharding::spring-namespace-jpa</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>example-spring-jpa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="shardingsphere-jdbc-spring-namespace-jpa-quickstart" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
......@@ -26,15 +26,15 @@
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-spring-namespace-mybatis-example</artifactId>
<name>Example::sharding::spring-namespace-mybatis</name>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>example-spring-mybatis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<configuration>
<property name="log.context.name" value="shardingsphere-jdbc-spring-namespace-mybatis-quickstart" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="${log.charset}">
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
......@@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>sharding-jdbc-example</artifactId>
<artifactId>shardingsphere-jdbc-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>transaction-example</artifactId>
......
......@@ -25,13 +25,12 @@
<artifactId>shardingsphere-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-proxy-example</artifactId>
<name>Example::proxy::root</name>
<artifactId>shardingsphere-proxy-example</artifactId>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<modules>
<module>sharding-proxy-boot-mybatis-example</module>
<module>sharding-proxy-hint-example</module>
<module>shardingsphere-proxy-boot-mybatis-example</module>
<module>shardingsphere-proxy-hint-example</module>
</modules>
</project>
......@@ -22,11 +22,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>sharding-proxy-example</artifactId>
<artifactId>shardingsphere-proxy-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-proxy-boot-mybatis-example</artifactId>
<name>Example::proxy::spring-boot-mybatis</name>
<artifactId>shardingsphere-proxy-boot-mybatis-example</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
......@@ -34,7 +34,7 @@
<artifactId>example-spring-mybatis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
......
......@@ -27,10 +27,10 @@ import org.springframework.context.annotation.ComponentScan;
import java.sql.SQLException;
/*
* 1. Copy resources/conf/*.yaml to sharding-proxy conf folder and overwrite original file.
* 1. Copy resources/conf/*.yaml to ShardingSphere-Proxy conf folder and overwrite original file.
* If you want to use master-slave, please select config-master_slave.yaml
* If you want to use sharding only, please select config-sharding.yaml
* 2. Please make sure sharding-proxy is running before you run this example.
* 2. Please make sure ShardingSphere-Proxy is running before you run this example.
*/
@ComponentScan("org.apache.shardingsphere.example")
@MapperScan(basePackages = "org.apache.shardingsphere.example.core.mybatis.repository")
......
......@@ -17,7 +17,7 @@
-->
<configuration>
<property name="log.context.name" value="sharding-proxy-boot-mybatis-example" />
<property name="log.context.name" value="shardingsphere-proxy-boot-mybatis-example" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
......
......@@ -21,19 +21,20 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>sharding-proxy-example</artifactId>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>shardingsphere-proxy-example</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>sharding-proxy-hint-example</artifactId>
<name>Example::proxy::hint</name>
<artifactId>shardingsphere-proxy-hint-example</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere.example</groupId>
<artifactId>example-raw-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
......@@ -43,5 +44,4 @@
<artifactId>shardingsphere-infra-common</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -17,7 +17,7 @@
-->
<configuration>
<property name="log.context.name" value="sharding-jdbc-api-quickstart" />
<property name="log.context.name" value="shardingsphere-proxy-hint-example" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[%-5level] %date --%thread-- [%logger] %msg %n" />
<contextName>${log.context.name}</contextName>
......
......@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
* Sharding-Proxy's information for MySQL.
* ShardingSphere-Proxy's information for MySQL.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class MySQLServerInfo {
......@@ -34,7 +34,7 @@ public final class MySQLServerInfo {
/**
* Server version.
*/
public static final String SERVER_VERSION = "5.6.4-Sharding-Proxy 5.0.0-RC1";
public static final String SERVER_VERSION = "5.6.4-ShardingSphere-Proxy 5.0.0-RC1";
/**
* Charset code 0x21 is utf8_general_ci.
......
......@@ -151,7 +151,7 @@ public final class DataSourceConfiguration {
}
/**
* Add alias to share configuration with sharding-jdbc.
* Add alias to share configuration.
*
* @param alias alias for configuration
*/
......
......@@ -84,7 +84,7 @@ public enum ConfigurationPropertyKey implements TypedPropertyKey {
QUERY_WITH_CIPHER_COLUMN("query.with.cipher.column", String.valueOf(Boolean.TRUE), boolean.class),
/**
* Sharding-Proxy's flush threshold for every records from databases.
* ShardingSphere-Proxy's flush threshold for every records from databases.
*/
PROXY_FRONTEND_FLUSH_THRESHOLD("proxy.frontend.flush.threshold", String.valueOf(128), int.class),
......@@ -93,33 +93,33 @@ public enum ConfigurationPropertyKey implements TypedPropertyKey {
*
* <p>
* LOCAL:
* Sharding-Proxy will run with LOCAL transaction.
* ShardingSphere-Proxy will run with LOCAL transaction.
* </p>
*
* <p>
* XA:
* Sharding-Proxy will run with XA transaction.
* ShardingSphere-Proxy will run with XA transaction.
* </p>
*
* <p>
* BASE:
* Sharding-Proxy will run with BASE transaction.
* ShardingSphere-Proxy will run with BASE transaction.
* </p>
*/
PROXY_TRANSACTION_TYPE("proxy.transaction.type", "LOCAL", String.class),
/**
* Enable opentracing for Sharding-Proxy.
* Enable opentracing for ShardingSphere-Proxy.
*/
PROXY_OPENTRACING_ENABLED("proxy.opentracing.enabled", String.valueOf(Boolean.FALSE), boolean.class),
/**
* Enable metrics for Sharding-Proxy.
* Enable metrics for ShardingSphere-Proxy.
*/
PROXY_METRICS_ENABLED("proxy.metrics.enabled", String.valueOf(Boolean.FALSE), boolean.class),
/**
* Enable hint for Sharding-Proxy.
* Enable hint for ShardingSphere-Proxy.
*/
PROXY_HINT_ENABLED("proxy.hint.enabled", String.valueOf(Boolean.FALSE), boolean.class),
......
......@@ -78,7 +78,7 @@ public final class JDBCRawBackendDataSourceFactory implements JDBCBackendDataSou
try {
Class.forName(driverClassName);
} catch (final ClassNotFoundException ex) {
throw new ShardingSphereException("Cannot load JDBC driver class `%s`, make sure it in Sharding-Proxy's classpath.", driverClassName);
throw new ShardingSphereException("Cannot load JDBC driver class `%s`, make sure it in ShardingSphere-Proxy's classpath.", driverClassName);
}
}
}
......@@ -35,7 +35,7 @@ import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
import org.apache.shardingsphere.proxy.context.ShardingProxyContext;
import org.apache.shardingsphere.proxy.frontend.bootstrap.ShardingProxy;
import org.apache.shardingsphere.proxy.frontend.bootstrap.ShardingSphereProxy;
import org.apache.shardingsphere.proxy.util.DataSourceConverter;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
......@@ -59,7 +59,7 @@ import java.util.Map.Entry;
import java.util.Properties;
/**
* Sharding-Proxy Bootstrap.
* ShardingSphere-Proxy Bootstrap.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Bootstrap {
......@@ -140,7 +140,7 @@ public final class Bootstrap {
final Map<String, Collection<RuleConfiguration>> schemaRules) throws SQLException {
ShardingSphereSchemas.getInstance().init(shardingSchemaNames, schemaDataSources, schemaRules);
initOpenTracing();
ShardingProxy.getInstance().start(port);
ShardingSphereProxy.getInstance().start(port);
}
private static Map<String, Map<String, YamlDataSourceParameter>> getSchemaDataSourceParameterMap(final ShardingOrchestrationFacade shardingOrchestrationFacade) {
......
......@@ -44,10 +44,10 @@ public final class ShardingConfigurationLoader {
private static final Pattern RULE_CONFIG_FILE_PATTERN = Pattern.compile("config-.+\\.yaml");
/**
* Load configuration of Sharding-Proxy.
* Load configuration of ShardingSphere-Proxy.
*
* @param path configuration path of Sharding-Proxy
* @return configuration of Sharding-Proxy
* @param path configuration path of ShardingSphere-Proxy
* @return configuration of ShardingSphere-Proxy
* @throws IOException IO exception
*/
public ShardingConfiguration load(final String path) throws IOException {
......
......@@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.log.ConfigurationLogger;
import java.util.Properties;
/**
* Context of Sharding-Proxy.
* Context of ShardingSphere-Proxy.
*/
@Getter
public final class ShardingProxyContext {
......@@ -48,9 +48,9 @@ public final class ShardingProxyContext {
}
/**
* Get instance of Sharding-Proxy's context.
* Get instance of ShardingSphere-Proxy's context.
*
* @return instance of Sharding-Proxy's context.
* @return instance of ShardingSphere-Proxy's context.
*/
public static ShardingProxyContext getInstance() {
return INSTANCE;
......
......@@ -38,12 +38,12 @@ import org.apache.shardingsphere.proxy.backend.executor.BackendExecutorContext;
import org.apache.shardingsphere.proxy.frontend.netty.ServerHandlerInitializer;
/**
* Sharding-Proxy.
* ShardingSphere-Proxy.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ShardingProxy {
public final class ShardingSphereProxy {
private static final ShardingProxy INSTANCE = new ShardingProxy();
private static final ShardingSphereProxy INSTANCE = new ShardingSphereProxy();
private EventLoopGroup bossGroup;
......@@ -54,12 +54,12 @@ public final class ShardingProxy {
*
* @return instance of proxy context.
*/
public static ShardingProxy getInstance() {
public static ShardingSphereProxy getInstance() {
return INSTANCE;
}
/**
* Start Sharding-Proxy.
* Start ShardingSphere-Proxy.
*
* @param port port
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册