brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [05/21] incubator-brooklyn git commit: Parameters rebind support
Date Mon, 09 Nov 2015 12:55:14 GMT
Parameters rebind support


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

Branch: refs/heads/master
Commit: 39656383992dfddb8cf5db1a59e8f60dbb7e63a0
Parents: f035200
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Tue Nov 3 17:30:13 2015 +0200
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Thu Nov 5 15:23:38 2015 +0200

----------------------------------------------------------------------
 .../rebind/mementos/CatalogItemMemento.java     |  4 ++++
 .../rebind/BasicCatalogItemRebindSupport.java   |  1 +
 .../rebind/dto/BasicCatalogItemMemento.java     | 24 +++++++++++++++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/39656383/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
index ad16b4a..57fbb8d 100644
--- a/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
+++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/rebind/mementos/CatalogItemMemento.java
@@ -19,8 +19,10 @@
 package org.apache.brooklyn.api.mgmt.rebind.mementos;
 
 import java.util.Collection;
+import java.util.List;
 
 import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.objs.SpecParameter;
 
 public interface CatalogItemMemento extends Memento {
 
@@ -36,6 +38,8 @@ public interface CatalogItemMemento extends Memento {
 
     String getJavaType();
 
+    List<SpecParameter<?>> getParameters();
+
     Collection<CatalogItem.CatalogBundle> getLibraries();
 
     CatalogItem.CatalogItemType getCatalogItemType();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/39656383/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java
b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java
index c8f2dfc..614b085 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java
@@ -48,6 +48,7 @@ public class BasicCatalogItemRebindSupport extends AbstractBrooklynObjectRebindS
                 .put("description", memento.getDescription())
                 .put("iconUrl", memento.getIconUrl())
                 .put("version", memento.getVersion())
+                .put("parameters", memento.getParameters())
                 .put("libraries", memento.getLibraries())
                 .put("planYaml", memento.getPlanYaml())
                 .put("deprecated", memento.isDeprecated())

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/39656383/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java
b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java
index be21dde..bf252e0 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java
@@ -21,16 +21,19 @@ package org.apache.brooklyn.core.mgmt.rebind.dto;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 
-import org.codehaus.jackson.annotate.JsonAutoDetect;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento;
+import org.apache.brooklyn.api.objs.SpecParameter;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
 
 import com.google.common.base.Joiner;
 import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
 
 @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE)
 public class BasicCatalogItemMemento extends AbstractMemento implements CatalogItemMemento,
Serializable {
@@ -48,6 +51,7 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
         protected String javaType;
         protected String version;
         protected String planYaml;
+        protected List<SpecParameter<?>> parameters;
         protected Collection<CatalogItem.CatalogBundle> libraries;
         protected CatalogItem.CatalogItemType catalogItemType;
         protected Class<?> catalogItemJavaType;
@@ -85,6 +89,11 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
             return self();
         }
 
+        public Builder parameters(List<SpecParameter<?>> params) {
+            this.parameters = params;
+            return self();
+        }
+
         public Builder libraries(Collection<CatalogItem.CatalogBundle> libraries) {
             this.libraries = libraries;
             return self();
@@ -123,6 +132,7 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
             javaType = other.getJavaType();
             version = other.getVersion();
             planYaml = other.getPlanYaml();
+            parameters = other.getParameters();
             libraries = other.getLibraries();
             catalogItemType = other.getCatalogItemType();
             catalogItemJavaType = other.getCatalogItemJavaType();
@@ -143,6 +153,7 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
     private String javaType;
     private String version;
     private String planYaml;
+    private List<SpecParameter<?>> parameters;
     private Collection<CatalogItem.CatalogBundle> libraries;
     private CatalogItem.CatalogItemType catalogItemType;
     private Class<?> catalogItemJavaType;
@@ -160,6 +171,7 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
         this.iconUrl = builder.iconUrl;
         this.version = builder.version;
         this.planYaml = builder.planYaml;
+        this.parameters = builder.parameters;
         this.libraries = builder.libraries;
         this.catalogItemJavaType = builder.catalogItemJavaType;
         this.catalogItemType = builder.catalogItemType;
@@ -209,6 +221,15 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
     }
 
     @Override
+    public List<SpecParameter<?>> getParameters() {
+        if (parameters != null) {
+            return parameters;
+        } else {
+            return ImmutableList.of();
+        }
+    }
+
+    @Override
     public Collection<CatalogItem.CatalogBundle> getLibraries() {
         return libraries;
     }
@@ -259,6 +280,7 @@ public class BasicCatalogItemMemento extends AbstractMemento implements
CatalogI
                 .add("iconUrl", getIconUrl())
                 .add("version", getVersion())
                 .add("planYaml", getPlanYaml())
+                .add("parameters", getParameters())
                 .add("libraries", getLibraries())
                 .add("catalogItemJavaType", getCatalogItemJavaType())
                 .add("catalogItemType", getCatalogItemType())


Mime
View raw message