brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreatu...@apache.org
Subject [2/5] brooklyn-server git commit: EntityDetail sets applicationId, iconUrl, service state and service up
Date Thu, 11 Feb 2016 19:13:24 GMT
EntityDetail sets applicationId, iconUrl, service state and service up


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

Branch: refs/heads/master
Commit: feab40025dcb32ac6e41a4a4812b19988699ec56
Parents: 14bd340
Author: Andrea Turli <andrea.turli@gmail.com>
Authored: Thu Feb 11 18:12:20 2016 +0100
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Thu Feb 11 18:22:16 2016 +0000

----------------------------------------------------------------------
 .../brooklyn/rest/domain/EntityDetail.java      | 40 ++++++++++---
 .../rest/resources/ApplicationResource.java     | 60 +++++++++++---------
 2 files changed, 66 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/feab4002/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java
----------------------------------------------------------------------
diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java
index 830c0b1..567c40b 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java
@@ -18,27 +18,32 @@
  */
 package org.apache.brooklyn.rest.domain;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.google.common.collect.ImmutableList;
+import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 
 public class EntityDetail extends EntitySummary {
 
     private static final long serialVersionUID = 100490507982229165L;
 
+    private final String applicationId;
     private final String parentId;
     @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
     private final List<EntitySummary> children;
     private final List<String> groupIds;
     private final List<Map<String, String>> members;
+    private final Boolean serviceUp;
+    private final Lifecycle serviceState;
+    private final String iconUrl;
 
     public EntityDetail(
+            @JsonProperty("applicationId") String applicationId,
             @JsonProperty("id") String id,
             @JsonProperty("parentId") String parentId,
             @JsonProperty("name") String name,
@@ -50,17 +55,25 @@ public class EntityDetail extends EntitySummary {
             @JsonProperty("children") List<EntitySummary> children,
             @JsonProperty("groupIds") List<String> groupIds,
             @JsonProperty("members") List<Map<String, String>> members) {
-        super(id, name, type, catalogItemId, null);
+        super(id, name, type, catalogItemId, Collections.<String, URI>emptyMap());
+        this.applicationId = applicationId;
+        this.iconUrl = iconUrl;
         this.parentId = parentId;
         this.children = (children == null) ? ImmutableList.<EntitySummary>of() : ImmutableList.copyOf(children);
         this.groupIds = (groupIds == null) ? ImmutableList.<String>of() : ImmutableList.copyOf(groupIds);
-        this.members = (members == null) ? ImmutableList.<Map<String,String>>of()
: ImmutableList.copyOf(members);
+        this.members = (members == null) ? ImmutableList.<Map<String, String>>of()
: ImmutableList.copyOf(members);
+        this.serviceState = serviceState;
+        this.serviceUp = serviceUp;
     }
 
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
 
+    public String getApplicationId() {
+        return applicationId;
+    }
+
     public String getParentId() {
         return parentId;
     }
@@ -77,4 +90,15 @@ public class EntityDetail extends EntitySummary {
         return members;
     }
 
+    public Boolean getServiceUp() {
+        return serviceUp;
+    }
+
+    public Lifecycle getServiceState() {
+        return serviceState;
+    }
+
+    public String getIconUrl() {
+        return iconUrl;
+    }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/feab4002/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
b/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
index 97ed1d9..1dbf1a8 100644
--- a/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
+++ b/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
@@ -18,24 +18,11 @@
  */
 package org.apache.brooklyn.rest.resources;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static javax.ws.rs.core.Response.created;
-import static javax.ws.rs.core.Response.status;
-import static javax.ws.rs.core.Response.Status.ACCEPTED;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.UriInfo;
-
+import com.google.common.base.Throwables;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 import org.apache.brooklyn.api.entity.Application;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.EntitySpec;
@@ -83,11 +70,22 @@ import org.apache.brooklyn.util.text.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Throwables;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.UriInfo;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static javax.ws.rs.core.Response.Status.ACCEPTED;
+import static javax.ws.rs.core.Response.created;
+import static javax.ws.rs.core.Response.status;
 
 @HaHotStateRequired
 public class ApplicationResource extends AbstractBrooklynRestResource implements ApplicationApi
{
@@ -134,9 +132,19 @@ public class ApplicationResource extends AbstractBrooklynRestResource
implements
                 members.addAll(entitiesIdAndNameAsList(memberEntities));
         }
 
-        return new EntityDetail(entity.getId(), parentId, entity.getDisplayName(),
-                entity.getEntityType().getName(), serviceUp, serviceState, iconUrl, entity.getCatalogItemId(),
-                children, groupIds, members);
+        return new EntityDetail(
+                entity.getApplicationId(),
+                entity.getId(),
+                parentId,
+                entity.getDisplayName(),
+                entity.getEntityType().getName(),
+                serviceUp,
+                serviceState,
+                iconUrl,
+                entity.getCatalogItemId(),
+                children,
+                groupIds,
+                members);
     }
 
     private List<Map<String, String>> entitiesIdAndNameAsList(Collection<?
extends Entity> entities) {


Mime
View raw message