You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/07/09 23:46:49 UTC

[36/50] git commit: Add the classloader as per Aled's suggestion.

Add the classloader as per Aled's suggestion.


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

Branch: refs/heads/master
Commit: 0f2e2c374fd032235ad4365a706f50dbf20aa3af
Parents: 8e57fb0
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue Jul 8 15:06:12 2014 +0300
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Jul 9 22:34:46 2014 +0100

----------------------------------------------------------------------
 .../main/java/brooklyn/entity/proxying/InternalEntityFactory.java  | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0f2e2c37/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 935f55e..df73423 100644
--- a/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
+++ b/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
@@ -129,6 +129,7 @@ public class InternalEntityFactory {
     public <T extends Entity> T createEntityProxy(EntitySpec<T> spec, T entity) {
         // TODO Don't want the proxy to have to implement EntityLocal, but required by how 
         // AbstractEntity.parent is used (e.g. parent.getAllConfig)
+        ClassLoader classloader = (spec.getImplementation() != null ? spec.getImplementation() : spec.getType()).getClassLoader();
         MutableSet.Builder<Class<?>> builder = MutableSet.<Class<?>>builder()
                 .add(EntityProxy.class, Entity.class, EntityLocal.class, EntityInternal.class);
         if (spec.getType().isInterface()) {
@@ -146,6 +147,7 @@ public class InternalEntityFactory {
         // Building our own aggregating class loader gets around this.
         // But we really should not have to do this! What are the consequences?
         AggregateClassLoader aggregateClassLoader =  AggregateClassLoader.newInstanceWithNoLoaders();
+        aggregateClassLoader.addFirst(classloader);
         aggregateClassLoader.addFirst(entity.getClass().getClassLoader());
         for(Class<?> iface : interfaces) {
             aggregateClassLoader.addLast(iface.getClassLoader());