Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
3fd291a9
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,发现更多精彩内容 >>
未验证
提交
3fd291a9
编写于
5月 10, 2020
作者:
L
Liang Zhang
提交者:
GitHub
5月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename ShardingSchema to ShardingSphereSchema (#5514)
上级
eac2fd32
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
59 addition
and
58 deletion
+59
-58
sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java
...nal/datasource/OrchestrationShardingSphereDataSource.java
+4
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingSphereDataSourceTest.java
...datasource/OrchestrationShardingSphereDataSourceTest.java
+3
-3
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenterNode.java
...orchestration/core/registrycenter/RegistryCenterNode.java
+3
-3
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/event/DisabledStateChangedEvent.java
.../core/registrycenter/event/DisabledStateChangedEvent.java
+2
-2
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/DataSourceStateChangedListener.java
...gistrycenter/listener/DataSourceStateChangedListener.java
+2
-2
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationSchema.java
...ation/core/registrycenter/schema/OrchestrationSchema.java
+3
-3
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationShardingSchemaGroup.java
...gistrycenter/schema/OrchestrationShardingSchemaGroup.java
+1
-1
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/DataSourceStateChangedListenerTest.java
...rycenter/listener/DataSourceStateChangedListenerTest.java
+3
-3
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationShardingSchemaGroupTest.java
...rycenter/schema/OrchestrationShardingSchemaGroupTest.java
+4
-4
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationShardingSchemaTest.java
...egistrycenter/schema/OrchestrationShardingSchemaTest.java
+2
-2
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java
...d/communication/jdbc/JDBCDatabaseCommunicationEngine.java
+2
-2
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java
...cation/jdbc/wrapper/PreparedStatementExecutorWrapper.java
+2
-2
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java
.../communication/jdbc/wrapper/StatementExecutorWrapper.java
+2
-2
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchemaFactory.java
...here/shardingproxy/backend/schema/LogicSchemaFactory.java
+5
-5
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/impl/ShardingSphereSchema.java
...ardingproxy/backend/schema/impl/ShardingSphereSchema.java
+7
-7
sharding-proxy/sharding-proxy-backend/src/test/java/org/apache/shardingsphere/shardingproxy/backend/response/query/QueryHeaderTest.java
...shardingproxy/backend/response/query/QueryHeaderTest.java
+3
-3
shardingsphere-ui/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/ShardingSphereSchemaDTO.java
...shardingsphere/ui/common/dto/ShardingSphereSchemaDTO.java
+2
-2
shardingsphere-ui/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/controller/ShardingSchemaController.java
...ingsphere/ui/web/controller/ShardingSchemaController.java
+9
-8
未找到文件。
sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java
浏览文件 @
3fd291a9
...
...
@@ -31,7 +31,7 @@ import org.apache.shardingsphere.orchestration.core.configcenter.ConfigCenter;
import
org.apache.shardingsphere.orchestration.core.facade.ShardingOrchestrationFacade
;
import
org.apache.shardingsphere.orchestration.core.metadatacenter.event.MetaDataChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.event.DisabledStateChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
import
org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingSphereDataSource
;
import
org.apache.shardingsphere.shardingjdbc.orchestration.internal.util.DataSourceConverter
;
import
org.apache.shardingsphere.underlying.common.config.DataSourceConfiguration
;
...
...
@@ -143,11 +143,11 @@ public class OrchestrationShardingSphereDataSource extends AbstractOrchestration
*/
@Subscribe
public
synchronized
void
renew
(
final
DisabledStateChangedEvent
disabledStateChangedEvent
)
{
OrchestrationS
hardingSchema
shardingSchema
=
disabledStateChangedEvent
.
getSharding
Schema
();
if
(
DefaultSchema
.
LOGIC_NAME
.
equals
(
sharding
Schema
.
getSchemaName
()))
{
OrchestrationS
chema
orchestrationSchema
=
disabledStateChangedEvent
.
getOrchestration
Schema
();
if
(
DefaultSchema
.
LOGIC_NAME
.
equals
(
orchestration
Schema
.
getSchemaName
()))
{
for
(
ShardingSphereRule
each
:
dataSource
.
getRuntimeContext
().
getRules
())
{
if
(
each
instanceof
MasterSlaveRule
)
{
((
MasterSlaveRule
)
each
).
updateDisabledDataSourceNames
(
sharding
Schema
.
getDataSourceName
(),
disabledStateChangedEvent
.
isDisabled
());
((
MasterSlaveRule
)
each
).
updateDisabledDataSourceNames
(
orchestration
Schema
.
getDataSourceName
(),
disabledStateChangedEvent
.
isDisabled
());
}
}
}
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingSphereDataSourceTest.java
浏览文件 @
3fd291a9
...
...
@@ -31,7 +31,7 @@ import org.apache.shardingsphere.orchestration.core.common.event.DataSourceChang
import
org.apache.shardingsphere.orchestration.core.common.event.PropertiesChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.common.event.ShardingRuleChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.event.DisabledStateChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
import
org.apache.shardingsphere.shardingjdbc.api.yaml.YamlShardingSphereDataSourceFactory
;
import
org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingSphereDataSource
;
import
org.apache.shardingsphere.underlying.common.config.DataSourceConfiguration
;
...
...
@@ -167,7 +167,7 @@ public final class OrchestrationShardingSphereDataSourceTest {
}
private
DisabledStateChangedEvent
getDisabledStateChangedEvent
()
{
OrchestrationS
hardingSchema
shardingSchema
=
new
OrchestrationSharding
Schema
(
"logic_db.ds_s"
);
return
new
DisabledStateChangedEvent
(
sharding
Schema
,
true
);
OrchestrationS
chema
orchestrationSchema
=
new
Orchestration
Schema
(
"logic_db.ds_s"
);
return
new
DisabledStateChangedEvent
(
orchestration
Schema
,
true
);
}
}
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenterNode.java
浏览文件 @
3fd291a9
...
...
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.orchestration.core.registrycenter;
import
com.google.common.base.Joiner
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
/**
* RegistryCenter node.
...
...
@@ -70,7 +70,7 @@ public final class RegistryCenterNode {
* @param dataSourceNodeFullPath data source node full path
* @return orchestration sharding schema
*/
public
OrchestrationS
hardingS
chema
getOrchestrationShardingSchema
(
final
String
dataSourceNodeFullPath
)
{
return
new
OrchestrationS
hardingS
chema
(
dataSourceNodeFullPath
.
replace
(
getDataSourcesNodeFullRootPath
()
+
'/'
,
""
));
public
OrchestrationSchema
getOrchestrationShardingSchema
(
final
String
dataSourceNodeFullPath
)
{
return
new
OrchestrationSchema
(
dataSourceNodeFullPath
.
replace
(
getDataSourcesNodeFullRootPath
()
+
'/'
,
""
));
}
}
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/event/DisabledStateChangedEvent.java
浏览文件 @
3fd291a9
...
...
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.orchestration.core.registrycenter.event;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.shardingsphere.orchestration.core.common.event.ShardingOrchestrationEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
/**
* Disabled state event.
...
...
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.orchestration.core.registrycenter.schema.Orches
@Getter
public
final
class
DisabledStateChangedEvent
implements
ShardingOrchestrationEvent
{
private
final
OrchestrationS
hardingSchema
sharding
Schema
;
private
final
OrchestrationS
chema
orchestration
Schema
;
private
final
boolean
disabled
;
}
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/DataSourceStateChangedListener.java
浏览文件 @
3fd291a9
...
...
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.orchestration.core.common.listener.PostSharding
import
org.apache.shardingsphere.orchestration.core.registrycenter.event.DisabledStateChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.RegistryCenterNode
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.RegistryCenterNodeStatus
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
import
java.util.Collections
;
...
...
@@ -45,7 +45,7 @@ public final class DataSourceStateChangedListener extends PostShardingCenterRepo
return
new
DisabledStateChangedEvent
(
getShardingSchema
(
event
.
getKey
()),
isDataSourceDisabled
(
event
));
}
private
OrchestrationS
hardingS
chema
getShardingSchema
(
final
String
dataSourceNodeFullPath
)
{
private
OrchestrationSchema
getShardingSchema
(
final
String
dataSourceNodeFullPath
)
{
return
registryCenterNode
.
getOrchestrationShardingSchema
(
dataSourceNodeFullPath
);
}
...
...
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationS
hardingS
chema.java
→
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationSchema.java
浏览文件 @
3fd291a9
...
...
@@ -25,17 +25,17 @@ import org.apache.shardingsphere.underlying.common.database.DefaultSchema;
import
java.util.List
;
/**
* Orchestration s
harding s
chema.
* Orchestration schema.
*/
@RequiredArgsConstructor
@Getter
public
final
class
OrchestrationS
hardingS
chema
{
public
final
class
OrchestrationSchema
{
private
final
String
schemaName
;
private
final
String
dataSourceName
;
public
OrchestrationS
hardingS
chema
(
final
String
value
)
{
public
OrchestrationSchema
(
final
String
value
)
{
if
(
value
.
contains
(
"."
))
{
List
<
String
>
values
=
Splitter
.
on
(
"."
).
splitToList
(
value
);
schemaName
=
values
.
get
(
0
);
...
...
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationShardingSchemaGroup.java
浏览文件 @
3fd291a9
...
...
@@ -35,7 +35,7 @@ public final class OrchestrationShardingSchemaGroup {
*
* @param orchestrationShardingSchema orchestration sharding schema
*/
public
void
add
(
final
OrchestrationS
hardingS
chema
orchestrationShardingSchema
)
{
public
void
add
(
final
OrchestrationSchema
orchestrationShardingSchema
)
{
String
schemaName
=
orchestrationShardingSchema
.
getSchemaName
();
if
(!
schemaGroup
.
containsKey
(
schemaName
))
{
schemaGroup
.
put
(
schemaName
,
new
LinkedList
<>());
...
...
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/DataSourceStateChangedListenerTest.java
浏览文件 @
3fd291a9
...
...
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.orchestration.core.registrycenter.listener;
import
org.apache.shardingsphere.orchestration.center.RegistryCenterRepository
;
import
org.apache.shardingsphere.orchestration.center.listener.DataChangedEvent
;
import
org.apache.shardingsphere.orchestration.center.listener.DataChangedEvent.ChangedType
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -45,8 +45,8 @@ public final class DataSourceStateChangedListenerTest {
@Test
public
void
assertCreateShardingOrchestrationEvent
()
{
OrchestrationS
hardingSchema
expected
=
new
OrchestrationSharding
Schema
(
"master_slave_db"
,
"slave_ds_0"
);
OrchestrationS
chema
expected
=
new
Orchestration
Schema
(
"master_slave_db"
,
"slave_ds_0"
);
DataChangedEvent
dataChangedEvent
=
new
DataChangedEvent
(
"/test/registry/datasources/master_slave_db.slave_ds_0"
,
"disabled"
,
ChangedType
.
UPDATED
);
assertThat
(
dataSourceStateChangedListener
.
createShardingOrchestrationEvent
(
dataChangedEvent
).
get
Sharding
Schema
().
getSchemaName
(),
is
(
expected
.
getSchemaName
()));
assertThat
(
dataSourceStateChangedListener
.
createShardingOrchestrationEvent
(
dataChangedEvent
).
get
Orchestration
Schema
().
getSchemaName
(),
is
(
expected
.
getSchemaName
()));
}
}
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationShardingSchemaGroupTest.java
浏览文件 @
3fd291a9
...
...
@@ -30,8 +30,8 @@ public final class OrchestrationShardingSchemaGroupTest {
@Test
public
void
assertAddWithExistedSchemaName
()
{
OrchestrationShardingSchemaGroup
actual
=
new
OrchestrationShardingSchemaGroup
();
actual
.
add
(
new
OrchestrationS
hardingS
chema
(
"test_0.ds_0"
));
actual
.
add
(
new
OrchestrationS
hardingS
chema
(
"test_0.ds_1"
));
actual
.
add
(
new
OrchestrationSchema
(
"test_0.ds_0"
));
actual
.
add
(
new
OrchestrationSchema
(
"test_0.ds_1"
));
assertThat
(
actual
.
getDataSourceNames
(
"test_0"
).
size
(),
is
(
2
));
assertTrue
(
actual
.
getDataSourceNames
(
"test_0"
).
contains
(
"ds_0"
));
assertTrue
(
actual
.
getDataSourceNames
(
"test_0"
).
contains
(
"ds_1"
));
...
...
@@ -40,8 +40,8 @@ public final class OrchestrationShardingSchemaGroupTest {
@Test
public
void
assertAddWithoutExistedSchemaName
()
{
OrchestrationShardingSchemaGroup
actual
=
new
OrchestrationShardingSchemaGroup
();
actual
.
add
(
new
OrchestrationS
hardingS
chema
(
"test_0.ds_0"
));
actual
.
add
(
new
OrchestrationS
hardingS
chema
(
"test_1.ds_1"
));
actual
.
add
(
new
OrchestrationSchema
(
"test_0.ds_0"
));
actual
.
add
(
new
OrchestrationSchema
(
"test_1.ds_1"
));
assertThat
(
actual
.
getDataSourceNames
(
"test_0"
).
size
(),
is
(
1
));
assertTrue
(
actual
.
getDataSourceNames
(
"test_0"
).
contains
(
"ds_0"
));
assertThat
(
actual
.
getDataSourceNames
(
"test_1"
).
size
(),
is
(
1
));
...
...
sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/schema/OrchestrationShardingSchemaTest.java
浏览文件 @
3fd291a9
...
...
@@ -27,14 +27,14 @@ public final class OrchestrationShardingSchemaTest {
@Test
public
void
assertNewOrchestrationSchemaWithDataSourceNameOnly
()
{
OrchestrationS
hardingSchema
actual
=
new
OrchestrationSharding
Schema
(
"test_ds"
);
OrchestrationS
chema
actual
=
new
Orchestration
Schema
(
"test_ds"
);
assertThat
(
actual
.
getSchemaName
(),
is
(
DefaultSchema
.
LOGIC_NAME
));
assertThat
(
actual
.
getDataSourceName
(),
is
(
"test_ds"
));
}
@Test
public
void
assertNewOrchestrationSchemaWithSchemaNameAndDataSourceName
()
{
OrchestrationS
hardingSchema
actual
=
new
OrchestrationSharding
Schema
(
"test_schema.test_ds"
);
OrchestrationS
chema
actual
=
new
Orchestration
Schema
(
"test_schema.test_ds"
);
assertThat
(
actual
.
getSchemaName
(),
is
(
"test_schema"
));
assertThat
(
actual
.
getDataSourceName
(),
is
(
"test_ds"
));
}
...
...
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java
浏览文件 @
3fd291a9
...
...
@@ -31,7 +31,7 @@ import org.apache.shardingsphere.shardingproxy.backend.response.query.QueryRespo
import
org.apache.shardingsphere.shardingproxy.backend.response.update.UpdateResponse
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchemas
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingS
phereS
chema
;
import
org.apache.shardingsphere.shardingproxy.context.ShardingProxyContext
;
import
org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext
;
import
org.apache.shardingsphere.sql.parser.binder.type.TableAvailable
;
...
...
@@ -90,7 +90,7 @@ public final class JDBCDatabaseCommunicationEngine implements DatabaseCommunicat
}
response
=
executeEngine
.
execute
(
executionContext
);
// TODO refresh non-sharding table meta data
if
(
logicSchema
instanceof
ShardingSchema
)
{
if
(
logicSchema
instanceof
ShardingS
phereS
chema
)
{
logicSchema
.
refreshTableMetaData
(
executionContext
.
getSqlStatementContext
());
}
return
merge
(
executionContext
.
getSqlStatementContext
());
...
...
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java
浏览文件 @
3fd291a9
...
...
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.shadow.rewrite.judgement.ShadowJudgementEngine;
import
org.apache.shardingsphere.shadow.rewrite.judgement.impl.PreparedJudgementEngine
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShadowSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingS
phereS
chema
;
import
org.apache.shardingsphere.shardingproxy.context.ShardingProxyContext
;
import
org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory
;
import
org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData
;
...
...
@@ -69,7 +69,7 @@ public final class PreparedStatementExecutorWrapper implements JDBCExecutorWrapp
@Override
public
ExecutionContext
route
(
final
String
sql
)
{
if
(
logicSchema
instanceof
ShardingSchema
)
{
if
(
logicSchema
instanceof
ShardingS
phereS
chema
)
{
return
doShardingRoute
(
sql
);
}
if
(
logicSchema
instanceof
ShadowSchema
)
{
...
...
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java
浏览文件 @
3fd291a9
...
...
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.shadow.rewrite.judgement.ShadowJudgementEngine;
import
org.apache.shardingsphere.shadow.rewrite.judgement.impl.SimpleJudgementEngine
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShadowSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingS
phereS
chema
;
import
org.apache.shardingsphere.shardingproxy.context.ShardingProxyContext
;
import
org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory
;
import
org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData
;
...
...
@@ -66,7 +66,7 @@ public final class StatementExecutorWrapper implements JDBCExecutorWrapper {
@Override
public
ExecutionContext
route
(
final
String
sql
)
{
if
(
logicSchema
instanceof
ShardingSchema
)
{
if
(
logicSchema
instanceof
ShardingS
phereS
chema
)
{
return
doShardingRoute
(
sql
);
}
if
(
logicSchema
instanceof
ShadowSchema
)
{
...
...
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchemaFactory.java
浏览文件 @
3fd291a9
...
...
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.api.config.shadow.ShadowRuleConfiguration;
import
org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration
;
import
org.apache.shardingsphere.encrypt.api.EncryptRuleConfiguration
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShadowSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingS
phereS
chema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.TransparentSchema
;
import
org.apache.shardingsphere.shardingproxy.config.yaml.YamlDataSourceParameter
;
import
org.apache.shardingsphere.underlying.common.config.RuleConfiguration
;
...
...
@@ -52,20 +52,20 @@ public final class LogicSchemaFactory {
public
static
LogicSchema
newInstance
(
final
String
schemaName
,
final
Map
<
String
,
Map
<
String
,
YamlDataSourceParameter
>>
schemaDataSources
,
final
Collection
<
RuleConfiguration
>
ruleConfigurations
)
throws
SQLException
{
if
(
ruleConfigurations
.
size
()
>
1
)
{
return
new
ShardingSchema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
ruleConfigurations
);
return
new
ShardingS
phereS
chema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
ruleConfigurations
);
}
if
(
ruleConfigurations
.
isEmpty
())
{
return
new
TransparentSchema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
));
}
RuleConfiguration
ruleConfiguration
=
ruleConfigurations
.
iterator
().
next
();
if
(
ruleConfiguration
instanceof
ShardingRuleConfiguration
)
{
return
new
ShardingSchema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
Collections
.
singleton
(
ruleConfiguration
));
return
new
ShardingS
phereS
chema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
Collections
.
singleton
(
ruleConfiguration
));
}
if
(
ruleConfiguration
instanceof
MasterSlaveRuleConfiguration
)
{
return
new
ShardingSchema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
Collections
.
singleton
(
ruleConfiguration
));
return
new
ShardingS
phereS
chema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
Collections
.
singleton
(
ruleConfiguration
));
}
if
(
ruleConfiguration
instanceof
EncryptRuleConfiguration
)
{
return
new
ShardingSchema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
Collections
.
singleton
(
ruleConfiguration
));
return
new
ShardingS
phereS
chema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
Collections
.
singleton
(
ruleConfiguration
));
}
if
(
ruleConfiguration
instanceof
ShadowRuleConfiguration
)
{
return
new
ShadowSchema
(
schemaName
,
schemaDataSources
.
get
(
schemaName
),
(
ShadowRuleConfiguration
)
ruleConfiguration
);
...
...
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/impl/ShardingSchema.java
→
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/impl/ShardingS
phereS
chema.java
浏览文件 @
3fd291a9
...
...
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.core.rule.MasterSlaveRule;
import
org.apache.shardingsphere.orchestration.core.common.event.ShardingRuleChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.facade.ShardingOrchestrationFacade
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.event.DisabledStateChangedEvent
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationS
hardingS
chema
;
import
org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchemas
;
import
org.apache.shardingsphere.shardingproxy.config.yaml.YamlDataSourceParameter
;
...
...
@@ -43,11 +43,11 @@ import java.util.Map;
import
java.util.Optional
;
/**
* Sharding schema.
* Sharding
Sphere
schema.
*/
public
final
class
ShardingSchema
extends
LogicSchema
{
public
final
class
ShardingS
phereS
chema
extends
LogicSchema
{
public
ShardingSchema
(
final
String
name
,
final
Map
<
String
,
YamlDataSourceParameter
>
dataSources
,
final
Collection
<
RuleConfiguration
>
ruleConfigurations
)
throws
SQLException
{
public
ShardingS
phereS
chema
(
final
String
name
,
final
Map
<
String
,
YamlDataSourceParameter
>
dataSources
,
final
Collection
<
RuleConfiguration
>
ruleConfigurations
)
throws
SQLException
{
super
(
name
,
dataSources
,
ShardingSphereRulesBuilder
.
build
(
ruleConfigurations
,
dataSources
.
keySet
()));
}
...
...
@@ -71,11 +71,11 @@ public final class ShardingSchema extends LogicSchema {
*/
@Subscribe
public
synchronized
void
renew
(
final
DisabledStateChangedEvent
disabledStateChangedEvent
)
{
OrchestrationS
hardingSchema
shardingSchema
=
disabledStateChangedEvent
.
getSharding
Schema
();
if
(
getName
().
equals
(
sharding
Schema
.
getSchemaName
()))
{
OrchestrationS
chema
orchestrationSchema
=
disabledStateChangedEvent
.
getOrchestration
Schema
();
if
(
getName
().
equals
(
orchestration
Schema
.
getSchemaName
()))
{
for
(
ShardingSphereRule
each
:
getRules
())
{
if
(
each
instanceof
MasterSlaveRule
)
{
((
MasterSlaveRule
)
each
).
updateDisabledDataSourceNames
(
sharding
Schema
.
getDataSourceName
(),
disabledStateChangedEvent
.
isDisabled
());
((
MasterSlaveRule
)
each
).
updateDisabledDataSourceNames
(
orchestration
Schema
.
getDataSourceName
(),
disabledStateChangedEvent
.
isDisabled
());
}
}
}
...
...
sharding-proxy/sharding-proxy-backend/src/test/java/org/apache/shardingsphere/shardingproxy/backend/response/query/QueryHeaderTest.java
浏览文件 @
3fd291a9
...
...
@@ -18,7 +18,7 @@
package
org.apache.shardingsphere.shardingproxy.backend.response.query
;
import
org.apache.shardingsphere.core.rule.ShardingRule
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingSchema
;
import
org.apache.shardingsphere.shardingproxy.backend.schema.impl.ShardingS
phereS
chema
;
import
org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaData
;
import
org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaData
;
import
org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData
;
...
...
@@ -125,8 +125,8 @@ public final class QueryHeaderTest {
assertTrue
(
header
.
isAutoIncrement
());
}
private
ShardingSchema
getShardingSchema
()
{
ShardingS
chema
result
=
mock
(
Sharding
Schema
.
class
);
private
ShardingS
phereS
chema
getShardingSchema
()
{
ShardingS
phereSchema
result
=
mock
(
ShardingSphere
Schema
.
class
);
ColumnMetaData
columnMetaData
=
new
ColumnMetaData
(
"order_id"
,
Types
.
INTEGER
,
"int"
,
true
,
false
,
false
);
SchemaMetaData
schemaMetaData
=
mock
(
SchemaMetaData
.
class
);
when
(
schemaMetaData
.
get
(
"t_logic_order"
)).
thenReturn
(
new
TableMetaData
(
Collections
.
singletonList
(
columnMetaData
),
Collections
.
singletonList
(
new
IndexMetaData
(
"order_id"
))));
...
...
shardingsphere-ui/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/ShardingSchemaDTO.java
→
shardingsphere-ui/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/ShardingS
phereS
chemaDTO.java
浏览文件 @
3fd291a9
...
...
@@ -23,13 +23,13 @@ import lombok.NoArgsConstructor;
import
lombok.Setter
;
/**
* Sharding schema DTO.
* Sharding
Sphere
schema DTO.
*/
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public
final
class
ShardingSchemaDTO
{
public
final
class
ShardingS
phereS
chemaDTO
{
private
String
name
;
...
...
shardingsphere-ui/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/controller/ShardingSchemaController.java
浏览文件 @
3fd291a9
...
...
@@ -17,17 +17,17 @@
package
org.apache.shardingsphere.ui.web.controller
;
import
org.apache.shardingsphere.ui.common.dto.ShardingSchemaDTO
;
import
org.apache.shardingsphere.ui.common.dto.ShardingS
phereS
chemaDTO
;
import
org.apache.shardingsphere.ui.servcie.ShardingSchemaService
;
import
org.apache.shardingsphere.ui.web.response.ResponseResult
;
import
org.apache.shardingsphere.ui.web.response.ResponseResultUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.Collection
;
import
java.util.Map
;
...
...
@@ -38,7 +38,7 @@ import java.util.Map;
@RequestMapping
(
"/api/schema"
)
public
final
class
ShardingSchemaController
{
@
Autowired
@
Resource
private
ShardingSchemaService
shardingSchemaService
;
/**
...
...
@@ -54,19 +54,20 @@ public final class ShardingSchemaController {
/**
* Add schema configuration.
*
* @param s
hardingSchema sharding schema DTO.
* @param s
chemaDTO schema DTO
* @return response result
*/
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
public
ResponseResult
addSchema
(
final
@RequestBody
ShardingS
chemaDTO
shardingSchema
)
{
shardingSchemaService
.
addSchemaConfiguration
(
s
hardingSchema
.
getName
(),
shardingSchema
.
getRuleConfiguration
(),
shardingSchema
.
getDataSourceConfiguration
());
public
ResponseResult
addSchema
(
final
@RequestBody
ShardingS
phereSchemaDTO
schemaDTO
)
{
shardingSchemaService
.
addSchemaConfiguration
(
s
chemaDTO
.
getName
(),
schemaDTO
.
getRuleConfiguration
(),
schemaDTO
.
getDataSourceConfiguration
());
return
ResponseResultUtil
.
success
();
}
/**
* Delete schema configuration
* Delete schema configuration.
*
* @param schemaName schema name
* @return
* @return
response result
*/
@RequestMapping
(
value
=
"/{schemaName}"
,
method
=
RequestMethod
.
DELETE
)
public
ResponseResult
deleteSchema
(
@PathVariable
(
"schemaName"
)
final
String
schemaName
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录