Commit 1068abe3 by Yiming Liu

Rename Server to Service

parent cff6c15f
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>apollo-configadmin</artifactId> <artifactId>apollo-adminservice</artifactId>
<name>Apollo ConfigAdmin</name> <name>Apollo AdminService</name>
<dependencies> <dependencies>
<!-- apollo --> <!-- apollo -->
<dependency> <dependency>
......
package com.ctrip.apollo.configadmin; package com.ctrip.apollo.adminservice;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
......
spring: spring:
application: application:
name: apollo-configadmin name: apollo-adminservice
server: server:
port: ${port:8080} port: ${port:8080}
...@@ -8,5 +8,5 @@ server: ...@@ -8,5 +8,5 @@ server:
logging: logging:
level: level:
org.springframework.cloud: 'DEBUG' org.springframework.cloud: 'DEBUG'
file: /opt/logs/apollo-configadmin.log file: /opt/logs/apollo-adminservice.log
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>apollo-configserver</artifactId> <artifactId>apollo-configservice</artifactId>
<name>Apollo ConfigServer</name> <name>Apollo ConfigService</name>
<packaging>war</packaging>
<dependencies> <dependencies>
<!-- apollo --> <!-- apollo -->
<dependency> <dependency>
......
package com.ctrip.apollo.configserver.controller; package com.ctrip.apollo.configservice.controller;
import com.ctrip.apollo.biz.entity.Version; import com.ctrip.apollo.biz.entity.Version;
import com.ctrip.apollo.biz.service.ConfigService; import com.ctrip.apollo.biz.service.ConfigService;
......
package com.ctrip.apollo.metaserver.controller; package com.ctrip.apollo.metaservice.controller;
import java.util.List; import java.util.List;
...@@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ctrip.apollo.metaserver.service.DiscoveryService; import com.ctrip.apollo.metaservice.service.DiscoveryService;
import com.netflix.appinfo.InstanceInfo; import com.netflix.appinfo.InstanceInfo;
@RestController @RestController
...@@ -18,12 +18,17 @@ public class ServiceController { ...@@ -18,12 +18,17 @@ public class ServiceController {
@RequestMapping("/meta") @RequestMapping("/meta")
public List<InstanceInfo> metaServer() { public List<InstanceInfo> getMetaService() {
return discoveryService.getMetaServerServiceInstance(); return discoveryService.getMetaServiceInstances();
} }
@RequestMapping("/config") @RequestMapping("/config")
public List<InstanceInfo> configServer() { public List<InstanceInfo> getConfigService() {
return discoveryService.getConfigServerServiceInstance(); return discoveryService.getConfigServiceInstances();
}
@RequestMapping("/admin")
public List<InstanceInfo> getAdminService(){
return discoveryService.getAdminServiceInstances();
} }
} }
package com.ctrip.apollo.metaserver.service; package com.ctrip.apollo.metaservice.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -17,14 +17,18 @@ public class DiscoveryService { ...@@ -17,14 +17,18 @@ public class DiscoveryService {
@Autowired @Autowired
private EurekaClient eurekaClient; private EurekaClient eurekaClient;
public List<InstanceInfo> getConfigServerServiceInstance() { public List<InstanceInfo> getConfigServiceInstances() {
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_CONFIGSERVER); Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_CONFIGSERVICE);
return application != null ? application.getInstances() : new ArrayList<>(); return application != null ? application.getInstances() : new ArrayList<>();
} }
public List<InstanceInfo> getMetaServerServiceInstance() { public List<InstanceInfo> getMetaServiceInstances() {
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_METASERVER); Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_METASERVICE);
return application != null ? application.getInstances() : new ArrayList<>(); return application != null ? application.getInstances() : new ArrayList<>();
} }
public List<InstanceInfo> getAdminServiceInstances(){
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_ADMINSERVICE);
return application != null ? application.getInstances() : new ArrayList<>();
}
} }
spring: spring:
application: application:
name: apollo-configserver name: apollo-configservice
server: server:
port: ${port:80} port: ${port:80}
...@@ -8,5 +8,5 @@ server: ...@@ -8,5 +8,5 @@ server:
logging: logging:
level: level:
org.springframework.cloud: 'DEBUG' org.springframework.cloud: 'DEBUG'
file: /opt/logs/apollo-configserver.log file: /opt/logs/apollo-configservice.log
package com.ctrip.apollo.configserver; package com.ctrip.apollo.configservice;
import com.ctrip.apollo.ServerApplication; import com.ctrip.apollo.ServerApplication;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -7,6 +7,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -7,6 +7,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ServerApplication.class) @SpringApplicationConfiguration(classes = ServerApplication.class)
public abstract class AbstractConfigServerTest { public abstract class AbstractConfigServiceTest {
} }
package com.ctrip.apollo.configserver; package com.ctrip.apollo.configservice;
import com.ctrip.apollo.configserver.controller.ConfigControllerTest;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses; import org.junit.runners.Suite.SuiteClasses;
import com.ctrip.apollo.configservice.controller.ConfigControllerTest;
@RunWith(Suite.class) @RunWith(Suite.class)
@SuiteClasses({ @SuiteClasses({
ConfigControllerTest.class ConfigControllerTest.class
......
package com.ctrip.apollo.configserver.controller; package com.ctrip.apollo.configservice.controller;
import com.ctrip.apollo.biz.entity.Version; import com.ctrip.apollo.biz.entity.Version;
import com.ctrip.apollo.biz.service.ConfigService; import com.ctrip.apollo.biz.service.ConfigService;
import com.ctrip.apollo.configservice.controller.ConfigController;
import com.ctrip.apollo.core.dto.ApolloConfig; import com.ctrip.apollo.core.dto.ApolloConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
......
...@@ -7,7 +7,7 @@ logging: ...@@ -7,7 +7,7 @@ logging:
spring: spring:
application: application:
name: apollo-configserver name: apollo-configservice
datasource: datasource:
url: jdbc:h2:file:~/fxapolloconfigdb;DB_CLOSE_ON_EXIT=FALSE url: jdbc:h2:file:~/fxapolloconfigdb;DB_CLOSE_ON_EXIT=FALSE
username: sa username: sa
......
...@@ -2,9 +2,11 @@ package com.ctrip.apollo.core; ...@@ -2,9 +2,11 @@ package com.ctrip.apollo.core;
public class ServiceIdConsts { public class ServiceIdConsts {
public static final String APOLLO_METASERVER = "apollo-metaserver"; public static final String APOLLO_METASERVICE = "apollo-metaservice";
public static final String APOLLO_CONFIGSERVER = "apollo-configserver"; public static final String APOLLO_CONFIGSERVICE = "apollo-configservice";
public static final String APOLLO_ADMINSERVICE = "apollo-adminservice";
public static final String APOLLO_PORTAL = "apollo-portal"; public static final String APOLLO_PORTAL = "apollo-portal";
} }
...@@ -67,8 +67,8 @@ ...@@ -67,8 +67,8 @@
<module>apollo-core</module> <module>apollo-core</module>
<module>apollo-client</module> <module>apollo-client</module>
<module>apollo-biz</module> <module>apollo-biz</module>
<module>apollo-configserver</module> <module>apollo-configservice</module>
<module>apollo-configadmin</module> <module>apollo-adminservice</module>
<module>apollo-portal</module> <module>apollo-portal</module>
<module>apollo-demo</module> <module>apollo-demo</module>
</modules> </modules>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment