Commit e42328fa by Dave Syer

Fix compiler warnings

parent 0f85b5ac
......@@ -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>
......
......@@ -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>
......
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.
*/
......
......@@ -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();
}
}
......@@ -70,7 +70,7 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
}
@Override
public Class<? extends Endpoint> getEndpointType() {
public Class<? extends Endpoint<?>> getEndpointType() {
return null;
}
}
/*
* 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);
}
}
......@@ -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();
}
......
/*
* 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);
}
}
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());
......
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.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.List;
import feign.FeignException;
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();
}
}
......
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 + "]";
}
......
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
......
......@@ -4,6 +4,8 @@ spring:
application:
name: client
eureka:
server:
enabled: false
client:
serviceUrl:
defaultZone: http://localhost:8080/v2/
......
<?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>
......
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