Merge pull request #15 from menghaoranss/7288

Load metadata from config center
diff --git a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/MetadataCenterService.java b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/MetadataCenterService.java
deleted file mode 100644
index 163bd51..0000000
--- a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/MetadataCenterService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.ui.servcie;
-
-import org.apache.shardingsphere.governance.core.metadata.MetaDataCenterNode;
-
-/**
- * Metadata center service.
- **/
-public interface MetadataCenterService {
-
-    /**
-     * Get activated metadata center node.
-     *
-     * @return metadata center node
-     */
-    MetaDataCenterNode getActivateMetaDataCenterNode();
-}
diff --git a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/MetadataCenterServiceImpl.java b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/MetadataCenterServiceImpl.java
deleted file mode 100644
index e58ae93..0000000
--- a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/MetadataCenterServiceImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.ui.servcie.impl;
-
-import org.apache.shardingsphere.governance.core.metadata.MetaDataCenterNode;
-import org.apache.shardingsphere.ui.common.domain.CenterConfig;
-import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException;
-import org.apache.shardingsphere.ui.servcie.CenterConfigService;
-import org.apache.shardingsphere.ui.servcie.MetadataCenterService;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.Optional;
-
-/**
- * Implementation of metadata center operation service.
- */
-@Service
-public final class MetadataCenterServiceImpl implements MetadataCenterService {
-
-    @Resource
-    private CenterConfigService centerConfigService;
-
-    @Override
-    public MetaDataCenterNode getActivateMetaDataCenterNode() {
-        Optional<CenterConfig> optional = centerConfigService.loadActivated();
-        if (optional.isPresent()) {
-            return new MetaDataCenterNode();
-        }
-        throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, "No activated metadata center!");
-    }
-}
diff --git a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/ShardingSchemaServiceImpl.java b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/ShardingSchemaServiceImpl.java
index 021d3ec..be41540 100644
--- a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/ShardingSchemaServiceImpl.java
+++ b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/ShardingSchemaServiceImpl.java
@@ -24,7 +24,6 @@
 import org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
 import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
 import org.apache.shardingsphere.ui.servcie.ConfigCenterService;
-import org.apache.shardingsphere.ui.servcie.MetadataCenterService;
 import org.apache.shardingsphere.ui.servcie.ShardingSchemaService;
 import org.apache.shardingsphere.ui.util.ConfigurationYamlConverter;
 import org.springframework.stereotype.Service;
@@ -44,9 +43,6 @@
     @Resource
     private ConfigCenterService configCenterService;
 
-    @Resource
-    private MetadataCenterService metadataCenterService;
-
     @Override
     public Collection<String> getAllSchemaNames() {
         return configCenterService.getActivatedConfigCenter().getChildrenKeys(configCenterService.getActivateConfigurationNode().getSchemasPath());
@@ -98,7 +94,7 @@
     @Override
     public String getMetadataConfiguration(final String schemaName) {
         return configCenterService.getActivatedConfigCenter().get(
-                metadataCenterService.getActivateMetaDataCenterNode().getMetaDataCenterNodeFullPath(schemaName));
+                configCenterService.getActivateConfigurationNode().getTablePath(schemaName));
     }
 
     private void checkRuleConfiguration(final String configData) {