Commit 0e6093e4 authored by cherrylzhao's avatar cherrylzhao
Browse files

CommonServiceImpl => OrderServiceImpl

parent b217c412
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -27,13 +27,13 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public final class CommonServiceImpl implements ExampleService {
public final class OrderServiceImpl implements ExampleService {
    
    private OrderRepository orderRepository;
    
    private OrderItemRepository orderItemRepository;
    
    public CommonServiceImpl(final OrderRepository orderRepository, final OrderItemRepository orderItemRepository) {
    public OrderServiceImpl(final OrderRepository orderRepository, final OrderItemRepository orderItemRepository) {
        this.orderRepository = orderRepository;
        this.orderItemRepository = orderItemRepository;
    }
+7 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.example.orchestration.raw.jdbc;

import org.apache.shardingsphere.example.core.jdbc.repository.OrderItemRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.repository.OrderRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.service.CommonServiceImpl;
import org.apache.shardingsphere.example.core.jdbc.service.OrderServiceImpl;
import org.apache.shardingsphere.example.core.api.service.ExampleService;
import org.apache.shardingsphere.example.config.ExampleConfiguration;
import org.apache.shardingsphere.example.orchestration.raw.jdbc.config.RegistryCenterConfigurationUtil;
@@ -56,10 +56,10 @@ public class JavaConfigurationExample {
    
    public static void main(final String[] args) throws Exception {
        DataSource dataSource = getDataSource(shardingType, loadConfigFromRegCenter);
        ExampleService commonService = getCommonService(dataSource);
        commonService.initEnvironment();
        commonService.processSuccess();
        commonService.cleanEnvironment();
        ExampleService exampleService = getExampleService(dataSource);
        exampleService.initEnvironment();
        exampleService.processSuccess();
        exampleService.cleanEnvironment();
        closeDataSource(dataSource);
    }
    
@@ -87,8 +87,8 @@ public class JavaConfigurationExample {
        return RegistryCenterType.ZOOKEEPER == registryCenterType ? RegistryCenterConfigurationUtil.getZooKeeperConfiguration() : RegistryCenterConfigurationUtil.getEtcdConfiguration();
    }
    
    private static ExampleService getCommonService(final DataSource dataSource) {
        return new CommonServiceImpl(new OrderRepositoryImpl(dataSource), new OrderItemRepositoryImpl(dataSource));
    private static ExampleService getExampleService(final DataSource dataSource) {
        return new OrderServiceImpl(new OrderRepositoryImpl(dataSource), new OrderItemRepositoryImpl(dataSource));
    }
    
    private static void closeDataSource(final DataSource dataSource) throws Exception {
+7 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.example.orchestration.raw.jdbc;

import org.apache.shardingsphere.example.core.jdbc.repository.OrderItemRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.repository.OrderRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.service.CommonServiceImpl;
import org.apache.shardingsphere.example.core.jdbc.service.OrderServiceImpl;
import org.apache.shardingsphere.example.core.api.service.ExampleService;
import org.apache.shardingsphere.example.type.RegistryCenterType;
import org.apache.shardingsphere.example.type.ShardingType;
@@ -52,10 +52,10 @@ public class YamlConfigurationExample {
    
    public static void main(final String[] args) throws Exception {
        DataSource dataSource = getDataSource(registryCenterType, loadConfigFromRegCenter, shardingType);
        ExampleService commonService = getCommonService(dataSource);
        commonService.initEnvironment();
        commonService.processSuccess();
        commonService.cleanEnvironment();
        ExampleService exampleService = getExampleService(dataSource);
        exampleService.initEnvironment();
        exampleService.processSuccess();
        exampleService.cleanEnvironment();
        closeDataSource(dataSource);
    }
    
@@ -80,8 +80,8 @@ public class YamlConfigurationExample {
        return new File(Thread.currentThread().getClass().getResource(fileName).getFile());
    }
    
    private static ExampleService getCommonService(final DataSource dataSource) {
        return new CommonServiceImpl(new OrderRepositoryImpl(dataSource), new OrderItemRepositoryImpl(dataSource));
    private static ExampleService getExampleService(final DataSource dataSource) {
        return new OrderServiceImpl(new OrderRepositoryImpl(dataSource), new OrderItemRepositoryImpl(dataSource));
    }
    
    private static void closeDataSource(final DataSource dataSource) throws Exception {
+2 −2
Original line number Diff line number Diff line
@@ -34,8 +34,8 @@ public class SpringBootExample {
    
    public static void main(final String[] args) throws SQLException {
        try (ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringBootExample.class, args)) {
            JPACommonService commonService = applicationContext.getBean(JPACommonService.class);
            commonService.processSuccess();
            JPACommonService exampleService = applicationContext.getBean(JPACommonService.class);
            exampleService.processSuccess();
        }
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -39,10 +39,10 @@ public class SpringNamespaceExample {
    
    public static void main(final String[] args) throws SQLException {
        try (ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(getApplicationFile())) {
            SpringPojoService commonService = applicationContext.getBean(SpringPojoService.class);
            commonService.initEnvironment();
            commonService.processSuccess();
            commonService.cleanEnvironment();
            SpringPojoService exampleService = applicationContext.getBean(SpringPojoService.class);
            exampleService.initEnvironment();
            exampleService.processSuccess();
            exampleService.cleanEnvironment();
        }
    }
    
Loading