Browse Source

Remove unused code

Yiming Liu 9 years ago
parent
commit
dfc172a1e6

+ 1 - 1
apollo-biz/pom.xml

@@ -9,7 +9,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>apollo-biz</artifactId>
-    <name>Apollo BizLogic</name>
+    <name>Apollo Biz</name>
     <packaging>jar</packaging>
 
     <dependencies>

+ 1 - 0
apollo-biz/src/main/resources/application.properties

@@ -2,3 +2,4 @@ spring.datasource.url = jdbc:h2:file:~/fxapolloconfigdb;mode=mysql
 spring.datasource.username = sa
 spring.datasource.password =
 spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.h2.console.enabled = true

+ 16 - 11
apollo-client/src/main/java/com/ctrip/apollo/client/loader/impl/RemoteConfigLoader.java

@@ -1,10 +1,15 @@
 package com.ctrip.apollo.client.loader.impl;
 
-import com.ctrip.apollo.client.loader.ConfigLoader;
-import com.ctrip.apollo.client.model.ApolloRegistry;
-import com.ctrip.apollo.client.util.ConfigUtil;
-import com.ctrip.apollo.core.model.ApolloConfig;
-import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.env.CompositePropertySource;
@@ -16,11 +21,11 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.util.StringUtils;
 import org.springframework.web.client.RestTemplate;
 
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicLong;
+import com.ctrip.apollo.client.loader.ConfigLoader;
+import com.ctrip.apollo.client.model.ApolloRegistry;
+import com.ctrip.apollo.client.util.ConfigUtil;
+import com.ctrip.apollo.core.model.ApolloConfig;
+import com.google.common.collect.Lists;
 
 /**
  * Load config from remote config server
@@ -116,7 +121,7 @@ public class RemoteConfigLoader implements ConfigLoader {
 
     ApolloConfig getRemoteConfig(RestTemplate restTemplate, String uri, long appId, String cluster, String version) {
         logger.info("Loading config from {}, appId={}, cluster={}, version={}", uri, appId, cluster, version);
-        String path = "/{appId}/{cluster}";
+        String path = "config/{appId}/{cluster}";
         Object[] args = new String[] {String.valueOf(appId), cluster};
         if (StringUtils.hasText(version)) {
             args = new String[] {String.valueOf(appId), cluster, version};

+ 0 - 22
apollo-configserver/pom.xml

@@ -18,17 +18,6 @@
 			<artifactId>apollo-biz</artifactId>
 		</dependency>
         <!-- end of apollo -->
-        <!-- web -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-tomcat</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <!-- end of web -->
         <!-- redis -->
         <dependency>
             <groupId>org.springframework.data</groupId>
@@ -45,17 +34,6 @@
 			<artifactId>spring-cloud-starter-eureka-server</artifactId>
 		</dependency>
         <!-- end of eureka -->
-        <!-- jsp -->
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>jstl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat.embed</groupId>
-            <artifactId>tomcat-embed-jasper</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <!-- end of jsp -->
 	</dependencies>
 	<build>
 		<plugins>

+ 0 - 47
apollo-configserver/src/main/java/com/ctrip/apollo/configserver/config/WebConfig.java

@@ -1,47 +0,0 @@
-package com.ctrip.apollo.configserver.config;
-
-import org.h2.server.web.WebServlet;
-import org.springframework.boot.context.embedded.ServletRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-import org.springframework.web.servlet.view.InternalResourceViewResolver;
-import org.springframework.web.servlet.view.JstlView;
-
-/**
- * @author Jason Song(song_s@ctrip.com)
- */
-@Configuration
-@EnableWebMvc
-public class WebConfig extends WebMvcConfigurerAdapter {
-    @Override
-    public void addViewControllers(ViewControllerRegistry registry) {
-        registry.addViewController("/").setViewName("welcome");
-        registry.addViewController("/index").setViewName("welcome");
-    }
-
-    @Bean
-    public InternalResourceViewResolver viewResolver() {
-        InternalResourceViewResolver viewResolver
-            = new InternalResourceViewResolver();
-        viewResolver.setViewClass(JstlView.class);
-        viewResolver.setPrefix("/WEB-INF/views/");
-        viewResolver.setSuffix(".jsp");
-        return viewResolver;
-    }
-
-    @Override
-    public void addResourceHandlers(ResourceHandlerRegistry registry) {
-        registry.addResourceHandler("/**").addResourceLocations("/");
-    }
-
-    @Bean
-    ServletRegistrationBean h2servletRegistration(){
-        ServletRegistrationBean registrationBean = new ServletRegistrationBean( new WebServlet());
-        registrationBean.addUrlMappings("/console/*");
-        return registrationBean;
-    }
-}

+ 1 - 0
apollo-configserver/src/main/java/com/ctrip/apollo/configserver/controller/ConfigController.java

@@ -16,6 +16,7 @@ import java.io.IOException;
  * @author Jason Song(song_s@ctrip.com)
  */
 @RestController
+@RequestMapping("/config")
 public class ConfigController {
     @Resource(name = "configService")
     private ConfigService configService;

+ 0 - 29
apollo-configserver/src/main/java/com/ctrip/apollo/configserver/service/DiscoveryService.java

@@ -1,29 +0,0 @@
-package com.ctrip.apollo.configserver.service;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.stereotype.Service;
-
-import com.ctrip.apollo.core.ServiceIdConsts;
-
-@Service
-public class DiscoveryService {
-
-  @Autowired
-  private DiscoveryClient discoveryClient;
-
-  public List<ServiceInstance> getConfigServerServiceInstances() {
-    List<ServiceInstance> instances =
-        discoveryClient.getInstances(ServiceIdConsts.APOLLO_CONFIGSERVER);
-    return instances;
-  }
-
-  public List<ServiceInstance> getMetaServerServiceInstances() {
-    List<ServiceInstance> instances =
-        discoveryClient.getInstances(ServiceIdConsts.APOLLO_METASERVER);
-    return instances;
-  }
-}

+ 1 - 1
apollo-configserver/src/main/resources/application.yml

@@ -1,7 +1,7 @@
 spring:
   application:
     name: apollo-configserver
-    
+
 server:
   port: 80
   

+ 0 - 10
apollo-configserver/src/main/webapp/WEB-INF/views/welcome.jsp

@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
-<html>
-<meta http-equiv=Content-Type content="text/html;charset=utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
-<title>Apollo Config Server</title>
-<body>
-<h2>Welcome to Apollo Config Server!</h2>
-</body>
-</html>

+ 0 - 21
apollo-configserver/src/test/java/com/ctrip/apollo/configserver/service/DiscoveryServiceTest.java

@@ -1,21 +0,0 @@
-package com.ctrip.apollo.configserver.service;
-
-import java.util.List;
-
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.client.ServiceInstance;
-
-import com.ctrip.apollo.configserver.AbstractConfigServerTest;
-
-public class DiscoveryServiceTest extends AbstractConfigServerTest {
-
-  @Autowired
-  private DiscoveryService discoveryService;
-
-  @Test
-  public void testGetLocalMetaServerServices() {
-    List<ServiceInstance> instances = discoveryService.getMetaServerServiceInstances();
-    System.out.println(instances);
-  }
-}