You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/08/01 17:46:02 UTC
[09/21] incubator-brooklyn git commit: Delete deprecated EntitySpec.id
Delete deprecated EntitySpec.id
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/1b3dc159
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/1b3dc159
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/1b3dc159
Branch: refs/heads/master
Commit: 1b3dc15927929a73862686a4c277f643a3312cb0
Parents: 0835846
Author: Aled Sage <al...@gmail.com>
Authored: Tue Jul 28 22:39:58 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Sat Aug 1 00:13:31 2015 +0100
----------------------------------------------------------------------
.../brooklyn/entity/proxying/EntitySpec.java | 22 --------------------
.../entity/proxying/InternalEntityFactory.java | 15 +++++--------
2 files changed, 5 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b3dc159/api/src/main/java/brooklyn/entity/proxying/EntitySpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/brooklyn/entity/proxying/EntitySpec.java b/api/src/main/java/brooklyn/entity/proxying/EntitySpec.java
index 4d8a643..0706ddc 100644
--- a/api/src/main/java/brooklyn/entity/proxying/EntitySpec.java
+++ b/api/src/main/java/brooklyn/entity/proxying/EntitySpec.java
@@ -133,8 +133,6 @@ public class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,E
return new EntitySpec<T>(type);
}
- private String id;
-
private Class<? extends T> impl;
private Entity parent;
private final Map<String, Object> flags = Maps.newLinkedHashMap();
@@ -166,16 +164,6 @@ public class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,E
}
/**
- * @return The id to use when creating the entity, or null if allow brooklyn to generate a unique id.
- /**
- * @deprecated since 0.7.0; instead let the management context pick a random+unique id
- */
- @Deprecated
- public String getId() {
- return id;
- }
-
- /**
* @return The implementation of the entity; if not null. this overrides any defaults or other configuration
*
* @see ImplementedBy on the entity interface classes for how defaults are defined.
@@ -258,16 +246,6 @@ public class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,E
return locations;
}
- /**
- * @deprecated since 0.7.0; instead let the management context pick a random+unique id
- */
- @Deprecated
- public EntitySpec<T> id(String val) {
- checkMutable();
- id = val;
- return this;
- }
-
public EntitySpec<T> impl(Class<? extends T> val) {
checkMutable();
checkIsImplementation(checkNotNull(val, "impl"), getType());
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b3dc159/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java b/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
index 880d07a..c48c059 100644
--- a/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
+++ b/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
@@ -38,7 +38,6 @@ import brooklyn.entity.basic.BrooklynTaskTags;
import brooklyn.entity.basic.Entities;
import brooklyn.entity.basic.EntityInternal;
import brooklyn.entity.basic.EntityLocal;
-import brooklyn.management.internal.LocalEntityManager;
import brooklyn.management.internal.ManagementContextInternal;
import brooklyn.policy.Enricher;
import brooklyn.policy.EnricherSpec;
@@ -179,7 +178,6 @@ public class InternalEntityFactory extends InternalFactory {
return entity;
}
- @SuppressWarnings("deprecation")
protected <T extends Entity> T createEntityAndDescendantsUninitialized(EntitySpec<T> spec, Map<String,Entity> entitiesByEntityId, Map<String,EntitySpec<?>> specsByEntityId) {
if (spec.getFlags().containsKey("parent") || spec.getFlags().containsKey("owner")) {
throw new IllegalArgumentException("Spec's flags must not contain parent or owner; use spec.parent() instead for "+spec);
@@ -187,12 +185,6 @@ public class InternalEntityFactory extends InternalFactory {
if (spec.getFlags().containsKey("id")) {
throw new IllegalArgumentException("Spec's flags must not contain id; use spec.id() instead for "+spec);
}
- if (spec.getId() != null) {
- log.warn("Use of deprecated EntitySpec.id ({}); instead let management context pick the random+unique id", spec);
- if (((LocalEntityManager)managementContext.getEntityManager()).isKnownEntityId(spec.getId())) {
- throw new IllegalArgumentException("Entity with id "+spec.getId()+" already exists; cannot create new entity with this explicit id from spec "+spec);
- }
- }
try {
Class<? extends T> clazz = getImplementedBy(spec);
@@ -337,8 +329,7 @@ public class InternalEntityFactory extends InternalFactory {
* although for old-style entities flags from the spec are passed to the constructor.
*/
public <T extends Entity> T constructEntity(Class<? extends T> clazz, EntitySpec<T> spec) {
- @SuppressWarnings("deprecation")
- T entity = constructEntityImpl(clazz, spec.getFlags(), spec.getId());
+ T entity = constructEntityImpl(clazz, spec.getFlags());
if (((AbstractEntity)entity).getProxy() == null) ((AbstractEntity)entity).setProxy(createEntityProxy(spec, entity));
return entity;
}
@@ -371,6 +362,10 @@ public class InternalEntityFactory extends InternalFactory {
}
return entity;
}
+
+ protected <T extends Entity> T constructEntityImpl(Class<? extends T> clazz, Map<String, ?> constructionFlags) {
+ return constructEntityImpl(clazz, constructionFlags, null);
+ }
protected <T extends Entity> T constructEntityImpl(Class<? extends T> clazz, Map<String, ?> constructionFlags, String entityId) {
T entity = super.construct(clazz, constructionFlags);