You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/06/19 15:39:49 UTC

[5/6] incubator-brooklyn git commit: remove core dependency

remove core dependency


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/65d0b722
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/65d0b722
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/65d0b722

Branch: refs/heads/master
Commit: 65d0b722c2b9d65af085acc480565f877a17ab45
Parents: aa5dc0d
Author: Robert Moss <ro...@gmail.com>
Authored: Fri Jun 19 13:35:10 2015 +0100
Committer: Robert Moss <ro...@gmail.com>
Committed: Fri Jun 19 13:35:10 2015 +0100

----------------------------------------------------------------------
 usage/rest-client/pom.xml                                    | 6 ------
 .../src/main/java/brooklyn/rest/client/BrooklynApi.java      | 8 ++++----
 2 files changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/65d0b722/usage/rest-client/pom.xml
----------------------------------------------------------------------
diff --git a/usage/rest-client/pom.xml b/usage/rest-client/pom.xml
index 30796b3..9149c30 100644
--- a/usage/rest-client/pom.xml
+++ b/usage/rest-client/pom.xml
@@ -119,12 +119,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${project.version}</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
             <artifactId>brooklyn-rest-server</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/65d0b722/usage/rest-client/src/main/java/brooklyn/rest/client/BrooklynApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-client/src/main/java/brooklyn/rest/client/BrooklynApi.java b/usage/rest-client/src/main/java/brooklyn/rest/client/BrooklynApi.java
index cabdcd2..408addd 100644
--- a/usage/rest-client/src/main/java/brooklyn/rest/client/BrooklynApi.java
+++ b/usage/rest-client/src/main/java/brooklyn/rest/client/BrooklynApi.java
@@ -34,7 +34,6 @@ import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.Credentials;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.eclipse.jetty.util.log.Log;
 import org.jboss.resteasy.client.ClientExecutor;
 import org.jboss.resteasy.client.ClientRequest;
 import org.jboss.resteasy.client.ClientResponse;
@@ -62,7 +61,6 @@ import brooklyn.rest.api.UsageApi;
 import brooklyn.rest.api.VersionApi;
 import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.http.BuiltResponsePreservingError;
-import brooklyn.util.http.HttpTool;
 
 import com.wordnik.swagger.core.ApiOperation;
 
@@ -130,7 +128,7 @@ public class BrooklynApi {
                     Class<?> type = String.class;
                     if (result1 instanceof Response) {
                         Response resp = (Response)result1;
-                        if(HttpTool.isStatusCodeHealthy(resp.getStatus()) && method.isAnnotationPresent(ApiOperation.class)) {
+                        if(isStatusCodeHealthy(resp.getStatus()) && method.isAnnotationPresent(ApiOperation.class)) {
                            type = getClassFromMethodAnnotationOrDefault(method, type);
                         }
                         // wrap the original response so it self-closes
@@ -146,6 +144,8 @@ public class BrooklynApi {
                 }  
             }
             
+            private boolean isStatusCodeHealthy(int code) { return (code>=200 && code<=299); }
+            
             private Class<?> getClassFromMethodAnnotationOrDefault(Method method, Class<?> def){
                 Class<?> type;
                 try{
@@ -153,7 +153,7 @@ public class BrooklynApi {
                     type = Class.forName(responseClass);
                 } catch (Exception e) {
                     type = def;
-                    LOG.info("Unable to get class from annotation: {}.  Defaulting to {}", e.getMessage(), def.getName());
+                    LOG.debug("Unable to get class from annotation: {}.  Defaulting to {}", e.getMessage(), def.getName());
                     Exceptions.propagateIfFatal(e);
                 }
                 return type;