Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
dfc172a1
Commit
dfc172a1
authored
Mar 22, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code
parent
53ed6342
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
21 additions
and
142 deletions
+21
-142
pom.xml
apollo-biz/pom.xml
+1
-1
application.properties
apollo-biz/src/main/resources/application.properties
+2
-0
RemoteConfigLoader.java
...m/ctrip/apollo/client/loader/impl/RemoteConfigLoader.java
+16
-11
pom.xml
apollo-configserver/pom.xml
+0
-22
WebConfig.java
.../java/com/ctrip/apollo/configserver/config/WebConfig.java
+0
-47
ConfigController.java
...trip/apollo/configserver/controller/ConfigController.java
+1
-0
DiscoveryService.java
...m/ctrip/apollo/configserver/service/DiscoveryService.java
+0
-29
application.yml
apollo-configserver/src/main/resources/application.yml
+1
-1
welcome.jsp
...lo-configserver/src/main/webapp/WEB-INF/views/welcome.jsp
+0
-10
DiscoveryServiceTest.java
...rip/apollo/configserver/service/DiscoveryServiceTest.java
+0
-21
No files found.
apollo-biz/pom.xml
View file @
dfc172a1
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-biz
</artifactId>
<artifactId>
apollo-biz
</artifactId>
<name>
Apollo Biz
Logic
</name>
<name>
Apollo Biz
</name>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<dependencies>
<dependencies>
...
...
apollo-biz/src/main/resources/application.properties
View file @
dfc172a1
...
@@ -2,3 +2,4 @@ spring.datasource.url = jdbc:h2:file:~/fxapolloconfigdb;mode=mysql
...
@@ -2,3 +2,4 @@ spring.datasource.url = jdbc:h2:file:~/fxapolloconfigdb;mode=mysql
spring.datasource.username
=
sa
spring.datasource.username
=
sa
spring.datasource.password
=
spring.datasource.password
=
spring.jpa.hibernate.naming_strategy
=
org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.hibernate.naming_strategy
=
org.hibernate.cfg.EJB3NamingStrategy
spring.h2.console.enabled
=
true
\ No newline at end of file
apollo-client/src/main/java/com/ctrip/apollo/client/loader/impl/RemoteConfigLoader.java
View file @
dfc172a1
package
com
.
ctrip
.
apollo
.
client
.
loader
.
impl
;
package
com
.
ctrip
.
apollo
.
client
.
loader
.
impl
;
import
com.ctrip.apollo.client.loader.ConfigLoader
;
import
java.io.IOException
;
import
com.ctrip.apollo.client.model.ApolloRegistry
;
import
java.util.List
;
import
com.ctrip.apollo.client.util.ConfigUtil
;
import
java.util.concurrent.Callable
;
import
com.ctrip.apollo.core.model.ApolloConfig
;
import
java.util.concurrent.ExecutionException
;
import
com.google.common.collect.Lists
;
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.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.env.CompositePropertySource
;
import
org.springframework.core.env.CompositePropertySource
;
...
@@ -16,11 +21,11 @@ import org.springframework.http.ResponseEntity;
...
@@ -16,11 +21,11 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
import
com.ctrip.apollo.client.loader.ConfigLoader
;
import
java.util.List
;
import
com.ctrip.apollo.client.model.ApolloRegistry
;
import
java.util.Map
;
import
com.ctrip.apollo.client.util.ConfigUtil
;
import
java.util.concurrent.*
;
import
com.ctrip.apollo.core.model.ApolloConfig
;
import
java.util.concurrent.atomic.AtomicLong
;
import
com.google.common.collect.Lists
;
/**
/**
* Load config from remote config server
* Load config from remote config server
...
@@ -116,7 +121,7 @@ public class RemoteConfigLoader implements ConfigLoader {
...
@@ -116,7 +121,7 @@ public class RemoteConfigLoader implements ConfigLoader {
ApolloConfig
getRemoteConfig
(
RestTemplate
restTemplate
,
String
uri
,
long
appId
,
String
cluster
,
String
version
)
{
ApolloConfig
getRemoteConfig
(
RestTemplate
restTemplate
,
String
uri
,
long
appId
,
String
cluster
,
String
version
)
{
logger
.
info
(
"Loading config from {}, appId={}, cluster={}, version={}"
,
uri
,
appId
,
cluster
,
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
};
Object
[]
args
=
new
String
[]
{
String
.
valueOf
(
appId
),
cluster
};
if
(
StringUtils
.
hasText
(
version
))
{
if
(
StringUtils
.
hasText
(
version
))
{
args
=
new
String
[]
{
String
.
valueOf
(
appId
),
cluster
,
version
};
args
=
new
String
[]
{
String
.
valueOf
(
appId
),
cluster
,
version
};
...
...
apollo-configserver/pom.xml
View file @
dfc172a1
...
@@ -18,17 +18,6 @@
...
@@ -18,17 +18,6 @@
<artifactId>
apollo-biz
</artifactId>
<artifactId>
apollo-biz
</artifactId>
</dependency>
</dependency>
<!-- end of apollo -->
<!-- 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 -->
<!-- redis -->
<dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<groupId>
org.springframework.data
</groupId>
...
@@ -45,17 +34,6 @@
...
@@ -45,17 +34,6 @@
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
</dependency>
</dependency>
<!-- end of eureka -->
<!-- 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>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
...
apollo-configserver/src/main/java/com/ctrip/apollo/configserver/config/WebConfig.java
deleted
100644 → 0
View file @
53ed6342
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
;
}
}
apollo-configserver/src/main/java/com/ctrip/apollo/configserver/controller/ConfigController.java
View file @
dfc172a1
...
@@ -16,6 +16,7 @@ import java.io.IOException;
...
@@ -16,6 +16,7 @@ import java.io.IOException;
* @author Jason Song(song_s@ctrip.com)
* @author Jason Song(song_s@ctrip.com)
*/
*/
@RestController
@RestController
@RequestMapping
(
"/config"
)
public
class
ConfigController
{
public
class
ConfigController
{
@Resource
(
name
=
"configService"
)
@Resource
(
name
=
"configService"
)
private
ConfigService
configService
;
private
ConfigService
configService
;
...
...
apollo-configserver/src/main/java/com/ctrip/apollo/configserver/service/DiscoveryService.java
deleted
100644 → 0
View file @
53ed6342
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
;
}
}
apollo-configserver/src/main/resources/application.yml
View file @
dfc172a1
spring
:
spring
:
application
:
application
:
name
:
apollo-configserver
name
:
apollo-configserver
server
:
server
:
port
:
80
port
:
80
...
...
apollo-configserver/src/main/webapp/WEB-INF/views/welcome.jsp
deleted
100644 → 0
View file @
53ed6342
<!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>
apollo-configserver/src/test/java/com/ctrip/apollo/configserver/service/DiscoveryServiceTest.java
deleted
100644 → 0
View file @
53ed6342
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment