Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
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
spring-cloud-netflix
Commits
e42328fa
Commit
e42328fa
authored
Jul 14, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler warnings
parent
0f85b5ac
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
169 additions
and
62 deletions
+169
-62
pom.xml
pom.xml
+16
-0
pom.xml
spring-platform-netflix-core/pom.xml
+4
-4
ConfigurableEnvironmentConfiguration.java
...etflix/archaius/ConfigurableEnvironmentConfiguration.java
+15
-5
CircuitBreakerConfiguration.java
...m/netflix/circuitbreaker/CircuitBreakerConfiguration.java
+1
-1
ServletWrappingEndpoint.java
...rk/platform/netflix/endpoint/ServletWrappingEndpoint.java
+1
-1
EurekaRegistryAvailableEvent.java
...platform/netflix/eureka/EurekaRegistryAvailableEvent.java
+36
-0
EurekaServerAutoConfiguration.java
...latform/netflix/eureka/EurekaServerAutoConfiguration.java
+4
-0
EurekaServerStartedEvent.java
...ork/platform/netflix/eureka/EurekaServerStartedEvent.java
+36
-0
FeignBase.java
...org/springframework/platform/netflix/feign/FeignBase.java
+8
-6
SpringDecoder.java
...springframework/platform/netflix/feign/SpringDecoder.java
+17
-16
SpringEncoder.java
...springframework/platform/netflix/feign/SpringEncoder.java
+19
-11
SpringMvcContract.java
...ngframework/platform/netflix/feign/SpringMvcContract.java
+6
-6
application.yml
...-platform-netflix-core/src/test/resources/application.yml
+2
-0
pom.xml
spring-platform-netflix-hystrix/pom.xml
+4
-12
No files found.
pom.xml
View file @
e42328fa
...
...
@@ -35,6 +35,12 @@
<groupId>
com.netflix.archaius
</groupId>
<artifactId>
archaius-core
</artifactId>
<version>
${archaius.version}
</version>
<exclusions>
<exclusion>
<artifactId>
commons-logging
</artifactId>
<groupId>
commons-logging
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.netflix.eureka
</groupId>
...
...
@@ -45,6 +51,16 @@
<groupId>
com.netflix.eureka
</groupId>
<artifactId>
eureka-core
</artifactId>
<version>
${eureka.version}
</version>
<exclusions>
<exclusion>
<artifactId>
commons-logging
</artifactId>
<groupId>
commons-logging
</groupId>
</exclusion>
<exclusion>
<artifactId>
log4j
</artifactId>
<groupId>
log4j
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.netflix.feign
</groupId>
...
...
spring-platform-netflix-core/pom.xml
View file @
e42328fa
...
...
@@ -54,10 +54,8 @@
<groupId>
com.netflix.feign
</groupId>
<artifactId>
feign-ribbon
</artifactId>
</dependency>
<!--<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-slf4j</artifactId>
</dependency>-->
<!--<dependency> <groupId>com.netflix.feign</groupId> <artifactId>feign-slf4j</artifactId>
</dependency> -->
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-core
</artifactId>
...
...
@@ -86,6 +84,8 @@
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<!-- Only needed at compile time -->
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/archaius/ConfigurableEnvironmentConfiguration.java
View file @
e42328fa
package
org
.
springframework
.
platform
.
netflix
.
archaius
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.commons.configuration.AbstractConfiguration
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.*
;
import
org.springframework.core.env.CompositePropertySource
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
org.springframework.core.env.EnumerablePropertySource
;
import
org.springframework.core.env.MutablePropertySources
;
import
org.springframework.core.env.PropertySource
;
import
org.springframework.core.env.StandardEnvironment
;
import
org.springframework.util.ReflectionUtils
;
import
java.lang.reflect.Field
;
import
java.util.*
;
/**
* Created by sgibb on 6/27/14.
*/
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java
View file @
e42328fa
...
...
@@ -50,7 +50,7 @@ public class CircuitBreakerConfiguration implements ImportAware {
throw
new
IllegalStateException
(
"Only one TransactionManagementConfigurer may exist"
);
}
//TODO: create CircuitBreakerConfigurer API
CircuitBreakerConfigurer
configurer
=
configurers
.
iterator
().
next
();
//
CircuitBreakerConfigurer configurer = configurers.iterator().next();
//this.txManager = configurer.annotationDrivenTransactionManager();
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/endpoint/ServletWrappingEndpoint.java
View file @
e42328fa
...
...
@@ -70,7 +70,7 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
}
@Override
public
Class
<?
extends
Endpoint
>
getEndpointType
()
{
public
Class
<?
extends
Endpoint
<?>
>
getEndpointType
()
{
return
null
;
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaRegistryAvailableEvent.java
0 → 100644
View file @
e42328fa
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
platform
.
netflix
.
eureka
;
import
org.springframework.context.ApplicationEvent
;
import
com.netflix.eureka.EurekaServerConfig
;
/**
* @author Dave Syer
*
*/
@SuppressWarnings
(
"serial"
)
public
class
EurekaRegistryAvailableEvent
extends
ApplicationEvent
{
/**
* @param eurekaServerConfig
*/
public
EurekaRegistryAvailableEvent
(
EurekaServerConfig
eurekaServerConfig
)
{
super
(
eurekaServerConfig
);
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java
View file @
e42328fa
...
...
@@ -31,6 +31,7 @@ import com.netflix.blitz4j.LoggingConfiguration;
import
com.netflix.eureka.EurekaBootStrap
;
import
com.netflix.eureka.EurekaServerConfig
;
import
com.netflix.eureka.EurekaServerConfigurationManager
;
import
com.netflix.eureka.PeerAwareInstanceRegistry
;
/**
* @author Dave Syer
...
...
@@ -69,9 +70,12 @@ public class EurekaServerAutoConfiguration implements ServletContextAware,
LoggingConfiguration
.
getInstance
().
configure
();
EurekaServerConfigurationManager
.
getInstance
()
.
setConfiguration
(
eurekaServerConfig
);
PeerAwareInstanceRegistry
.
getInstance
();
applicationContext
.
publishEvent
(
new
EurekaRegistryAvailableEvent
(
eurekaServerConfig
));
}
}.
contextInitialized
(
new
ServletContextEvent
(
servletContext
));
running
=
true
;
applicationContext
.
publishEvent
(
new
EurekaServerStartedEvent
(
eurekaServerConfig
));
}
}).
start
();
}
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerStartedEvent.java
0 → 100644
View file @
e42328fa
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
platform
.
netflix
.
eureka
;
import
org.springframework.context.ApplicationEvent
;
import
com.netflix.eureka.EurekaServerConfig
;
/**
* @author Dave Syer
*
*/
@SuppressWarnings
(
"serial"
)
public
class
EurekaServerStartedEvent
extends
ApplicationEvent
{
/**
* @param eurekaServerConfig
*/
public
EurekaServerStartedEvent
(
EurekaServerConfig
eurekaServerConfig
)
{
super
(
eurekaServerConfig
);
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/FeignBase.java
View file @
e42328fa
package
org
.
springframework
.
platform
.
netflix
.
feign
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
javax.xml.transform.Source
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.converter.ByteArrayHttpMessageConverter
;
import
org.springframework.http.converter.HttpMessageConverter
;
...
...
@@ -14,12 +21,6 @@ import org.springframework.http.converter.xml.SourceHttpMessageConverter;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
javax.xml.transform.Source
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by sgibb on 6/27/14.
*/
...
...
@@ -54,6 +55,7 @@ public class FeignBase {
this
.
messageConverters
.
addAll
(
messageConverters
);
}
@SuppressWarnings
(
"deprecation"
)
protected
void
addDefaultConverters
(
List
<
HttpMessageConverter
<?>>
messageConverters
)
{
messageConverters
.
add
(
new
ByteArrayHttpMessageConverter
());
messageConverters
.
add
(
new
StringHttpMessageConverter
());
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringDecoder.java
View file @
e42328fa
package
org
.
springframework
.
platform
.
netflix
.
feign
;
import
feign.FeignException
;
import
feign.Response
;
import
feign.codec.DecodeException
;
import
feign.codec.Decoder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.lang.reflect.Type
;
import
java.util.List
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.web.client.HttpMessageConverterExtractor
;
import
java.io.IO
Exception
;
import
java.io.InputStream
;
import
java.lang.reflect.Type
;
import
java.util.List
;
import
feign.Feign
Exception
;
import
feign.Response
;
import
feign.codec.DecodeException
;
import
feign.codec.Decoder
;
/**
* Created by sgibb on 6/26/14.
*/
public
class
SpringDecoder
extends
FeignBase
implements
Decoder
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SpringDecoder
.
class
);
public
SpringDecoder
()
{
}
...
...
@@ -31,15 +29,17 @@ public class SpringDecoder extends FeignBase implements Decoder {
}
@Override
public
Object
decode
(
final
Response
response
,
Type
type
)
throws
IOException
,
DecodeException
,
FeignException
{
public
Object
decode
(
final
Response
response
,
Type
type
)
throws
IOException
,
DecodeException
,
FeignException
{
if
(
type
instanceof
Class
)
{
HttpMessageConverterExtractor
<?>
extractor
=
new
HttpMessageConverterExtractor
((
Class
<?>)
type
,
getMessageConverters
());
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
HttpMessageConverterExtractor
<?>
extractor
=
new
HttpMessageConverterExtractor
(
(
Class
<?>)
type
,
getMessageConverters
());
Object
data
=
extractor
.
extractData
(
new
FeignResponseAdapter
(
response
));
return
data
;
}
throw
new
DecodeException
(
"type is not an instance of Class: "
+
type
);
throw
new
DecodeException
(
"type is not an instance of Class: "
+
type
);
}
private
class
FeignResponseAdapter
implements
ClientHttpResponse
{
...
...
@@ -68,7 +68,8 @@ public class SpringDecoder extends FeignBase implements Decoder {
public
void
close
()
{
try
{
response
.
body
().
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringEncoder.java
View file @
e42328fa
package
org
.
springframework
.
platform
.
netflix
.
feign
;
import
com.google.common.base.Charsets
;
import
feign.RequestTemplate
;
import
feign.codec.EncodeException
;
import
feign.codec.Encoder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpHeaders
;
...
...
@@ -31,8 +33,9 @@ public class SpringEncoder extends FeignBase implements Encoder {
}
@Override
public
void
encode
(
Object
requestBody
,
RequestTemplate
request
)
throws
EncodeException
{
//template.body(conversionService.convert(object, String.class));
public
void
encode
(
Object
requestBody
,
RequestTemplate
request
)
throws
EncodeException
{
// template.body(conversionService.convert(object, String.class));
if
(
requestBody
!=
null
)
{
Class
<?>
requestType
=
requestBody
.
getClass
();
Collection
<
String
>
contentTypes
=
request
.
headers
().
get
(
"Content-Type"
);
...
...
@@ -47,28 +50,33 @@ public class SpringEncoder extends FeignBase implements Encoder {
if
(
messageConverter
.
canWrite
(
requestType
,
requestContentType
))
{
if
(
logger
.
isDebugEnabled
())
{
if
(
requestContentType
!=
null
)
{
logger
.
debug
(
"Writing ["
+
requestBody
+
"] as \""
+
requestContentType
+
"\" using ["
+
messageConverter
+
"]"
);
logger
.
debug
(
"Writing ["
+
requestBody
+
"] as \""
+
requestContentType
+
"\" using ["
+
messageConverter
+
"]"
);
}
else
{
logger
.
debug
(
"Writing ["
+
requestBody
+
"] using ["
+
messageConverter
+
"]"
);
logger
.
debug
(
"Writing ["
+
requestBody
+
"] using ["
+
messageConverter
+
"]"
);
}
}
FeignOutputMessage
outputMessage
=
new
FeignOutputMessage
(
request
);
try
{
((
HttpMessageConverter
<
Object
>)
messageConverter
).
write
(
requestBody
,
requestContentType
,
outputMessage
);
}
catch
(
IOException
e
)
{
@SuppressWarnings
(
"unchecked"
)
HttpMessageConverter
<
Object
>
copy
=
(
HttpMessageConverter
<
Object
>)
messageConverter
;
copy
.
write
(
requestBody
,
requestContentType
,
outputMessage
);
}
catch
(
IOException
e
)
{
throw
new
EncodeException
(
"Error converting request body"
,
e
);
}
request
.
body
(
outputMessage
.
getOutputStream
().
toByteArray
(),
Charsets
.
UTF_8
);
//TODO: set charset
request
.
body
(
outputMessage
.
getOutputStream
().
toByteArray
(),
Charsets
.
UTF_8
);
// TODO: set charset
return
;
}
}
String
message
=
"Could not write request: no suitable HttpMessageConverter found for request type ["
+
requestType
.
getName
()
+
"]"
;
String
message
=
"Could not write request: no suitable HttpMessageConverter found for request type ["
+
requestType
.
getName
()
+
"]"
;
if
(
requestContentType
!=
null
)
{
message
+=
" and content type ["
+
requestContentType
+
"]"
;
}
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringMvcContract.java
View file @
e42328fa
package
org
.
springframework
.
platform
.
netflix
.
feign
;
import
feign.Contract
;
import
feign.MethodMetadata
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
static
feign
.
Util
.
checkState
;
import
static
feign
.
Util
.
emptyToNull
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
import
static
feign
.
Util
.
checkState
;
import
static
feign
.
Util
.
emptyToNull
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
feign.Contract
;
import
feign.MethodMetadata
;
/**
* Created by sgibb on 6/27/14.
...
...
@@ -20,7 +21,6 @@ public class SpringMvcContract extends Contract.BaseContract {
@Override
protected
void
processAnnotationOnMethod
(
MethodMetadata
data
,
Annotation
methodAnnotation
,
Method
method
)
{
Class
<?
extends
Annotation
>
annotationType
=
methodAnnotation
.
annotationType
();
RequestMapping
mapping
=
RequestMapping
.
class
.
cast
(
methodAnnotation
);
if
(
mapping
!=
null
)
{
//HTTP Method
...
...
spring-platform-netflix-core/src/test/resources/application.yml
View file @
e42328fa
...
...
@@ -4,6 +4,8 @@ spring:
application
:
name
:
client
eureka
:
server
:
enabled
:
false
client
:
serviceUrl
:
defaultZone
:
http://localhost:8080/v2/
...
...
spring-platform-netflix-hystrix/pom.xml
View file @
e42328fa
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.springframework.platform
</groupId>
<artifactId>
spring-platform-netflix-hystrix
</artifactId>
<version>
1.0.0.BUILD-SNAPSHOT
</version>
<packaging>
war
</packaging>
<name>
Spring Platform Netflix Hystrix
</name>
<url>
http://projects.spring.io/spring-platform/
</url>
...
...
@@ -17,15 +15,6 @@
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.1
</version>
<configuration>
<source>
1.7
</source>
<target>
1.7
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
...
...
@@ -55,7 +44,10 @@
<dependency>
<groupId>
org.springframework.platform
</groupId>
<artifactId>
spring-platform-netflix-core
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.platform
</groupId>
...
...
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