Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
770340e8
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
770340e8
编写于
10月 16, 2018
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add example-utility module & refactor raw-jdbc-nodep-example
上级
ffeea44d
变更
35
隐藏空白更改
内联
并排
Showing
35 changed file
with
264 addition
and
272 deletion
+264
-272
example-utility/pom.xml
example-utility/pom.xml
+1
-1
example-utility/src/main/java/io/shardingsphere/example/algorithm/ModuloShardingDatabaseAlgorithm.java
...re/example/algorithm/ModuloShardingDatabaseAlgorithm.java
+0
-0
example-utility/src/main/java/io/shardingsphere/example/algorithm/ModuloShardingTableAlgorithm.java
...phere/example/algorithm/ModuloShardingTableAlgorithm.java
+0
-0
example-utility/src/main/java/io/shardingsphere/example/config/DataSourceUtil.java
...java/io/shardingsphere/example/config/DataSourceUtil.java
+1
-1
example-utility/src/main/java/io/shardingsphere/example/config/ExampleConfiguration.java
...o/shardingsphere/example/config/ExampleConfiguration.java
+26
-0
example-utility/src/main/java/io/shardingsphere/example/type/ShardingType.java
...ain/java/io/shardingsphere/example/type/ShardingType.java
+23
-0
pom.xml
pom.xml
+1
-1
sharding-jdbc-example/raw-jdbc-nodep-example/pom.xml
sharding-jdbc-example/raw-jdbc-nodep-example/pom.xml
+1
-1
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/JavaConfigurationExample.java
...ngsphere/example/jdbc/nodep/JavaConfigurationExample.java
+81
-0
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/YamlConfigurationExample.java
...ngsphere/example/jdbc/nodep/YamlConfigurationExample.java
+83
-0
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/config/MasterSlaveConfiguration.java
...e/example/jdbc/nodep/config/MasterSlaveConfiguration.java
+7
-17
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/config/ShardingDatabasesAndTablesConfiguration.java
...nodep/config/ShardingDatabasesAndTablesConfiguration.java
+6
-16
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/config/ShardingDatabasesConfiguration.java
...ple/jdbc/nodep/config/ShardingDatabasesConfiguration.java
+6
-16
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/config/ShardingMasterSlaveConfiguration.java
...e/jdbc/nodep/config/ShardingMasterSlaveConfiguration.java
+6
-16
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/config/ShardingTablesConfiguration.java
...xample/jdbc/nodep/config/ShardingTablesConfiguration.java
+6
-16
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingAndMasterSlaveTogether.java
.../jdbc/nodep/main/yaml/ShardingAndMasterSlaveTogether.java
+0
-45
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingOnlyWithDatabases.java
...ample/jdbc/nodep/main/yaml/ShardingOnlyWithDatabases.java
+0
-42
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingOnlyWithDatabasesAndTables.java
...c/nodep/main/yaml/ShardingOnlyWithDatabasesAndTables.java
+0
-42
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingOnlyWithTables.java
.../example/jdbc/nodep/main/yaml/ShardingOnlyWithTables.java
+0
-42
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/resources/META-INF/master-slave.yaml
...dep-example/src/main/resources/META-INF/master-slave.yaml
+1
-1
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/resources/logback.xml
...ple/raw-jdbc-nodep-example/src/main/resources/logback.xml
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/pom.xml
sharding-jdbc-example/raw-jdbc-orche-example/pom.xml
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/MasterSlaveOnly.java
...re/example/jdbc/orche/main/java/etcd/MasterSlaveOnly.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingAndMasterSlaveTogether.java
.../orche/main/java/etcd/ShardingAndMasterSlaveTogether.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingOnlyWithDatabases.java
.../jdbc/orche/main/java/etcd/ShardingOnlyWithDatabases.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingOnlyWithDatabasesAndTables.java
...he/main/java/etcd/ShardingOnlyWithDatabasesAndTables.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingOnlyWithTables.java
...ple/jdbc/orche/main/java/etcd/ShardingOnlyWithTables.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/MasterSlaveOnly.java
...ample/jdbc/orche/main/java/zookeeper/MasterSlaveOnly.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingAndMasterSlaveTogether.java
...e/main/java/zookeeper/ShardingAndMasterSlaveTogether.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingOnlyWithDatabases.java
.../orche/main/java/zookeeper/ShardingOnlyWithDatabases.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingOnlyWithDatabasesAndTables.java
...in/java/zookeeper/ShardingOnlyWithDatabasesAndTables.java
+1
-1
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingOnlyWithTables.java
...dbc/orche/main/java/zookeeper/ShardingOnlyWithTables.java
+1
-1
sharding-jdbc-example/spring-boot-orche-example/spring-boot-orche-jpa-example/src/main/resources/application.properties
...che-jpa-example/src/main/resources/application.properties
+1
-1
sharding-jdbc-example/spring-namespace-nodep-example/pom.xml
sharding-jdbc-example/spring-namespace-nodep-example/pom.xml
+1
-1
sharding-jdbc-example/spring-namespace-orche-example/pom.xml
sharding-jdbc-example/spring-namespace-orche-example/pom.xml
+1
-1
未找到文件。
common-sharding-algorithm
/pom.xml
→
example-utility
/pom.xml
浏览文件 @
770340e8
...
...
@@ -8,7 +8,7 @@
<version>
3.0.0.M5-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
common-sharding-algorithm
</artifactId>
<artifactId>
example-utility
</artifactId>
<dependencies>
<dependency>
...
...
common-sharding-algorithm
/src/main/java/io/shardingsphere/example/algorithm/ModuloShardingDatabaseAlgorithm.java
→
example-utility
/src/main/java/io/shardingsphere/example/algorithm/ModuloShardingDatabaseAlgorithm.java
浏览文件 @
770340e8
文件已移动
common-sharding-algorithm
/src/main/java/io/shardingsphere/example/algorithm/ModuloShardingTableAlgorithm.java
→
example-utility
/src/main/java/io/shardingsphere/example/algorithm/ModuloShardingTableAlgorithm.java
浏览文件 @
770340e8
文件已移动
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/util
/DataSourceUtil.java
→
example-utility/src/main/java/io/shardingsphere/example/config
/DataSourceUtil.java
浏览文件 @
770340e8
...
...
@@ -15,7 +15,7 @@
* </p>
*/
package
io.shardingsphere.example.
jdbc.orche.util
;
package
io.shardingsphere.example.
config
;
import
org.apache.commons.dbcp.BasicDataSource
;
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/util/DataSourceUtil
.java
→
example-utility/src/main/java/io/shardingsphere/example/config/ExampleConfiguration
.java
100755 → 100644
浏览文件 @
770340e8
...
...
@@ -15,28 +15,12 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.util
;
import
org.apache.commons.dbcp.BasicDataSource
;
package
io.shardingsphere.example.config
;
import
javax.sql.DataSource
;
import
java.sql.SQLException
;
public
class
DataSourceUtil
{
private
static
final
String
HOST
=
"localhost"
;
private
static
final
int
PORT
=
3306
;
private
static
final
String
USER_NAME
=
"root"
;
private
static
final
String
PASSWORD
=
""
;
public
interface
ExampleConfiguration
{
public
static
DataSource
createDataSource
(
final
String
dataSourceName
)
{
BasicDataSource
result
=
new
BasicDataSource
();
result
.
setDriverClassName
(
com
.
mysql
.
jdbc
.
Driver
.
class
.
getName
());
result
.
setUrl
(
String
.
format
(
"jdbc:mysql://%s:%s/%s"
,
HOST
,
PORT
,
dataSourceName
));
result
.
setUsername
(
USER_NAME
);
result
.
setPassword
(
PASSWORD
);
return
result
;
}
DataSource
getDataSource
()
throws
SQLException
;
}
example-utility/src/main/java/io/shardingsphere/example/type/ShardingType.java
0 → 100644
浏览文件 @
770340e8
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/
package
io.shardingsphere.example.type
;
public
enum
ShardingType
{
SHARDING_DATABASES
,
SHARDING_TABLES
,
SHARDING_DATABASES_AND_TABLES
,
MASTER_SLAVE
,
SHARDING_MASTER_SLAVE
}
pom.xml
浏览文件 @
770340e8
...
...
@@ -7,9 +7,9 @@
<modules>
<module>
common-repository
</module>
<module>
example-utility
</module>
<module>
sharding-jdbc-example
</module>
<module>
sharding-proxy-example
</module>
<module>
common-sharding-algorithm
</module>
</modules>
<properties>
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/pom.xml
浏览文件 @
770340e8
...
...
@@ -15,7 +15,7 @@
</dependency>
<dependency>
<groupId>
io.shardingsphere
</groupId>
<artifactId>
common-sharding-algorithm
</artifactId>
<artifactId>
example-utility
</artifactId>
<version>
${project.version}
</version>
</dependency>
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/JavaConfigurationExample.java
0 → 100644
浏览文件 @
770340e8
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep
;
import
io.shardingsphere.example.config.ExampleConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.config.MasterSlaveConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.config.ShardingDatabasesConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.config.ShardingDatabasesAndTablesConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.config.ShardingMasterSlaveConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.config.ShardingTablesConfiguration
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.type.ShardingType
;
import
javax.sql.DataSource
;
import
java.sql.SQLException
;
public
class
JavaConfigurationExample
{
private
static
ShardingType
type
=
ShardingType
.
SHARDING_DATABASES
;
// private static ShardingType type = ShardingType.SHARDING_TABLES;
// private static ShardingType type = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType type = ShardingType.MASTER_SLAVE;
// private static ShardingType type = ShardingType.SHARDING_MASTER_SLAVE;
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
{
process
(
getDataSource
());
}
private
static
DataSource
getDataSource
()
throws
SQLException
{
ExampleConfiguration
exampleConfig
;
switch
(
type
)
{
case
SHARDING_DATABASES:
exampleConfig
=
new
ShardingDatabasesConfiguration
();
break
;
case
SHARDING_TABLES:
exampleConfig
=
new
ShardingTablesConfiguration
();
break
;
case
SHARDING_DATABASES_AND_TABLES:
exampleConfig
=
new
ShardingDatabasesAndTablesConfiguration
();
break
;
case
MASTER_SLAVE:
exampleConfig
=
new
MasterSlaveConfiguration
();
break
;
case
SHARDING_MASTER_SLAVE:
exampleConfig
=
new
ShardingMasterSlaveConfiguration
();
break
;
default
:
throw
new
UnsupportedOperationException
(
type
.
name
());
}
return
exampleConfig
.
getDataSource
();
}
private
static
void
process
(
final
DataSource
dataSource
)
{
CommonService
commonService
=
getCommonService
(
dataSource
);
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
CommonService
getCommonService
(
final
DataSource
dataSource
)
{
return
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
}
}
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
main/yaml/MasterSlaveOnly
.java
→
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
YamlConfigurationExample
.java
浏览文件 @
770340e8
...
...
@@ -15,31 +15,69 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep
.main.yaml
;
package
io.shardingsphere.example.jdbc.nodep
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.type.ShardingType
;
import
io.shardingsphere.shardingjdbc.api.yaml.YamlMasterSlaveDataSourceFactory
;
import
io.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory
;
import
javax.sql.DataSource
;
import
java.io.File
;
import
java.io.IOException
;
import
java.sql.SQLException
;
/*
* Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.
*/
public
class
MasterSlaveOnly
{
public
class
YamlConfigurationExample
{
private
static
ShardingType
type
=
ShardingType
.
SHARDING_DATABASES
;
// private static ShardingType type = ShardingType.SHARDING_TABLES;
// private static ShardingType type = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType type = ShardingType.MASTER_SLAVE;
// private static ShardingType type = ShardingType.SHARDING_MASTER_SLAVE;
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
DataSource
dataSource
=
YamlMasterSlaveDataSourceFactory
.
createDataSource
(
getYamlFile
());
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
,
IOException
{
process
(
getDataSource
());
}
private
static
DataSource
getDataSource
()
throws
IOException
,
SQLException
{
return
ShardingType
.
MASTER_SLAVE
==
type
?
YamlMasterSlaveDataSourceFactory
.
createDataSource
(
getYamlFile
())
:
YamlShardingDataSourceFactory
.
createDataSource
(
getYamlFile
());
}
private
static
File
getYamlFile
()
{
String
result
;
switch
(
type
)
{
case
SHARDING_DATABASES:
result
=
"/META-INF/sharding-databases.yaml"
;
break
;
case
SHARDING_TABLES:
result
=
"/META-INF/sharding-tables.yaml"
;
break
;
case
SHARDING_DATABASES_AND_TABLES:
result
=
"/META-INF/sharding-databases-tables.yaml"
;
break
;
case
MASTER_SLAVE:
result
=
"/META-INF/master-slave.yaml"
;
break
;
case
SHARDING_MASTER_SLAVE:
result
=
"/META-INF/sharding-master-slave.yaml"
;
break
;
default
:
throw
new
UnsupportedOperationException
(
type
.
name
());
}
return
new
File
(
YamlConfigurationExample
.
class
.
getResource
(
result
).
getFile
());
}
private
static
void
process
(
final
DataSource
dataSource
)
{
CommonService
commonService
=
getCommonService
(
dataSource
);
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
File
getYamlFile
(
)
{
return
new
File
(
MasterSlaveOnly
.
class
.
getResource
(
"/META-INF/master-slave.yaml"
).
getFile
(
));
private
static
CommonService
getCommonService
(
final
DataSource
dataSource
)
{
return
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
}
}
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
main/java/MasterSlaveOnly
.java
→
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
config/MasterSlaveConfiguration
.java
浏览文件 @
770340e8
...
...
@@ -15,14 +15,11 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.
main.java
;
package
io.shardingsphere.example.jdbc.nodep.
config
;
import
io.shardingsphere.api.config.MasterSlaveRuleConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.util.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.config.DataSourceUtil
;
import
io.shardingsphere.example.config.ExampleConfiguration
;
import
io.shardingsphere.shardingjdbc.api.MasterSlaveDataSourceFactory
;
import
javax.sql.DataSource
;
...
...
@@ -36,22 +33,15 @@ import java.util.concurrent.ConcurrentHashMap;
/*
* Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.
*/
public
class
MasterSlave
Only
{
public
class
MasterSlave
Configuration
implements
ExampleConfiguration
{
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
{
DataSource
dataSource
=
getDataSource
();
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
DataSource
getDataSource
()
throws
SQLException
{
@Override
public
DataSource
getDataSource
()
throws
SQLException
{
MasterSlaveRuleConfiguration
masterSlaveRuleConfig
=
new
MasterSlaveRuleConfiguration
(
"demo_ds_master_slave"
,
"demo_ds_master"
,
Arrays
.
asList
(
"demo_ds_slave_0"
,
"demo_ds_slave_1"
));
return
MasterSlaveDataSourceFactory
.
createDataSource
(
createDataSourceMap
(),
masterSlaveRuleConfig
,
new
ConcurrentHashMap
<
String
,
Object
>(),
new
Properties
());
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
private
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
Map
<
String
,
DataSource
>
result
=
new
HashMap
<>();
result
.
put
(
"demo_ds_master"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_master"
));
result
.
put
(
"demo_ds_slave_0"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_slave_0"
));
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
main/java/ShardingOnlyWithDatabasesAndTables
.java
→
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
config/ShardingDatabasesAndTablesConfiguration
.java
浏览文件 @
770340e8
...
...
@@ -15,18 +15,15 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.
main.java
;
package
io.shardingsphere.example.jdbc.nodep.
config
;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.example.algorithm.ModuloShardingTableAlgorithm
;
import
io.shardingsphere.example.jdbc.nodep.util.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.config.DataSourceUtil
;
import
io.shardingsphere.example.config.ExampleConfiguration
;
import
io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory
;
import
javax.sql.DataSource
;
...
...
@@ -35,17 +32,10 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Properties
;
public
class
Sharding
OnlyWithDatabasesAndTables
{
public
class
Sharding
DatabasesAndTablesConfiguration
implements
ExampleConfiguration
{
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
{
DataSource
dataSource
=
getDataSource
();
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
DataSource
getDataSource
()
throws
SQLException
{
@Override
public
DataSource
getDataSource
()
throws
SQLException
{
ShardingRuleConfiguration
shardingRuleConfig
=
new
ShardingRuleConfiguration
();
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
main/java/ShardingOnlyWithDatabases
.java
→
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
config/ShardingDatabasesConfiguration
.java
浏览文件 @
770340e8
...
...
@@ -15,16 +15,13 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.
main.java
;
package
io.shardingsphere.example.jdbc.nodep.
config
;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.util.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.config.DataSourceUtil
;
import
io.shardingsphere.example.config.ExampleConfiguration
;
import
io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory
;
import
javax.sql.DataSource
;
...
...
@@ -33,17 +30,10 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Properties
;
public
class
Sharding
OnlyWithDatabases
{
public
class
Sharding
DatabasesConfiguration
implements
ExampleConfiguration
{
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
{
DataSource
dataSource
=
getDataSource
();
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
DataSource
getDataSource
()
throws
SQLException
{
@Override
public
DataSource
getDataSource
()
throws
SQLException
{
ShardingRuleConfiguration
shardingRuleConfig
=
new
ShardingRuleConfiguration
();
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
main/java/ShardingAndMasterSlaveTogether
.java
→
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
config/ShardingMasterSlaveConfiguration
.java
浏览文件 @
770340e8
...
...
@@ -15,7 +15,7 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.
main.java
;
package
io.shardingsphere.example.jdbc.nodep.
config
;
import
com.google.common.collect.Lists
;
import
io.shardingsphere.api.config.MasterSlaveRuleConfiguration
;
...
...
@@ -24,11 +24,8 @@ import io.shardingsphere.api.config.TableRuleConfiguration;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.example.algorithm.ModuloShardingDatabaseAlgorithm
;
import
io.shardingsphere.example.algorithm.ModuloShardingTableAlgorithm
;
import
io.shardingsphere.example.jdbc.nodep.util.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.config.DataSourceUtil
;
import
io.shardingsphere.example.config.ExampleConfiguration
;
import
io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory
;
import
javax.sql.DataSource
;
...
...
@@ -42,17 +39,10 @@ import java.util.Properties;
/*
* Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.
*/
public
class
Sharding
AndMasterSlaveTogether
{
public
class
Sharding
MasterSlaveConfiguration
implements
ExampleConfiguration
{
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
{
DataSource
dataSource
=
getDataSource
();
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
DataSource
getDataSource
()
throws
SQLException
{
@Override
public
DataSource
getDataSource
()
throws
SQLException
{
ShardingRuleConfiguration
shardingRuleConfig
=
new
ShardingRuleConfiguration
();
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
main/java/ShardingOnlyWithTables
.java
→
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/
config/ShardingTablesConfiguration
.java
浏览文件 @
770340e8
...
...
@@ -15,15 +15,12 @@
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.
main.java
;
package
io.shardingsphere.example.jdbc.nodep.
config
;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.example.jdbc.nodep.util.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.example.config.DataSourceUtil
;
import
io.shardingsphere.example.config.ExampleConfiguration
;
import
io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory
;
import
javax.sql.DataSource
;
...
...
@@ -32,17 +29,10 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Properties
;
public
class
Sharding
OnlyWithTables
{
public
class
Sharding
TablesConfiguration
implements
ExampleConfiguration
{
public
static
void
main
(
final
String
[]
args
)
throws
SQLException
{
DataSource
dataSource
=
getDataSource
();
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
DataSource
getDataSource
()
throws
SQLException
{
@Override
public
DataSource
getDataSource
()
throws
SQLException
{
ShardingRuleConfiguration
shardingRuleConfig
=
new
ShardingRuleConfiguration
();
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
...
...
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingAndMasterSlaveTogether.java
已删除
100644 → 0
浏览文件 @
ffeea44d
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.main.yaml
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory
;
import
javax.sql.DataSource
;
import
java.io.File
;
/*
* Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.
*/
public
class
ShardingAndMasterSlaveTogether
{
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
DataSource
dataSource
=
YamlShardingDataSourceFactory
.
createDataSource
(
getYamlFile
());
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
File
getYamlFile
()
{
return
new
File
(
ShardingAndMasterSlaveTogether
.
class
.
getResource
(
"/META-INF/sharding-master-slave.yaml"
).
getFile
());
}
}
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingOnlyWithDatabases.java
已删除
100644 → 0
浏览文件 @
ffeea44d
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.main.yaml
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory
;
import
javax.sql.DataSource
;
import
java.io.File
;
public
class
ShardingOnlyWithDatabases
{
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
DataSource
dataSource
=
YamlShardingDataSourceFactory
.
createDataSource
(
getYamlFile
());
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
File
getYamlFile
()
{
return
new
File
(
ShardingOnlyWithDatabases
.
class
.
getResource
(
"/META-INF/sharding-databases.yaml"
).
getFile
());
}
}
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingOnlyWithDatabasesAndTables.java
已删除
100644 → 0
浏览文件 @
ffeea44d
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.main.yaml
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory
;
import
javax.sql.DataSource
;
import
java.io.File
;
public
class
ShardingOnlyWithDatabasesAndTables
{
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
DataSource
dataSource
=
YamlShardingDataSourceFactory
.
createDataSource
(
getYamlFile
());
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
File
getYamlFile
()
{
return
new
File
(
ShardingOnlyWithDatabasesAndTables
.
class
.
getResource
(
"/META-INF/sharding-databases-tables.yaml"
).
getFile
());
}
}
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/java/io/shardingsphere/example/jdbc/nodep/main/yaml/ShardingOnlyWithTables.java
已删除
100644 → 0
浏览文件 @
ffeea44d
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/
package
io.shardingsphere.example.jdbc.nodep.main.yaml
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.service.RawPojoService
;
import
io.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory
;
import
javax.sql.DataSource
;
import
java.io.File
;
public
class
ShardingOnlyWithTables
{
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
DataSource
dataSource
=
YamlShardingDataSourceFactory
.
createDataSource
(
getYamlFile
());
CommonService
commonService
=
new
RawPojoService
(
new
JDBCOrderRepositoryImpl
(
dataSource
),
new
JDBCOrderItemRepositoryImpl
(
dataSource
));
commonService
.
initEnvironment
();
commonService
.
processSuccess
();
commonService
.
cleanEnvironment
();
}
private
static
File
getYamlFile
()
{
return
new
File
(
ShardingOnlyWithTables
.
class
.
getResource
(
"/META-INF/sharding-tables.yaml"
).
getFile
());
}
}
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/resources/META-INF/master-slave.yaml
浏览文件 @
770340e8
...
...
@@ -21,4 +21,4 @@ masterSlaveRule:
slaveDataSourceNames
:
[
ds_slave_0
,
ds_slave_1
]
props
:
sql.show
:
true
\ No newline at end of file
sql.show
:
true
sharding-jdbc-example/raw-jdbc-nodep-example/src/main/resources/logback.xml
浏览文件 @
770340e8
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"log.context.name"
value=
"raw-jdbc-
yaml-
nodep-example"
/>
<property
name=
"log.context.name"
value=
"raw-jdbc-nodep-example"
/>
<property
name=
"log.charset"
value=
"UTF-8"
/>
<property
name=
"log.pattern"
value=
"[%-5level] %date --%thread-- [%logger] %msg %n"
/>
<contextName>
${log.context.name}
</contextName>
...
...
sharding-jdbc-example/raw-jdbc-orche-example/pom.xml
浏览文件 @
770340e8
...
...
@@ -18,7 +18,7 @@
</dependency>
<dependency>
<groupId>
io.shardingsphere
</groupId>
<artifactId>
common-sharding-algorithm
</artifactId>
<artifactId>
example-utility
</artifactId>
<version>
${project.version}
</version>
</dependency>
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/MasterSlaveOnly.java
浏览文件 @
770340e8
...
...
@@ -18,7 +18,7 @@
package
io.shardingsphere.example.jdbc.orche.main.java.etcd
;
import
io.shardingsphere.api.config.MasterSlaveRuleConfiguration
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingAndMasterSlaveTogether.java
浏览文件 @
770340e8
...
...
@@ -24,7 +24,7 @@ import io.shardingsphere.api.config.TableRuleConfiguration;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.example.algorithm.ModuloShardingDatabaseAlgorithm
;
import
io.shardingsphere.example.algorithm.ModuloShardingTableAlgorithm
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingOnlyWithDatabases.java
浏览文件 @
770340e8
...
...
@@ -20,7 +20,7 @@ package io.shardingsphere.example.jdbc.orche.main.java.etcd;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingOnlyWithDatabasesAndTables.java
浏览文件 @
770340e8
...
...
@@ -22,7 +22,7 @@ import io.shardingsphere.api.config.TableRuleConfiguration;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.example.algorithm.ModuloShardingTableAlgorithm
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/etcd/ShardingOnlyWithTables.java
浏览文件 @
770340e8
...
...
@@ -19,7 +19,7 @@ package io.shardingsphere.example.jdbc.orche.main.java.etcd;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/MasterSlaveOnly.java
浏览文件 @
770340e8
...
...
@@ -18,7 +18,7 @@
package
io.shardingsphere.example.jdbc.orche.main.java.zookeeper
;
import
io.shardingsphere.api.config.MasterSlaveRuleConfiguration
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingAndMasterSlaveTogether.java
浏览文件 @
770340e8
...
...
@@ -24,7 +24,7 @@ import io.shardingsphere.api.config.TableRuleConfiguration;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.example.algorithm.ModuloShardingDatabaseAlgorithm
;
import
io.shardingsphere.example.algorithm.ModuloShardingTableAlgorithm
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingOnlyWithDatabases.java
浏览文件 @
770340e8
...
...
@@ -20,7 +20,7 @@ package io.shardingsphere.example.jdbc.orche.main.java.zookeeper;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingOnlyWithDatabasesAndTables.java
浏览文件 @
770340e8
...
...
@@ -22,7 +22,7 @@ import io.shardingsphere.api.config.TableRuleConfiguration;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.example.algorithm.ModuloShardingTableAlgorithm
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/raw-jdbc-orche-example/src/main/java/io/shardingsphere/example/jdbc/orche/main/java/zookeeper/ShardingOnlyWithTables.java
浏览文件 @
770340e8
...
...
@@ -19,7 +19,7 @@ package io.shardingsphere.example.jdbc.orche.main.java.zookeeper;
import
io.shardingsphere.api.config.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.TableRuleConfiguration
;
import
io.shardingsphere.example.
jdbc.orche.util
.DataSourceUtil
;
import
io.shardingsphere.example.
config
.DataSourceUtil
;
import
io.shardingsphere.example.repository.api.service.CommonService
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderItemRepositoryImpl
;
import
io.shardingsphere.example.repository.jdbc.repository.JDBCOrderRepositoryImpl
;
...
...
sharding-jdbc-example/spring-boot-orche-example/spring-boot-orche-jpa-example/src/main/resources/application.properties
浏览文件 @
770340e8
...
...
@@ -22,4 +22,4 @@ spring.profiles.active=etcd-sharding-local
#spring.profiles.active=zookeeper-masterslave-local
#spring.profiles.active=zookeeper-masterslave-cloud
#spring.profiles.active=zookeeper-sharding-masterslave-local
#
spring.profiles.active
=
zookeeper-sharding-masterslave-cloud
\ No newline at end of file
#spring.profiles.active=zookeeper-sharding-masterslave-cloud
sharding-jdbc-example/spring-namespace-nodep-example/pom.xml
浏览文件 @
770340e8
...
...
@@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>
io.shardingsphere
</groupId>
<artifactId>
common-sharding-algorithm
</artifactId>
<artifactId>
example-utility
</artifactId>
<version>
${project.version}
</version>
</dependency>
...
...
sharding-jdbc-example/spring-namespace-orche-example/pom.xml
浏览文件 @
770340e8
...
...
@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>
io.shardingsphere
</groupId>
<artifactId>
common-sharding-algorithm
</artifactId>
<artifactId>
example-utility
</artifactId>
<version>
${project.version}
</version>
</dependency>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录