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/10/15 18:16:46 UTC

[5/7] incubator-brooklyn git commit: [BROOKLYN-182] Decouple ReflectiveEntityDriverFactory from WinRmMachineLocation

[BROOKLYN-182] Decouple ReflectiveEntityDriverFactory from WinRmMachineLocation

Remove compile-time dependency towards WinRmMachineLocation, with the
later purpose of allowing the driver factory to be initialized from
higher-level code.


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

Branch: refs/heads/master
Commit: 0ded95c049f4f41356b3fa8e7f47c7feeff86402
Parents: 2cb87d3
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Wed Oct 14 18:58:41 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Wed Oct 14 23:36:38 2015 +0300

----------------------------------------------------------------------
 .../core/entity/drivers/ReflectiveEntityDriverFactory.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0ded95c0/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java b/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
index 19973f2..f9cf5a7 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/drivers/ReflectiveEntityDriverFactory.java
@@ -30,7 +30,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.location.paas.PaasLocation;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.exceptions.Exceptions;
@@ -192,7 +191,12 @@ public class ReflectiveEntityDriverFactory {
         @Override
         public <D extends EntityDriver> String inferDriverClassName(DriverDependentEntity<D> entity, Class<D> driverInterface, Location location) {
             String driverInterfaceName = driverInterface.getName();
-            if (!(location instanceof WinRmMachineLocation)) return null;
+            // TODO: use a proper registry later on
+            try {
+                if (!Class.forName("org.apache.brooklyn.location.winrm.WinRmMachineLocation").isInstance(location)) return null;
+            } catch (ClassNotFoundException ex) {
+                return null;
+            }
             if (!driverInterfaceName.endsWith("Driver")) {
                 throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect WinRmDriver class name", driverInterfaceName));
             }