brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [07/18] git commit: Initialize the context catalog item id when adding items to the BO hierarchy.
Date Tue, 04 Nov 2014 14:30:01 GMT
Initialize the context catalog item id when adding items to the BO hierarchy.


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

Branch: refs/heads/master
Commit: 36ee1e0fcb944fa2a3b6265cdad54de3afb8b889
Parents: 246c29d
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Thu Oct 30 15:18:38 2014 +0200
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Fri Oct 31 14:44:41 2014 +0200

----------------------------------------------------------------------
 .../src/main/java/brooklyn/entity/basic/AbstractEntity.java | 4 ++++
 .../brooklyn/entity/proxying/InternalLocationFactory.java   | 5 +++++
 .../brooklyn/entity/proxying/InternalPolicyFactory.java     | 9 +++++++++
 .../java/brooklyn/policy/basic/AbstractEntityAdjunct.java   | 3 +++
 4 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/36ee1e0f/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java b/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java
index 00b58b7..f26ee64 100644
--- a/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java
+++ b/core/src/main/java/brooklyn/entity/basic/AbstractEntity.java
@@ -555,6 +555,10 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements
E
         
         getApplication();
         
+        if (getContextCatalogItemId() == null) {
+            setContextCatalogItemId(entity.getContextCatalogItemId());
+        }
+        
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/36ee1e0f/core/src/main/java/brooklyn/entity/proxying/InternalLocationFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/proxying/InternalLocationFactory.java b/core/src/main/java/brooklyn/entity/proxying/InternalLocationFactory.java
index a5fa6c5..14ea05f 100644
--- a/core/src/main/java/brooklyn/entity/proxying/InternalLocationFactory.java
+++ b/core/src/main/java/brooklyn/entity/proxying/InternalLocationFactory.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import brooklyn.config.ConfigKey;
+import brooklyn.entity.basic.AbstractEntity;
 import brooklyn.location.Location;
 import brooklyn.location.LocationSpec;
 import brooklyn.location.basic.AbstractLocation;
@@ -104,6 +105,10 @@ public class InternalLocationFactory extends InternalFactory {
             if (spec.getDisplayName()!=null)
                 ((AbstractLocation)loc).setDisplayName(spec.getDisplayName());
             
+            if (spec.getContextCatalogItemId()!=null) {
+                ((AbstractLocation)loc).setContextCatalogItemId(spec.getContextCatalogItemId());
+            }
+            
             loc.tags().addTags(spec.getTags());
             
             if (isNewStyle(clazz)) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/36ee1e0f/core/src/main/java/brooklyn/entity/proxying/InternalPolicyFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/proxying/InternalPolicyFactory.java b/core/src/main/java/brooklyn/entity/proxying/InternalPolicyFactory.java
index 10bc83b..c5785ca 100644
--- a/core/src/main/java/brooklyn/entity/proxying/InternalPolicyFactory.java
+++ b/core/src/main/java/brooklyn/entity/proxying/InternalPolicyFactory.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import brooklyn.config.ConfigKey;
 import brooklyn.enricher.basic.AbstractEnricher;
 import brooklyn.entity.Feed;
+import brooklyn.entity.basic.AbstractEntity;
 import brooklyn.management.ManagementContext;
 import brooklyn.management.internal.ManagementContextInternal;
 import brooklyn.policy.Enricher;
@@ -106,6 +107,10 @@ public class InternalPolicyFactory extends InternalFactory {
             if (spec.getDisplayName()!=null)
                 ((AbstractPolicy)pol).setDisplayName(spec.getDisplayName());
             
+            if (spec.getContextCatalogItemId()!=null) {
+                ((AbstractPolicy)pol).setContextCatalogItemId(spec.getContextCatalogItemId());
+            }
+            
             pol.tags().addTags(spec.getTags());
             
             if (isNewStyle(clazz)) {
@@ -143,6 +148,10 @@ public class InternalPolicyFactory extends InternalFactory {
             if (spec.getDisplayName()!=null)
                 ((AbstractEnricher)enricher).setDisplayName(spec.getDisplayName());
             
+            if (spec.getContextCatalogItemId()!=null) {
+                ((AbstractEnricher)enricher).setContextCatalogItemId(spec.getContextCatalogItemId());
+            }
+            
             enricher.tags().addTags(spec.getTags());
             
             if (isNewStyle(clazz)) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/36ee1e0f/core/src/main/java/brooklyn/policy/basic/AbstractEntityAdjunct.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/policy/basic/AbstractEntityAdjunct.java b/core/src/main/java/brooklyn/policy/basic/AbstractEntityAdjunct.java
index 9dd3e9a..a7d8892 100644
--- a/core/src/main/java/brooklyn/policy/basic/AbstractEntityAdjunct.java
+++ b/core/src/main/java/brooklyn/policy/basic/AbstractEntityAdjunct.java
@@ -238,6 +238,9 @@ public abstract class AbstractEntityAdjunct extends AbstractBrooklynObject
imple
     public void setEntity(EntityLocal entity) {
         if (destroyed.get()) throw new IllegalStateException("Cannot set entity on a destroyed
entity adjunct");
         this.entity = entity;
+        if (getContextCatalogItemId() == null) {
+            setContextCatalogItemId(entity.getContextCatalogItemId());
+        }
     }
     
     /** @deprecated since 0.7.0 only {@link AbstractEnricher} has emit convenience */


Mime
View raw message