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
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
20 additions
and
141 deletions
+20
-141
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
+0
-0
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 @@
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-biz
</artifactId>
<name>
Apollo Biz
Logic
</name>
<name>
Apollo Biz
</name>
<packaging>
jar
</packaging>
<dependencies>
...
...
apollo-biz/src/main/resources/application.properties
View file @
dfc172a1
...
...
@@ -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
\ 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
;
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
};
...
...
apollo-configserver/pom.xml
View file @
dfc172a1
...
...
@@ -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>
...
...
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;
* @author Jason Song(song_s@ctrip.com)
*/
@RestController
@RequestMapping
(
"/config"
)
public
class
ConfigController
{
@Resource
(
name
=
"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
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